Skip to content
Snippets Groups Projects
Commit 78e0e550 authored by Stephen D's avatar Stephen D
Browse files

Disk retry code fixed - untested

parent ea1e957b
No related branches found
No related tags found
No related merge requests found
......@@ -33,13 +33,7 @@ load_bootloader:
;mov dh, [SEC_COUNT]
;call print_hex
pusha
mov es, [CURRENT_REG_LOAD]
mov bx, 0;[CURRENT_MEM_LOAD] ; Read from disk and store into ax
mov dh, [HEAD_COUNT] ; dh <- head number (0x0 .. 0xF) //Redundant?
mov cl, al
mov al, 1 ;Num sectors
mov ch, [CYL_COUNT] ;Cylinder number
mov dl, [BOOT_DRIVE]
call disk_load
popa
mov bx, SECTOR_LOADED
......
disk_load:
pusha
; reading from disk requires setting specific values in all registers
retry:
mov es, [CURRENT_REG_LOAD]
mov bx, 0;[CURRENT_MEM_LOAD] ; Read from disk and store into ax
mov dh, [HEAD_COUNT] ; dh <- head number (0x0 .. 0xF) //Redundant?
mov cl, al
mov al, 1 ;Num sectors
mov ch, [CYL_COUNT] ;Cylinder number
mov dl, [BOOT_DRIVE]
mov ah, 0x02 ; ah <- int 0x13 function. 0x02 = 'read'
;mov cl, 0x02 ; cl <- sector (0x01 .. 0x11)
; 0x01 is our boot sector, 0x02 is the first 'available' sector
......@@ -11,7 +18,6 @@ disk_load:
; [es:bx] <- pointer to buffer where the data will be stored
; caller sets it up for us, and it is actually the standard location for int 13h
retry:
int 0x13 ; BIOS interrupt
jc disk_error ; if error (stored in the carry bit)
......@@ -22,13 +28,13 @@ retry:
disk_error:
mov bx, DISK_ERROR
call print
call print_nl
mov dh, ah ; ah = error code, dl = disk drive that dropped the error
call print_hex ; check out the code at http://stanislavs.org/helppc/int_13-1.html
jmp disk_loop
jmp retry ;Try again. Forever.
mov bx, DISK_ERROR
call print
call print_nl
mov dh, ah ; ah = error code, dl = disk drive that dropped the error
call print_hex ; check out the code at http://stanislavs.org/helppc/int_13-1.html
;jmp disk_loop
jmp retry ;Try again. Forever.
sectors_error:
mov bx, SECTORS_ERROR
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment