6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Jun 03, 2024 8:48 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Dec 27, 2019 5:43 pm 
Offline

Joined: Fri Nov 16, 2018 8:55 pm
Posts: 71
I've always thought that the 6502's status registers "lived" inside of the CPU itself and did not require RAM on the data bus. But, then I discovered that on the C64 the status flags reside in a single byte of RAM at memory address $30F. At which point I though, "Oh, I was wrong and the CPU needs one byte of RAM on the system's data bus to represent its internal state."

Much more recently, I was reading over the memory map of the Atari 2600 and noticed something strange. I don't see an analogous memory location to that of the C64 where the CPU registers are exposed to the system bus. Obviously, that's a MOS 6507 in the Atari VCS which changes a few things. In any event, I'm confused.

Which is it?

  1. Are the CPU registers internal to the CPU alone?
  2. If so, why does the C64 place them outside (or copy them) outside of the CPU itself?
  3. If not, where is the analogous location that holds the processor's state on the Atari 2600?
  4. Or, is there an option here I haven't considered that would make this all make sense?


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 27, 2019 6:16 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3363
Location: Ontario, Canada
load81 wrote:
Or, is there an option here I haven't considered that would make this all make sense?
Hi, load81. No, you're alright -- asking all the right questions. :)

Quote:
2. If so, why does the C64 place them outside (or copy them) outside of the CPU itself?
The CPU registers are internal to the CPU, and a program can also copy them to memory.

Why? I'm not expert on C64, but the KIM-1 (and other machines, I'm sure) sometimes copy the registers to memory for debugging purposes -- for example, to single-step through a program. In this scenario you have two programs -- the debugger program and the program under test. After each single step, the register gets copied to memory by the debugger, and from there it can be displayed and/or altered. When it's time to do another step memory gets copied back to the register beforehand. So, in the single-step scenario what's in memory is just a snapshot used for human reference. I believe that's what was meant by your source which said the C64 the status flags reside at address $30F. HTH!

cheers
Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Fri Dec 27, 2019 6:24 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 27, 2019 6:24 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
1. The status register is internal the the CPU and uses no memory.
2. BASIC on the C64 loads and saves the registers from memory $30c-$30f when the SYS command is used.
3. No.
4. An application may choose to store a copy of the status flags in memory, but most applications won't need to do this. The flags are more often pushed to the stack for temporary storage while some other action that would affect thier state is carried out.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: