Changeset 27 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Timestamp:
- Jul 28, 2010, 6:53:32 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.