A modern, user-friendly x86_64 assembler for Linux
Optimized assembler with quick compilation times
Simple syntax and helpful error messages
Support for latest x86_64 instructions
git clone https://github.com/jotrorox/jasm.git cd jasm make
Create a new file
hello.jasm
Write your assembly code
Follow the syntax guide below
Compile your code
jasm hello.jasm
Run the executable
./a.out
jasm [options] <input.jasm> [output] Options: -h, --help Display help message -v, --verbose Enable verbose output -V, --version Display version information -f, --formatSpecify output format (elf, bin)
Basic Compilation
jasm program.jasm
Creates an ELF executable named a.out
Binary Output
jasm -f bin program.jasm prog.bin
Creates a raw binary file
Verbose Mode
jasm -v program.jasm prog
Shows detailed assembly information
Creates a Linux executable file with:
Creates a raw binary file containing:
# Example: Print "Hello, world!" to stdout # Syscall details: # sys_write: rax=1, rdi=stdout, rsi=buffer, rdx=length data msg "Hello, World!\n" # sys_write(stdout, msg, 14) mov rax, 1 # sys_write mov rdi, 1 # stdout mov rsi, msg # message mov rdx, 14 # length call # sys_exit(0) mov rax, 60 # sys_exit mov rdi, 0 # status call
# Example: Read from a file and display contents # Syscall details: # sys_open: rax=2, rdi=filename, rsi=flags # sys_read: rax=0, rdi=fd, rsi=buffer, rdx=length data filename "input.txt" data buffer size 1024 data fd size 8 # Open file mov rax, 2 # sys_open mov rdi, filename mov rsi, 0 # O_RDONLY call # Read file mov rax, 0 # sys_read mov rdi, [fd] mov rsi, buffer mov rdx, 1024 call
data
Define data with a label and value
data msg "Hello"
data
Allocate buffer with specified size
data buffer size 1024
data
Load data from a file
data content file "data.txt"
mov destination, source
Move data between registers or memory
mov rax, 42
mov rax, [msg]
call
System call (based on rax value)
mov rax, 1 # sys_write
call
jmp/jmplt/jmpgt/jmpeq label
Jump instructions
jmplt loop_start
rax - Accumulator
rbx - Base
rcx - Counter
rdx - Data
rsi - Source
rdi - Destination
sys_write (rax = 1)
Write to file descriptor
rdi: fd, rsi: buffer, rdx: count
sys_read (rax = 0)
Read from file descriptor
rdi: fd, rsi: buffer, rdx: count
sys_open (rax = 2)
Open a file
rdi: filename, rsi: flags