[stella] Understanding the PIA

Stephen Anthony sa666666 at gmail.com
Fri Apr 4 07:30:51 CDT 2008


On April 4, 2008 8:34:39 am André Wagner wrote:
> > 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 ...
>
> I got this from http://nocash.emubase.de/2k6specs.htm . Maybe is
> because of this?
>
> "Once when the timer does underflow, it restarts at FFh, and is then
> decremented once per clock cycle, regardless of the selected 
> interval (this feature allows to calculate the exact underflow time
> at one clock cycle resolution even if a larger interval was used).
>
> However, the interval is automatically re-actived when reading from
> the INTIM register, ie. the timer does then continue to decrement at
> interval speed (originated at the current value)."

OK, now I'm just really confused.  There's the documentation that you 
provided from nocash, and the actual implementation in Stella that say 
this is how it should work.  However, z26 and MESS don't do it that 
way, and they produce the results that you guys say is correct.

At this point it's not a matter of fixing a bug in the emulator; I have 
code that does it both ways.  What I need is confirmation of *which* 
way is correct.

Steve



More information about the Stella mailing list