implemented non-accumulator version of ROR

This commit is contained in:
James Tauber 2011-08-07 00:24:25 -04:00
parent 8f10724a7f
commit 777266f8e1

View File

@ -456,11 +456,18 @@ class CPU:
m = m | 0x01 m = m | 0x01
self.memory.write_byte(operand_address,self.update_nzc(m)) self.memory.write_byte(operand_address,self.update_nzc(m))
def ROR(self): def ROR(self, operand_address=None):
if operand_address is None:
if self.carry_flag: if self.carry_flag:
self.accumulator = self.accumulator | 0x100 self.accumulator = self.accumulator | 0x100
self.carry_flag = self.accumulator % 2 self.carry_flag = self.accumulator % 2
self.accumulator = self.update_nz(self.accumulator >> 1) 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): def LSR(self, operand_address=None):
if operand_address is None: if operand_address is None: