[stella] Understanding the PIA

seagtgruff at aol.com seagtgruff at aol.com
Fri Apr 4 14:01:09 CDT 2008


Based on my previous tests with a real 2600 (see the thread in AtariAge that I had alluded to in an earlier post), the timer does decrement by 1 as soon as you finish writing to it. I actually played around with different SLEEP values so I could vary the number of cycles I waited before reading the timer, so I could determine the cycle on which the value changed. The following summarizes my understanding of how it works, but I can't guarantee it's technically correct, because I'm not sure I've got the timings right as far as the load and store instructions (i.e., when you store a value, at what point is the value in memory, and if you load a value, at which point is the value loaded from memory). But I do know that I'm describing the observed behavior, even if the cycles when things happen might be off a tad. Anyway, let's say you write an 8 to TIM8T. On the last cycle of the store instruction, the timer will have an 8 in it. On the first cycle of the next instruction, the timer will have a 7 in it, and it will keep that value for 8 cycles, as follows:

LDA #8??? ; 2 ;??? ?? <-- These represent the value in the timer
STA TIM8T ; 4 ; ?? ?? ?? 08 <-- as of each instruction cycle.
NOP?????? ; 2 ; 07 07
NOP?????? ; 2 ; 07 07
NOP?????? ; 2 ; 07 07
NOP?????? ; 2 ; 07 07
NOP?????? ; 2 ; 06 06
; etc.

By the way, the PIA (as some of the Atari documents refer to it) or RIOT chip is a 6532, and you can find some documentation about it at http://www.6502.org. That's really the best place to look for information about the RIOT chip and its various registers, because the Atari ("Stella") programming guides don't talk about it very much.

Michael


-----Original Message-----
From: bob.montgomery at thomson.com
To: stella at atari2600.org
Sent: Fri, 4 Apr 2008 12:23 pm
Subject: Re: [stella] Understanding the PIA



Hi Michael,

> Can anyone think of anything else?

How about what value is stored in TIMxT?

My tests in z26/Stella showed that after storing 8 in TIM8T, INTIM held
7 four cycles later and behaved in all ways as if a 7 had actually been
written to the timer.  Is that how a 2600 actually works?

-Bob 

_______________________________________________
Stella mailing list
Stella at atari2600.org
http://atari2600.org/mailman/listinfo/stella

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://atari2600.org/pipermail/stella/attachments/20080404/8bf1354e/attachment.html 


More information about the Stella mailing list