Bootsector

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
black.fish

Bootsector

Post 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!
Tim Robinson Alternate

Re:Bootsector

Post 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.
Post Reply