Pong Gets The Boot

You might be surprised to find out that [Akshat Joshi’s] Pong game that fits in a 512-byte boot sector isn’t the first of its kind. But that doesn’t mean it isn’t an accomplishment to shoehorn useful code in that little bitty space.

As you might expect, a game like this uses assembly language. It also can’t use any libraries or operating system functions because there aren’t any at that particular time of the computer startup sequence. Once you remember that the bootloader has to end with two magic bytes (0x55 0xAA), you know you have to get it all done in 510 bytes or less.

This version of Pong uses 80×25 text mode and writes straight into video memory. You can find the code in a single file on GitHub. In the old days, getting something like this working was painful because you had little choice but reboot your computer to test it and hope it went well. Now you can run it in a virtual machine like QEMU and even use that to debug problems in ways that would have made a developer from the 1990s offer up their life savings.

We’ve seen this before, but we still appreciate the challenge. We wonder if you could write Pong in BootBasic?

5 thoughts on “Pong Gets The Boot

    1. Are you writing this because it was not obvious for you or do you assume that younger readers may not be familiar with pre-UEFI boot process? I’m genuinely curious, because I can think of just one platform when reading about 512-byte boot sectors ending with 0x55 0xAA. But maybe it’s because I’m old ;-)

  1. With VMWare-Player (version 9 at least on linux), when you use an emty file (it has 0 bytes) as imagefile. You don’t get the “Disk not bootable, change and press enter” prompt, instead the bios starts a pong-game.
    I needed an empty DOS diskimage, so created an empty file, added to my Win98 virtual-machine to format it as systemdisk, but boot from floppy before harddisk was enabled.
    That was a surprise, at first i wonderd, if i had added a wrong diskimage with pong, from the 512 byte demos.

Leave a Reply to SkloogisCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.