{"id":18961468,"url":"https://github.com/kvakil/0asm","last_synced_at":"2025-04-19T11:40:27.690Z","repository":{"id":87306869,"uuid":"222866059","full_name":"kvakil/0asm","owner":"kvakil","description":"x86 assembler in 512 bytes of x86 machine code","archived":false,"fork":false,"pushed_at":"2019-12-01T21:08:04.000Z","size":174,"stargazers_count":33,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T07:22:37.915Z","etag":null,"topics":["assembler","assembly","demoscene","x86"],"latest_commit_sha":null,"homepage":"","language":"Assembly","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/kvakil.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":"2019-11-20T06:24:03.000Z","updated_at":"2025-02-10T23:13:59.000Z","dependencies_parsed_at":"2023-03-06T16:45:29.244Z","dependency_job_id":null,"html_url":"https://github.com/kvakil/0asm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvakil%2F0asm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvakil%2F0asm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvakil%2F0asm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvakil%2F0asm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kvakil","download_url":"https://codeload.github.com/kvakil/0asm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249195408,"owners_count":21228193,"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":["assembler","assembly","demoscene","x86"],"created_at":"2024-11-08T14:13:03.925Z","updated_at":"2025-04-16T04:32:52.066Z","avatar_url":"https://github.com/kvakil.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 0asm\n\n0asm is a 16-bit x86 assembler written in 16-bit x86 assembly which fits\nin under 512 bytes of x86 machine code! It runs on\n[bootOS](https://github.com/nanochess/bootOS/). \n\n## Assembling\n\nYou can assemble and run 0asm using nasm and QEMU (respectively):\n\n    make run\n\nThis also copies the input file `test.asm` into the disk under the filename\n`0`. One can then run the assembler in bootOS:\n\n    $0asm\n\nand then run the output program under `@`:\n\n    $@\n    Hello, world! $\n\nFurther examples are available under the `examples/` directory.\n\n## Anticipated FAQ\n\n### What does it support?\n\n0asm supports several common instructions, labels (absolute and relative\nrelocations), and octal literals (but only octal literals). It also\nsupports all 16-bit x86 general purpose registers, but does not support\nsegment registers.\n\nMany jump instructions are supported (call, jmp, jb, jnb, jz, jnz, jbe,\njnbe), along with several string instructions (stosb, stosw, lodsb, lodsw,\nmovsw, cbw, scasw), several stack instructions (push, pop, ret), a few\nfundamental arithmetic instructions in both register/register and\nregister/immediate form (add, or, adc, and, xor, cmp, mov), and some misc\ninstructions (int, stc, inc, dec, the pseudo-instruction db).\n\nErrors are not always handled, but the assembler does usually exit cleanly\ninstead of producing garbage.\n\n### How does it work?\n\n0asm is a simple 2-pass assembler. The first pass outputs the machine\ncode for instructions which do not require any relocation; it also collects\nlabels into a \"symbol table\", and the addresses of immediates which need\nto be fixed into a \"fixup table\". The first pass also outputs the machine\ncode for instructions which do not require any relocation.\n\n### Is it self-hosting?\n\nUnfortunately not yet, for several reasons.\n\n1. The underlying bootOS only supports 512 byte files.\n2. The instruction encoding produced is not optimal, so it will not fit\nin 512 bytes once assembled.\n3. Shift and memory-addressing instructions are not yet supported.\n\nThese problems are not insurmountable, although it seems difficult.\nWe could easily move the goalpost by typing the entire program using db,\nbut of course that would be no fun.\n\n## Development\n\nThe code is decently commented. Many of the files in this repo are\ngenerated from `0asm.asm`, including the README. You can also debug by\nrunning `make debug` (to start QEMU in one pane) and `make gdbdebug`\n(to start GDB along with some helpful default scripts).\n\n## License\n\nCopyright (c) 2019 Keyhan Vakil\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvakil%2F0asm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkvakil%2F0asm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvakil%2F0asm/lists"}