assemblyoperating-systemfat

FAT 12 Implementation


I have been following the Operating System development tutorial on http://www.brokenthorn.com. Right now I'm trying to setup the BIOS parameter block with this code:

jmp loader
bpbName db "NubOS",0,0,0
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 "MOS FLOPPY "
bsFileSystem:           DB "FAT12   "

However, when I try to open the disk using the ImDisk driver for virtual floppies, it says that the drive needs to be formatted. Is the code I'm using correct?


Solution

  • Try a short jump: the sector begins with jmp short loader, followed by nop, then go bpbName through bsFileSystem, then loader: and all your code and then the last 2 bytes of the 512-byte sector being 0x55 and 0xAA. These two must be at offsets 510 and 511 respectively.