Custom Atari 2600 Code on vintage E7 Cart
Running Anachronistic Demakes on Vintage Atari VCS Hardware
Custom Atari 2600 Code on an actual E7 Cartridge
TL;DR
I wanted to run a modern "demake" of Myst for the Atari 2600/VCS<br>on actual vintage 1980s cartridge hardware.<br>The target was the M-Networks "E7" chip that allowed 16k of ROM and<br>2k of RAM, but it turns out possibly no one had ever used all 2k of RAM<br>before. In theory it should have been as easy as getting a Burgertime<br>cartridge, swapping out the ROMs with my code, and upgrading the SRAM<br>chip from 1k to 2k. This turned into a multi-year ordeal but in the<br>end (spoiler) I did get it working.
Background on the Myst demakes
As a fun followup to my
Apple II Myst demake I thought I would see how much of the game I<br>could fit on the much more hardware constrained Atari 2600/VCS.<br>As a reminder,<br>the original MYST was one of the first CD-ROM games with hundreds<br>of megabytes of pre-rendered graphics, and generally Atari 2600 cartridges<br>maxed out at 4k, maybe 32k if you did complex bank-switching.
The
Atari VCS version ended up being a limited subset of the original game<br>(although the full speedrun route is possible).<br>This version ended up unexpectedly popular and
got a lot of press coverage.
Running on a Harmony Cartridge
The demake was developed on Linux and tested via the Stella emulator.<br>It does run on real hardware.<br>You can test it with the Harmony Cartridge, with is an emulated<br>cartridge that can run ROM files off of an SD card.<br>I also had a custom cartridge made, but this one too is emulated with<br>a Melody board which is similar to the Harmony cartridge, just running<br>the ROM off of flash.
These cartridges have 70MHz 32-bit ARM microcontrollers<br>on them handling the bank-switching and other signaling needed to<br>emulate high-end cartridge mappers.<br>This is great for development, but<br>not something that would have been available back in 1977 when the<br>console debuted. In fact the ARM chip inside of it would have had<br>workstation to supercomputing amounts of power back then.
I began wondering, could I get Atari 2600 Myst running using<br>1980s vintage technology without any ARM micro-controllers?
Fitting Myst into a 16k Cartridge
The Atari VCS lasted a long time, and toward the end of their run<br>companies started using advanced bank-switching to fit more ROM onto<br>a cartridge than the natural 4k limit.<br>The Atari VCS/2600 has the 6507 processor in it, which is a 6502 chip<br>but in a smaller package to save money.<br>It only has enough address lines to access 8k of memory,<br>but the A12 line is used to select between internal addresses and<br>the cartridge which limits programs to 4k.<br>Most early games<br>were 2k or 4k ROMs, but that quickly turned out not to be enough so<br>later various mapper schemes came up to bank-switch larger amounts of<br>storage into the address space..
Back in the 1980s you could get cartridges that mapped up to 32k<br>of ROM.<br>Generally chunks of ROM could be bank-switched after accessing<br>special soft-switch memory addresses.<br>Coding for this could get exciting if you were swapping the ROM<br>out in the middle of executing code from it.
The Atari VCS only had 128 bytes of general purpose RAM built in.<br>So just half of the 6502 zero page, and it was also shared with the stack.<br>Some cartridges added extra RAM too, though that was complicated because<br>the cartridge slot did not have the 6502 read/write line available.<br>The way developers got around this was by reserving some address space<br>for reads, some for writes.<br>So you might have a 1k region and so storing to the bottom half would<br>write the value to RAM, whereas if you wanted to read you'd read from<br>the top half, and extra logic involved made sure the read/write<br>pins got set properly for the RAM chip.
To fit as many scenes<br>from Myst as I could I needed to use compression, but due to the race-the-beam<br>nature of the graphics it would be much easier if I could decompress the<br>graphics to a staging area bigger than 128 bytes.<br>When you enter a new level the compressed graphics data is copied to<br>the 256-byte RAM window. Then the ROM is swapped out and the 1k<br>RAM range is banked in, and the 256-byte RAM is decompressed to the 1k<br>range.
The E7 M-Network "Big Game" Mapper
For Atari VCS MYST I picked the E7 "Big Game" mapper from M-Networks<br>(Mattel).<br>Released in 1983, this chip could not only handle 16k<br>of ROM, but also it (in theory) supports up to 2k of RAM.<br>Your primary ROM was 1.5k at the top of the address space that<br>is always mapped in.<br>By hitting a set of soft-switches near the end of memory you could<br>map in 7 different 2k chunks of ROM at the bottom of the address space.<br>You can also swap in 256 bytes of RAM in the remaining 512 byte<br>space (the bottom half for writes, top for reads).<br>Finally, instead of ROM, you can bank-switch in an additional 1k<br>of RAM to the bottom address space.
This mapper seemed like a good fit for the Myst demake.<br>The question was where I could get such a chip?
In the table below you...