written by - Akshat Joshi Sometime back, I set myself a crazy constraint:Load only one thing at boot - A Pong game that fits in one floppy disk sector β 512 bytes.Why would I build this?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 challengeNo 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.I wanted to see if I could fit:Player paddle (W/S keys)CPU opponentBall with velocityScoringColor 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.Everything is drawn directly into video memory (0xB800) with stosw β of course no graphics libraries here.ControlsW / S β Move your paddleC β Cycle paddle and midline colorsR β Reset game (reboots the sector)Itβs a deterministic ball-tracking logic. It checks the ballβs Y position every frame:If ball is above paddle β move upIf below β move downNever goes off-screenSimple. Fast. Fits in 510 bytes. Demo run Key Technical HighlightsVideo 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 1...
First seen: 2025-11-19 07:54
Last seen: 2025-11-19 17:00