bootloader issue with USB stick
Posted: Thu Sep 18, 2008 11:50 am
hi guys, as this is my first post id like to say i really like the look of the community and hope to stay here for a while
Right then, im quite new to the OS development scene, although ive been programming in C/++ and ASM for a while. Im trying to create a purely USB stick-based operating system, but im struggling to load sectors from the drive with my bootloader. I think its an issue with the drive number, but ive tried all drive numbers from 0 to 255 without luck, and im completely stumped. Doubtless itl be a really obvious typo or bug, so could you please flick through this code to see if you spot anything? Thanks a lot
[edit] my assembler and linker are as86 and ld86 for ubuntu if that helps.
Right then, im quite new to the OS development scene, although ive been programming in C/++ and ASM for a while. Im trying to create a purely USB stick-based operating system, but im struggling to load sectors from the drive with my bootloader. I think its an issue with the drive number, but ive tried all drive numbers from 0 to 255 without luck, and im completely stumped. Doubtless itl be a really obvious typo or bug, so could you please flick through this code to see if you spot anything? Thanks a lot
Code: Select all
entry start
start:
nop
mov ax, #0x0600
mov bh, #0x4f
mov cx, #0
mov dh, #25
mov dl, #80
int 0x10 ;clear screen, just in case
mov ax, #0x0e47
mov bh, #0x00
int 0x10 ;output "G"
;gooo: jmp gooo ;repeater, for debugging
mov dl, #0x80
mov ah, #0x02
mov al, #1
mov ch, #0
mov cl, #2
mov dh, #0
mov bx, #0
push #0x1000
pop es
int 0x13 ;try to load sector 2 from drive at dh
;woop: jmp woop ;enter infinite woop
jmp 0:0x1000 ;enter the boot code