You should be storing a
BPB[
^] at the start. Your code should start with a JMP & NOP to skip over it.
I'm guessing that the 4096B sectors are on a CD. I never made it this far when making my OS, but there was some trick to it.
You can store anything you want in the free space, but typically you would fill it with code or error messages.
This is the basics of my boot sector. It boots off a floppy disk because they are really easy to use.
When you want to halt execution, you should use the
hlt
instruction. This puts the CPU to sleep. Your current jump loop is thrashing the CPU.
[BITS 16]
[ORG 0x7C00]
JMP main
NOP
bpbOEM db "MY OS "
bpbBytesPerSector dw 512
bpbSectorsPerCluster db 1
bpbReservedSectors dw 1
bpbNumberOfFATs db 2
bpbRootEntries dw 224
bpbTotalSectors dw 2880
bpbMedia db 0xF0
bpbSectorsPerFAT dw 9
bpbSectorsPerTrack dw 18
bpbHeadsPerCylinder dw 2
bpbHiddenSectors dd 0
bpbTotalSectorsBig dd 0
bsDriveNumber db 0
bsUnused db 0
bsExtBootSignature db 0x29
bsSerialNumber dd 0xA0A1A2A3
bsVolumeLabel db "MY OS BOOT "
bsFileSystem db "FAT12 "
main:
;code removed
;error messages and such
TIMES 510 - ($ - $$) db 0
dw 0xAA55