{"id":22122735,"url":"https://github.com/timendus/silicon8","last_synced_at":"2025-07-08T08:04:58.645Z","repository":{"id":45913875,"uuid":"343889186","full_name":"Timendus/silicon8","owner":"Timendus","description":"A Go implementation of Chip-8, SCHIP and XO-Chip for WebAssembly","archived":false,"fork":false,"pushed_at":"2023-05-30T20:23:34.000Z","size":16421,"stargazers_count":28,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T09:11:28.326Z","etag":null,"topics":["chip-8","emulator","go","interpreter","javascript","tinygo","vm","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://timendus.github.io/silicon8/","language":"Roff","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/Timendus.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":"2021-03-02T19:30:15.000Z","updated_at":"2024-12-18T20:55:48.000Z","dependencies_parsed_at":"2024-12-01T15:31:05.136Z","dependency_job_id":"39169cab-16b8-4483-872d-9e00dad5b4be","html_url":"https://github.com/Timendus/silicon8","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Timendus/silicon8","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timendus%2Fsilicon8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timendus%2Fsilicon8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timendus%2Fsilicon8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timendus%2Fsilicon8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Timendus","download_url":"https://codeload.github.com/Timendus/silicon8/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timendus%2Fsilicon8/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264229252,"owners_count":23576239,"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":["chip-8","emulator","go","interpreter","javascript","tinygo","vm","wasm","webassembly"],"created_at":"2024-12-01T15:27:33.613Z","updated_at":"2025-07-08T08:04:58.621Z","avatar_url":"https://github.com/Timendus.png","language":"Roff","readme":"[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/T6T0DOOWP)\n\n# Silicon8\n\nSilicon8 is an implementation of a runtime for Chip-8, SCHIP and XO-Chip in Go\nthat can be used in Go projects or it can be compiled to WebAssembly so it can\nrun in your web browser (or anywhere WebAssembly can run).\n\nTo try it running in your browser, visit https://timendus.github.io/silicon8/\nand load a CHIP-8 ROM file.\n\nPlease note that it is not perfect, and you may run into some bugs. Especially when the auto-detection fails to detect SCHIP and XO-CHIP programs. More about that [below](#august-2021).\n\nThis is my first experiment with both WebAssembly and Go. So I'll probably look\nback on this repository with shame in a very short amount of time 😉 But that's\nthe point of this, this is a learning project for me.\n\n## Development log\n\n### March 2021\n\nIt's still missing a couple of features and instructions, and I'm sure there's\nstill a few problems here and there on the Chip interpretation side of things.\nBut most of the hard WASM/Go/JavaScript boundary related stuff is done.\n\nThe interpreter currently builds and runs as WebAssembly on NodeJS in the\nterminal with `npm start`. You'll have to hard-code a file to load in `run.js`.\nI'm still playing with a pure Go front-end, and the browser front-end is also\nstill a to do. But I can probably use this pretty much as a drop-in replacement\nfor my existing [web based Chip-8 play thing](https://github.com/Timendus/chip-8).\n\nWe'll see where this goes 😄\n\n### July 2021\n\nAlright, having a couple of days off, it's time to finish(?) this project 😉\n\nFirst, I added the ability to provide it with a CHIP-8 binary of your choice as\na command line parameter. Having to hard-code the ROM has annoyed me for a\nwhile.\n\nSecond, it was time to start finding the interpretation issues that were still\npresent, so I decided to start writing some automated tests. After about a week\nof writing tests and fixing bugs here and there, on and off, I think I now feel\nkind of safe saying that the interpreter works as it should for CHIP-8.\n\n![Space Invaders by David Winter, although that has a bug in and of itself](console.png)\n\nAlso, I added a web-based front-end for the interpreter that works nicer and\nlooks better than the console based version.\n\nNext up: Time to work on the SCHIP and XOCHIP features some more 😄\n\n### August 2021\n\nSCHIP high resolution mode works. Most instructions have been implemented (not\nall have been tested) except for the 16 by 16 pixel sprites and XO-CHIP's four\ncolour mode. I'm going to refactor stuff a bit before I fix those, because I\nintend to just hand the external runtime a colour bitmap to render from the\n(WebAssembly) Go package. That should make it easier to implement a runtime and\nallows for a fancy 16-colour mode. In theory. We'll see 😄\n\nI added an auto-detect mode that tries to determine the version of CHIP-8 used\nat runtime. I figured that programs that use specific instructions or access\nmemory outside of the regular limits can be safely bumped to SCHIP or XO-CHIP.\nThe feature works, but the number of programs that are accurately auto-detected\nis lower than I expected. A program can use none of the SCHIP features, and\nstill expect to be run on SCHIP with all the quirks of that platform, for\nexample. Same with developers writing programs for XO-CHIP without actually\nusing anything beyond CHIP-8 and SCHIP instructions. No way to tell from just\nthe binary.\n\n### Second half of August 2021\n\nAfter doing a pretty big refactor, the host environment now just has to call the\n`clockTick` function 60 times per second, and it will get a callback with the\nnew image to display when the screen has been updated. This is a much cleaner\nsolution that doesn't require as much knowledge of the interpreter internals on\nthe host side.\n\nAlso, as mentioned above, the image that the host environment receives is now a\ncolour image (three bytes per pixel), which has allowed me to more easily\nimplement XO-CHIPs four colour mode. Beyond that, I added the option to draw 16\ncolours to the screen using four planes. [John\nEarnest](https://github.com/JohnEarnest) mentions this posibility in [his\nproposal for XO-CHIP](https://github.com/JohnEarnest/Octo/blob/gh-pages/docs/XO-ChipSpecification.md),\nbut Octo doesn't implement it:\n\n\u003e Encoding is chosen such that it would be possible to provide 4 bitplanes (and\n\u003e thus 16 colors!) in the future should it prove necessary.\n\nAlthough I'm not quire sure I would call it necessary, it's certainly cool.\n\n![Showing 16 colours in Silicon8](colours.png)\n\nTo properly test all the display stuff I added two expectations to Jest that\nallow me to capture the contents of the display in a BMP file, and then test\nagainst that file. This allows for easy and quick visual inspection to see if\nthe test results in the right image, and to be alerted when anything breaks\nthat.\n\nFinally, I made [\"Pixel Studio\"](https://timendus.github.io/silicon8/pixel-studio/)\nto convert images to sprite data in a what-you-see-is-what-you-get type of way.\nIt supports one through four planes of colour, all possible sprite sizes and\noptional dithering.\n\n### November 2021\n\nJust a few small changes. So far at least.\n\nHaving recently discovered the existence of the [Gamepad\nAPI](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API)\nI figured I should add gamepad support to Silicon8. It's a pretty simple API and\nthe code wasn't that complicated, but for some reason I'm not seeing my gamepad\nin any browser other than Safari. That may have to do with my gamepad, but it is\npretty weird. Anyway, it works fine in Safari, and it \"should work\" for other\nbrowsers too, I guess. To use it, open Silicon8, connect your gamepad if it\nisn't already connected and press a button on it. Silicon8 should give you a\nnotification that it found your gamepad.\n\nNext, I moved the fonts from the host environment to the Go module, so host\nenvironments don't have to bother with that mess. This is something I had been\nplanning on doing for a long time, because it makes moving the interpreter to\nother platforms easier, which is something I kinda plan on doing 👌🏻\n\nThen, [Kouzeru](https://github.com/Kouzeru) reached out to me, and urged me to\nimplement the new XO-Chip opcode `pitch` in Silicon8. When I admitted to him\nthat the prerequisite opcode `audio` wasn't even working, he immediately offered\nhis support. Step one was just making the `audio` pattern and the `pitch`\navailable to the host environment. Then I had to turn those two into a sound\nthat makes sense. The\n[specification](https://github.com/JohnEarnest/Octo/blob/gh-pages/docs/XO-ChipSpecification.md#audio)\nis vague to say the least and the [implementation in\nOcto](https://github.com/JohnEarnest/Octo/blob/77fc843d9f44a45ebb0cbd9f3ea2ec14caba4851/js/shared.js#L198)\nkinda went over my head. But with a snippet of FFT code from Kouzeru, some\npatient explanations and some experimentation I managed to get it working. So\nnow Silicon8 finally has XO-Chip sound support! 😄\n\nThe only question that remains is: should all this frequency calculation magic\nbe in the host environment, or should it really be moved to the Go module? And\nit so, what exactly does the module pass to the host? I'm not sure. We'll see.\n\nFinally, I added an overlay that allows the user to select the compatibility\ntype and execution speed of the interpreter. I was really hoping the\nauto-detection would be enough, but it clearly isn't. Also, only being able to\nset the execution speed \"blind\" with the -/+ keys was not to my liking.\n\nA big thanks to @MinThaMi for fixing a nasty CSS issue with Safari 🎉\n\n### August 2022\n\nIn June and July of this year I wrote a [CHIP-8 test\nsuite](https://github.com/Timendus/chip8-test-suite) that people can use to test\nif their interpreter works as it should. I discovered to my dismay that Silicon8\ndidn't do so well when it came to my very own keypad tests. So I fixed the\nkeyboard 😉\n\n## Developer instructions\n\n### How to run\n\nIn the console, using NodeJS:\n\n```bash\ngit clone git@github.com:Timendus/silicon8.git\ncd silicon8\n./run.js ./tests/abc.ch8 # Should run the interpreter with a given CHIP-8 binary\n```\n\nKey `Q` or `Ctrl+C` exits the interpreter.\n\n### How to serve the website\n\n```bash\nnpm install\nnpm run serve # Should serve the web version on localhost:8080\n```\n\n### How to build\n\n```bash\nbrew install tinygo # Or use your own favourite package manager\nnpm run build # Should rebuild the WebAssembly Go module\n```\n\n### How to test\n\n```bash\nnpm install\nnpm test # Should run the tests\n```\n","funding_links":["https://ko-fi.com/T6T0DOOWP"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimendus%2Fsilicon8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimendus%2Fsilicon8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimendus%2Fsilicon8/lists"}