Summary of SpaceInvaders Video Game Using Mega32
This project implements the classic Atari Space Invaders game on an MEGA32 microcontroller. To prevent TV flicker, the developers utilized hardware interrupts to manage sound separately from the screen refresh cycle. The system generates a 128x100 pixel display where 30 invaders are rendered over 10 frames per update cycle. Each invader measures 10x8 pixels arranged in a 6x5 grid. The software supports a points system, tracks player deaths and invader landings, and handles multiple levels.
Parts used in the Space Invaders Game:
- MEGA32 Microcontroller
- Hardware Interrupts for Sound
- TV Paint Interrupt
- Points System
- Player Death Logic
- Invader Landing Logic
- Level Management System
- Barrier System
- Bullet Movement Logic
- 128x100 Pixel Screen Generation
Introduction
Our final project is the classic Atari version of spaceinvaders on the MEGA32. The story: A horde of space invaders are attempting to land on the planet’s surface. You play a heroic pixilated thing on the ground trying to stop them one bullet at a time. It wasn’t Half Life, but eh… it was the 80s.
The real challenge is implementing the game without television flicker or artifacts. With the MEGA32, we use “hardware interrupts” so that sound can easily be played without interfering with the TV paint interrupt. A simple points system and basic gaming mode functions- such as player “deaths”, invader landings, and subsequent levels- are of course supported.
High Level Design
General Considerations:
How big of a screen do we have to work with (in pixels)?
o We can easily generate a 128 by 100 pixel screen using the MEGA32
• Can we write all of the invaders to the screen in one frame cycle?
o No. It turned out that we needed 10 frames to write all 30 invaders to the screen. We write 3 invaders per frame, plus update bullets, player movements, and barrier changes. Attempting to write more than 3 invaders to the screen every frame (along with player logic etc…) leads to flicker.
• Resolution of one invader?
o We decided the classic Atari invader pixel dimensions were necessary for nostalgia purposes, so the dimensions of the invaders are 10 pixels by 8 pixels.
• Number of invaders per round?
o We decided that a 6 by 5 array of invaders was sufficient at this resolution
For more detail: SpaceInvaders Video Game
- What resolution does the MEGA32 generate for this game?
The MEGA32 generates a 128 by 100 pixel screen. - How many frames are required to write all invaders to the screen?
It takes 10 frames to write all 30 invaders to the screen. - How many invaders are written per frame?
Three invaders are written per frame along with updates for bullets and barriers. - Why was the 128 by 100 pixel resolution chosen?
This resolution can be easily generated using the MEGA32. - What are the dimensions of one invader?
Each invader is 10 pixels by 8 pixels. - How many invaders are in each round?
There is a 6 by 5 array of invaders, totaling 30 per round. - How does the project avoid television flicker?
The project uses hardware interrupts so sound plays without interfering with the TV paint interrupt. - What gaming mode functions are supported?
The system supports player deaths, invader landings, and subsequent levels.


