[stella] Understanding the PIA
bob.montgomery at thomson.com
bob.montgomery at thomson.com
Thu Apr 3 12:58:12 CDT 2008
Hi,
>If you get a chance, could you also test those (ie, let me know what
*is*
>happening, and what *should* be happening in terms of output)?
Ok, did some testing. All with emulators.
For TIM8T, after the timer passes zero Stella begins (correctly)
counting down once every cycle UNTIL INTIM is read, then the timer
begins counting down every 8 cycles again:
lda #3
sta TIM8T
nop
nop
lda INTIM ;A holds 2
nop
nop
lda INTIM ;A holds 1
nop
nop
lda INTIM ;A holds 0
nop
nop
lda INTIM ;A holds (correctly) F8
nop
nop
lda INTIM ;A should hold F0, but in Stella has
A=F7
For TIM1T, things are really weird:
lda #4
sta TIM1T
lda INTIM ;A holds 0
lda INTIM ;A should be FC, Stella has A=F9
(?!)(counting double starting with FF? Or?)
lda INTIM ;A should be F8 (FC-4), instead Stella
has A=F5 (F9-4) (counting down by 1s again)
lda INTIM ;Stella: A holds F1 (etc.)
lda INTIM ;Stella: A holds ED
For TIM64T, seems to be the same as TIM8T, only using a counter value of
64 rather than 8. I.e., it counts down normally to zero, holds zero for
64 cycles, then counts down once very cycle until you read INTIM, then
it starts counting down once every 64 cycles.
Haven't tested TIM1024T yet.
Seems like two issues in Stella:
1st: timer goes crazy after passing zero when using TIM1T
2nd: reading INTIM after timer has passed zero improperly resets the
count-down speed
-Bob
P.S. Additionally, undocumented in the programmer's guide but the same
in z26 and Stella: The timer counts down by one immediately and *then*
begins counting down as you would expect (i.e., by 1s, 8s, 64s, 1024s).
This has no effect on TIM1T, but with TIM8T, for example, counting by
cycles:
Cycle Timer (TIM8T stored with 8)
1 7?
2 7?
3 7?
4 7 tested in z26
5 7 tested in z26
6 7 tested in z26
7 7 tested in z26
8 7 tested in z26
9 6 tested in z26
Cycle Timer (TIM1T stored with 8)
1 7?
2 6?
3 5?
4 4 tested in z26
5 3 tested in z26
6 2 tested in z26
7 1 tested in z26
8 0 tested in z26
9 FF tested in z26
10 FE tested in z26
11 FD tested in z26
I have a very vague memory of this being discussed in [stella] before...
More information about the Stella
mailing list