Changeset 271 in xtideuniversalbios
- Timestamp:
- Feb 27, 2012, 4:24:52 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- 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 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 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r262 r271 33 33 ; AHDh_ResetDrive 34 34 ; Parameters: 35 ; DL: Drive number 36 ; DS: RAMVARS segment 35 ; DS:DI: Ptr to DPT 37 36 ; SS:BP: Ptr to IDEPACK 38 37 ; Returns: … … 40 39 ; CF: 0 if succesfull, 1 if error 41 40 ; Corrupts registers: 42 ; AL, CX,SI41 ; AL, SI 43 42 ;-------------------------------------------------------------------- 44 ;ALIGN JUMP_ALIGN45 43 AHDh_ResetDrive: 46 44 push dx 45 push cx 47 46 push bx 48 47 push di … … 58 57 59 58 mov si, IterateAndResetDrives 60 call IterateAllDPTs59 call FindDPT_IterateAllDPTs 61 60 62 61 shr ah, 1 ; Move error code and CF into proper position … … 64 63 pop di 65 64 pop bx 65 pop cx 66 66 pop dx 67 67 ret … … 76 76 IterateAndResetDrives: 77 77 cmp al, [di+DPT.bIdevarsOffset] ; The right controller? 78 jn z.done78 jne .done 79 79 push ax 80 80 call AH9h_InitializeDriveForUse ; Reset Master and Slave (Master will come first in DPT list) … … 83 83 or ah, (RET_HD_RESETFAIL << 1) | 1 ; OR in Reset Failed error code and CF, will SHR into position later 84 84 .done: 85 stc ; From IterateAllDPTs perspective, the DPT is never found 85 stc ; From IterateAllDPTs perspective, the DPT is never found (continue iteration) 86 86 ret 87 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r262 r271 96 96 .ResetDetectedDrives: 97 97 call Idepack_FakeToSSBP 98 call AH0h_Reset HardDisksHandledByOurBIOS98 call AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization 99 99 add sp, BYTE EXTRA_BYTES_FOR_INTPACK 100 100 ret -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r265 r271 116 116 ret 117 117 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 ;-------------------------------------------------------------------- 131 FindDPT_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 ;-------------------------------------------------------------------- 148 IterateFindFirstDPTforIdevars: 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 118 156 ;-------------------------------------------------------------------- 119 157 ; Finds pointer to first unused Disk Parameter Table. … … 198 236 ; Iterates all Disk Parameter Tables. 199 237 ; 200 ; IterateAllDPTs238 ; FindDPT_IterateAllDPTs 201 239 ; Parameters: 202 240 ; AX,BX,DX: Parameters to callback function … … 213 251 ;-------------------------------------------------------------------- 214 252 ALIGN JUMP_ALIGN 215 IterateAllDPTs:253 FindDPT_IterateAllDPTs: 216 254 push cx 217 255
Note:
See TracChangeset
for help on using the changeset viewer.