An NES emulator coded entirely in C using device drivers developed for LCOM course at @FEUP.
Welcome to the NES Emulator! This project aims to provide an emulator for the Nintendo Entertainment System (NES), written from the ground up to be portable and easily compatible with various device drivers, whether for Linux, Windows and Minix. This allows users to play classic NES games on modern hardware.
- Accurate emulation of NES CPU, PPU, cartidge loading, mapping and contoller connection.
- Support for the popular NES file formats (.nes) with iNES headers.
- Serial connection to real controller through a
ESP8266
being used as a bridge. - Various resolutions and scalling.
- Very fast loading and unloading of games.
This repository only runs on the Minix image developed for the LCOM course at FEUP.
You can download the image here.
Since we are working with low-level hardware configurations and direct access to the programmatic interface of a computer’s I/O devices raises security risks, it is recommended to use a
virtual machine
to emulate this project. The suggested solution is to run it on VirtualBox (the link above contains the.vb
file).
-
Install VirtualBox: Download and install VirtualBox for your system.
-
Download MINIX Image: Get the MINIX image provided in the System Requirements.
-
Open MINIX in VirtualBox:
- Double-click the
.vbox
file to open VirtualBox with the settings for the MINIX-LCOM VM.
- Clone the Repository:
# clone the repository
git clone git@github.com:ricardoyang00/NES_Emulator-LCOM.git
- Set Up Shared Folder:
- In the
MINIX-LCOM/
folder, create ashared/
folder. - Open the settings for the MINIX VM in VirtualBox and set the shared folder to the
shared/
directory you just created. - Move the cloned repository into the
shared/
folder.
- Start the VM:
- Boot up the VM. Use
lcom
for the login andlcom
for the password.
- Get the ROMs:
- To use the emulator, ensure all ROMs are placed in the
roms/
folder. - The roms that are expected to have are
supermariobros
,soccer
,DonkeyKong
,mspacman
, andBattleCity
.
- Build and Run the Project:
cd labs/src/
make
lcom_run proj
# see more in USAGE about extra flags
- To exit the emulator's interface you can press
exit
key.
To run use lcom_run proj
You can also use these flags:
Syntax | Description |
---|---|
--no-uart | Disables serial connection |
--player-1-serial | Swaps controller 1 from keyboard to Serial |
--vmode 0x115 | Enables VBE_MODE_DC_24 video mode while emulator running |
(Don't forget to wrap the flags in " ")
for example
lcom_run proj "--no-uart"
- Mouse - to select game
- Arrows - ← and → to change menu page
- Exit - to quit the program
A big thanks to:
- Professor Nuno Cardoso for his unwavering support and encouragement, inspiring us to learn more and never give up.
- OneLoneCoder (Javidx9) for his insightful series on NES emulator development, and his community for helping me understand the inner workings of the NES.