Back to Projects

Pong

Bootable Pong written in 16-bit x86 assembly with no OS underneath: the BIOS boots the disk image straight into the game, which runs in VGA text mode in QEMU or on bare metal.

Architecture Overview

A 512-byte boot sector loads about 2 KB of game code to 0x7E00; the game is split into NASM modules (boot, main loop, game logic, video, sound, timer, keyboard) joined with %include into a single flat binary padded to a 1.44 MB floppy image.

Key Challenges

Doing everything without an OS or libraries: owning the interrupt vector table, timing frames off the PIT with HLT, and latching key presses in the ISR so taps shorter than a frame are not dropped.

Security Considerations

Not a security-focused project; it runs as the only code on the machine in real mode, with no network, file system, or user data.

Future Improvements

Possible next steps: a mode 13h graphics version with sub-cell ball movement, and a single 512-byte boot-sector edition.

Technical Impact

  • Built a bare-metal Pong game in NASM x86 real-mode assembly, booted by a hand-written two-stage boot loader that loads the game from disk with BIOS INT 13h.
  • Replaced the BIOS keyboard and timer interrupt handlers with custom IRQ1/IRQ0 ISRs, tracking per-scancode key state and reprogramming the PIT to drive a 60 Hz game loop.
  • Implemented double-buffered rendering to VGA text memory, PC speaker sound via PIT channel 2, and a beatable CPU opponent alongside local two-player mode.
  • Tested the game headlessly through the QEMU monitor (scripted keypresses and screen dumps), which caught and fixed keypresses lost between frames.