summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/LINKS.TODO1
-rw-r--r--src/stage2_real_functions.asm15
2 files changed, 15 insertions, 1 deletions
diff --git a/doc/LINKS.TODO b/doc/LINKS.TODO
index c51106b..4a2f7b3 100644
--- a/doc/LINKS.TODO
+++ b/doc/LINKS.TODO
@@ -71,6 +71,7 @@ http://www.osdever.net/tutorials/view/loading-sectors
http://www.osdever.net/tutorials/view/lba-to-chs
LILO boot loader
http://www.uruk.org/orig-grub/PC_partitioning.txt
+http://wiki.osdev.org/ATA_in_x86_RealMode_%28BIOS%29
C:
http://www.drdobbs.com/extending-c-for-object-oriented-programm/184402731
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