I'm building my own bootloader and when I emulate it using qemu I get "Boot failed: could not read the boot disk". It works like this: The first stage loads the second stage and then the second stage bootloader loads the kernel. Everything looks fine, but I keep getting that message and nothing works like it should.
This is the code of my first stage bootloader: I'm building my own bootloader and when I simulate it using qemu I get "Boot failed: could not read the boot disk".
org 0x7C00
jmp 0x0000:start
string db 'Bootloader by JCLC - GMM4 - RGT!', 13, 10, 0
start:
;Setup stack segments
mov ax,cs
mov ds,ax
mov es,ax
mov ss,ax
mov sp, 0x7c00
xor ax, ax
mov ds, ax
xor ax, ax
mov ds, ax
mov si, string
mov cl, 0
printString:
lodsb
cmp cl, al
je done
mov ah, 0xe
mov bl, 2
int 10h
jmp printString
done:
mov ah, 0x02
mov al, 1
mov dl, 0x80
mov ch, 0
mov dh, 0
mov cl, 2
mov bx, 0x7E00
int 0x13
jmp 0x7E00
times ((0x200 - 2) - ($ - $$)) db 0x00
dw 0xAA55
This one is the code of my second stage bootloader:
org 0x7E00
mov ax,cs
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7E00
xor ax, ax
mov ds, ax
mov ah, 0x500
mov al, 1
mov dl, 0x80
mov ch, 0
mov dh, 0
mov cl, 2
mov bx, 0x500
int 0x13
jmp 0x500
times ((0x200 - 2) - ($ - $$)) db 0x00
dw 0xAA55
This is what should be the kernel. It's just something I wrote to see if everythig was working as it should.
org 0x500
; Print 'a'.
mov ax, 0x0E61
int 0x10
cli
hlt
; Pad image to multiple of 512 bytes.
times ((0x200 - 2) - ($ - $$)) db 0x00