The MIPS Binary Game is an interactive game written in MIPS assembly that helps users practice converting between decimal and binary numbers. The game is structured into 10 levels, where each level contains a number of problems equal to the level number. This results in a total of 55 problems throughout the game.
For each problem, the game randomly selects one of two modes:
- Binary to Decimal
- Decimal to Binary
All problems are randomly generated at runtime. This project was developed as part of a Computer Architecture course and demonstrates low-level programming, modular design, and correct register usage in a MIPS environment.
- Each correct answer awards 10 points
- Incorrect answers do not deduct points
- The correct answer is displayed after an incorrect attempt
- Maximum possible score: 550 points (55 × 10)
The program is organized into modular assembly files to improve readability and maintainability: src/
├── main.asm # Main game loop, level control, scoring
├── binary2decimal.asm # Binary → decimal conversion logic
├── decimal2binary.asm # Decimal → binary conversion logic
├── validation.asm # Input validation routines
├── syscalls.asm # Named syscall helpers for readability
Additional documentation: docs/
├── User_Manual.pdf
├── Project_Report.pdf
- Displays the welcome message
- Controls level progression
- Randomly selects the problem mode
- Calls the appropriate conversion module
- Handles scoring and end-of-game output
- Generates a random decimal number in the range 0–255
- Converts the number to an 8-bit binary value
- Displays the binary using ASCII-art boxes
- Prompts the user for the decimal equivalent
- Validates input and checks correctness
- Generates a random decimal number in the range 0–255
- Prompts the user to enter an 8-bit binary number
- Validates that the input contains only
0and1 - Converts the binary input to decimal and checks correctness
- Validates decimal inputs (range 0–255)
- Validates binary inputs (only 0s and 1s allowed)
- Prompts the user to re-enter invalid inputs
- Modular program design in MIPS assembly
- Loop and branch-based control flow
- Proper register usage (
$sregisters for persistent state) - Random number generation using
SysRandIntRange - ASCII graphics using
+,-, and| - MIDI sound effects using syscall 31
-
Binary comparison logic:
Binary input was stored as a string, converted to decimal character-by-character, and compared against the generated value. -
Register usage bug:
Level progression failed when stored in a$tregister. Switching to a$sregister fixed the issue. -
Bit-length error:
An off-by-one loop counter caused incorrect bit generation and was corrected. -
Syscall assembly errors:
Errors caused by MARS assembling helper files separately were fixed by disabling Assemble file upon opening and includingsyscalls.asmonly inmain.asm.
- ASCII-based game board for displaying numbers
- Level transition banners using
= - MIDI sound effects for game start and end
- Custom welcome and ending melodies
- Designing modular programs in assembly language
- Managing control flow and persistent state using registers
- Validating user input at the assembly level
- Debugging low-level syscall and assembly issues
- Structuring non-trivial MIPS programs cleanly
- Add a timer for each question
- Implement a graphical interface
- Save and display high scores
- Deduct points for incorrect answers
This project was originally developed for a Computer Architecture course and is shared for educational and portfolio purposes.