wiithon.ppc.instructions module

wiithon.ppc.instructions.b(target, from_addr)[source]

b target - unconditional relative branch, no link

Parameters:
  • target (int)

  • from_addr (int)

Return type:

bytes

wiithon.ppc.instructions.bl(target, from_addr)[source]

bl target - unconditional relative branch with link (saves return address in LR)

Parameters:
  • target (int)

  • from_addr (int)

Return type:

bytes

wiithon.ppc.instructions.ba(target)[source]

ba target - unconditional absolute branch, no link

Parameters:

target (int)

Return type:

bytes

wiithon.ppc.instructions.bla(target)[source]

bla target - unconditional absolute branch with link

Parameters:

target (int)

Return type:

bytes

wiithon.ppc.instructions.bc(bo, bi, target, from_addr)[source]

bc bo, bi, target - conditional relative branch, no link

Parameters:
Return type:

bytes

wiithon.ppc.instructions.bcl(bo, bi, target, from_addr)[source]

bcl bo, bi, target - conditional relative branch with link

Parameters:
Return type:

bytes

wiithon.ppc.instructions.bclr(bo, bi)[source]
Parameters:
wiithon.ppc.instructions.bclrl(bo, bi)[source]
Parameters:
wiithon.ppc.instructions.blr()[source]
wiithon.ppc.instructions.blrl()[source]
wiithon.ppc.instructions.cmp(crfD, rA, rB, l=0)[source]

cmp crfD, rA, rB - signed integer compare; result written to CR field crfD

Parameters:
Return type:

bytes

wiithon.ppc.instructions.cmpi(crfD, rA, imm, l=0)[source]

cmpi crfD, rA, imm - signed compare immediate; result written to CR field crfD

Parameters:
Return type:

bytes

wiithon.ppc.instructions.li(rD, imm)[source]

li rD, imm - load signed 16-bit immediate

Parameters:
Return type:

bytes

wiithon.ppc.instructions.lis(rD, imm)[source]

lis rD, imm - load immediate shifted left 16 (accepts signed or unsigned 16-bit)

Parameters:
Return type:

bytes

wiithon.ppc.instructions.addi(rD, rA, imm)[source]

addi rD, rA, imm - add signed 16-bit immediate; rA=r0 reads as 0

Parameters:
Return type:

bytes

wiithon.ppc.instructions.addis(rD, rA, imm)[source]

addis rD, rA, imm - add immediate shifted; imm is placed in the high halfword

Parameters:
Return type:

bytes

wiithon.ppc.instructions.mulli(rD, rA, imm)[source]

mulli rD, rA, imm - multiply rA by signed 16-bit immediate, store low 32 bits

Parameters:
Return type:

bytes

wiithon.ppc.instructions.lwz(rD, offset, rA)[source]

lwz rD, offset(rA) - load word and zero-extend from effective address

Parameters:
Return type:

bytes

wiithon.ppc.instructions.stw(rS, offset, rA)[source]

stw rS, offset(rA) - store 32-bit word to effective address

Parameters:
Return type:

bytes

wiithon.ppc.instructions.lbz(rD, offset, rA)[source]

lbz rD, offset(rA) - load byte and zero-extend

Parameters:
Return type:

bytes

wiithon.ppc.instructions.stb(rS, offset, rA)[source]

stb rS, offset(rA) - store byte (low 8 bits of rS)

Parameters:
Return type:

bytes

wiithon.ppc.instructions.lhz(rD, offset, rA)[source]

lhz rD, offset(rA) - load halfword and zero-extend

Parameters:
Return type:

bytes

wiithon.ppc.instructions.sth(rS, offset, rA)[source]

sth rS, offset(rA) - store halfword (low 16 bits of rS)

Parameters:
Return type:

bytes

wiithon.ppc.instructions.ori(rA, rS, imm)[source]

ori rA, rS, imm - bitwise OR with unsigned 16-bit immediate

Parameters:
Return type:

bytes

wiithon.ppc.instructions.oris(rA, rS, imm)[source]

oris rA, rS, imm - bitwise OR with unsigned 16-bit immediate shifted

Parameters:
wiithon.ppc.instructions.nop()[source]

nop - no operation (pseudo: ori r0, r0, 0)

Return type:

bytes

wiithon.ppc.instructions.andi(rA, rS, imm)[source]

andi. rA, rS, imm - rA = rS & imm (unsigned 16-bit); always updates CR0

Parameters:
Return type:

bytes

wiithon.ppc.instructions.lfs(frD, offset, rA)[source]

lfs frD, offset(rA) - load single-precision float, convert to double in frD

Parameters:
Return type:

bytes

wiithon.ppc.instructions.stfs(frS, offset, rA)[source]

stfs frS, offset(rA) - convert frS to single precision and store to memory

Parameters:
Return type:

bytes

wiithon.ppc.instructions.add(rD, rA, rB)[source]

add rD, rA, rB - rD = rA + rB

Parameters:
Return type:

bytes

wiithon.ppc.instructions.subf(rD, rA, rB)[source]

subf rD, rA, rB - subtract from: rD = rB - rA

Parameters:
Return type:

bytes

wiithon.ppc.instructions.and_(rA, rS, rB)[source]

and rA, rS, rB - rA = rS & rB

Parameters:
Return type:

bytes

wiithon.ppc.instructions.or_(rA, rS, rB)[source]

or rA, rS, rB - rA = rS | rB

Parameters:
Return type:

bytes

wiithon.ppc.instructions.mr(rA, rS)[source]

mr rA, rS - copy register (pseudo: or rA, rS, rS)

Parameters:
Return type:

bytes

wiithon.ppc.instructions.cntlzw(rA, rS)[source]
Parameters:
Return type:

bytes

wiithon.ppc.instructions.rlwnm(rA, rS, rB, mb, me)[source]

rlwnm rA, rS, rB, MB, ME - rotate rS left by rB bits, AND with mask(MB, ME), store in rA

Parameters:
Return type:

bytes

wiithon.ppc.instructions.mfspr(rD, spr)[source]

mfspr rD, spr - move from special-purpose register into rD

Parameters:
Return type:

bytes

wiithon.ppc.instructions.mtspr(spr, rS)[source]

mtspr spr, rS - move rS into special-purpose register

Parameters:
Return type:

bytes

wiithon.ppc.instructions.mflr(rD)[source]

mflr rD - move Link Register into rD

Parameters:

rD (int)

Return type:

bytes

wiithon.ppc.instructions.mtlr(rS)[source]

mtlr rS - move rS into Link Register

Parameters:

rS (int)

Return type:

bytes

wiithon.ppc.instructions.mfctr(rD)[source]

mfctr rD - move Count Register into rD

Parameters:

rD (int)

Return type:

bytes

wiithon.ppc.instructions.mtctr(rS)[source]

mtctr rS - move rS into Count Register

Parameters:

rS (int)

Return type:

bytes