rz-asm(1)

RZ_ASM(1) General Commands Manual RZ_ASM(1)

NAME

rz-asmrizin assembler and disassembler tool

SYNOPSIS

rz-asm [-ABCdDeIEhjLpqrvxw] [-a arch] [-b bits] [-m plugin] [-c CPU] [-O file] [-o addr] [-@ addr] [-f file] [-F in:out] [-i len] [-k kernel] [-s syntax] [-l len]

DESCRIPTION

This command is part of the Rizin project.

This tool uses RzAsm to assemble and disassemble files or hexpair strings. It supports a large list of architectures which can be listed using the -L flag.

-a arch
Set architecture to assemble/disassemble (see -L)
-A
Show analysis information from given hexpairs
-b bits
Set CPU register size (8, 16, 32, 64) (RZ_ASM_BITS)
-B
Binary input/output (-l is mandatory for binary input)
-c CPU
Select specific CPU (depends on the arch)
-C
Output in C format
-d, -D
Disassemble from hexpair bytes (-D show hexpairs)
-e
Use big endian instead of little endian
-I
Display lifted RzIL code (same input as in -d, IL is also validated)
-E
Display ESIL expression (same input as in -d)
-f file
Read data from file
-F in:out
Specify input and/or output filters (att2intel, x86.pseudo, ...)
-h, -hh
Show usage help message, hh for long
-i len
Ignore N bytes of the input buffer
-j
Output in JSON format
-k kernel
Select operating system (linux, windows, darwin, ..)
-l len
Input/Output length
-L
List asm plugins: (a=asm, d=disasm, A=analyze, e=ESIL, I=RzIL)
-m plugin
List supported CPUs for the chosen plugin
-o, -@ addr
Set start address for code (default 0)
-O file
Output file name (rz-asm -Bf a.asm -O a)
-p
Run SPP over input for assembly
-q
Quiet mode
-s syntax
Select syntax (intel, att)
-v
Show version information
-x
Use hex dwords instead of hex pairs when assembling
-w
Describe opcode

Directives

.intel_syntax
Use Intel syntax rather than AT&T
.att_syntax
Use AT&T syntax rather than Intel
.align number
Set the code or data alignment
.arch name
Set the code architecture
.arm
Set the ARM mode (as opposed to Thumb) for ARM architecture
.ascii string
Define the ASCII string
.asciz string
Define the zero-ending ASCII string
.bits number
Define the code bitness
.big_endian
Set the BE (big endian) byte order
.cpu name
Set the CPU for the chosen architecture
.data
Mark the start of the data section
.endian 1|0
Set the endianness (the byte order) - 1 is BE, 0 is LE
.equ name value
Define the constant
.fill repeat,size,value
Fill the data with the repeating value pattern
.hex data
Define the data in hexadecimal format
.incbin filename
Include binary file
.int16 number
Define 16-bit integer
.int32 number
Define 32-bit integer
.int64 number
Define 64-bit integer
.kernel name
Set the kernel for syscalls
.little_endian
Set the LE (little endian) byte order
.org value
Set the value of the PC (Program Counter) register
.os name
Set the operating system for syscalls
.short number
Define 16-bit integer
.string string
Define the ASCII string
.text
Mark the start of the text section
.thumb
Set the Thumb mode (as opposed to ARM) for ARM architecture

ENVIRONMENT

RZ_ARCH: e asm.arch - architecture to assemble or disassemble(same as rz-asm -a)

RZ_ASM_ARCH: architecture to assemble/disassemble (same as rz-asm -a)

RZ_ASM_BITS: cpu register size (8, 16, 32, 64) (same as rz-asm -b)

RZ_BITS: e asm.bits - cpu register size (8, 16, 32, 64) (same as rz-asm -b)

RZ_DEBUG: if defined, show error messages and crash signal0

RZ_NOPLUGINS: do not load shared plugins (speedup loading)0

EXAMPLES

Assemble opcode: rz-asm -a x86 -b 32 'mov eax, 33'

Disassemble opcode:

rz-asm -d 90

SEE ALSO

rizin(1), rz-ax(1), rz-bin(1), rz-diff(1), rz-find(1), rz-gg(1), rz-hash(1), rz-run(1)

AUTHORS

pancake <pancake@nopcode.org>

byteninjaa0

January 22, 2024 Linux 6.12.85-6.12-alt1