Changeset 105 in xtideuniversalbios for trunk/Assembly_Library


Ignore:
Timestamp:
Feb 17, 2011, 2:52:42 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:

  • More optimizations to reduce size.
  • Removed some utility functions to reduce size.
Location:
trunk/Assembly_Library
Files:
1 added
10 edited

Legend:

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

    r104 r105  
    1414%include "Macros.inc"
    1515%include "Math.inc"
     16%include "Registers.inc"
    1617
    1718; Library dependencies
  • trunk/Assembly_Library/Inc/Menu.inc

    r62 r105  
    129129MENU_TEXT_ROW_OFFSET                EQU     1
    130130MENU_TEXT_COLUMN_OFFSET             EQU     2
    131 MENU_TIMEOUT_STRING_CHARACTERS      EQU     23
     131MENU_TIMEOUT_STRING_CHARACTERS      EQU     19
    132132MENU_TIMEOUT_SECONDS_FOR_HURRY      EQU     3
    133133
  • trunk/Assembly_Library/Src/File/FileIO.asm

    r67 r105  
    1 ; File name     :   FileIO.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   1.9.2010
    4 ; Last update   :   6.12.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for file access.
    73
     
    175171ALIGN JUMP_ALIGN
    176172.TransferNextBytes:
    177     call    Registers_NormalizeDSSI
     173    call    NormalizeDSSI
    178174    call    bp                      ; Transfer function
    179175    jc      SHORT .ErrorOccurredDuringTransfer
     
    184180    pop     cx                      ; CX = Bytes for last transfer
    185181    jcxz    .ReturnErrorCodeInAX    ; No remaining bytes
    186     call    Registers_NormalizeDSSI
     182    call    NormalizeDSSI
    187183    call    bp
    188184.ReturnErrorCodeInAX:
     
    195191    pop     cx                      ; Remove bytes for last transfer
    196192    jmp     SHORT .ReturnErrorCodeInAX
     193
     194;--------------------------------------------------------------------
     195; NormalizeDSSI
     196;   Parameters
     197;       DS:SI:  Ptr to normalize
     198;   Returns:
     199;       DS:SI:  Normalized pointer
     200;   Corrupts registers:
     201;       Nothing
     202;--------------------------------------------------------------------
     203ALIGN JUMP_ALIGN
     204NormalizeDSSI:
     205    push    dx
     206    push    ax
     207    NORMALIZE_FAR_POINTER ds, si, ax, dx
     208    pop     ax
     209    pop     dx
     210    ret
    197211
    198212
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm

    r103 r105  
    4545.ItemSelectedFromCX:
    4646    call    LoadItemStringBufferToESDI
    47     Registers_CopyESDItoDSSI
     47    COPY_ESDI_to_DSSI
    4848    call    ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
    4949    jmp     ParseSelectionFromItemLineInDSSI
     
    128128    call    RemoveLastLFandTerminateESDIwithNull
    129129
    130     Registers_CopySSBPtoDSSI
     130    COPY_SSBP_TO_DSSI
    131131    xor     ax, ax
    132132    call    Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
     
    198198ALIGN JUMP_ALIGN
    199199.ClearDLifInRootDirectory:
    200     Registers_CopyESDItoDSSI
     200    COPY_ESDI_to_DSSI
    201201    call    Directory_WriteCurrentPathToDSSI
    202202    mov     dl, [si]
     
    374374ALIGN JUMP_ALIGN
    375375SortDirectoryContentsStringFromESDIwithCountInCX:
    376     Registers_CopyESDItoDSSI
     376    COPY_ESDI_to_DSSI
    377377    call    .AddDirectoryContentsStringLengthToDI
    378378    mov     bx, .FileStringComparator
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r104 r105  
    394394    db      DOUBLE_BOTTOM_LEFT_CORNER
    395395    db      DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
    396     db      "%AAutoselection in %2u s",NULL
     396    db      "%ASelection in %2u s",NULL
    397397
    398398
  • trunk/Assembly_Library/Src/Menu/MenuLoop.asm

    r60 r105  
    1 ; File name     :   MenuLoop.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   22.7.2010
    4 ; Last update   :   25.11.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Menu loop for waiting keystrokes.
    73
     
    2218    call    KeystrokeProcessing
    2319    call    TimeoutProcessing
    24     call    IdleTimeProcessing
     20    call    MenuEvent_IdleProcessing    ; User idle processing
    2521    test    BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
    2622    jz      SHORT MenuLoop_Enter
     
    2925
    3026;--------------------------------------------------------------------
    31 ; IdleTimeProcessing
     27; KeystrokeProcessing
    3228; TimeoutProcessing
    33 ; KeystrokeProcessing
    3429;   Parameters
    3530;       SS:BP:  Ptr to MENU
     
    4035;--------------------------------------------------------------------
    4136ALIGN JUMP_ALIGN
    42 IdleTimeProcessing:
    43     jmp     MenuEvent_IdleProcessing        ; User idle processing
     37KeystrokeProcessing:
     38    call    Keyboard_GetKeystrokeToAX
     39    jnz     SHORT ProcessKeystrokeFromAX
     40NoKeystrokeToProcess:
     41    ret
    4442
    4543ALIGN JUMP_ALIGN
    4644TimeoutProcessing:
    4745    call    MenuTime_UpdateSelectionTimeout
     46    jnc     NoKeystrokeToProcess
    4847    mov     ah, MENU_KEY_ENTER              ; Fake ENTER to select item
    49     jc      SHORT ProcessKeystrokeFromAX    ; Process faked ENTER
    50     ret
    51 
    52 ALIGN JUMP_ALIGN
    53 KeystrokeProcessing:
    54     call    Keyboard_GetKeystrokeToAX
    55     jnz     SHORT ProcessKeystrokeFromAX
    56     ret
     48    ; Fall to ProcessKeystrokeFromAX
    5749
    5850
     
    7466    xchg    ax, cx
    7567    call    .ProcessMenuSystemKeystrokeFromAX
    76     jc      SHORT .Return
     68    jc      SHORT NoKeystrokeToProcess
    7769    jmp     MenuEvent_KeyStrokeInAX
    78 ALIGN JUMP_ALIGN, ret
    79 .Return:
    80     ret
    8170
    8271;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm

    r67 r105  
    1 ; File name     :   MenuScrollbars.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   20.7.2010
    4 ; Last update   :   9.12.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for drawing scroll bars over menu borders.
    73
     
    185181
    186182;--------------------------------------------------------------------
    187 ; .IsItemInCXonVisiblePage
     183; MenuScrollbars_IsItemInCXonVisiblePage
    188184;   Parameters
    189185;       CX:     Item whose visibility is to be checked
     
    197193ALIGN JUMP_ALIGN
    198194MenuScrollbars_IsItemInCXonVisiblePage:
    199     cmp     cx, [bp+MENUINIT.wItems]
    200     jae     SHORT .ItemIsNotVisible
    201 
    202195    cmp     cx, [bp+MENU.wFirstVisibleItem]
    203196    jb      SHORT .ItemIsNotVisible
     
    215208
    216209;--------------------------------------------------------------------
    217 ; MenuLocation_GetLastVisibleItemOnPageToAX
     210; MenuScrollbars_GetLastVisibleItemOnPageToAX
    218211;   Parameters
    219212;       SS:BP:  Ptr to MENU
  • trunk/Assembly_Library/Src/Menu/MenuTime.asm

    r62 r105  
    1 ; File name     :   MenuTime.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   25.7.2010
    4 ; Last update   :   30.11.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Menu timeouts other time related functions.
    73
     
    4137MenuTime_StopSelectionTimeout:
    4238    test    BYTE [bp+MENU.bFlags], FLG_MENU_TIMEOUT_COUNTDOWN
    43     jz      SHORT .TimeoutAlreadyStopped
     39    jz      SHORT TimeoutAlreadyStopped
    4440    and     BYTE [bp+MENU.bFlags], ~FLG_MENU_TIMEOUT_COUNTDOWN
    4541    jmp     MenuBorders_RedrawBottomBorderLine
    46 ALIGN JUMP_ALIGN
    47 .TimeoutAlreadyStopped:
    48     ret
    4942
    5043
     
    7770    call    MenuBorders_RedrawBottomBorderLine
    7871    clc
    79 ALIGN JUMP_ALIGN
    8072.ReturnSinceTimeoutDisabled:
     73TimeoutAlreadyStopped:
    8174    ret
    8275
  • trunk/Assembly_Library/Src/Util/Memory.asm

    r103 r105  
    6666    push    di
    6767    push    ax
    68     Registers_CopySSBPtoESDI
     68    call    Registers_CopySSBPtoESDI
    6969    call    Memory_ZeroESDIwithSizeInCX
    7070    pop     ax
  • trunk/Assembly_Library/Src/Util/Registers.asm

    r103 r105  
    11; Project name  :   Assembly Library
    22; Description   :   Functions for register operations.
    3 
    4 ;--------------------------------------------------------------------
    5 ; NORMALIZE_FAR_POINTER
    6 ;   Parameters:
    7 ;       %1:%2:      Far pointer to normalize
    8 ;       %3:         Scratch register
    9 ;       %4:         Scratch register
    10 ;   Returns:
    11 ;       %1:%2:      Normalized far pointer
    12 ;   Corrupts registers:
    13 ;       %3, %4
    14 ;--------------------------------------------------------------------
    15 %macro NORMALIZE_FAR_POINTER 4
    16     mov     %4, %2              ; Copy offset to scratch reg
    17     and     %2, BYTE 0Fh        ; Clear offset bits 15...4
    18     eSHR_IM %4, 4               ; Divide offset by 16
    19     mov     %3, %1              ; Copy segment to scratch reg
    20     add     %3, %4              ; Add shifted offset to segment
    21     mov     %1, %3              ; Set normalized segment
    22 %endmacro
    233
    244
    255; Section containing code
    266SECTION .text
    27 
    28 ;--------------------------------------------------------------------
    29 ; Registers_NormalizeDSSI
    30 ; Registers_NormalizeESDI
    31 ;   Parameters
    32 ;       DS:SI or ES:DI: Ptr to normalize
    33 ;   Returns:
    34 ;       DS:SI or ES:DI: Normalized pointer
    35 ;   Corrupts registers:
    36 ;       Nothing
    37 ;--------------------------------------------------------------------
    38 ALIGN JUMP_ALIGN
    39 Registers_NormalizeDSSI:
    40     push    dx
    41     push    ax
    42     NORMALIZE_FAR_POINTER ds, si, ax, dx
    43     pop     ax
    44     pop     dx
    45     ret
    46 
    47 ALIGN JUMP_ALIGN
    48 Registers_NormalizeESDI:
    49     push    dx
    50     push    ax
    51     NORMALIZE_FAR_POINTER es, di, ax, dx
    52     pop     ax
    53     pop     dx
    54     ret
    55 
    567
    578;--------------------------------------------------------------------
     
    7627;--------------------------------------------------------------------
    7728; Registers_CopySSBPtoESDI
    78 ; Registers_CopySSBPtoDSSI
    79 ; Registers_CopyDSSItoESDI
    80 ; Registers_CopyESDItoDSSI
     29; Registers_CopySSBPtoDSSI (uncommented to save bytes)
     30; Registers_CopyDSSItoESDI (uncommented to save bytes)
     31; Registers_CopyESDItoDSSI (uncommented to save bytes)
    8132;   Parameters
    8233;       Nothing
     
    8637;       Nothing
    8738;--------------------------------------------------------------------
    88 %macro Registers_CopySSBPtoESDI 0
    89     push    ss
    90     pop     es
    91     mov     di, bp
    92 %endmacro
     39ALIGN JUMP_ALIGN
     40Registers_CopySSBPtoESDI:
     41    COPY_SSBP_TO_ESDI
     42    ret
    9343
    94 %macro Registers_CopySSBPtoDSSI 0
    95     push    ss
    96     pop     ds
    97     mov     si, bp
    98 %endmacro
     44;ALIGN JUMP_ALIGN
     45;Registers_CopySSBPtoDSSI:
     46;   COPY_SSBP_TO_DSSI
     47;   ret
    9948
    100 %macro Registers_CopyDSSItoESDI 0
    101     push    ds
    102     pop     es
    103     mov     di, si
    104 %endmacro
     49;ALIGN JUMP_ALIGN
     50;Registers_CopyDSSItoESDI:
     51;   COPY_DSSI_TO_ESDI
     52;   ret
    10553
    106 %macro Registers_CopyESDItoDSSI 0
    107     push    es
    108     pop     ds
    109     mov     si, di
    110 %endmacro
     54;ALIGN JUMP_ALIGN
     55;Registers_CopyESDItoDSSI:
     56;   COPY_ESDI_to_DSSI
     57;   ret
    11158
    11259
    11360;--------------------------------------------------------------------
    114 ; Registers_SetZFifNullPointerInDSSI
     61; Registers_SetZFifNullPointerInDSSI (uncommented to save bytes)
    11562;   Parameters
    11663;       DS:SI:  Far pointer
     
    12067;       Nothing
    12168;--------------------------------------------------------------------
    122 ALIGN JUMP_ALIGN
    123 Registers_SetZFifNullPointerInDSSI:
    124     push    ax
    125     mov     ax, ds
    126     or      ax, si
    127     pop     ax
    128     ret
     69;ALIGN JUMP_ALIGN
     70;Registers_SetZFifNullPointerInDSSI:
     71;   push    ax
     72;   mov     ax, ds
     73;   or      ax, si
     74;   pop     ax
     75;   ret
Note: See TracChangeset for help on using the changeset viewer.