{"id":34970549,"url":"https://github.com/howerj/muxleq","last_synced_at":"2026-05-14T16:36:07.222Z","repository":{"id":230280179,"uuid":"778427497","full_name":"howerj/muxleq","owner":"howerj","description":"A two instruction set computer that greatly speeds things up over SUBLEQ","archived":false,"fork":false,"pushed_at":"2024-03-28T19:48:23.000Z","size":68,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-28T20:56:33.097Z","etag":null,"topics":["c","eforth","forth","multiplexing","mux","muxleq","oisc","subleq"],"latest_commit_sha":null,"homepage":"","language":"Forth","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/howerj.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}},"created_at":"2024-03-27T17:48:42.000Z","updated_at":"2024-03-28T20:56:35.815Z","dependencies_parsed_at":"2024-03-28T20:56:35.613Z","dependency_job_id":"7f2e03a3-cd5e-4541-b641-7a77d2d7c78e","html_url":"https://github.com/howerj/muxleq","commit_stats":null,"previous_names":["howerj/muxleq"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/howerj/muxleq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howerj%2Fmuxleq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howerj%2Fmuxleq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howerj%2Fmuxleq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howerj%2Fmuxleq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/howerj","download_url":"https://codeload.github.com/howerj/muxleq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howerj%2Fmuxleq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33033310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["c","eforth","forth","multiplexing","mux","muxleq","oisc","subleq"],"created_at":"2025-12-26T23:44:32.472Z","updated_at":"2026-05-14T16:36:07.216Z","avatar_url":"https://github.com/howerj.png","language":"Forth","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MUXLEQ\n\n* Author: Richard James Howe\n* License: The Unlicense / Public Domain\n* Email: \u003cmailto:howe.r.j.89@gmail.com\u003e\n* Repo: \u003chttps://github.com/howerj/muxleq\u003e\n\n**THE ORIGINAL MUXLEQ**.\n\nA faster SUBLEQ variant called MUXLEQ. SUBLEQ is a single instruction machine, \nthis is a two instruction machine. By just adding one instruction is becomes possible to\nspeed up the system dramatically whilst also reducing the program size. The\nmachine is not much more complex, and it would still be trivial to implement the\nsystem in hardware.\n\nSUBLEQ programs can (usually) run unaltered on the MUXLEQ CPU.\n\nMUXLEQ runs a Forth interpreter, a programming language, as a test program. \nTo run, type:\n\n\tmake run\n\nThis requires a C compiler and make to be installed.\n\nThe pseudo code for this SUBLEQ variant, MUXLEQ, is:\n\n\twhile pc \u003e= 0:\n\t\ta = m[pc + 0]\n\t\tb = m[pc + 1]\n\t\tc = m[pc + 2]\n\t\tpc = pc + 3\n\t\tif a == -1:\n\t\t\tm[b] = get_byte()\n\t\telse if b == -1:\n\t\t\tput_byte(m[a])\n\t\telse if c != -1 and c \u003c 0:\n\t\t\tm[b] = (m[a] \u0026 ~m[c]) | (m[b] \u0026 m[c])\n\t\telse:\n\t\t\tr = m[b] - m[a]\n\t\t\tif r \u003c= 0:\n\t\t\t\tpc = c\n\t\t\tm[b] = r\n\nRemoving the line `else if c != -1 and c \u003c 0:` along with the clause turns\nthis variant back into a SUBLEQ machine.\n\nPossible variants to pack as much functionality as possible in would include:\n\n* A pure single instruction muxleq variant, this would have the problem that \n  shifting bits in either direction would be expensive, however it would be an \n  interesting comparison to SUBLEQ.\n* Bit reversal, the resulting multiplexed value could have its bits reversed.\n  This could be folded into the `mux` instruction.\n* Right shift, even if only by one place.\n* Comparison, the result of comparing `m[a]` and `m[b]` could be stored in\n  `m[a]`, useful comparisons would be `is zero?`, signed or unsigned less than\n  or greater than. Any of those five would be useful.\n* The paper \u003chttps://janders.eecg.utoronto.ca/pdfs/esl.pdf\u003e \"Subleq(?): An \n  Area-Efficient Two-Instruction-Set Computer\" extends SUBLEQ in a different\n  way using bit-reversal that should lend itself to a hardware implementation\n  that uses minimal extra resources as the structure of the new instruction\n  is very similar SUBLEQ. If the `c` operand is negative it computes \n  `r = reverse(reverse(m[b]) - reverse(m[a]))`. This turns the less than or\n  equal to zero branch into a branch on evenness, allowing a quicker right\n  shift to be implemented using minimal resources. `reverse` reverses all\n  bits in a cell.\n\nThis variant greatly speeds up loading, storing and the bitwise operations,\neven with minimal effort. There are a few features missing from this MUXLEQ\nvariant (such as the \"self-interpreter\") and as such have been disabled. No\ndoubt if more effort was expended many more performance gains could be made.\n\nThe old SUBLEQ only version of the Forth interpreter can be run with:\n\n\tmake old\n\nThis is useful for speed tests.\n\nThis project could contain alternative SUBLEQ instructions and improvements\nin the future, `altleq` might be a better name for the project.\n\ngforth can be used to build the images from either `muxleq.fth` or\n`subleq.fth`, but the Forth systems are self-hosting so you can use\nthem to build the new images if you modify either Forth source file.\n\n# References\n\n* \u003chttps://github.com/howerj/subleq\u003e\n* \u003chttps://github.com/howerj/subleq-vhdl\u003e\n* \u003chttps://github.com/howerj/subleq-python\u003e\n* \u003chttps://github.com/howerj/subleq-perl\u003e\n* \u003chttps://github.com/howerj/subleq-forth\u003e\n* \u003chttps://github.com/howerj/subleq-js\u003e\n* \u003chttps://github.com/howerj/subleq-nodejs\u003e\n* \u003chttps://esolangs.org/wiki/Subleq\u003e\n* \u003chttps://en.wikipedia.org/wiki/One-instruction_set_computer\u003e\n* \u003chttps://janders.eecg.utoronto.ca/pdfs/esl.pdf\u003e\n* \u003chttps://www.gnu.org/software/gforth/\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowerj%2Fmuxleq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhowerj%2Fmuxleq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowerj%2Fmuxleq/lists"}