v0.1 Release

JASM Assembler

A modern, user-friendly x86_64 assembler for Linux

Lightning Fast

Optimized assembler with quick compilation times

Easy to Use

Simple syntax and helpful error messages

Modern Features

Support for latest x86_64 instructions

Getting Started

Installation

Terminal
git clone https://github.com/jotrorox/jasm.git
cd jasm
make

Quick Start

  1. 1.

    Create a new file

    hello.jasm
  2. 2.

    Write your assembly code

    Follow the syntax guide below

  3. 3.

    Compile your code

    jasm hello.jasm
  4. 4.

    Run the executable

    ./a.out

Command Line Interface

Usage
jasm [options] <input.jasm> [output]

Options:
  -h, --help            Display help message
  -v, --verbose         Enable verbose output
  -V, --version         Display version information
  -f, --format  Specify output format (elf, bin)

Example Usage

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

Output Formats

ELF (default)

Creates a Linux executable file with:

  • Proper ELF headers
  • Executable permissions
  • Symbol information
Binary

Creates a raw binary file containing:

  • Pure machine code
  • No headers or metadata
  • Suitable for embedded use

Examples

Hello World

# 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

File Reading

# 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

Syntax Reference

Program Sections

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"

Instructions

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

Registers

General Purpose

rax - Accumulator rbx - Base rcx - Counter rdx - Data rsi - Source rdi - Destination

System Calls

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