all repos — mgba @ c7d50956b3ce957f370072b8fb60e259a79a75ea

mGBA Game Boy Advance Emulator

Python: Add aliases for some registers
Vicki Pfau vi@endrift.com
Mon, 24 Aug 2020 01:59:12 -0700
commit

c7d50956b3ce957f370072b8fb60e259a79a75ea

parent

4c8e08d2b00dda0015e6929fa963c95ab2bdeb9c

1 files changed, 28 insertions(+), 0 deletions(-)

jump to
M src/platform/python/mgba/arm.pysrc/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