{"id":15060566,"url":"https://github.com/antoninhrlt/x64asm","last_synced_at":"2025-04-10T06:11:21.809Z","repository":{"id":57675954,"uuid":"480903419","full_name":"antoninhrlt/x64asm","owner":"antoninhrlt","description":"Library to write x64 Assembly code from Rust, more properly. Designed for the nasm assembler","archived":false,"fork":false,"pushed_at":"2023-01-06T22:40:25.000Z","size":33,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T07:21:36.775Z","etag":null,"topics":["assembly","assembly-language","nasm","rust","x64","x86-64"],"latest_commit_sha":null,"homepage":"https://docs.rs/x64asm/latest/x64asm","language":"Rust","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/antoninhrlt.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}},"created_at":"2022-04-12T17:10:51.000Z","updated_at":"2024-07-21T12:22:11.000Z","dependencies_parsed_at":"2023-02-06T09:47:03.957Z","dependency_job_id":null,"html_url":"https://github.com/antoninhrlt/x64asm","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/antoninhrlt%2Fx64asm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Fx64asm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Fx64asm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Fx64asm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoninhrlt","download_url":"https://codeload.github.com/antoninhrlt/x64asm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166925,"owners_count":21058481,"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":["assembly","assembly-language","nasm","rust","x64","x86-64"],"created_at":"2024-09-24T23:00:24.652Z","updated_at":"2025-04-10T06:11:21.779Z","avatar_url":"https://github.com/antoninhrlt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# x64asm\nLibrary to write x64 Assembly code from Rust, more properly. Designed for the nasm assembler\n\n## How to use\n```rust                                 \nlet instructions = vec![\n    i!(/* \u003cmnemonic\u003e, [operands, ...] */),\n    // other instructions\n];\n\nlet code = instructions.to_assembly(/*separator (space or tab)*/);\n// Writes to a file\nlet mut stream = File::create(\u0026Path::new(\"output.asm\")).unwrap();\nwrite!(stream, \"{}\", code).unwrap();\n```\n\n## Installation\nIn your \"Cargo.toml\" file :\n```toml\n[dependencies]\nx64asm = \"*\"\n```\n\nCheck the current version on [crates.io](https://crates.io/crates/x64asm)\n\n## Example\n```rust      \nlet instructions = vec![\n    i!(Global, oplabel!(\"_start\")),\n\n    i!(section!(Text)),\n    i!(label!(\"_start\")),\n    i!(Mov, reg!(Rax), Op::Literal(1)),\n    i!(Mov, reg!(Rdi), Op::Literal(1)),\n    i!(Mov, reg!(Rsi), oplabel!(\"msg\")),\n    i!(Mov, reg!(Rdx), oplabel!(\"msg_len\")),\n    i!(Syscall),\n\n    i!(Mov, reg!(Rax), Op::Literal(60)),\n    i!(Mov, reg!(Rdi), Op::Literal(0)),\n    i!(Syscall),\n    \n    i!(section!(Data)),\n    i!(label!(\"msg\"), dd!(Db), opstring!(\"Hello world\")),\n    i!(label!(\"msg_len\"), dd!(Equ), opexpr!(\"$ - msg\")),\n];\n\nlet code = instructions.to_assembly(Separator::Space);\nlet mut stream = File::create(\u0026Path::new(\"output.asm\")).unwrap();\nwrite!(stream, \"{}\", code).unwrap();\n``` \n\n\u003cdetails\u003e\n\u003csummary\u003eImports for the example\u003c/summary\u003e\n\n```rust\nuse std::path::Path;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nuse x64asm::convert::{ ToAssembly, Separator };\nuse x64asm::macros::*;\n```\n\u003c/details\u003e\n\nAnd then, the generated \"output.asm\" file :\n```asm\n\tglobal _start \nsection .text \n_start: \n\tmov rax, 1 \n\tmov rdi, 1 \n\tmov rsi, msg \n\tmov rdx, msg_len \n\tsyscall \n\tmov rax, 60 \n\tmov rdi, 0 \n\tsyscall\nsection .data \nmsg: db `Hello world` \nmsg_len: equ $ - msg \n```\n\n## Notes\nOriginally inspired by [GregoryComer/rust-x86asm](https://github.com/GregoryComer/rust-x86asm).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoninhrlt%2Fx64asm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoninhrlt%2Fx64asm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoninhrlt%2Fx64asm/lists"}