Ignore:
Timestamp:
Feb 24, 2012, 10:28:31 AM (12 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/VariablesAndDPTs/RamVars.asm

    r258 r262  
    115115
    116116;--------------------------------------------------------------------
    117 ; Checks if INT 13h function is handled by this BIOS.
    118 ;
    119 ; RamVars_IsFunctionHandledByThisBIOS
    120 ;   Parameters:
    121 ;       AH:     INT 13h function number
    122 ;       DL:     Drive number
    123 ;       DS:     RAMVARS segment
    124 ;   Returns:
    125 ;       CF:     Cleared if function is handled by this BIOS
    126 ;               Set if function belongs to some other BIOS
    127 ;   Corrupts registers:
    128 ;       Nothing
    129 ;--------------------------------------------------------------------
    130 ALIGN JUMP_ALIGN
    131 RamVars_IsFunctionHandledByThisBIOS:
    132     test    ah, ah          ; Reset for all floppy and hard disk drives?
    133     jz      SHORT RamVars_IsDriveHandledByThisBIOS.CFAlreadyClear_IsHandledByOurBIOS
    134     cmp     ah, 08h
    135 %ifdef MODULE_SERIAL_FLOPPY
    136 ; we handle all traffic for function 08h, as we need to wrap both hard disk and floppy drive counts
    137     je      SHORT RamVars_IsDriveHandledByThisBIOS.CFAlreadyClear_IsHandledByOurBIOS
    138 %else
    139 ; we handle all *hard disk* traffic for function 08h, as we need to wrap the hard disk drive count
    140     je      SHORT RamVars_IsDriveHandledByThisBIOS.IsDriveAHardDisk
    141 %endif
    142 ;;; fall-through           
    143        
    144 ;--------------------------------------------------------------------
    145 ; Checks if drive is handled by this BIOS.
    146 ;
    147 ; RamVars_IsDriveHandledByThisBIOS
    148 ;   Parameters:
    149 ;       DL:     Drive number
    150 ;       DS:     RAMVARS segment
    151 ;   Returns:
    152 ;       CF:     Cleared if drive is handled by this BIOS
    153 ;               Set if drive belongs to some other BIOS
    154 ;   Corrupts registers:
    155 ;       Nothing
    156 ;--------------------------------------------------------------------
    157 ALIGN JUMP_ALIGN
    158 RamVars_IsDriveHandledByThisBIOS:
    159     push    ax
    160 
    161     mov     ax, [RAMVARS.wDrvCntAndFirst]       ; Drive count to AH, First number to AL
    162     add     ah, al                              ; One past last drive to AH
    163     cmp     dl, ah                              ; Above last supported?
    164     jae     SHORT .HardDiskIsNotHandledByThisBIOS
    165 .TestLowLimit:
    166     cmp     dl, al                              ; Below first supported?
    167     jae     SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX  ; note that CF is clear if the branch is taken
    168 
    169 .HardDiskIsNotHandledByThisBIOS:
    170 %ifdef MODULE_SERIAL_FLOPPY
    171     call    RamVars_UnpackFlopCntAndFirstToAL
    172     cbw                                         ; normally 0h, could be ffh if no drives present
    173     adc     ah, al                              ; if no drives present, still ffh (ffh + ffh + 1 = ffh)
    174     js      SHORT .DiskIsNotHandledByThisBIOS
    175     cmp     ah, dl
    176     jz      SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX
    177     cmp     al, dl
    178     jz      SHORT .CFAlreadyClear_IsHandledByOurBIOS_PopAX
    179 .DiskIsNotHandledByThisBIOS:           
    180 %endif
    181 
    182     stc                                         ; Is not supported by our BIOS
    183        
    184 .CFAlreadyClear_IsHandledByOurBIOS_PopAX:               
    185     pop     ax
    186 .CFAlreadyClear_IsHandledByOurBIOS:
    187     ret
    188 
    189 %ifndef MODULE_SERIAL_FLOPPY       
    190 ;
    191 ; Note that we could have just checked for the high order bit in dl, but with the needed STC and jumps,
    192 ; leveraging the code above resulted in space savings.
    193 ;
    194 .IsDriveAHardDisk:     
    195     push    ax                                  ; match stack at the top of routine
    196     mov     al, 80h                             ; to catch all hard disks, lower limit is 80h vs. bFirstDrv
    197     jmp     .TestLowLimit                       ; and there is no need to test a high limit
    198 %endif
    199 
    200 ;--------------------------------------------------------------------
    201117; RamVars_GetHardDiskCountFromBDAtoAX
    202118;   Parameters:
Note: See TracChangeset for help on using the changeset viewer.