summaryrefslogtreecommitdiff
path: root/src/stage2_real_functions.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage2_real_functions.asm')
-rw-r--r--src/stage2_real_functions.asm15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/stage2_real_functions.asm b/src/stage2_real_functions.asm
index 2db8947..273d790 100644
--- a/src/stage2_real_functions.asm
+++ b/src/stage2_real_functions.asm
@@ -6,7 +6,8 @@ NOF_LOAD_SECTORS equ 36
; data sections used for reading the kernel from disk
SECTORS_PER_CYLINDER:
- db 0x13 ; detect parameters enters the correct value here (sectors + 1)
+ db 0x3F ; detect parameters enters the correct value here (sectors + 1)
+ ; if detection fails, force int13 to read ahead
NOF_HEADS:
db 0x02 ; number of heads + 1
SECTORS_TO_LOAD:
@@ -25,6 +26,18 @@ detect_disk_geometry:
mov es, dx
mov ah, 0x08
int 0x13
+ jc .error
+ jmp .ok
+
+.error:
+ mov si, DISK_ERROR
+ call print_string
+ mov dh, 0
+ mov dl, ah
+ call print_hex
+ ret
+
+.ok:
add dh, 1
mov [NOF_HEADS], BYTE dh
call print_hex