[hatari-devel] ACSI/DMA emulation issues

Uwe Seimet Uwe.Seimet at seimet.de
Sat Nov 21 21:23:30 CET 2009


Hi,

I had a closer look at the ACSI/DMA emulation and I found some
compatibility issues that prevent the emulation from working with
HDDRIVER and probably also with other drivers.

I found that the HDCCommand byteCount field is only reset after 6 ACSI
command bytes habe been received. If the hard disk driver decides that
there was a communication error and does not send a complete command
block the byteCount offset will be wrong for subsequent commands.
The byteCount should be reset at the *beginning* of a command, i.e. when
the DMA status is cleared and the sectour could register is selected.
This is the usual command sequence for doing so:

move #$190,$ff8606
move #$90,$ff8606

After this byteCount should be 0. It should not be set to 0 in any other
case. Doing so will make the emulation even less compatible or will at
least prevent emulating the ICD ACSI host adapter, which accepts 7
instead of 6 command bytes.

So why does HDDRIVER think there was a communication error and stops
sending command bytes? This is because as already suspected there is a
compatibility issue with the timer C emulation. After send a command
byte HDDRIVER waits a certain time for it to be accepted, i.e. for
setting I5 (hdc.c):

MFP_GPIP |= 0x20;

It looks as if I5 is not set during HDDRIVER's timeout period. This is
how HDDRIVER detects the timeout:

.qd0:   btst #5,gpip
        beq.s .nowait
        tst.b tcdr
        bpl .qd0
.wait:  btst #5,gpip
        beq.s .nowait
        tst.b tcdr
        bmi .wait
        subq.l #1,d0
        bne .qd0
.err:   moveq #-1,d0
        rts
.nowait:moveq #0,d0
        rts

If the timer c data register value has changed its sign twice and the
command byte was not yet acknowledged HDDRIVER assumes a timeout and
will not send any more command bytes. The current command (INQUIRY) has
failed, and even worse, because the byteCount in hdc.c has not been
reset the next command must also fail.

Can you confirm that my error analysis makes sense? If you can, is there
any chance to improve the compatibility/accuracy of timer C?

Best regards

Uwe



More information about the hatari-devel mailing list