[stella] Understanding the PIA
bob.montgomery at thomson.com
bob.montgomery at thomson.com
Thu Apr 3 11:08:28 CDT 2008
Hi Andre,
>There seems to be something going on when the PIA underflows, but I
can't
>quite understand what is it. Does anyone has experience programming the
>PIA?
the Stella Programmer's Guide tells you what should happen when the
timer underflows:
>The PIA decrements the value or count loaded into it once each interval
>until it reaches 0. It holds that 0 counts for one interval, then the
>counter flips to FF(HEX) and decrements once each clock cycle, rather
than
>once per interval.
As far as I know, this is what happens on a real 2600 and what happens
in z26. But! Stella (the emulator) absolutely does NOT do this, it
does (incorrectly) something else entirely; I've never bothered to
figure out exactly what. Based on your values and some of my own hazy
recollections, I think that it does NOT hold the zero value for one
interval but begins counting down immediately. Or something. Anyway,
for timer stuff, use z26 or a real Atari.
I just ran your test in z26 (with the -t flag) and, according to the log
file, the values I got match up with your expected values: 0B, 04, FD,
F6, EF, E8, etc.
-Bob
More information about the Stella
mailing list