Changeset 271 in xtideuniversalbios


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.
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
4 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
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r262 r271  
    3333; AHDh_ResetDrive
    3434;   Parameters:
    35 ;       DL:     Drive number
    36 ;       DS:     RAMVARS segment
     35;       DS:DI:  Ptr to DPT
    3736;       SS:BP:  Ptr to IDEPACK
    3837;   Returns:
     
    4039;       CF:     0 if succesfull, 1 if error
    4140;   Corrupts registers:
    42 ;       AL, CX, SI
     41;       AL, SI
    4342;--------------------------------------------------------------------
    44 ;ALIGN JUMP_ALIGN
    4543AHDh_ResetDrive:
    4644    push    dx
     45    push    cx
    4746    push    bx
    4847    push    di
     
    5857       
    5958    mov     si, IterateAndResetDrives
    60     call    IterateAllDPTs
     59    call    FindDPT_IterateAllDPTs
    6160
    6261    shr     ah, 1                               ; Move error code and CF into proper position
     
    6463    pop     di
    6564    pop     bx
     65    pop     cx
    6666    pop     dx
    6767    ret
     
    7676IterateAndResetDrives:
    7777    cmp     al, [di+DPT.bIdevarsOffset]         ; The right controller?
    78     jnz     .done
     78    jne     .done
    7979    push    ax
    8080    call    AH9h_InitializeDriveForUse          ; Reset Master and Slave (Master will come first in DPT list)
     
    8383    or      ah, (RET_HD_RESETFAIL << 1) | 1     ; OR in Reset Failed error code and CF, will SHR into position later
    8484.done:
    85     stc                                         ; From IterateAllDPTs perspective, the DPT is never found
     85    stc                                         ; From IterateAllDPTs perspective, the DPT is never found (continue iteration)
    8686    ret
    87        
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r262 r271  
    9696.ResetDetectedDrives:
    9797    call    Idepack_FakeToSSBP
    98     call    AH0h_ResetHardDisksHandledByOurBIOS
     98    call    AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
    9999    add     sp, BYTE EXTRA_BYTES_FOR_INTPACK
    100100    ret
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r265 r271  
    116116    ret
    117117
     118
     119;--------------------------------------------------------------------
     120; FindDPT_ForIdevarsOffsetInDL
     121;   Parameters:
     122;       DL:     Offset to IDEVARS to search for
     123;       DS:     RAMVARS segment
     124;   Returns:
     125;       DS:DI:      Ptr to first DPT with same IDEVARS as in DL
     126;       CF:         Clear if wanted DPT found
     127;                   Set if DPT not found, or no DPTs present
     128;   Corrupts registers:
     129;       SI
     130;--------------------------------------------------------------------
     131FindDPT_ForIdevarsOffsetInDL:
     132    mov     si, IterateFindFirstDPTforIdevars           ; iteration routine (see below)
     133    jmp     SHORT FindDPT_IterateAllDPTs                ; look for the first drive on this controller, if any
     134
     135;--------------------------------------------------------------------
     136; Iteration routine for FindDPT_ForIdevarsOffsetInDL,
     137; for use with IterateAllDPTs
     138;
     139; Returns when DPT is found on the controller with Idevars offset in DL
     140;
     141; IterateFindFirstDPTforIdevars
     142;       DL:     Offset to IDEVARS to search from DPTs
     143;       DS:DI:  Ptr to DPT to examine
     144;   Returns:
     145;       CF:     Clear if wanted DPT found
     146;               Set if wrong DPT
     147;--------------------------------------------------------------------
     148IterateFindFirstDPTforIdevars:     
     149    cmp     dl, [di+DPT.bIdevarsOffset]         ; Clears CF if matched
     150    je      .done
     151    stc                                         ; Set CF for not found
     152.done: 
     153    ret
     154
     155
    118156;--------------------------------------------------------------------
    119157; Finds pointer to first unused Disk Parameter Table.
     
    198236; Iterates all Disk Parameter Tables.
    199237;
    200 ; IterateAllDPTs
     238; FindDPT_IterateAllDPTs
    201239;   Parameters:
    202240;       AX,BX,DX:   Parameters to callback function
     
    213251;--------------------------------------------------------------------
    214252ALIGN JUMP_ALIGN
    215 IterateAllDPTs:
     253FindDPT_IterateAllDPTs:
    216254    push    cx
    217255
Note: See TracChangeset for help on using the changeset viewer.