Changeset 104 in xtideuniversalbios for trunk/Assembly_Library/Src


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.
Location:
trunk/Assembly_Library/Src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/Keyboard/Keyboard.asm

    r54 r104  
    1 ; File name     :   Keyboard.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   5.7.2010
    4 ; Last update   :   24.10.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for managing keyboard.
    73
  • trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm

    r52 r104  
    1 ; File name     :   CharOutLineSplitter.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   11.10.2010
    4 ; Last update   :   12.10.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for splitting menu lines during character output.
    73
     
    2016ALIGN JUMP_ALIGN
    2117CharOutLineSplitter_PrepareForPrintingTextLines:
    22     call    .GetLastTextLineColumnOffsetToDX
    23     call    CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX
    24     mov     ah, dl          ; AL = Text line first column, AH = Text line last column
     18    ; Get first text line column offset to DX
     19    call    CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
     20    add     al, MENU_TEXT_COLUMN_OFFSET<<1
     21    xchg    dx, ax
     22
     23    ; Get last text line column offset to AX
     24    call    MenuLocation_GetMaxTextLineLengthToAX
     25    shl     ax, 1           ; Characters to BYTEs
     26    add     ax, dx
     27
     28    xchg    ax, dx          ; AL = First text line column offset
     29    mov     ah, dl          ; AH = Last text line column offset
    2530    CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
    26     ret
    27 
    28 ;--------------------------------------------------------------------
    29 ; .GetLastTextLineColumnOffsetToDX
    30 ;   Parameters:
    31 ;       SS:BP:  Ptr to MENU
    32 ;   Returns:
    33 ;       DX:     Offset to last (allowed) character in text line
    34 ;   Corrupts registers:
    35 ;       AX
    36 ;--------------------------------------------------------------------
    37 ALIGN JUMP_ALIGN
    38 .GetLastTextLineColumnOffsetToDX:
    39     call    CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX
    40     xchg    dx, ax
    41     call    MenuLocation_GetMaxTextLineLengthToAX
    42     shl     ax, 1
    43     add     dx, ax
    4431    ret
    4532
    4633
    4734;--------------------------------------------------------------------
    48 ; CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX
    4935; CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
    5036;   Parameters:
     
    5541;       Nothing
    5642;--------------------------------------------------------------------
    57 ALIGN JUMP_ALIGN
    58 CharOutLineSplitter_GetFirstTextLineColumnOffsetToAX:
    59     call    CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
    60     add     al, MENU_TEXT_COLUMN_OFFSET<<1
    61     ret
    62 
    6343ALIGN JUMP_ALIGN
    6444CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX:
     
    11191    push    cx
    11292    push    ax
    113 
    114     call    GetOffsetToPartialWordToSIandSizeToCX
    115     call    MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
    116     jcxz    .NothingToMove
    117     call    MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
    118 .NothingToMove:
    119     pop     ax
    120     pop     cx
    121     pop     si
    122     ret
    123 
     93    ; Fall to .GetOffsetToPartialWordToSIandSizeToCX
    12494
    12595;--------------------------------------------------------------------
    126 ; GetOffsetToPartialWordToSIandSizeToCX
     96; .GetOffsetToPartialWordToSIandSizeToCX
    12797;   Parameters:
    12898;       ES:DI:  Ptr to space before border character
     
    133103;       Nothing
    134104;--------------------------------------------------------------------
    135 ALIGN JUMP_ALIGN
    136 GetOffsetToPartialWordToSIandSizeToCX:
     105.GetOffsetToPartialWordToSIandSizeToCX:
    137106    xor     cx, cx
    138107    mov     si, di
     
    150119    inc     si          ; SI now points one past space
    151120    shl     cx, 1       ; Characters to bytes
    152     ret
    153 
     121    ; Fall to .ChangeLine
    154122
    155123;--------------------------------------------------------------------
    156 ; MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
     124; .ChangeLine
     125;   Parameters:
     126;       Nothing
     127;   Returns:
     128;       Nothing
     129;   Corrupts registers:
     130;       AX, DX
     131;--------------------------------------------------------------------
     132.ChangeLine:
     133    call    MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
     134    jcxz    .ReturnFromMovePartialWordToNewTextLine
     135    ; Fall to .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
     136
     137;--------------------------------------------------------------------
     138; .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
    157139;   Parameters:
    158140;       CX:     Number of BYTEs in partial word
     
    165147;       AX, CX, DX, SI
    166148;--------------------------------------------------------------------
    167 ALIGN JUMP_ALIGN
    168 MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX:
     149.MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX:
    169150    push    si
    170151    push    cx
     
    178159    call    DisplayPrint_RepeatCharacterFromALwithCountInCX
    179160    mov     di, si
     161
     162.ReturnFromMovePartialWordToNewTextLine:
     163    pop     ax
     164    pop     cx
     165    pop     si
    180166    ret
  • trunk/Assembly_Library/Src/Menu/Menu.asm

    r60 r104  
    1 ; File name     :   Menu.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   3.8.2010
    4 ; Last update   :   22.11.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Menu Library functions for CALL_MENU_LIBRARY macro
    73;                   that users should use to make library call.
  • trunk/Assembly_Library/Src/Menu/MenuAttributes.asm

    r52 r104  
    1 ; File name     :   MenuAttributes.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   15.7.2010
    4 ; Last update   :   9.8.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Finds suitable character attribute for
    73;                   color, B/W and monochrome displays.
  • 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
  • trunk/Assembly_Library/Src/Menu/MenuCharOut.asm

    r52 r104  
    1 ; File name     :   MenuCharOut.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   15.7.2010
    4 ; Last update   :   12.10.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Character out function for printing withing menu window.
    73
  • trunk/Assembly_Library/Src/Menu/MenuEvent.asm

    r58 r104  
    1 ; File name     :   MenuEvent.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   13.7.2010
    4 ; Last update   :   12.10.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for initializing menu system.
    73
  • trunk/Assembly_Library/Src/Menu/MenuInit.asm

    r60 r104  
    1 ; File name     :   MenuInit.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   13.7.2010
    4 ; Last update   :   22.11.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for initializing menu system.
    73
     
    2521    LOAD_BDA_SEGMENT_TO ds, cx
    2622    push    WORD [BDA.wVidCurShape]
    27     eENTER_STRUCT MENU_size
     23    mov     cl, MENU_size
     24    eENTER_STRUCT cx
    2825
    29     mov     cx, MENU_size
    3026    call    Memory_ZeroSSBPwithSizeInCX
    3127    call    MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
     
    5955    mov     ax, CURSOR_HIDDEN
    6056    CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
    61     call    MenuEvent_InitializeMenuinit        ; User initialization
     57    call    MenuEvent_InitializeMenuinit    ; User initialization
    6258    call    MenuInit_RefreshMenuWindow
    6359    jmp     MenuLoop_Enter
  • trunk/Assembly_Library/Src/Menu/MenuLocation.asm

    r60 r104  
    1 ; File name     :   MenuLocation.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   14.7.2010
    4 ; Last update   :   25.11.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for calculation menu window dimensions.
    73
    84; Section containing code
    95SECTION .text
    10 
    11 ;--------------------------------------------------------------------
    12 ; MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
    13 ;   Parameters
    14 ;       AX:     Item index
    15 ;       SS:BP:  Ptr to MENU
    16 ;   Returns:
    17 ;       AL:     Column (X)
    18 ;       AH:     Row (Y)
    19 ;   Corrupts registers:
    20 ;       Nothing
    21 ;--------------------------------------------------------------------
    22 ALIGN JUMP_ALIGN
    23 MenuLocation_GetScrollbarCoordinatesToAXforItemInAX:
    24     call    MenuLocation_GetTextCoordinatesToAXforItemInAX
    25     add     al, [bp+MENUINIT.bWidth]
    26     sub     al, MENU_TEXT_COLUMN_OFFSET*2
    27     ret
    28 
    296
    307;--------------------------------------------------------------------
     
    7249; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
    7350; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
    74 ; MenuLocation_GetInformationBordersTopLeftCoordinatesToAX
    7551; MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
    7652;   Parameters
     
    9369
    9470ALIGN JUMP_ALIGN
    95 MenuLocation_GetInformationBordersTopLeftCoordinatesToAX:
    96     xor     ax, ax
    97     jmp     SHORT AddInformationBordersTopLeftCoordinatesToAX
    98 
    99 ALIGN JUMP_ALIGN
    10071MenuLocation_GetBottomBordersTopLeftCoordinatesToAX:
    10172    xor     ax, ax
    102     ; Fall to AddBottomBordersTopLeftCoordinatesToAX
     73    ; Fall to .AddBottomBordersTopLeftCoordinatesToAX
    10374
    10475;--------------------------------------------------------------------
    105 ; AddBottomBordersTopLeftCoordinatesToAX
     76; .AddBottomBordersTopLeftCoordinatesToAX
    10677; AddInformationBordersTopLeftCoordinatesToAX
    10778; AddItemBordersTopLeftCoordinatesToAX
     
    11687;       Nothing
    11788;--------------------------------------------------------------------
    118 ALIGN JUMP_ALIGN
    119 AddBottomBordersTopLeftCoordinatesToAX:
     89.AddBottomBordersTopLeftCoordinatesToAX:
    12090    stc                         ; Compensate for Information top border
    12191    adc     ah, [bp+MENUINIT.bInfoLines]
     
    160130    sub     ax, BYTE MENU_HORIZONTAL_BORDER_LINES + MENU_TEXT_COLUMN_OFFSET
    161131    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 ;--------------------------------------------------------------------
    175 ALIGN JUMP_ALIGN
    176 MenuLocation_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/MenuText.asm

    r67 r104  
    250250    call    MenuBorders_AdjustDisplayContextForDrawingBorders
    251251    mov     ax, cx
    252     call    MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
     252
     253    call    MenuLocation_GetTextCoordinatesToAXforItemInAX
     254    add     al, [bp+MENUINIT.bWidth]
     255    sub     al, MENU_TEXT_COLUMN_OFFSET*2
    253256    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    254257
Note: See TracChangeset for help on using the changeset viewer.