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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
RezaNoei
Member
Member
Posts: 40
Joined: Sun Jun 01, 2014 1:39 pm

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

Post 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,
Octocontrabass
Member
Member
Posts: 6298
Joined: Mon Mar 25, 2013 7:01 pm

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

Post 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).
Post Reply