{"id":20802676,"url":"https://github.com/andreiglesias/corewar","last_synced_at":"2026-02-16T06:02:19.836Z","repository":{"id":83157203,"uuid":"291977155","full_name":"AndreIglesias/Corewar","owner":"AndreIglesias","description":"Development of a Virtual Computer, an Assembler and a Disassembler for the programming game Corewar.","archived":false,"fork":false,"pushed_at":"2022-12-15T09:56:32.000Z","size":42522,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T21:30:22.090Z","etag":null,"topics":["assembler","assembly-language","c","corewar","disassembler","low-level-programming"],"latest_commit_sha":null,"homepage":"","language":"C","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/AndreIglesias.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}},"created_at":"2020-09-01T11:18:30.000Z","updated_at":"2024-06-05T10:40:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"1df0107d-96a5-4cf1-b2f0-1584cd7ca28d","html_url":"https://github.com/AndreIglesias/Corewar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndreIglesias/Corewar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreIglesias%2FCorewar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreIglesias%2FCorewar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreIglesias%2FCorewar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreIglesias%2FCorewar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndreIglesias","download_url":"https://codeload.github.com/AndreIglesias/Corewar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreIglesias%2FCorewar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29501361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T05:57:17.024Z","status":"ssl_error","status_checked_at":"2026-02-16T05:56:49.929Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["assembler","assembly-language","c","corewar","disassembler","low-level-programming"],"created_at":"2024-11-17T18:34:30.410Z","updated_at":"2026-02-16T06:02:19.820Z","avatar_url":"https://github.com/AndreIglesias.png","language":"C","readme":"\n\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://github.com/AndreIglesias/corewar\"\u003e\u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/logo.png\" alt=\"Corewar\" width=\"600\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003eA virtual Computer, an Assembler and a Disassembler for the programming game \u003ca href=\"https://en.wikipedia.org/wiki/Core_War\" target=\"_blank\"\u003eCorewar\u003c/a\u003e.\n\u003c/h4\u003e\n  \n---\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#introduction\"\u003eIntroduction\u003c/a\u003e •\n  \u003ca href=\"#virtual-computer\"\u003eVirtual Computer\u003c/a\u003e •\n  \u003ca href=\"#assembler\"\u003eAssembler\u003c/a\u003e •\n  \u003ca href=\"#disassembler\"\u003eDisassembler\u003c/a\u003e •\n  \u003ca href=\"#bonus-features\"\u003eBonus Features\u003c/a\u003e •\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n![Battlefield](docs/corewar.gif?raw=true \"corewar\")\n# Introduction\n\nCore War was inspired by a malicious virus written in the 80’s. To deal with the self-replicating virus, a white hat hacker invented Reaper. It was a virus designed to spread and eliminate the malware. He fought fire with fire.\n\nThis inspired A. K. Dewdney to coin the idea for Core War.\n\nThe idea was simple. You compete by designing viruses to overtake a computer. You win by protecting your own program and overwriting your opponent's programs. This is all happening on a virtual computer. Think, a simple computer within your computer.\n\n# Virtual Computer\n### VM General Structure:\n[![VM general structure](https://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/01/FIGS/cpu1.gif)](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/doc1.png)\n\n[Reference](https://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/01/intro-computer2.html)\n\n\nThe loading of the **champions** and the **enumeration** of each player happens in the command line.\n\nIt’s important to remember that the **last player** will have the **first process** in the order of *execution*.\n### VM Usage:\n![vm usage](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/Usage.png)\n\n### Champions loaded without any option:\n![champion without options](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/zork.png)\n\n### Dumping memory at given cycle:\n![vm verbosity](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/verbosity.png)\n\n## Ncurse's Display\n![vm_corewar](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/corewar.png)\n\n### Loading champions\nThe champions are loaded within the memory so that they can space out evenly their entry points.\n\nAt startup, each champion have their initial process at their respective entry point.\n\n![loading champions](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/initial_process.png)\n\n### Processes Table\nThe **number** (*id*) of the player is generated by the machine or specified at launch, and is given to the champions via the **r1 registry** of their first process at startup.\n\n![processes](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/process_reg.png)\n\nSo even if the champion has *no instructions*, it will be able to participate as a contestant with the help of the **initial process** and the registry **r1** which has its player’s id.\n\n# Assembler\n\nThe **assembler** (*asm*) translates the champion's code to bytecode.\n\n### zork.s:\n\n\u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/zork_s.png\" alt=\"zork_code\" width=\"500\"/\u003e\n\n### champion's header and the Magic Number:\n\n![header with magic number](https://github.com/AndreIglesias/Corewar/blob/master/docs/img/MAGIC_EXEC.png)\n\n### champion's instructions in bytecode:\n\n\u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/asm_dump.png\" alt=\"zork_body\" width=\"500\"/\u003e\n\n### asm with the -v option\nThe **asm** translates the champion into a *.cor bytecode file*, as usual, but also displays in the standard output, the **syntax table** with translation of each instruction to the right.\n\n\u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/asm_v.png\" alt=\"asm v\" width=\"500\"/\u003e\n\n## Disassembler\n\nThe **disassembler** takes a *.cor bytecode file* and translates into a *.s assembly file*.\n\n### Assembling a disassembled zork.cor:\n\u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/disasm_zork.png\" alt=\"disasm\" width=\"500\"/\u003e\n\n## Bonus Features\n\n1. (vm) ncurse’s interface visualizer\n2. (vm) verbose and formatted output (-v)\n3. (asm) a detailed syntax table display (-v)\n4. (asm) beautiful error message when assembling\n   + with line numbers, and a cursor to show where is the error\n   + differentiating between **lexical** and **syntactical** error.\n   + \u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/syntax_error.png\" alt=\"syntax error\" width=\"500\"/\u003e\n   + \u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/lexicon_error.png\" alt=\"lexicon error\" width=\"500\"/\u003e\n5. (other) disassembler\n6. (other) org documentation\n   + \u003cimg src=\"https://github.com/AndreIglesias/Corewar/blob/master/docs/img/doc2.png\" alt=\"lexicon error\" width=\"1000\"/\u003e\n# Installation\n```bash\n# Clone this repository\n$ git clone --recurse-submodules https://github.com/AndreIglesias/Corewar\n# Go into the repository\n$ cd Corewar\n# Compile the project\n$ make\n```\n\n## License\n\n\u003e [GPL v3.0](https://github.com/AndreIglesias/Corewar/blob/master/LICENSE) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e [@AndreIglesias](https://github.com/AndreIglesias)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreiglesias%2Fcorewar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreiglesias%2Fcorewar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreiglesias%2Fcorewar/lists"}