Project Name: SKPIC32-based Experimental Mini-Game using VGA and 1-bit colour.
Author/Designer: Y H
Project Description: As on the title, it is a experimental mini-game with 1-bit colour.
Due to the very short time of the creation, some parts of the game do not resemble the original "Space Invaders", like the barriers, "mystery saucer" and explodable alien projectile. Earlier games written during late 70s may only contain simple structured programming and many state machines, and this is also an attempt to imitate the progress but using high level language.
The laser shooter is controlled by the player through the PS2 Analog Joystick by Cytron, and the analog values are decoded in in the microcontroller on the fly.
The VGA part is controlled directly by taking advantage of the "Output Compare" modules in the PIC32, and all the Horizontal Sync and Vertical Sync are precisely timed. The horizontal drawing is done by using SPI, hence the 1-bit colour. An attempt to use partial shades and halftones are done but due to the PIC32's high-speed cache, this cannot be written in assembly code as each instruction in this MIPS processor has inconsistent number of cycles.
The system "paints" the screen from the frame buffer stored in the SKPIC32's RAM. As it has a lot of it, two frame buffers are used and double buffering is used to reduce screen tearing artifacts. Instead, while waiting for another vertical sync to happen, the system processes the logic of the game and such, so the maximum frame rate will be only limited to 30FPS. The resolution of the video is 432x480, and that resolution chews up 40% of the PIC32's available RAM.
Other attempts on the video was done using composite video, but unsuccessful due to the complexity of the signal itself. As a result, I broke a few fingernails trying to connect the thing to the TV.
There is no sound for now - as this is an experimental and a proof-of-concept build. The sound generated in the original Space Invaders arcade might be using completely analogue components. Modelling squarewaves and simple noises can be simply done in a PIC16F.
On the aliens returning fire - it is based on a random number generator. However, sometimes the thing is a bit wonky at times - some aliens can shoot a few times in a row until it is gotten rid of.
Photo:
Compiler: MPLAB X IDE v1.10, MPLAB XC32 (latest)
Source code: Attached below.
Schematics:
Video:
Note: All of the functions are lumped into one C file. I will seperate these functions in a later revision.