Changeset 271 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
- Timestamp:
- Feb 27, 2012, 4:24:52 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r269 r271 8 8 ; Int 13h function AH=0h, Disk Controller Reset. 9 9 ; 10 ; Note: We handle all AH=0h calls, even for drives handled by other 11 ; BIOSes! 12 ; 10 13 ; AH0h_HandlerForDiskControllerReset 11 14 ; Parameters: 12 15 ; DL: Translated Drive number (ignored so all drives are reset) 13 16 ; 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) 15 18 ; SS:BP: Ptr to IDEPACK 16 19 ; Returns with INTPACK: … … 49 52 50 53 ; 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 53 57 54 58 .SkipHardDiskReset: … … 66 70 ; AX, DL, DI 67 71 ;-------------------------------------------------------------------- 68 ALIGN JUMP_ALIGN69 72 ResetFloppyDrivesWithInt40h: 70 call GetDriveNumberForForeign BiosesToDL73 call GetDriveNumberForForeignHardDiskHandlerToDL 71 74 and dl, 7Fh ; Clear hard disk bit 72 75 xor ah, ah ; Disk Controller Reset … … 85 88 ; AX, DL, DI 86 89 ;-------------------------------------------------------------------- 87 ALIGN JUMP_ALIGN88 90 ResetForeignHardDisks: 89 call GetDriveNumberForForeign BiosesToDL91 call GetDriveNumberForForeignHardDiskHandlerToDL 90 92 xor ah, ah ; Disk Controller Reset 91 93 call Int13h_CallPreviousInt13hHandler … … 104 106 ; Nothing 105 107 ;-------------------------------------------------------------------- 106 ALIGN JUMP_ALIGN107 108 BackupErrorCodeFromTheRequestedDriveToBH: 108 109 cmp dl, bl ; Requested drive? 109 110 eCMOVE bh, ah 110 111 ret 111 112 112 113 113 114 ;-------------------------------------------------------------------- 114 ; GetDriveNumberForForeign BiosesToDL115 ; GetDriveNumberForForeignHardDiskHandlerToDL 115 116 ; Parameters: 116 117 ; BL: Requested drive (DL when entering AH=00h) 117 118 ; DS: RAMVARS segment 118 119 ; Returns: 120 ; DS:DI: Ptr to DPT if our drive 119 121 ; DL: BL if foreign drive 120 122 ; 80h if our drive 123 ; CF: Set if foreign drive 124 ; Cleared if our drive 121 125 ; Corrupts registers: 122 ; DI126 ; (DI) 123 127 ;-------------------------------------------------------------------- 124 ALIGN JUMP_ALIGN 125 GetDriveNumberForForeignBiosesToDL: 128 GetDriveNumberForForeignHardDiskHandlerToDL: 126 129 mov dl, bl 127 test di, di128 j z SHORT .Return ; Return what was in BL unmodified129 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: 131 134 ret 132 135 133 136 134 137 ;-------------------------------------------------------------------- 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 ;-------------------------------------------------------------------- 147 AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization: 148 mov bl, [RAMVARS.bFirstDrv] 149 call GetDriveNumberForForeignHardDiskHandlerToDL 150 ; Fall to ResetHardDisksHandledByOurBIOS 151 152 ;-------------------------------------------------------------------- 153 ; ResetHardDisksHandledByOurBIOS 136 154 ; Parameters: 137 155 ; BL: Requested drive (DL when entering AH=00h) 138 ; DS: RAMVARS segment156 ; DS:DI: Ptr to DPT for requested drive 139 157 ; SS:BP: Ptr to IDEPACK 140 158 ; Returns: … … 143 161 ; AX, CX, DX, SI, DI 144 162 ;-------------------------------------------------------------------- 145 ALIGN JUMP_ALIGN 146 AH0h_ResetHardDisksHandledByOurBIOS: 163 ResetHardDisksHandledByOurBIOS: 147 164 mov bl, [di+DPT.bIdevarsOffset] ; replace drive number with Idevars pointer for cmp with dl 148 165 mov dl, ROMVARS.ideVars0 ; starting Idevars offset 149 166 150 call RamVars_GetIdeControllerCountToCX 167 call RamVars_GetIdeControllerCountToCX ; get count of ide controllers 151 168 jcxz .done ; just in case bIdeCnt is zero (shouldn't be) 152 153 mov si, IterateFindFirstDPTforIdevars ; iteration routine (see below)154 155 169 .loop: 156 call IterateAllDPTs; look for the first drive on this controller, if any170 call FindDPT_ForIdevarsOffsetInDL ; look for the first drive on this controller, if any 157 171 jc .notFound 158 172 … … 166 180 .done: 167 181 ret 168 169 ;--------------------------------------------------------------------170 ; Iteration routine for AH0h_ResetHardDisksHandledByOurBIOS,171 ; for use with IterateAllDPTs172 ;173 ; Returns when DPT is found on the controller with Idevars offset in DL174 ;--------------------------------------------------------------------175 IterateFindFirstDPTforIdevars:176 cmp dl, [di+DPT.bIdevarsOffset] ; Clears CF if matched177 jz .done178 stc ; Set CF for not found179 .done:180 ret
Note:
See TracChangeset
for help on using the changeset viewer.