Chapter 14: Rasm

The inline assembler/disassembler. Initially 'rasm' was designed to be used for binary patching, just to get the bytes of a certain opcode. Here's the help

$ rasm -h
Usage: rasm [-elvV] [-f file] [-s offset] [-a arch] [-d bytes] "opcode"|-
 if 'opcode' is '-' reads from stdin
  -v           enables debug
  -d [bytes]   disassemble from hexpair bytes
  -f [file]    compiles assembly file to 'file'.o
  -s [offset]  offset where this opcode is suposed to be
  -a [arch]    selected architecture (x86, olly, ppc, arm, java, rsc)
  -e           use big endian
  -l           list all supported opcodes and architectures
  -V           show version information

The basic 'portable' assembler instructions can be listed with 'rasm -l':

$ rasm -l
Usage: rasm [-elvV] [-f file] [-s offset] [-a arch] [-d bytes] "opcode"|-
 olly, x86, ppc, arm, java
 call [addr]  - call to address
 jmp [addr]   - jump to relative address
 jz  [addr]   - jump if equal
 jnz          - jump if not equal
 trap         - trap into the debugger
 nop          - no operation
 push 33      - push a value or reg in stack
 pop eax      - pop into a register
 int 0x80     - system call interrupt
 ret          - return from subroutine
 ret0         - return 0 from subroutine
 hang         - hang (infinite loop
 mov eax, 33  - asign a value to a register
 .zero 23     - fill 23 zeroes
 .org 0x8000  - offset