I'm testing my floppy driver in qemu and it works as expected. But if I turn to real hardware something strange happens:
output:
Code: Select all
LBA: 35 >> H: 1 C: 0 S: 18
ST0: 01000000 // ST0 of seek op - success
track: 0 - pcn: 0
seeking done
command sent ... waiting for INT
ST0: 01000000 // ST0 of READ - failed
ST1: 10000000
request failed
In addtion to this my code seems to work just fine I can read all the other sectors, just the last one of tracks on Head 1 seem to be an issue.
The spec of the floppy controller stats for this error, that it may show up if TC isn't set high by dma controller although the floppy has successfully transfered the read data. For all the other sectors my dma code works - and as this code has no relation to the sector that gets read it shouldn't be an issue here.
What confused me even more is this homepage: http://www.phys.uu.nl/~heukelum/xdflinux/
Although the statement about how linux formats floppy disks - well, I used mformat under linux - would explain why I the sector I try to read should be on the next track, I still don't get why everyone uses the same formular to convert from LBA to CHS?
Code: Select all
void kfd_lba2chs(uint block, uint* cyl, uint* head, uint*sector) // linear block addressing to cylinder/ track - head - sector addressing
{
*cyl=0;
*head=0;
*sector=0;
//*cyl = (block / 18) / 2;
//*head = (block / 18) % 2;
//*sector = (block % 18) + 1;
*head = (block % (18 * 2)) / (18);
*cyl = block / (18 * 2);
*sector = block % 18 + 1;
FD_DEBUG("lba: %d >> H: %d C: %d S: %d\n",block,*head,*cyl,*sector);
}
Any thing special about the last sector of tracks on head 1? It is a 3.5 inch 1.44 mb standard floppy. I did also try to replace it, I don't think it's a bad sector or stuff, cause the disk image I created of it to run in qemu just works fine.
Any suggestions? thx