< Back to main page

boot sector game

an animated gif showing my boot sector game the li'l game i made! you can play it in the browser

what?

inspired by this video by the 8-bit guy, i decided to make my own boot sector game

oh no... what now?

old timey floppy disks and hard drives, specifically the ones used in ibm pcs and regular windows/intel pcs, used to have this small part at the beginning called the "boot sector". this sector was small. really small. like 512 bytes small. and for good reason!

the boot sector is the FIRST PIECE OF DATA that gets loaded, when the computer is first turned on, when it's still just HARDWARE doing hardware stuff, before any of the actual software starts running, and before the computer even KNOWS how to read any more than that tiny amount of data from the disk. (computers aren't currently very smart and we have to feed them in small spoonfulls sometimes)

so our limited computer that's just turned on loads the boot sector from the disk into memory, and then just immediately starts whatever program is inside that boot sector. et voilĂ ! our computer is now running an actual piece of SOFTWARE.

and so, because of this size constraint, the boot sector would usually contain a tiny program, called a "boot loader", which was only sophisticated enough to load the rest of the important computery stuff from the disk, and finally start up dos or windows or linux or whatever.

but you CAN actually technically put ANY computer program inside of a disk's boot sector, as long as it fits inside of the maximum allowed 512 bytes

and that's exactly what i did!

the game itself

because this game has to fit inside of 512 bytes, i had to choose something simple. no city planning, or roads or trains or buses. no complex graphics, no complex timing. and i'm really bad at games, so something that doesn't require hand-eye coordination.

breakout? nah, too timing-dependent. blackjack? no, too capitalist. tetris? no, the rotations always get me. i sat down and thought about this for a few minutes, until i finally decided on:

sokoban! a simple puzzle game where you push blocks around a room and onto predetermined "spots", whereupon arriving they light up, and once they've all arrived, you win! you can move around in four directions, and reload the level, and there's absolutely no time-related element to the game. sounds simple enough!

i searched the web for how to make an bootloader for x86 computers, read a few of the results, and decided on using the code from this tutorial, which uses nasm and qemu, and built my game on top of their code. (though i actually ran it with dosbox instead)

downloads

you can download the assembly code for the game, which can be built with nasm, or the actual floppy image, which you can run with any virtual machine software of your choice

you could also theoretically flash it on a floppy/hard/usb drive and boot from it, no operating system necessary! but i haven't tested it yet as of 12 nov 2019, and i assume no responsibility if you somehow wreck your computer trying to do this crazy thing. (but please write to me if you do lol)

and just to be like absolutely 100% clear, because everything sucks: i'm giving this program/game away for free and with no warranty whatsoever, expressed or implied, and i'm placing it in the public domain for all to enjoy.

play "online"!

if you're on a desktop computer, you can also play right here on this webpage! click the space below, that's hopefully asking you to click it:

move with the arrow keys, reset with esc

(this was embedded into the webpage using em-dosbox and emularity)

solution to the level

i, of course, couldn't be assed to make my own level, so i copied this level, from this solution video

special thanks

a big thank you goes out to my patreon patrons, for supporting me on my lifelong quest to be human. capitalism is poop from a butt, so every dollar helps, and i'm grateful for every single one. thanks! <3