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

Last change on this file since 369 was 369, checked in by gregli@…, 12 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 3.1 KB
RevLine 
[41]1; Project name  :   Assembly Library
2; Description   :   Menu timeouts other time related functions.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
[60]8; MenuTime_StartSelectionTimeoutWithTicksInAX
[41]9;   Parameters
[60]10;       AX:     Timeout ticks
[41]11;       SS:BP:  Ptr to MENU
12;   Returns:
13;       Nothing
14;   Corrupts registers:
[60]15;       AX, BX
[41]16;--------------------------------------------------------------------
[369]17ALIGN MENU_JUMP_ALIGN
[60]18MenuTime_StartSelectionTimeoutWithTicksInAX:
19    push    ds
20    call    PointDSBXtoTimeoutCounter
21    call    TimerTicks_InitializeTimeoutFromAX
22    or      BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
23    pop     ds
[41]24    ret
25
26
27;--------------------------------------------------------------------
[60]28; MenuTime_StopSelectionTimeout
[41]29;   Parameters
30;       SS:BP:  Ptr to MENU
31;   Returns:
32;       Nothing
33;   Corrupts registers:
[60]34;       AX, BX, DX, SI, DI
[41]35;--------------------------------------------------------------------
[369]36ALIGN MENU_JUMP_ALIGN
[60]37MenuTime_StopSelectionTimeout:
38    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
[105]39    jz      SHORT TimeoutAlreadyStopped
[60]40    and     BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
41    jmp     MenuBorders_RedrawBottomBorderLine
[41]42
43
44;--------------------------------------------------------------------
45; MenuTime_UpdateSelectionTimeout
46;   Parameters
47;       SS:BP:  Ptr to MENU
48;   Returns:
49;       CF:     Set if timeout
50;               Cleared if time left
51;   Corrupts registers:
[60]52;       AX, BX, SI, DI
[41]53;--------------------------------------------------------------------
[369]54ALIGN MENU_JUMP_ALIGN
[41]55MenuTime_UpdateSelectionTimeout:
[60]56    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
57    jz      SHORT .ReturnSinceTimeoutDisabled
58
[41]59    push    ds
[45]60    call    PointDSBXtoTimeoutCounter
[60]61    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[41]62    pop     ds
[60]63    jnc     SHORT .RedrawSinceNoTimeout
64    and     BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
65    stc
[41]66    ret
67
[369]68ALIGN MENU_JUMP_ALIGN
[60]69.RedrawSinceNoTimeout:
[62]70    call    MenuBorders_RedrawBottomBorderLine
[60]71    clc
[41]72.ReturnSinceTimeoutDisabled:
[105]73TimeoutAlreadyStopped:
[41]74    ret
75
76
77;--------------------------------------------------------------------
[60]78; MenuTime_GetTimeoutSecondsLeftToAX
[41]79;   Parameters
80;       SS:BP:  Ptr to MENU
81;   Returns:
[45]82;       AX:     Seconds until timeout
[41]83;   Corrupts registers:
[60]84;       AX
[41]85;--------------------------------------------------------------------
[369]86ALIGN MENU_JUMP_ALIGN
[60]87MenuTime_GetTimeoutSecondsLeftToAX:
88    push    ds
89    push    dx
90    push    cx
91    push    bx
92
[45]93    call    PointDSBXtoTimeoutCounter
[60]94    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[62]95    jc      SHORT .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero
[60]96
[45]97    xchg    dx, ax
[60]98    call    TimerTicks_GetSecondsToAXfromTicksInDX
[133]99    SKIP2B  f   ; cmp ax, <next instruction>
[62]100.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
[60]101    xor     ax, ax
[133]102
[60]103    pop     bx
104    pop     cx
105    pop     dx
106    pop     ds
107    ret
[41]108
109
110;--------------------------------------------------------------------
[45]111; PointDSBXtoTimeoutCounter
[41]112;   Parameters
113;       SS:BP:  Ptr to MENU
114;   Returns:
115;       DS:BX:  Ptr to timeout counter
116;   Corrupts registers:
[45]117;       Nothing
[41]118;--------------------------------------------------------------------
[369]119ALIGN MENU_JUMP_ALIGN
[45]120PointDSBXtoTimeoutCounter:
121    push    ss
122    pop     ds
123    lea     bx, [bp+MENU.wTimeoutCounter]
124    ret
Note: See TracBrowser for help on using the repository browser.