[41] | 1 | ; File name : MenuTime.asm
|
---|
| 2 | ; Project name : Assembly Library
|
---|
| 3 | ; Created date : 25.7.2010
|
---|
[60] | 4 | ; Last update : 25.11.2010
|
---|
[41] | 5 | ; Author : Tomi Tilli
|
---|
| 6 | ; Description : Menu timeouts other time related functions.
|
---|
| 7 |
|
---|
| 8 | ; Section containing code
|
---|
| 9 | SECTION .text
|
---|
| 10 |
|
---|
| 11 | ;--------------------------------------------------------------------
|
---|
[60] | 12 | ; MenuTime_StartSelectionTimeoutWithTicksInAX
|
---|
[41] | 13 | ; Parameters
|
---|
[60] | 14 | ; AX: Timeout ticks
|
---|
[41] | 15 | ; SS:BP: Ptr to MENU
|
---|
| 16 | ; Returns:
|
---|
| 17 | ; Nothing
|
---|
| 18 | ; Corrupts registers:
|
---|
[60] | 19 | ; AX, BX
|
---|
[41] | 20 | ;--------------------------------------------------------------------
|
---|
| 21 | ALIGN JUMP_ALIGN
|
---|
[60] | 22 | MenuTime_StartSelectionTimeoutWithTicksInAX:
|
---|
| 23 | push ds
|
---|
| 24 | call PointDSBXtoTimeoutCounter
|
---|
| 25 | call TimerTicks_InitializeTimeoutFromAX
|
---|
| 26 | or BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
|
---|
| 27 | pop ds
|
---|
[41] | 28 | ret
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | ;--------------------------------------------------------------------
|
---|
[60] | 32 | ; MenuTime_StopSelectionTimeout
|
---|
[41] | 33 | ; Parameters
|
---|
| 34 | ; SS:BP: Ptr to MENU
|
---|
| 35 | ; Returns:
|
---|
| 36 | ; Nothing
|
---|
| 37 | ; Corrupts registers:
|
---|
[60] | 38 | ; AX, BX, DX, SI, DI
|
---|
[41] | 39 | ;--------------------------------------------------------------------
|
---|
| 40 | ALIGN JUMP_ALIGN
|
---|
[60] | 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:
|
---|
[41] | 48 | ret
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | ;--------------------------------------------------------------------
|
---|
| 52 | ; MenuTime_UpdateSelectionTimeout
|
---|
| 53 | ; Parameters
|
---|
| 54 | ; SS:BP: Ptr to MENU
|
---|
| 55 | ; Returns:
|
---|
| 56 | ; CF: Set if timeout
|
---|
| 57 | ; Cleared if time left
|
---|
| 58 | ; Corrupts registers:
|
---|
[60] | 59 | ; AX, BX, SI, DI
|
---|
[41] | 60 | ;--------------------------------------------------------------------
|
---|
| 61 | ALIGN JUMP_ALIGN
|
---|
| 62 | MenuTime_UpdateSelectionTimeout:
|
---|
[60] | 63 | test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
|
---|
| 64 | jz SHORT .ReturnSinceTimeoutDisabled
|
---|
| 65 |
|
---|
[41] | 66 | push ds
|
---|
[45] | 67 | call PointDSBXtoTimeoutCounter
|
---|
[60] | 68 | call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
|
---|
[41] | 69 | pop ds
|
---|
[60] | 70 | jnc SHORT .RedrawSinceNoTimeout
|
---|
| 71 | and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
|
---|
| 72 | stc
|
---|
[41] | 73 | ret
|
---|
| 74 |
|
---|
| 75 | ALIGN JUMP_ALIGN
|
---|
[60] | 76 | .RedrawSinceNoTimeout:
|
---|
| 77 | call MenuBorders_RedrawTimeoutValue
|
---|
| 78 | clc
|
---|
| 79 | ALIGN JUMP_ALIGN
|
---|
[41] | 80 | .ReturnSinceTimeoutDisabled:
|
---|
| 81 | ret
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | ;--------------------------------------------------------------------
|
---|
[60] | 85 | ; MenuTime_GetTimeoutSecondsLeftToAX
|
---|
[41] | 86 | ; Parameters
|
---|
| 87 | ; SS:BP: Ptr to MENU
|
---|
| 88 | ; Returns:
|
---|
[45] | 89 | ; AX: Seconds until timeout
|
---|
[41] | 90 | ; Corrupts registers:
|
---|
[60] | 91 | ; AX
|
---|
[41] | 92 | ;--------------------------------------------------------------------
|
---|
| 93 | ALIGN JUMP_ALIGN
|
---|
[60] | 94 | MenuTime_GetTimeoutSecondsLeftToAX:
|
---|
| 95 | push ds
|
---|
| 96 | push dx
|
---|
| 97 | push cx
|
---|
| 98 | push bx
|
---|
| 99 |
|
---|
[45] | 100 | call PointDSBXtoTimeoutCounter
|
---|
[60] | 101 | call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
|
---|
| 102 | jc SHORT .TimeoutHasOccurred
|
---|
| 103 |
|
---|
[45] | 104 | xchg dx, ax
|
---|
[60] | 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
|
---|
[41] | 117 |
|
---|
| 118 |
|
---|
| 119 | ;--------------------------------------------------------------------
|
---|
[45] | 120 | ; PointDSBXtoTimeoutCounter
|
---|
[41] | 121 | ; Parameters
|
---|
| 122 | ; SS:BP: Ptr to MENU
|
---|
| 123 | ; Returns:
|
---|
| 124 | ; DS:BX: Ptr to timeout counter
|
---|
| 125 | ; Corrupts registers:
|
---|
[45] | 126 | ; Nothing
|
---|
[41] | 127 | ;--------------------------------------------------------------------
|
---|
| 128 | ALIGN JUMP_ALIGN
|
---|
[45] | 129 | PointDSBXtoTimeoutCounter:
|
---|
| 130 | push ss
|
---|
| 131 | pop ds
|
---|
| 132 | lea bx, [bp+MENU.wTimeoutCounter]
|
---|
| 133 | ret
|
---|