All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
So I'm writing a Makefile early to automate bootable floppy creation. I have the loader.s+kernel.c-linked "kernel" ELF binary, loader.o, and kernel.o. Plus, a FAT12 blank floppy image.
And then it's just zeroed out beyond that. Presumably, from the "non-system disk" part, around there is the boot code. But where do I inject my kernel (byte starting position) to overwrite that, but leave it a valid floppy?
The first 2 bytes (EB 3C) are a jump to byte <edit>#3E</edit>. Everything from there to the strings (i.e. FA 31 .. CD 19) is the boot code. The strings (plus one zero-byte after them) are data for that boot code.
So you should be able to replace bytes <edit>#3E to #1FD</edit> by your own boot code.
(edited to fix mistake, see post below)
Last edited by urxae on Mon Mar 19, 2007 6:43 am, edited 1 time in total.
Most likely he's refering to the index of the bytes in the bootsector. Byte 0x3C should be number 13 in row 4 (00000030 on the left) and 0x01FD is just before the final signature (000001F0 -> "0x55 0xAA")
Most likely he's refering to the index of the bytes in the bootsector. Byte 0x3C should be number 13 in row 4 (00000030 on the left) and 0x01FD is just before the final signature (000001F0 -> "0x55 0xAA")
Yes, those were indexes not values .
Unfortunately, I also got the first one wrong. That should've been byte number 0x3E, not 0x3C. I got confused with the relative jump, it seems. (even though I disassembled that code )