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

Last change on this file since 91 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
RevLine 
[41]1; File name : MenuTime.asm
2; Project name : Assembly Library
3; Created date : 25.7.2010
[62]4; Last update : 30.11.2010
[41]5; Author : Tomi Tilli
6; Description : Menu timeouts other time related functions.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
[60]12; MenuTime_StartSelectionTimeoutWithTicksInAX
[41]13; Parameters
[60]14; AX: Timeout ticks
[41]15; SS:BP: Ptr to MENU
16; Returns:
17; Nothing
18; Corrupts registers:
[60]19; AX, BX
[41]20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
[60]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
[41]28 ret
29
30
31;--------------------------------------------------------------------
[60]32; MenuTime_StopSelectionTimeout
[41]33; Parameters
34; SS:BP: Ptr to MENU
35; Returns:
36; Nothing
37; Corrupts registers:
[60]38; AX, BX, DX, SI, DI
[41]39;--------------------------------------------------------------------
40ALIGN JUMP_ALIGN
[60]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:
[41]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:
[60]59; AX, BX, SI, DI
[41]60;--------------------------------------------------------------------
61ALIGN JUMP_ALIGN
62MenuTime_UpdateSelectionTimeout:
[60]63 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
64 jz SHORT .ReturnSinceTimeoutDisabled
65
[41]66 push ds
[45]67 call PointDSBXtoTimeoutCounter
[60]68 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[41]69 pop ds
[60]70 jnc SHORT .RedrawSinceNoTimeout
71 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
72 stc
[41]73 ret
74
75ALIGN JUMP_ALIGN
[60]76.RedrawSinceNoTimeout:
[62]77 call MenuBorders_RedrawBottomBorderLine
[60]78 clc
79ALIGN JUMP_ALIGN
[41]80.ReturnSinceTimeoutDisabled:
81 ret
82
83
84;--------------------------------------------------------------------
[60]85; MenuTime_GetTimeoutSecondsLeftToAX
[41]86; Parameters
87; SS:BP: Ptr to MENU
88; Returns:
[45]89; AX: Seconds until timeout
[41]90; Corrupts registers:
[60]91; AX
[41]92;--------------------------------------------------------------------
93ALIGN JUMP_ALIGN
[60]94MenuTime_GetTimeoutSecondsLeftToAX:
95 push ds
96 push dx
97 push cx
98 push bx
99
[45]100 call PointDSBXtoTimeoutCounter
[60]101 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[62]102 jc SHORT .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero
[60]103
[45]104 xchg dx, ax
[60]105 call TimerTicks_GetSecondsToAXfromTicksInDX
106 jmp SHORT .PopRegistersAndReturn
[62]107.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
[60]108 xor ax, ax
109.PopRegistersAndReturn:
110 pop bx
111 pop cx
112 pop dx
113 pop ds
114 ret
[41]115
116
117;--------------------------------------------------------------------
[45]118; PointDSBXtoTimeoutCounter
[41]119; Parameters
120; SS:BP: Ptr to MENU
121; Returns:
122; DS:BX: Ptr to timeout counter
123; Corrupts registers:
[45]124; Nothing
[41]125;--------------------------------------------------------------------
126ALIGN JUMP_ALIGN
[45]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.