Re: [hatari-devel] Problem with SCSI initiator command register

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


Le 07/06/2012 09:50, Uwe Seimet a écrit :
Hi,

what are the initial value for ffffa23 and its control register ?

The initial values are for the data register are unspecified because it
is incremented constantly while the timer is running. The control
register value also does not really matter, as long as the timer is
running (i.e. decrementing). The standard values after a reset are fine..

I didn't follow the whole discussion on SCSI, but what does this transition in fffa23 helps to measure for SCSI ? Could you describe the logic behind it to better understand what could be missing in Hatari ?

Also, relying on "standard" values after a reset seems dangerous to me, a program running before yours could completly change those values or even set the control register to 0 and the counter would never decrement. Or maybe some TOS/Emutos versions would not start control register in the way you expect it.

Still, a problem remains in Hatari, but I think explictly setting mfp values would be better.



Would you be able to compile a small .prg with this loop so I could run
it under Hatari and look at the traces ?

(the problem could be when ffa23 loops from 0 to its starting value,
this transition might not be accurate in Hatari)

Note that for my code the actual value does not matter, just the sign of
the value.

If I recall correctly, the data register on a real MFP goes to 255 before looping to its initial value. This might be the problem under Hatari. But in that case, as your code is detecting the timer is looping, you could just use (replace bpl/bmi with bne/beq) :

    move.l #12000,d1
wait1:    tst.b $fffffa23
    bne wait1
wait2:    tst.b $fffffa23
    beq wait2
    subq.l #1,d1
    bne wait1
    illegal

you're testing bmi/bpl, but if fffa23 is started with $50 (>0) or $a0 (<0), you won't measure the same things.

With a > 0 starting data reg, your loop will just wait for the data reg transition from $0 to $ff to $50 and exit immediatly.

With a < 0 starting data reg, your loop will wait longer for fffa23 to become >0 again : $0 to $ff to $a0 to ... $80 to $7f and exit.

Might not be a problem, but the behaviour is not the same.

Nicolas



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