Page 1 of 1
int 13h problem?
Posted: Wed May 28, 2003 4:29 pm
by stonedzealot
There are two questions in this post. First of all, has anyone else noticed that int13h will not function without the requested beginning sector being <=18? I tested this by just substituting and then calling (empty bootsector, try to read three times, if cf is set after the third try then hang) if moved 18 into CL and it ran, then I tried 19 and it hung...
It makes sense, 18 is the number of sectors/track on a normal floppy...but on Ralph Brown's list, int13h can take upto 63 (3.5 tracks worth of sectors)
Second of all, is how would I get around this? I'm guessing that say sector 57 would turn into Head 0, Track 3, Sector 3...is that right?
Re:int 13h problem?
Posted: Wed May 28, 2003 5:21 pm
by Tim
The sector number is not the only input which determines which data are read. The location is described by sector, track and head. The first 18 sectors are on track 0; the next 18 are on head 1 on track 0; the next 18 on head 0 on track 1, and so on. So to go past sector 18 on the disk, you need to move to sector 1 on track 0 on head 1. A floppy drive capable of reading double-sided disks has two heads, one for each side of the disk.
To go from a block number to a sector, track and head number:
Code: Select all
void BlockToHts(unsigned block, unsigned *head, unsigned *track, unsigned *sector)
{
*head = (block % (spt * heads)) / spt;
*track = block / (spt * heads);
*sector = block % spt + 1;
}
where:
spt = sectors per track (18 for a 1.40MB disk)
heads = number of heads (2 for a 1.40MB disk)
Re:int 13h problem?
Posted: Wed May 28, 2003 6:54 pm
by stonedzealot
OHHHHHHHH. I see, I thought it was different. I was skipping an entire track by assuming it went head 0, track 0 18 sectors, head 0, track 1 18 sectors! Whew. I was wondering where in the world I was getting these weirdass values from!
Thanks alot!
Re:int 13h problem?
Posted: Thu May 29, 2003 8:11 am
by Pype.Clicker
afaik, the reason why Great Teacher Ralf Brown mention a limit of 63 sectors in a row during a BIOS read is because this is the maximum number of sectors per track a hard disk can have (roughly, it must be coming from the way geometry was encoded on very early disks: sector number is limited to 6 bits, because bits 6 and 7 are for hi-bits of the cylinder number)
as the same BIOS function is used to read/write to disk regardless it's a floppy or a hdd ...