Changeset 60 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu/MenuTime.asm
- Timestamp:
- Nov 25, 2010, 2:17:45 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Menu/MenuTime.asm
r47 r60 2 2 ; Project name : Assembly Library 3 3 ; Created date : 25.7.2010 4 ; Last update : 4.10.20104 ; Last update : 25.11.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Menu timeouts other time related functions. … … 10 10 11 11 ;-------------------------------------------------------------------- 12 ; MenuTime_S etSelectionTimeoutValueFromAX12 ; MenuTime_StartSelectionTimeoutWithTicksInAX 13 13 ; Parameters 14 ; AX: Selection timeout in system timer ticks 15 ; SS:BP: Ptr to MENU 16 ; Returns: 17 ; Nothing 18 ; Corrupts registers: 19 ; Nothing 20 ;-------------------------------------------------------------------- 21 ALIGN JUMP_ALIGN 22 MenuTime_SetSelectionTimeoutValueFromAX: 23 mov [bp+MENUINIT.wTimeoutTicks], ax 24 ret 25 26 27 ;-------------------------------------------------------------------- 28 ; MenuTime_RestartSelectionTimeout 29 ; Parameters 14 ; AX: Timeout ticks 30 15 ; SS:BP: Ptr to MENU 31 16 ; Returns: … … 35 20 ;-------------------------------------------------------------------- 36 21 ALIGN JUMP_ALIGN 37 MenuTime_ RestartSelectionTimeout:22 MenuTime_StartSelectionTimeoutWithTicksInAX: 38 23 push ds 39 24 call PointDSBXtoTimeoutCounter 40 mov ax, [bp+MENUINIT.wTimeoutTicks]41 call TimerTicks_InitializeTimeoutFromAX ; End time to [DS:BX]25 call TimerTicks_InitializeTimeoutFromAX 26 or BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN 42 27 pop ds 28 ret 29 30 31 ;-------------------------------------------------------------------- 32 ; MenuTime_StopSelectionTimeout 33 ; Parameters 34 ; SS:BP: Ptr to MENU 35 ; Returns: 36 ; Nothing 37 ; Corrupts registers: 38 ; AX, BX, DX, SI, DI 39 ;-------------------------------------------------------------------- 40 ALIGN JUMP_ALIGN 41 MenuTime_StopSelectionTimeout: 42 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN 43 jz SHORT .TimeoutAlreadyStopped 44 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN 45 jmp MenuBorders_RedrawBottomBorderLine 46 ALIGN JUMP_ALIGN 47 .TimeoutAlreadyStopped: 43 48 ret 44 49 … … 52 57 ; Cleared if time left 53 58 ; Corrupts registers: 54 ; AX, BX, CX, DX,SI, DI59 ; AX, BX, SI, DI 55 60 ;-------------------------------------------------------------------- 56 61 ALIGN JUMP_ALIGN 57 62 MenuTime_UpdateSelectionTimeout: 63 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN 64 jz SHORT .ReturnSinceTimeoutDisabled 65 58 66 push ds 59 60 call MenuTime_DrawWithoutUpdating61 jnc SHORT .TimeoutDisabled62 67 call PointDSBXtoTimeoutCounter 63 call TimerTicks_SetCarryIfTimeoutFromDSBX 68 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX 69 pop ds 70 jnc SHORT .RedrawSinceNoTimeout 71 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN 72 stc 73 ret 64 74 65 75 ALIGN JUMP_ALIGN 66 .TimeoutDisabled: 67 pop ds 68 ret 69 70 ;-------------------------------------------------------------------- 71 ; MenuTime_DrawWithoutUpdating 72 ; Parameters 73 ; SS:BP: Ptr to MENU 74 ; Returns: 75 ; CF: Set if timeout enabled 76 ; Cleared if timeout disabled 77 ; Corrupts registers: 78 ; AX, BX, CX, DX, SI, DI 79 ;-------------------------------------------------------------------- 76 .RedrawSinceNoTimeout: 77 call MenuBorders_RedrawTimeoutValue 78 clc 80 79 ALIGN JUMP_ALIGN 81 MenuTime_DrawWithoutUpdating:82 cmp WORD [bp+MENUINIT.wTimeoutTicks], BYTE 083 je SHORT .ReturnSinceTimeoutDisabled ; Clear CF84 85 push ds86 call GetSecondsLeftUntilTimeoutToAXandCounterToDSBX87 call DrawTimeoutInAXoverMenuBorders88 pop ds89 stc90 ALIGN JUMP_ALIGN, ret91 80 .ReturnSinceTimeoutDisabled: 92 81 ret … … 94 83 95 84 ;-------------------------------------------------------------------- 96 ; GetSecondsLeftUntilTimeoutToAXandCounterToDSBX85 ; MenuTime_GetTimeoutSecondsLeftToAX 97 86 ; Parameters 98 87 ; SS:BP: Ptr to MENU 99 88 ; Returns: 100 89 ; AX: Seconds until timeout 101 ; DS:BX: Ptr to timeout counter102 90 ; Corrupts registers: 103 ; AX , CX, DX91 ; AX 104 92 ;-------------------------------------------------------------------- 105 93 ALIGN JUMP_ALIGN 106 GetSecondsLeftUntilTimeoutToAXandCounterToDSBX: 94 MenuTime_GetTimeoutSecondsLeftToAX: 95 push ds 96 push dx 97 push cx 98 push bx 99 107 100 call PointDSBXtoTimeoutCounter 108 call TimerTicks_Get ElapsedToAXfromDSBX109 neg ax ; Negate since DS:BX points to end time110 MAX_S ax, 0 ; Set to zero if overflow 101 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX 102 jc SHORT .TimeoutHasOccurred 103 111 104 xchg dx, ax 112 jmp TimerTicks_GetSecondsToAXfromTicksInDX 105 call TimerTicks_GetSecondsToAXfromTicksInDX 106 clc 107 jmp SHORT .PopRegistersAndReturn 108 .TimeoutHasOccurred: 109 xor ax, ax 110 stc 111 .PopRegistersAndReturn: 112 pop bx 113 pop cx 114 pop dx 115 pop ds 116 ret 113 117 114 118 … … 128 132 lea bx, [bp+MENU.wTimeoutCounter] 129 133 ret 130 131 132 ;--------------------------------------------------------------------133 ; DrawTimeoutInAXoverMenuBorders134 ; Parameters135 ; AX: Seconds to draw136 ; SS:BP: Ptr to MENU137 ; Returns:138 ; Nothing139 ; Corrupts registers:140 ; AX, CX, DX, SI, DI141 ;--------------------------------------------------------------------142 ALIGN JUMP_ALIGN143 DrawTimeoutInAXoverMenuBorders:144 xchg cx, ax145 call MenuBorders_AdjustDisplayContextForDrawingBorders146 call MenuLocation_GetBottomBordersTopLeftCoordinatesToAX147 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX148 ; Fall to .PrintTimeoutStringWithSecondsInDX149 150 ;--------------------------------------------------------------------151 ; .PrintTimeoutStringWithSecondsInDX152 ; Parameters153 ; CX: Seconds to print154 ; SS:BP: Ptr to MENU155 ; Returns:156 ; Nothing157 ; Corrupts registers:158 ; AX, DX, SI, DI159 ;--------------------------------------------------------------------160 ;ALIGN JUMP_ALIGN161 .PrintTimeoutStringWithSecondsInDX:162 push bp163 164 mov bp, sp165 call .GetTimeoutAttributeToAXfromSecondsInCX166 mov si, .szSelectionTimeout167 push ax ; Push attribute168 push cx ; Push seconds169 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI170 pop bp171 172 ; Draw right border with normal border color173 mov al, DOUBLE_RIGHT_HORIZONTAL_TO_SINGLE_VERTICAL174 jmp MenuBorders_PrintSingleBorderCharacterFromAL175 .szSelectionTimeout:176 db DOUBLE_BOTTOM_LEFT_CORNER177 db DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL178 db "%AAutoselection in %2u s",NULL179 180 ;--------------------------------------------------------------------181 ; .GetTimeoutAttributeToAXfromSecondsInCX182 ; Parameters183 ; CX: Seconds to print184 ; Returns:185 ; AX: Attribute byte for seconds186 ; CX: Seconds to print187 ; Corrupts registers:188 ; SI, DI189 ;--------------------------------------------------------------------190 ALIGN JUMP_ALIGN191 .GetTimeoutAttributeToAXfromSecondsInCX:192 mov si, ATTRIBUTE_CHARS.cNormalTimeout193 cmp cx, BYTE 3194 ja SHORT .GetAttributeToAX195 add si, BYTE ATTRIBUTE_CHARS.cHurryTimeout - ATTRIBUTE_CHARS.cNormalTimeout196 ALIGN JUMP_ALIGN197 .GetAttributeToAX:198 jmp MenuAttribute_GetToAXfromTypeInSI
Note:
See TracChangeset
for help on using the changeset viewer.