Page 1 of 1

Read Error, When Setting dh to 1 in int 0x13

Posted: Wed Oct 14, 2015 10:14 am
by RezaNoei
Hello,

When i changed Head Number (dh in int 0x13) to 1, int 0x13 just shows a read error !

here is my OEM parameter blocks :

Code: Select all

bpbBytesPerSector:  		DW 512
bpbSectorsPerCluster:		DB 1
bpbReservedSectors:     	DW 1
bpbNumberOfFATs:            DB 2
bpbRootEntries:            	DW 224
bpbTotalSectors:           	DW 0x2880
bpbMedia:                  	DB 0xF1
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 "Shams    OS"
bsFileSystem:           	DB "FAT12   "
im using qemu :

qemu-system-x86_64 floppy.img

is there any way to say my floppy disk (image) is two sided ?

thanks,

Re: Read Error, When Setting dh to 1 in int 0x13

Posted: Wed Oct 14, 2015 11:02 am
by Octocontrabass
As far as I know, qemu thinks it's a hard disk if you don't specify otherwise, so you're getting a read error because qemu is using an automatically generated, different geometry.

If you use int 0x13 ah=0x08 and calculate the C/H/S tuple for the sector you want instead of hardcoding the disk geometry, you won't have this problem.

You also need to make sure your disk image is an exact multiple of 512 bytes (or exactly the size of a floppy disk, if you want it to be a floppy disk).