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

Last change on this file since 370 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
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;--------------------------------------------------------------------
[370]17%ifndef EXCLUDE_FROM_XTIDECFG
[369]18ALIGN MENU_JUMP_ALIGN
[60]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
[41]25    ret
[370]26%endif
[41]27
28
29;--------------------------------------------------------------------
[60]30; MenuTime_StopSelectionTimeout
[41]31;   Parameters
32;       SS:BP:  Ptr to MENU
33;   Returns:
34;       Nothing
35;   Corrupts registers:
[60]36;       AX, BX, DX, SI, DI
[41]37;--------------------------------------------------------------------
[369]38ALIGN MENU_JUMP_ALIGN
[60]39MenuTime_StopSelectionTimeout:
40    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
[105]41    jz      SHORT TimeoutAlreadyStopped
[60]42    and     BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
43    jmp     MenuBorders_RedrawBottomBorderLine
[41]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:
[60]54;       AX, BX, SI, DI
[41]55;--------------------------------------------------------------------
[369]56ALIGN MENU_JUMP_ALIGN
[41]57MenuTime_UpdateSelectionTimeout:
[60]58    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
59    jz      SHORT .ReturnSinceTimeoutDisabled
60
[41]61    push    ds
[45]62    call    PointDSBXtoTimeoutCounter
[60]63    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[41]64    pop     ds
[60]65    jnc     SHORT .RedrawSinceNoTimeout
66    and     BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
67    stc
[41]68    ret
69
[369]70ALIGN MENU_JUMP_ALIGN
[60]71.RedrawSinceNoTimeout:
[62]72    call    MenuBorders_RedrawBottomBorderLine
[60]73    clc
[41]74.ReturnSinceTimeoutDisabled:
[105]75TimeoutAlreadyStopped:
[41]76    ret
77
78
79;--------------------------------------------------------------------
[60]80; MenuTime_GetTimeoutSecondsLeftToAX
[41]81;   Parameters
82;       SS:BP:  Ptr to MENU
83;   Returns:
[45]84;       AX:     Seconds until timeout
[41]85;   Corrupts registers:
[60]86;       AX
[41]87;--------------------------------------------------------------------
[369]88ALIGN MENU_JUMP_ALIGN
[60]89MenuTime_GetTimeoutSecondsLeftToAX:
90    push    ds
91    push    dx
92    push    cx
93    push    bx
94
[45]95    call    PointDSBXtoTimeoutCounter
[60]96    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
[62]97    jc      SHORT .TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero
[60]98
[45]99    xchg    dx, ax
[60]100    call    TimerTicks_GetSecondsToAXfromTicksInDX
[133]101    SKIP2B  f   ; cmp ax, <next instruction>
[62]102.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
[60]103    xor     ax, ax
[133]104
[60]105    pop     bx
106    pop     cx
107    pop     dx
108    pop     ds
109    ret
[41]110
111
112;--------------------------------------------------------------------
[45]113; PointDSBXtoTimeoutCounter
[41]114;   Parameters
115;       SS:BP:  Ptr to MENU
116;   Returns:
117;       DS:BX:  Ptr to timeout counter
118;   Corrupts registers:
[45]119;       Nothing
[41]120;--------------------------------------------------------------------
[369]121ALIGN MENU_JUMP_ALIGN
[45]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.