HASM (Hendrik's Assembly Language) is a custom x86-64 assembler written entirely in C, located in the HASM/ directory of this project. It compiles modern, readable assembly code directly into native ELF64 executables for Linux. HASM features a clean syntax, robust error reporting, and a simple, transparent implementation, demonstrating low-level programming and system architecture skills.
HASM was primarily created as a personal educational project to deepen my understanding of low-level programming, assembler design, and the ELF binary format. The codebase is clean and well-commented, so it may also be useful or approachable for others interested in systems programming.
The assembler is thoroughly tested with a comprehensive suite of test cases covering all supported instructions and edge cases, ensuring reliability and correctness.
For testing and verification, I used the Defuse Online x86/x64 Assembler and Disassembler extensively. All test comparisons were written with the help of this tool to ensure that the output of HASM matched the expected machine code and behavior.
Note: HASM does not include a macro system, optimization passes, or a linker. It is focused on correctness, clarity, and educational value.
Simplified, modern syntax designed for readability while maintaining full control over hardware resources and memory management.
Multi-phase assembler with tokenization, parsing, label resolution, and binary code generation.
Produces standard ELF64 (Executable and Linkable Format) binaries compatible with Linux systems.
Supports a wide range of x86-64 instructions, registers, and addressing modes.
Detailed error messages with line and column information for easier debugging and learning.
GLOBAL _start
SECTION .data
msg DB "Hello, World!" 0x0A
SECTION .text
_start:
CALL HelloWorld
JMP end
HelloWorld:
MOV EDX 0x0E
MOV ECX msg
MOV EBX 0x01
MOV EAX 0x04
INT 0x80
RET
end:
MOV EBX 0x00
MOV EAX 0x01
INT 0x80
File: HelloWorld (ELF binary)
Platform: Linux x86-64
Size: 179 bytes
HASM/ folder.
HASM/ directory in your terminal.make
./HASM input.hasm -o output
chmod +x output
./output