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

Last change on this file since 576 was 526, checked in by krille_n_@…, 12 years ago

Changes:

  • Update of the copyright notices to include the year 2013.
File size: 3.8 KB
Line 
1; Project name : Assembly Library
2; Description : Menu timeouts other time related functions.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20
21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; MenuTime_StartSelectionTimeoutWithTicksInAX
26; Parameters
27; AX: Timeout ticks
28; SS:BP: Ptr to MENU
29; Returns:
30; Nothing
31; Corrupts registers:
32; AX, BX
33;--------------------------------------------------------------------
34%ifndef EXCLUDE_FROM_XTIDECFG
35ALIGN MENU_JUMP_ALIGN
36MenuTime_StartSelectionTimeoutWithTicksInAX:
37 push ds
38 call PointDSBXtoTimeoutCounter
39 call TimerTicks_InitializeTimeoutFromAX
40 or BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
41 pop ds
42 ret
43%endif
44
45
46;--------------------------------------------------------------------
47; MenuTime_StopSelectionTimeout
48; Parameters
49; SS:BP: Ptr to MENU
50; Returns:
51; Nothing
52; Corrupts registers:
53; AX, BX, DX, SI, DI
54;--------------------------------------------------------------------
55ALIGN MENU_JUMP_ALIGN
56MenuTime_StopSelectionTimeout:
57 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
58 jz SHORT TimeoutAlreadyStopped
59 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
60 jmp MenuBorders_RedrawBottomBorderLine
61
62
63;--------------------------------------------------------------------
64; MenuTime_UpdateSelectionTimeout
65; Parameters
66; SS:BP: Ptr to MENU
67; Returns:
68; CF: Set if timeout
69; Cleared if time left
70; Corrupts registers:
71; AX, BX, SI, DI
72;--------------------------------------------------------------------
73ALIGN MENU_JUMP_ALIGN
74MenuTime_UpdateSelectionTimeout:
75 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
76 jz SHORT .ReturnSinceTimeoutDisabled
77
78 push ds
79 call PointDSBXtoTimeoutCounter
80 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
81 pop ds
82 jnc SHORT .RedrawSinceNoTimeout
83 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
84 stc
85 ret
86
87ALIGN MENU_JUMP_ALIGN
88.RedrawSinceNoTimeout:
89 call MenuBorders_RedrawBottomBorderLine
90 clc
91.ReturnSinceTimeoutDisabled:
92TimeoutAlreadyStopped:
93 ret
94
95
96;--------------------------------------------------------------------
97; MenuTime_GetTimeoutSecondsLeftToAX
98; Parameters
99; SS:BP: Ptr to MENU
100; Returns:
101; AX: Seconds until timeout
102; Corrupts registers:
103; Nothing
104;--------------------------------------------------------------------
105ALIGN MENU_JUMP_ALIGN
106MenuTime_GetTimeoutSecondsLeftToAX:
107 push ds
108 push dx
109 push cx
110 push bx
111
112 call PointDSBXtoTimeoutCounter
113 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
114 jc SHORT .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero
115
116 xchg dx, ax
117 call TimerTicks_GetSecondsToAXfromTicksInDX
118 SKIP2B dx
119.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
120 xor ax, ax
121
122 pop bx
123 pop cx
124 pop dx
125 pop ds
126 ret
127
128
129;--------------------------------------------------------------------
130; PointDSBXtoTimeoutCounter
131; Parameters
132; SS:BP: Ptr to MENU
133; Returns:
134; DS:BX: Ptr to timeout counter
135; Corrupts registers:
136; Nothing
137;--------------------------------------------------------------------
138ALIGN MENU_JUMP_ALIGN
139PointDSBXtoTimeoutCounter:
140 push ss
141 pop ds
142 lea bx, [bp+MENU.wTimeoutCounter]
143 ret
Note: See TracBrowser for help on using the repository browser.