{"id":26439911,"url":"https://github.com/seanwevans/xorm","last_synced_at":"2026-02-15T01:01:52.064Z","repository":{"id":279987182,"uuid":"940664857","full_name":"seanwevans/XORM","owner":"seanwevans","description":"⊕, macros, and two 8-bit registers. That's all you get.","archived":false,"fork":false,"pushed_at":"2025-10-21T17:55:18.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T19:33:34.615Z","etag":null,"topics":["8-bit","assembly","macros","programming-language","xor-machine"],"latest_commit_sha":null,"homepage":"","language":"Racket","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/seanwevans.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-28T15:19:35.000Z","updated_at":"2025-10-21T17:55:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"069dfcd0-c6d9-499b-b948-d52ee9d5f794","html_url":"https://github.com/seanwevans/XORM","commit_stats":null,"previous_names":["seanwevans/xorm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seanwevans/XORM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FXORM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FXORM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FXORM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FXORM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanwevans","download_url":"https://codeload.github.com/seanwevans/XORM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanwevans%2FXORM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29463478,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T22:42:09.113Z","status":"ssl_error","status_checked_at":"2026-02-14T22:42:05.053Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["8-bit","assembly","macros","programming-language","xor-machine"],"created_at":"2025-03-18T09:18:33.248Z","updated_at":"2026-02-15T01:01:52.044Z","avatar_url":"https://github.com/seanwevans.png","language":"Racket","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XORM (⊕M)\n\u003cimg width=\"256\" alt=\"\\oplus\" src=\"https://github.com/user-attachments/assets/acf232dd-e236-4637-8126-728d10831198\" /\u003e\n\nXORM is a tiny DSL with two 8‑bit registers (`R1` and `R0`).  Programs are\nwritten in terms of macros that expand to a small set of primitive\ninstructions executed by `run-xorm`.  Originally only XOR was available;\nthe machine now also exposes helper primitives for computing carries,\nbitwise logic and addition so that `add-r0-r1` can perform genuine\n8‑bit arithmetic.  Running a program produces a list of the final values\nof `R0` and `R1`.\n\n`XORM` (`⊕M`) is just xor, macros and two abstract 8-bit registers: `R1`\nand `R0`.  Macros are the only abstraction allowed.  The runtime supports\n`⊕` along with helper instructions for addition (`ADD` plus carry control)\nand basic bitwise logic.\n\nTo use the DSL in another Racket file:\n\n```racket\n(require \"xorm.rkt\")\n\n(module+ main\n  (do (set-r0 42))\n  (do (← 13))\n  (displayln (run-xorm xorm-program)))\n```\n\n\n\n## Setup\n\n1. Install [Racket](https://racket-lang.org/) (version 8 or newer).  The\n   `raco` command from this installation is used to run the test suite.\n2. Clone this repository and enter the directory.\n\n```\n$ git clone \u003crepo-url\u003e\n$ cd XORM\n```\n\nNo additional packages are required – all files run with the default\nRacket distribution.\n\n## Macros\n\nThe language is built entirely from macros that expand to the primitive\n`xor` instruction.  The most important forms are:\n\n- `xor` – perform `R0 ← R0 ⊕ R1`.\n- `← c` – set `R1` to the constant or register `c`.\n- `set-r0 c` – load the constant `c` into `R0`.\n- `do` – evaluate a sequence of operations.\n- `swap` – exchange the values of `R0` and `R1`.\n- `clear-r0` / `clear-r1` – set the respective register to zero.\n- `inc-r0` / `dec-r0` – increment or decrement `R0`.\n- `copy-to-r1` – copy the current value of `R0` into `R1`.\n- `not-r0` – bitwise complement of `R0`.\n- `and-r0-r1` / `or-r0-r1` – bitwise logic with the result placed in `R0`.\n- `add-r0-r1` – add `R1` to `R0` (8‑bit arithmetic with wrap-around).\n- `set-carry` / `clear-carry` – control the carry flag used by `ADD`.\n- `store-carry-in-r1` – expose the carry flag to software.\n- `shift-left-r0` / `shift-right-r0` – shift `R0` one bit left or right.\n- `\u003c\u003c` / `\u003e\u003e` – compile‑time helpers that shift numeric constants.\n\nSome operations remain *placeholders*.  Increment/decrement and the shift\nmacros are still implemented purely in terms of XOR and constant loads and\ndo **not** behave like real arithmetic shifts.  See the implementation in\n[`xorm.rkt`](xorm.rkt) for details.\n\n## Example usage\n\n### `xorm.rkt`\n\nThis file defines the XORM DSL and includes a small sample program at the\nbottom.  Running the file will execute that sample and print the resulting\nprogram and register values.\n\n```\n$ racket xorm.rkt\n```\n\nYou can modify the sequence of `(do ...)` forms at the end of the file to\nexperiment with the macros.  Each macro emits primitive instructions that\nare stored in `xorm-program` and executed by `run-xorm`.\n\n### `mrox.rkt`\n\n`mrox.rkt` is a very small \"decompiler\" that attempts to turn a sequence\nof primitive instructions back into the higher level macros.  Running the\nfile will print the example program and the decompiled form:\n\n```\n$ racket mrox.rkt\n```\n\n## Running the tests\n\nAn automated test suite lives in the `tests` directory.  After installing\nRacket you can execute all tests with:\n\n```\n$ raco test tests\n```\n\nRunning `xorm.rkt` and `mrox.rkt` directly is still useful for quick\nexperimentation:\n\n```\n$ racket xorm.rkt\n$ racket mrox.rkt\n```\n\nThe first command prints the generated instruction list and final register\nstate; the second shows a decompilation of that program.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanwevans%2Fxorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanwevans%2Fxorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanwevans%2Fxorm/lists"}