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

Last change on this file since 60 was 60, checked in by Tomi Tilli, 14 years ago

Changes to Assembly Library:

  • Timeout count down is now stopped when any key pressed.
File size: 3.2 KB
Line 
1; File name : MenuTime.asm
2; Project name : Assembly Library
3; Created date : 25.7.2010
4; Last update : 25.11.2010
5; Author : Tomi Tilli
6; Description : Menu timeouts other time related functions.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; MenuTime_StartSelectionTimeoutWithTicksInAX
13; Parameters
14; AX: Timeout ticks
15; SS:BP: Ptr to MENU
16; Returns:
17; Nothing
18; Corrupts registers:
19; AX, BX
20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22MenuTime_StartSelectionTimeoutWithTicksInAX:
23 push ds
24 call PointDSBXtoTimeoutCounter
25 call TimerTicks_InitializeTimeoutFromAX
26 or BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
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;--------------------------------------------------------------------
40ALIGN JUMP_ALIGN
41MenuTime_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
46ALIGN JUMP_ALIGN
47.TimeoutAlreadyStopped:
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:
59; AX, BX, SI, DI
60;--------------------------------------------------------------------
61ALIGN JUMP_ALIGN
62MenuTime_UpdateSelectionTimeout:
63 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
64 jz SHORT .ReturnSinceTimeoutDisabled
65
66 push ds
67 call PointDSBXtoTimeoutCounter
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
74
75ALIGN JUMP_ALIGN
76.RedrawSinceNoTimeout:
77 call MenuBorders_RedrawTimeoutValue
78 clc
79ALIGN JUMP_ALIGN
80.ReturnSinceTimeoutDisabled:
81 ret
82
83
84;--------------------------------------------------------------------
85; MenuTime_GetTimeoutSecondsLeftToAX
86; Parameters
87; SS:BP: Ptr to MENU
88; Returns:
89; AX: Seconds until timeout
90; Corrupts registers:
91; AX
92;--------------------------------------------------------------------
93ALIGN JUMP_ALIGN
94MenuTime_GetTimeoutSecondsLeftToAX:
95 push ds
96 push dx
97 push cx
98 push bx
99
100 call PointDSBXtoTimeoutCounter
101 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
102 jc SHORT .TimeoutHasOccurred
103
104 xchg dx, ax
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
117
118
119;--------------------------------------------------------------------
120; PointDSBXtoTimeoutCounter
121; Parameters
122; SS:BP: Ptr to MENU
123; Returns:
124; DS:BX: Ptr to timeout counter
125; Corrupts registers:
126; Nothing
127;--------------------------------------------------------------------
128ALIGN JUMP_ALIGN
129PointDSBXtoTimeoutCounter:
130 push ss
131 pop ds
132 lea bx, [bp+MENU.wTimeoutCounter]
133 ret
Note: See TracBrowser for help on using the repository browser.