Why 55 AA is used as the boot signature on IBM PCs?

SasQ picture SasQ · Jun 17, 2012 · Viewed 7.8k times · Source

Why does the IBM PC architecture use 55 AA magic numbers in the last two bytes of a bootsector for the boot signature?

I suspect that has something to do with the bit patterns they are: 01010101 10101010, but don't know what.

My guesses are that:

  1. BIOS is making some bitwise and/or/xor operations on these bytes to compare them together and if it, for example, results in 0, it can easily detect that and jump somewhere.
  2. it could be some parity/integrity safeguard that if some of these bits is broken, it could be detected or something and still be considered a valid signature to properly boot the system even if this particular bits on the disk has been broken or something.

Maybe someone of you could help me answer this nagging question?

I remember I've once read somewhere about these bit patterns but don't remember where. And it migt be in some paperbook, because I cannot find anything about it on the Net.

Answer

supercat picture supercat · Jun 17, 2012

I think it was chosen arbitrarily because 10101010 01010101 seemed like a nice bit pattern. The Apple ][+ reset vector was xor'ed with $A5 to (10100101) to produce a check-value. Some machines used something more "specific" for boot validation; for PET-derived machines (e.g. the VIC-20 and Commodore 64 by Commodore Business Machines), a bootable cartridge image which was located at e.g. address $8000 would have the PETASCII string "CBM80" stored at address $8004 (a cart starting at $A000 would have the string "CBMA0" at $A004, etc.), but I guess IBM didn't think disks for any other machine would be inserted and have $55AA in the last two bytes of the first sector.