summaryrefslogtreecommitdiff
path: root/boot0/disk_load_16.asm
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-05 02:36:33 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-05 02:36:33 +0200
commitb75c10c9d8c7405ba2f89724b485154d5201c404 (patch)
tree6ce30784f4d7bbb5ca2a5cb636da7fa2186bee57 /boot0/disk_load_16.asm
parent467e19b262d435f1820539bc0c85ed4fa31b9687 (diff)
working on bootloaders (lba)
Diffstat (limited to 'boot0/disk_load_16.asm')
-rw-r--r--boot0/disk_load_16.asm44
1 files changed, 36 insertions, 8 deletions
diff --git a/boot0/disk_load_16.asm b/boot0/disk_load_16.asm
index 55ad4aa..6762469 100644
--- a/boot0/disk_load_16.asm
+++ b/boot0/disk_load_16.asm
@@ -9,15 +9,15 @@
[bits 16]
STR_LBA:
- db "\nLBA Support Detected (no support yet)",0
+ db "LBA Support Detected",0
-STR_CHS
+STR_CHS:
db "CHS Support Detected",0
-STR_ERROR
+STR_ERROR:
db "Disk Read Error",0
-STR_DONE
+STR_DONE:
db "Stage 2 Loaded",0
disk_load_16:
@@ -31,14 +31,23 @@ disk_load_16:
jnc disk_load_lba
jmp disk_load_chs
-
disk_load_lba:
mov bx, STR_LBA
call print_string
call print_nextline
- jmp $
- jmp disk_load_finish
+
+ mov dl,[BOOT_DRIVE]
+ xor ah,ah
+ mov ah,0x42
+
+ mov bx,0
+ mov ds,bx
+ lea si,[lba_adr]
+
+ int 0x13
+ jnc disk_load_finish
+ jmp disk_load_error
disk_load_chs:
@@ -63,6 +72,12 @@ disk_load_chs:
jnc disk_load_finish
+disk_load_error:
+
+ call print_nextline
+ mov bx, STR_ERROR
+ call print_string
+ call print_nextline
jmp $
disk_load_finish:
@@ -75,4 +90,17 @@ disk_load_finish:
popa
ret
-
+
+
+;; here we hold the lba addr
+lba_adr:
+
+ dw 0x10 ; size of packet ( 16 byte)
+ dw 16 ; number of sectors to read
+
+ ; target is 0x7e00
+ dw 0x7e00 ; target addr. offset
+ dw 0x0000 ; target addr. sector
+
+ dd 1 ; first sector to read
+ dd 0