DtY Posted April 23, 2014 Share Posted April 23, 2014 I am trying to write an Atari 2600 emulator as a summer project. I'm reading everything I can find on the hardware, and after reading lots about the 6502 decided to start with a premade generic 6502 emulator since there's nothing particularly exciting in there, but a lot of stuff that would be tedious to program (manually checking if there was an overflow and other status flags that C doesn't give you direct access to, as well as writing everything twice thanks to its BCD mode). Anyway, I've come across a very strange problem. The 6502 puts the bottom of the stack at address $01FF, but the 2600 has all of its memory in the zero page. In Stella I can see that the bottom of the stack is in fact at $00FF. How is this handled in the Atari hardware? My approach right now is to mirror the RAM on page 1. As far as I can tell, this won't cause any problems, but is this how the original hardware handles it? With only 128 bytes of RAM, it makes a lot of sense to put it in the zero page, why is it that the 6502 puts it on page one? Thanks. Quote Link to comment Share on other sites More sharing options...
iesposta Posted April 23, 2014 Share Posted April 23, 2014 Interesting question, beyond my knowledge. It's oddly quiet here this Tuesday Wednesday. I like to think of the VCS as a 3 chip system. A processor, the 6507. The signal maker for sound and video, the TIA. And the input output, the RIOT chip. RIOT just happens to have 128 bytes of RAM, there are no "memory chips." I can't add much more than that. Hope you get an answer as I'll learn something too. Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 23, 2014 Share Posted April 23, 2014 The RAM, RIOT and TIA I/O registers of the 2600 are mirrored in various places due to the simplified nature of memory select logic. Conveniently, the RAM appears at $80-$FF as well as $180-$1FF (and other places) which is where the top half of the stack is for a 6502. Of course, you can't use the entire 128 bytes for either work or stack, it's up to the programmer to decide how much to dedicate to each then ensure the stack doesn't grow too big. 6507 doesn't accept Interrupts which helps out a little. For an emulator to be accurate, you'd probably want to replicate the memory configuration of the default system. Then of course there's also the various banking schemes used by carts. It's something you could tackle later - most of the early games only used a single bank. Quote Link to comment Share on other sites More sharing options...
DtY Posted April 23, 2014 Author Share Posted April 23, 2014 Thank you! My goal right now is to emulate combat, which is just a run of the mill 2k cart. Eventually, I want to run the emulator on an arduino, wired to an actual cartridge. And then the cartridge itself can take care of banking. What is RIOT, generally? Is it like a less capable BIOS? Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 23, 2014 Share Posted April 23, 2014 2600 doesn't have any BIOS, in fact no ROM built in except those few editions with the built-in games. RIOT = RAM, Input, Output, Timers - it's a MOS special-purpose chip, a cheaper alternative to having dedicated RAM and general-purpose I/O + Timer chip such as a VIA or CIA. As it happened, Atari became the biggest customer by far (Gottlieb also used it in a couple of their pinballs). Atari used it in the 2600 as well as some of the peripherals for the 8-bit computer. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted April 23, 2014 Share Posted April 23, 2014 There were a number of chips called "RIOT," which I presume were all variations of each other (similar to the way the 6507 and other CPUs were variations of the 6502). The specific RIOT chip that the 2600 used is the 6532. You can find documentation for it (pinouts and other specs) at the http://www.6502.org web site. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.