BootInvaders
A functional Space Invaders clone implemented entirely within a 512-byte x86 boot sector. Written in assembly (FASM) for the BIOS real mode.
Important
This is for educational purposes, demonstrating how to make a bootloader do interesting stuff.
Technical Specifications
- Architecture: x86 (16-bit Real Mode)
- Memory Address: Loaded at
0x0000:0x7C00by the BIOS. - Display: VGA Mode 13h (320x200, 256-color linear framebuffer).
- Video Memory: Direct writes to segment
0xA000. - I/O & Interrupts:
int 0x10: Video services for mode setting and character output.int 0x16: Keyboard services for polling and reading scan codes.int 0x1A: Clock services used for frame timing and pseudo-random seed.0x3DA: VGA Status Register polling for vertical retrace synchronization.
Features
- Double Buffering Simulation: Clears and redraws every frame synchronized with the vertical retrace to prevent flickering.
- Physics & Collision: AABB (Axis-Aligned Bounding Box) collision detection for bullets, enemies, and player.
- Procedural Respawn: Uses the system timer's lower bits to calculate the next enemy X-coordinate.
- Score Tracking: Real-time score display using a custom decimal-to-string conversion routine.
Building and Running
Prerequisites
Commands
# Compile the source to a 512-byte binary
make
# Run the binary in QEMU as a raw disk image
make run
Controls
- Left Arrow: Move Left
- Right Arrow: Move Right
- Space Bar: Fire Bullet
- Any Key: Restart (on Game Over)