Changeset 27 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
- Timestamp:
- Jul 28, 2010, 6:53:32 PM (15 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r26 r27 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 27.9.2007 4 ; Last update : 2 6.7.20104 ; Last update : 28.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Int 13h function AH=0h, Disk Controller Reset. … … 41 41 jz SHORT .SkipHardDiskReset 42 42 call ResetForeignHardDisks 43 call ResetHardDisksHandledByOurBIOS43 call AH0h_ResetHardDisksHandledByOurBIOS 44 44 ALIGN JUMP_ALIGN 45 45 .SkipHardDiskReset: 46 46 mov ah, bh ; Copy error code to AH 47 47 xor al, al ; Zero AL... 48 sub al, ah ; ...and set CF if error48 cmp al, bh ; ...and set CF if error 49 49 jmp Int13h_PopXRegsAndReturn 50 50 … … 54 54 ; Parameters: 55 55 ; BL: Requested drive (DL when entering AH=00h) 56 ; DL: Drive number57 56 ; Returns: 58 57 ; BH: Error code from requested drive (if available) 59 58 ; Corrupts registers: 60 ; AX, DL 59 ; AX, DL, DI 61 60 ;-------------------------------------------------------------------- 62 61 ALIGN JUMP_ALIGN 63 62 ResetFloppyDrivesWithInt40h: 63 call GetDriveNumberForForeignBiosesToDL 64 and dl, 7Fh ; Clear hard disk bit 64 65 xor ah, ah ; Disk Controller Reset 65 and dl, 7Fh ; Clear bit 766 66 int INTV_FLOPPY_FUNC 67 67 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH … … 76 76 ; BH: Error code from requested drive (if available) 77 77 ; Corrupts registers: 78 ; AX, DL 78 ; AX, DL, DI 79 79 ;-------------------------------------------------------------------- 80 80 ALIGN JUMP_ALIGN 81 81 ResetForeignHardDisks: 82 mov dl, bl ; Drive to reset 83 mov ah, 0Dh ; Reset Hard Disk (Alternate reset) 84 82 call GetDriveNumberForForeignBiosesToDL 83 xor ah, ah ; Disk Controller Reset 85 84 pushf ; Push flags to simulate INT 86 85 cli ; Disable interrupts since INT does that 87 86 call FAR [RAMVARS.fpOldI13h] 88 87 sti ; Make sure interrupts are enabled again (some BIOSes fails to enable it) 88 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH 89 89 90 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH 90 91 ;-------------------------------------------------------------------- 92 ; GetDriveNumberForForeignBiosesToDL 93 ; Parameters: 94 ; BL: Requested drive (DL when entering AH=00h) 95 ; DS: RAMVARS segment 96 ; Returns: 97 ; DL: BL if foreign drive 98 ; 80h if our drive 99 ; Corrupts registers: 100 ; DI 101 ;-------------------------------------------------------------------- 102 ALIGN JUMP_ALIGN 103 GetDriveNumberForForeignBiosesToDL: 104 mov dl, bl 105 call RamVars_IsDriveHandledByThisBIOS 106 jc SHORT .GetFirstDriveForForeignBios 107 ret ; Return what was in BL unmodified 108 ALIGN JUMP_ALIGN 109 .GetFirstDriveForForeignBios: 110 mov dl, 80h 111 ret 91 112 92 113 … … 99 120 ; BH: Error code from requested drive (if available) 100 121 ; Corrupts registers: 101 ; AX, CX, DX 122 ; AX, CX, DX, DI 102 123 ;-------------------------------------------------------------------- 103 124 ALIGN JUMP_ALIGN 104 ResetHardDisksHandledByOurBIOS:125 AH0h_ResetHardDisksHandledByOurBIOS: 105 126 mov dh, [RAMVARS.bDrvCnt] ; Load drive count to DH 106 127 test dh, dh … … 111 132 .DriveResetLoop: 112 133 call AHDh_ResetDrive 113 call BackupErrorCodeFromTheRequestedDriveToBH 114 call .SkipNextDriveIfItIsSlaveForThisController 134 call .BackupErrorCodeFromMasterOrSlaveToBH 115 135 inc dx 116 136 cmp dl, dh ; All done? … … 120 140 121 141 ;-------------------------------------------------------------------- 122 ; . SkipNextDriveIfItIsSlaveForThisController142 ; .BackupErrorCodeFromMasterOrSlaveToBH 123 143 ; Parameters: 144 ; AH: Error code for drive DL reset 145 ; BL: Requested drive (DL when entering AH=00h) 124 146 ; DL: Drive just resetted 125 147 ; DS: RAMVARS segment 126 148 ; Returns: 149 ; BH: Backuped error code 127 150 ; DL: Incremented if next drive is slave drive 128 151 ; (=already resetted) 129 152 ; Corrupts registers: 130 ; AX, CX153 ; CX, DI 131 154 ;-------------------------------------------------------------------- 132 155 ALIGN JUMP_ALIGN 133 .SkipNextDriveIfItIsSlaveForThisController: 134 push di 156 .BackupErrorCodeFromMasterOrSlaveToBH: 157 call BackupErrorCodeFromTheRequestedDriveToBH 158 mov cx, [RAMVARS.wIdeBase] ; Load base port for resetted drive 135 159 136 call .GetBasePortToAXfromDriveInDL 137 xchg cx, ax 138 139 inc dx 140 call .GetBasePortToAXfromDriveInDL 141 jnc SHORT .SkipNextDrive 142 143 cmp ax, cx 144 je SHORT .SkipNextDrive ; Same controller so slave already reset 145 146 dec dx ; Restore DX 147 .SkipNextDrive: 148 pop di 149 ret 150 151 ;-------------------------------------------------------------------- 152 ; .GetBasePortToAXfromDriveInDL 153 ; Parameters: 154 ; DL: Drive whose base port to find 155 ; DS: RAMVARS segment 156 ; Returns: 157 ; AX: Base port (if drive found) 158 ; CF: Set if drive found 159 ; Cleared if drive not found 160 ; Corrupts registers: 161 ; DI 162 ;-------------------------------------------------------------------- 163 ALIGN JUMP_ALIGN 164 .GetBasePortToAXfromDriveInDL: 165 call FindDPT_ForDriveNumber ; Get DPT to DS:DI 166 jnc SHORT .DriveNotFound 167 eMOVZX di, BYTE [di+DPT.bIdeOff] ; CS:DI now points to IDEVARS 168 mov ax, [cs:di+IDEVARS.wPort] 169 .DriveNotFound: 160 inc dx ; DL to next drive 161 call FindDPT_ForDriveNumber ; Get DPT to DS:DI, store port to RAMVARS 162 jnc SHORT .NoMoreDrivesOrNoSlaveDrive 163 cmp cx, [RAMVARS.wIdeBase] ; Next drive is from same controller? 164 je SHORT BackupErrorCodeFromTheRequestedDriveToBH 165 .NoMoreDrivesOrNoSlaveDrive: 166 dec dx 170 167 ret 171 168
Note:
See TracChangeset
for help on using the changeset viewer.