3 ms·
I survived making an Atari 2600 game! https://github.com/boomlinde/jupitersumo https://github.com/boomlinde/jupitersumo The tricky part is writing the graphics
by boomlinde 11y ago
I survived making an Atari 2600 game! https://github.com/boomlinde/jupitersumo https://github.com/boomlinde/jupitersumo
The tricky part is writing the graphics kernel (which is responsible for updating the one-dimensional screen registers as the beam advances vertically). It needs to be quick, and it's probably not healthy for the programmer trying to incorporate any other game logic into this part.
After the screen has been drawn you have a few lines free for arbitrary code on every frame. You still have to keep track of how many lines have passed to maintain the correct screen frequency and initiate the vertical sync at the right moment, though. There are no interrupts to deal with this, but there is a timer that you can set up and start polling once your game code is finished not to have to think about lines when doing the game logic.
Then there's the sprites... They can be nudged side to side arbitrarily in up to 8 pixel increments, but can only be placed at an absolute horizontal location by waiting for the beam to get there and writing to a register that resets an internal sprite counter. There is no vertical positioning, and you just enable/disable the drawing of the sprite or clear its pattern at the right line.
In my game, I could save a lot of time in the kernel by never explicitly clearing the sprites to produce 2D objects. Instead, as the screen draws lines, it decrements an 8-bit counter which is used to index a table of 256 sprite lines. "Moving" the sprite vertically, then, is just a matter of changing the initial value of the counter.
- anta40 11y agoInteresting. How do you build the code? A quick Google "acme atari assembler" pointed me to: https://sourceforge.net/projects/acme-crossass/ https://sourceforge.net/projects/acme-crossass/ Is this correct?
- kabdib 11y agoThere are tons of 6502 assemblers out there. It's a pretty easy processor to work with. I wrote maybe half a dozen assemblers back in the day (each one better than the last). On a lark, I wrote one in Python a couple of years ago; it's on github (https://github.com/landondyer/kasm https://github.com/landondyer/kasm).
- boomlinde 11y agoYes, that's it.