Page 1 of 1

Bootsector

Posted: Wed Apr 10, 2002 3:28 am
by black.fish
Hi! I've written a prog. that writes a file into the bootsector of a floppy disc. Now I've some questions about the file, that's written to the sector.
1. I know that it must be 512 bytes. How can I fill the rest when it's smaller?
2. Someone told me the last two bytes must be 0AA55h. Is that the same as 0x0AA55 in C?
3. Which extension (format) must the file have? bin?

Please help me!

Re:Bootsector

Posted: Wed Apr 10, 2002 12:06 pm
by Tim Robinson Alternate
black.fish wrote:1. I know that it must be 512 bytes. How can I fill the rest when it's smaller?
Any way you want. However, it's conventional to pad it with zeroes. In NASM, you can do this:

Code: Select all

times 510-($-$$) db 0     ; make the file the right size
dw 0xAA55                 ; magic word for BIOS
2. Someone told me the last two bytes must be 0AA55h. Is that the same as 0x0AA55 in C?
Yes, that's right.
3. Which extension (format) must the file have? bin?
The extension doesn't matter, but you need to make sure that your assembler is outputting to flat binary format. On NASM, use the -f bin switch.