Re: [hatari-devel] Missing DMA sector count register emulation for ACSI transfers?

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



Le 01/09/2021 à 15:45, Christian Zietz a écrit :
Hello,

I'm testing a (fairly exotic) harddisk driver that was bundled with DDD
harddisks:

Harddisktreiber V4.13
   (C) 1991 by K.R.
Digital Data Deicke

(Digital Data Deicke used to be a popular Atari distributor in Germany.)

... and I found it not to be working on Hatari. First, I thought that it
was perhaps relying on some non-standard behavior/commands of DDD
harddisks. But meanwhile I've come to the conclusion that there is a
detail missing in Hatari's emulation of ACSI disks.

After completion of a command, the driver reads the DMA status register
at address $FF8606. (Not to be confused with the status byte that is
read over the ACSI bus from the actual drive.) It masks the lower three
bits and checks for 1 (= 3'b001). But Hatari always returns a 3 (=
3'b011), here. Bit 0 means "no DMA error", bit 1 means "sector count
register is not zero". The equivalent lines of code are here:
https://git.tuxfamily.org/hatari/hatari.git/tree/src/fdc.c#n4393

However, it seems that the ACSI code in hdc.c never sets the DMA sector
count register to 0, which makes this particular disk driver fail. I've
tested (by means of a quick hack) that zeroing the sector count register
from Acsi_DmaTransfer() makes Hatari return the expected DMA status of
1, and makes the driver work.

Hi

I don't know very well that part in hdc.c, but it seems Acsi_DmaTransfer() never checks SectorCount at all and doesn't update it after enough bytes are read/written.

IMO Acsi_DmaTransfer() should be modified to use FDC_DMA_FIFO_Push() when reading as it's already the case for FDC read accesses.

For write case it's harder to share code with fdc's FDC_DMA_FIFO_Pull(), so it should at least check FDC_DMA.SectorCount>0 and decrement it accordingly.

Unfortunately I don't use HD image that much, so I'd rather leave the change to someone more familiar with this part (thomas maybe ?)

Nicolas



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