Rasm2

rasm2 is an inline assembler/disassembler. Initially, rasm tool was designed to be used for binary patching. Its main function is to get bytes corresponding to given machine instruction opcode.

  1. $ rasm2 -h
  2. Usage: rasm2 [-ACdDehLBvw] [-a arch] [-b bits] [-o addr] [-s syntax]
  3. [-f file] [-F fil:ter] [-i skip] [-l len] 'code'|hex|-
  4. -a [arch] Set architecture to assemble/disassemble (see -L)
  5. -A Show Analysis information from given hexpairs
  6. -b [bits] Set cpu register size (8, 16, 32, 64) (RASM2_BITS)
  7. -B Binary input/output (-l is mandatory for binary input)
  8. -c [cpu] Select specific CPU (depends on arch)
  9. -C Output in C format
  10. -d, -D Disassemble from hexpair bytes (-D show hexpairs)
  11. -e Use big endian instead of little endian
  12. -E Display ESIL expression (same input as in -d)
  13. -f [file] Read data from file
  14. -F [in:out] Specify input and/or output filters (att2intel, x86.pseudo, ...)
  15. -h, -hh Show this help, -hh for long
  16. -i [len] ignore/skip N bytes of the input buffer
  17. -j output in json format
  18. -k [kernel] Select operating system (linux, windows, darwin, ..)
  19. -l [len] Input/Output length
  20. -L List Asm plugins: (a=asm, d=disasm, A=analyze, e=ESIL)
  21. -o [offset] Set start address for code (default 0)
  22. -O [file] Output file name (rasm2 -Bf a.asm -O a)
  23. -p Run SPP over input for assembly
  24. -q quiet mode
  25. -r output in radare commands
  26. -s [syntax] Select syntax (intel, att)
  27. -v Show version information
  28. -w What's this instruction for? describe opcode
  29. If '-l' value is greater than output length, output is padded with nops
  30. If the last argument is '-' reads from stdin
  31. Environment:
  32. RASM2_NOPLUGINS do not load shared plugins (speedup loading)
  33. RASM2_ARCH same as rasm2 -a
  34. RASM2_BITS same as rasm2 -b
  35. R_DEBUG if defined, show error messages and crash signal

Plugins for supported target architectures can be listed with the -L option. Knowing a plugin name, you can use it by specifying its name to the -a option

  1. $ rasm2 -L
  2. _dAe 8 16 6502 LGPL3 6502/NES/C64/Tamagotchi/T-1000 CPU
  3. _dAe 8 8051 PD 8051 Intel CPU
  4. _dA_ 16 32 arc GPL3 Argonaut RISC Core
  5. a___ 16 32 64 arm.as LGPL3 as ARM Assembler (use ARM_AS environment)
  6. adAe 16 32 64 arm BSD Capstone ARM disassembler
  7. _dA_ 16 32 64 arm.gnu GPL3 Acorn RISC Machine CPU
  8. _d__ 16 32 arm.winedbg LGPL2 WineDBG's ARM disassembler
  9. adAe 8 16 avr GPL AVR Atmel
  10. adAe 16 32 64 bf LGPL3 Brainfuck (by pancake, nibble) v4.0.0
  11. _dA_ 32 chip8 LGPL3 Chip8 disassembler
  12. _dA_ 16 cr16 LGPL3 cr16 disassembly plugin
  13. _dA_ 32 cris GPL3 Axis Communications 32-bit embedded processor
  14. adA_ 32 64 dalvik LGPL3 AndroidVM Dalvik
  15. ad__ 16 dcpu16 PD Mojang's DCPU-16
  16. _dA_ 32 64 ebc LGPL3 EFI Bytecode
  17. adAe 16 gb LGPL3 GameBoy(TM) (z80-like)
  18. _dAe 16 h8300 LGPL3 H8/300 disassembly plugin
  19. _dAe 32 hexagon LGPL3 Qualcomm Hexagon (QDSP6) V6
  20. _d__ 32 hppa GPL3 HP PA-RISC
  21. _dAe i4004 LGPL3 Intel 4004 microprocessor
  22. _dA_ 8 i8080 BSD Intel 8080 CPU
  23. adA_ 32 java Apache Java bytecode
  24. _d__ 32 lanai GPL3 LANAI
  25. _d__ 8 lh5801 LGPL3 SHARP LH5801 disassembler
  26. _d__ 32 lm32 BSD disassembly plugin for Lattice Micro 32 ISA
  27. _dA_ 16 32 m68k BSD Capstone M68K disassembler
  28. _dA_ 32 malbolge LGPL3 Malbolge Ternary VM
  29. _d__ 16 mcs96 LGPL3 condrets car
  30. adAe 16 32 64 mips BSD Capstone MIPS disassembler
  31. adAe 32 64 mips.gnu GPL3 MIPS CPU
  32. _dA_ 16 msp430 LGPL3 msp430 disassembly plugin
  33. _dA_ 32 nios2 GPL3 NIOS II Embedded Processor
  34. _dAe 8 pic LGPL3 PIC disassembler
  35. _dAe 32 64 ppc BSD Capstone PowerPC disassembler
  36. _dA_ 32 64 ppc.gnu GPL3 PowerPC
  37. _d__ 32 propeller LGPL3 propeller disassembly plugin
  38. _dA_ 32 64 riscv GPL RISC-V
  39. _dAe 32 rsp LGPL3 Reality Signal Processor
  40. _dAe 32 sh GPL3 SuperH-4 CPU
  41. _dA_ 8 16 snes LGPL3 SuperNES CPU
  42. _dAe 32 64 sparc BSD Capstone SPARC disassembler
  43. _dA_ 32 64 sparc.gnu GPL3 Scalable Processor Architecture
  44. _d__ 16 spc700 LGPL3 spc700, snes' sound-chip
  45. _d__ 32 sysz BSD SystemZ CPU disassembler
  46. _dA_ 32 tms320 LGPLv3 TMS320 DSP family (c54x,c55x,c55x+,c64x)
  47. _d__ 32 tricore GPL3 Siemens TriCore CPU
  48. _dAe 32 v810 LGPL3 v810 disassembly plugin
  49. _dAe 32 v850 LGPL3 v850 disassembly plugin
  50. _dAe 8 32 vax GPL VAX
  51. adA_ 32 wasm MIT WebAssembly (by cgvwzq) v0.1.0
  52. _dA_ 32 ws LGPL3 Whitespace esotheric VM
  53. a___ 16 32 64 x86.as LGPL3 Intel X86 GNU Assembler
  54. _dAe 16 32 64 x86 BSD Capstone X86 disassembler
  55. a___ 16 32 64 x86.nasm LGPL3 X86 nasm assembler
  56. a___ 16 32 64 x86.nz LGPL3 x86 handmade assembler
  57. _dA_ 16 xap PD XAP4 RISC (CSR)
  58. _dA_ 32 xcore BSD Capstone XCore disassembler
  59. _dAe 32 xtensa GPL3 XTensa CPU
  60. adA_ 8 z80 GPL Zilog Z80

Note that “ad” in the first column means both assembler and disassembler are offered by a corresponding plugin. “d” indicates disassembler, “a“ means only assembler is available.