{"id":30094344,"url":"https://github.com/kishore-ganesh/nesemulator","last_synced_at":"2025-08-09T10:41:38.524Z","repository":{"id":96029580,"uuid":"200706230","full_name":"kishore-ganesh/NESEmulator","owner":"kishore-ganesh","description":"An emulator for the Nintendo Entertainment System - A Work in Progress","archived":false,"fork":false,"pushed_at":"2025-03-25T07:33:39.000Z","size":2590,"stargazers_count":26,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T08:34:46.633Z","etag":null,"topics":["c-plus-plus","emulator","emulator-programming","emulators","nes-emulator"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kishore-ganesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-05T18:13:51.000Z","updated_at":"2024-05-31T20:08:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"2716d721-05be-42ff-8298-99b0b32ff804","html_url":"https://github.com/kishore-ganesh/NESEmulator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kishore-ganesh/NESEmulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishore-ganesh%2FNESEmulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishore-ganesh%2FNESEmulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishore-ganesh%2FNESEmulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishore-ganesh%2FNESEmulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kishore-ganesh","download_url":"https://codeload.github.com/kishore-ganesh/NESEmulator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishore-ganesh%2FNESEmulator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269566275,"owners_count":24439210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","emulator","emulator-programming","emulators","nes-emulator"],"created_at":"2025-08-09T10:41:36.207Z","updated_at":"2025-08-09T10:41:38.503Z","avatar_url":"https://github.com/kishore-ganesh.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NESEmulator\nAn emulator for the Nintendo Entertainment System - A Work in Progress\n\n\n## Screenshots\n\n![](Screenshots/nes_smb.gif)  ![](Screenshots/contra.gif)\n![](Screenshots/megaman.gif)\n![](Screenshots/nes_pop.png)\n![](Screenshots/Screenshot%202020-03-08%2000:20:44.png)\n\n\nOver the past few months, I've been working on creating an emulator for the Nintendo Entertainment System, a console from 1984\nthat singlehandedly brought back the videogame industry from the brinks of extinction.\n\nIt has specs that some may consider primitive in our times, with a paltry 2KB of RAM and a 1.79 Mhz 6502 CPU. It was a beast in its own age, however,\nwith its custom Picture Processing Unit being one of the foremost 2D picture processors of that age.\n\nThis project would not have been possible without the incredible reverse engineering knowledge on the Interwebs, particularly Nesdev, which proved to be an invaluable resource. \n\n## Current Status:\n\nIt is in a fairly stable state and is able to play many games (Including Donkey Kong, Contra, Super Mario Bros and more) perfectly (A minor glitch may pop up from time to time). \n\nThe CPU has been\nimplemented with all of its instructions, and the baseline model for the PPU is ready. Although the PPU is mostly functional and pretty accurate, it needs to be refactored a fair bit. The PPU's scrolling is currently implemented in a crude manner, and needs to be refactored to become more cycle accurate.\n\nAudio support has also been implemented with 3/5 Audio channels (2 pulse and 1 Triangle) present. However, the audio resampling is currently not satisfactory and a low pass filter will make it much clearer. \n\nOne mapper (the UNROM mapper) has been implemented. I'm currently working on audio resampling and integrating MMC1 and MMC3 mappers. \n\n\n\n## Features\n\n-\u003e 150 instructions (All right, you got me 50 instructions with 5 addressing modes)  \n-\u003e Ricoh Picture Processing Unit  \n-\u003e Logging using SPDLog (Enable compile time options to see logs)  \n-\u003e Rendering using SDL  \n-\u003e Audio Processing Unit with 3/5 channels being implemented\n## File Structure:\n\n\n        ├── CMakeLists.txt\n        ├── color_structs\n        ├── cpu\n        ├── include\n        │   ├── apu.h\n        │   ├── cartridge.h\n        │   ├── controller.h\n        │   ├── cpu.h\n        │   ├── interrupt.h\n        │   ├── memory.h\n        │   ├── nes.h\n        │   ├── ppu.h\n        │   ├── sdl_handler.h\n        │   └── util.h\n        ├── lib\n        ├── Makefile\n        ├── rgb_struct_new.py - Helper script written to format the pallete colors in code\n        ├── rgb_struct.py \n        └── src\n            ├── apu.cpp - The Audio Processing Unit of the NES\n            ├── cartridge.cpp - Contains code for handling Cartridge Loading\n            ├── controller.cpp - Input Handled here\n            ├── cpu.cpp - The brains of the 6502 CPU\n            ├── interrupt.cpp - Interrupt Functionality\n            ├── main.cpp - Driver code\n            ├── memory.cpp - Memory Bus (Common between CPU and PPU)\n            ├── nes.cpp - Wraps CPU, PPU and Controller\n            ├── ppu.cpp - The Picture Processing Unit of the NES\n            ├── sdl_handler.cpp - Wrapper for SDL code, the actual rendering happens here\n            └── tests.cpp - A few tests (not exhaustive) for testing a few instructions\n\n## Bird's eye view\n\nAt every step, the CPU reads the next instruction at the address specified by the Program Counter, executes it, while counting cycles.\nThe PPU runs 3 cycles for every CPU cycle, and there are a set of common memory locations used for communication between both. The PPU synthesizes an\nimage from these locations, and outputs an RGB array, which is rendered through SDL.\n\nThere are various strategies for keeping the CPU, PPU and APU in sync. I've gone with the run CPU an instruction and let the other units catch up strategy (Which works well till now).\n\n## PPU Rendering\n\nThe PPU fetches a byte from an area known as the nametable, which contains an index into a pattern table. Each entry in the pattern table is of 16 bytes, and specifies an 8x8 pixel pattern.\nThe NES has a 64 color pallete, out of which 16 can be active at any one time. For indexing 16 palletes, we need four bits, and two come from the pattern table entry. Two more bits come from the screen area's corresponding\nattribute table (Each 32x32 part of the screen shares an attribute).\n\nScrolling is done through xscroll and yscroll registers.\n\n\n## PPU Registers\nPPUCTRL  \nPPUPPUMASK   \nPPUSTATUS  \nOAMADDR  \nOAMDATA  \nPPUSCROLL  \nPPUADDR  \nPPUDATA  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkishore-ganesh%2Fnesemulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkishore-ganesh%2Fnesemulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkishore-ganesh%2Fnesemulator/lists"}