Skip to content
This repository has been archived by the owner. It is now read-only.
A dodge obstacle game written in MU0 Assembly for COMP12111 final lab.
Assembly Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

6 Display Runner

MU0 Assembly Game



The game was inspired by the old games, usually found on cheap devices for "gaming". The purpose of the game is to dodge the incoming "cars" by moving up or down. There are four difficulties randing from EASY to IMPOSSIBLE. You can get hit 3 times as there is a health system (displayed on the bar graph). The game also has background sounds and diffrent sounds for each action.

Game Guide

Start of game

When the FGPA Board first loads, press one of the difficulty selection buttons 1 2 3 X Buttons on the keypad in order to start the game. The bar graph (top right with 10 segments, only 8 working) will light up from the left to the right. When the loading time ends, the game will start by spawning diffrent obstacles on the right. You are the left most display.


Marked with P is the Player, marked with X are obstacles, marked with _ will be empty spaces.

Difficulty Level Layout Description
1 P____X Spawn only one obstacle at a time
2 P__X_X Spawn two obstacles
3 PX_X_X Spawn three obstacles
X PXXXXX Fill all the possible displays with an obstacle


Health is displayed on the Bar Graph at the start of the game (after difficulty selection). The starting default health of the player is three (3). After each hit with a obstacle, the bar graph will turn off one segment. If the health is one (1) and the player gets hit, the game is over, the board plays a sound and restarts to the difficulty selection menu.


Each game has a sequence of a given size (6 by default) that is randomly generated by a Python script (MU0PAL). After the program has passed the sequence once, it will start looping the same sequence. All obstacles get spawned on dp0, the digit on the right, and shift every delay to the left. Your goal is to the dodge the obstacles for as long as possible.


After loading the program on the FGPA Board, you will have to select a difficulty (Start of game). After that your player gets spawned and obstacles start appearing. You can move your player in two dirrections:

  • UP, by pressing the left switch
  • DOWN, by pressing the right switch

Both switcehes can be found on the top, left side of the FGPA Board. Pressing both buttons at the same time will not move the player.


MU0 - Micro Processor

MU0 Has a small limited set of instructions.

Code Mneomonic Use Description
0000 LDA LDA S Load the value S into the ACC
0001 STA STA S Store the value from ACC into S
0010 ADD ADD S Add S to ACC (ACC = ACC + S)
0011 SUB SUB S Sub S from ACC (ACC = ACC - S)
0100 JMP JMP S Set the PC to the value of S
0101 JGE JGE S Set the PC to the value of S if ACC >= 0
0110 JNE JNE S Set the PC to the value of S if ACC != 0
0111 STP STP Stop the program from running.

COMP12111 - Lab FGPA Board


The following memory locations have been alocated for accessing the FGPA Board features:

EQU Feature Address Description
kr1 KeyRow 1 &FEF Using the AC button for sending the KILL signal to the system.
kr3 KeyRow 3 &FF1 Using the 1 2 3 X buttons for choosing difficulty.
kr4 KeyRow 4 &FF2 Using the RESET button to FLUSH the displays and SHIFTfor tests.
ksw Switch &FEE Using the two switches for moving the player (display5) up or down.
bzz Buzzer Input &FFD Used for playing "music".
bsy Buzzer Busy &FF3 Decide if buzzer can play the next sound.
dgb Graph Bar &FFE Display loading times.
EQU Display Address Description
dp0 0 &FF5 Obstacle
dp1 1 &FF6 Obstacle
dp2 2 &FF7 Obstacle
dp3 3 &FF8 Obstacle
dp4 4 &FF9 Obstacle
dp5 5 &FFA player

Memory Labels

DEFW Type Description Default
nul constant Constant decimal value 0x0
one constant Constant decimal value 0x1
six constant Constant decimal value 0x6
top signal Seven-Segment Decoder signal for top segment 0x1
mid signal Seven-Segment Decoder signal for middle segment 0x2
bot signal Sever-Segment Decoder signal for bottom segment 0x3
fff constant Bar Graph full display, turn on all 8 segments 0xFF
php variable Store the health value of the player, used for the bar graph 0b0111
ph3 constant Used to set player health to 3/3 0b0111
ph2 constant Used to set player health to 2/3 0b0011
ph1 constant Used to set player health to 1/3 0b0001
hlt signal Default (1), goes to (0) on halt 0x1
krt key Key value of Reset on KeyRow 4 0x80
kst key Key value of AC on KeyRow 1 0x02
ksa key Key value of C on KeyRow 1 0x04
ksf key Key value of Shift on KeyRow 4 0x40
df1 key Key value of 1 on KeyRow 3 0x20
df2 key Key value of 2 on KeyRow 3 0x10
df3 key Key value of 3 on KeyRow 3 0x08
dfx key Key value of X on KeyRow 3 0x04
tmv switch Key value of left switch move up 0x01
bmv switch Key value of right switch move down 0x02
mmv switch Key value of both switches, move middle 0x03
dly delay Global delay time for each loop 50000
dlc delay Initial load screen number of loops 0x7
dlp delay Skip/Input number of loops 0x2
sqc sequence Count current sequence, added to sequence jump 0x0
sma sequence Max sequence count, used as max limit 0x6
dff variable On start/restart store selected dificulty 0x0
jop operation Value of JMP jump operation 0x4000
spr sound Reset sound 0b1000010001001000
sht sound Stop sound 0b1000010000010001
sdu sound Move up sound 0b1000001001010110
smd sound Move down sound 0b1000001000110110
sgo sound Hit sound 0b1000001000010000
sbm sound Background (every tick) sound 0b1000001000100011
Label Description
mrst Reset or Stop the program based on hlt
mlal Set the value of all displays (dp) to the value in ACC
mtop Move the player (dp5) up by one segment
mbot Move the player (dp5) down by one segment
shift Move contents of obstacle displays to the left by one, then spawn next (mcemp)
mcemp Check the status of each display based on dff then jump to sequence
mhit On player collision with obstacle, check health (php) and substract one bar or reset game if dead
You can’t perform that action at this time.