{"id":19848231,"url":"https://github.com/omrawaley/chip-8-assembler","last_synced_at":"2025-02-28T20:29:37.439Z","repository":{"id":257125423,"uuid":"850441058","full_name":"omrawaley/chip-8-assembler","owner":"omrawaley","description":"A simple, straightforward assembler for the Chip-8.","archived":false,"fork":false,"pushed_at":"2024-09-14T19:02:59.000Z","size":118,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T12:46:42.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omrawaley.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":"2024-08-31T19:21:42.000Z","updated_at":"2024-09-03T00:44:42.000Z","dependencies_parsed_at":"2024-09-15T00:24:03.335Z","dependency_job_id":"b65438f3-ca40-443d-a1ce-bb1bbac5686e","html_url":"https://github.com/omrawaley/chip-8-assembler","commit_stats":null,"previous_names":["omrawaley/chip-8-assembler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omrawaley%2Fchip-8-assembler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omrawaley%2Fchip-8-assembler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omrawaley%2Fchip-8-assembler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omrawaley%2Fchip-8-assembler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omrawaley","download_url":"https://codeload.github.com/omrawaley/chip-8-assembler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241226812,"owners_count":19930487,"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":[],"created_at":"2024-11-12T13:16:38.521Z","updated_at":"2025-02-28T20:29:37.417Z","avatar_url":"https://github.com/omrawaley.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Chip-8 Assembler\n\nA basic assembler with labels that can be used to create programs for the Chip-8.\n\n\n## Authors\n\n- [@omrawaley](https://www.github.com/omrawaley)\n\n\n## Instruction Table\n\n| Mnemonic | Opcode     | Operands                |\n| :-------- | :------- | :------------------------- |\n| `CLS` | `00E0` | None |\n| `RET` | `00EE` | None |\n| `JMP` | `1NNN` | Addr OR Label |\n| `CALL` | `2NNN` | Addr |\n| `SERB` | `3XNN` | Reg, Byte |\n| `SNERB` | `4XNN` | Reg, Byte |\n| `SERR` | `5XY0` | Reg, Reg |\n| `LDRB` | `6XNN` | Reg, Byte |\n| `ADDRB` | `7XNN` | Reg, Byte |\n| `LDRR` | `8XY0` | Reg, Reg |\n| `OR` | `8XY1` | Reg, Reg |\n| `AND` | `8XY2` | Reg, Reg |\n| `XOR` | `8XY3` | Reg, Reg |\n| `ADDRR` | `8XY4` | Reg, Reg |\n| `SUBRR` | `8XY5` | Reg, Reg |\n| `SHR` | `8XY6` | Reg, Reg |\n| `SUBNRR` | `8XY7` | Reg, Reg |\n| `SHL` | `8XYE` | Reg, Reg |\n| `SNERR` | `9XY0` | Reg, Reg |\n| `LDI` | `ANNN` | Addr |\n| `JMP0` | `BNNN` | Addr |\n| `RND` | `CXNN` | Reg, Byte |\n| `DRW` | `DXYN` | Reg, Reg, Nibble |\n| `SKP` | `EX9E` | Reg |\n| `SKNP` | `EXA1` | Reg |\n| `LDRDT` | `FX07` | Reg |\n| `LDRK` | `FX0A` | Reg |\n| `LDDTR` | `FX15` | Reg |\n| `LDSTR` | `FX18` | Reg |\n| `ADDIR` | `FX1E` | Reg |\n| `LDFR` | `FX29` | Reg |\n| `LDBR` | `FX33` | Reg |\n| `LDMIR` | `FX55` | Reg |\n| `LDRMI` | `FX65` | Reg |\n\n## Features\n\n### Comments\n\nComments can be used to provide information or notes.\n\nSingle-line comments are denoted using a semicolon (`;`). \n\nComments can either have their own line or be placed after an existing line, but they cannot be placed after labels.\n\n```\n; This is a comment!\n\nLDRB 0 A    ;0x200    And this one, too! \n```\n\n### Labels\n\nLabels can be used to mark sections of code which makes jumping easier.\n\nLabels are denoted using a period (`.`).\n\nWhen referring to an existing label in a `JMP` instruction, do not include the period.\n\n```\n.add\nADDRR 3 4   ;0x200  Add reg 3 to reg 4\n\nJMP add     ;0x202  Jump to 0x200\n```\n\n### Definitions\n\nDefinitions can be used to assign a name to a value which the preprocessor then replaces with the actual value.\n\nDefinitions are denoted using a hashtag (`#`).\n\nIf you have ever used C or C++, definitions are essentially `#define`.\n\n```\n#count A      ;      Create a definition named \"count\" with a value of A\n\n.start\nSERB 3 count  ;0x200 Skip the next instruction if reg 3's value is A\n\nLDRB 3 count  ;0x202 Load reg 3 with A\n\nJMP start     ;0x204 Jump to 0x200\n```\n\nYou can also use four arithmetic operators (`+`, `-`, `*`, `/`) with your definitions.\n\nCurrently, you can only use one operator per definition, but that is subject to change in the near future.\n\n```\n#a 4          ;      Create a definition named \"a\" with a value of 4\n#b 2          ;      Create a definition named \"b\" with a value of 2\n\n#sum a + b    ;      Create a definition named \"sum\" with a value of 6\n```\n\n## Installation\n\nCompile with `make`.\n\n```bash\ng++ chip8asm.cpp -o chip8asm -std=c++17\n```\n## Usage\n\n```bash\n./chip8asm \u003cpath-to-asm\u003e \u003cname-of-binary\u003e\n```\n\n## Examples\n\nSee the [examples](https://github.com/omrawaley/chip-8-assembler/tree/main/examples) folder for demos and sample programs.\n\n## Todo\n\n- ~~Remove `3NNN` and either preprocess labels or enable `JMP` to be used for labels as well as 12-bit addresses.~~\n- ~~Add a preprocessor~~\n- ~~Add text replacement (like #define)~~\n- Refine the file structure to simplify `main.cpp`\n- Add better error handling (e.g. \"multiple definitions of label,\" \"definition does not exist\")\n- ~~Allow arithmetic operators to work on definitions~~\n\n## License\n\nChip-8 Assembler - [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomrawaley%2Fchip-8-assembler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomrawaley%2Fchip-8-assembler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomrawaley%2Fchip-8-assembler/lists"}