• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmake/H24-Aug-2018-257242

research/H03-May-2022-3126

resources/H24-Aug-2018-3837

roms/H24-Aug-2018-77,57465,396

scripts/H24-Aug-2018-4639

src/H03-May-2022-10,3356,888

thirdparty/H24-Aug-2018-28,02320,351

.gitattributesH A D24-Aug-2018140 64

.gitignoreH A D24-Aug-2018263 1814

.travis.ymlH A D24-Aug-20181 KiB4841

LICENSEH A D24-Aug-20181 KiB2217

README.mdH A D24-Aug-201810.8 KiB328268

_config.ymlH A D24-Aug-201860 32

appveyor.ymlH A D24-Aug-20181.1 KiB3231

wideNES.mdH A D24-Aug-20184.9 KiB148105

README.md

1<p align="center">
2  <a href="https://prilik.com/ANESE">
3    <img height="128px" src="resources/icons/anese.ico"
4      alt="ANESE Logo">
5  </a>
6</p>
7<p align="center">
8  <a href="https://ci.appveyor.com/project/daniel5151/anese">
9    <img src="https://ci.appveyor.com/api/projects/status/qgy19m8us3ss6ilt?svg=true"
10      alt="Build Status Windows">
11  </a>
12  <a href="https://travis-ci.org/daniel5151/ANESE">
13    <img src="https://travis-ci.org/daniel5151/ANESE.svg?branch=master"
14      alt="Build Status macOS/Linux">
15  </a>
16</p>
17
18**ANESE** (**A**nother **NES** **E**mulator) is a Nintendo Entertainment System
19Emulator written for fun and learning.
20
21Accuracy and performance are long-term goals, but the primary focus is getting
22popular titles up and running. There are still a lot of bugs, but many games are
23working quite well already.
24
25ANESE is _cross-platform_, and is regularly tested on macOS, Windows, and Linux.
26
27ANESE core uses clean and _interesting_ C++11, emphasizing _readability_,
28_maintainability_, and _approachability_. It is well commented, providing
29in-line sources and insights for much of the implementation. It is also
30dependency free (aside from stdlib), making it easy to embed in other projects.
31
32## WideNES
33
34**wideNES** is a novel technique that can automatically "map-out" levels and
35worlds in NES games. Check out the [wideNES Readme](/ANESE/wideNES) for details.
36
37A GIF is worth a 1000 words:
38
39<p align="center">
40  <img src="resources/web/wideNES_metroid.gif" alt="wideNES on Metroid">
41</p>
42
43Pretty cool huh? Here's another one:
44
45<p align="center">
46  <img src="resources/web/wideNES_smb1.gif" alt="wideNES on SMB1">
47</p>
48
49## Downloads
50
51Official releases of ANESE can be found on the Releases tab on GitHub.
52
53Alternatively, for the most up-to-date version of ANESE, nightly builds are
54available. These are compiled directly from the latest ANESE commit, so there
55may/will be bugs.
56
57**Windows:** You can download builds of ANESE from
58[AppVeyor](https://ci.appveyor.com/project/daniel5151/anese)'s build artifacts
59page.
60
61**macOS:** Travis uploads ANESE.app bundles to
62[this GDrive folder](https://drive.google.com/drive/folders/1GWiinQ4tjDSZlhjReVMdElwK1b-Zvagf).
63
64## Building
65
66### Dependencies
67
68ANESE's emulation core (src/nes) doesn't have any major dependencies, but the UI
69does use a couple. Most of these dependencies are bundled with ANESE
70(see: /thirdparty), although some require additional installation:
71
72- **SDL2** (video/audio/controls)
73  - _Linux_: `apt-get install libsdl2-dev` (on Ubuntu)
74  - _MacOS_: `brew install SDL2`
75  - _Windows_:
76    - Download dev libs from [here](https://www.libsdl.org/download-2.0.php) and
77      unzip them somewhere.
78    - EITHER: Set the `SDL` environment variable to point to the dev libs
79    - OR: Unzip them to `C:\sdl2\` (Where I put them)
80    - OR: Modify the `SDL2_MORE_INCLUDE_DIR` variable in `CMakeLists.txt` to
81      point to the SDL2 dev libs
82
83### Generating + Compiling
84
85ANESE builds with **CMake**
86
87On macOS / Linux
88```bash
89# in ANESE root
90mkdir build
91cd build
92cmake ..
93make
94
95make install # on macOS: creates ANESE.app in ANESE/bin/
96```
97
98On Windows:
99```bat
100mkdir build
101cd build
102cmake ..
103msbuild anese.sln /p:Configuration=Release
104```
105
106## Running
107
108ANESE opens to a directory-browser, from which ROMs can be launched.
109
110ANESE can run from the shell using `anese [rom.nes]` syntax. Certain features
111are _only_ accessible from the command-line at the moment (e.g: movie recording
112/ playback, PPU timing hacks). For a full list of switches, run `anese -h`
113
114**Windows Users:** make sure the executable can find `SDL2.dll`! Download the
115runtime DLLs from the SDL website, and plop them in the same directory as
116anese.exe
117
118## Mappers
119
120Most popular Mappers are implemented:
121
122 \#  | Name  | Some Games
123-----|-------|--------------------------------------------------
124 000 | NROM  | Super Mario Bros. 1, Donkey Kong, Duck Hunt
125 001 | MMC1  | Legend of Zelda, Dr. Mario, Metroid
126 002 | UxROM | Megaman, Contra, Castlevania
127 003 | CNROM | Arkanoid, Cybernoid, Solomon's Key
128 004 | MMC3  | Super Mario Bros 2 & 3, Kirby's Adventure
129 007 | AxROM | Marble Madness, Battletoads
130 009 | MMC2  | Punch Out!!
131
132Feel free to open a PR for any mappers you implement :)
133
134## Controls
135
136Currently hard-coded to the following:
137
138Button | Key         | Controller
139-------|-------------|------------
140A      | Z           | X
141B      | X           | A
142Start  | Enter       | Start
143Select | Right Shift | Select
144Up     | Up arrow    | D-Pad
145Down   | Down arrow  | D-Pad
146Left   | Left arrow  | D-Pad
147Right  | Right arrow | D-Pad
148
149Any xbox-compatible controller should work.
150
151There are also a couple of emulator actions:
152
153Action             | Key                  | Controller
154-------------------|----------------------|-------------------------
155Pause / Open Menu  | Esc                  | Left Thumbstick Button
156Reset              | Ctrl - R             |
157Power Cycle        | Ctrl - P             |
158Toggle CPU logging | Ctrl - C             |
159Speed +25%         | Ctrl - =             |
160Speed -25%         | Ctrl - -             |
161Fast-Forward       | Space                | Right Thumbstick Button
162Make Save-State    | Ctrl - (1-4)         |
163Load Save-State    | Ctrl - Shift - (1-4) |
164
165(there are 4 save-state slots)
166
167## DISCLAIMERS
168
169- ANESE is not the best emulator out there, far from it! Expect bugs!
170- My APU uses a naive sampling algorithm with a basic lookup table grafted from
171the nesdev wiki. The `blargg-apu` branch has an older version of ANESE that uses
172Blargg's awesome `nes_snd_emu` library for the APU, and while my integration was
173a bit unstable at times, it did sound a lot better when it did work.
174- The CPU is _instruction-cycle_ accurate, but not _sub-instruction cycle_
175accurate. While this inaccuracy doesn't affect most games, there are some that
176that rely on sub-instruction level timings (eg: Solomon's Key).
177  - The `--alt-nmi-timing` flag might fix some of these games.
178
179## TODO
180
181These are features that will add major value to ANESE:
182
183- [ ] _Implement_: Cycle accurate CPU (will probably fix _many_ bugs)
184- [ ] _Implement_: Better menu (not just fs, also config)
185- [ ] _CMake_: more robust macOS bundles (good way to get SDL2.0 packaged?)
186- [ ] _Implement_: LibRetro Core
187- [ ] _Implement_: Get the Light-gun working
188- [ ] _Debugging_: Add debug GUI
189  - All objects implementing the Memory interface _must also_ implement `peek`,
190    i.e: a `const` read. As such, a debugger could easily inspect any/all memory
191    locations with no side effects!
192
193Here's a couple that have been crossed off already:
194
195- [x] _Implement_: My own APU (don't use Blarrg's)
196- [x] _Refactor_: Modularize `main.cc` - push everything into `src/ui/`
197  - [x] _Refactor_: Split `gui.cc` into more files!
198- [x] _Refactor_: Push common mapper behavior to Base Mapper (eg: bank chunking)
199
200And here are some ongoing low-priority goals:
201
202- [ ] _Refactor_: Roll-my-own Sound_Queue (SDL_QueueAudio?)
203- [ ] _Cleanup_: Unify naming conventions (either camelCase or snake_case)
204- [ ] _Cleanup_: Comment the codebase _even more_
205- [ ] _Security_: Actually bounds-check files lol
206- [ ] _Cleanup_: Conform to the `.fm2` movie format better
207- [ ] _Cleanup_: Remove fatal asserts (?)
208- [ ] _Cleanup_: Switch to a better logging system
209               (\*cough\* not fprintf \*cough\*)
210
211## Roadmap
212
213### Key Milestones
214
215- [x] Parse iNES files
216- [x] Create Cartridges (iNES + Mapper interface)
217- [x] CPU
218  - [x] Set Up Memory Map
219  - [x] Hardware Structures (registers)
220  - [x] Core Loop / Basic Functionality
221    - [x] Read / Write RAM
222    - [x] Addressing Modes
223    - [x] Fetch - Decode - Execute
224  - [x] Official Opcodes Implemented
225  - [x] Handle Interrupts
226- [x] PPU
227  - [x] Set Up Basic Rendering Context (SDL)
228  - [x] Implement Registers + Memory Map them
229  - [x] Implement DMA
230  - [x] Generate NMI -> CPU
231  - [x] Core rendering loop
232    - [x] Background Rendering
233    - [x] Sprite Rendering - _currently not hardware accurate_
234    - [x] Proper Background / Foreground blending
235  - [x] Sprite Zero Hit
236  - [ ] Misc PPU flags (emphasize RGB, Greyscale, etc...)
237- [x] APU
238  - [x] Implement Registers + Memory Map them
239  - [ ] Frame Timer IRQ - _kinda_
240  - [x] Set Up Basic Sound Output Context (SDL)
241  - [x] Channels
242    - [x] Pulse 1
243    - [x] Pulse 2
244    - [x] Triangle
245    - [x] Noise
246    - [x] DMC
247  - [x] DMC DMA
248- [ ] Joypads
249  - [x] Basic Controller
250  - [ ] Zapper - _still needs work_
251  - [ ] NES Four Score
252
253### Secondary Milestones
254
255- [x] Loading Files with picker
256- [x] Reset / Power-cycle
257- [x] Fast Forward
258- [x] Run / Pause
259- Saving
260  - [x] Battery Backed RAM - Saves to `.sav`
261  - [x] Save-states
262    - [ ] Dump to file
263- [x] Config File
264  - [x] Preserve ROM path
265  - [x] Window size
266  - [ ] Controls
267- [x] Running NESTEST (behind a flag)
268- [x] Controller support - _currently very basic_
269- [x] A SDL GUI
270  - [x] SDL-based ROM picker
271  - [ ] Options menu
272
273### Tertiary Milestones (Fun Features!)
274
275- [x] Zipped ROM support
276- [ ] Rewind
277- [ ] Game Genie
278- [x] Movie recording and playback
279- [ ] More ROM formats (not just iNES)
280- [ ] Proper PAL handling?
281- [ ] Proper NTSC artifacting?
282- Multiple Front-ends
283  - [x] SDL Standalone
284  - [ ] LibRetro
285- [ ] Debugger!
286  - [ ] CPU
287    - [ ] Step through instructions
288  - [x] PPU Views
289    - [x] Static Palette
290    - [x] Palette Memory
291    - [x] Pattern Tables
292    - [x] Nametables
293    - [ ] OAM memory
294
295### Accuracy & Compatibility
296
297- More Mappers! Always more mappers!
298- [ ] Add automatic testing
299  - [ ] Screenshots: compare power-on with 30 seconds of button mashing
300  - [ ] Test ROMs: Parse debug outputs
301- CPU
302  - [ ] Implement Unofficial Opcodes
303  - [ ] Pass More Tests
304  - [ ] _\(Stretch\)_ Switch to sub-instruction level cycle-based emulation
305        (vs instruction level)
306- PPU
307  - [x] Make the sprite rendering pipeline more accurate (fetch-timings)
308  - [ ] Pass More Tests
309  - [ ] Make value in PPU <-> CPU bus decay?
310
311## Attributions
312
313- A big shout-out to [LaiNES](https://github.com/AndreaOrru/LaiNES) and
314[fogleman/nes](https://github.com/fogleman/nes), two solid NES emulators that I
315referenced while implementing some particularly tricky parts of the PPU). While
316I actively avoided looking at the source codes of other NES emulators while
317writing my initial implementations of the CPU and PPU, I did sneak a peek at how
318others solved some problems once I got stuck.
319- These awesome libraries are used throughout ANESE's UI and in WideNES:
320  - [cfg_path](https://github.com/Malvineous/cfgpath) - cross-platform config file
321  - [clara](https://github.com/catchorg/Clara) - argument Parsing
322  - [cute_headers](https://github.com/RandyGaul/cute_headers/) - cross-platform directory browsing
323  - [miniz](https://github.com/richgel999/miniz) - zipped ROM support
324  - [sdl2](https://www.libsdl.org/) - A/V and Input
325  - [SDL_inprint](https://github.com/driedfruit/SDL_inprint/) - SDL fonts, without SDL_ttf
326  - [simpleini](https://github.com/brofield/simpleini) - ini config parsing / saving
327  - [stb](https://github.com/nothings/stb) - image loading / writing
328