Changeset 181 in xtideuniversalbios for trunk/Assembly_Library


Ignore:
Timestamp:
Nov 13, 2011, 3:38:40 PM (12 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
Files:
17 edited

Legend:

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

    r168 r181  
    452452        times %2    %3      %1, 1
    453453    %else
    454         %if %2 > 7
     454;       %if %2 > 7  ; Original value
     455        %if %2 > 3  ; Size optimized value
    455456            push    cx
    456457            mov     cl, %2
  • trunk/Assembly_Library/Inc/Math.inc

    r172 r181  
    4343;       %2:     Operand 2
    4444;   Returns:
    45 ;       %1:     Lesser operand
     45;       %1:     Greater operand
    4646;   Corrupts registers:
    4747;       Nothing
  • trunk/Assembly_Library/Src/Display/Display.asm

    r177 r181  
    5757    jmp     ax
    5858
    59        
    60 %define InitializeDisplayContext                        DisplayContext_Initialize
     59
     60    %define InitializeDisplayContext                        DisplayContext_Initialize
    6161
    6262%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    63 %define SetCharacterPointerFromBXAX                     DisplayContext_SetCharacterPointerFromBXAX
     63    %define SetCharacterPointerFromBXAX                     DisplayContext_SetCharacterPointerFromBXAX
    6464%endif
    65 %define SetCharOutputFunctionFromAXwithAttribFlagInBL   DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL
    66 %define SetCharacterOutputParameterFromAX               DisplayContext_SetCharacterOutputParameterFromAX
    67 %define SetCharacterAttributeFromAL                     DisplayContext_SetCharacterAttributeFromAL
    68 %define SetCursorShapeFromAX                            DisplayCursor_SetShapeFromAX
    69 %define SetCursorCoordinatesFromAX                      DisplayCursor_SetCoordinatesFromAX
    70 %define SetNewPageFromAL                                DisplayPage_SetFromAL
    71 %define SynchronizeDisplayContextToHardware             DisplayContext_SynchronizeToHardware
     65    %define SetCharOutputFunctionFromAXwithAttribFlagInBL   DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL
     66    %define SetCharacterOutputParameterFromAX               DisplayContext_SetCharacterOutputParameterFromAX
     67    %define SetCharacterAttributeFromAL                     DisplayContext_SetCharacterAttributeFromAL
     68    %define SetCursorShapeFromAX                            DisplayCursor_SetShapeFromAX
     69    %define SetCursorCoordinatesFromAX                      DisplayCursor_SetCoordinatesFromAX
     70    %define SetNewPageFromAL                                DisplayPage_SetFromAL
     71    %define SynchronizeDisplayContextToHardware             DisplayContext_SynchronizeToHardware
    7272
    7373%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    74 %define GetCharacterPointerToBXAX                       DisplayContext_GetCharacterPointerToBXAX
     74    %define GetCharacterPointerToBXAX                       DisplayContext_GetCharacterPointerToBXAX
    7575%endif
    76 %define GetSoftwareCoordinatesToAX                      DisplayCursor_GetSoftwareCoordinatesToAX
    77 %define GetColumnsToALandRowsToAH                       DisplayPage_GetColumnsToALandRowsToAH
     76    %define GetSoftwareCoordinatesToAX                      DisplayCursor_GetSoftwareCoordinatesToAX
     77    %define GetColumnsToALandRowsToAH                       DisplayPage_GetColumnsToALandRowsToAH
    7878
    79 %define FormatNullTerminatedStringFromCSSI              Display_FormatNullTerminatedStringFromCSSI
     79    %define FormatNullTerminatedStringFromCSSI              Display_FormatNullTerminatedStringFromCSSI
    8080%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    81 %define PrintSignedWordFromAXWithBaseInBX               DisplayPrint_SignedWordFromAXWithBaseInBX
     81    %define PrintSignedWordFromAXWithBaseInBX               DisplayPrint_SignedWordFromAXWithBaseInBX
    8282%endif
    83 %define PrintWordFromAXwithBaseInBX                     DisplayPrint_WordFromAXWithBaseInBX
    84 %define PrintCharBufferFromBXSIwithLengthInCX           DisplayPrint_CharacterBufferFromBXSIwithLengthInCX
    85 %define PrintNullTerminatedStringFromBXSI               DisplayPrint_NullTerminatedStringFromBXSI
    86 %define PrintNullTerminatedStringFromCSSI               DisplayPrint_NullTerminatedStringFromCSSI
    87 %define PrintRepeatedCharacterFromALwithCountInCX       DisplayPrint_RepeatCharacterFromALwithCountInCX
    88 %define PrintCharacterFromAL                            DisplayPrint_CharacterFromAL
    89 %define PrintNewlineCharacters                          DisplayPrint_Newline
     83    %define PrintWordFromAXwithBaseInBX                     DisplayPrint_WordFromAXWithBaseInBX
     84    %define PrintCharBufferFromBXSIwithLengthInCX           DisplayPrint_CharacterBufferFromBXSIwithLengthInCX
     85    %define PrintNullTerminatedStringFromBXSI               DisplayPrint_NullTerminatedStringFromBXSI
     86    %define PrintNullTerminatedStringFromCSSI               DisplayPrint_NullTerminatedStringFromCSSI
     87    %define PrintRepeatedCharacterFromALwithCountInCX       DisplayPrint_RepeatCharacterFromALwithCountInCX
     88    %define PrintCharacterFromAL                            DisplayPrint_CharacterFromAL
     89    %define PrintNewlineCharacters                          DisplayPrint_Newline
    9090%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    91 %define ClearAreaWithHeightInAHandWidthInAL             DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
     91    %define ClearAreaWithHeightInAHandWidthInAL             DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
    9292%endif
    93 %define ClearScreenWithCharInALandAttrInAH              DisplayPrint_ClearScreenWithCharInALandAttributeInAH
     93    %define ClearScreenWithCharInALandAttrInAH              DisplayPrint_ClearScreenWithCharInALandAttributeInAH
    9494
  • trunk/Assembly_Library/Src/Display/DisplayContext.asm

    r162 r181  
    268268;       Nothing
    269269;--------------------------------------------------------------------
    270 ;%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS  ; This appears to be completely unused
    271 ;ALIGN JUMP_ALIGN
    272 ;DisplayContext_GetCharacterOutputParameterToDX:
    273 ;   mov     dx, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
    274 ;   ret
    275 ;%endif
     270%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG  ; This is currently unused (dead code)
     271ALIGN JUMP_ALIGN
     272DisplayContext_GetCharacterOutputParameterToDX:
     273    mov     dx, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
     274    ret
     275%endif
    276276
    277277
  • trunk/Assembly_Library/Src/Display/DisplayFormat.asm

    r134 r181  
    5252    dec     bp
    5353    dec     bp              ; SS:BP now points to next parameter
    54     test    cx, cx
    55     jnz     SHORT PrependOrAppendSpaces
     54    inc     cx
     55    loop    PrependOrAppendSpaces
    5656ReturnFromFormat:
    5757    ret
  • trunk/Assembly_Library/Src/Display/DisplayPrint.asm

    r162 r181  
    158158    loop    .PrintNextCharacter
    159159
    160     mov     ds, cx  ; Restore DS to BDA. Not needed unless DisplayPrint_CharacterFromAL changes DS.
     160    ;mov        ds, cx  ; Restore DS to BDA. Not needed unless DisplayPrint_CharacterFromAL changes DS.
    161161    pop     cx
    162162    pop     si
     
    304304;       DI:     Updated offset to video RAM
    305305;   Corrupts registers:
    306 ;       AX, DX
     306;       DX
    307307;--------------------------------------------------------------------
    308308ALIGN JUMP_ALIGN
  • trunk/Assembly_Library/Src/File/Drive.asm

    r133 r181  
    7272    call    Drive_SetDefaultFromDL
    7373    eMOVZX  cx, al          ; Number of potentially valid drive letters available
    74     MIN_U   cx, 32
     74    cmp     cl, 32
     75    jb      SHORT .Return
     76    mov     cl, 32
     77ALIGN JUMP_ALIGN, ret
     78.Return:
    7579    ret
    7680
  • trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm

    r104 r181  
    104104;--------------------------------------------------------------------
    105105.GetOffsetToPartialWordToSIandSizeToCX:
    106     xor     cx, cx
     106    mov     cx, di
    107107    mov     si, di
    108108ALIGN JUMP_ALIGN
     
    111111    dec     si
    112112    cmp     BYTE [es:si], ' '
    113     je      SHORT .PartialWordFound
    114     inc     cx
    115     jmp     SHORT .ScanNextCharacter
    116 ALIGN JUMP_ALIGN
    117 .PartialWordFound:
     113    jne     SHORT .ScanNextCharacter
    118114    inc     si
    119115    inc     si          ; SI now points one past space
    120     shl     cx, 1       ; Characters to bytes
     116    sub     cx, si
    121117    ; Fall to .ChangeLine
    122118
  • 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
  • trunk/Assembly_Library/Src/Menu/Menu.asm

    r177 r181  
    3131
    3232
    33 %define DisplayWithHandlerInBXandUserDataInDXAX     MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
    34 ;%define Close                                      MenuInit_CloseMenuWindow                ; Special case in CALL_MENU_LIBRARY
    35 %define RefreshWindow                       MenuInit_RefreshMenuWindow
     33    %define DisplayWithHandlerInBXandUserDataInDXAX         MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
     34    ;%define Close                                          MenuInit_CloseMenuWindow                ; Special case in CALL_MENU_LIBRARY
     35    %define RefreshWindow                                   MenuInit_RefreshMenuWindow
    3636
    37 ;%define SetUserDataFromDSSI                MenuInit_SetUserDataFromDSSI            ; Special case in CALL_MENU_LIBRARY
    38 ;%define GetUserDataToDSSI                  MenuInit_GetUserDataToDSSI              ; Special case in CALL_MENU_LIBRARY
     37    ;%define SetUserDataFromDSSI                            MenuInit_SetUserDataFromDSSI            ; Special case in CALL_MENU_LIBRARY
     38    ;%define GetUserDataToDSSI                              MenuInit_GetUserDataToDSSI              ; Special case in CALL_MENU_LIBRARY
    3939
    40 ;%define SetTitleHeightFromAL               MenuInit_SetTitleHeightFromAL           ; Special case in CALL_MENU_LIBRARY
    41 %define ClearTitleArea                      MenuText_ClearTitleArea
    42 %define RefreshTitle                        MenuText_RefreshTitle
     40    ;%define SetTitleHeightFromAL                           MenuInit_SetTitleHeightFromAL           ; Special case in CALL_MENU_LIBRARY
     41    %define ClearTitleArea                                  MenuText_ClearTitleArea
     42    %define RefreshTitle                                    MenuText_RefreshTitle
    4343
    44 %define HighlightItemFromAX                 MenuInit_HighlightItemFromAX
    45 ;%define SetTotalItemsFromAX                MenuInit_SetTotalItemsFromAX            ; Special case in CALL_MENU_LIBRARY
    46 %define RefreshItemFromAX                   MenuText_RefreshItemFromAX
     44    %define HighlightItemFromAX                             MenuInit_HighlightItemFromAX
     45    ;%define SetTotalItemsFromAX                            MenuInit_SetTotalItemsFromAX            ; Special case in CALL_MENU_LIBRARY
     46    %define RefreshItemFromAX                               MenuText_RefreshItemFromAX
    4747
    48 ;%define SetInformationHeightFromAL                     MenuInit_SetInformationHeightFromAL     ; Special case in CALL_MENU_LIBRARY
    49 %define ClearInformationArea                            MenuText_ClearInformationArea
    50 %define RefreshInformation                              MenuText_RefreshInformation
     48    ;%define SetInformationHeightFromAL                     MenuInit_SetInformationHeightFromAL     ; Special case in CALL_MENU_LIBRARY
     49    %define ClearInformationArea                            MenuText_ClearInformationArea
     50    %define RefreshInformation                              MenuText_RefreshInformation
    5151
    52 %define StartSelectionTimeoutWithTicksInAX              MenuTime_StartSelectionTimeoutWithTicksInAX
     52    %define StartSelectionTimeoutWithTicksInAX              MenuTime_StartSelectionTimeoutWithTicksInAX
    5353
    5454%ifdef INCLUDE_MENU_DIALOGS
    55 %define StartProgressTaskWithIoInDSSIandParamInDXAX     DialogProgress_StartProgressTaskWithIoInDSSIandParamInDXAX
    56 %define SetProgressValueFromAX                          DialogProgress_SetProgressValueFromAX
     55    %define StartProgressTaskWithIoInDSSIandParamInDXAX     DialogProgress_StartProgressTaskWithIoInDSSIandParamInDXAX
     56    %define SetProgressValueFromAX                          DialogProgress_SetProgressValueFromAX
    5757
    58 %define DisplayMessageWithInputInDSSI                   DialogMessage_DisplayMessageWithInputInDSSI
    59 %define GetSelectionToAXwithInputInDSSI                 DialogSelection_GetSelectionToAXwithInputInDSSI
    60 %define GetWordWithIoInDSSI                             DialogWord_GetWordWithIoInDSSI
    61 %define GetStringWithIoInDSSI                           DialogString_GetStringWithIoInDSSI
    62 %define GetFileNameWithIoInDSSI                         DialogFile_GetFileNameWithIoInDSSI
    63 %define GetDriveWithIoInDSSI                            DialogDrive_GetDriveWithIoInDSSI
     58    %define DisplayMessageWithInputInDSSI                   DialogMessage_DisplayMessageWithInputInDSSI
     59    %define GetSelectionToAXwithInputInDSSI                 DialogSelection_GetSelectionToAXwithInputInDSSI
     60    %define GetWordWithIoInDSSI                             DialogWord_GetWordWithIoInDSSI
     61    %define GetStringWithIoInDSSI                           DialogString_GetStringWithIoInDSSI
     62    %define GetFileNameWithIoInDSSI                         DialogFile_GetFileNameWithIoInDSSI
     63    %define GetDriveWithIoInDSSI                            DialogDrive_GetDriveWithIoInDSSI
    6464%endif
    6565
  • trunk/Assembly_Library/Src/Menu/MenuLocation.asm

    r104 r181  
    44; Section containing code
    55SECTION .text
    6 
    7 ;--------------------------------------------------------------------
    8 ; MenuLocation_GetTitleTextTopLeftCoordinatesToAX
    9 ; MenuLocation_GetInformationTextTopLeftCoordinatesToAX
    10 ;   Parameters
    11 ;       SS:BP:  Ptr to MENU
    12 ;   Returns:
    13 ;       AL:     Column (X)
    14 ;       AH:     Row (Y)
    15 ;   Corrupts registers:
    16 ;       Nothing
    17 ;--------------------------------------------------------------------
    18 ALIGN JUMP_ALIGN
    19 MenuLocation_GetTitleTextTopLeftCoordinatesToAX:
    20     mov     ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
    21     jmp     SHORT MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
    22 
    23 ALIGN JUMP_ALIGN
    24 MenuLocation_GetInformationTextTopLeftCoordinatesToAX:
    25     mov     ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
    26     jmp     SHORT AddInformationBordersTopLeftCoordinatesToAX
    27 
    286
    297;--------------------------------------------------------------------
     
    4321    xchg    al, ah                              ; Line to AH, clear AL
    4422    add     ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
    45     jmp     SHORT AddItemBordersTopLeftCoordinatesToAX
    46 
     23    SKIP2B  f   ; cmp ax, <next instruction>
     24    ; Fall to MenuLocation_GetItemBordersTopLeftCoordinatesToAX
    4725
    4826;--------------------------------------------------------------------
     27; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
     28; MenuLocation_GetTitleTextTopLeftCoordinatesToAX
    4929; MenuLocation_GetTitleBordersTopLeftCoordinatesToAX
    50 ; MenuLocation_GetItemBordersTopLeftCoordinatesToAX
     30; MenuLocation_GetInformationTextTopLeftCoordinatesToAX
    5131; MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
    5232;   Parameters
     
    5838;       Nothing
    5939;--------------------------------------------------------------------
     40MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
     41    xor     ax, ax
     42    jmp     SHORT AddItemBordersTopLeftCoordinatesToAX
     43
    6044ALIGN JUMP_ALIGN
     45MenuLocation_GetTitleTextTopLeftCoordinatesToAX:
     46    mov     ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
     47    SKIP2B  f   ; cmp ax, <next instruction>
    6148MenuLocation_GetTitleBordersTopLeftCoordinatesToAX:
    6249    xor     ax, ax
     
    6451
    6552ALIGN JUMP_ALIGN
    66 MenuLocation_GetItemBordersTopLeftCoordinatesToAX:
    67     xor     ax, ax
    68     jmp     SHORT AddItemBordersTopLeftCoordinatesToAX
     53MenuLocation_GetInformationTextTopLeftCoordinatesToAX:
     54    mov     ax, (MENU_TEXT_ROW_OFFSET<<8) | MENU_TEXT_COLUMN_OFFSET
     55    jmp     SHORT AddInformationBordersTopLeftCoordinatesToAX
    6956
    7057ALIGN JUMP_ALIGN
  • trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm

    r133 r181  
    3737MenuScrollbars_GetScrollCharacterToALForLineInDI:
    3838    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    39     call    .GetFirstThumbLineToAX
     39    ; Get first thumb line to AX
     40    mov     ax, [bp+MENU.wFirstVisibleItem]
     41    call    .CalculateFirstOrLastThumbLineToAX
     42
    4043    cmp     di, ax              ; Before first thumb line?
    4144    jb      SHORT .ReturnTrackCharacter
    4245    call    .GetLastThumbLineToAX
    43     cmp     di, ax              ; After last thumb line?
    44     ja      SHORT .ReturnTrackCharacter
    45     mov     al, SCROLL_THUMB_CHARACTER
    46     ret
     46    cmp     ax, di              ; After last thumb line?
    4747ALIGN JUMP_ALIGN
    4848.ReturnTrackCharacter:
    4949    mov     al, SCROLL_TRACK_CHARACTER
     50    jb      SHORT .Return
     51    mov     al, SCROLL_THUMB_CHARACTER
     52ALIGN JUMP_ALIGN, ret
     53.Return:
    5054    ret
    5155
     
    6367.GetLastThumbLineToAX:
    6468    call    MenuScrollbars_GetLastVisibleItemOnPageToAX
    65     jmp     SHORT .CalculateFirstOrLastThumbLineToAX
    66 
    67 ;--------------------------------------------------------------------
    68 ; .GetFirstThumbLineToAX
    69 ;   Parameters
     69    ; Fall to .CalculateFirstOrLastThumbLineToAX
     70
     71;--------------------------------------------------------------------
     72; .CalculateFirstOrLastThumbLineToAX
     73;   Parameters
     74;       AX:     Index of first or last visible item on page
    7075;       CX:     Max visible items on page
    7176;       SS:BP:  Ptr to MENU
     
    7681;--------------------------------------------------------------------
    7782ALIGN JUMP_ALIGN
    78 .GetFirstThumbLineToAX:
    79     mov     ax, [bp+MENU.wFirstVisibleItem]
    8083.CalculateFirstOrLastThumbLineToAX:
    8184    mul     cx
     
    98101    mov     cx, [bp+MENUINIT.wHighlightedItem]
    99102    add     cx, ax
    100     call    .RotateItemInCX
     103    ; Fall to .RotateItemInCX
     104
     105;--------------------------------------------------------------------
     106; .RotateItemInCX
     107;   Parameters
     108;       CX:     Possibly under of overflown item to be rotated
     109;       SS:BP:  Ptr to MENU
     110;   Returns:
     111;       CX:     Valid item index
     112;   Corrupts registers:
     113;       DX
     114;--------------------------------------------------------------------
     115;.RotateItemInCX:
     116    mov     dx, [bp+MENUINIT.wItems]
     117    test    cx, cx
     118    js      SHORT .RotateNegativeItemInCX
     119    sub     cx, dx
     120    jae     SHORT .ScrollPageForNewItemInCX
     121
     122ALIGN JUMP_ALIGN
     123.RotateNegativeItemInCX:
     124    add     cx, dx
    101125    ; Fall to .ScrollPageForNewItemInCX
    102126
     
    111135;       AX, BX, CX, DX, SI, DI
    112136;--------------------------------------------------------------------
     137ALIGN JUMP_ALIGN
    113138.ScrollPageForNewItemInCX:
    114139    call    MenuScrollbars_IsItemInCXonVisiblePage
     
    117142    mov     dx, [bp+MENU.wFirstVisibleItem]
    118143    sub     dx, [bp+MENUINIT.wHighlightedItem]
     144
     145    ; Get MaxFirstVisibleItem to AX
     146    push    cx
     147    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
     148    mov     ax, [bp+MENUINIT.wItems]
     149    sub     ax, cx
     150    pop     cx
     151
    119152    add     dx, cx
    120     MAX_S   dx, 0
    121     call    .GetMaxFirstVisibleItemToAX
    122     MIN_U   ax, dx
     153    jns     .DXisPositive
     154    cwd     ; This won't work if MaxFirstVisibleItem > 32767
     155
     156ALIGN JUMP_ALIGN
     157.DXisPositive:
     158    cmp     ax, dx
     159    jb      .AXisLessThanDX
     160    xchg    dx, ax
     161
     162ALIGN JUMP_ALIGN
     163.AXisLessThanDX:
    123164    mov     [bp+MENU.wFirstVisibleItem], ax
    124165    call    MenuText_RefreshAllItems
     
    127168.HighlightNewItemOnCX:
    128169    jmp     MenuEvent_HighlightItemFromCX
    129 
    130 ;--------------------------------------------------------------------
    131 ; .GetMaxFirstVisibleItemToAX
    132 ;   Parameters
    133 ;       SS:BP:  Ptr to MENU
    134 ;   Returns:
    135 ;       AX:     Max first visible item
    136 ;   Corrupts registers:
    137 ;       Nothing
    138 ;--------------------------------------------------------------------
    139 ALIGN JUMP_ALIGN
    140 .GetMaxFirstVisibleItemToAX:
    141     push    cx
    142 
    143     call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    144     mov     ax, [bp+MENUINIT.wItems]
    145     sub     ax, cx
    146 
    147     pop     cx
    148     ret
    149 
    150 ;--------------------------------------------------------------------
    151 ; .RotateItemInCX
    152 ;   Parameters
    153 ;       CX:     Possibly under of overflown item to be rotated
    154 ;       SS:BP:  Ptr to MENU
    155 ;   Returns:
    156 ;       CX:     Valid item index
    157 ;   Corrupts registers:
    158 ;       DX
    159 ;--------------------------------------------------------------------
    160 ALIGN JUMP_ALIGN
    161 .RotateItemInCX:
    162     mov     dx, [bp+MENUINIT.wItems]
    163     test    cx, cx
    164     js      SHORT .RotateNegativeItemInCX
    165     cmp     cx, dx
    166     jae     SHORT .RotatePositiveItemInCX
    167     ret
    168 
    169 ALIGN JUMP_ALIGN
    170 .RotatePositiveItemInCX:
    171     sub     cx, dx
    172     ;jae    SHORT .RotatePositiveItemInCX   ; Not needed by scrolling
    173     ret
    174 
    175 ALIGN JUMP_ALIGN
    176 .RotateNegativeItemInCX:
    177     add     cx, dx
    178     ;js     SHORT .RotateNegativeItemInCX   ; Not needed by scrolling
    179     ret
    180170
    181171
     
    216206ALIGN JUMP_ALIGN
    217207MenuScrollbars_GetLastVisibleItemOnPageToAX:
    218     push    cx
    219 
     208    xchg    cx, ax
    220209    call    MenuScrollbars_GetActualVisibleItemsOnPageToCX
    221210    xchg    ax, cx
    222211    dec     ax
    223212    add     ax, [bp+MENU.wFirstVisibleItem]
    224 
    225     pop     cx
    226213    ret
    227214
     
    239226MenuScrollbars_GetActualVisibleItemsOnPageToCX:
    240227    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    241     MIN_U   cx, [bp+MENUINIT.wItems]
     228    cmp     cx, [bp+MENUINIT.wItems]
     229    jb      SHORT .Return
     230    mov     cx, [bp+MENUINIT.wItems]
     231ALIGN JUMP_ALIGN, ret
     232.Return:
    242233    ret
    243234
  • trunk/Assembly_Library/Src/String/Char.asm

    r162 r181  
    161161Char_ALtoLowerCaseLetter:
    162162    call    Char_IsUpperCaseLetterInAL  ; Is upper case character?
    163     jnc     SHORT .Return               ;  If not, return
    164     add     al, 'a'-'A'                 ; Convert to lower case
    165 .Return:
    166     ret
     163    jmp     SHORT Char_ALtoUpperCaseLetter.CheckCF
    167164%endif
    168165
     
    179176Char_ALtoUpperCaseLetter:
    180177    call    Char_IsLowerCaseLetterInAL  ; Is lower case character?
    181     jnc     SHORT .Return               ;  If not, return
    182     sub     al, 'a'-'A'                 ; Convert to upper case
     178.CheckCF:
     179    jnc     SHORT Char_ChangeCaseInAL.Return
     180    ; Fall to Char_ChangeCaseInAL
     181
     182;--------------------------------------------------------------------
     183; Char_ChangeCaseInAL
     184;   Parameters:
     185;       AL:     Character to convert (must be A-Z or a-z)
     186;   Returns:
     187;       AL:     Character converted
     188;   Corrupts registers:
     189;       Nothing
     190;--------------------------------------------------------------------
     191Char_ChangeCaseInAL:
     192    xor     al, 32
    183193.Return:
    184194    ret
    185 
    186195
    187196;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Util/Math.asm

    r174 r181  
    1717;       AX
    1818;--------------------------------------------------------------------
     19%ifndef EXCLUDE_FROM_XTIDECFG   ; Not used in XTIDECFG
    1920ALIGN JUMP_ALIGN
    20 Math_DivQWatSSBPbyCX:       ; This procedure is included but not used in XTIDECFG
     21Math_DivQWatSSBPbyCX:
    2122    xor     dx, dx
    2223    mov     ax, [bp+6]      ; Load highest divident WORD to DX:AX
     
    3637    mov     [bp], ax
    3738    ret
     39%endif
    3840
    3941
     
    4951;       Nothing
    5052;--------------------------------------------------------------------
    51 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     53%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
    5254ALIGN JUMP_ALIGN
    53 Math_DivDXAXbyCX:           ; This procedure is included but not used in XTIDECFG
     55Math_DivDXAXbyCX:   ; This is currently unused (dead code)
    5456    xor     bx, bx
    5557    xchg    bx, ax
Note: See TracChangeset for help on using the changeset viewer.