{"id":15049323,"url":"https://github.com/visrealm/vremu6502","last_synced_at":"2025-03-17T16:12:37.786Z","repository":{"id":174973698,"uuid":"450742846","full_name":"visrealm/vrEmu6502","owner":"visrealm","description":"6502/65C02 emulator library (C99)","archived":false,"fork":false,"pushed_at":"2024-11-03T05:21:10.000Z","size":502,"stargazers_count":48,"open_issues_count":1,"forks_count":17,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-02T14:18:45.715Z","etag":null,"topics":["6502","6502-emulation","6510","65c02","65c02-emulation","c","c99","emulator","r65c02","wdc65c02"],"latest_commit_sha":null,"homepage":"","language":"C","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/visrealm.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}},"created_at":"2022-01-22T07:01:35.000Z","updated_at":"2025-02-02T22:29:53.000Z","dependencies_parsed_at":"2024-02-02T07:26:15.843Z","dependency_job_id":"3d0274af-eba6-4436-96c0-f3c1702d2daf","html_url":"https://github.com/visrealm/vrEmu6502","commit_stats":null,"previous_names":["visrealm/vremu6502"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visrealm%2FvrEmu6502","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visrealm%2FvrEmu6502/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visrealm%2FvrEmu6502/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visrealm%2FvrEmu6502/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visrealm","download_url":"https://codeload.github.com/visrealm/vrEmu6502/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066189,"owners_count":20392406,"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","6510","65c02","65c02-emulation","c","c99","emulator","r65c02","wdc65c02"],"created_at":"2024-09-24T21:19:46.044Z","updated_at":"2025-03-17T16:12:37.765Z","avatar_url":"https://github.com/visrealm.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vrEmu6502\n\n\u003ca href=\"https://github.com/visrealm/vrEmu6502/actions/workflows/cmake-multi-platform.yml\"\u003e\u003cimg src=\"https://github.com/visrealm/vrEmu6502/actions/workflows/cmake-multi-platform.yml/badge.svg\"/\u003e\u003c/a\u003e\n\n6502/65C02 emulator written in standard C99 with no external dependencies.\n\nInitially created for my [HBC-56 (6502 on a backplane) Emulator](https://github.com/visrealm/hbc-56)\n\nIncludes:\n* Support for standard 6502/6510, 65C02, WDC65C02 and R65C02.\n* Supports all unofficial (\"illegal\") 6502/6510 opcodes (Use model value `CPU_6502U`).\n* Correct handling of Decimal mode.\n* Accurate instruction timing.\n* All WDC and Rockwell-specific 65C02 instructions.\n* User-supplied I/O callbacks.\n* IRQ and NMI signals.\n* Multiple CPU instances.\n* Instruction disassembler.\n* Test runner.\n\n## Test suite\nIncludes a test program which was designed to run [Klaus Dormann's 6502 tests](https://github.com/Klaus2m5/6502_65C02_functional_tests).\n\nPasses all tests:\n* 6502_functional_test (all models)\n* 6502_decimal_test (with valid and invalid bcd) (6502)\n* 65C02_decimal_test (with valid and invalid bcd) (all 65C02 models)\n* 65C02_extended_opcodes_test (Standard 65C02)\n* W65C02_extended_opcodes_test (WDC65C02)\n* R65C02_extended_opcodes_test (R65C02)\n\nSee the [test](test) directory or more details.\n\n## Building\n\nvrEmu6502 uses the CMake build system\n\n#### Checkout repository:\n\n```\ngit clone https://github.com/visrealm/vrEmu6502.git\ncd vrEmu6502\n```\n\n#### Setup build:\n\n```\nmkdir build\ncd build\ncmake ..\n```\n\n#### Build\n\n```\ncmake --build .\n```\nWindows: Optionally, open the generated solution file\n\n#### Run tests\n```\nctest\n```\nWindows: Optionally, build the ALL_TESTS project in the generated solution file\n\n## Quick start\n\n```C\n#include \"vrEmu6502.h\"\n\nuint8_t ram[0x8000];\nuint8_t rom[0x8000];\n\nuint8_t My6502MemoryReadFunction(uint16_t addr, bool isDbg)\n{\n  if (addr \u003c 0x8000)\n  {\n    return ram[addr];\n  }\n  return rom[addr \u0026 0x7fff];\n}\n\nvoid My6502MemoryWriteFunction(uint16_t addr, uint8_t val)\n{\n  if (addr \u003c 0x8000)\n  {\n    ram[addr] = val;\n  }\n}\n\n/* fill rom with something that makes sense here */\n\n\n/* create a new WDC 65C02. */  \nVrEmu6502 *my6502 = vrEmu6502New(CPU_W65C02, My6502MemoryReadFunction, My6502MemoryWriteFunction);\n\nif (my6502)\n{\n  /* if you want to interrupt the CPU, get a handle to its IRQ \"pin\" */\n  vrEmu6502Interrupt *irq = vrEmu6502Int(my6502);\n\n  /* reset the cpu (technically don't need to do this as vrEmu6502New does reset it) */\n  vrEmu6502Reset(my6502);\n\n  while (1)\n  {\n    /* call me once for each clock cycle (eg. 1,000,000 times per second for a 1MHz clock) */\n    vrEmu6502Tick(my6502);\n        \n    /* interrupt it? */\n    if (myHardwareWantsAttention)\n    {\n      *irq = IntRequested;\n      \n      /* at some point, the hardware will be happy and it will need to release the interrupt */\n    }\n  }\n\n  vrEmu6502Destroy(my6502);\n  my6502 = NULL;\n}\n```\n\nSee  [HBC-56](https://github.com/visrealm/hbc-56) for real-life example usage.\n\n\n## License\nThis code is licensed under the [MIT](https://opensource.org/licenses/MIT \"MIT\") license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisrealm%2Fvremu6502","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisrealm%2Fvremu6502","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisrealm%2Fvremu6502/lists"}