Changeset 104 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu/MenuBorders.asm


Ignore:
Timestamp:
Feb 2, 2011, 3:53:52 AM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:

  • Some more optimizations.
  • Moved macros.inc from XTIDE Universal BIOS to Assembly Library.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r67 r104  
    1 ; File name     :   MenuBorders.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   14.7.2010
    4 ; Last update   :   9.12.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for drawing menu borders.
    73
     
    5652
    5753;--------------------------------------------------------------------
     54; MenuBorders_RefreshItemBorders
     55;   Parameters
     56;       SS:BP:  Ptr to MENU
     57;   Returns:
     58;       Nothing
     59;   Corrupts registers:
     60;       AX, BX, CX, DX, SI, DI
     61;--------------------------------------------------------------------
     62ALIGN JUMP_ALIGN
     63MenuBorders_RefreshItemBorders:
     64    call    MenuBorders_AdjustDisplayContextForDrawingBorders
     65    call    MenuLocation_GetItemBordersTopLeftCoordinatesToAX
     66    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
     67
     68    call    MenuBorders_GetNumberOfMiddleCharactersToDX
     69    jmp     SHORT RefreshItemBorders
     70
     71
     72;--------------------------------------------------------------------
    5873; MenuBorders_AdjustDisplayContextForDrawingBorders
    5974;   Parameters
     
    8196
    8297;--------------------------------------------------------------------
    83 ; MenuBorders_RefreshItemBorders
    84 ;   Parameters
    85 ;       SS:BP:  Ptr to MENU
    86 ;   Returns:
    87 ;       Nothing
    88 ;   Corrupts registers:
    89 ;       AX, BX, CX, DX, SI, DI
    90 ;--------------------------------------------------------------------
    91 ALIGN JUMP_ALIGN
    92 MenuBorders_RefreshItemBorders:
    93     call    MenuBorders_AdjustDisplayContextForDrawingBorders
    94     call    MenuLocation_GetItemBordersTopLeftCoordinatesToAX
    95     CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    96 
    97     call    MenuBorders_GetNumberOfMiddleCharactersToDX
    98     jmp     SHORT RefreshItemBorders
    99 
    100 
    101 ;--------------------------------------------------------------------
    10298; MenuBorders_GetNumberOfMiddleCharactersToDX
    10399;   Parameters
     
    161157    call    DrawSeparationBorderLine
    162158    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
     159    ; Fall to DrawTextBorderLinesByCXtimes
     160
     161;--------------------------------------------------------------------
     162; DrawTextBorderLinesByCXtimes
     163;   Parameters
     164;       CX:     Number of border lines to draw
     165;       DX:     Number of times to repeat middle character
     166;       SS:BP:  Ptr to MENU
     167;   Returns:
     168;       Nothing
     169;   Corrupts registers:
     170;       AX, CX, SI, DI
     171;--------------------------------------------------------------------
    163172DrawTextBorderLinesByCXtimes:
    164     mov     bx, DrawTextBorderLine
    165     ; Fall to DrawBorderLinesByCXtimes
    166 
    167 ;--------------------------------------------------------------------
    168 ; DrawBorderLinesByCXtimes
    169 ;   Parameters
    170 ;       BX:     Offset to border drawing function
    171 ;       CX:     Number of border lines to draw
    172 ;       DX:     Number of times to repeat middle character
    173 ;       SS:BP:  Ptr to MENU
    174 ;   Returns:
    175 ;       Nothing
    176 ;   Corrupts registers:
    177 ;       AX, CX, SI, DI
    178 ;--------------------------------------------------------------------
    179 DrawBorderLinesByCXtimes:
    180     jcxz    .Return
     173    jcxz    .NoBorderLinesToDraw
    181174ALIGN JUMP_ALIGN
    182175.DrawBordersWithFunctionInBX:
    183     call    bx
     176    call    DrawTextBorderLine
    184177    loop    .DrawBordersWithFunctionInBX
    185 .Return:
     178.NoBorderLinesToDraw:
    186179    ret
    187180
     
    228221ALIGN JUMP_ALIGN
    229222DrawBottomShadowLine:
    230     mov     ax, 1       ; Increment column
    231     call    MenuLocation_MoveCursorByALcolumnsAndAHrows
     223    CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
     224    inc     ax          ; Move one column left
     225    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    232226    inc     dx          ; Increment repeat count...
    233227    inc     dx          ; ...for both corner characters
     
    319313ALIGN JUMP_ALIGN
    320314PrintBorderCharactersFromCSSI:
    321     cld
    322315    eSEG    cs
    323     lodsb           ; Load from [si+BORDER_CHARS.cLeft] to AL
     316    lodsb           ; Load from [cs:si+BORDER_CHARS.cLeft] to AL
    324317    call    MenuBorders_PrintSingleBorderCharacterFromAL
    325318
    326319    eSEG    cs
    327     lodsb           ; Load from [si+BORDER_CHARS.cMiddle] to AL
     320    lodsb           ; Load from [cs:si+BORDER_CHARS.cMiddle] to AL
    328321    call    MenuBorders_PrintMultipleBorderCharactersFromAL
    329322
    330323    eSEG    cs
    331     lodsb           ; Load from [si+BORDER_CHARS.cRight] to AL
     324    lodsb           ; Load from [cs:si+BORDER_CHARS.cRight] to AL
    332325    ; Fall to MenuBorders_PrintSingleBorderCharacterFromAL
    333326
     
    382375;       AX, SI, DI
    383376;--------------------------------------------------------------------
    384 ;ALIGN JUMP_ALIGN
    385377.PrintTimeoutStringWithSecondsInAX:
     378    ; Get attribute to AX
     379    xchg    di, ax
     380    mov     si, ATTRIBUTE_CHARS.cNormalTimeout
     381    cmp     di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY
     382    eCMOVB  si, ATTRIBUTE_CHARS.cHurryTimeout
     383    call    MenuAttribute_GetToAXfromTypeInSI
     384
    386385    push    bp
    387 
    388     xchg    di, ax
    389386    mov     bp, sp
    390     call    .GetTimeoutAttributeToAXfromSecondsInDI
    391387    mov     si, .szSelectionTimeout
    392388    push    ax          ; Push attribute
     
    399395    db      DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
    400396    db      "%AAutoselection in %2u s",NULL
    401 
    402 ;--------------------------------------------------------------------
    403 ; .GetTimeoutAttributeToAXfromSecondsInDI
    404 ;   Parameters
    405 ;       DI:     Seconds to print
    406 ;   Returns:
    407 ;       AX:     Attribute byte for seconds
    408 ;   Corrupts registers:
    409 ;       SI
    410 ;--------------------------------------------------------------------
    411 ALIGN JUMP_ALIGN
    412 .GetTimeoutAttributeToAXfromSecondsInDI:
    413     mov     si, ATTRIBUTE_CHARS.cNormalTimeout
    414     cmp     di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY
    415     eCMOVB  si, ATTRIBUTE_CHARS.cHurryTimeout
    416     jmp     MenuAttribute_GetToAXfromTypeInSI
    417397
    418398
Note: See TracChangeset for help on using the changeset viewer.