Skip to content
/ vga-maze Public

Maze generator and graph traversal visualizer for MS-DOS featuring ground-breaking VGA graphics.

Notifications You must be signed in to change notification settings

dalps/vga-maze

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 

Repository files navigation

vga-maze

A pseudorandom maze generator for MS-DOS written in 80x86 real mode assembly and featuring ground-breaking mode 13h VGA graphics.

This is a simple, recursive implementation of a randomized depth-first traversal algorithm of a connected graph here encoded as an array of maze cells for the purpose maze generation. The program provides a step-by-step visualization of the algorithm as it makes way through the walls of a square grid pattern and backtracks along the visited paths until the initial cell is reached.

Installation

An 80x86 assembler and MS-DOS machine with VGA graphics support are required to assemble and run the program, which lives in the single source file vgamaze.asm. NASM for DOSBox is a clean solution to emulate such an architecture.

Mount the folder with the assembler executables (make sure it includes nasm.exe and cwsdpmi.exe) on the emulator. To assemble and run the source file:

C:\> nasm vgamaze.asm -fbin -o vgamaze.com

C:\> vgamaze

Usage

Just watch as the algorithm walks the grid in a depth first, randomized fashion. You'll know the generation animation is complete once all the visited cells are filled with a solid color. Then, you can run the generator again by pressing R or exit the program with Q.

The parameters of the gerenator are hardcoded - for now - in the assembly code. The maze's dimensions are parametric to the cell size, which should divide both the screen's width and height (in mode 13h these are 320 and 200 pixels respectively). A maze cell comprises a square of pixels whose side is defined by the CELL_SIZE constant.

Shrink or enlarge the maze output by playing with the CELL_SIZE constant (beware of values less than 4 as they lead to stack overflow). Adjust the color constants to your liking using a subset of values drawn from the VGA standard palette.

Gallery

The generator in action.

Animation

Have fun adjusting the cell size and color palette to your liking.

vgamaze_006

tmp_045

tmp_047

Notes

vga-maze was realized in the context of a low-level computing course over at my Uni.

Further improvements to the code include:

  • assembly optimization
  • user menu offering customization options
  • an iterative implementation of the search

About

Maze generator and graph traversal visualizer for MS-DOS featuring ground-breaking VGA graphics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published