[41] | 1 | ; Project name : Assembly Library |
---|
| 2 | ; Description : Menu timeouts other time related functions. |
---|
| 3 | |
---|
| 4 | ; Section containing code |
---|
| 5 | SECTION .text |
---|
| 6 | |
---|
| 7 | ;-------------------------------------------------------------------- |
---|
[60] | 8 | ; MenuTime_StartSelectionTimeoutWithTicksInAX |
---|
[41] | 9 | ; Parameters |
---|
[60] | 10 | ; AX: Timeout ticks |
---|
[41] | 11 | ; SS:BP: Ptr to MENU |
---|
| 12 | ; Returns: |
---|
| 13 | ; Nothing |
---|
| 14 | ; Corrupts registers: |
---|
[60] | 15 | ; AX, BX |
---|
[41] | 16 | ;-------------------------------------------------------------------- |
---|
| 17 | ALIGN JUMP_ALIGN |
---|
[60] | 18 | MenuTime_StartSelectionTimeoutWithTicksInAX: |
---|
| 19 | push ds |
---|
| 20 | call PointDSBXtoTimeoutCounter |
---|
| 21 | call TimerTicks_InitializeTimeoutFromAX |
---|
| 22 | or BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN |
---|
| 23 | pop ds |
---|
[41] | 24 | ret |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | ;-------------------------------------------------------------------- |
---|
[60] | 28 | ; MenuTime_StopSelectionTimeout |
---|
[41] | 29 | ; Parameters |
---|
| 30 | ; SS:BP: Ptr to MENU |
---|
| 31 | ; Returns: |
---|
| 32 | ; Nothing |
---|
| 33 | ; Corrupts registers: |
---|
[60] | 34 | ; AX, BX, DX, SI, DI |
---|
[41] | 35 | ;-------------------------------------------------------------------- |
---|
| 36 | ALIGN JUMP_ALIGN |
---|
[60] | 37 | MenuTime_StopSelectionTimeout: |
---|
| 38 | test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN |
---|
[105] | 39 | jz SHORT TimeoutAlreadyStopped |
---|
[60] | 40 | and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN |
---|
| 41 | jmp MenuBorders_RedrawBottomBorderLine |
---|
[41] | 42 | |
---|
| 43 | |
---|
| 44 | ;-------------------------------------------------------------------- |
---|
| 45 | ; MenuTime_UpdateSelectionTimeout |
---|
| 46 | ; Parameters |
---|
| 47 | ; SS:BP: Ptr to MENU |
---|
| 48 | ; Returns: |
---|
| 49 | ; CF: Set if timeout |
---|
| 50 | ; Cleared if time left |
---|
| 51 | ; Corrupts registers: |
---|
[60] | 52 | ; AX, BX, SI, DI |
---|
[41] | 53 | ;-------------------------------------------------------------------- |
---|
| 54 | ALIGN JUMP_ALIGN |
---|
| 55 | MenuTime_UpdateSelectionTimeout: |
---|
[60] | 56 | test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN |
---|
| 57 | jz SHORT .ReturnSinceTimeoutDisabled |
---|
| 58 | |
---|
[41] | 59 | push ds |
---|
[45] | 60 | call PointDSBXtoTimeoutCounter |
---|
[60] | 61 | call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX |
---|
[41] | 62 | pop ds |
---|
[60] | 63 | jnc SHORT .RedrawSinceNoTimeout |
---|
| 64 | and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN |
---|
| 65 | stc |
---|
[41] | 66 | ret |
---|
| 67 | |
---|
| 68 | ALIGN JUMP_ALIGN |
---|
[60] | 69 | .RedrawSinceNoTimeout: |
---|
[62] | 70 | call MenuBorders_RedrawBottomBorderLine |
---|
[60] | 71 | clc |
---|
[41] | 72 | .ReturnSinceTimeoutDisabled: |
---|
[105] | 73 | TimeoutAlreadyStopped: |
---|
[41] | 74 | ret |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | ;-------------------------------------------------------------------- |
---|
[60] | 78 | ; MenuTime_GetTimeoutSecondsLeftToAX |
---|
[41] | 79 | ; Parameters |
---|
| 80 | ; SS:BP: Ptr to MENU |
---|
| 81 | ; Returns: |
---|
[45] | 82 | ; AX: Seconds until timeout |
---|
[41] | 83 | ; Corrupts registers: |
---|
[60] | 84 | ; AX |
---|
[41] | 85 | ;-------------------------------------------------------------------- |
---|
| 86 | ALIGN JUMP_ALIGN |
---|
[60] | 87 | MenuTime_GetTimeoutSecondsLeftToAX: |
---|
| 88 | push ds |
---|
| 89 | push dx |
---|
| 90 | push cx |
---|
| 91 | push bx |
---|
| 92 | |
---|
[45] | 93 | call PointDSBXtoTimeoutCounter |
---|
[60] | 94 | call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX |
---|
[62] | 95 | jc SHORT .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero |
---|
[60] | 96 | |
---|
[45] | 97 | xchg dx, ax |
---|
[60] | 98 | call TimerTicks_GetSecondsToAXfromTicksInDX |
---|
[133] | 99 | SKIP2B f ; cmp ax, <next instruction> |
---|
[62] | 100 | .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero: |
---|
[60] | 101 | xor ax, ax |
---|
[133] | 102 | |
---|
[60] | 103 | pop bx |
---|
| 104 | pop cx |
---|
| 105 | pop dx |
---|
| 106 | pop ds |
---|
| 107 | ret |
---|
[41] | 108 | |
---|
| 109 | |
---|
| 110 | ;-------------------------------------------------------------------- |
---|
[45] | 111 | ; PointDSBXtoTimeoutCounter |
---|
[41] | 112 | ; Parameters |
---|
| 113 | ; SS:BP: Ptr to MENU |
---|
| 114 | ; Returns: |
---|
| 115 | ; DS:BX: Ptr to timeout counter |
---|
| 116 | ; Corrupts registers: |
---|
[45] | 117 | ; Nothing |
---|
[41] | 118 | ;-------------------------------------------------------------------- |
---|
| 119 | ALIGN JUMP_ALIGN |
---|
[45] | 120 | PointDSBXtoTimeoutCounter: |
---|
| 121 | push ss |
---|
| 122 | pop ds |
---|
| 123 | lea bx, [bp+MENU.wTimeoutCounter] |
---|
| 124 | ret |
---|