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

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

Changes:

  • Added some missing PIO mode timings to ATA_ID.inc (based on info from http://www.singlix.net/specs/cfspc4_0.pdf)
  • Updated Configuration_FullMode.txt but it may need additional changes as the Tandy info doesn't match the wiki.
  • Optimizations.
  • Excluded some unused code from XTIDECFG.
File size: 3.2 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;--------------------------------------------------------------------
17%ifndef EXCLUDE_FROM_XTIDECFG
18ALIGN MENU_JUMP_ALIGN
19MenuTime_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;--------------------------------------------------------------------
38ALIGN MENU_JUMP_ALIGN
39MenuTime_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;--------------------------------------------------------------------
56ALIGN MENU_JUMP_ALIGN
57MenuTime_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
70ALIGN MENU_JUMP_ALIGN
71.RedrawSinceNoTimeout:
72 call MenuBorders_RedrawBottomBorderLine
73 clc
74.ReturnSinceTimeoutDisabled:
75TimeoutAlreadyStopped:
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;--------------------------------------------------------------------
88ALIGN MENU_JUMP_ALIGN
89MenuTime_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;--------------------------------------------------------------------
121ALIGN MENU_JUMP_ALIGN
122PointDSBXtoTimeoutCounter:
123 push ss
124 pop ds
125 lea bx, [bp+MENU.wTimeoutCounter]
126 ret
Note: See TracBrowser for help on using the repository browser.