{"id":17930917,"url":"https://github.com/quattromusic/6502-simulator","last_synced_at":"2025-03-24T04:31:33.800Z","repository":{"id":258409116,"uuid":"852919741","full_name":"QuattroMusic/6502-Simulator","owner":"QuattroMusic","description":"A simple to use 6502 simulator, featuring a code viewer, keyboard input and a display!","archived":false,"fork":false,"pushed_at":"2024-10-23T20:40:40.000Z","size":4032,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-24T06:24:20.935Z","etag":null,"topics":["6502","assembly","emulator","simulator"],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuattroMusic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-09-05T16:53:01.000Z","updated_at":"2024-10-20T00:48:45.000Z","dependencies_parsed_at":"2024-10-25T16:15:38.246Z","dependency_job_id":null,"html_url":"https://github.com/QuattroMusic/6502-Simulator","commit_stats":null,"previous_names":["quattromusic/6502-simulator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuattroMusic%2F6502-Simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuattroMusic%2F6502-Simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuattroMusic%2F6502-Simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuattroMusic%2F6502-Simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuattroMusic","download_url":"https://codeload.github.com/QuattroMusic/6502-Simulator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245211199,"owners_count":20578370,"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","assembly","emulator","simulator"],"created_at":"2024-10-28T21:18:35.205Z","updated_at":"2025-03-24T04:31:33.787Z","avatar_url":"https://github.com/QuattroMusic.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 6502-Simulator\nA simple to use 6502 simulator, featuring a code viewer, keyboard input and a display!\n\n![[image]](_data/6502.png)\n\n![[video]](_data/hello_6502.gif)\n\n## Technical specifications\n- 32kB RAM and ROM\n- 120x80 display\n- Date and time in RAM\n- Keyboard input\n- Frequency selector in the range of 1Hz to 1GHz\n\n### Address Space\n```\n┌───────────────┐\n│               │ 0x0000\n│   Zero Page   │\n│               │ 0x00FF\n├───────────────┤\n│               │ 0x0100\n│     Stack     │\n│               │ 0x01FF\n├───────────────┤\n│               │ 0x0200\n│      RAM      │\n│               │ 0x7FFF\n├───────────────┤\n│               │ 0x8000\n│      ROM      │\n│               │ 0xFFF9\n├───────────────┤\n│   NMI Vector  │ 0xFFFA\n│    (unused)   │ 0xFFFB\n├───────────────┤\n│   RES Vector  │ 0xFFFC \u0026 0xFFFD\n├───────────────┤\n│   IRQ Vector  │ 0xFFFE\n│    (unused)   │ 0xFFFF\n└───────────────┘\n```\n\nThe Zero Page is considered as RAM, it's just an optimized way for the memory operations (less cycles).\n\nThe RAM is then subdivided as below:\n```\n┌───────────────┐\n│               │ 0x0200\n│    Display    │\n│               │ 0x277F\n├───────────────┤\n│    Keyboard   │ 0x2780\n│     Input     │\n├───────────────┤\n│     Year      │ 0x2781 \u0026 0x2782\n├───────────────┤\n│     Month     │ 0x2783\n├───────────────┤\n│      Day      │ 0x2784\n├───────────────┤\n│     Hours     │ 0x2785\n├───────────────┤\n│    Minutes    │ 0x2786\n├───────────────┤\n│    Seconds    │ 0x2787\n├───────────────┤\n│ Milliseconds  │ 0x2788 \u0026 0x2789\n├───────────────┤\n│               │ 0x278A\n│      RAM      │\n│               │ 0x7FFF\n└───────────────┘\n```\n\nThe Year and the Milliseconds section is stored as little-endian (see programmers model)\n\nNote: you can use the display space as RAM storage without any problem, but not the input and date space.\nThe keyboard input only works when the display is open\n\n### Programmers Model\nAt the beginning of the exectution, the 6502 will read the data at the address `0xFFFC` and `0xFFFD` (RES Vector).\nThe resulted address will give the entry point of your program (see examples or the minimal code).\n\nMultiple byte data is stored in little-endian, so, the address `0x1234` will be stored the RAM as `0x34` and `0x12`\n\nThe 6502 features 3 general purpose 8b registers, called `A` (accumulator), `X` and `Y`.\nThen there's the 16b `PC` (Program Counter) used to point at the instruction in the ROM,\nan 8b register `S`, which points to the next free slot in the stack (0xFF at startup, downwards)\nand the 8b `P` reg, which includes the flags used for comparisons and branching.\n\n```\n   MSB                             LSB\n    ┌───┬───┬───┬───┬───┬───┬───┬───┐\nP = │ N │ V │ - │ B │ D │ I │ Z │ C │\n    └───┴───┴───┴───┴───┴───┴───┴───┘\n```\n- `N`: Negative result\n- `V`: Overflow\n- `B`: BRK instruction\n- `D`: Decimal mode\n- `I`: IRQ disable (unused)\n- `Z`: zero result\n- `C`: Carry = !Borrow\n\nFor a complete list of the implemented intrinsics, you may look at this [cheatsheet](https://www.atarimania.com/documents/6502%20(65xx)%20Microprocessor%20Instant%20Reference%20Card.pdf)\n\n## Installation\n\n1. Download the simulator from this repository\n2. Download the [Vasm compiler](http://www.compilers.de/vasm.html) (`vasm6502_oldstyle.exe`) and add it to the same folder of the executable, or setup environment variables\n3. Enjoy!\n\n## How to use\n\n1. Open the simulator\n2. Create a file on your pc\n3. Drag and drop the file on the simulator\n4. Open your favourite IDE and edit the file\n5. Enjoy!\n\nNote: every time you save the file, the program automatically reload it\n\n### Minimal Code\n```\n    .org $8000\ninit:\n    ; your code here!\n\n    .org $FFFC\n    .word init\n    .word $0000\n```\n\n## Roadmap\n\n### Version 1.0\n- [x] display\n- [x] keyboard input\n- [x] date in memory\n- [x] fix / improve 6502 engine\n\n### Version 2.0\n- [x] render and gui revamp\n- [x] options panel + save configurations to file\n\n### Version 3.0\n- [ ] panel for the 6502 instruction set\n- [ ] use an internal 6502 compiler\n\n### Version 4.0\n- [ ] error handling\n- [ ] code editor instead of code viewer\n\n\n# License\n\nI don't like the way the license system works, so instead of searching for a license that satisfies me, I'm making my own version.\n\n#### What this software allows you to do\nYou can keep the source code on your devices; you may compile it and use it for private or public use.\n\n#### What this software doesn't allow you to do\nEven if you've modified it, I don't want you to use this product for commercial use or to distribute under your name;\nI put a lot of effort on this project, for learning purposes, and to make it possible for everyone to use a 6502 simulator to learn assembly in the easiest possible way.\n\n#### In short\nUse it wherever you want, but please do not use this project for commercial purposes; it's an educational tool that I want accessible to everyone.\n\n## Contact me\n\nQuestions? Bugs? Ideas? Feel free to contact me on Discord `@quattromusic`!\n\nJoin [my server](https://discord.gg/wXECkMJb6V) for the latest news.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquattromusic%2F6502-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquattromusic%2F6502-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquattromusic%2F6502-simulator/lists"}