Spacewar! Oscilloscope Game (MSP430)

From Texas Instruments Wiki
Jump to: navigation, search
MSP430 SPACEWAR! Game Running on an Oscilloscope

Much of the talk about the MSP430 is about its low power capabilities. My purpose with this project was to test the raw performance of the MSP430. I also wanted to test the efficiency of the IAR C complier as compared to assembly code. I used a classic game that Larry Bryant and I wrote back in collage in 1974, SPACEWAR. In 1974 SPACEWAR was written for a PDP-11 with 8K bytes of magnetic core memory. The PDP-11 had DAC's connected to an X-Y scope and handmade controllers connected to A2D's. I ported the PDP-11 assembly language to IAR C code. Many modifications were needed to squeeze a minimum game of SPACEWAR into the MSP430F2013 with 2K bytes of flash and 128 bytes of RAM.

The hardware is a MSP430F2013 microcontroller, a TI TLV5618A dual DAC, a handful of resistors, caps, and buttons. The output device is again an x-y scope. The input is from two 4 button hand controllers. The scope's x axis is connected to the brown output wire. The scope's y axis is connected to the black output wire. The scope's ground is connected to the white output wire.

How to Play

The game begins with two rockets on the screen. Rocket 1 is in the upper left and rocket 2 is in the bottom right. The 4 button controllers allow the player to rotate CW, rotate CCW, thrust, and fire torpedoes. Each player has only 2 torpedoes. Sorry not enough memory for more. You win the game by hitting the other rocket with 6 torpedoes. The game score is displayed as a rocket shape for each game you won. I regret that I had to leave out some of the advanced features of the original SPACEWAR such as gravity, black holes, user configuration. I was down to the last few byte of code space and no more ram space. I spent more time squeezing the code that I did writing it.

Hardware Design Files

Custom SPACEWAR Hardware

Schematic & Layout

Source Code