{"id":19249697,"url":"https://github.com/asmjit/asmtk","last_synced_at":"2025-04-09T10:07:03.693Z","repository":{"id":9740711,"uuid":"63176259","full_name":"asmjit/asmtk","owner":"asmjit","description":"Assembler toolkit based on AsmJit","archived":false,"fork":false,"pushed_at":"2023-07-18T09:16:26.000Z","size":155,"stargazers_count":232,"open_issues_count":2,"forks_count":47,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-02T03:58:03.702Z","etag":null,"topics":["asm-parser","asmjit","cpp","x86","x86-64"],"latest_commit_sha":null,"homepage":"https://asmjit.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asmjit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"kobalicek"}},"created_at":"2016-07-12T16:54:03.000Z","updated_at":"2025-03-19T07:36:15.000Z","dependencies_parsed_at":"2025-01-16T01:08:51.580Z","dependency_job_id":"0e3293d6-7213-47a3-a77f-eb535bfb65ba","html_url":"https://github.com/asmjit/asmtk","commit_stats":{"total_commits":79,"total_committers":6,"mean_commits":"13.166666666666666","dds":0.06329113924050633,"last_synced_commit":"e2752c85d39da4b0c5c729737a6faa25286b8e0c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmjit%2Fasmtk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmjit%2Fasmtk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmjit%2Fasmtk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmjit%2Fasmtk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asmjit","download_url":"https://codeload.github.com/asmjit/asmtk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"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":["asm-parser","asmjit","cpp","x86","x86-64"],"created_at":"2024-11-09T18:15:09.475Z","updated_at":"2025-04-09T10:07:03.670Z","avatar_url":"https://github.com/asmjit.png","language":"C++","readme":"AsmTK\n-----\n\nAssembler toolkit based on AsmJit.\n\n  * [Official Repository (asmjit/asmtk)](https://github.com/asmjit/asmtk)\n  * [Official Blog (asmbits)](https://asmbits.blogspot.com/ncr)\n  * [Official Chat (gitter)](https://gitter.im/asmjit/asmjit)\n  * [Permissive ZLIB license](./LICENSE.md)\n\nIntroduction\n------------\n\nAsmTK is a sister project of AsmJit library, which provides concepts that are useful mostly in AOT code-generation.\n\nFeatures\n--------\n\n  * Both X86 and X64 modes are supported and can be selected at runtime (i.e. they not depend on how your application is compiled).\n  * Asm parser can parse everything that AsmJit provides (i.e. supports all instruction sets, named labels, etc...).\n  * Asm parser can also parse instruction aliases defined by AsmTK (like `movsb`, `cmpsb`, `sal`, ...). AsmJit provides just generic `movs`, `cmps`, etc... so these are extras that are handled and recognized by AsmTK.\n  * Assembles to any `BaseEmitter`, which means that you can choose between `Assembler` and `BaseBuilder` at runtime, and that the result can be post-processed as well\n  * More to be added...\n\nTODO\n----\n\n  * [ ] More aliases to some SIMD instructions (to be added).\n  * [ ] Implement asmtk::Linker that will add the possibility to write shared libraries and executables.\n\nAsmParser Usage Guide\n---------------------\n\nAssembler parsing is provided by `AsmParser` class, which emits to `BaseEmitter`:\n\n```C++\n#include \u003casmtk/asmtk.h\u003e\n\nusing namespace asmjit;\nusing namespace asmtk;\n\n// Used to print binary code as hex.\nstatic void dumpCode(const uint8_t* buf, size_t size) {\n  constexpr uint32_t kCharsPerLine = 39;\n  char hex[kCharsPerLine * 2 + 1];\n\n  size_t i = 0;\n  while (i \u003c size) {\n    size_t j = 0;\n    size_t end = size - i \u003c kCharsPerLine ? size - i : size_t(kCharsPerLine);\n\n    end += i;\n    while (i \u003c end) {\n      uint8_t b0 = buf[i] \u003e\u003e 4;\n      uint8_t b1 = buf[i] \u0026 15;\n\n      hex[j++] = b0 \u003c 10 ? '0' + b0 : 'A' + b0 - 10;\n      hex[j++] = b1 \u003c 10 ? '0' + b1 : 'A' + b1 - 10;\n      i++;\n    }\n\n    hex[j] = '\\0';\n    puts(hex);\n  }\n}\n\nint main(int argc, char* argv[]) {\n  // Setup CodeHolder for X64.\n  Environment env(Arch::kX64);\n  CodeHolder code;\n  code.init(env);\n\n  // Attach x86::Assembler to `code`.\n  x86::Assembler a(\u0026code);\n\n  // Create AsmParser that will emit to x86::Assembler.\n  AsmParser p(\u0026a);\n\n  // Parse some assembly.\n  Error err = p.parse(\n    \"mov rax, rbx\\n\"\n    \"vaddpd zmm0, zmm1, [rax + 128]\\n\");\n\n  // Error handling (use asmjit::ErrorHandler for more robust error handling).\n  if (err) {\n    printf(\"ERROR: %08x (%s)\\n\", err, DebugUtils::errorAsString(err));\n    return 1;\n  }\n\n  // Now you can print the code, which is stored in the first section (.text).\n  CodeBuffer\u0026 buffer = code.sectionById(0)-\u003ebuffer();\n  dumpCode(buffer.data(), buffer.size());\n\n  return 0;\n}\n```\n\nYou should check out the test directory to see how AsmTK integrates with AsmJit.\n\nAuthors \u0026 Maintainers\n---------------------\n\n  * Petr Kobalicek \u003ckobalicek.petr@gmail.com\u003e\n","funding_links":["https://github.com/sponsors/kobalicek"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmjit%2Fasmtk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasmjit%2Fasmtk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmjit%2Fasmtk/lists"}