Skip to content

lkm-schulz/snake8086

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SNAKE for MS-DOS in 8086 Assembly

This project was created for the "Game" assignment as part of the Computer Organization course @ Vrije Universiteit Amsterdam. The project was initially completed in March 2022. The code found in this repository is unchanged from the original at project completion time.

Authors

Name Profile
Lennart K. M. Schulz GitHub, LinkedIn
Dovydas Vadišius GitHub, LinkedIn

Demo

Installation / Usage

To run the game on modern systems an MS-DOS emulator (like DosBox is required.

Binaries for the MASM compiler and linker, which can be used to build the game from source, are included in the misc directory.

To run the game, simply start the SNAKE.EXE executable.

Controls

The game includes three difficulty settings, which can be selected on the start screen by using the 1, 2, or 3 key.

The snake is controlled via the arrow keys.

Project Information

The Computer Organization course is a first year Computer Science BSc course at the VU Amsterdam. The course covers “the architecture, the structure, the operation, and the interconnection of computer components into computer systems.” As such, part of the course is learning about Assembly languages with a focus on the prevalent x86_64 architecture.

Task

The Lab component of the course includes eight x86 assembly programming assignments ranging from a simple “Hello, world” program to implementing a simplified printf method from scratch.

The ninth and last extra assignment allows for implementing a (more or less simple) real-time game in assembly, which is what this project is all about.

Implementation Details

To go fully retro on this one, we decided to build a snake remake for MS-DOS in 16-bit 8086 assembly. By this, we could use the classic VGA graphics mode, where all pixels on screen are simply mapped to addressable memory locations.

Our implementation does not rely on any external libraries. We do use a limited number of DOS/BIOS interrupts for some core functionality as listed below.

  • INT 10h - Video services
    • Function 00h (set video mode)
  • INT 16h - Keyboard services
    • Function 00h (wait for keystroke)
    • Function 01h (check for keystroke without waiting)
  • INT 21h - DOS services
    • Function 2Ch (get system time)
    • Function 4Ch (terminate program)

All text and graphics are custom made and simply defined as raw data. All functions to print the game, score, or other UI elements are written from scratch.

AI Usage

This project was completed in the beginning of 2022, so chatGPT-like generative AI and coding agents were not a thing yet. All code is hand-written by us.

Code Quality Disclaimer

At the time of working on this project we were first-year Computer Science BSc students with essentially none (Lennart) and very limited (Dovydas) prior programming experience. As such, the implementation is not the most elegant in probably quite a few regards, but hey - we made a game in assembly and it's fun to play.. :)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Contributors