Skip to content

A Pac-man like game, created in Assembly for the DOSBox environment

License

Notifications You must be signed in to change notification settings

4R1u/assembly-pacman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assembly-pacman

Overview

A simplistic implementation of Pac-Man in 16-bit x86 Assembly for the DOSBox environment. This was the final project in the "Computer Organization and Assembly Language" course at my university.

  • This game runs in mode 13h, like a number of games from the DOS era.
  • It runs in real mode
  • The game loads a map file into "VRAM," and constantly tracks the locations of and redraws sprites.
  • The project is compiled with NASM

Installation

  1. Install DOSBox
  2. Download and extract or clone this repo to a folder
git clone git@github.com:4R1u/assembly-pacman.git ~/Downloads/assembly-pacman
  1. Install NASM into a new folder in the parent directory of the game, such as ~/Downloads/nasm in this case
  2. Launch DOSBox
  3. Mount the folder in which NASM resides
MOUNT C ~/Downloads/
  1. Switch to the mounted drive
C:
  1. Switch to the folder which has the NASM executable
cd NASM
  1. Compile the game (use TAB completion, because DOSBox has length limits):
NASM.EXE C:/assem<TAB>/main.asm -o C:/assem<TAB>/game.com
  1. Switch to the directory which has the game:
cd C:/assem<TAB>
  1. Run the game:
game.com

You can change the directories, the main thing to keep in mind is that NASM has to be accessible from your mount point, and that the game executable and map.bmp have to be in the current directory when you run the game.

(Optional) How to make the game look smooth like in the screenshots

  1. Open your dosbox.conf options.
  2. Ctrl-F replace scaler=normal2x with scaler=hq3x

How to play

You will be shown an intro screen (this was one of the requirements of the project). Press any key to start the game.

The intro screen

The game then starts, and the ghosts and pacman start moving.

The start of the game

  • Pac-Man loses a life when he runs into a ghost
  • The score increments whenever Pac-Man eats a dot

The game ends when Pac-Man loses his three lives, or when the score reaches 248.

The game then returns to text-mode and shows you the score.

The end of the game

Limitations

Since this project was to be made in Assembly, and I didn't use a logical "grid", my project has some places it lacks in:

The ghosts' pathfinding

Since this is Assembly, implementing a path-finding algorithm would have been pretty difficult within the short time span I had for the project.

Also, the grading scheme for the project wanted random movement for the ghosts, so that is what I implemented with a 32-bit Xorshift algorithm.

To make the ghosts more difficult to counter, I made the ghosts move every tick, and Pac-Man only every 30 ticks. This compensates for the fact that the ghosts tend to stay in the general area of one place, and makes them leave their starting area faster.

Collision detection

I couldn't get my function that detects if Pac-Man had collided with a ghost to work, so I just made it run a manual check for each of the corners.

About

A Pac-man like game, created in Assembly for the DOSBox environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published