Ignore:
Timestamp:
Mar 19, 2011, 8:09:41 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm

    r128 r148  
    66
    77;--------------------------------------------------------------------
    8 ; Translates drive number when entering INT 13h.
    9 ;
    10 ; DriveXlate_WhenEnteringInt13h
    11 ;   Parameters:
    12 ;       DL:     Drive number to be possibly translated
    13 ;       DS:     RAMVARS segment
    14 ;   Returns:
    15 ;       DL:     Translated drive number
    16 ;   Corrupts registers:
    17 ;       DI
    18 ;--------------------------------------------------------------------
    19 ALIGN JUMP_ALIGN
    20 DriveXlate_WhenEnteringInt13h:
    21     inc     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]
    22     cmp     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt], 1
    23     je      SHORT DriveXlate_ToOrBack
    24     ret
    25 
    26 
    27 ;--------------------------------------------------------------------
    28 ; DriveXlate_WhenLeavingInt13hWithReturnValueInDL
    29 ;   Parameters:
    30 ;       DS:     RAMVARS segment
    31 ;   Returns:
    32 ;       Nothing
    33 ;   Corrupts registers:
    34 ;       DI
    35 ;--------------------------------------------------------------------
    36 ALIGN JUMP_ALIGN
    37 DriveXlate_WhenLeavingInt13hWithReturnValueInDL:
    38     dec     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]
    39     ret
    40 
    41 ;--------------------------------------------------------------------
    42 ; Translates drive number when leaving INT 13h.
    43 ;
    44 ; DriveXlate_WhenLeavingInt13h
    45 ;   Parameters:
    46 ;       DL:     Drive number to be possibly translated
    47 ;       DS:     RAMVARS segment
    48 ;   Returns:
    49 ;       DL:     Translated drive number
    50 ;   Corrupts registers:
    51 ;       DI
    52 ;--------------------------------------------------------------------
    53 ALIGN JUMP_ALIGN
    54 DriveXlate_WhenLeavingInt13h:
    55     dec     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]
    56     jz      SHORT DriveXlate_ToOrBack
    57     ret
    58 
    59 
    60 ;--------------------------------------------------------------------
    61 ; Translates drive number to or back.
    62 ;
    638; DriveXlate_ToOrBack
    649;   Parameters:
     
    7520    jz      SHORT .Return           ; Return if translation disabled
    7621    xchg    di, ax                  ; Backup AX
    77     call    DriveXlate_SwapFloppyDriveOrHardDisk
     22    call    SwapFloppyDriveOrHardDisk
    7823    xchg    ax, di
    7924.Return:
     
    8227
    8328;--------------------------------------------------------------------
    84 ; Swaps Floppy Drive or Hard Disk number.
    85 ;
    86 ; DriveXlate_SwapFloppyDriveOrHardDisk
     29; SwapFloppyDriveOrHardDisk
    8730;   Parameters:
    8831;       DL:     Drive number to be possibly swapped
     
    9437;--------------------------------------------------------------------
    9538ALIGN JUMP_ALIGN
    96 DriveXlate_SwapFloppyDriveOrHardDisk:
     39SwapFloppyDriveOrHardDisk:
    9740    mov     ah, 80h                 ; Assume hard disk
    9841    mov     al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
     
    14588DriveXlate_Reset:
    14689    mov     WORD [RAMVARS.xlateVars], 8000h ; .bFDSwap and .bHDSwap
    147     mov     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt], 0
    14890    ret
    14991
     
    172114    mov     [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
    173115    ret
    174 
    175 
    176 ;--------------------------------------------------------------------
    177 ; Checks if INT 13h function returns some value in DL
    178 ; (other than the drive number that was also parameter).
    179 ;
    180 ; DriveXlate_DoesFunctionReturnSomethingInDL
    181 ;   Parameters:
    182 ;       AH:     INT 13h BIOS Function
    183 ;       DL:     Drive number
    184 ;   Returns:
    185 ;       CF:     Set if something is returned in DL
    186 ;               Cleared if only drive number parameter is returned in DL
    187 ;   Corrupts registers:
    188 ;       Nothing
    189 ;--------------------------------------------------------------------
    190 ALIGN JUMP_ALIGN
    191 DriveXlate_DoesFunctionReturnSomethingInDL:
    192     cmp     ah, 08h         ; AH=08h, Read Disk Drive Parameters?
    193     je      SHORT DriveXlate_FunctionReturnsSomethingInDL
    194     test    dl, dl
    195     jns     SHORT DriveXlate_DoesFloppyFunctionReturnSomethingInDL
    196     ; Fall to DriveXlate_DoesHardDiskFunctionReturnSomethingInDL
    197 
    198 ;--------------------------------------------------------------------
    199 ; Checks if INT 13h hard disk or floppy drive function returns some
    200 ; value in DL other than the drive number that was also parameter).
    201 ; Some functions return different values for hard disks and floppy drives.
    202 ;
    203 ; DriveXlate_DoesHardDiskFunctionReturnSomethingInDL
    204 ; DriveXlate_DoesFloppyFunctionReturnSomethingInDL
    205 ;   Parameters:
    206 ;       AH:     INT 13h BIOS Function
    207 ;       DL:     Hard Disk number
    208 ;   Returns:
    209 ;       CF:     Set if something is returned in DL
    210 ;               Cleared if only drive number parameter is returned in DL
    211 ;   Corrupts registers:
    212 ;       Nothing
    213 ;--------------------------------------------------------------------
    214 ; ALIGN JUMP_ALIGN
    215 DriveXlate_DoesHardDiskFunctionReturnSomethingInDL:
    216     cmp     ah, 15h         ; AH=15h, Read Disk Drive Size?
    217     je      SHORT DriveXlate_FunctionReturnsSomethingInDL
    218 DriveXlate_DoesFloppyFunctionReturnSomethingInDL:
    219     clc
    220     ret
    221 
    222 ALIGN JUMP_ALIGN
    223 DriveXlate_FunctionReturnsSomethingInDL:
    224     stc
    225     ret
Note: See TracChangeset for help on using the changeset viewer.