Adding Force Feedback to Combat

by Chris Kirmse
Porting Stella to the PlayStation 2/Linux environment was fairly easy, so I wanted to add something special that no other Stella port has--force feedback added to a 20 year old game.

I decided to add force feedback for moving (a low rumble), firing (a quick kickback), and of course, getting hit (big long rumble). My initial plan was to look for sprite collisions in one or more registers of the TIA chip. It seemed to work, but then I realized that it was only registering when your tank is blown through the sides or top/bottom of the screen. I then looked in main RAM to look for key events.

Here's the interface I used. The first row shows the frame drawing time (irrelevant here), followed by the TIA registers, the M6532 registers, and then 8 rows of 16 bytes each of RAM--that's right, the Atari 2600 had only 128 bytes of RAM! You can see this display by hitting L3 on your control pad.

By moving, firing, and getting shot while watching RAM, it was possible to determine certain key locations in memory:

  • A is a time-to-live counter for player 1 and player 2's bullets. It is set to 0x3d when the player shoots, and the bullet is deleted when this location counts down to 0 (or when there is a collision with the opponent).
  • B has something to do with player movement. It is set to 0x80 when each player is actually moved forward.
  • C is a copy of the score. When the score is increased from its value the previous frame, the other player was shot.
  • D is a state value for the cartridge. It is 0x2c, 0x3c, 0x9c, or 0x98 during play of the various games supported by the cartridge. Any other value means that the user is selecting a game. This is used to suppress force feedback events when users aren't the cause of the movement or collision.

After figuring out these locations, I added support in the program to look at the emulated memory and play the appropriate force feedback events when movement, firing, and hits are detected. After years of making sound effects when making a hit while playing Combat, I can finally be quiet and let my opponent's controller do the talking for me!