Changeset 275 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers


Ignore:
Timestamp:
Feb 28, 2012, 1:25:33 PM (13 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Made some tweaks to ah0h, saving some space by taking advantage of DPT=null indicating foreign drive.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r271 r275  
    1515;       DL:     Translated Drive number (ignored so all drives are reset)
    1616;               If bit 7 is set all hard disks and floppy disks reset.
    17 ;       DS:DI:  Ptr to DPT (only if DL is our drive)
     17;       DS:DI:  Ptr to DPT (or Null if foreign drive)
    1818;       SS:BP:  Ptr to IDEPACK
    1919;   Returns with INTPACK:
     
    5151    call    ResetForeignHardDisks
    5252
    53     ; Resetting our hard disks will modify dl and bl such that this call must be the last in the list
    54     call    GetDriveNumberForForeignHardDiskHandlerToDL ; Load DPT for our drive
    55     jc      SHORT .SkipHardDiskReset                    ; Our drive not requested so let's not reset them
     53    test    di, di
     54    jz      SHORT .SkipHardDiskReset
     55
     56    ; Resetting our hard disks will modify dl and bl to be idevars offset based instead of drive number based,
     57    ; such that this call must be the last in the list of reset routines called.
     58    ;
    5659    call    ResetHardDisksHandledByOurBIOS         
    5760
     
    118121;       DS:     RAMVARS segment
    119122;   Returns:
    120 ;       DS:DI:  Ptr to DPT if our drive
     123;       DS:DI:  Ptr to DPT if our drive (or Null if foreign drive)
    121124;       DL:     BL if foreign drive
    122125;               80h if our drive
    123 ;       CF:     Set if foreign drive
    124 ;               Cleared if our drive
    125 ;   Corrupts registers:
    126 ;       (DI)
    127126;--------------------------------------------------------------------
    128127GetDriveNumberForForeignHardDiskHandlerToDL:
    129128    mov     dl, bl
    130     call    FindDPT_ForDriveNumberInDL
    131     jc      SHORT .ReturnWithForeignDriveInDL
     129    test    di, di
     130    jz      SHORT .Return
    132131    mov     dl, 80h             ; First possible Hard Disk should be safe value
    133 .ReturnWithForeignDriveInDL:
     132.Return:
    134133    ret
    135134
    136 
    137 ;--------------------------------------------------------------------
    138 ; AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
    139 ;   Parameters:
    140 ;       DS:     RAMVARS segment
    141 ;       SS:BP:  Ptr to IDEPACK
    142 ;   Returns:
    143 ;       Nothing
    144 ;   Corrupts registers:
    145 ;       AX, BX, CX, DX, SI, DI
    146 ;--------------------------------------------------------------------
    147 AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization:
    148     mov     bl, [RAMVARS.bFirstDrv]
    149     call    GetDriveNumberForForeignHardDiskHandlerToDL
    150     ; Fall to ResetHardDisksHandledByOurBIOS
     135AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization equ ResetHardDisksHandledByOurBIOS.ErrorCodeNotUsed
    151136
    152137;--------------------------------------------------------------------
    153138; ResetHardDisksHandledByOurBIOS
    154139;   Parameters:
    155 ;       BL:     Requested drive (DL when entering AH=00h)
    156140;       DS:DI:  Ptr to DPT for requested drive
     141;               If DI is Null (foreign drive), or if error result in BH won't be used,
     142;               enter through .ErrorCodeNotUsed, to avoid di=Null dereference
    157143;       SS:BP:  Ptr to IDEPACK
    158144;   Returns:
    159145;       BH:     Error code from requested drive (if available)
    160146;   Corrupts registers:
    161 ;       AX, CX, DX, SI, DI
     147;       AX, BX, CX, DX, SI, DI
    162148;--------------------------------------------------------------------
    163149ResetHardDisksHandledByOurBIOS:
    164150    mov     bl, [di+DPT.bIdevarsOffset]                 ; replace drive number with Idevars pointer for cmp with dl
     151
     152.ErrorCodeNotUsed:                                      ; BH will be garbage if thie entry point is used,
     153                                                        ; but reset of all drives will still happen
     154
    165155    mov     dl, ROMVARS.ideVars0                        ; starting Idevars offset
    166156
Note: See TracChangeset for help on using the changeset viewer.