[stella] Understanding the PIA

André Wagner andre.nho at gmail.com
Thu Apr 3 06:50:28 CDT 2008


Hello,

I've been a Atari programming enthusiast for a long time, but this is my first message to the list.

I'm trying to understand how the pia works. I wrote the following very simple program:

	lda #15    ; A = 15
	sta TIM1T  ; set TIM1T = 15 (4 cycles)

Here
	lda INTIM  ; load A with timer (4 cycles)
	jmp Here   ; do it again (3 cycles)

Basicly, I loaded TIM1T with 15 and I'm checking the value of INTIM every 7 cycles.

The values I understand I should get every time I read the INTIM (3rd instruction) are: 0B, 04, FD, F6, EF...

But when I run it in Stella, I get: 0B, 04, FB, F4, ED...

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?

Thank you in advance!

André

-- 
André Wagner <andre.nho at gmail.com>
http://historiacomputacao.blogspot.com



More information about the Stella mailing list