Page 1 of 1

solved: osdev floppy oem block

Posted: Wed Nov 10, 2010 12:16 pm
by rty
Hi again, i was here last year, i wasnt ready though :0
I thought i would try the osdev tutorial again.

I have a floppy drive + disc, im using bochs, and im writing to the boot sector with the debug command.
"w 100 0 0 1" <- mabey the address is wrong?

The problem is, after i format the FD, then write the boot.bin file to the boot sector.
Windows is still giving me the unformatted disc error.

The boot program works in bochs, usually. Just wondering why it may think its unformatted in windows.

This is a copy of the start of the program + parameter block.

Code: Select all

bits                      16
org                       0x7c00
start:                    jmp boot_program

bpbOEM:                   DB "bootdisc"

bpbBytesPerSector:        DW 512
bpbSectorsPerCluster:     DB 1
bpbReservedSectors:       DW 1
bpbNumberOfFATs:          DB 2
bpbRootEntries:           DW 224
bpbTotalSectors:          DW 2880
bpbMedia:                 DB 0xf0      ;// 1.44 MB FD(f0)
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   "

boot_program:
                          ..
Thanks for any idears.

Re: osdev floppy oem block

Posted: Thu Nov 11, 2010 10:38 pm
by Andyhhp
have you got the bootloader signature at the end of the block? (0xAA55)

~Andrew

Re: osdev floppy oem block

Posted: Thu Nov 11, 2010 11:29 pm
by rty
yep. the same happens with the example on chapter 4.

im guessing the problem is, the debug write command, or, i need more data for the fat12 format to work.

i have no idear though.

the examples work as boot disks, but windows and debug say the disk is unformatted, after the debug write command.

Re: osdev floppy oem block

Posted: Tue Nov 16, 2010 12:17 pm
by rty
found out the problem.

nasm was assembling "jmp boot_program" into a 2 byte opcode.
nasm-2.09.03-win32

i stuck a byte under the jmp instruction for now.

Code: Select all

start:    jmp boot_program
          db 0x00
awesome.