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

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

Changes to Assembly Library:

  • Small improvements to timeout counter drawing.
File size: 3.3 KB
Line 
1; File name : MenuTime.asm
2; Project name : Assembly Library
3; Created date : 25.7.2010
4; Last update : 30.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_RedrawBottomBorderLine
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 .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero
103
104 xchg dx, ax
105 call TimerTicks_GetSecondsToAXfromTicksInDX
106 jmp SHORT .PopRegistersAndReturn
107.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
108 xor ax, ax
109.PopRegistersAndReturn:
110 pop bx
111 pop cx
112 pop dx
113 pop ds
114 ret
115
116
117;--------------------------------------------------------------------
118; PointDSBXtoTimeoutCounter
119; Parameters
120; SS:BP: Ptr to MENU
121; Returns:
122; DS:BX: Ptr to timeout counter
123; Corrupts registers:
124; Nothing
125;--------------------------------------------------------------------
126ALIGN JUMP_ALIGN
127PointDSBXtoTimeoutCounter:
128 push ss
129 pop ds
130 lea bx, [bp+MENU.wTimeoutCounter]
131 ret
Note: See TracBrowser for help on using the repository browser.