Atari 2600 hardware design: Making something out of almost nothing
bigmessowires.com
bigmessowires.com
My reasons are:
1. The hardware is simple enough that you can completely understand everything that is going on. And you absolutely need to understand it, if you want to make good games. Just a great feeling of power and control.
2. You need to use assembly. Even with 8-bit era computers you don't really need to use assembly. Sure, for performance but for many task even the dog-slow Basic of the C64 could get you far. Not many excuses to write substantial amounts of assembly these days, so I really enjoy the challenge.
3. You are forced towards radical simplicity but the hardware is still strong enough that you can make games people might want to play. Even in 2023.
There are great fantasy-consoles like the pico-8 these days but they don't scratch the same itch for me. I enjoy the historicity of programming for a real and very influential console.
Plus, the 6502 instructions set you learn used to be ubiquitous, giving you a head start if you want to program for the C64, NES, Apple ][ and many more systems.
I recommend using https://8bitworkshop.com/ as you can get an instant feedback loop when developing your game.
I haven't yet finished making a game but I am having great fun!
Heap? Lol you are not doing ANY dynamic allocation of any kind on the Atari 2600.
Also you're not using the stack to pass parameters to routines here either. You might not even use subroutines.
> This pin-reduced 6507 eliminated the 6502’s NMI and IRQ pins, so there was no hardware interrupt capability at all. Everything had to be accomplished with software timing and polling.
STA WSYNC will make the CPU halt until the TIA is at the next scan line. This is the chief video synchronization tool on the Atari 2600. You do have to keep track of the number of scanlines you've generated. Horizontal timing takes care of itself but you need to track that too for various effects.
Well that 128 bytes was in the upper half of page 1 and the 6502's stack was in page 1, but at least one source says that the upper half of page 1 was also mapped to page 0.
I'd guess that at least some programs would push to the stack - if nothing else you could save a byte when storing a byte to memory (PHA vs STA #FF).
"Recently over the holiday break, I became interested in the 2600’s hardware architecture"
"Did I butcher some technical explanation here, or omit important details? Please let me know! I’m just a beginner on this Atari hardware journey, with much still to learn."
I read in a similar article that the branches of the trees are too finely detailed to be drawn with the playfield layer. So, they are added on with sprites.
Looks like the tree branches could be two copies on the left, then two more on the right. Not much going on in that region so plenty of time.
EDIT: presumably this bit: https://github.com/johnidm/asm-atari-2600/blob/8b613f3c4bc80...
I'm guessing because a counter would have ripple carry (i.e. five extra gate delays when rolling over from 111111 to 000000) or need extra gates for carry lookahead and an LFSR is constant-delay.
Some early microprocessors used LFSRs instead of a regular counter for their instruction pointer register for this reason: https://news.ycombinator.com/item?id=8375577
Once the graphics kernel is written, it just a matter of playing with the data that's fed into it.
The real challenge, it seems, it simply that there are so few cycles left over to implement the actual game logic.
I haven’t programmed the 2600, but I expect that, in about every program for the 2600, running out of time for your game logic is unavoidable, and will make you go back to your universal, (relatively) easy to use kernel and tweak it to make it just a little bit faster for your particular use case.
Given that that kernel will be written in tight assembly, I expect that more or less amounts to a rewrite. You’ll use your knowledge f the kernel to write a new one.
You often round robin game logic.
Here's a fun example Castlevania on the NES by timing your movement precisely you can make it skip certain blocks being loaded. Making it leave a stair case or even a door.
Works because alternate even and odd frames responsible for loading different y coords for level data in blocks.
https://m.youtube.com/watch?v=Dw7NkOzp8tE
It might seem like there's no point now..but even in a 120fps game do you need absolutely everything to update at 120hz?
You really do need to get almost all your game loop to fit into vblank, and spend most of the screen on time driving the graphics. NES and other systems with fancier graphics systems kind of inverted the script; on those you run the game loop during screen on, and mostly transfer data to the graphics unit during vblank.
[0] https://forums.atariage.com/topic/330778-part-1-cdfj-overvie...
Luckily your program is running out of ROM so you don't have to load it before you execute, but even with that it's an incredibly tight fit.
It seems incredible, very difficult. And remember, back then cartridges only had 8KB of memory.
This means even more hacks are required, if your game needs more than a few levels. Theres a recurring hn post how Pitfall encoded levels in a single byte (bitfield), then used some sort of sequence generator to allow going back and forth among the 255 levels.
The other thing that starts happening is more buffers and caches appear everywhere as you add I/O, raising your minimum spec. What every system after the 2600 did was add some form of graphics buffer: on the Atari 400/800, with a base config of 16kB it was a mix of a display list program(which automates the scanline tricks of the 2600) and various character and raster modes to give software trade-offs between RAM usage and display fidelity. But even the smallest character mode assumes that you have a few kilobytes available.
8-bit programs, even with larger RAM, are necessarily "right to the point" in terms of what information they are working on. The luxury of larger spec is just in being flexible and allowing more non-essential data to pass through.
I can't recommend it enough!
Atari 2600 Programming: https://pikuma.com/courses/learn-assembly-language-programmi...
Looking at it from some strange angle, it's a tremendous accomplishment.
Anyway he got his bonus so from his point of view all was well.
Does that just mean they take turns ticking with equal interval between ticks?