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

Last change on this file since 597 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
RevLine 
[41]1; Project name : Assembly Library
2; Description : Menu timeouts other time related functions.
3
[376]4;
[491]5; XTIDE Universal BIOS and Associated Tools
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[491]12;
[376]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
[491]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
[491]20
[41]21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
[60]25; MenuTime_StartSelectionTimeoutWithTicksInAX
[41]26; Parameters
[60]27; AX: Timeout ticks
[41]28; SS:BP: Ptr to MENU
29; Returns:
30; Nothing
31; Corrupts registers:
[60]32; AX, BX
[41]33;--------------------------------------------------------------------
[370]34%ifndef EXCLUDE_FROM_XTIDECFG
[369]35ALIGN MENU_JUMP_ALIGN
[60]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
[41]42 ret
[370]43%endif
[41]44
45
46;--------------------------------------------------------------------
[60]47; MenuTime_StopSelectionTimeout
[41]48; Parameters
49; SS:BP: Ptr to MENU
50; Returns:
51; Nothing
52; Corrupts registers:
[60]53; AX, BX, DX, SI, DI
[41]54;--------------------------------------------------------------------
[369]55ALIGN MENU_JUMP_ALIGN
[60]56MenuTime_StopSelectionTimeout:
57 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
[105]58 jz SHORT TimeoutAlreadyStopped
[60]59 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
60 jmp MenuBorders_RedrawBottomBorderLine
[41]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:
[60]71; AX, BX, SI, DI
[41]72;--------------------------------------------------------------------
[369]73ALIGN MENU_JUMP_ALIGN
[41]74MenuTime_UpdateSelectionTimeout:
[60]75 test BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
76 jz SHORT .ReturnSinceTimeoutDisabled
77
[41]78 push ds
[45]79 call PointDSBXtoTimeoutCounter
[60]80 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[41]81 pop ds
[60]82 jnc SHORT .RedrawSinceNoTimeout
83 and BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
84 stc
[41]85 ret
86
[369]87ALIGN MENU_JUMP_ALIGN
[60]88.RedrawSinceNoTimeout:
[62]89 call MenuBorders_RedrawBottomBorderLine
[60]90 clc
[41]91.ReturnSinceTimeoutDisabled:
[105]92TimeoutAlreadyStopped:
[41]93 ret
94
95
96;--------------------------------------------------------------------
[60]97; MenuTime_GetTimeoutSecondsLeftToAX
[41]98; Parameters
99; SS:BP: Ptr to MENU
100; Returns:
[45]101; AX: Seconds until timeout
[41]102; Corrupts registers:
[491]103; Nothing
[41]104;--------------------------------------------------------------------
[369]105ALIGN MENU_JUMP_ALIGN
[60]106MenuTime_GetTimeoutSecondsLeftToAX:
107 push ds
108 push dx
109 push cx
110 push bx
111
[45]112 call PointDSBXtoTimeoutCounter
[60]113 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[62]114 jc SHORT .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero
[60]115
[45]116 xchg dx, ax
[60]117 call TimerTicks_GetSecondsToAXfromTicksInDX
[491]118 SKIP2B dx
[62]119.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
[60]120 xor ax, ax
[133]121
[60]122 pop bx
123 pop cx
124 pop dx
125 pop ds
126 ret
[41]127
128
129;--------------------------------------------------------------------
[45]130; PointDSBXtoTimeoutCounter
[41]131; Parameters
132; SS:BP: Ptr to MENU
133; Returns:
134; DS:BX: Ptr to timeout counter
135; Corrupts registers:
[45]136; Nothing
[41]137;--------------------------------------------------------------------
[369]138ALIGN MENU_JUMP_ALIGN
[45]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.