Ignore:
Timestamp:
Feb 27, 2012, 4:24:52 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • AH=0h (Reset) should now work but our drives are no longer reset if DL belongs to foreign drive.
File:
1 edited

Legend:

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

    r269 r271  
    88; Int 13h function AH=0h, Disk Controller Reset.
    99;
     10; Note: We handle all AH=0h calls, even for drives handled by other
     11; BIOSes!
     12;
    1013; AH0h_HandlerForDiskControllerReset
    1114;   Parameters:
    1215;       DL:     Translated Drive number (ignored so all drives are reset)
    1316;               If bit 7 is set all hard disks and floppy disks reset.
    14 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     17;       DS:DI:  Ptr to DPT (only if DL is our drive)
    1518;       SS:BP:  Ptr to IDEPACK
    1619;   Returns with INTPACK:
     
    4952
    5053    ; Resetting our hard disks will modify dl and bl such that this call must be the last in the list
    51     ;
    52     call    AH0h_ResetHardDisksHandledByOurBIOS         
     54    call    GetDriveNumberForForeignHardDiskHandlerToDL ; Load DPT for our drive
     55    jc      SHORT .SkipHardDiskReset                    ; Our drive not requested so let's not reset them
     56    call    ResetHardDisksHandledByOurBIOS         
    5357
    5458.SkipHardDiskReset:
     
    6670;       AX, DL, DI
    6771;--------------------------------------------------------------------
    68 ALIGN JUMP_ALIGN
    6972ResetFloppyDrivesWithInt40h:
    70     call    GetDriveNumberForForeignBiosesToDL
     73    call    GetDriveNumberForForeignHardDiskHandlerToDL
    7174    and     dl, 7Fh                     ; Clear hard disk bit
    7275    xor     ah, ah                      ; Disk Controller Reset
     
    8588;       AX, DL, DI
    8689;--------------------------------------------------------------------
    87 ALIGN JUMP_ALIGN
    8890ResetForeignHardDisks:
    89     call    GetDriveNumberForForeignBiosesToDL
     91    call    GetDriveNumberForForeignHardDiskHandlerToDL
    9092    xor     ah, ah                      ; Disk Controller Reset
    9193    call    Int13h_CallPreviousInt13hHandler
     
    104106;       Nothing
    105107;--------------------------------------------------------------------
    106 ALIGN JUMP_ALIGN
    107108BackupErrorCodeFromTheRequestedDriveToBH:
    108109    cmp     dl, bl              ; Requested drive?
    109110    eCMOVE  bh, ah
    110111    ret
    111        
     112
    112113
    113114;--------------------------------------------------------------------
    114 ; GetDriveNumberForForeignBiosesToDL
     115; GetDriveNumberForForeignHardDiskHandlerToDL
    115116;   Parameters:
    116117;       BL:     Requested drive (DL when entering AH=00h)
    117118;       DS:     RAMVARS segment
    118119;   Returns:
     120;       DS:DI:  Ptr to DPT if our drive
    119121;       DL:     BL if foreign drive
    120122;               80h if our drive
     123;       CF:     Set if foreign drive
     124;               Cleared if our drive
    121125;   Corrupts registers:
    122 ;       DI
     126;       (DI)
    123127;--------------------------------------------------------------------
    124 ALIGN JUMP_ALIGN
    125 GetDriveNumberForForeignBiosesToDL:
     128GetDriveNumberForForeignHardDiskHandlerToDL:
    126129    mov     dl, bl
    127     test    di, di
    128     jz      SHORT .Return               ; Return what was in BL unmodified
    129     mov     dl, 80h
    130 .Return:
     130    call    FindDPT_ForDriveNumberInDL
     131    jc      SHORT .ReturnWithForeignDriveInDL
     132    mov     dl, 80h             ; First possible Hard Disk should be safe value
     133.ReturnWithForeignDriveInDL:
    131134    ret
    132135
    133136
    134137;--------------------------------------------------------------------
    135 ; AH0h_ResetHardDisksHandledByOurBIOS
     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;--------------------------------------------------------------------
     147AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization:
     148    mov     bl, [RAMVARS.bFirstDrv]
     149    call    GetDriveNumberForForeignHardDiskHandlerToDL
     150    ; Fall to ResetHardDisksHandledByOurBIOS
     151
     152;--------------------------------------------------------------------
     153; ResetHardDisksHandledByOurBIOS
    136154;   Parameters:
    137155;       BL:     Requested drive (DL when entering AH=00h)
    138 ;       DS:     RAMVARS segment
     156;       DS:DI:  Ptr to DPT for requested drive
    139157;       SS:BP:  Ptr to IDEPACK
    140158;   Returns:
     
    143161;       AX, CX, DX, SI, DI
    144162;--------------------------------------------------------------------
    145 ALIGN JUMP_ALIGN
    146 AH0h_ResetHardDisksHandledByOurBIOS:
     163ResetHardDisksHandledByOurBIOS:
    147164    mov     bl, [di+DPT.bIdevarsOffset]                 ; replace drive number with Idevars pointer for cmp with dl
    148165    mov     dl, ROMVARS.ideVars0                        ; starting Idevars offset
    149166
    150     call    RamVars_GetIdeControllerCountToCX
     167    call    RamVars_GetIdeControllerCountToCX           ; get count of ide controllers
    151168    jcxz    .done                                       ; just in case bIdeCnt is zero (shouldn't be)
    152 
    153     mov     si, IterateFindFirstDPTforIdevars           ; iteration routine (see below)
    154 
    155169.loop:
    156     call    IterateAllDPTs                              ; look for the first drive on this controller, if any
     170    call    FindDPT_ForIdevarsOffsetInDL                ; look for the first drive on this controller, if any
    157171    jc      .notFound
    158172
     
    166180.done:
    167181    ret
    168 
    169 ;--------------------------------------------------------------------
    170 ; Iteration routine for AH0h_ResetHardDisksHandledByOurBIOS,
    171 ; for use with IterateAllDPTs
    172 ;
    173 ; Returns when DPT is found on the controller with Idevars offset in DL
    174 ;--------------------------------------------------------------------
    175 IterateFindFirstDPTforIdevars:     
    176     cmp     dl, [di+DPT.bIdevarsOffset]         ; Clears CF if matched
    177     jz      .done
    178     stc                                         ; Set CF for not found
    179 .done: 
    180     ret
Note: See TracChangeset for help on using the changeset viewer.