From 008164b387cd96c66033bc9beff41585f2deb957 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 21 Sep 2022 20:41:47 +0200 Subject: [PATCH] Load stage2 from boot drive rather than fixed hard disk --- stage1/boot.asm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stage1/boot.asm b/stage1/boot.asm index 2e995a0..6144c2a 100644 --- a/stage1/boot.asm +++ b/stage1/boot.asm @@ -13,10 +13,12 @@ mov ss, ax ; Initialize the stack ; It grows down, overwriting this code -; I have no idea what this does exactly +; I have no idea what this does exactly (note by Lizzy: bp is base pointer, sp is stack pointer) mov bp, STAGE2START mov sp, bp +push dx ; Save boot drive (will be restored when making the int 0x13 ah=0x02 call) + jmp boot ; Print al register @@ -78,8 +80,8 @@ boot: mov al, STAGE2SECTORS ; Stage 2 size in sectors xor ch, ch ; Cylinder 0 mov cl, 2 ; Second sector, they start at 1 + pop dx ; Restore boot drive xor dh, dh ; Head 0 - mov dl, 0x80 ; Hard Drive 1 mov bx, STAGE2START ; Memory address to load stage 2 into int 0x13 -- 2.44.0