Changeset 181 in xtideuniversalbios


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
Files:
57 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
  • trunk/Configurator/Src/BiosFile.asm

    r145 r181  
    2929
    3030    ; Ask if user wants to save
    31     mov     ax, cs
    32     mov     ds, ax
    33     mov     es, ax
     31    push    cs
     32    pop     ds
     33    push    cs
     34    pop     es
    3435    call    BiosFile_DoesUserWantToSaveChanges
    3536    jnc     SHORT .Return
  • trunk/Configurator/Src/Libraries/math.asm

    r78 r181  
    1 ; File name     :   math.asm
    21; Project name  :   Math library
    3 ; Created date  :   7.10.2009
    4 ; Last update   :   4.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
    7 ; Description   :   ASM library to for math related functions.     
     2; Description   :   ASM library for math related functions.
    83
    94;--------------- Equates -----------------------------
     
    2722;--------------------------------------------------------------------
    2823; Macro to select lesser of two unsigned operands.
    29 ; 
     24;
    3025; MIN_U
    3126;   Parameters:
     
    4843;--------------------------------------------------------------------
    4944; Macro to select greater of two unsigned operands.
    50 ; 
     45;
    5146; MAX_U
    5247;   Parameters:
     
    6964;--------------------------------------------------------------------
    7065; Macro to select lesser and greater of two unsigned operands.
    71 ; 
     66;
    7267; MINMAX_U
    7368;   Parameters:
     
    8277%macro MINMAX_U 2
    8378    cmp     %1, %2              ; Is %1 smaller?
    84     jbe     %%Return            ;  If so, return
     79    jb      %%Return            ;  If so, return
    8580    xchg    %1, %2              ; Exchange operands
    8681ALIGN JUMP_ALIGN
     
    9388; Multiplies unsigned 32-bit integer by unsigned 16-bit integer.
    9489; Result is unsigned 32-bit integer, so overflow is possible.
    95 ; 
     90;
    9691; Math_MulDWbyW
    9792;   Parameters:
     
    130125;--------------------------------------------------------------------
    131126; Divide a 32-bit unsigned integer so that quotient can be 32-bit.
    132 ; 
     127;
    133128; Math_DivDWbyW
    134129;   Parameters:
     
    157152;--------------------------------------------------------------------
    158153; Converts remainder to tenths.
    159 ; 
     154;
    160155; Math_RemToTenths
    161156;   Parameters:
  • trunk/Configurator/Src/Libraries/menu/menudraw.asm

    r170 r181  
    287287    test    BYTE [bp+MENUVARS.bFlags], FLG_MNU_HIDENFO  ; Information hidden?
    288288    jnz     SHORT .JumpToBottomBorder
    289     test    cx, cx                          ; Any info strings?
    290     jz      SHORT MenuDraw_BottomBorder
     289    jcxz    MenuDraw_BottomBorder           ; Any info strings?
    291290    push    cx
    292291    call    MenuDraw_MiddleBorder           ; Draw middle border
  • trunk/Configurator/Src/Libraries/menu/menumsg.asm

    r2 r181  
    1 ; File name     :   menumsg.asm
    21; Project name  :   Menu library
    3 ; Created date  :   13.11.2009
    4 ; Last update   :   10.1.2010
    5 ; Author        :   Tomi Tilli
    6 ; Description   :   ASM library to menu system.
     2; Description   :   ASM library for menu system.
    73;                   Contains functions for displaying messages.
    84
     
    156152ALIGN JUMP_ALIGN
    157153MenuMsg_GetTokenForLine:
    158     test    cx, cx              ; Line 0 wanted?
    159     jz      .GetFirst           ;  If so, just get token length
     154    jcxz    .GetFirst           ; Line 0 wanted? If so, just get token length
    160155    push    bp
    161156    push    si
     
    218213    jnc     .EndOfString                    ; Return if no tokens
    219214    eMOVZX  dx, BYTE [bp+MENUVARS.bWidth]   ; Menu width
    220     sub     dl, SIZE_MSG_HBRDR              ; To line length 
     215    sub     dl, SIZE_MSG_HBRDR              ; To line length
    221216    mov     bl, ' '                         ; Space character
    222217ALIGN JUMP_ALIGN
  • trunk/Configurator/Src/Libraries/print.asm

    r78 r181  
    1 ; File name     :   print.asm
    21; Project name  :   Print library
    3 ; Created date  :   6.10.2009
    4 ; Last update   :   4.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
    72; Description   :   ASM library for character and string
    83;                   printing related functions.
     
    9590;--------------------------------------------------------------------
    9691; Debugging macro that prints wanted character and newline.
    97 ; 
     92;
    9893; PRINT_DBG_CH
    9994;   Parameters:
     
    141136;
    142137;   NOTE! Caller must clean the stack variables!
    143 ; 
     138;
    144139; Print_Format
    145140;   Parameters:
     
    341336;--------------------------------------------------------------------
    342337; Prints newline character to change line.
    343 ; 
     338;
    344339; Print_Newline
    345340;   Parameters:
     
    363358    ret
    364359%endif
    365    
     360
    366361
    367362;--------------------------------------------------------------------
    368363; Prints wanted number of characters.
    369 ; 
     364;
    370365; Print_CharBuffer
    371366;   Parameters:
     
    404399;--------------------------------------------------------------------
    405400; Repeats wanted character.
    406 ; 
     401;
    407402; Print_Repeat
    408403;   Parameters:
     
    429424;--------------------------------------------------------------------
    430425; Prints boolean value.
    431 ; 
     426;
    432427; Print_Bool
    433428;   Parameters:
     
    455450;--------------------------------------------------------------------
    456451; Prints signed or unsigned 16-bit integer.
    457 ; 
     452;
    458453; Print_IntSW   Prints signed 16-bit word
    459454; Print_IntUW   Prints unsigned 16-bit word
     
    506501    PRINT_CHAR                  ; Print character
    507502    inc     di                  ; Increment chars printed
    508     test    cx, cx              ; Characters left
    509     jnz     .PrintLoop          ;  If so, loop
     503    inc     cx                  ; Characters left
     504    loop    .PrintLoop          ;  If so, loop
    510505    mov     dx, di              ; Copy chars printed to DX
    511506    pop     cx
     
    518513;--------------------------------------------------------------------
    519514; Prints unsigned 32-bit integer.
    520 ; 
     515;
    521516; Print_IntUDW
    522517;   Parameters:
     
    552547    PRINT_CHAR                  ; Print character
    553548    inc     di                  ; Increment chars printed
    554     test    cx, cx              ; Characters left
    555     jnz     .PrintLoop          ;  If so, loop
     549    inc     cx                  ; Characters left
     550    loop    .PrintLoop          ;  If so, loop
    556551    mov     dx, di              ; Copy characters printed to DX
    557552    pop     cx
     
    565560;--------------------------------------------------------------------
    566561; Prints 8-bit byte as hexadecimal string.
    567 ; 
     562;
    568563; Print_IntHexB
    569564;   Parameters:
     
    593588;--------------------------------------------------------------------
    594589; Prints 16-bit word as hexadecimal string.
    595 ; 
     590;
    596591; Print_IntHexW
    597592;   Parameters:
     
    621616;--------------------------------------------------------------------
    622617; Prints 32-bit dword as hexadecimal string.
    623 ; 
     618;
    624619; Print_IntHexDW
    625620;   Parameters:
     
    658653;--------------------------------------------------------------------
    659654; Prints hexadecimal character for every nybble for WORD.
    660 ; 
     655;
    661656; Print_HexString
    662657;   Parameters:
  • trunk/Configurator/Src/MenuPageItem.asm

    r145 r181  
    6565ALIGN JUMP_ALIGN
    6666MenuPageItem_DisplayHelpDialog:
     67    push    cs
     68    pop     es
    6769    mov     di, [di+MENUPAGEITEM.szHelp]    ; ES:DI now points to help string
    68     push    cs
    69     pop     es
    7070    mov     bl, WIDTH_DLG                   ; Dialog width
    7171    jmp     Menu_ShowMsgDlg
  • trunk/Configurator/Src/Menupages/FlashMenu.asm

    r145 r181  
    371371FlashMenu_CalculateCompletionPercentage:
    372372    cmp     WORD [si+FLASHVARS.wPagesLeft], 0
     373    mov     ax, 100
    373374    je      SHORT .FlashComplete
    374     mov     ax, 100
    375375    mul     WORD [si+FLASHVARS.wPagesLeft]
    376376    div     WORD [si+FLASHVARS.wTotalPages]     ; AX = Percentage left to write
     
    382382ALIGN JUMP_ALIGN
    383383.FlashComplete:
    384     mov     ax, 100
    385384    stc
    386385    ret
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r179 r181  
    55%define ROMVARS_INC
    66
    7 ; ROM Variables. There are written to ROM image before flashing.
     7; ROM Variables. Written to the ROM image before flashing.
    88struc ROMVARS
    9     .wRomSign       resb    2   ; ROM Signature (AA55h)
    10     .bRomSize       resb    1   ; ROM size in 512 byte blocks
    11     .rgbJump        resb    3   ; First instruction to ROM init (jmp)
     9    .wRomSign           resb    2   ; ROM Signature (AA55h)
     10    .bRomSize           resb    1   ; ROM size in 512 byte blocks
     11    .rgbJump            resb    3   ; First instruction to ROM init (jmp)
    1212
    13     .rgbSign        resb    8   ; Signature for XTIDE Configurator Program
    14     .szTitle        resb    31  ; BIOS title string
    15     .szVersion      resb    25  ; BIOS version string
     13    .rgbSign            resb    8   ; Signature for XTIDE Configurator Program
     14    .szTitle            resb    31  ; BIOS title string
     15    .szVersion          resb    25  ; BIOS version string
    1616
    17     .wFlags         resb    2   ; Word for ROM flags
    18     .wDisplayMode   resb    2   ; Display mode for boot menu
    19     .wBootTimeout   resb    2   ; Boot Menu selection timeout in system timer ticks
    20     .bIdeCnt        resb    1   ; Number of available IDE controllers
    21     .bBootDrv       resb    1   ; Boot Menu default drive
    22     .bMinFddCnt     resb    1   ; Minimum number of Floppy Drives
    23     .bStealSize     resb    1   ; Number of 1kB blocks stolen from 640kB base RAM
     17    .wFlags             resb    2   ; Word for ROM flags
     18    .wDisplayMode       resb    2   ; Display mode for boot menu
     19    .wBootTimeout       resb    2   ; Boot Menu selection timeout in system timer ticks
     20    .bIdeCnt            resb    1   ; Number of available IDE controllers
     21    .bBootDrv           resb    1   ; Boot Menu default drive
     22    .bMinFddCnt         resb    1   ; Minimum number of Floppy Drives
     23    .bStealSize         resb    1   ; Number of 1kB blocks stolen from 640kB base RAM
    2424
    25     .ideVars0       resb    IDEVARS_size
    26     .ideVars1       resb    IDEVARS_size
    27     .ideVars2       resb    IDEVARS_size
    28     .ideVars3       resb    IDEVARS_size
     25    .ideVars0           resb    IDEVARS_size
     26    .ideVars1           resb    IDEVARS_size
     27    .ideVars2           resb    IDEVARS_size
     28    .ideVars3           resb    IDEVARS_size
    2929
    3030%ifdef MODULE_SERIAL
     
    3434
    3535; Bit defines for ROMVARS.wFlags
    36 FLG_ROMVARS_FULLMODE    EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
    37 FLG_ROMVARS_DRVXLAT     EQU (1<<2)  ; Enable drive number translation
     36FLG_ROMVARS_FULLMODE        EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
     37FLG_ROMVARS_DRVXLAT         EQU (1<<2)  ; Enable drive number translation
    3838FLG_ROMVARS_MODULE_SERIAL   EQU (1<<3)
    3939FLG_ROMVARS_MODULE_EBIOS    EQU (1<<4)
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm

    r165 r181  
    125125    mul     bl                          ; AX = Offset inside BOOTNFO array
    126126    add     ax, BOOTVARS.rgBootNfo      ; Add offset to BOOTNFO array
    127     xchg    bx, ax                      ; Copy result to BX
     127    xchg    bx, ax                      ; Move result to BX
    128128    ret
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm

    r130 r181  
    102102    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
    103103    sub     ah, MENU_SCREEN_BOTTOM_LINES*2  ; Leave space for bottom info
    104     MIN_U   ah, cl
     104    cmp     ah, cl
     105    jb      SHORT .Return
     106    mov     ah, cl
     107ALIGN JUMP_ALIGN, ret
     108.Return:
    105109    ret
    106110
     
    148152    call    FloppyDrive_GetCountToCX
    149153    add     cl, 'A'
    150     MAX_U   cl, 'C'
     154    cmp     cl, 'C'
     155    ja      .Return
     156    mov     cl, 'C'
     157ALIGN JUMP_ALIGN, ret
     158.Return:
    151159    ret
    152160
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r158 r181  
    8585;       AX, DX
    8686;--------------------------------------------------------------------
    87 PushBusType:
     87;PushBusType:
     88    cwd                 ; Clear DX using sign extension
    8889    xchg    ax, bx      ; Store BX to AX
    8990    eMOVZX  bx, BYTE [cs:si+IDEVARS.bDevice]
    9091    mov     bx, [cs:bx+rgwBusTypeValues]    ; Char to BL, Int to BH
    91     eMOVZX  dx, bh
     92    mov     dl, bh
    9293    push    bx          ; Push character
    9394    push    dx          ; Push 1, 8, 16 or 32
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r175 r181  
    1616;       AX, BX, CX, DX
    1717;--------------------------------------------------------------------
     18%ifdef MODULE_SERIAL
    1819Device_FinalizeDPT:
    19 %ifdef MODULE_SERIAL
    2020    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    2121    jnz     SHORT .FinalizeDptForSerialPortDevice
     22    jmp     IdeDPT_Finalize
     23
     24.FinalizeDptForSerialPortDevice:
     25    jmp     SerialDPT_Finalize
     26%else
     27    Device_FinalizeDPT EQU IdeDPT_Finalize
    2228%endif
    23     jmp     IdeDPT_Finalize
    24 %ifdef MODULE_SERIAL
    25 .FinalizeDptForSerialPortDevice:
    26     jmp     SerialDPT_Finalize     
    27 %endif
     29
    2830
    2931;--------------------------------------------------------------------
     
    3739;       AL, BX, CX, DX
    3840;--------------------------------------------------------------------
     41%ifdef MODULE_SERIAL
    3942Device_ResetMasterAndSlaveController:
    40 %ifdef MODULE_SERIAL
    4143    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    4244    jnz     SHORT ReturnSuccessForSerialPort
     45    jmp     IdeCommand_ResetMasterAndSlaveController
     46%else
     47    Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController
    4348%endif
    44     jmp     IdeCommand_ResetMasterAndSlaveController
    4549
    4650
     
    5862;       AL, BL, CX, DX, SI, DI, ES
    5963;--------------------------------------------------------------------
     64%ifdef MODULE_SERIAL
    6065Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    61 %ifdef MODULE_SERIAL
    6266    cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    6367    je      SHORT .IdentifyDriveFromSerialPort
    64 %endif
    6568    jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    66 %ifdef MODULE_SERIAL
     69
    6770.IdentifyDriveFromSerialPort:
    6871    jmp     SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     72%else
     73    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    6974%endif
     75
    7076
    7177;--------------------------------------------------------------------
     
    8389;       AL, BX, CX, DX, (ES:SI for data transfer commands)
    8490;--------------------------------------------------------------------
     91%ifdef MODULE_SERIAL
    8592ALIGN JUMP_ALIGN
    8693Device_OutputCommandWithParameters:
    87 %ifdef MODULE_SERIAL
    8894    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    8995    jnz     SHORT .OutputCommandToSerialPort
    90 %endif
    9196    jmp     IdeCommand_OutputWithParameters
    92 %ifdef MODULE_SERIAL
     97
    9398ALIGN JUMP_ALIGN
    9499.OutputCommandToSerialPort:
    95100    jmp     SerialCommand_OutputWithParameters
     101%else
     102    Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters
    96103%endif
     104
    97105
    98106;--------------------------------------------------------------------
     
    107115;       AL, BX, CX, DX
    108116;--------------------------------------------------------------------
     117%ifdef MODULE_SERIAL
    109118ALIGN JUMP_ALIGN
    110119Device_SelectDrive:
    111 %ifdef MODULE_SERIAL
    112120    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    113121    jnz     SHORT ReturnSuccessForSerialPort
    114 %endif
    115122    jmp     IdeCommand_SelectDrive
    116 %ifdef MODULE_SERIAL
     123
    117124ReturnSuccessForSerialPort:
    118125    xor     ax, ax
    119126    ret
     127%else
     128    Device_SelectDrive EQU IdeCommand_SelectDrive
    120129%endif
     130
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm

    r160 r181  
    77;--------------------------------------------------------------------
    88; IdeIO_OutputALtoIdeRegisterInDL
     9; IdeIO_OutputALtoIdeControlBlockRegisterInDL
    910;   Parameters:
    1011;       AL:     Byte to output
    11 ;       DL:     IDE Register
     12;       DL:     IDE Register                (IdeIO_OutputALtoIdeRegisterInDL)
     13;               IDE Control Block Register  (IdeIO_OutputALtoIdeControlBlockRegisterInDL)
    1214;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    1315;   Returns:
     
    1820ALIGN JUMP_ALIGN
    1921IdeIO_OutputALtoIdeRegisterInDL:
    20     mov     bx, IDEVARS.wPort
    21     call    GetPortToDXandTranslateA0andA3ifNecessary
    22     out     dx, al
    23     ret
     22    mov     bl, IDEVARS.wPort
     23    SKIP2B  f   ; cmp ax, <next instruction>
     24    ; Fall to IdeIO_OutputALtoIdeControlBlockRegisterInDL
    2425
    25 
    26 ;--------------------------------------------------------------------
    27 ; IdeIO_OutputALtoIdeControlBlockRegisterInDL
    28 ;   Parameters:
    29 ;       AL:     Byte to output
    30 ;       DL:     IDE Control Block Register
    31 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    32 ;   Returns:
    33 ;       Nothing
    34 ;   Corrupts registers:
    35 ;       BX, DX
    36 ;--------------------------------------------------------------------
    37 ALIGN JUMP_ALIGN
    3826IdeIO_OutputALtoIdeControlBlockRegisterInDL:
    39     mov     bx, IDEVARS.wPortCtrl
     27    mov     bl, IDEVARS.wPortCtrl
    4028    call    GetPortToDXandTranslateA0andA3ifNecessary
    4129    out     dx, al
     
    5543ALIGN JUMP_ALIGN
    5644IdeIO_InputToALfromIdeRegisterInDL:
    57     mov     bx, IDEVARS.wPort
     45    mov     bl, IDEVARS.wPort
    5846    call    GetPortToDXandTranslateA0andA3ifNecessary
    5947    in      al, dx
     
    6452; GetPortToDXandTranslateA0andA3ifNecessary
    6553;   Parameters:
    66 ;       BX:     Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl)
     54;       BL:     Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl)
    6755;       DL:     IDE Register
    6856;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     
    7462ALIGN JUMP_ALIGN
    7563GetPortToDXandTranslateA0andA3ifNecessary:
     64    xor     bh, bh
    7665    xor     dh, dh                          ; DX now has IDE register offset
    7766    add     bl, [di+DPT.bIdevarsOffset]     ; CS:BX now points port address
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r171 r181  
    230230ALIGN JUMP_ALIGN
    231231DualByteReadForXtide:
    232 %ifdef USE_186
    233     shr     cx, 2       ; Smaller but slower on 186/286
    234 %else
    235     times 2 shr cx, 1   ; Loop unrolling
    236 %endif
     232    eSHR_IM cx, 2       ; Loop unrolling
    237233    mov     bx, 8       ; Bit mask for toggling data low/high reg
    238234ALIGN JUMP_ALIGN
     
    322318    push    ds
    323319    push    bx
    324 %ifdef USE_186
    325     shr     cx, 2       ; Smaller but slower on 186/286
    326 %else
    327     times 2 shr cx, 1   ; Loop unrolling
    328 %endif
     320    eSHR_IM cx, 2       ; Loop unrolling
    329321    mov     bx, 8       ; Bit mask for toggling data low/high reg
    330322    push    es          ; Copy ES...
     
    372364WordWriteForXTIDEmod:
    373365    push    ds
    374 %ifdef USE_186
    375     shr     cx, 2       ; Smaller but slower on 186/286
    376 %else
    377     times 2 shr cx, 1   ; Loop unrolling
    378 %endif
     366    eSHR_IM cx, 2       ; Loop unrolling
    379367    push    es          ; Copy ES...
    380368    pop     ds          ; ...to DS
  • trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm

    r180 r181  
    2020    jmp     ax
    2121
    22 %ifdef MODULE_EBIOS
     22
    2323;--------------------------------------------------------------------
    2424; Idepack_ConvertDapToIdepackAndIssueCommandFromAH
     
    3636;       AL, BX, CX, DX, SI, ES
    3737;--------------------------------------------------------------------
     38%ifdef MODULE_EBIOS
    3839ALIGN JUMP_ALIGN
    3940Idepack_ConvertDapToIdepackAndIssueCommandFromAH:
     
    6061%endif
    6162
     63
    6264;--------------------------------------------------------------------
    6365; Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
     
    8385Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH:
    8486    mov     [bp+IDEPACK.bCommand], ah
    85     test    al, al
    86     eCSETZ  ah
     87
     88    xor     ah, ah
     89    cmp     ah, al
     90    cmc
     91    adc     ah, ah
     92
    8793    mov     [bp+IDEPACK.bSectorCount], al
    8894    mov     [bp+IDEPACK.bSectorCountHighExt], ah
     
    100106    call    AccessDPT_GetDeviceControlByteToAL
    101107    mov     [bp+IDEPACK.bDeviceControl], al
    102     jmp     Device_OutputCommandWithParameters 
     108    jmp     Device_OutputCommandWithParameters
    103109
    104110
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r179 r181  
    1010;    http://en.wikibooks.org/wiki/Serial_Programming
    1111;
    12        
     12
    1313SerialCommand_UART_base                         EQU     0
    1414SerialCommand_UART_transmitByte                 EQU     0
    1515SerialCommand_UART_receiveByte                  EQU     0
    1616SerialCommand_UART_divisorLow                   EQU     0
    17 ; Values for UART_divisorLow:   
     17; Values for UART_divisorLow:
    1818; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 3 = 38400, 2 = 57600, 1 = 115200
    1919
     
    2323; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level
    2424
    25 SerialCommand_UART_interruptEnable              EQU     1               
     25SerialCommand_UART_interruptEnable              EQU     1
    2626SerialCommand_UART_divisorHigh                  EQU     1
    2727; UART_divisorHigh is zero for all speeds including and above 1200 baud
     
    3131
    3232SerialCommand_UART_lineControl                  EQU     3
    33        
     33
    3434SerialCommand_UART_modemControl                 EQU     4
    3535
     
    4040SerialCommand_UART_scratch                      EQU     7
    4141
    42 SerialCommand_PackedPortAndBaud_StartingPort    EQU     240h   
     42SerialCommand_PackedPortAndBaud_StartingPort    EQU     240h
    4343SerialCommand_PackedPortAndBaud_PortMask        EQU     0fch    ; upper 6 bits - 240h through 438h
    4444SerialCommand_PackedPortAndBaud_BaudMask        EQU     3       ; lower 2 bits - 4 baud rates
     
    4848SerialCommand_Protocol_Inquire                  EQU     0
    4949SerialCommand_Protocol_Header                   EQU     0a0h
    50        
     50
    5151;--------------------------------------------------------------------
    5252; SerialCommand_OutputWithParameters
     
    6565;       AL, BX, CX, DX, (ES:SI for data transfer commands)
    6666;--------------------------------------------------------------------
    67 
    6867ALIGN JUMP_ALIGN
    6968SerialCommand_OutputWithParameters:
    70        
     69
    7170        mov     ah,(SerialCommand_Protocol_Header | SerialCommand_Protocol_Read)
    72        
     71
    7372        mov     al,[bp+IDEPACK.bCommand]
    7473
     
    7877        cmp     al,30h          ; Write Sectors IDE command
    7978        jz      .readOrWrite
    80        
     79
    8180;  all other commands return success
    8281;  including function 0ech which should return drive information, this is handled with the identify functions
    8382        xor     ah,ah           ;  also clears carry
    8483        ret
    85        
    86 .readOrWrite:   
     84
     85.readOrWrite:
    8786        mov     [bp+IDEPACK.bFeatures],ah       ; store protocol command
    88        
    89         mov     dl, byte [ds:di+DPT.bSerialPortAndBaud]
    90        
     87
     88        mov     dl, byte [di+DPT.bSerialPortAndBaud]
     89
    9190; fall-through
    9291
     
    9493; SerialCommand_OutputWithParameters_DeviceInDL
    9594;   Parameters:
    96 ;       AH:     Protocol Command 
     95;       AH:     Protocol Command
    9796;       DL:     Packed I/O port and baud rate
    9897;       ES:SI:  Ptr to buffer (for data transfer commands)
     
    103102;   Corrupts registers:
    104103;       AL, BX, CX, DX, (ES:SI for data transfer commands)
    105 ;--------------------------------------------------------------------       
     104;--------------------------------------------------------------------
    106105SerialCommand_OutputWithParameters_DeviceInDL:
    107        
     106
    108107        push    si
    109108        push    di
     
    111110        push    es
    112111
    113 ; 
     112;
    114113; Unpack I/O port and baud from DPT
    115114;       Port to DX more or less for the remainder of the routine
     
    117116;
    118117        mov     cl, dl
    119        
     118
    120119        and     cl, SerialCommand_PackedPortAndBaud_BaudMask
    121120        shl     cl, 1
     
    125124
    126125        and     dl, SerialCommand_PackedPortAndBaud_PortMask
    127         mov     dh, 0       
     126        mov     dh, 0
    128127        shl     dx, 1
    129128        add     dx, SerialCommand_PackedPortAndBaud_StartingPort
     
    131130;
    132131; Buffer is referenced through ES:DI throughout, since we need to store faster than we read
    133 ; 
     132;
    134133        mov     di,si
    135134
     
    138137;
    139138; Command byte and sector count live at the top of the stack, pop/push are used to access
    140 ; 
     139;
    141140        push    ax
    142        
    143         cld
     141
     142;       cld     ; Shouldn't be needed. DF has already been cleared (line 24, Int13h.asm)
    144143
    145144;----------------------------------------------------------------------
     
    147146; Initialize UART
    148147;
    149 ; We do this each time since DOS (at boot) or another program may have 
     148; We do this each time since DOS (at boot) or another program may have
    150149; decided to reprogram the UART
    151150;
    152151        push    dx
    153        
     152
    154153        mov     al,83h
    155154        add     dl,SerialCommand_UART_lineControl
     
    167166        mov     al,047h
    168167        inc     dx              ;  fifo
    169         out     dx,al       
     168        out     dx,al
    170169
    171170        mov     al,03h
     
    192191        push    es              ; save off real buffer location
    193192        push    di
    194        
    195         mov     di,bp           ; point to IDEREGS for command dispatch;       
     193
     194        mov     di,bp           ; point to IDEREGS for command dispatch;
    196195        push    ss
    197196        pop     es
    198197
    199198        xor     si,si           ; initialize checksum for write
    200         dec     si     
     199        dec     si
    201200        mov     bp,si
    202201
    203202        mov     bl,03h      ; writing 3 words
    204        
     203
    205204        call    SerialCommand_WriteProtocol
    206205
     
    213212;
    214213; Top of the read/write loop, one iteration per sector
    215 ; 
     214;
    216215.nextSector:
    217216        xor     si,si           ; initialize checksum for read or write
     
    220219
    221220        mov     bx,0100h
    222        
     221
    223222        shr     ah,1            ; command byte, are we doing a write?
    224223        jnc     .readSector
    225224        call    SerialCommand_WriteProtocol
    226        
     225
    227226        xor     bx,bx
    228227
     
    230229        mov     cx,bx
    231230        inc     cx
    232        
     231
    233232        mov     bl,dl           ; setup bl with proper values for read loop (bh comes later)
    234233
     
    246245        push    cx
    247246        xor     cx,cx
    248 .readTimeoutLoop:   
     247.readTimeoutLoop:
    249248        push    dx
    250249        or      dl,SerialCommand_UART_lineStatus
     
    257256        mov     bh,1
    258257        call    SerialCommand_WaitAndPoll_Init
    259         cli     
     258        cli
    260259.readTimeoutComplete:
    261260        mov     bh,bl
    262261        or      bh,SerialCommand_UART_lineStatus
    263        
     262
    264263        pop     cx
    265264        test    dl,1
     
    271270; Read Block (without interrupts, used when there is a FIFO, high speed)
    272271;
    273 ; NOTE: This loop is very time sensitive.  Literally, another instruction 
     272; NOTE: This loop is very time sensitive.  Literally, another instruction
    274273; cannot be inserted into this loop without us falling behind at high
    275 ; speed (460.8K baud) on a 4.77Mhz 8088, making it hard to receive 
     274; speed (460.8K baud) on a 4.77Mhz 8088, making it hard to receive
    276275; a full 512 byte block.
    277276;
    278 .readLoop:     
     277.readLoop:
     278        stosw                   ; store word in caller's data buffer
     279
    279280        add     bp, ax          ; update Fletcher's checksum
    280281        adc     bp, 0
     
    282283        adc     si, 0
    283284
    284         stosw                   ; store word in caller's data buffer
    285 
    286         mov     dl,bh           
    287         in      al,dx           
     285        mov     dl,bh
     286        in      al,dx
    288287        shr     al,1            ; data ready (byte 1)?
    289         mov     dl,bl           ; get ready to read data           
     288        mov     dl,bl           ; get ready to read data
    290289        jnc     .readTimeout    ; nope not ready, update timeouts
    291        
    292 ; 
     290
     291;
    293292; Entry point after initial timeout.  We enter here so that the checksum word
    294293; is not stored (and is left in AX after the loop is complete).
    295 ; 
    296 .readByte1Ready:       
     294;
     295.readByte1Ready:
    297296        in      al, dx          ; read data byte 1
    298297
    299298        mov     ah, al          ; store byte in ah for now
    300        
    301 ;
    302 ; note the placement of this reset of dl to bh, and that it is 
    303 ; before the return, which is assymetric with where this is done 
    304 ; above for byte 1.  The value of dl is used by the timeout routine 
    305 ; to know which byte to return to (.read_byte1_ready or 
     299
     300;
     301; note the placement of this reset of dl to bh, and that it is
     302; before the return, which is assymetric with where this is done
     303; above for byte 1.  The value of dl is used by the timeout routine
     304; to know which byte to return to (.read_byte1_ready or
    306305; .read_byte2_ready)
    307306;
    308         mov     dl,bh           
    309                                
     307        mov     dl,bh
     308
    310309        in      al,dx
    311310        shr     al,1            ; data ready (byte 2)?
    312311        jnc     .readTimeout
    313 .readByte2Ready:                       
    314         mov     dl,bl       
     312.readByte2Ready:
     313        mov     dl,bl
    315314        in      al, dx          ; read data byte 2
    316315
    317316        xchg    al, ah          ; ah was holding byte 1, reverse byte order
    318        
     317
    319318        loop    .readLoop
    320319
     320        sti                     ; interrupts back on ASAP, if we turned them off
     321
    321322;
    322323; Compare checksums
    323 ; 
     324;
    324325        xor     bp,si
    325326        cmp     ax,bp
    326327        jnz     SerialCommand_OutputWithParameters_Error
    327328
    328         sti                 ; interrupts back on ASAP, if we turned them off
    329        
     329
    330330;----------------------------------------------------------------------
    331 ; 
     331;
    332332; Clear read buffer
    333333;
    334334; In case there are extra characters or an error in the FIFO, clear it out.
    335 ; In theory the initialization of the UART registers above should have 
     335; In theory the initialization of the UART registers above should have
    336336; taken care of this, but I have seen cases where this is not true.
    337337;
    338338.clearBuffer:
    339         mov     dl,bh       
     339        mov     dl,bh
    340340        in      al,dx
    341         mov     dl,bl               
     341        mov     dl,bl
    342342        test    al,08fh
    343343        jz      .clearBufferComplete
    344344        shr     al,1
    345         in      al,dx       
     345        in      al,dx
    346346        jc      .clearBuffer    ; note CF from shr above
    347347        jmp     SerialCommand_OutputWithParameters_Error
    348        
    349 .clearBufferComplete:   
     348
     349.clearBufferComplete:
    350350        pop     ax              ; sector count and command byte
    351351        dec     al              ; decrememnt sector count
    352352        push    ax              ; save
    353353        jz      SerialCommand_OutputWithParameters_ReturnCodeInALCF    ; CF clear from .clearBuffer test above
    354                
     354
    355355        cli                     ; interrupts back off for ACK byte to host
    356356                                ; (host could start sending data immediately)
    357357        out     dx,al           ; ACK with next sector number
    358        
     358
    359359        jmp     .nextSector     ; all is well, time for next sector
    360360
     
    363363; Cleanup, error reporting, and exit
    364364;
    365        
    366 ; 
     365
     366;
    367367; Used in situations where a call is underway, such as with SerialCommand_WaitAndPoll
    368 ; 
     368;
    369369SerialCommand_OutputWithParameters_ErrorAndPop2Words:
    370370        pop     ax
    371371        pop     ax
    372372
    373 SerialCommand_OutputWithParameters_Error:       
     373SerialCommand_OutputWithParameters_Error:
     374        stc
    374375        mov     al,1
    375         stc
    376 
    377 SerialCommand_OutputWithParameters_ReturnCodeInALCF:   
     376
     377SerialCommand_OutputWithParameters_ReturnCodeInALCF:
     378        sti
    378379        mov     ah,al
    379         sti
    380380
    381381        pop     bp              ;  recover ax from stack, throw away
     
    398398;       Returns when desired UART_LineStatus bit is cleared
    399399;       Jumps directly to error exit if timeout elapses (and cleans up stack)
    400 ;   Corrupts registers: 
     400;   Corrupts registers:
    401401;       CX, flags
    402402;--------------------------------------------------------------------
     
    404404SerialCommand_WaitAndPoll_SoftDelayTicks   EQU   20
    405405
    406 ALIGN JUMP_ALIGN               
     406ALIGN JUMP_ALIGN
    407407SerialCommand_WaitAndPoll_Init:
    408408        mov     cl,SerialCommand_WaitAndPoll_SoftDelayTicks
    409409        call    Timer_InitializeTimeoutWithTicksInCL
    410410; fall-through
    411        
     411
    412412SerialCommand_WaitAndPoll:
    413413        call    Timer_SetCFifTimeout
     
    422422        jz      SerialCommand_WaitAndPoll
    423423; fall-through
    424        
    425 SerialCommand_WaitAndPoll_Done: 
     424
     425SerialCommand_WaitAndPoll_Done:
    426426        ret
    427427
     
    442442SerialCommand_WriteProtocol:
    443443        mov     bh,20h
    444        
     444
    445445.writeLoop:
    446446        test    bh,1
    447447        jnz     SerialCommand_WaitAndPoll_Done
    448        
     448
    449449        mov     ax,[es:di]      ; fetch next word
    450450        inc     di
    451451        inc     di
    452        
     452
    453453        add     bp,ax           ; update checksum
    454454        adc     bp,0
     
    458458.writeLoopChecksum:
    459459        call    SerialCommand_WaitAndPoll_Init
    460        
     460
    461461        out     dx,al           ; output first byte
    462462
    463463        call    SerialCommand_WaitAndPoll
    464        
     464
    465465        mov     al,ah           ; output second byte
    466466        out     dx,al
     
    468468        dec     bl
    469469        jnz     .writeLoop
    470        
     470
    471471        inc     bh
    472        
     472
    473473        mov     ax,bp           ; merge checksum for possible write (last loop)
    474         xor     ax,si       
    475        
     474        xor     ax,si
     475
    476476        jmp     .writeLoopChecksum
    477477
     
    501501        mov     dx,[cs:bp+IDEVARS.wPortCtrl]
    502502        inc     dx
    503         dec     dx     
     503        dec     dx
    504504        jz      SerialCommand_AutoSerial
    505505
    506506; fall-through
    507 SerialCommand_IdentifyDeviceInDL_DriveInBH:     
     507SerialCommand_IdentifyDeviceInDL_DriveInBH:
    508508
    509509        push    bp              ; setup fake IDEREGS_AND_INTPACK
     
    516516        mov     bl,0a0h         ; protocol command to ah and onto stack with bh
    517517        mov     ah,bl
    518        
     518
    519519        push    bx
    520520
     
    524524
    525525        pop     bx
    526        
    527         pop     cx             
     526
     527        pop     cx
    528528        pop     dx
    529529
    530530        pop     bp
    531531
    532 ; place packed port/baud in vendor area of packet, read by FinalizeDPT 
    533         mov     byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud], dl 
     532; place packed port/baud in vendor area of packet, read by FinalizeDPT
     533        mov     byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud], dl
    534534
    535535        ret
     
    540540;
    541541; When the SerialAuto IDEVARS entry is used, scans the COM ports on the machine for a possible serial connection.
    542 ; 
    543        
     542;
     543
    544544SerialCommand_ScanPortAddresses:  db  0b8h, 0f8h, 0bch, 0bah, 0fah, 0beh, 0feh, 0
    545545; Corresponds to I/O port:             3f8,  2f8,  3e8,  2e8,  2f0,  3e0,  2e0,  260,  368,  268,  360,  270
    546546; COM Assignments:                       1,    2,    3,    4,    5,    6,    7,    8,    9,   10,   11,   12
    547547
    548 ALIGN JUMP_ALIGN                       
    549 SerialCommand_AutoSerial:       
     548ALIGN JUMP_ALIGN
     549SerialCommand_AutoSerial:
    550550        mov     di,SerialCommand_ScanPortAddresses-1
    551        
     551
    552552.nextPort:
    553553        inc     di              ; load next port address
    554554        mov     dl,[cs:di]
    555        
     555
    556556        mov     dh,0            ; shift from one byte to two
    557         shl     dx,1
    558         shl     dx,1       
     557        eSHL_IM dx, 2
    559558        jz      .exitNotFound
    560559
    561560;
    562561; Test for COM port presence, write to and read from registers
    563 ; 
    564         push    dx     
     562;
     563        push    dx
    565564        add     dl,SerialCommand_UART_lineControl
    566565        mov     al, 09ah
     
    569568        pop     dx
    570569        cmp     al, 09ah
    571         jnz     .nextPort       
     570        jnz     .nextPort
    572571
    573572        mov     al, 0ch
     
    579578;
    580579; Pack into dl, baud rate starts at 0
    581 ; 
     580;
    582581        add     dx,-(SerialCommand_PackedPortAndBaud_StartingPort)
    583582        shr     dx,1
    584        
     583
    585584        jmp     .testFirstBaud
    586585
    587586;
    588587; Walk through 4 possible baud rates
    589 ; 
    590 .nextBaud:     
     588;
     589.nextBaud:
    591590        inc     dx
    592591        test    dl,3
    593592        jz      .nextPort
    594        
    595 .testFirstBaud:     
     593
     594.testFirstBaud:
    596595        call    SerialCommand_IdentifyDeviceInDL_DriveInBH
    597596        jc      .nextBaud
    598597
    599598        ret
    600                
     599
    601600.exitNotFound:
     601        stc
    602602        mov     ah,1
    603         stc
    604603
    605604        ret
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm

    r179 r181  
    1818        or      byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    1919        mov     al, byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud]
    20         mov     byte [ds:di+DPT.bSerialPortAndBaud], al
     20        mov     byte [di+DPT.bSerialPortAndBaud], al
    2121        ret
    2222
    23 
  • trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm

    r155 r181  
    5959%ifndef USE_AT
    6060    mov     ax, 2
    61     ; Fall to Delay_TimerTicksFromAX
     61    ; Fall to Timer_DelayTimerTicksFromAX
    6262%else
    6363    push    dx
     
    6868    mov     ah, EVENT_WAIT
    6969    int     BIOS_SYSTEM_INTERRUPT_15h
    70     sti                                 ; XT BIOSes return with interrupt disabled
     70    sti                                 ; XT BIOSes return with interrupts disabled. TODO: Maybe we can remove this since it's in an AT-only block?
    7171
    7272    pop     cx
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r176 r181  
    5353    cmp     ah, 48h
    5454    ja      SHORT Int13h_UnsupportedFunction
    55     sub     bx, 41h<<1                  ; BX = Offset to eINT 13h jump table
    56     jl      SHORT Int13h_UnsupportedFunction
     55    sub     bl, 41h<<1                  ; BX = Offset to eINT 13h jump table
     56    jb      SHORT Int13h_UnsupportedFunction
    5757    jmp     [cs:bx+g_rgwEbiosFunctionJumpTable]
    5858%endif
     
    169169    mov     di, [RAMVARS.fpOldI13h+2]
    170170    xchg    di, [es:BIOS_DISK_INTERRUPT_13h*4+2]
     171    sti
    171172    mov     [RAMVARS.fpOldI13h+2], di
    172     sti
    173173    pop     es
    174174    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r170 r181  
    6060    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    6161    pop     bx
    62     jc      SHORT .DisableBlockMode
    63 
    64     ; Store new block size to DPT and return
    65     mov     [di+DPT_ATA.bSetBlock], bl              ; Store new block size
     62    jnc     .StoreBlockSize
     63    mov     bl, 1   ; Disable block mode
     64.StoreBlockSize:    ; Store new block size to DPT and return
     65    mov     [di+DPT_ATA.bSetBlock], bl
    6666    ret
    67 .DisableBlockMode:
    68     mov     BYTE [di+DPT_ATA.bSetBlock], 1          ; Disable block mode
    69     ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/CommandLookup.asm

    r176 r181  
    55SECTION .text
    66
    7 %ifdef MODULE_EBIOS
    87;--------------------------------------------------------------------
    98; CommandLookup_GetEbiosIndexToBX
     
    1615;       AX, DX
    1716;--------------------------------------------------------------------
     17%ifdef MODULE_EBIOS
    1818ALIGN JUMP_ALIGN
    1919CommandLookup_GetEbiosIndexToBX:
     
    2929    ret
    3030%endif
    31        
     31
    3232;--------------------------------------------------------------------
    3333; CommandLookup_GetOldInt13hIndexToBX
     
    6363    db      COMMAND_VERIFY_SECTORS_EXT
    6464    db      COMMAND_VERIFY_SECTORS
    65     db      COMMAND_VERIFY_SECTORS_EXT     
     65    db      COMMAND_VERIFY_SECTORS_EXT
     66
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r174 r181  
    121121;--------------------------------------------------------------------
    122122AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI:
    123     call    Registers_ExchangeDSSIwithESDI  ; ATA info now in DSDI
     123    mov     bx, Registers_ExchangeDSSIwithESDI
     124    call    bx  ; ATA info now in DS:DI
     125    push    bx  ; We will return via Registers_ExchangeDSSIwithESDI
    124126    xor     bx, bx
    125127    test    BYTE [di+ATA1.wCaps+1], A1_wCaps_LBA>>8
     
    133135;   Parameters:
    134136;       BX:     Zero
    135 ;       DS:SI:  Ptr to 512-byte ATA information read from the drive
     137;       DS:DI:  Ptr to 512-byte ATA information read from the drive
    136138;   Returns:
    137139;       BX:DX:AX:   48-bit sector count
     
    145147    mov     dx, [di+ATA6.qwLBACnt+2]
    146148    mov     bx, [di+ATA6.qwLBACnt+4]
    147     jmp     SHORT .ExchangePtrAndReturn
     149    ret
    148150
    149151.GetLba28SectorCount:
    150152    mov     ax, [di+ATA1.dwLBACnt]
    151153    mov     dx, [di+ATA1.dwLBACnt+2]
    152     jmp     SHORT .ExchangePtrAndReturn
     154    ret
    153155
    154156.GetChsSectorCount:
     
    156158    mul     BYTE [di+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads
    157159    mul     WORD [di+ATA1.wCylCnt]  ; DX:AX=Sectors per track * number of heads * number of cylinders
    158 .ExchangePtrAndReturn:
    159     jmp     Registers_ExchangeDSSIwithESDI
     160    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm

    r148 r181  
    5555;       DL:     Translated drive number
    5656;   Corrupts registers:
    57 ;       Nothing
     57;       AL
    5858;--------------------------------------------------------------------
    5959ALIGN JUMP_ALIGN
     
    6262    je      SHORT .SwapToXXhInAL
    6363    cmp     al, dl              ; Swap DL from xxh to 00h/80h?
    64     je      SHORT .SwapTo00hOr80hInAH
    65     ret
    66 ALIGN JUMP_ALIGN
    67 .SwapTo00hOr80hInAH:
    68     mov     dl, ah
    69     ret
     64    jne     SHORT .Return
     65    mov     al, ah
    7066ALIGN JUMP_ALIGN
    7167.SwapToXXhInAL:
    7268    mov     dl, al
     69ALIGN JUMP_ALIGN, ret
     70.Return:
    7371    ret
    7472
     
    8381;       Nothing
    8482;   Corrupts registers:
    85 ;       AX
     83;       Nothing
    8684;--------------------------------------------------------------------
    8785ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r152 r181  
    136136    call    GetCountFromBDA
    137137%endif
    138     MAX_U   cl, [cs:ROMVARS.bMinFddCnt]
     138    mov     ch, [cs:ROMVARS.bMinFddCnt]
     139    MAX_U   cl, ch
     140    pop     es
    139141    xor     ch, ch
    140     pop     es
    141142    ret
    142143
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r162 r181  
    2929;--------------------------------------------------------------------
    3030.InitializeInt13hAnd40h:
     31    mov     ax, [es:BIOS_DISK_INTERRUPT_13h*4+2]; Load old INT 13h segment
     32    mov     [RAMVARS.fpOldI13h+2], ax           ; Store old INT 13h segment
     33    xchg    dx, ax
    3134    mov     ax, [es:BIOS_DISK_INTERRUPT_13h*4]  ; Load old INT 13h offset
    32     mov     dx, [es:BIOS_DISK_INTERRUPT_13h*4+2]; Load old INT 13h segment
    3335    mov     [RAMVARS.fpOldI13h], ax             ; Store old INT 13h offset
    34     mov     [RAMVARS.fpOldI13h+2], dx           ; Store old INT 13h segment
     36
    3537    mov     bx, BIOS_DISK_INTERRUPT_13h         ; INT 13h interrupt vector offset
    3638    mov     si, Int13h_DiskFunctionsHandler     ; Interrupt handler offset
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r179 r181  
    33;               :   aitotat@gmail.com
    44;               :
     5;               :   Greg Lindhorst
     6;               :   gregli@hotmail.com
     7;               ;
    58;               :   Krister Nordvall
    69;               :   krille_n_@hotmail.com
     
    1316
    1417
    15 ; Included .inc files
    16 %include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
    17 %include "IntController.inc"    ; For Interrupt Controller equates
    18 %include "ATA_ID.inc"           ; For ATA Drive Information structs
    19 %include "IdeRegisters.inc"     ; For ATA Registers, flags and commands
    20 %include "Int13h.inc"           ; Equates for INT 13h functions
     18    ; Included .inc files
     19    %include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
     20    %include "IntController.inc"    ; For Interrupt Controller equates
     21    %include "ATA_ID.inc"           ; For ATA Drive Information structs
     22    %include "IdeRegisters.inc"     ; For ATA Registers, flags and commands
     23    %include "Int13h.inc"           ; Equates for INT 13h functions
    2124%ifdef MODULE_EBIOS
    22 %include "EBIOS.inc"            ; Equates for EBIOS functions
    23 %endif
    24 %include "CustomDPT.inc"        ; For Disk Parameter Table
    25 %include "RomVars.inc"          ; For ROMVARS and IDEVARS structs
    26 %include "RamVars.inc"          ; For RAMVARS struct
    27 %include "BootVars.inc"         ; For BOOTVARS and BOOTNFO structs
    28 %include "BootMenu.inc"         ; For Boot Menu
    29 %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
    30 %include "DeviceIDE.inc"        ; For IDE device equates
     25    %include "EBIOS.inc"            ; Equates for EBIOS functions
     26%endif
     27    %include "CustomDPT.inc"        ; For Disk Parameter Table
     28    %include "RomVars.inc"          ; For ROMVARS and IDEVARS structs
     29    %include "RamVars.inc"          ; For RAMVARS struct
     30    %include "BootVars.inc"         ; For BOOTVARS and BOOTNFO structs
     31    %include "BootMenu.inc"         ; For Boot Menu
     32    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
     33    %include "DeviceIDE.inc"        ; For IDE device equates
    3134
    3235
     
    3942    at  ROMVARS.wRomSign,   dw  0AA55h          ; PC ROM signature
    4043    at  ROMVARS.bRomSize,   db  CNT_ROM_BLOCKS  ; ROM size in 512B blocks
    41     at  ROMVARS.rgbJump,    jmp Initialize_FromMainBiosRomSearch
     44    at  ROMVARS.rgbJump,    jmp Initialize_FromMainBiosRomSearch
    4245    at  ROMVARS.rgbSign,    db  "XTIDE120"      ; Signature for flash program
    4346    at  ROMVARS.szTitle
     
    5356
    5457;;; For OR'ing into wFlags below
    55 ;;; 
     58;;;
    5659%ifdef MODULE_SERIAL
    57 MAIN_FLG_MODULE_SERIAL  equ   FLG_ROMVARS_MODULE_SERIAL
    58 %else
    59 MAIN_FLG_MODULE_SERIAL  equ   0
     60    MAIN_FLG_MODULE_SERIAL  equ FLG_ROMVARS_MODULE_SERIAL
     61%else
     62    MAIN_FLG_MODULE_SERIAL  equ 0
    6063%endif
    6164
    6265%ifdef MODULE_EBIOS
    63 MAIN_FLG_MODULE_EBIOS   equ   FLG_ROMVARS_MODULE_EBIOS
    64 %else
    65 MAIN_FLG_MODULE_EBIOS   equ   0
     66    MAIN_FLG_MODULE_EBIOS   equ FLG_ROMVARS_MODULE_EBIOS
     67%else
     68    MAIN_FLG_MODULE_EBIOS   equ 0
    6669%endif
    6770
     
    109112    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
    110113    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db  FLG_DRVPARAMS_BLOCKMODE
    111     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE     
    112 %endif         
     114    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
     115%endif
    113116%else
    114117;-----------------------------------;
     
    142145    at  ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice,      db  DEVICE_SERIAL_PORT
    143146    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db  FLG_DRVPARAMS_BLOCKMODE
    144     at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE     
    145 %endif 
     147    at  ROMVARS.ideVarsSerialAuto+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,  db  FLG_DRVPARAMS_BLOCKMODE
     148%endif
    146149%endif
    147150iend
    148151
    149152
    150 ; Libraries and data
    151 %include "AssemblyLibrary.asm"
    152 %include "Strings.asm"          ; For BIOS message strings
    153 
    154 ; Initialization and drive detection
    155 %include "Initialize.asm"       ; For BIOS initialization
    156 %include "Interrupts.asm"       ; For Interrupt initialization
    157 %include "RamVars.asm"          ; For RAMVARS initialization and access
    158 %include "CreateDPT.asm"        ; For creating DPTs
    159 %include "FindDPT.asm"          ; For finding DPTs
    160 %include "AccessDPT.asm"        ; For accessing DPTs
    161 %include "BootInfo.asm"         ; For creating BOOTNFO structs
    162 %include "AtaID.asm"            ; For ATA Identify Device information
    163 %include "DetectDrives.asm"     ; For detecting IDE drives
    164 %include "DetectPrint.asm"      ; For printing drive detection strings
    165 
    166 ; Boot menu
    167 %include "BootMenu.asm"         ; For Boot Menu operations
    168 %include "BootMenuEvent.asm"    ; For menu library event handling
    169 %include "FloppyDrive.asm"      ; Floppy Drive related functions
    170 %include "BootSector.asm"       ; For loading boot sector
    171 %include "BootPrint.asm"        ; For printing boot information
    172 %include "BootMenuPrint.asm"    ; For printing Boot Menu strings
    173 %include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
    174 
    175 ; Boot loader
     153    ; Libraries and data
     154    %include "AssemblyLibrary.asm"
     155    %include "Strings.asm"          ; For BIOS message strings
     156
     157    ; Initialization and drive detection
     158    %include "Initialize.asm"       ; For BIOS initialization
     159    %include "Interrupts.asm"       ; For Interrupt initialization
     160    %include "RamVars.asm"          ; For RAMVARS initialization and access
     161    %include "CreateDPT.asm"        ; For creating DPTs
     162    %include "FindDPT.asm"          ; For finding DPTs
     163    %include "AccessDPT.asm"        ; For accessing DPTs
     164    %include "BootInfo.asm"         ; For creating BOOTNFO structs
     165    %include "AtaID.asm"            ; For ATA Identify Device information
     166    %include "DetectDrives.asm"     ; For detecting IDE drives
     167    %include "DetectPrint.asm"      ; For printing drive detection strings
     168
     169    ; Boot menu
     170    %include "BootMenu.asm"         ; For Boot Menu operations
     171    %include "BootMenuEvent.asm"    ; For menu library event handling
     172    %include "FloppyDrive.asm"      ; Floppy Drive related functions
     173    %include "BootSector.asm"       ; For loading boot sector
     174    %include "BootPrint.asm"        ; For printing boot information
     175    %include "BootMenuPrint.asm"    ; For printing Boot Menu strings
     176    %include "BootMenuPrintCfg.asm" ; For printing hard disk configuration
     177
     178    ; Boot loader
    176179%ifndef USE_AT
    177     %include "Int19hLate.asm"   ; For late initialization
    178 %endif
    179 %include "Int19hMenu.asm"       ; For Int 19h, Boot Loader for Boot Menu
    180 
    181 ; For all device types
    182 %include "Device.asm"
    183 %include "Idepack.asm"
    184 %include "Timer.asm"            ; For timeout and delay
    185 
    186 ; IDE Device support
    187 %include "IdeCommand.asm"
    188 %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
    189 %include "IdeDPT.asm"
    190 %include "IdeIO.asm"
    191 %include "IdeIrq.asm"
    192 %include "IdeWait.asm"
    193 %include "IdeError.asm"         ; Must be included after IdeWait.asm
    194 
    195 %ifdef MODULE_SERIAL       
    196 ; Serial Port Device support
    197 %include "SerialCommand.asm"
    198 %include "SerialDPT.asm"
    199 %endif
    200 
    201 ; INT 13h Hard Disk BIOS functions
    202 %include "DriveXlate.asm"       ; For swapping drive numbers
    203 %include "Address.asm"          ; For sector address translations
    204 %include "CommandLookup.asm"    ; For getting correct transfer command
    205 %include "Int13h.asm"           ; For Int 13h, Disk functions
    206 %include "AH0h_HReset.asm"      ; Required by Int13h_Jump.asm
    207 %include "AH1h_HStatus.asm"     ; Required by Int13h_Jump.asm
    208 %include "AH2h_HRead.asm"       ; Required by Int13h_Jump.asm
    209 %include "AH3h_HWrite.asm"      ; Required by Int13h_Jump.asm
    210 %include "AH4h_HVerify.asm"     ; Required by Int13h_Jump.asm
    211 %include "AH8h_HParams.asm"     ; Required by Int13h_Jump.asm
    212 %include "AH9h_HInit.asm"       ; Required by Int13h_Jump.asm
    213 %include "AHCh_HSeek.asm"       ; Required by Int13h_Jump.asm
    214 %include "AHDh_HReset.asm"      ; Required by Int13h_Jump.asm
    215 %include "AH10h_HReady.asm"     ; Required by Int13h_Jump.asm
    216 %include "AH11h_HRecal.asm"     ; Required by Int13h_Jump.asm
    217 %include "AH15h_HSize.asm"      ; Required by Int13h_Jump.asm
    218 %include "AH23h_HFeatures.asm"  ; Required by Int13h_Jump.asm
    219 %include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
    220 %include "AH25h_HDrvID.asm"     ; Required by Int13h_Jump.asm
     180    %include "Int19hLate.asm"       ; For late initialization
     181%endif
     182    %include "Int19hMenu.asm"       ; For Int 19h, Boot Loader for Boot Menu
     183
     184    ; For all device types
     185    %include "Device.asm"
     186    %include "Idepack.asm"
     187    %include "Timer.asm"            ; For timeout and delay
     188
     189    ; IDE Device support
     190    %include "IdeCommand.asm"
     191    %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
     192    %include "IdeDPT.asm"
     193    %include "IdeIO.asm"
     194    %include "IdeIrq.asm"
     195    %include "IdeWait.asm"
     196    %include "IdeError.asm"         ; Must be included after IdeWait.asm
     197
     198%ifdef MODULE_SERIAL                ; Serial Port Device support
     199    %include "SerialCommand.asm"
     200    %include "SerialDPT.asm"
     201%endif
     202
     203    ; INT 13h Hard Disk BIOS functions
     204    %include "DriveXlate.asm"       ; For swapping drive numbers
     205    %include "Address.asm"          ; For sector address translations
     206    %include "CommandLookup.asm"    ; For getting correct transfer command
     207    %include "Int13h.asm"           ; For Int 13h, Disk functions
     208    %include "AH0h_HReset.asm"      ; Required by Int13h_Jump.asm
     209    %include "AH1h_HStatus.asm"     ; Required by Int13h_Jump.asm
     210    %include "AH2h_HRead.asm"       ; Required by Int13h_Jump.asm
     211    %include "AH3h_HWrite.asm"      ; Required by Int13h_Jump.asm
     212    %include "AH4h_HVerify.asm"     ; Required by Int13h_Jump.asm
     213    %include "AH8h_HParams.asm"     ; Required by Int13h_Jump.asm
     214    %include "AH9h_HInit.asm"       ; Required by Int13h_Jump.asm
     215    %include "AHCh_HSeek.asm"       ; Required by Int13h_Jump.asm
     216    %include "AHDh_HReset.asm"      ; Required by Int13h_Jump.asm
     217    %include "AH10h_HReady.asm"     ; Required by Int13h_Jump.asm
     218    %include "AH11h_HRecal.asm"     ; Required by Int13h_Jump.asm
     219    %include "AH15h_HSize.asm"      ; Required by Int13h_Jump.asm
     220    %include "AH23h_HFeatures.asm"  ; Required by Int13h_Jump.asm
     221    %include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm
     222    %include "AH25h_HDrvID.asm"     ; Required by Int13h_Jump.asm
    221223%ifdef MODULE_EBIOS
    222 %include "AH41h_CheckIfExtensionsPresent.asm"
    223 %include "AH42h_ExtendedReadSectors.asm"
    224 %include "AH43h_ExtendedWriteSectors.asm"
    225 %include "AH44h_ExtendedVerifySectors.asm"
    226 %include "AH47h_ExtendedSeek.asm"
    227 %include "AH48h_GetExtendedDriveParameters.asm"
     224    %include "AH41h_CheckIfExtensionsPresent.asm"
     225    %include "AH42h_ExtendedReadSectors.asm"
     226    %include "AH43h_ExtendedWriteSectors.asm"
     227    %include "AH44h_ExtendedVerifySectors.asm"
     228    %include "AH47h_ExtendedSeek.asm"
     229    %include "AH48h_GetExtendedDriveParameters.asm"
    228230%endif
    229231
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r173 r181  
    7878    ; Only need to limit sectors for LBA assist
    7979    test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
    80     jnz     SHORT .ReturnLbaAssistedLCHS
     80    jz      SHORT AccessDPT_ShiftPCHinBXDXtoLCH
    8181
    82     ; P-CHS to L-CHS translation when necessary
    83     jmp     SHORT AccessDPT_ShiftPCHinBXDXtoLCH
     82    cmp     WORD [di+DPT.dwCylinders+2], BYTE 0
     83    jnz     SHORT .Return_MAX_LCHS_CYLINDERS
    8484
    85 .ReturnLbaAssistedLCHS:
    86     cmp     WORD [di+DPT.dwCylinders+2], BYTE 0
    87     jz      SHORT .LimitCylindersTo1024
     85    ; Limit cylinders to 1024
     86    cmp     bx, MAX_LCHS_CYLINDERS
     87    jb      SHORT .Return
     88ALIGN JUMP_ALIGN
     89.Return_MAX_LCHS_CYLINDERS:
    8890    mov     bx, MAX_LCHS_CYLINDERS
    89 .LimitCylindersTo1024:
    90     MIN_U   bx, MAX_LCHS_CYLINDERS
     91ALIGN JUMP_ALIGN, ret
     92.Return:
    9193    ret
    9294
     
    114116    jmp     SHORT .ShiftLoop
    115117.LimitHeadsTo255:                       ; DOS does not support drives with 256 heads
    116     sub     dl, dh                      ; BH set only when 256 logical heads
     118    sub     dl, dh                      ; DH set only when 256 logical heads
    117119    xor     dh, dh
    118120    ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r175 r181  
    6666%ifdef MODULE_SERIAL
    6767    cmp     byte [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    68     jnz     .around
     68    jnz     .StoreAddressing
    6969    or      byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    70 .around:               
    71 %endif     
    72 
     70%endif
    7371    ; Fall to .StoreAddressing
    7472
     
    117115
    118116    ; We need to get number of bits to shift for translation
    119     push    bx
    120117    push    ax
    121118    eMOVZX  dx, bl                      ; Heads now in DX
    122     xchg    bx, ax                      ; Sectors now in BX
    123     call    AccessDPT_ShiftPCHinBXDXtoLCH
     119    xchg    bx, ax                      ; Cylinders now in BX
     120    call    AccessDPT_ShiftPCHinBXDXtoLCH   ; Leaves AX untouched
     121    xchg    bx, ax                      ; Restore HeadsAndSectors to BX
    124122    or      cl, ADDRESSING_MODE_PCHS<<ADDRESSING_MODE_FIELD_POSITION
    125123    or      [di+DPT.bFlagsLow], cl      ; Store bits to shift
    126124    pop     ax
    127     pop     bx
    128125    ; Fall to .StoreChsFromAXBX
    129126
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r161 r181  
    167167;       CF:         Set if wanted DPT found
    168168;                   Cleared if DPT not found
     169;                   Unchanged if no drives
    169170;   Corrupts registers:
    170171;       Nothing unless corrupted by callback function
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r155 r181  
    9393    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    9494    jnz     SHORT .GetStolenSegmentToDS
     95%ifndef USE_186
    9596    mov     di, LITE_MODE_RAMVARS_SEGMENT
    9697    mov     ds, di
     98%else
     99    push    LITE_MODE_RAMVARS_SEGMENT
     100    pop     ds
     101%endif
    97102    ret
    98103
     
    183188    LOAD_BDA_SEGMENT_TO es, cx, !       ; Zero CX
    184189    call    RamVars_GetCountOfKnownDrivesToDL
    185     MAX_U   dl, [es:BDA.bHDCount]
    186     mov     cl, dl
     190    mov     cl, [es:BDA.bHDCount]
     191    MAX_U   cl, dl
    187192
    188193    pop     dx
  • trunk/XTIDE_Universal_BIOS/makefile

    r176 r181  
    6565# Assembler preprocessor defines.                               #
    6666#################################################################
    67 DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS
     67DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL
    6868DEFINES_XT = ELIMINATE_CGA_SNOW
    6969DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/BiosFile.asm

    r138 r181  
    9292    call    Registers_ExchangeDSSIwithESDI
    9393    call    FileIO_ReadDXCXbytesToDSSIusingHandleFromBX
    94     jnc     SHORT .StoreFileNameToCfgvarsFromESDI
    95 
    96     pop     es
    97     ret
    98 
    99 ALIGN JUMP_ALIGN
    100 .StoreFileNameToCfgvarsFromESDI:
     94    jc      SHORT .ReturnError
     95
     96    ; Store filename to Cfgvars from ESDI
    10197    push    cx
    10298
     
    107103    cld
    108104    call    String_CopyDSSItoESDIandGetLengthToCX
     105    clc
    109106
    110107    pop     cx
     108ALIGN JUMP_ALIGN
     109.ReturnError:
    111110    pop     es
    112     clc
    113111    ret
    114112
     
    157155    xor     dx, dx
    158156    shl     cx, 1
    159     rcl     dx, 1           ; WORDs to BYTEs   
     157    rcl     dx, 1           ; WORDs to BYTEs
    160158
    161159    mov     al, FILE_ACCESS.WriteOnly
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Dialogs.asm

    r170 r181  
    159159ALIGN JUMP_ALIGN
    160160Dialogs_DisplayProgressDialogForFlashingWithDialogIoInDSSIandFlashvarsInDSBX:
    161     call    .InitializeProgressDialogIoInDSSIwithFlashvarsInDSBX
    162     mov     dx, ds
    163     mov     ax, bx
    164     CALL_MENU_LIBRARY StartProgressTaskWithIoInDSSIandParamInDXAX
    165     ret
    166 
    167 ALIGN JUMP_ALIGN
    168 .InitializeProgressDialogIoInDSSIwithFlashvarsInDSBX:
     161    ; Initialize progress dialog I/O in DS:SI with flashvars in DS:BX
    169162    call    InitializeDialogInputFromDSSI
    170163    mov     WORD [si+DIALOG_INPUT.fszTitle], g_szFlashTitle
     
    177170    mov     WORD [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI], Flash_EepromWithFlashvarsInDSSI
    178171    mov     [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI+2], cs
     172    ; Init done
     173
     174    mov     dx, ds
     175    mov     ax, bx
     176    CALL_MENU_LIBRARY StartProgressTaskWithIoInDSSIandParamInDXAX
    179177    ret
    180178
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm

    r159 r181  
    169169    call    Buffers_IsXtideUniversalBiosSignatureInESDI
    170170    je      SHORT .RomFound
    171     add     bx, 200h                ; Increment by 8kB
     171    add     bh, 2                   ; Increment by 8kB
    172172    jnc     SHORT .SegmentLoop      ; Loop until segment overflows
    173173    clc
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm

    r159 r181  
    1 ; File name     :   Flash.asm
    21; Project name  :   XTIDE Universal BIOS Configurator v2
    3 ; Created date  :   1.12.2010
    4 ; Last update   :   3.12.2010
    5 ; Author        :   Tomi Tilli
    62; Description   :   Functions for flashing the EEPROM.
    73
     
    3733
    3834    loop    .FlashNextPage
     35%if FLASH_RESULT.success = 0    ; Just in case this should ever change
     36    mov     [bp+FLASHVARS.flashResult], cl
     37%else
    3938    mov     BYTE [bp+FLASHVARS.flashResult], FLASH_RESULT.success
     39%endif
    4040    ret
    4141
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuEvents.asm

    r138 r181  
    135135.KeyStrokeInAX:
    136136    cmp     ah, KEY_DISPLAY_ITEM_HELP
    137     je      SHORT .DisplayHelp
    138     jmp     SHORT .EventNotHandled
    139 
    140 ALIGN JUMP_ALIGN
    141 .DisplayHelp:
     137    jne     SHORT .EventNotHandled
     138
     139;ALIGN JUMP_ALIGN
     140;.DisplayHelp:
    142141    call    Menupage_GetActiveMenupageToDSDI
    143142    CALL_MENU_LIBRARY GetHighlightedItemToAX
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menuitem.asm

    r108 r181  
    150150    add     di, [si+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    151151    jmp     [cs:bx+.rgfnJumpToStoreValueBasedOnItemType]
    152 .InvalidItemType:
    153     ret
    154152
    155153ALIGN WORD_ALIGN
     
    242240    CALL_MENU_LIBRARY GetHighlightedItemToAX
    243241    CALL_MENU_LIBRARY RefreshItemFromAX
     242.InvalidItemType:
    244243    ret
    245244
     
    268267ALIGN JUMP_ALIGN
    269268Menuitem_GetValueToAXfromMenuitemInDSSI:
    270     call    .GetMenuitemValueToAX
    271     test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_BYTEVALUE
    272     jnz     SHORT .ConvertWordToByteValue
    273     test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_FLAGVALUE
    274     jnz     SHORT .ConvertWordToFlagValue
    275     ret
    276 
    277 ALIGN JUMP_ALIGN
    278 .GetMenuitemValueToAX:
    279269    push    es
    280270    push    di
     
    284274    pop     di
    285275    pop     es
    286     ret
    287 
     276
     277    test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_BYTEVALUE
     278    jnz     SHORT .ConvertWordToByteValue
     279    test    BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_FLAGVALUE
     280    jz      SHORT .Return
     281
     282    test    ax, [si+MENUITEM.itemValue+ITEM_VALUE.wValueBitmask]
     283    mov     ax, TRUE<<1     ; Shift for lookup
     284    jnz     SHORT .Return
     285    xor     ax, ax
    288286ALIGN JUMP_ALIGN
    289287.ConvertWordToByteValue:
    290288    xor     ah, ah
    291     ret
    292 
    293 ALIGN JUMP_ALIGN
    294 .ConvertWordToFlagValue:
    295     test    ax, [si+MENUITEM.itemValue+ITEM_VALUE.wValueBitmask]
    296     jnz     SHORT .ReturnTrue
    297     xor     ax, ax
    298     ret
    299 ALIGN JUMP_ALIGN
    300 .ReturnTrue:
    301     mov     ax, TRUE<<1     ; Shift for lookup
     289ALIGN JUMP_ALIGN, ret
     290.Return:
    302291    ret
    303292
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm

    r153 r181  
    168168    call    .GetIdeControllerCountToCX
    169169    dec     cx          ; Primary always enabled
    170     jcxz    .PrimaryControllerAlreadyEnabled
     170    j    .PrimaryControllerAlreadyEnabled
    171171    mov     bx, g_MenuitemConfigurationSecondaryIdeController
    172172ALIGN JUMP_ALIGN
     
    191191    call    Buffers_GetRomvarsFlagsToAX
    192192    test    ax, FLG_ROMVARS_FULLMODE
     193    mov     al, 1   ; Assume lite mode
    193194    jz      SHORT .AllowOnlyOneIdeControllerInLiteMode
    194195
    195196    mov     bx, ROMVARS.bIdeCnt
    196197    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    197     eMOVZX  cx, al
    198     ret
    199198ALIGN JUMP_ALIGN
    200199.AllowOnlyOneIdeControllerInLiteMode:
    201     mov     cx, 1
     200    cbw     ; A maximum of 127 controllers should be sufficient
     201    xchg    cx, ax
    202202    ret
    203203
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm

    r159 r181  
    390390    mov     al, 0FEh                ; System reset (AT+ keyboard controller)
    391391    out     64h, al                 ; Reset computer (AT+)
    392     mov     ax, 10
     392    mov     al, 10
    393393    call    Delay_MicrosecondsFromAX
    394394.ResetXT:
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/makefile

    r145 r181  
    5858# Assembler preprocessor defines.                               #
    5959#################################################################
    60 DEFINES =
     60DEFINES = EXCLUDE_FROM_XTIDECFG
    6161DEFINES_XT = ELIMINATE_CGA_SNOW
    6262DEFINES_XTPLUS = USE_186 ELIMINATE_CGA_SNOW
Note: See TracChangeset for help on using the changeset viewer.