Changeset 27 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Jul 28, 2010, 6:53:32 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r3 r27 88 88 Int13h_UnsupportedFunction: 89 89 Int13h_DirectCallToAnotherBios: 90 ; Temporarily store original DI and DS to RAMVARS90 ; Temporarily store original DI and DS from stack to RAMVARS 91 91 pop WORD [RAMVARS.wI13hDI] 92 92 pop WORD [RAMVARS.wI13hDS] -
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 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r26 r27 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 9.12.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=Dh, Reset Hard Disk (Alternate reset). … … 40 40 ; CF: 0 if succesfull, 1 if error 41 41 ; Corrupts registers: 42 ; Nothing42 ; DI 43 43 ;-------------------------------------------------------------------- 44 44 ALIGN JUMP_ALIGN 45 45 AHDh_ResetDrive: 46 push di47 46 push dx 48 47 push cx … … 64 63 pop cx 65 64 pop dx 66 pop di67 65 ret 68 66 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm
r3 r27 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 30.11.2007 4 ; Last update : 8.4.20104 ; Last update : 28.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Error checking functions for BIOS Hard disk functions. … … 8 8 ; Section containing code 9 9 SECTION .text 10 11 ;-------------------------------------------------------------------- 12 ; HError_GetErrorCodeToAHforBitPollingTimeout 13 ; Parameters: 14 ; AL: IDE Status Register contents 15 ; DX: IDE Status Register Address 16 ; Returns: 17 ; AH: Hard disk BIOS error code 18 ; CF: Set since error 19 ; Corrupts registers: 20 ; AL, CX 21 ;-------------------------------------------------------------------- 22 ALIGN JUMP_ALIGN 23 HError_GetErrorCodeToAHforBitPollingTimeout: 24 test al, FLG_IDE_ST_BSY ; Other bits undefined when BSY set 25 jnz SHORT HError_GetErrorCodeForStatusReg ; Busy, normal timeout 26 test al, FLG_IDE_ST_DF | FLG_IDE_ST_CORR | FLG_IDE_ST_ERR 27 jnz SHORT HError_GetErrorCodeForStatusReg ; Not busy but some error 28 or al, FLG_IDE_ST_BSY ; Polled bit got never set, force timeout 29 ; Fall to HError_GetErrorCodeForStatusReg 10 30 11 31 ;-------------------------------------------------------------------- … … 37 57 mov [HDBDA.wHDStAndErr], ax ; Store Status and Error to BDA 38 58 pop ds 39 40 ; Translate registers to BIOS error code41 59 ; Fall to HError_ConvertIdeErrorToBiosRet 42 60 … … 58 76 ALIGN JUMP_ALIGN 59 77 HError_ConvertIdeErrorToBiosRet: 60 ; Any error? 78 test al, FLG_IDE_ST_BSY 79 jnz SHORT .TimeoutError 61 80 test al, FLG_IDE_ST_DF | FLG_IDE_ST_CORR | FLG_IDE_ST_ERR 62 81 jnz SHORT .ReadErrorFromStatusReg 63 82 xor ah, ah ; No errors, zero AH and CF 83 ret 84 85 .TimeoutError: 86 mov ah, RET_HD_TIMEOUT 87 stc 64 88 ret 65 89 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
r26 r27 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 15.12.2009 4 ; Last update : 2 6.6.20104 ; Last update : 28.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : IDE Status Register polling functions. … … 189 189 ; IDE Status register polling. 190 190 ; This function first waits until controller is not busy. 191 ; When not busy, IDE Status Register is polled until wanted 192 ; flag (HBIT_ST_DRDY or HBIT_ST_DRQ) is set. 191 ; When not busy, IDE Status Register is polled until wanted flag is set. 193 192 ; 194 193 ; HStatus_PollBusyAndFlg … … 207 206 ALIGN JUMP_ALIGN 208 207 HStatus_PollBsyAndFlg: 209 call SoftDelay_InitTimeout ; Initialize timeout counter208 call SoftDelay_InitTimeout ; Initialize timeout counter 210 209 ALIGN JUMP_ALIGN 211 210 .PollLoop: 212 in al, dx ; Load IDE Status Register213 test al, FLG_IDE_ST_BSY ; Controller busy?214 jnz SHORT .UpdateTimeout ; If so, jump to timeout update215 test al, ah ; Test secondary flag216 jnz SHORT HStatus_PollCompleted; If set, break loop211 in al, dx ; Load IDE Status Register 212 test al, FLG_IDE_ST_BSY ; Controller busy? 213 jnz SHORT .UpdateTimeout ; If so, jump to timeout update 214 test al, ah ; Test secondary flag 215 jnz SHORT GetErrorCodeFromPollingToAH ; If set, break loop 217 216 ALIGN JUMP_ALIGN 218 217 .UpdateTimeout: 219 call SoftDelay_UpdTimeout ; Update timeout counter 220 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 221 mov ah, RET_HD_TIMEOUT ; Load error code for timeout 222 ret 223 218 call SoftDelay_UpdTimeout ; Update timeout counter 219 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 220 jmp HError_GetErrorCodeToAHforBitPollingTimeout 224 221 225 222 ;-------------------------------------------------------------------- … … 241 238 ALIGN JUMP_ALIGN 242 239 HStatus_PollBsy: 243 call SoftDelay_InitTimeout ; Initialize timeout counter240 call SoftDelay_InitTimeout ; Initialize timeout counter 244 241 ALIGN JUMP_ALIGN 245 242 .PollLoop: 246 in al, dx ; Load IDE Status Reg 247 test al, FLG_IDE_ST_BSY ; Controller busy? (clears CF) 248 jz SHORT HStatus_PollCompleted ; If not, jump to check errors 249 call SoftDelay_UpdTimeout ; Update timeout counter 250 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 251 mov ah, RET_HD_TIMEOUT ; Load error code for timeout 252 ret 253 254 ALIGN JUMP_ALIGN 255 HStatus_PollCompleted: 256 test al, FLG_IDE_ST_DF | FLG_IDE_ST_ERR 257 jnz SHORT .GetErrorCode ; If errors, jump to get error code 258 xor ah, ah ; Zero AH and clear CF 259 ret 260 .GetErrorCode: 243 in al, dx ; Load IDE Status Reg 244 test al, FLG_IDE_ST_BSY ; Controller busy? 245 jz SHORT GetErrorCodeFromPollingToAH ; If not, jump to check errors 246 call SoftDelay_UpdTimeout ; Update timeout counter 247 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 248 ALIGN JUMP_ALIGN 249 GetErrorCodeFromPollingToAH: 261 250 jmp HError_GetErrorCodeForStatusReg -
trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
r3 r27 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 25.3.2010 4 ; Last update : 2 .5.20104 ; Last update : 28.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Various floppy drive related functions that … … 25 25 FloppyDrive_IsInt40hInstalled: 26 26 cmp WORD [es:INTV_FLOPPY_FUNC*4+2], 0C000h ; Any ROM segment? 27 jae SHORT .Int40hIsAlreadyInstalled 28 clc 29 ret 30 ALIGN JUMP_ALIGN 31 .Int40hIsAlreadyInstalled: 32 stc 27 cmc 33 28 ret 34 29 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r23 r27 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 23.3.2010 4 ; Last update : 1.7.20104 ; Last update : 28.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for initializing the BIOS. … … 418 418 ALIGN JUMP_ALIGN 419 419 Initialize_ResetDetectedDrives: 420 xor ah, ah ; Disk Controller Reset 421 mov dl, 80h ; Reset all floppy drives and hard disks 422 int INTV_DISK_FUNC 423 ret 420 xor bx, bx 421 call ResetFloppyDrivesWithInt40h 422 mov bl, 80h 423 call ResetForeignHardDisks 424 jmp AH0h_ResetHardDisksHandledByOurBIOS -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r26 r27 38 38 at ROMVARS.bRomSize, db CNT_ROM_BLOCKS ; ROM size in 512B blocks 39 39 at ROMVARS.rgbJump, jmp Initialize_FromMainBiosRomSearch 40 at ROMVARS.rgbDate, db "07/2 6/10" ; Build data (mm/dd/yy)40 at ROMVARS.rgbDate, db "07/28/10" ; Build data (mm/dd/yy) 41 41 at ROMVARS.rgbSign, db "XTIDE110" ; Signature for flash program 42 42 at ROMVARS.szTitle … … 49 49 db " (XT)=-",STOP 50 50 %endif 51 at ROMVARS.szVersion, db "v1.1.2 (07/2 6/10)",STOP51 at ROMVARS.szVersion, db "v1.1.2 (07/28/10)",STOP 52 52 53 53 ;---------------------------;
Note:
See TracChangeset
for help on using the changeset viewer.