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

[ Thread Index | Date Index | More Archives ]


thank you for spending so much of your time with this issue.

> Yes, that the whole point of the discussion : if you don't set $fffa23 
> yourself, you can't be sure there will be negative value when reading it.
> You're waiting with bmi, but if timer was started with $fffa23 = $18 for 
> example, the transitions when reading $fffa23 will be :
> $18, $17, ..., $2, $1, $0, ($ff) (very brief), [timer loops], $18, $17, 
> $16, ...

Ah, I see what you mean now. (Actually I do not expect the timer to have
the value $ff at all if started with $18.) But note that I rely on the
regular timer behavior based on a well-defined initialization by TOS
anyway, so it does not really matter, see below.

> I don't understand "the timer will be too fast or too slow". You don't 
> set data reg yourself before doing the loop with bpl/bmi, yet you expect 
> the timer to be at a given speed ?

Yes, because it's the 200 Hz system timer. I expect it to run at 200 Hz
because TOS ensures this, just as it is documented. If it doesn't run at this
speed my timing will be wrong or will not work at all. Because I may
expect it to run at 200 Hz the value is negative long enough for my check.
I don't claim my code to work if somebody manipulates the frequency of this
timer. But if you cannot rely on any timer you cannot have a
platform-independent (not depending on processor speed) timing anyway.

> No, there is no specific behaviour between tst and mfp. Internally this 
> is a read from $fffa23, then a comparison, then a branch. Bxx is 
> completly working with any register. The problem could be when computing 
> what the value of $fffa23 should be a the time of the read (but there're 
> plenty working demos/games under Hatari that uses this, so this is 
> certainly a very rare case here)

I'm sorry, but I am not yet convinced, because these two lines of code you
suggested result in an endless loop:

wait: tst.b $fffffa23
      bne wait

Maybe they worked on your Hatari because your settings are different?

The loop would have to terminate with the standard timer C settings
initialized by TOS.
I have attached a new sample program with these statements (supervisor mode
is required):

      move #32,-(sp)
      trap #1
wait: tst.b $fffffa23
      bne wait

The illegal instruction is never reached.

Take care


Mail converted by MHonArc 2.6.19+