Giter VIP home page Giter VIP logo

dotnes's Introduction

DotNes(WIP)

CI-badge

Yet another NES file parser.

WARNING: I'm not an expert on NES simulator. This parser implementation is on a very early stage, it may leaking important feature/fields and contains bugs comes from my misunderstanding of wiki articles. I write this parser for my (WIP) sau project(which even not publish to GitHub for now), if you REALLY want, please use with caution.

Any bug report is welcome, But temporarily DO NOT accept any feature requests.

Not publish to crates.io for the same reason.

Usage

Just use the dotnes::parse() function with your bytes.

use {std::fs, dotnes};

fn main() {
    let file = "tests/roms/cpu_tests/branch_timing_tests/1.Branch_Basics.nes";
    let data = fs::read(file).unwrap();
    let nes = dotnes::parse(&data).unwrap();
    println!("NES file Header: {:#?}", nes.header);
    println!(
        "PRG ROM        : {:?}...",
        &nes.prg_rom[0..usize::min(16, nes.prg_rom.len())]
    );
    println!(
        "CHR ROM        : {:?}...",
        &nes.chr_rom[0..usize::min(16, nes.chr_rom.len())]
    );
    println!(
        "Misc ROM       : {:?}...",
        &nes.miscellaneous_roms[0..usize::min(16, nes.miscellaneous_roms.len())]
    );
}

Output:

NES file Header: NesFileHeader {
    prg_rom_size: 16384,
    chr_rom_size: 0,
    prg_ram_size: 8192,
    prg_nv_ram_size: 0,
    chr_ram_size: 0,
    chr_nv_ram_size: 0,
    miscellaneous_rom_count: 0,
    mapper: 0,
    sub_mapper: 0,
    is_four_screen: false,
    has_trainer: false,
    has_persistent_memory: false,
    mirroring: Horizontal,
    has_bus_conflicts: false,
    timing: NTSC,
    is_nes2: false,
    console_type: Nes,
    default_expansion_device: Unspecified,
}
PRG ROM        : [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]...
CHR ROM        : []...
Misc ROM       : []...

LICENSE

Except ROM files in tests/roms folds, all other code are under GPLv3 License.

SEE LICENSE.

dotnes's People

Contributors

7sdream avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.