...CrazyBuddha's BabyStep tutorial says it must be "dw 0xAA55", GoogleBattle says it's 0xAA55...
...but when I tried to follow the tutorial (old GRUB affectionado though I am, I wanted to write a bootsector once in my life), Bochs stubbornly refused to accept either
Code: Select all
times 510-($-$$) db 0
dw 0xAA55
Code: Select all
.org 510
.word 0xAA55
Reversing that to 0x55AA worked.
Is this just me, a strange rift in the time/space continuum, a bug in Bochs (2.1.1), or is it really that no-one ever actually tested this and we have to edit all examples in the FAQ?
This is a x86 using a i586-elf cross-binutils and the following (GAS) source (the NASM source in the tutorial generates identical binary):
Code: Select all
.code16
.text
movw $0x07c0, %ax
movw %ax, %ds
movw $msg, %si
ch_loop:
lodsb
or %al, %al
jz hang
mov $0x0e, %ah
int $0x10
jmp ch_loop
hang:
jmp hang
msg:
.asciz "Welcome to BabySteps."
.org 510
.word 0x55AA
ld -Ttext 0x0 -o bootsector bootsector.o --oformat binary --entry=0
If it's really that everyone just copied each other and never actually put this to the test, I'll fall over backwards from laughing...