{"id":13419557,"url":"https://github.com/irmen/pyc64","last_synced_at":"2025-12-30T01:01:41.384Z","repository":{"id":23922743,"uuid":"100173522","full_name":"irmen/pyc64","owner":"irmen","description":"Commodore-64 simulator in pure Python","archived":false,"fork":false,"pushed_at":"2023-11-17T13:27:38.000Z","size":1560,"stargazers_count":80,"open_issues_count":2,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-07-31T22:49:50.839Z","etag":null,"topics":["commodore-64","emulator","petscii"],"latest_commit_sha":null,"homepage":"","language":"Python","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/irmen.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":"2017-08-13T11:58:56.000Z","updated_at":"2024-05-31T18:58:02.000Z","dependencies_parsed_at":"2024-10-26T16:05:11.338Z","dependency_job_id":"6f52343e-8091-4f0c-a5d5-046519920d77","html_url":"https://github.com/irmen/pyc64","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyc64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyc64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyc64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irmen%2Fpyc64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irmen","download_url":"https://codeload.github.com/irmen/pyc64/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690111,"owners_count":20331726,"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":["commodore-64","emulator","petscii"],"created_at":"2024-07-30T22:01:17.660Z","updated_at":"2025-12-30T01:01:34.317Z","avatar_url":"https://github.com/irmen.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# pyc64: Commodore-64 simulator in pure Python!\n\n![Screenshot one](demo_screenshot1.png)\n\n... Or is it?\n\nWell, it emulates the character mode *with sprites* quite well and thus you can display pretty PETSCII pictures if you want.\nIt's generally not possible to run actual C-64 software, but that's not the real goal\nof this project. (Look at actual c-64 emulators such as Vice or CCS64 if you want that)\n\n\n## 6502 machine code execution\n\nYes, this thing can actually run 6502 machine code and\nhas a built-in machine code monitor.\nThis is made possible by the awesome [py65](https://github.com/mnaberez/py65) library. \nNote that while it can run the 6502 code,\nyou can only do the same things with it as what is supported\nfor the BASIC mode. So no fancy screen scrolling or rasterbars...\n\n\n## Can run the real BASIC and KERNAL roms! True C64 emulation! \n\nIf basic/kernal/chargen ROM files are supplied in the roms folder,\nthe simulator will load these and make them part of the memory of the machine as ROM areas.\nIf you run the ``startreal64`` program, it will load the ``realemulator`` module\ninstead of the simulated one, and will *actually run the C64 BASIC ROM*. \n\nYou can type anything in BASIC that you could type on a real C64 too!\n\nUnfortunately, the I/O is not emulated so it is not possible to load or save\nyour programs in this mode.\n\nOn my machine the current code runs at around 0.6 Mhz in regular Python \n(around half the speed of a real c64),\nand between 2 and 3 Mhz in Pypy (there is a lot more speed than this obtainable\nwith pypy, but that makes the c64's basic mode more or less unusable)\n\n### I/O Emulation\nIn real mode, you can load real programs using I/O emulation.\nAlso you can specify load file at boot: for example, for loading drive8/hello.prg at boot type\n\n\u003e python3 startreal64.py hello\n\nTry also:\n\n\u003e python3 startreal64.py gary2\n\nTAPE are redirected to drive8\n\n\n\n## BASIC V2 and the VIC-registers (video chip)\n\nA subset and variant of the BASIC V2 in the C-64 is provided.\n\nSome VIC-II registers have been made available:\n\n- 53280 and 53281 screen and border colors ($d020/$d021)\n- 646 cursor color ($0286)\n- 1024-2023 the screen buffer characters ($0400-$07e7) \n- 55296-56295 the screen buffer colors ($d800-$dbe7)\n- 53272 charset shift/unshift register ($d018)\n- 53265 and 53270 horizontal and vertical smooth scroll registers ($d011/$d016)\n- 56320 joystick port 2 bits\n- the [sprite](https://www.c64-wiki.com/wiki/Sprite) registers! (no multicolor though, and no priority register and collision detection)\n\n\n## Keyboard\n\nA few function keys are remapped as wel for convenience, like the fastloader cartridges of old:\n\n- F1 = LIST:\n- F3 = RUN:\n- F5 = LOAD shortcut\n- F6 (shift-F5): LOAD \"*\",8  shortcut\n- F7 = DOS\"$ to show directory of drive8\n\nOther uncommon keys:\n- Esc = RUN/STOP\n- Ctrl = Commodore key\n- PgUp = RESTORE key\n- Insert/Help = INSERT\n- End = move to end of current logical line\n- the reset button on top = perform warm reset\n- numpad keys = joystick (r_ctrl or 0 or enter = fire)\n\nNote that most of the BASIC operations are essentially handled by Python itself via eval(),\nso you can do many interesting things that are silly to see working on a classic 80's c-64 screen.\nFor instance, try ``print 5**123``  or ``print sys.platform`` or ``print sum(log(x) for x in range(1,10))``\n\nIt is not yet supported to do any blocking operation such as INPUT or WAIT.\nHowever, GET *is* supported (which gets one keypress from the keyboard buffer)\nSo simple interactive programs can be created.\n\n\n## 1541 disk drive\n\nRudimentary read-only support for a simulated disk drive is available.\nSome demo programs are included 'on the disk' (=the 'drive8' directory),\nincluding some that draw some pretty PETSCII images as seen in the\nscreenshot.\n\n\n## Python REPL in your C64\n\nEnter the 'gopy' command to switch to a Python REPL, and use 'go64' to switch back to BASIC.\nSome convenience symbols are provided in the REPL to access the screen\nand memory for instance. Try 'dir()' to see what's there.\n\n\n## dependencies\n\nYou'll need the [pillow](https://pillow.readthedocs.io) library because \nthe program needs to do some charset bitmap conversions at startup for tkinter.\n\nYou'll also need the [cbmcodecs2](https://github.com/irmen/cbmcodecs2) library to handle\ntranslation of ASCII text to and from the C-64's PETSCII and screencode values.\n\nIf you want to execute 6502 machine code or inspect the memory via a\nmachine code monitor, you also need the [py65](https://github.com/mnaberez/py65) library. \n()This allows you to actually run a few simple \"real\" C64 programs! Some of them \nare included on the 'virtual disk' in this project)\n\n## screenshots\n\nPETSCII image:\n\n![Screenshot](demo_screenshot2.png)\n\nPython mode:\n\n![Screenshot](demo_screenshot3.png)\n\nReal emulation of a C64:\n\n![Screenshot](demo_screenshot4.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firmen%2Fpyc64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firmen%2Fpyc64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firmen%2Fpyc64/lists"}