While implementing my own boot sector loaders starting in 2012 I made sure to zero the bytes at offsets 508 and 509. These are the fourth to last and third to last bytes of a standard 512 byte sized sector. This is what I put there:
_fill 508,38,start
dw 0
; 2-byte magic bootsector signature
dw 0AA55h
I do not now recall any specific source for this, but I believe I added the two zero bytes in an attempt to increase compatibility to some or another OS's drivers. At some point I must have learned that this may be needed.
Paging through the document "Microsoft Extensible Firmware Initiative - FAT32 File System Specification - FAT: General Overview of On-Disk Format - Version 1.03, December 6, 2000" did not yield any information about the bytes 508 and 509. On page 13 it states:
There is one other important note about Sector 0 of a FAT volume. If we consider the contents of the sector as a byte array, it must be true that sector[510] equals 0x55, and sector[511] equals 0xAA.
NOTE: Many FAT documents mistakenly say that this 0xAA55 signature occupies the "last 2 bytes of the boot sector". This statement is correct if — and only if — BPB_BytsPerSec is 512. If BPB_BytsPerSec is greater than 512, the offsets of these signature bytes do not change (although it is perfectly OK for the last two bytes at the end of the boot sector to also contain this signature).
The closest it gets to talking about the bytes 508 and 509 is in the description of the FSINFO structure for FAT32, on page 22:
FSI_TrailSig 508 4
Value 0xAA550000. This trail signature is used to validate that this is in fact an FSInfo sector. Note that the high 2 bytes of this value—which go into the bytes at offsets 510 and 511—match the signature bytes used at the same offsets in sector 0.
But it does not specify that the entire doubleword should match this signature in the boot sector.
The modern FreeDOS boot sector loader does provide these two bytes as zeros too:
times 0x01f1-$+$$ db 0
filename db "KERNEL SYS",0,0
sign dw 0xAA55
The page "An Examination of the MSWIN4.1 OS Boot Record" depicts the MS Windows 4.x boot sector as having the two bytes as zeros, too. In the hex dump titled "Location of Data and Error Messages in Memory" the last line contains these zeros:
7DF0 00 57 49 4E 42 4F 4F 54 20 53 59 53 00 00 55 AA .WINBOOT SYS..U.
Is there a reason for these zero bytes or is it all an instance of cargo cult?
Just reviewing the state of all of the FreeDOS kernel's boot sector loaders I came upon a specific claim in another file of theirs. This is in the LBA FAT32 loader: