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