From 777266f8e1ec4d2605b73f23f1b8e2d1444242bb Mon Sep 17 00:00:00 2001 From: James Tauber Date: Sun, 7 Aug 2011 00:24:25 -0400 Subject: [PATCH] implemented non-accumulator version of ROR --- applepy.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/applepy.py b/applepy.py index 5b72edb..b8d9851 100644 --- a/applepy.py +++ b/applepy.py @@ -456,11 +456,18 @@ class CPU: m = m | 0x01 self.memory.write_byte(operand_address,self.update_nzc(m)) - def ROR(self): - if self.carry_flag: - self.accumulator = self.accumulator | 0x100 - self.carry_flag = self.accumulator % 2 - self.accumulator = self.update_nz(self.accumulator >> 1) + def ROR(self, operand_address=None): + if operand_address is None: + if self.carry_flag: + self.accumulator = self.accumulator | 0x100 + self.carry_flag = self.accumulator % 2 + self.accumulator = self.update_nz(self.accumulator >> 1) + else: + m = self.memory.read_byte(operand_address) + if self.carry_flag: + m = m | 0x100 + self.carry_flag = m % 2 + self.memory.write_byte(operand_address, self.update_nz(m >> 1)) def LSR(self, operand_address=None): if operand_address is None: