Python: Add aliases for some registers
Vicki Pfau vi@endrift.com
Mon, 24 Aug 2020 01:59:12 -0700
1 files changed,
28 insertions(+),
0 deletions(-)
jump to
M
src/platform/python/mgba/arm.py
→
src/platform/python/mgba/arm.py
@@ -22,8 +22,36 @@ self._cpu._native.gprs[reg] = value
class ARMCore: + SP = 13 + LR = 14 + PC = 15 + def __init__(self, native): self._native = ffi.cast("struct ARMCore*", native) self.gprs = _ARMRegisters(self) self.cpsr = self._native.cpsr self.spsr = self._native.spsr + + @property + def sp(self): + return self.gprs[self.SP] + + @sp.setter + def sp(self, value): + self.gprs[self.SP] = value + + @property + def lr(self): + return self.gprs[self.LR] + + @lr.setter + def lr(self, value): + self.gprs[self.LR] = value + + @property + def pc(self): + return self.gprs[self.PC] + + @pc.setter + def pc(self, value): + self.gprs[self.PC] = value