https://github.com/0x1c1101/blazing_asm
Simple, fast and lightweight Header-Only C++ Assembler Library
https://github.com/0x1c1101/blazing_asm
asmjit assembler assembler-x86 assembly cpp20 embedded-systems exploit-development malware reverse-engineering x86-64 x86-assembly
Last synced: about 2 months ago
JSON representation
Simple, fast and lightweight Header-Only C++ Assembler Library
- Host: GitHub
- URL: https://github.com/0x1c1101/blazing_asm
- Owner: 0x1c1101
- License: gpl-3.0
- Created: 2025-05-23T20:59:19.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-08-06T19:11:34.000Z (about 2 months ago)
- Last Synced: 2025-08-06T19:12:17.721Z (about 2 months ago)
- Topics: asmjit, assembler, assembler-x86, assembly, cpp20, embedded-systems, exploit-development, malware, reverse-engineering, x86-64, x86-assembly
- Language: C++
- Homepage:
- Size: 85 KB
- Stars: 94
- Watchers: 4
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Blazing ASM
[](https://discord.gg/GdYanwSCwm)
[](LICENSE)A simple and lightweight assembler library that supports the majority of significant instructions from the Intel x86-64 architecture. Mainly beneficial for shellcode development and runtime bytecode generation. Due to its design, it can produce the machine code quite fast while allowing you to generate and use random registers/immediates at runtime.
## Requirements
- C++20 or above
- STL is not required (Compatible with kernel driver projects)## Why not use AsmJit?
If you need to generate x86-64 machine code with minimal overhead and maximum control, `BlazingASM` is a powerful alternative to dynamic assemblers like AsmJit. Designed entirely for compile-time code generation, it emits raw, fixed-size machine instructions directly into static arrays, eliminating the need for runtime encoding or memory management. Its single-header design requires no dependencies, making it lightweight and easy to integrate ~ even in bare-metal or embedded environments. With predictable instruction layout, very little to zero runtime allocation, and clean, assembly-like syntax, it is particularly well-suited for shellcode generation, firmware, code mutation or any scenario where performance, binary size, and determinism matter.
That being said, `BlazingASM` is intentionally minimal and focused; it doesn’t aim to match AsmJit’s vast instruction coverage, runtime flexibility, or feature set. Instead, it trades breadth for simplicity and performance ~ making it a practical tool when you know exactly what code you need, and want it fast and small.
For a better demonstration, below is a screenshot of the comparison between the code and the disassembly (`assemble_static()` mode):

If you wish to use the dynamic code generation, below is a screenshot of the comparison between the code and the decompilation on IDA (`assemble()` mode):

## Instructions Supported
| **Category** | **Instruction** | **Description** |
| ------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------ |
| **Data Movement** | `MOV` | Register/Memory/Immediate moves |
| | `LEA` | Load effective address |
| | `DB(...)` | Define raw byte(s) (data injection) |
| **Arithmetic (GRP1)** | `ADD`, `OR`, `ADC`, `SBB`, `AND`, `SUB`, `XOR`, `CMP` | Basic arithmetic and bitwise operations |
| | `TEST` | Bitwise AND for flag setting (no result stored) |
| **Shifts/Rotates (GRP2)** | `ROL`, `ROR`, `RCL`, `RCR`, `SHL`, `SAL`, `SHR`, `SAR` | Support both constant and 1-bit variants (`ROL1`, `ROR1`, etc.) |
| **Unary Ops (GRP3)** | `NOT`, `NEG` | Logical negation, two's complement |
| | `MUL`, `IMUL` | Unsigned and signed multiplication |
| | `DIV`, `IDIV` | Unsigned and signed division |
| **Control Flow** | `JCC` | Conditional jumps via `Conditions` enum |
| | `JMP`, `JMP32` | Unconditional jump (near and 32-bit override) |
| | `CALL`, `CALL32` | Near calls (with 32-bit override support) |
| **Stack Operations** | `PUSH`, `PUSH32`, `POP`, `POP32` | Push/pop values (supports 64-bit and 32-bit override) |
| | `POPF`, `PUSHF` | Push/pop flags |
| **Fixed Instructions** | `RET` | Return from procedure |
| | `NOP` | No operation |
| **Planned** | `FPU Ops`, `INC/DEC` | 🚧 Coming Soon... |## Setting it up
All you need to do is download the `blazing_asm.hpp` header file, paste it into your project folder, and add this in your source code:
```cpp
#include "blazing_asm.hpp".
.
.auto shellcode = basm::assemble_static (
basm::MOV (basm::RAX, basm::RBX),
basm::MOV (basm::RCX, basm::RDX)
);
```Or you can define `basm` namespace for a simpler syntax:
```cpp
using namespace basm;auto shellcode = assemble_static (
MOV (RAX, RBX),
MOV (RCX, RDX)
);
```## Usage
You can find the detailed explanation in the [Documentation Page](DOCUMENTATION.md).
## 🚧 Note
This project is currently in development, so if you come across any problems, please create an issue. Also, feel free to contribute and improve.