Changeset 60 in xtideuniversalbios for trunk/Assembly_Library


Ignore:
Timestamp:
Nov 25, 2010, 2:17:45 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:

  • Timeout count down is now stopped when any key pressed.
Location:
trunk/Assembly_Library
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Inc/Emulate.inc

    r50 r60  
    22; Project name  :   Emulation library
    33; Created date  :   21.10.2009
    4 ; Last update   :   9.10.2010
     4; Last update   :   25.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Macros for emulating later x86 instruction with older
     
    157157%macro eCMOVE 2
    158158    jne     SHORT %%Return
     159    mov     %1, %2
     160%%Return:
     161%endmacro
     162
     163%macro eCMOVB 2
     164    jnb     SHORT %%Return
    159165    mov     %1, %2
    160166%%Return:
  • trunk/Assembly_Library/Inc/Menu.inc

    r54 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   13.7.2010
    4 ; Last update   :   23.10.2010
     4; Last update   :   22.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Defines for Menu library.
     
    7575    .RefreshInformation                         resb    2
    7676
    77     .RestartTimeout                             resb    2
    78     .SetTimeoutValueFromAX:
     77    .StartSelectionTimeoutWithTicksInAX         resb    2
    7978
    8079%ifdef INCLUDE_MENU_DIALOGS
     
    9493; Menu initialization parameters
    9594struc MENUINIT
    96     .wTimeoutTicks                  resb    2   ; Selection timeout in system timer ticks
    9795    .wItems                         resb    2   ; Number of items in menu
    9896    .wHighlightedItem               resb    2   ; Index for highlighted item
     
    124122FLG_MENU_NOHIGHLIGHT                EQU     (1<<1)  ; Never highlight items
    125123FLG_MENU_USER_HANDLES_SCROLLING     EQU     (1<<2)
     124FLG_MENU_TIMEOUT_COUNTDOWN          EQU     (1<<3)  ; Timeout countdown in progress
    126125
    127126
  • trunk/Assembly_Library/Src/LibraryTests.asm

    r58 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   27.6.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   22.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Tests for Assembly Library.
     
    6565ALIGN JUMP_ALIGN
    6666.InitializeMenu:
    67     mov     WORD [si+MENUINIT.wTimeoutTicks], 10000 / 55    ; 10 seconds
    6867    mov     WORD [si+MENUINIT.wItems], 51
    6968    mov     BYTE [si+MENUINIT.bWidth], 40
     
    7271    mov     BYTE [si+MENUINIT.bInfoLines], TEST_MENU_INFO_LINES
    7372    mov     WORD [si+MENUINIT.wHighlightedItem], 1
     73   
     74    mov     ax, 10000 / 55  ; 10 seconds
     75    CALL_MENU_LIBRARY StartSelectionTimeoutWithTicksInAX
    7476    stc
    7577    ret
     
    166168    CALL_MENU_LIBRARY SetInformationHeightFromAL
    167169.RefreshMenuWindow:
    168     CALL_MENU_LIBRARY RestartTimeout
     170    ;CALL_MENU_LIBRARY RestartTimeout
    169171    CALL_MENU_LIBRARY RefreshWindow
    170172    stc
  • trunk/Assembly_Library/Src/Menu/Dialog/Dialog.asm

    r58 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   6.8.2010
    4 ; Last update   :   18.11.2010
     4; Last update   :   22.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Common functions for many dialogs.
     
    232232Dialog_RemoveFromScreenByRedrawingParentMenu:
    233233    mov     si, [bp+DIALOG.pParentMenu] ; SS:SI points to parent MENU
    234     call    .ResetSelectionTimeoutFromParentMenuInSSSI
    235234    call    .GetParentTitleBorderCoordinatesToDX
    236235    call    MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
     
    238237    jb      SHORT .RedrawDialogAreaAndWholeParentWindow
    239238    jmp     SHORT .RedrawWholeParentWindow
    240 
    241 ;--------------------------------------------------------------------
    242 ; .ResetSelectionTimeoutFromParentMenuInSSSI
    243 ;   Parameters:
    244 ;       SS:SI:  Ptr to parent MENU
    245 ;   Returns:
    246 ;       Nothing
    247 ;   Corrupts:
    248 ;       AX, BX
    249 ;--------------------------------------------------------------------
    250 ALIGN JUMP_ALIGN
    251 .ResetSelectionTimeoutFromParentMenuInSSSI:
    252     xchg    bp, si
    253     call    MenuTime_RestartSelectionTimeout    ; Restart timeout for parent MENU
    254     xchg    si, bp
    255     ret
    256239
    257240;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Menu/Menu.asm

    r54 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   3.8.2010
    4 ; Last update   :   23.10.2010
     4; Last update   :   22.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Menu Library functions for CALL_MENU_LIBRARY macro
     
    5757    at  MENU_LIB.RefreshInformation,            dw  MenuText_RefreshInformation
    5858
    59     at  MENU_LIB.RestartTimeout,                dw  MenuTime_RestartSelectionTimeout
    60     ;at MENU_LIB.SetTimeoutValueFromAX,         dw  MenuTime_SetSelectionTimeoutValueFromAX ; Special case in CALL_MENU_LIBRARY
     59    at  MENU_LIB.StartSelectionTimeoutWithTicksInAX,    dw  MenuTime_StartSelectionTimeoutWithTicksInAX
    6160
    6261%ifdef INCLUDE_MENU_DIALOGS
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r52 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   11.10.2010
     4; Last update   :   25.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu borders.
     
    3434    call    RefreshInformationBorders
    3535    call    DrawBottomBorderLine
    36     call    DrawBottomShadowLine
    37     jmp     MenuTime_DrawWithoutUpdating
     36    call    DrawTimeoutCounterOverBottomBorderLine
     37    jmp     DrawBottomShadowLine
     38
     39
     40;--------------------------------------------------------------------
     41; MenuBorders_RedrawBottomBorderLine
     42;   Parameters
     43;       SS:BP:  Ptr to MENU
     44;   Returns:
     45;       Nothing
     46;   Corrupts registers:
     47;       AX, BX, DX, SI, DI
     48;--------------------------------------------------------------------
     49ALIGN JUMP_ALIGN
     50MenuBorders_RedrawBottomBorderLine:
     51    call    MenuBorders_AdjustDisplayContextForDrawingBorders
     52    call    MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
     53    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
     54    call    GetNumberOfMiddleCharactersToDX
     55    jmp     DrawBottomBorderLine
     56
     57
     58;--------------------------------------------------------------------
     59; MenuBorders_RedrawTimeoutValue
     60;   Parameters
     61;       SS:BP:  Ptr to MENU
     62;   Returns:
     63;       Nothing
     64;   Corrupts registers:
     65;       AX, BX, SI, DI
     66;--------------------------------------------------------------------
     67ALIGN JUMP_ALIGN
     68MenuBorders_RedrawTimeoutValue:
     69    call    MenuBorders_AdjustDisplayContextForDrawingBorders
     70    call    MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
     71    inc     ah      ; Increment for shadow border
     72    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
     73    jmp     DrawTimeoutCounterOverBottomBorderLine
    3874
    3975
     
    174210; DrawSeparationBorderLine
    175211; DrawBottomBorderLine
     212; DrawTimeoutCounterOverBottomBorderLine
    176213; DrawBottomShadowLine
    177214; DrawTextBorderLine
     
    201238
    202239ALIGN JUMP_ALIGN
     240DrawTimeoutCounterOverBottomBorderLine:
     241    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
     242    jz      SHORT .NoNeedToDrawSinceTimeoutDisabled
     243    mov     ax, (-1)<<8 ; Decrement row
     244    call    MenuLocation_MoveCursorByALcolumnsAndAHrows
     245    call    MenuTime_GetTimeoutSecondsLeftToAX
     246    call    PrintTimeoutStringWithSecondsInAX
     247    jmp     SHORT PrintNewlineToEndBorderLine
     248.NoNeedToDrawSinceTimeoutDisabled:
     249    ret
     250
     251ALIGN JUMP_ALIGN
    203252DrawBottomShadowLine:
    204     CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
    205     inc     ax          ; Increment column
    206     CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
     253    mov     ax, 1       ; Increment column
     254    call    MenuLocation_MoveCursorByALcolumnsAndAHrows
    207255    inc     dx          ; Increment repeat count...
    208256    inc     dx          ; ...for both corner characters
     
    333381
    334382
     383;--------------------------------------------------------------------
     384; PrintTimeoutStringWithSecondsInAX
     385;   Parameters
     386;       AX:     Seconds to print
     387;       SS:BP:  Ptr to MENU
     388;   Returns:
     389;       Nothing
     390;   Corrupts registers:
     391;       AX, SI, DI
     392;--------------------------------------------------------------------
     393ALIGN JUMP_ALIGN
     394PrintTimeoutStringWithSecondsInAX:
     395    push    bp
     396
     397    xchg    di, ax
     398    mov     bp, sp
     399    call    .GetTimeoutAttributeToAXfromSecondsInDI
     400    mov     si, .szSelectionTimeout
     401    push    ax          ; Push attribute
     402    push    di          ; Push seconds
     403    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
     404    pop     bp
     405
     406    ; Draw right border with normal border color
     407    mov     al, DOUBLE_RIGHT_HORIZONTAL_TO_SINGLE_VERTICAL
     408    jmp     MenuBorders_PrintSingleBorderCharacterFromAL
     409.szSelectionTimeout:
     410    db      DOUBLE_BOTTOM_LEFT_CORNER
     411    db      DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
     412    db      "%AAutoselection in %2u s",NULL
     413
     414;--------------------------------------------------------------------
     415; .GetTimeoutAttributeToAXfromSecondsInDI
     416;   Parameters
     417;       DI:     Seconds to print
     418;   Returns:
     419;       AX:     Attribute byte for seconds
     420;   Corrupts registers:
     421;       SI
     422;--------------------------------------------------------------------
     423ALIGN JUMP_ALIGN
     424.GetTimeoutAttributeToAXfromSecondsInDI:
     425    mov     si, ATTRIBUTE_CHARS.cNormalTimeout
     426    cmp     di, BYTE 3
     427    eCMOVB  si, ATTRIBUTE_CHARS.cHurryTimeout
     428    jmp     MenuAttribute_GetToAXfromTypeInSI
     429
    335430
    336431; Lookup tables for border characters
  • trunk/Assembly_Library/Src/Menu/MenuInit.asm

    r52 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   13.7.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   22.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for initializing menu system.
     
    6060    CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
    6161    call    MenuEvent_InitializeMenuinit        ; User initialization
    62     call    MenuTime_RestartSelectionTimeout
    6362    call    MenuInit_RefreshMenuWindow
    6463    jmp     MenuLoop_Enter
  • trunk/Assembly_Library/Src/Menu/MenuLocation.asm

    r41 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   11.8.2010
     4; Last update   :   25.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for calculation menu window dimensions.
     
    160160    sub     ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
    161161    ret
     162
     163
     164;--------------------------------------------------------------------
     165; MenuLocation_MoveCursorByALcolumnsAndAHrows
     166;   Parameters
     167;       AL:     Number of columns to move
     168;       AH:     Numver of rows to move
     169;       SS:BP:  Ptr to MENU
     170;   Returns:
     171;       Nothing
     172;   Corrupts registers:
     173;       AX, DI
     174;--------------------------------------------------------------------
     175ALIGN JUMP_ALIGN
     176MenuLocation_MoveCursorByALcolumnsAndAHrows:
     177    push    ax
     178    CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
     179    pop     di
     180    add     ax, di
     181    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
     182    ret
  • trunk/Assembly_Library/Src/Menu/MenuLoop.asm

    r58 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   22.7.2010
    4 ; Last update   :   18.10.2010
     4; Last update   :   25.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Menu loop for waiting keystrokes.
     
    7070ALIGN JUMP_ALIGN
    7171ProcessKeystrokeFromAX:
    72     call    .ProcessMenuSystemKeystroke
     72    xchg    cx, ax
     73    call    MenuTime_StopSelectionTimeout
     74    xchg    ax, cx
     75    call    .ProcessMenuSystemKeystrokeFromAX
    7376    jc      SHORT .Return
    7477    jmp     MenuEvent_KeyStrokeInAX
     
    7881
    7982;--------------------------------------------------------------------
    80 ; .ProcessMenuSystemKeystroke
     83; .ProcessMenuSystemKeystrokeFromAX
    8184;   Parameters
    8285;       AL:     ASCII character
     
    9295;--------------------------------------------------------------------
    9396ALIGN JUMP_ALIGN
    94 .ProcessMenuSystemKeystroke:
     97.ProcessMenuSystemKeystrokeFromAX:
    9598    cmp     ah, MENU_KEY_ESC
    9699    je      SHORT .LeaveMenuWithoutSelectingItem
     
    194197.MoveHighlightedItemByAX:
    195198    call    MenuScrollbars_MoveHighlightedItemByAX
    196     call    MenuTime_RestartSelectionTimeout
    197199    stc
    198200    ret
  • trunk/Assembly_Library/Src/Menu/MenuTime.asm

    r47 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   25.7.2010
    4 ; Last update   :   4.10.2010
     4; Last update   :   25.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Menu timeouts other time related functions.
     
    1010
    1111;--------------------------------------------------------------------
    12 ; MenuTime_SetSelectionTimeoutValueFromAX
     12; MenuTime_StartSelectionTimeoutWithTicksInAX
    1313;   Parameters
    14 ;       AX:     Selection timeout in system timer ticks
    15 ;       SS:BP:  Ptr to MENU
    16 ;   Returns:
    17 ;       Nothing
    18 ;   Corrupts registers:
    19 ;       Nothing
    20 ;--------------------------------------------------------------------
    21 ALIGN JUMP_ALIGN
    22 MenuTime_SetSelectionTimeoutValueFromAX:
    23     mov     [bp+MENUINIT.wTimeoutTicks], ax
    24     ret
    25 
    26 
    27 ;--------------------------------------------------------------------
    28 ; MenuTime_RestartSelectionTimeout
    29 ;   Parameters
     14;       AX:     Timeout ticks
    3015;       SS:BP:  Ptr to MENU
    3116;   Returns:
     
    3520;--------------------------------------------------------------------
    3621ALIGN JUMP_ALIGN
    37 MenuTime_RestartSelectionTimeout:
     22MenuTime_StartSelectionTimeoutWithTicksInAX:
    3823    push    ds
    3924    call    PointDSBXtoTimeoutCounter
    40     mov     ax, [bp+MENUINIT.wTimeoutTicks]
    41     call    TimerTicks_InitializeTimeoutFromAX  ; End time to [DS:BX]
     25    call    TimerTicks_InitializeTimeoutFromAX
     26    or      BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
    4227    pop     ds
     28    ret
     29
     30
     31;--------------------------------------------------------------------
     32; MenuTime_StopSelectionTimeout
     33;   Parameters
     34;       SS:BP:  Ptr to MENU
     35;   Returns:
     36;       Nothing
     37;   Corrupts registers:
     38;       AX, BX, DX, SI, DI
     39;--------------------------------------------------------------------
     40ALIGN JUMP_ALIGN
     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:
    4348    ret
    4449
     
    5257;               Cleared if time left
    5358;   Corrupts registers:
    54 ;       AX, BX, CX, DX, SI, DI
     59;       AX, BX, SI, DI
    5560;--------------------------------------------------------------------
    5661ALIGN JUMP_ALIGN
    5762MenuTime_UpdateSelectionTimeout:
     63    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
     64    jz      SHORT .ReturnSinceTimeoutDisabled
     65
    5866    push    ds
    59 
    60     call    MenuTime_DrawWithoutUpdating
    61     jnc     SHORT .TimeoutDisabled
    6267    call    PointDSBXtoTimeoutCounter
    63     call    TimerTicks_SetCarryIfTimeoutFromDSBX
     68    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
     69    pop     ds
     70    jnc     SHORT .RedrawSinceNoTimeout
     71    and     BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
     72    stc
     73    ret
    6474
    6575ALIGN JUMP_ALIGN
    66 .TimeoutDisabled:
    67     pop     ds
    68     ret
    69 
    70 ;--------------------------------------------------------------------
    71 ; MenuTime_DrawWithoutUpdating
    72 ;   Parameters
    73 ;       SS:BP:  Ptr to MENU
    74 ;   Returns:
    75 ;       CF:     Set if timeout enabled
    76 ;               Cleared if timeout disabled
    77 ;   Corrupts registers:
    78 ;       AX, BX, CX, DX, SI, DI
    79 ;--------------------------------------------------------------------
     76.RedrawSinceNoTimeout:
     77    call    MenuBorders_RedrawTimeoutValue
     78    clc
    8079ALIGN JUMP_ALIGN
    81 MenuTime_DrawWithoutUpdating:
    82     cmp     WORD [bp+MENUINIT.wTimeoutTicks], BYTE 0
    83     je      SHORT .ReturnSinceTimeoutDisabled   ; Clear CF
    84 
    85     push    ds
    86     call    GetSecondsLeftUntilTimeoutToAXandCounterToDSBX
    87     call    DrawTimeoutInAXoverMenuBorders
    88     pop     ds
    89     stc
    90 ALIGN JUMP_ALIGN, ret
    9180.ReturnSinceTimeoutDisabled:
    9281    ret
     
    9483
    9584;--------------------------------------------------------------------
    96 ; GetSecondsLeftUntilTimeoutToAXandCounterToDSBX
     85; MenuTime_GetTimeoutSecondsLeftToAX
    9786;   Parameters
    9887;       SS:BP:  Ptr to MENU
    9988;   Returns:
    10089;       AX:     Seconds until timeout
    101 ;       DS:BX:  Ptr to timeout counter
    10290;   Corrupts registers:
    103 ;       AX, CX, DX
     91;       AX
    10492;--------------------------------------------------------------------
    10593ALIGN JUMP_ALIGN
    106 GetSecondsLeftUntilTimeoutToAXandCounterToDSBX:
     94MenuTime_GetTimeoutSecondsLeftToAX:
     95    push    ds
     96    push    dx
     97    push    cx
     98    push    bx
     99
    107100    call    PointDSBXtoTimeoutCounter
    108     call    TimerTicks_GetElapsedToAXfromDSBX
    109     neg     ax          ; Negate since DS:BX points to end time
    110     MAX_S   ax, 0       ; Set to zero if overflow
     101    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
     102    jc      SHORT .TimeoutHasOccurred
     103
    111104    xchg    dx, ax
    112     jmp     TimerTicks_GetSecondsToAXfromTicksInDX
     105    call    TimerTicks_GetSecondsToAXfromTicksInDX
     106    clc
     107    jmp     SHORT .PopRegistersAndReturn
     108.TimeoutHasOccurred:
     109    xor     ax, ax
     110    stc
     111.PopRegistersAndReturn:
     112    pop     bx
     113    pop     cx
     114    pop     dx
     115    pop     ds
     116    ret
    113117
    114118
     
    128132    lea     bx, [bp+MENU.wTimeoutCounter]
    129133    ret
    130 
    131 
    132 ;--------------------------------------------------------------------
    133 ; DrawTimeoutInAXoverMenuBorders
    134 ;   Parameters
    135 ;       AX:     Seconds to draw
    136 ;       SS:BP:  Ptr to MENU
    137 ;   Returns:
    138 ;       Nothing
    139 ;   Corrupts registers:
    140 ;       AX, CX, DX, SI, DI
    141 ;--------------------------------------------------------------------
    142 ALIGN JUMP_ALIGN
    143 DrawTimeoutInAXoverMenuBorders:
    144     xchg    cx, ax
    145     call    MenuBorders_AdjustDisplayContextForDrawingBorders
    146     call    MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
    147     CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    148     ; Fall to .PrintTimeoutStringWithSecondsInDX
    149 
    150 ;--------------------------------------------------------------------
    151 ; .PrintTimeoutStringWithSecondsInDX
    152 ;   Parameters
    153 ;       CX:     Seconds to print
    154 ;       SS:BP:  Ptr to MENU
    155 ;   Returns:
    156 ;       Nothing
    157 ;   Corrupts registers:
    158 ;       AX, DX, SI, DI
    159 ;--------------------------------------------------------------------
    160 ;ALIGN JUMP_ALIGN
    161 .PrintTimeoutStringWithSecondsInDX:
    162     push    bp
    163 
    164     mov     bp, sp
    165     call    .GetTimeoutAttributeToAXfromSecondsInCX
    166     mov     si, .szSelectionTimeout
    167     push    ax          ; Push attribute
    168     push    cx          ; Push seconds
    169     CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
    170     pop     bp
    171 
    172     ; Draw right border with normal border color
    173     mov     al, DOUBLE_RIGHT_HORIZONTAL_TO_SINGLE_VERTICAL
    174     jmp     MenuBorders_PrintSingleBorderCharacterFromAL
    175 .szSelectionTimeout:
    176     db      DOUBLE_BOTTOM_LEFT_CORNER
    177     db      DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
    178     db      "%AAutoselection in %2u s",NULL
    179 
    180 ;--------------------------------------------------------------------
    181 ; .GetTimeoutAttributeToAXfromSecondsInCX
    182 ;   Parameters
    183 ;       CX:     Seconds to print
    184 ;   Returns:
    185 ;       AX:     Attribute byte for seconds
    186 ;       CX:     Seconds to print
    187 ;   Corrupts registers:
    188 ;       SI, DI
    189 ;--------------------------------------------------------------------
    190 ALIGN JUMP_ALIGN
    191 .GetTimeoutAttributeToAXfromSecondsInCX:
    192     mov     si, ATTRIBUTE_CHARS.cNormalTimeout
    193     cmp     cx, BYTE 3
    194     ja      SHORT .GetAttributeToAX
    195     add     si, BYTE ATTRIBUTE_CHARS.cHurryTimeout - ATTRIBUTE_CHARS.cNormalTimeout
    196 ALIGN JUMP_ALIGN
    197 .GetAttributeToAX:
    198     jmp     MenuAttribute_GetToAXfromTypeInSI
  • trunk/Assembly_Library/Src/Time/TimerTicks.asm

    r41 r60  
    22; Project name  :   Assembly Library
    33; Created date  :   24.7.2010
    4 ; Last update   :   3.8.2010
     4; Last update   :   22.11.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for system timer related operations.
     
    7272    ret
    7373
     74
    7475;--------------------------------------------------------------------
    75 ; Timeout counter can be initialized with TimerTicks_InitializeTimeoutFromAX.
    76 ;
    77 ; TimerTicks_SetCarryIfTimeoutFromDSBX
     76; TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
    7877;   Parameters:
     78;       AX:         Number of ticks left before timeout
    7979;       DS:BX:      Ptr to timeout variable WORD
    8080;   Returns:
     
    8585;--------------------------------------------------------------------
    8686ALIGN JUMP_ALIGN
    87 TimerTicks_SetCarryIfTimeoutFromDSBX:
    88     push    ax
     87TimerTicks_GetTimeoutTicksLeftToAXfromDSBX:
     88    push    dx
     89    mov     dx, [bx]
    8990    call    TimerTicks_ReadFromBdaToAX
    90     cmp     [bx], ax        ; Set CF if timeout WORD is less than time
    91     pop     ax
     91    xchg    ax, dx
     92    sub     ax, dx      ; AX = End time - current time
     93    pop     dx
    9294    ret
    9395
Note: See TracChangeset for help on using the changeset viewer.