Changeset 181 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu/Dialog


Ignore:
Timestamp:
Nov 13, 2011, 3:38:40 PM (13 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes to all parts of the project:

  • Size optimizations.
  • Added a define (EXCLUDE_FROM_XTIDECFG) to exclude unused library code from XTIDECFG.
  • Tried to minimize time spent with interrupts disabled.
  • Some minor attempts to improve speed (reordering instructions etc).
  • Tried to improve readability, did some cleanup and fixed some errors in comments.
Location:
trunk/Assembly_Library/Src/Menu/Dialog
Files:
4 edited

Legend:

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

    r162 r181  
    127127    ret
    128128
     129
    129130;--------------------------------------------------------------------
    130131; .GetWidthBasedOnParentMenuToAL
     
    141142    mov     al, [ss:bx+MENUINIT.bWidth]
    142143    sub     al, DIALOG_DELTA_WIDTH_FROM_PARENT
    143     MIN_U   al, DIALOG_MAX_WIDTH
    144     ret
     144    cmp     al, DIALOG_MAX_WIDTH
     145    jb      .ALlessThanDIALOG_MAX_WIDTH
     146    mov     al, DIALOG_MAX_WIDTH
     147ALIGN JUMP_ALIGN, ret
     148.ALlessThanDIALOG_MAX_WIDTH:
     149    ret
     150
    145151
    146152;--------------------------------------------------------------------
     
    161167    add     ah, [bp+MENUINIT.bInfoLines]
    162168    add     ah, BYTE MENU_VERTICAL_BORDER_LINES
    163     MIN_U   ah, bh
    164     MIN_U   ah, DIALOG_MAX_HEIGHT
     169    cmp     ah, bh
     170    jb      .AHlessThanBH
     171    xchg    bx, ax
     172ALIGN JUMP_ALIGN
     173.AHlessThanBH:
     174    cmp     ah, DIALOG_MAX_HEIGHT
     175    jb      .AHlessThanDIALOG_MAX_HEIGHT
     176    mov     ah, DIALOG_MAX_HEIGHT
     177ALIGN JUMP_ALIGN, ret
     178.AHlessThanDIALOG_MAX_HEIGHT:
    165179    ret
    166180
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm

    r170 r181  
    265265.FilterCurrentDirectory:
    266266    cmp     WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS
    267     je      SHORT .ReturnWithFiltering
     267    je      SHORT .DoFilter
    268268    ret
    269269
     
    274274    cmp     WORD [si+DTA.szFile], UPDIR_CHARACTERS
    275275    jne     SHORT .ReturnWithoutFiltering
    276 .ReturnWithFiltering:
     276.DoFilter:
    277277    add     sp, BYTE 2      ; Remove return address from stack
    278278ALIGN JUMP_ALIGN, ret
     
    375375SortDirectoryContentsStringFromESDIwithCountInCX:
    376376    call    Registers_CopyESDItoDSSI
    377     call    .AddDirectoryContentsStringLengthToDI
    378     mov     bx, .FileStringComparator
    379     xchg    dx, cx
    380     mov     cx, FILE_STRING_LENGTH
    381     jmp     Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX
    382 
    383 ALIGN JUMP_ALIGN
    384 .AddDirectoryContentsStringLengthToDI:
     377
     378    ; Add directory contents string length to DI
    385379    mov     ax, FILE_STRING_LENGTH
     380    push    ax
    386381    mul     cx
    387382    add     di, ax
    388     ret
     383
     384    mov     dx, cx
     385    pop     cx
     386    mov     bx, .FileStringComparator
     387    jmp     Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX
    389388
    390389;--------------------------------------------------------------------
     
    395394;       ES:DI:  Ptr to second item to compare
    396395;   Returns:
    397 ;       FLAGS:  Signed comparition between first and second item
     396;       FLAGS:  Signed comparison between first and second item
    398397;   Corrupts registers:
    399398;       Nothing
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm

    r73 r181  
    1 ; File name     :   DialogProgress.asm
    21; Project name  :   Assembly Library
    3 ; Created date  :   15.8.2010
    4 ; Last update   :   10.12.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Displays progress bar dialog and starts progress task.
    73
     
    4137    lds     si, [bp+DIALOG.fpDialogIO]
    4238    mov     bx, [si+PROGRESS_DIALOG_IO.wMaxProgressValue]
    43     MIN_U   ax, bx
    44     cmp     ax, bx  ; Make sure that last progress character is shown
    45     je      SHORT .UpdateProgressBar
    46 
     39    cmp     ax, bx
     40    jb      SHORT .AXlessThanBX
     41    mov     ax, bx
     42    jmp     SHORT .UpdateProgressBar
     43ALIGN JUMP_ALIGN
     44.AXlessThanBX:
    4745    mov     bx, ax
    4846    sub     bx, [si+PROGRESS_DIALOG_IO.wCurrentProgressValue]
     
    172170ALIGN JUMP_ALIGN
    173171DrawProgressBarFromDialogIoInDSSI:
    174     call    .GetFullCharsToCXandEmptyCharsToDXwithDialogIoInDSSI
    175 
    176     mov     al, PROGRESS_COMPLETE_CHARACTER
    177     call    .RepeatProgressCharacterCXtimesFromAL
    178 
    179     mov     cx, dx
    180     mov     al, PROGRESS_INCOMPLETE_CHARACTER
    181     jmp     SHORT .RepeatProgressCharacterCXtimesFromAL
    182 
    183 ;--------------------------------------------------------------------
    184 ; .GetFullCharsToCXandEmptyCharsToDXwithDialogIoInDSSI
    185 ;   Parameters:
    186 ;       DS:SI:  Ptr to PROGRESS_DIALOG_IO
    187 ;       SS:BP:  Ptr to DIALOG
    188 ;   Returns:
    189 ;       CX:     Number of full progress bar characters
    190 ;       DX:     Number of empty progress bar characters
    191 ;   Corrupts:
    192 ;       AX, BX
    193 ;--------------------------------------------------------------------
    194 ALIGN JUMP_ALIGN
    195 .GetFullCharsToCXandEmptyCharsToDXwithDialogIoInDSSI:
     172    ; Get full chars to CX and empty chars to DX
    196173    call    MenuLocation_GetMaxTextLineLengthToAX
    197174    mov     cx, ax
     
    200177    div     bx
    201178    xchg    cx, ax      ; AX = Text line length, CX = Number of full chars
    202 
    203179    sub     ax, cx
    204180    xchg    dx, ax      ; DX = Number of empty chars
    205     ret
     181
     182    mov     al, PROGRESS_COMPLETE_CHARACTER
     183    call    .RepeatProgressCharacterCXtimesFromAL
     184
     185    mov     cx, dx
     186    mov     al, PROGRESS_INCOMPLETE_CHARACTER
     187    ; Fall to .RepeatProgressCharacterCXtimesFromAL
    206188
    207189;--------------------------------------------------------------------
     
    239221    ret
    240222
    241    
     223
    242224;--------------------------------------------------------------------
    243225; DrawTimeElapsedFromDX
     
    286268
    287269    sub     cx, [si+PROGRESS_DIALOG_IO.wMinProgressValue]
    288     jcxz    .PreventDivisionByZero
     270    jz      SHORT .PreventDivisionByZero
    289271    div     cx          ; AX = Estimated ticks left
    290272    xchg    dx, ax
    291     jmp     SHORT FormatTicksFromDX
     273    SKIP2B  f   ; cmp ax, <next instruction>
    292274.PreventDivisionByZero:
    293275    xor     dx, dx
  • trunk/Assembly_Library/Src/Menu/Dialog/ItemLineSplitter.asm

    r133 r181  
    115115ALIGN JUMP_ALIGN
    116116.CheckLineLength:
    117     cmp     cx, [bp+ITEM_LINE_SPLITTER.wMaxTextLineLength]
    118     ja      SHORT .ChangeToNextLine
    119     clc
    120     ret
     117    cmp     [bp+ITEM_LINE_SPLITTER.wMaxTextLineLength], cx
     118    jb      SHORT .ChangeToNextLine
     119    ret     ; With CF cleared
    121120
    122121ALIGN JUMP_ALIGN
Note: See TracChangeset for help on using the changeset viewer.