magiclantern

Registers

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

Decoding instructions

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

returns the mode suffix string or ""

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

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

Binary/Hex stuff

def setBit01(old, offset, value):
    if value: setBit(old, offset)
    else: clearBit(old, offset)
hex(10) => "A"
hex(-1) => "FFFFFFFF"