Re: [hatari-devel] reading DMA sector count in HDC mode ?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 14/12/2013 10:13, Thomas Huth wrote:

  Hi Nicolas!

Am Fri, 13 Dec 2013 00:52:52 +0100
schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:
[...]
I think the dma sector counter is common to FDC/HDC mode, so it
should be the same, but could someone with a hard drive confirm this ?

I do not have an ACSI hard disk, but I think you're right ... the DMA
sector counter register belongs to the DMA chip, not the hard disk, so
I think it is the same for floppy and hard disk mode.

Yes, that's why it think too, it wouldn't make sense to have different sector count, the DMA does not really depend on FDC or HDC, it just handles DRQ signal and copy the corresponding byte.

I will update fdc.c / hdc.c to handle this better.

In the meantime, I also made some tests on my STF to determine the value of the unused bits when reading DMA infos at $ff8604/06. Those bits are in fact not set to 0, but will have the value of the last data read/written in fdc/hdc registers.

Only bits in $ff8605/07 are handled this way. Unused bits in the upper 8 bits of $ff8604.w and $ff8606.w are '0' most of the time, but I saw some cases where it was a completely different value, not related to previous read/write at $ff86xx. For now, I will leave them to '0'.

I don't know any program yet that rely on this, but since this is completely reproductible on real HW, it could be used in a protection as a value to init a decryption routine for example. I added some code to handle this in Hatari.


None of the doc I have are clear on this, they don't mention if
sector count can be read or not. But as dma status has a bit to tell
if sector count is 0 or not, this could confirm you can't read sector
count, you can only know if it reached 0.

I just had a look in my "Scheibenkleister" book (one of the best books
about Atari floppy and hard disks), and on page 179 I found this
statement:

  "Leider kann man den Sektorzähler nur beschreiben, nicht aber lesen;
  man kann nur an Bit 1 des DMA-Statusregisters ($FF8606, nur lesbar)
  erkennen, ob der Sektorzähler mittlerweile bei Null angekommen ist."

Roughly translated:

  "Unfortunately, you can only write to sector counter, but not read it;
  you can only watch bit 1 of the DMA status register ($FF8606, read
  only) to see whether the sector counter already reached zero."

Unfortunately, it is not mentioned whether there is a difference
between floppy and hard disk mode for the sector count register, but I
do not think that there is any.


Thanks for this and for the translation (my german is a little rusty, so better having a verified translation :) ).

Byt the way, what it the name / publisher of this book ? In France, I had many books from "Micro Application" which were considered as very good reference books on HW. Most of them were translations of the german edition published by "Data Becker" (eg "Disquette et disque dur" ("floppy and harddrive") was my reference book for all wd1772 coding).

Was your book publised by Data Becker ? If so, it seems some parts were not included in the translated french version.

Nicolas





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/