Changeset 28 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
- Timestamp:
- Aug 1, 2010, 5:57:24 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
r3 r28 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 3.8.2007 4 ; Last update : 2.5.20104 ; Last update : 1.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Int 19h BIOS functions (Boot Strap Loader). … … 10 10 11 11 B_READ_RETRY_TIMES EQU 3 ; Number of times to retry 12 B_READ_RETRY_DELAY EQU 3 ; Timer ticks between retries13 12 14 13 … … 110 109 ALIGN JUMP_ALIGN 111 110 .ReadRetryLoop: 112 call Int19h_LoadFirstSectorFromDLToESBX 111 call .ResetBootDriveFromDL 112 call .LoadFirstSectorFromDLtoESBX 113 113 jnc SHORT .Return 114 call Int19h_ResetDriveOrWait115 114 dec di ; Decrement retry counter 116 115 jnz SHORT .ReadRetryLoop ; Loop while retries left … … 121 120 122 121 ;-------------------------------------------------------------------- 122 ; .ResetBootDriveFromDL 123 ; Parameters: 124 ; DL: Drive to boot from (translated, 00h or 80h) 125 ; Returns: 126 ; AH: INT 13h error code 127 ; CF: Cleared if read successfull 128 ; Set if any error 129 ; Corrupts registers: 130 ; AL 131 ;-------------------------------------------------------------------- 132 ALIGN JUMP_ALIGN 133 .ResetBootDriveFromDL: 134 xor ax, ax ; AH=0h, Disk Controller Reset 135 test dl, 80h ; Floppy drive? 136 jz SHORT .ResetDriveFromDL ; If so, jump to reset 137 mov ah, 0Dh ; AH=Dh, Reset Hard Disk (Alternate reset) 138 .ResetDriveFromDL: 139 int INTV_DISK_FUNC 140 ret 141 142 ;-------------------------------------------------------------------- 123 143 ; Reads first sector (boot sector) from drive DL to ES:BX. 124 144 ; 125 ; Int19h_LoadFirstSectorFromDLToESBX145 ; .LoadFirstSectorFromDLtoESBX 126 146 ; Parameters: 127 147 ; DL: Drive to boot from (translated, 00h or 80h) … … 136 156 ;-------------------------------------------------------------------- 137 157 ALIGN JUMP_ALIGN 138 Int19h_LoadFirstSectorFromDLToESBX:158 .LoadFirstSectorFromDLtoESBX: 139 159 mov ax, 0201h ; Read 1 sector 140 160 mov cx, 1 ; Cylinder 0, Sector 1 141 161 xor dh, dh ; Head 0 142 162 int INTV_DISK_FUNC 143 ret144 145 146 ;--------------------------------------------------------------------147 ; Reset drive controller or waits a while before retrying148 ; to load boot sector.149 ;150 ; Int19h_ResetDriveOrWait151 ; Parameters:152 ; DL: Drive to boot from (translated, 00h or 80h)153 ; DI: Retry counter154 ; Returns:155 ; Nothing156 ; Corrupts registers:157 ; CX158 ;--------------------------------------------------------------------159 ALIGN JUMP_ALIGN160 Int19h_ResetDriveOrWait:161 test di, 1<<0 ; Reset on every other retry162 jnz SHORT .ResetDrive163 mov cx, B_READ_RETRY_DELAY ; Wait for a while164 jmp SoftDelay_TimerTicks165 ALIGN JUMP_ALIGN166 .ResetDrive:167 xor cx, cx168 xchg cx, ax ; AH=0h, Disk Controller Reset169 int INTV_DISK_FUNC170 xchg ax, cx ; Restore AX171 163 ret 172 164
Note:
See TracChangeset
for help on using the changeset viewer.