[stella] Reading T1024T?
seagtgruff at aol.com
seagtgruff at aol.com
Sun Jan 6 21:36:59 CST 2008
I figured it out. It's either a "mistake" or a "clever trick," depending on your point of view. My opinion is that it's a mistake, but others might disagree.
"LDA T1024T" apparently has the same effect as "LDA TIMINT." It's actually reading TIMINT-- or mirror of TIMINT-- rather than T1024T. When you do "LDA T1024T," you get $00 as long as the timer is still counting down, and then you get $80 once the timer has finished counting down-- i.e., the same thing as if you did "LDA TIMINT." You can see this happening by watching the program execute in Stella's debugger.
The 6532 addressing for T1024T and TIMINT are as follows:
T1024T = RS 1, R/W 0, A4 1, A3 (a), A2 1, A1 1, A0 1
TIMINT = RS 1, R/W 1, A4 -, A3? - , A2 1, A1 -, A0 1
(a) A3 0 to disable timer interrupt
??? A3 1 to? enable timer interrupt
As you can see, they're identical except for A1, A3, and A4--?which?are ignored for TIMINT-- along with R/W. Note that the R/W line isn't part of the address per se, at least I don't think it is.
Consider the two addresses, T1024T and TIMINT:
T1024T = $0297 = %0000 0010? 1001 0111
TIMINT = $0285 = %0000 0010? 1000 0101
Since the only differences between them are in bits that are ignored by TIMINT, the "LDA T1024T" instruction-- which sets the R/W line high for reading-- is actually reading a mirror of TIMINT.
Personally, I think it would be less confusing to just use "LDA TIMINT," which is why it's my opinion that this is a mistake rather than a "clever trick."
Michael
-----Original Message-----
From: Dennis Debro <dennis at debrofamily.com>
To: 'Atari 2600 programming list' <stella at atari2600.org>
Sent: Sun, 6 Jan 2008 8:38 pm
Subject: Re: [stella] Reading T1024T?
Hi Michael,
> So I guess it must have been a programming mistake.
I don't think it's a mistake. Tracing this routine shows that the programmer
used it to determine when the timer expired. I, like you, didn't think you
could do this as it's documented as a write register only.
So apparently the register will go high when the timer expires. I don't
understand this unless I'm reading the 6532 datasheet wrong.
Take care,
Dennis
_______________________________________________
Stella mailing list
Stella at atari2600.org
http://atari2600.org/mailman/listinfo/stella
________________________________________________________________________
More new features than ever. Check out the new AOL Mail ! - http://webmail.aol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://atari2600.org/pipermail/stella/attachments/20080106/5db052e4/attachment.html
More information about the Stella
mailing list