Simple boot sector game — Snake

arturfog
1 min readDec 7, 2020

Some time I saw a YouTube movie about boot sector games and I’ve decided to create one.

It can be found in my GitHub repository: https://github.com/arturfog/bootsector_game

Game is written entirely in assembler.

Working game

There is still one bug waiting to be fixed that game resolution is 320 x 180 px but game logic only supports 256x180 px so it leads to some unexpected behavior when player exits that area.

How to compile the game ?

Game can be compiled with following commands

game.sh
-----------
#!/bin/bash
set -x
as game.S -o game.o
ld -Ttext 0x7c00 --oformat=binary -o game.bin game.o

How to play ?

There are 2 ways to play the game.

  1. Copy game on floppy disk / USB drive and boot PC from it (ie. using dd)
  2. Run game using virtual machine (ie. Bochs)

Below is my configuration for Bochs emulator

snake.txt
--------------
megs: 32
floppya: 1_44=game.bin, status=inserted
boot: a
mouse: enabled=0
display_library: x

To run the game install bochs for you system and run with

bochs -f snake.txt

--

--