Project
Course Unit: Computer Laboratory (LCOM), 2nd year
Course: Master in Informatics and Computing Engineering (LEIC/MIEIC)
Faculty: FEUP (Faculty of Engineering of the University of Porto)
Project evaluation: 19/20
The objective of this project was to develop a complete, fully functional game from scratch by writing low-level hardware device drivers for the Minix 3 operating system.
Space Invaders was built bypassing standard operating system APIs and instead interacting directly with the PC's I/O ports and interrupt controllers.
![]() |
![]() |
The project was structured using the Model-View-Controller (MVC) architectural pattern to separate the game logic, game state, and low-level hardware interactions.
All hardware interaction was written in C, handling hardware interrupts (IRQs) and I/O port reading/writing:
- Video Card (VBE): Configured the VBE graphics mode
0x105(1024x768). We implemented functions to map physical memory to the process's virtual address space, handle double-buffering, and drawXPMsprite images pixel-by-pixel. - Keyboard (KBC): Implemented an interrupt handler to read scancodes from the keyboard output buffer. This provides real-time, zero-latency inputs for moving the spaceship (Left/Right arrows) and firing lasers (Spacebar).
- Mouse (PS/2): Configured the mouse to enable data reporting, parsing the 3-byte data packets upon interrupt. This allows the player to seamlessly navigate and click through the game's menus.
- Timer (i8254): Programmed the programmable interval timer to generate interrupts at a specific frequency (sys_hz), driving the game loop, frame rendering, and entity movement updates at a steady frame rate.
- Real-Time Clock (RTC): Handled RTC interrupts and read from its registers to keep track of the current real-world date and time. This data was used to timestamp high scores in the Leaderboard system.
-
Model (
src/model): Contains the game state and data structures. It stores thePlayer,Monster,Bullet,Cursor, andMenustates. Every visual element inherits a baseDrawableObjectstructure with position coordinates and an assigned XPM image. -
Controllers (
src/controllers): Centralizes the core gameplay loop. It handles state transitions (Main Menu$\rightarrow$ Game$\rightarrow$ Game Over$\rightarrow$ Leaderboard), processes hardware interrupts, updates entity positions, and calculates bounding-box collisions between lasers, monsters, and the player. -
View (
src/devices/video.c): Renders the current state of the Model to the screen on every timer tick, clearing previous frames and drawing updated XPMs to give the illusion of smooth movement.
To play the game, you need to compile and run it within a Minix 3 virtual machine with the LCOM framework installed.
- Open the terminal and navigate to the directory containing the
Makefile(proj/src/). - Clean previous build files:
make clean
- Compile the project:
make
- Run the compiled executable using the LCF framework:
lcom_run proj
Language: C
OS: Minix 3.1.8
Tools: LCF (LCOM Framework), Make, Doxygen (Documentation)
- Adriano Machado (up202105352@fe.up.pt)
- José João (up202108818@fe.up.pt)
- Luís Cunha (up201709375@up.pt)
- Rodrigo Ribeiro (up202108679@fe.up.pt)

