Skip to content

arieldeveloper/assembly-nes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assembly-nes

A NES game written using 6502 Assembly

Table of Contents

Description

Screenshot.png


A side-scroller NES game written completely in 6502 assembly, created to learn assembly programming in a resource constrained environment (2k of memory!). The purpose of this project was not to design a super intricate game, as least not for now, but rather learn how to program old systems that did not have the advanced hardware we have today.

Currently working on adding more animations and complex background graphics.

Installation

To run the project you're going to need an assembler/linker and an emulator.

For the assembler / linker you must install cc65, a 6502 assembler, C compiler, linker and more. We're not using any of the C functionality of the CC65.

https://cc65.github.io/getting-started.html

For the emulator, I'm using Fceux because it has a few other tools i'm looking for but you can use any emulator of your choice. Particularly I'm interested in the debugging tools and ability to view memory as the game runs.

https://fceux.com/web/download.html

With a little more setup, and a device for making cartridges, you can even make your own nes game cartridge and have it work with the original NES console!

Now that the compiler and emulator are downloaded, clone the project.

If on Unix system (I use MacOS), you can use my compile.sh file that I've provided to run the assembler/linker and create an executable. Once in the project directory:

./compile.sh

If you're on Windows, please modify the script as needed.

Now, using the emulator you have downloaded, open the .nes file generated from the compile script.

Usage

Depending on how your emulator is configured, use the right and left buttons mapped from the emulator's gamepad to move the character forward and back.

Code Details

Hardware

The nes has no persistent storage or operating system. It has 2k worth of RAM for us to execute our program and the cartridge gives us ROM, containing the code and sprites

The header.asm file includes a header which is in a specific format for emulators to recognize the file as an NES game.

Since there is no operating system on the NES, we need to provide our own interrupt handlers, which are found under /vector_table.

Our graphics include backgrounds and sprites. Sprites live in the OAM at $0200 and backgrounds are inputted into the PPU at specified regions mentioned in the NES docs.

Sources

About

An NES game made using 6502 Assembly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published