summaryrefslogtreecommitdiff
path: root/boot/disk_load_16.asm
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-06 20:43:57 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-06 20:43:57 +0100
commit1271f4f3e3891b1de2f810c2063490c4a71a2518 (patch)
treee4d872454a8e2e1330fd16e8af360da3abe9bcd6 /boot/disk_load_16.asm
parent2a30fa85fd50919aa45fac4b961cc9508732b62a (diff)
vdi target for virtualbox.
Diffstat (limited to 'boot/disk_load_16.asm')
-rw-r--r--boot/disk_load_16.asm41
1 files changed, 35 insertions, 6 deletions
diff --git a/boot/disk_load_16.asm b/boot/disk_load_16.asm
index ae34360..52912f4 100644
--- a/boot/disk_load_16.asm
+++ b/boot/disk_load_16.asm
@@ -108,13 +108,42 @@ disk_load_chs:
pusha
+ ; get boot drive geometry
+ mov ah,8
+ mov dl,[BOOT_DRIVE]
+ int 0x13
+
+ add dh,1
+ and cl,0x3f
+
+ mov [bpbSectorsPerTrack],cl
+ mov [bpbHeadsPerCylinder],dh
+ ;
+
+ ;show geometry
+ mov al,dh
+ call print_hex_byte
+
+ mov bx, STR_SPACE
+ call print_string
+
+ mov al,cl
+ call print_hex_byte
+
+ call print_nextline
+ popa
+ ;
+
+ pusha
+
+
mov bx,0x1800 ;target es:bx
mov es,bx
mov bx,0
next_sectors_chs:
- jmp skip_debug
+ ;jmp skip_debug
pusha
mov bx, STR_SPACE
@@ -132,7 +161,7 @@ disk_load_chs:
mov bx, STR_SPACE
call print_string
- ;load and show next LBA numer
+ ;show next LBA numer
mov ax,[LBA]
mov al,ah
call print_hex_byte
@@ -171,7 +200,7 @@ disk_load_chs:
call lba_to_chs
; and now READ it!
- mov al,16 ;number of sectors to read
+ mov al,1 ;number of sectors to read
mov dl,[BOOT_DRIVE]
mov ah,0x02 ;BIOS read sector func
@@ -180,15 +209,15 @@ disk_load_chs:
jc disk_read_error
mov bx,es
- add bx,0x0200
- cmp bx,0x9e00
+ add bx,0x0020
+ cmp bx,0x9000
je disk_load_finish
mov es,bx
mov bx,0
mov ax,[LBA]
- add ax,16
+ add ax,1
mov [LBA],ax
jmp next_sectors_chs