A NES emulator written in Rust, with a focus on expandability and accuracy

Related tags

Emulators fancy-nes
Overview

fancy-nes

License

Copyright [2022] [Benjamin Mordaunt [email protected]]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You might also like...
RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.
RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance ™ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

Unicorn Emulator Debug Server - Written in Rust, with bindings of C, Go, Java and Python

udbserver - Unicorn Emulator Debug Server When you do emulation with Unicorn Engine, do you want to inspect the inner state during every step? udbserv

Chip8 emulator written in pure rust, using rust-sdl2 for graphics

Rust-8 chip8 emulator written in rust, using rust-sdl2 for graphics. Features Fully implemented all 35 original chip8 opcodes. This emulator does NOT

Commodore 64 emulator written in Rust
Commodore 64 emulator written in Rust

Rust64 - a C64 emulator written in Rust This is my attempt to study the Rust programming language and have fun at the same time. The goal is to presen

A Flash Player emulator written in Rust
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

ZX Spectrum emulator written in Rust
ZX Spectrum emulator written in Rust

rustzx ZX Spectrum emulator which I writing in rust. I develop this project just for fun and for learning the basics of computer architecture. License

CHIP-8 emulator written in Rust
CHIP-8 emulator written in Rust

CHIP-8 emulator written in Rust. This is intended to be a project for gaining experience writing emulators and practice Rust.

A 6502 emulator written in Rust.

v6502 This package contains an emulator for the 6502 microprocessor. It doesn't support binary decimal (BCD) mode yet. To run the debug version: cargo

Spaghetti Chip8 Emulator Written In Rust

How to run? Command is simple: cargo run FILENAME. files are stored in the /c8games folder, use one of them. Example: cargo run INVADERS Keymap use 1

Comments
  • Better panicking

    Better panicking

    The emulator panics a fair amount at the moment, and will continue to do so until all the bugs in CPU/PPU emulation are ironed out.

    Ideally, whenever a panic occurs, I want to know the following information:

    • [ ] What was the last instruction successfully fetched and executed?
    • [ ] What was the value of the program counter at the time of panic?
    • [ ] What were the stack contents?
    • [ ] Which scanline and tick was the PPU trying to process?

    At the moment, some of this information is produced when a panic occurs in the CPU, but nowhere else. The library needs to be rewritten so that Result<T, E> are returned by functions instead of those functions themselves panicking.

    opened by benjaminmordaunt 0
  • Sprites & OAM

    Sprites & OAM

    Tracking issue for sprites + OAM emulation in the PPU. This is the final step necessary to get playable games with basic mappers such as Mario Bros. and Donkey Kong.

    New data structures in PPU.

    • pOAM (primary OAM) (holds 64 sprites for the entire frame)
    • sOAM (secondary OAM) (holds 8 sprites for the current scanline)
    • 16 (2x8) 8-bit shift registers - pattern data for up to 8 sprites on current scanline.
    • 8 latches - Attribute data for 8 sprites.
    • 8 counters - X positions for 8 sprites.

    Sprite Evaluation

    "Translated" from nesdev

    • [x] Cycles 1-64: Clear secondary OAM full of $FF's.
    • [ ] Cycles 65-256: Odd cycles: Fetch data (i.e. OAM[n][m]) from pOAM. Even cycles: Write to sOAM iff sOAM not full, else read from sOAM.
      1. For each n = 0..=63, copy pOAM[n][0] (y-coordinate) into next open slot in sOAM, according to alternating rules above. If y-coordinate in range of interest (qualify?) copy pOAM[n][1..=3] into remainder of slot.
      2. Increment n n has overflowed? All sprites in pOAM evaluated, go to (iv). Fewer than 8 sprites have been found/copied, go to (i). If 8 sprites have been found, disable writes to sOAM (as desc. above).
      3. Start at m = 0, evaluate every OAM[n][m] as a y-coordinate (seems a little strange... but OK) If the value is in scanline range, set sprite overflow flag in $2002 and read rest of slot. Handle m overflow into n (when m is 3, n++, m = 0) If not in range for scanline, increment n and m. If n overflows, go to (iv), otherwise go to (iii).
      4. Increment n until HBLANK is reached.
    • [ ] Cycles 257-320: Sprite fetches (8 sprites, 8 cycles per sprite) 1-4: Read the Y-coordinate, tile number, attributes and X-coordinate of the selected sprite from sOAM. 5-8: Read the X-coordinate 4 more times, while the PPU fetches sprite data. (Maybe emulator can do nothing here?) Useful note: First empty sprite slot will consist of last sprite (63)'s y-coordinate followed by [0xFF; 3]. Then others will be [0xFF; 4].
    • [ ] Cycles 321-340+0: Fetching the first byte in the secondary OAM needs to align with PPU fetches of next two background tiles for next scanline.

    Sprite Rendering - TODO

    Notes

    I haven't given much thought to 8x16 sprites. Start with just 8x8 sprite support for now. Important for evaluation of byte 1 of sprite data in OAM.

    opened by benjaminmordaunt 0
Owner
Benjamin Mordaunt
Benjamin Mordaunt
NES emulator written in Rust to learn Rust

OxideNES A NES emulator in Rust. CPU should be accurate, PPU is mostly accurate, timing between the 2 is off for some corner cases and hardware qui

null 37 Nov 7, 2022
An NES emulator written in Rust

Pinky Pinky is an NES emulator written in Rust completely from scratch based only on publicly available documentation. You can run it in your Web brow

Koute 709 Dec 23, 2022
NES emulator written in Rust

sprocketnes is an emulator for the Nintendo Entertainment System written in the Rust programming language. Its purpose is to serve as a technology dem

Patrick Walton 725 Dec 27, 2022
a work-in-progress NES emulator written in rust.

sayaka-rs a work-in-progress NES emulator, written in Rust. the project image is an edit of a frame from the Mahou Shoujo Madoka Magica manga. the Mik

Lumine 1 Jan 16, 2022
🥔 MOS-6502 and NES emulator in Rust (SDL/WebAssembly)

?? Potatis /mos6502 - Generic CPU emulator. Passes all tests, including illegal ops. (No BCD mode). /nes - A very incomplete NES emulator. /nes-sdl -

Henrik Persson 28 Jan 9, 2023
Learn emulator and programming languages, target chip8, nes, gbc, gba ...

[WIP]learn emulator go-chip8 go run main.go source https://en.wikipedia.org/wiki/CHIP-8 http://devernay.free.fr/hacks/chip8/C8TECH10.HTM https://githu

早晨海风 4 Apr 30, 2021
NES emulator in rust

NES emulator in Rust plastic is a NES emulator built from scratch using Rust. This is a personal project for fun and to experience emulating hardware

Amjad Alsharafi 27 Dec 15, 2022
A simple NES emulator implemented in Rust. (WIP)

remu A ?? ?? BLAZINGLY FAST* ?? ?? NES emulator implemented in Rust. Status: Work in progress. About This emulator is mainly meant to be more of a lea

luna 10 Aug 25, 2022
A **BLAZINGLY FAST** rust emulator for the NES.

rust-nes A BLAZINGLY FAST rust emulator for the NES. Install / Usage Clone the repository and navigate to it git clone https://github.com/imagine-huss

null 7 Jan 20, 2023
A Game Boy research project and emulator written in Rust

Mooneye GB Mooneye GB is a Game Boy research project and emulator written in Rust. The main goals of this project are accuracy and documentation. Some

Joonas Javanainen 802 Dec 28, 2022