I have played with Operating Systems and their workings by customizing them and tweaking their behavior. But this was about pushing constraints to the extreme. Can I have an OS which just loads one PONG GAME ?
The challenge
No operating system.
No drivers.
No libraries.
Just raw x86 assembly, BIOS interrupts, and the video memory at 0xB800.
The boot sector is the first 512 bytes a computer loads from disk. It has to end with the magic bytes 0x55 0xAA β leaving only 510 bytes for actual code.
Player paddle (W/S keys)
CPU opponent
Ball with velocity
Scoring
Color toggle (C key)
Full reset (R key)
After learning about Operating systems and the bootup flow, I finally managed to get a pong game running π
How it works!
The game runs in 80x25 text mode (VGA mode 03h) using BIOS interrupt 10h.
Controls
W / S β Move your paddle
Itβs a deterministic ball-tracking logic. It checks the ballβs Y position every frame:
If ball is above paddle β move up
If below β move down
Never goes off-screen
Simple. Fast. Fits in 510 bytes.
0:00
/0:20
Demo run
Key Technical Highlights
Video Memory Direct Access Used ES:DI = 0xB800:0000 and rep stosw to clear screen in one instruction.
Efficient Positioning - imul di, [playerY], 160 β converts row to video offset (80 cols Γ 2 bytes per char).
Real-Time Input - BIOS int 0x16 with ah=1 (peek) β non-blocking keyboard check.
Physics & Collision - Ball velocity stored in single bytes (ballVeloX, ballVeloY). Reversed on wall/paddle hit using neg byte.
Delay Loop - Used BIOS timer at 0x46C for frame pacing β no hlt, no busy-wait burn.
Color Cycling - C key increments drawColour by 0x10 β rotates through 16 background colors.
The Full Code
The entire game is in one file: pong.asm
Run It Yourself
Clone the repo
Assemble with NASM
Run in QEMU (or burn to USB and boot on old hardware)