{"id":15430420,"url":"https://github.com/davidjenni/6502-emu","last_synced_at":"2025-03-28T05:41:11.377Z","repository":{"id":194702361,"uuid":"684840859","full_name":"davidjenni/6502-emu","owner":"davidjenni","description":"6502 CPU emulator in rust","archived":false,"fork":false,"pushed_at":"2023-10-22T23:50:28.000Z","size":159,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-18T06:15:25.561Z","etag":null,"topics":["6502","6502-emulation","emulator","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidjenni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-08-30T00:52:29.000Z","updated_at":"2023-10-22T23:49:29.000Z","dependencies_parsed_at":"2024-10-20T11:26:14.369Z","dependency_job_id":null,"html_url":"https://github.com/davidjenni/6502-emu","commit_stats":{"total_commits":57,"total_committers":1,"mean_commits":57.0,"dds":0.0,"last_synced_commit":"c28332a54e62a728ac5ad0126ec5dab8468e831d"},"previous_names":["davidjenni/6502-emu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidjenni%2F6502-emu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidjenni%2F6502-emu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidjenni%2F6502-emu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidjenni%2F6502-emu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidjenni","download_url":"https://codeload.github.com/davidjenni/6502-emu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245978206,"owners_count":20703676,"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","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":["6502","6502-emulation","emulator","rust"],"created_at":"2024-10-01T18:16:06.934Z","updated_at":"2025-03-28T05:41:11.352Z","avatar_url":"https://github.com/davidjenni.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 6502 CPU emulator in rust\n\n[![CI](https://github.com/davidjenni/6502-emu/actions/workflows/CI.yml/badge.svg)](https://github.com/davidjenni/6502-emu/actions/workflows/CI.yml)\n[![codecov](https://codecov.io/gh/davidjenni/6502-emu/graph/badge.svg?token=K65NNITM7V)](https://codecov.io/gh/davidjenni/6502-emu)\n\n![MOS6502 in a 40 pin plastic package](/assets/MOS%206502%20DIP40-small.jpg)\n![MOS6502 die](/assets/MOS_6502_die-small.jpg)\n\nThe [MOS 6502 CPU](https://en.wikipedia.org/wiki/MOS_Technology_6502) spawned\nthe microcomputer age in the mid 1970s, and was the common runtime for\none of MSFT's earliest products, MSBASIC.\nWhile the original first MS product targeted the Altair 8080,\nit was the abundance of 6502-based computers (Apple I \u0026 II, PET, CBM, etc.)\nthat made MSBASIC truly popular and considerably helped the MSFT brand in its early days.\n\nRunning MSBASIC on a rust-based CPU emulator on a VM in the Azure cloud is a geeky,\nbut also educational showcase how the whole computer industry has evolved over the past 50 years.\n\n![rust crustacean](/assets/crabby.png)\n\nThis project is also my first foray into programming with rust; the code in this repo is the journey\nto get hopefully close to idiomatic rust programming.\nMy notes on and sources for [the journey to rust](/docs/Learning_Rust.md).\n\n## Run via cargo\n\n```bash\nA 6502 emulator written in Rust\n\nUsage: r6502.exe [OPTIONS] [COMMAND]\n\nArguments:\n  [COMMAND]\n          [default: run]\n          [possible values: run, debug]\n\nOptions:\n  -b, --binary \u003cBINARY\u003e\n          Path to binary file to load and run\n\n  -f \u003cFORMAT\u003e\n          File format of the binary file to load\n\n          Possible values:\n          - bin: Plain binary with no header, little endian byte order\n          - prg: Like a bin file, but with a 16 byte header that indicates the load address\n\n  -l, --load-address \u003cLOAD_ADDRESS\u003e\n          Load address (u16) for binary to be loaded to (inferred for .prg); if no start_addr it is also used as start address\n\n  -s, --start-address \u003cSTART_ADDRESS\u003e\n          Start address (u16) for binary to be started with; can be hex address in 0x1234 format\n\n  -r, --read-only\n          loaded binary is read-only in memory (simulate ROM)\n\n  -h, --help\n          Print help (see a summary with '-h')\n\n  -V, --version\n          Print version\n\n```\n\nWith an empty program, the reset vector 0xFFFE points to a BRK instruction,\nhalting the \"program\" after one instruction.\n\n```bash\ncargo run --bin r6502 --\nNo binary file specified, running empty program with single BRK instruction\n\nPC: FFFE: A: 00 X: 00 Y: 00 S: 00000000 SP: 01FC\nInstructions: 1; Cycles: 7; Clock speed: 1.045 MHz\nProgram finished after 6 μs:\ndone.\n```\n\nDebugging with step and disassembly listing is also possible.\n\n```bash\ncargo run --bin r6502 -- debug -b ./cli/tests/assets/euclid_gcd.prg -s 0x0200\nLoaded 476 bytes at address 0040; read-only mem=false\nPC: 0200: A: 00 X: 00 Y: 00 S: 00000000 SP: 01FF\n(dbg)\u003e di\n  0200 LDA $40\n  0202 SEC\n  0203 SBC $41\n  0205 BEQ $12 (0219)\n  0207 BMI $05 (020E)\n  0209 STA $40\n  020B JMP $0202\n  020E LDX $40\n  0210 LDY $41\n  0212 STX $41\n(dbg)\u003e\n(dbg)\u003e s\nPC: 0202: A: 78 X: 00 Y: 00 S: 00000000 SP: 01FF\n(dbg)\u003e\nPC: 0203: A: 78 X: 00 Y: 00 S: 00000001 SP: 01FF\n(dbg)\u003e h\nUsage:\n  step (s)          - step one instruction\n  disassemble (di)  - disassemble instructions from current PC\n  continue (c)      - continue execution\n  \u003cempty line\u003e      - repeat last command\n  quit (q)          - quit debugger\n(dbg)\u003e\n```\n\n## Feedback \u0026 Questions\n\nPlease use the issues tracker in the home repo: \u003chttps://github.com/davidjenni/6502-emu/issues\u003e\n\n## Contributing\n\nThis project will welcome contributions in the near future. At this stage, we're not ready for contributions,\nbut do welcome your suggestions via this repository's issue tracker.\n\nInformation on how to setup a local dev environment is also detailed in this document.\n\nSee details in [CONTRIBUTING](CONTRIBUTING.md)\n\n### Code of Conduct\n\nSee details in [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidjenni%2F6502-emu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidjenni%2F6502-emu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidjenni%2F6502-emu/lists"}