15 ms·
The book "Racing the Beam: The Atari Video Computer System" is a pretty interesting overview of the technical challenges they had to overcome. The racing part c
by fred_is_fred 6y ago
The book "Racing the Beam: The Atari Video Computer System" is a pretty interesting overview of the technical challenges they had to overcome. The racing part comes to having to have the frame ready to paint before the CRT beam drew them.
- EvanAnderson 6y agoI hate to nitpick, but I think it's more interesting to think about it as it actually is. You mentioned having the "frame" ready, but there is no frame. The platform has produced some masterpieces of creativity under limitations. You have 128 bytes of RAM to work with (for all non-register variables and stack) and slavish timing requirements. The timing is nightmarish because you're actually controlling the painting of each scanline as the raster sweeps across and down the screen. The design of an Atari 2600 game's "kernel" (as they're called) is one where timing and cycle counting dominates. Game logic has to sit in specific points in time where the video raster isn't painting (horizontal and vertical blanking intervals). When the raster is sweeping across the phosphors your code is concerned primarily with manipulating the registers of the Television Interface Adapter (TIA) chip to produce the desired video output. There are some "tricks" the TIA can perform itself (mirroring the playfield output across a vertical center line, etc) that can be used to free up some cycles. Creative use of the 5 movable objects (two "player" sprites, two "missile" sprites, and a "ball" sprite) can be used to make more detailed graphics than would be possible with the playfield alone (which has a fairly coarse resolution).
- pwg 6y ago> The platform has produced some masterpieces of creativity under limitations. You have 128 bytes of RAM to work with (for all non-register variables and stack) And as the CPU was a 6502, you had three 8-bit registers within the CPU, one 8-bit accumulator and two 8-bit index registers.
- T-hawk 6y agoOn the 2600, you can use a fourth register, the stack pointer. The 2600 as a machine has no interrupts, so if a section of code doesn't push/pop/call anything, stack memory is never touched and you can do whatever you want with the stack pointer register. There's more tricks with the stack pointer on this machine too. Set it to point to the top of a sequence of video registers, and then you can rapidly write values to that sequence of registers just by issuing push instructions, which are faster than load/store/decrement!
- EvanAnderson 6y agoThat stack trick is ingenious. I've done next to no 2600 programming but I've done enough 6502 to appreciate that one. I am remound of the perennial HN favorite: http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html http://blog.moertel.com/posts/2013-12-14-great-old-timey-gam...
- T-hawk 6y agoI'll give you more detail of one way to use that trick then. The single-bit missile and ball objects are turned on or off by writing to their activation register, controlled by bit 1 of that register. Why bit 1, why not 0 or 7? Because that lines up with the zero flag in the 6502's flags register. What you do is set the stack pointer to that video register, compare on the object's Y-coordinate, then push the flags register to turn the object on or off! So the code needs no shifts or conditions or branches. It's even cycle invariant which is a great property on this machine. The video hardware was deliberately designed to do this (by chip legend Jay Miner), and Combat's code does. Also, the registers for the two missiles and the ball are adjacent, so you can do this trick to all of them in succession without resetting the stack pointer.
- EvanAnderson 6y agoThanks for sharing that. That's a neat piece of trivia. I'm already very impressed by Jay Miner's work, and this just adds to that. It makes sense that the TIA would be designed hand-in-glove for the 6507. BTW - I saw in your other comments that you wrote INV+. This counts as my little brush with "celebrity" for the day. >smile<
- TigeriusKirk 6y agoThere's a small hobbyist community programming for the 2600 these days. Even releasing new game cartridges! https://atariage.com/2600/programming/index.html https://atariage.com/2600/programming/index.html