{"id":20765713,"url":"https://github.com/inindev/65c02_emu","last_synced_at":"2026-07-16T03:33:26.431Z","repository":{"id":148907257,"uuid":"148065890","full_name":"inindev/65c02_emu","owner":"inindev","description":"65c02 emulator","archived":false,"fork":false,"pushed_at":"2026-02-15T21:19:06.000Z","size":110,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-16T04:21:46.125Z","etag":null,"topics":["6502","6502-emulator"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inindev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-09-09T21:07:43.000Z","updated_at":"2026-02-15T21:19:10.000Z","dependencies_parsed_at":"2023-07-24T09:33:00.945Z","dependency_job_id":null,"html_url":"https://github.com/inindev/65c02_emu","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/inindev/65c02_emu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inindev%2F65c02_emu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inindev%2F65c02_emu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inindev%2F65c02_emu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inindev%2F65c02_emu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inindev","download_url":"https://codeload.github.com/inindev/65c02_emu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inindev%2F65c02_emu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35529725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-16T02:00:06.687Z","response_time":83,"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":["6502","6502-emulator"],"created_at":"2024-11-17T11:18:29.626Z","updated_at":"2026-07-16T03:33:26.426Z","avatar_url":"https://github.com/inindev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# W65C02S Emulator\n\nA complete W65C02S (CMOS 6502) processor emulator written in JavaScript with an interactive trainer/debugger interface.\n\n🚀 **[Try it live!](https://inindev.github.io/65c02_emu/)**\n\n🧪 **[Klaus Dormann 6502 Test Suite](https://inindev.github.io/65c02_emu/kd_test/)**\n\n## Features\n\n- **Full W65C02S instruction set** - All 65C02 opcodes including CMOS-specific instructions\n- **Interactive trainer/debugger** - Visual register inspector, memory viewer, single-step execution\n- **Browser-based** - No installation required, runs entirely in the browser\n- **Validation tested** - Passes Klaus Dormann's comprehensive 6502 functional test suite (~88M cycles)\n\n## Quick Start\n\n### Online Demo\n\nTry the emulator immediately: **https://inindev.github.io/65c02_emu/**\n\n### Local Development\n\n1. **Start the Web Server**\n\n```bash\nsh http_server.sh\n```\n\nThis starts a local HTTP server on port 8000.\n\n2. **Open the Trainer**\n\nNavigate to: **http://localhost:8000/**\n\n## Project Structure\n\n```\n├── index.html          # Main trainer/debugger interface\n├── w65c02s.js          # W65C02S CPU emulator core\n├── ram.js              # Memory implementation\n├── display.js          # UI and debugger logic\n├── kd_test/            # Klaus Dormann test harness\n│   ├── README.md       # Test suite documentation\n│   ├── index.html      # Test runner interface\n│   ├── test_harness.js # Test execution engine\n│   └── test_ui.js      # Test UI controller\n└── test/               # Legacy test interface\n    ├── index.html\n    └── tests.js\n```\n\n## Using the Trainer/Debugger\n\nThe main interface (`index.html`) provides:\n\n### Register Inspector\n- View and edit all CPU registers (PC, A, X, Y, SP)\n- Monitor processor flags (N, V, B, D, I, Z, C)\n- Click any value to edit directly\n\n### Memory Viewer\n- Hexadecimal memory dump\n- Navigate to any address\n- View disassembled instructions\n\n### Execution Controls\n- **Step** - Execute one instruction\n- **Run** - Continuous execution\n- **Stop** - Halt execution\n- **Reset** - Reset CPU to initial state\n\n### Code Entry\n- Enter 6502 assembly code or hex bytes\n- Load programs into memory\n- Execute from any address\n\n## Validation\n\nThis emulator has been validated against Klaus Dormann's comprehensive 6502 functional test suite, which exercises:\n- All instruction opcodes and addressing modes\n- Flag behavior (N, V, Z, C)\n- Stack operations\n- Interrupt handling\n\nSee [kd_test/README.md](kd_test/README.md) for details on running the test suite.\n\n**Test Results:**\n- ✅ 6502 Functional Test: **PASSED** (87,947,229 cycles)\n- ✅ 65C02 Extended Opcodes: **PASSED**\n\n## Architecture\n\n### W65C02S Core (`w65c02s.js`)\n\nThe emulator implements:\n- All 17 addressing modes (absolute, zero page, indexed, indirect, etc.)\n- Complete instruction set including 65C02 extensions\n- Accurate flag behavior and timing\n- Stack operations with proper push/pull semantics\n\nKey classes:\n- `W65C02S` - Main CPU emulator\n- `Register6502` - Register file (A, X, Y, PC, SP, flags)\n- `Flags6502` - Processor status register\n\n### Memory Model (`ram.js`)\n\n- 64KB addressable memory space\n- Read/write operations\n- 16-bit word operations (little-endian)\n\n### Display/Debugger (`display.js`)\n\n- Real-time register updates\n- Memory visualization\n- Disassembly view\n- Execution control\n\n## Development\n\n### Browser Compatibility\n\nWorks in all modern browsers with ES6 support:\n- Chrome/Edge\n- Firefox\n- Safari\n\n### Local Development\n\nNo build process required - pure JavaScript:\n\n```bash\n# Start local server\nsh http_server.sh\n\n# Or use Python's built-in server\npython3 -m http.server 8000\n```\n\n## Technical Details\n\n### W65C02S Specifications\n\n- **Architecture**: 8-bit CMOS microprocessor\n- **Address Space**: 64KB (16-bit addressing)\n- **Registers**: A (accumulator), X, Y (index), PC (program counter), SP (stack pointer)\n- **Flags**: N (negative), V (overflow), B (break), D (decimal), I (interrupt), Z (zero), C (carry)\n- **Stack**: 256 bytes (0x0100-0x01FF), descending\n\n### References\n\n- [W65C02S Datasheet](http://www.wdesignc.com/wdc/documentation/w65c02s.pdf)\n- [6502 Flag Tutorial](http://www.6502.org/tutorials/vflag_html)\n- [Klaus Dormann Test Suite](https://github.com/Klaus2m5/6502_65C02_functional_tests)\n\n## Known Bugs Fixed\n\n- ✅ **PHP instruction** - Now correctly sets B flag when pushing status to stack\n- ✅ **BRK instruction** - Now properly pushes PC+2 and status, sets flags, jumps to IRQ vector\n\n## License\n\nGNU General Public License v3.0\n\nCopyright © 2018 John Clark\n\nSee [LICENSE](LICENSE) for full license text.\n\n## Contributing\n\nBug reports and pull requests welcome! This emulator aims for cycle-accurate emulation of the W65C02S.\n\n### Testing Changes\n\nAlways run the Klaus Dormann test suite after making changes:\n\n```bash\n# See kd_test/README.md for setup\ncd kd_test\n# Download test binaries (see README)\n# Open http://localhost:8000/kd_test\n# Load and run tests\n```\n\n## Credits\n\n- **CPU Implementation**: John Clark\n- **Test Suite**: Klaus Dormann ([6502_65C02_functional_tests](https://github.com/Klaus2m5/6502_65C02_functional_tests))\n- **W65C02S Specifications**: Western Design Center ([Datasheet](https://www.westerndesigncenter.com/wdc/documentation/w65c02s.pdf))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finindev%2F65c02_emu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finindev%2F65c02_emu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finindev%2F65c02_emu/lists"}