I have made a bootloader that works perfectly in QEMU (I also tested Bochs and VirtualBox with no problems) but it behaves unexpectedly in any real machine when booting from an USB.
I believe it must be a problem with my segment registers, here's how I am setting them up:
Code: Select all
[ORG 0x7C00]
[BITS 16]
cli
xor ax, ax
mov ds, ax
mov es, ax
mov ax, 0x20
mov ss, ax
mov sp, 4096
mov bp, sp
sti
https://gist.github.com/AstroThing/f844 ... 8b4486d43d
I'm using NASM to generate a flat binary file and copying it to a USB using dd:
Code: Select all
nasm -f bin boot.asm -o boot.bin
dd if=boot.bin bs=512 count=1 of=/dev/sdb