Registers[edit | edit source]

  • def getRegs03(op):
getRegs03("blah R1 blah R3 blah R2 blah R5") => [1, 3, 2]
  • def getRegsS(op):
getRegsS("blah R1 blah R3 blah R2 blah R5") => ["R1", "R3", "R2", "R5"]

Decoding instructions[edit | edit source]

ARM asm instructions are sometimes a big keyword made from mnemonics and some suffixes (conditional, mode, change flags, byte/word operation and maybe others.

  • Mode suffixes: (IA|IB|DA|DB|FD|FA|ED|EA)
  • Conditional suffixes: (AL|NV|EQ|NE|VS|VC|MI|PL|CS|CC|HI|LS|GE|LT|GT|LE)
  • Flag change suffix: S
  • Byte and Halfword: B and H
  • def GetModeSuffix(ea):
returns the mode suffix string or ""

e.g. if ea contains LDMIA blah blah, 
GetModeSuffix(ea) => "IA"
  • def GetCondSuffix(ea):
returns the conditional suffix string or ""

e.g. if ea contains ADDEQ blah blah, 
GetCondSuffix(ea) => "EQ"
  • def GetExtraSuffixes(ea):
get a string with all suffixes except mode and condition
  • def GetFlagSuffix(ea):
returns "S" or ""
  • def GetByteSuffix(ea):
returns "B" or ""
  • def GetHalfwordSuffix(ea):
returns "H" or ""
  • def OppositeSuffix(s):
OppositeSuffix("EQ") => NE
OppositeSuffix("MI") => PL
and so on...
  • def ChangesFlags(ea):
True if the instruction at "ea" changes flags, False otherwise.
  • isFuncStart(ea):
True if ea is the first instruction of a function, else False

Binary/Hex stuff[edit | edit source]

  • def setBit01(old, offset, value):
def setBit01(old, offset, value):
    if value: setBit(old, offset)
    else: clearBit(old, offset)
  • def hex(x):
hex(10) => "A"
hex(-1) => "FFFFFFFF"
Community content is available under CC-BY-SA unless otherwise noted.