Loading the second stage bootloader
Posted: Sun Nov 25, 2007 8:25 pm
Hi, I'm a beginner at OS development so forgive my ignorance. What I want to do is write a bootloader that loads a second stage bootloader. Here's what I have so far:
I'm using Q (Mac OS X's version of Qemu) and I'm using an ISO disk image to boot. My problem is that nothing happens once it boots, it doesn't even print the message. My first guess is that I used the line:
Which is the Floppy Drive, I think this is the problem because (as far as I know) I'm not using a floppy drive.
Also, the second stage bootloader doesn't exist. I don't know how to add it to the image. Here's how I'm adding the bootloader to the image:
How can I add stuff to the image after I add the bootloader?
ANY help WILL be appreciated, thanks in advanced.
Code: Select all
;----------[boot_loader.asm]----------;
; Author: Ricardo Diaz ;
; Description: A simple first stage ;
; bootloader. ;
;-------------------------------------;
org 0x7C00
bits 16
start:
.reset:
mov ah, 0
mov dl, 0
int 0x13
jc .reset
mov ax, 0x1000
mov es, ax
xor bx, bx
call print_msg
mov ah, 0x02
mov al, 1
mov ch, 1
mov cl, 2
mov dh, 0
mov dl, 0
int 0x13
jmp 0x1000:0x0
print_msg:
mov si, msg
mov ah, 0x0E
mov bx, 0x00
.print_loop:
lodsb
cmp al, 0
je .print_done
int 0x10
jmp .print_loop
.print_done:
ret
msg db "Loading second stage bootloader.", 13, 10, 0
times 510 - ($-$$) db 0
dw 0xAA55
Code: Select all
mov dl, 0
Also, the second stage bootloader doesn't exist. I don't know how to add it to the image. Here's how I'm adding the bootloader to the image:
Code: Select all
dd if=bootloader.bin of=bootable_image.iso
ANY help WILL be appreciated, thanks in advanced.