[stella] Understanding the PIA

Stephen Anthony sa666666 at gmail.com
Thu Apr 3 18:10:10 CDT 2008


On April 3, 2008 3:28:12 pm bob.montgomery at thomson.com wrote:

> 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

OK, I had a chance to look at this, and I've found that there's actually 
code in Stella that does #2.  That is, there's specific logic that 
checks if a read has been done after passing zero, and if so the timer 
results are changed.  When I remove that bit of logic, I get the 
correct output as in your previous examples.  So it seems the base 
timer code *is* working.

So I'm wondering why this logic was added in the first place.  Obviously 
there was some reason, even if it was a misunderstanding of how the PIA 
works.  I'll have to contact the person who added that bit of code ...

> 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

Are you saying the emulators are working correctly in this case, or 
not??

Steve



More information about the Stella mailing list