summaryrefslogtreecommitdiff
path: root/src/boot/stage2_real_functions.asm
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-16 09:13:29 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-16 09:13:29 +0200
commit3c200891bfcffbf62ac572cd6841a09a0a69e247 (patch)
tree66654cb33d5d5605978a55adf7a1d9c46231ba98 /src/boot/stage2_real_functions.asm
parent657769355b34f6b9aba19b997cba5f20f0546b96 (diff)
downloadabaos-3c200891bfcffbf62ac572cd6841a09a0a69e247.tar.gz
abaos-3c200891bfcffbf62ac572cd6841a09a0a69e247.tar.bz2
fixed loading of kernel in stage2 grossing 64k
Diffstat (limited to 'src/boot/stage2_real_functions.asm')
-rw-r--r--src/boot/stage2_real_functions.asm9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/boot/stage2_real_functions.asm b/src/boot/stage2_real_functions.asm
index 8b4b5af..3810963 100644
--- a/src/boot/stage2_real_functions.asm
+++ b/src/boot/stage2_real_functions.asm
@@ -88,9 +88,9 @@ probe_and_fix_disk_geometry:
; IN dl: drive to read from
read_from_disk:
- mov bx, 0 ; where to store the data
+ mov bx, 0x0880 ; where to store the data
mov es, bx
- mov bx, 0x8800 ; 3072 bytes after first sector
+ mov bx, 0x0 ; 3072 bytes after first sector
.read_next_sector:
@@ -108,6 +108,11 @@ read_from_disk:
jmp .read_next_sector
.next_head:
+ shr bx, 4 ; make it a segment offset..
+ mov ax, es
+ add ax, bx
+ mov es, ax ; ..and add it to ES
+ mov bx, 0x0 ; we also reset bx and update es to avoid hitting the 64k wrap around point
mov [CURRENT_SECTOR], BYTE 1 ; start from first sector again
add [CURRENT_HEAD], BYTE 1 ; advance head
mov ch, [NOF_HEADS]