Only the Master Boot Code is repaired.
Tools like the old dos fdisk
with its undocumented parameter called /mbr
or windows mbrfix
recovery command are able to write the hard disk master boot record without altering its partition table information.
So in short, these tools only write to the 1st physical sector of the disk, that is as you already guessed, its 512 first bytes.
More to read here: wikipedia/Master_boor_record.