mirror of
https://github.com/mnaberez/py65.git
synced 2024-11-07 21:05:41 +00:00
Added 65C02 instruction EOR (ZP).
This commit is contained in:
parent
766609b9a4
commit
5cb179450d
@ -54,6 +54,11 @@ class MPU(NMOS6502):
|
||||
self.opAND(self.ZeroPageIndirectAddr)
|
||||
self.pc += 1
|
||||
|
||||
@instruction(name="EOR", mode="zpi", cycles=5)
|
||||
def i52(self):
|
||||
self.opEOR(self.ZeroPageIndirectAddr)
|
||||
self.pc += 1
|
||||
|
||||
@instruction(name="PHY", mode="imp", cycles=3)
|
||||
def i5a(self):
|
||||
self.stPush(self.y)
|
||||
|
@ -40,6 +40,34 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEquals(mpu.NEGATIVE, mpu.flags & mpu.NEGATIVE)
|
||||
self.assertEquals(0, mpu.flags & mpu.ZERO)
|
||||
|
||||
# EOR Zero Page, Indirect
|
||||
|
||||
def test_eor_zp_indirect_flips_bits_over_setting_z_flag(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.a = 0xFF
|
||||
self._write(mpu.memory, 0x0000, (0x52, 0x10)) #=> EOR ($0010)
|
||||
self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) #=> Vector to $ABCD
|
||||
mpu.memory[0xABCD] = 0xFF
|
||||
mpu.step()
|
||||
self.assertEquals(0x0002, mpu.pc)
|
||||
self.assertEquals(5, mpu.processorCycles)
|
||||
self.assertEquals(0x00, mpu.a)
|
||||
self.assertEquals(0xFF, mpu.memory[0xABCD])
|
||||
self.assertEquals(mpu.ZERO, mpu.flags & mpu.ZERO)
|
||||
|
||||
def test_eor_zp_indirect_flips_bits_over_setting_n_flag(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.a = 0x00
|
||||
self._write(mpu.memory, 0x0000, (0x52, 0x10)) #=> EOR ($0010)
|
||||
self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) #=> Vector to $ABCD
|
||||
mpu.memory[0xABCD] = 0xFF
|
||||
mpu.step()
|
||||
self.assertEquals(0x0002, mpu.pc)
|
||||
self.assertEquals(5, mpu.processorCycles)
|
||||
self.assertEquals(0xFF, mpu.a)
|
||||
self.assertEquals(0xFF, mpu.memory[0xABCD])
|
||||
self.assertEquals(mpu.NEGATIVE, mpu.flags & mpu.NEGATIVE)
|
||||
self.assertEquals(0, mpu.flags & mpu.ZERO)
|
||||
|
||||
# LDA Zero Page, Indirect
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user