{"id":22383838,"url":"https://github.com/jorbush/lc3_vm","last_synced_at":"2025-09-12T06:36:59.655Z","repository":{"id":243695197,"uuid":"813155208","full_name":"jorbush/lc3_vm","owner":"jorbush","description":"Implementation of the LC-3 VM in Rust","archived":false,"fork":false,"pushed_at":"2024-06-18T13:57:42.000Z","size":120,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T02:16:35.380Z","etag":null,"topics":["lc3","rust","vm"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jorbush.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-10T15:16:52.000Z","updated_at":"2024-06-18T13:57:47.000Z","dependencies_parsed_at":"2024-06-17T12:14:06.516Z","dependency_job_id":null,"html_url":"https://github.com/jorbush/lc3_vm","commit_stats":null,"previous_names":["jorbush/lc3_vm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorbush%2Flc3_vm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorbush%2Flc3_vm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorbush%2Flc3_vm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorbush%2Flc3_vm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jorbush","download_url":"https://codeload.github.com/jorbush/lc3_vm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245727720,"owners_count":20662557,"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":["lc3","rust","vm"],"created_at":"2024-12-05T01:15:33.929Z","updated_at":"2025-03-26T20:17:42.778Z","avatar_url":"https://github.com/jorbush.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LC-3 Virtual Machine in Rust\n\nThis project is an implementation of the LC-3 Virtual Machine (VM) in Rust.\n\n## What is LC-3?\n\nThe LC-3 is a simple educational computer designed to teach the basics of computer architecture and machine language programming.\n\n## Requirements\n\n- [Rust](https://www.rust-lang.org/tools/install)\n\n## Implemented Instructions\n\n| Instruction | OpCode           | Description                                                         | Implemented  |\n|-------------|------------------|---------------------------------------------------------------------|--------------|\n| BR          | 0000             | Performs a conditional branch based on the condition flags.         | ✅           |\n| ADD         | 0001             | Adds two values. Can use immediate mode or register mode.           | ✅           |\n| LD          | 0010             | Loads a value from a memory address into a register.                | ✅           |\n| ST          | 0011             | Stores the value of a register into a memory address.               | ✅           |\n| JSR         | 0100             | Jumps to a subroutine and saves the return address.                 | ✅           |\n| AND         | 0101             | Performs a bitwise AND operation between two registers.             | ✅           |\n| LDR         | 0110             | Loads a value from a memory address calculated based on a register. | ✅           |\n| STR         | 0111             | Stores the value of a register into a calculated memory address.    | ✅           |\n| RTI         | 1000             | Unused.                                                             | ✅           |\n| NOT         | 1001             | Performs a bitwise NOT operation on a register.                     | ✅           |\n| LDI         | 1010             | Loads a value from an indirect memory address into a register.      | ✅           |\n| STI         | 1011             | Stores the value of a register into an indirect memory address.     | ✅           |\n| JMP         | 1100             | Jumps to the address contained in a register.                       | ✅           |\n| RES         | 1101             | Unused.                                                             | ✅           |\n| LEA         | 1110             | Loads the effective address into a register.                        | ✅           |\n| TRAP        | 1111             | Invokes an operating system routine.                                | ✅           |\n\n## Usage\n\nYou can play two games that are implemented with this VM: `2048` and `rogue`.\n\n### 2048\n\nTo play the `2048` game, use the following command:\n\n```bash\ncargo run examples/2048.obj\n```\n\nThe output should look like this:\n\n```\nControl the game using WASD keys.\nAre you on an ANSI terminal (y/n)?\ny\n +--------------------------+\n |                          |\n |                          |\n |                          |\n |                     2    |\n |                          |\n |   2                      |\n |                          |\n |                          |\n |                          |\n +--------------------------+\n```\n\u003e [!NOTE]\n\u003e You need to press `Enter` before typing `y` or `n` and press `Enter` again to start playing.\n\n### Rogue\n\nTo play the `rogue` game, use the following command:\n\n```bash\ncargo run examples/rogue.obj\n```\n\nThe output should look like this:\n\n```\nWelcome to LC3 Rogue.\nUse WSAD to move.\nPress any key..\n```\nAnd then you can start playing the game.\n```\n##################  ############\n###################     ########\n#######################        #\n########################  #  #\n###############################D\n################################\n################################\n@ ##############################\n#  #############################\n##    ##########################\n#####  #########################\n######  ########################\n#######   ######################\n#########    ###################\n############  ##  ##############\n#############      #############\n```\n\n## Testing\n\nTo run the tests, use the following command:\n\n```bash\ncargo test\n```\n\n## Formatting\n\nTo format the code, use the following command:\n\n```bash\ncargo fmt\n```\n\n## References\n\nThis project is based on the following articles and resources:\n- [The tutorial by James Meiners](https://www.jmeiners.com/lc3-vm/)\n- [Specification](https://www.jmeiners.com/lc3-vm/supplies/lc3-isa.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorbush%2Flc3_vm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorbush%2Flc3_vm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorbush%2Flc3_vm/lists"}