[back]
Atari 2600 animated sprite example (in 6502 assembly language)
I wrote a small Atari 2600 game in the past, but I used batari Basic, which hides all the legendary complexities of programming the Atari 2600 hardware.

To gain more knowledge on this topic, I created this animated sprite example. A sprite is animated on-screen, and the joystick can be used to move it.

Writing an Atari 2600 homebrew game is a complex exercise in CPU timing. Here are some of the aspects new to me which had to be overcome:
  • working with finely adjusted sprite X position
  • "setting" sprite's onscreen X position by means of CPU timing
  • tightening show/no show sprite code such that its position is controlled while remaining fast enough that it does not distort the sprite
  • spreading out computation (checking input, recalculating sprite position) across vertically blanked (invisible) scanlines, to keep the code which executes during visible scanlines as fast as possible
  • when to set the background's colour so that the scanline is not incompletely coloured

Downloads

anisprt ROM - the 4kb ROM that can run in many Atari 2600 emulators (like Stella or z26), or on real hardware via an EPROM
source code and development kit - unzip anywhere and run the make.bat file inside the anispr directory to build the ROM

Here is the program running on real hardware:


This is the book on which I relied to learn about the 6502 processor: