Author – Akshat Joshi
Some time ago, I set up a strange obstacle for myself:
Load only one thing at boot – a Pong game that fits in a floppy disk sector – 512 bytes.
Why would I make it?
I have played with operating systems and their functioning by customizing them and changing their behavior. But this was about pushing the odds to the extreme. Can I have an OS that only loads one Pong game?
challenge
- No operating system.
- No driver.
- No library.
- Just raw x86 assembly, BIOS interrupts, and video memory at 0xB800.
The boot sector is the first 512 bytes that the computer loads from the disk. It has to end with magic bytes 0x55 0xAA – leaving only 510 bytes For the actual code.
I wanted to see if I could fit:
- Player Paddle (W/S Key)
- cpu rival
- ball speed
- scoring
- color toggle (C key)
- Full reset (R key)
After learning about operating systems and bootup flows, I finally managed to run a Pong game 😄
how it works!
the game goes on 80×25 text mode (VGA mode 03h) Using BIOS interrupt 10h.
Everything is drawn directly into video memory (0xB800) with Stosw – no graphics library here of course.
Control
W/S – move your paddle
C – Bicycle pedals and midline color
R – reset game (reboots the sector)
this is one Deterministic ball-tracking logicThis checks the Y position of the ball in each frame:
- If the ball is above the paddle → go up
- If below → go down
- never off-screen
Easy. Fast. Fits in 510 bytes.
run demo
Key Technical Highlights
- video memory direct access used ES:DI = 0xB800:0000 And Rep. Stosw To clear the screen in one instruction.
- efficient state- Imul di, [playerY]160 → Converts the 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 and Collision – Ball velocity stored in single bytes (ballveloX, ballveloYHit the wall/turn using the paddle negative byte,
- Delay Loop – BIOS timer used 0x46C For frame pacing – no HLT, no busy-wait burn.
- Color Cycling – C Key Increment Draw Color By 0x10 → Rotates through 16 background colors.
full code
The entire game is in one file: pong.asm
Publicly available on GitHub:
https://github.com/akshat666/-bootponggame
drive it yourself
- clone the repo
- Combine with NASM
- Run in QEMU (or burn to USB and boot on older hardware)