source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuTime.asm@ 318

Last change on this file since 318 was 133, checked in by krille_n_@…, 14 years ago

Size optimizations in various files in the Assembly Library. Also a very small change to a string in XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

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