solved: osdev floppy oem block

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
rty
Posts:6
Joined:Fri Apr 03, 2009 12:48 am
solved: osdev floppy oem block

Post by rty » Wed Nov 10, 2010 12:16 pm

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.
Last edited by rty on Tue Nov 16, 2010 12:18 pm, edited 1 time in total.

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: osdev floppy oem block

Post by Andyhhp » Thu Nov 11, 2010 10:38 pm

have you got the bootloader signature at the end of the block? (0xAA55)

~Andrew
Image

rty
Posts:6
Joined:Fri Apr 03, 2009 12:48 am

Re: osdev floppy oem block

Post by rty » Thu Nov 11, 2010 11:29 pm

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.

rty
Posts:6
Joined:Fri Apr 03, 2009 12:48 am

Re: osdev floppy oem block

Post by rty » Tue Nov 16, 2010 12:17 pm

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.

Post Reply