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.
I used the following LBA to CHS code. It's working fine in Bochs. In real hardware there seems to be problem when LBA value is >= 9000 (LBA sector count >= 46). The LBA to CHS routine converts this LBA value into
02 - track(cylinder)
01 - sector
00 - head
Assume 18 sectors per track.
I am having doubt with the head value since it is 1 for LBA Sector value < 71. But if it is wrong how can bochs display the file correctly? I am confused with LBA to CHS translation. I just adopted an LBAtoCHS tutorial.
If the LBA is 9216 then (for a 1440 KB floppy) you'd get sector 1, head 0 and cylinder 256. Cylinder number 256 doesn't fit into CH, so it'd be truncated to zero.
Of course this is way past the end of the floppy - the last sector of a 1440 KB floppy would have LBA 2879 (or cylinder 79, head 1, sector 18).
The LBA to CHS conversion code looks fine for floppies. For hard drives the highest 2 bits of the (10 bit) cylinder number is put in the highest 2 bits of CL. This allows for up to 1024 cylinders and limits it to 63 sectors per track.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
The error found was WCYL(Wrong cylinder) in ResultST2 and No data in ResultST1, ResultST0 contains the value 0x40 i.e Abnormal Termination. Cylinder 2,head 0,Sector 1 is the CHS value. For cylinder 2 the error occurs. I am talking about the LBA 0x48.
Brendan: I should have confused you with 0x9000. It is nothing but 0x48 * 512 bytes. I haven't even read the 2 cylinder itself.
pradeep wrote:
The error found was WCYL(Wrong cylinder) in ResultST2 and No data in ResultST1, ResultST0 contains the value 0x40 i.e Abnormal Termination. Cylinder 2,head 0,Sector 1 is the CHS value. For cylinder 2 the error occurs. I am talking about the LBA 0x48.
Brendan: I should have confused you with 0x9000. It is nothing but 0x48 * 512 bytes. I haven't even read the 2 cylinder itself.
I still can't find anything wrong with the LBA -> CHS conversion code itself. Are you sure the problem isn't somewhere else?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Bochs doesn't say any problems.
Bochs is displaying the contents correctly and no problem in bochs. But these problems happen in real hardware. So i couldn't debug. If something works in Bochs and not in real hardware means it is mostly because of delay.Suppose that there is a problem with seek, it would generate an error after timeout. Those timeout error also doesn't occurs.
Since i am implementing(...) vfs it's hard to debug
Could the problem be that delay is not introduced in proper position. fdc driver reads track 0,1 but not track >=2 while both bochs and vmware reads it happily for me. Seek operation is success and after issuing read command it waits for an interrupt to happen. should there be any delays inserted. Soon i will check it on other test system.
<edited on 30/11/05>
The problem is related to driver implementation. It works without any problem when called directly. But if i make call through VFS this problem occurs. First of all i have to implement VFS completely, Anyway thanks for those guys who answered for this thread.
</edited on 30/11/05>