Ignore:
Timestamp:
Feb 24, 2012, 10:28:31 AM (13 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

More optimizations. Merged RamVars_IsFunction/DriveHandledByThisBIOS in with FindDPT_ForDriveNumber, since they are often used together, making a returned NULL DI pointer indicate a foreign drive in many places. Revamped the iteration done in the handlers for int13/0dh and int13h/0h. Added serial specific print string during drive detection.

File:
1 edited

Legend:

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

    r259 r262  
    121121GetDriveNumberForForeignBiosesToDL:
    122122    mov     dl, bl
    123     call    RamVars_IsDriveHandledByThisBIOS
    124     jc      SHORT .Return               ; Return what was in BL unmodified
     123    test    di, di
     124    jz      SHORT .Return               ; Return what was in BL unmodified
    125125    mov     dl, 80h
    126126.Return:
     
    141141ALIGN JUMP_ALIGN
    142142AH0h_ResetHardDisksHandledByOurBIOS:
    143     mov     dx, [RAMVARS.wDrvCntAndFirst]   ; DL = drive number, DH = drive count
    144     test    dh, dh
    145     jz      SHORT .AllDrivesReset       ; Return if no drives
    146     add     dh, dl                      ; DH = one past last drive to reset
    147 ALIGN JUMP_ALIGN
    148 .DriveResetLoop:
    149     call    AHDh_ResetDrive
    150     call    .BackupErrorCodeFromMasterOrSlaveToBH
    151     inc     dx
    152     cmp     dl, dh                      ; All done?
    153     jb      SHORT .DriveResetLoop       ;  If not, reset next drive
    154 .AllDrivesReset:
     143    mov     bl, [di+DPT.bIdevarsOffset]                 ; replace drive number with Idevars pointer for comparisons
     144    mov     cl, [cs:ROMVARS.bIdeCnt]                    ; get count of ide controllers
     145    mov     ch, 0                                       
     146    mov     dl, 0                                       ; starting Idevars offset
     147    mov     si, IterateFindFirstDPTforIdevars           ; iteration routine
     148.loop:
     149    call    IterateAllDPTs                              ; look for the first drive on this controller, if any
     150    jc      .notFound
     151    call    AHDh_ResetDrive                             ; reset master and slave on that controller
     152    call    BackupErrorCodeFromTheRequestedDriveToBH    ; save error code if same controller as initial request
     153.notFound:
     154    add     dl, IDEVARS_size                            ; move pointer forward
     155    loop    .loop                                       ; and repeat
    155156    ret
    156157
    157                
    158158;--------------------------------------------------------------------
    159 ; .BackupErrorCodeFromMasterOrSlaveToBH
    160 ;   Parameters:
    161 ;       AH:     Error code for drive DL reset
    162 ;       BL:     Requested drive (DL when entering AH=00h)
    163 ;       DL:     Drive just resetted
    164 ;       DS:     RAMVARS segment
    165 ;   Returns:
    166 ;       BH:     Backuped error code
    167 ;       DL:     Incremented if next drive is slave drive
    168 ;               (=already resetted)
    169 ;   Corrupts registers:
    170 ;       CX, DI
     159; Iteration routine for AH0h_ResetHardDisksHandledByOurBIOS,
     160; for use with IterateAllDPTs
     161;
     162; Returns when DPT is found on the controller with Idevars offset in DL
    171163;--------------------------------------------------------------------
    172 ALIGN JUMP_ALIGN
    173 .BackupErrorCodeFromMasterOrSlaveToBH:
    174     call    BackupErrorCodeFromTheRequestedDriveToBH
    175     call    GetBasePortToCX             ; Load base port for resetted drive
    176     push    cx
    177     inc     dx                          ; DL to next drive
    178     call    GetBasePortToCX
    179     pop     di
    180     cmp     cx, di                      ; Next drive is from same controller?
    181     je      SHORT BackupErrorCodeFromTheRequestedDriveToBH
    182 .NoMoreDrivesOrNoSlaveDrive:
    183     dec     dx
     164IterateFindFirstDPTforIdevars:     
     165    cmp     dl, [di+DPT.bIdevarsOffset]         ; Clears CF if matched
     166    jz      .done
     167    stc                                         ; Set CF for not found
     168.done: 
    184169    ret
    185 
    186        
    187 ;--------------------------------------------------------------------
    188 ; GetBasePortToCX
    189 ;   Parameters:
    190 ;       DL:     Drive number
    191 ;       DS:     RAMVARS segment
    192 ;   Returns:
    193 ;       CX:     Base port address
    194 ;       CF:     Set if valid drive number
    195 ;               Cleared if invalid drive number
    196 ;   Corrupts registers:
    197 ;       DI
    198 ;--------------------------------------------------------------------
    199 ALIGN JUMP_ALIGN
    200 GetBasePortToCX:
    201     xchg    cx, bx
    202     xor     bx, bx
    203     call    FindDPT_ForDriveNumber
    204     mov     bl, [di+DPT.bIdevarsOffset]
    205     mov     bx, [cs:bx+IDEVARS.wPort]
    206     xchg    bx, cx
    207     ret
    208 
    209 
Note: See TracChangeset for help on using the changeset viewer.