mirror of
https://github.com/mnaberez/py65.git
synced 2024-12-26 17:29:50 +00:00
Fix 65C02 opcode $D2: CMP Zero Page, Indirect
This commit is contained in:
parent
dbd12228d4
commit
7530f81507
@ -1,5 +1,7 @@
|
||||
0.19-dev (Next Release)
|
||||
|
||||
- Fixed 65C02 opcode $D2: CMP Zero Page, Indirect.
|
||||
|
||||
- Blocking character input at $F005 has been removed. The I/O area
|
||||
was designed to be compatible with Michal Kowalski's simulator,
|
||||
and it uses this address for another purpose. Examples that depended
|
||||
|
@ -274,7 +274,7 @@ class MPU(mpu6502.MPU):
|
||||
|
||||
@instruction(name="CMP", mode='zpi', cycles=5)
|
||||
def inst_0xd2(self):
|
||||
self.opCPY(self.ZeroPageIndirectAddr)
|
||||
self.opCMPR(self.ZeroPageIndirectAddr, self.a)
|
||||
self.pc += 1
|
||||
|
||||
@instruction(name="SMB5", mode="zpg", cycles=5)
|
||||
|
@ -13,7 +13,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
|
||||
# ADC Indirect, Indexed (X)
|
||||
|
||||
def test_adc_ind_indexed_has_page_wrap_bug(self):
|
||||
def test_adc_ind_indexed_does_not_have_wrap_bug(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.a = 0x01
|
||||
mpu.x = 0xFF
|
||||
@ -476,9 +476,41 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(mpu.BREAK, mpu.p & mpu.BREAK)
|
||||
self.assertEqual(0, mpu.p & mpu.DECIMAL)
|
||||
|
||||
# CMP Zero Page, Indirect
|
||||
|
||||
def test_cmp_zpi_sets_z_flag_if_equal(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.a = 0x42
|
||||
# $0000 AND ($10)
|
||||
# $0010 Vector to $ABCD
|
||||
self._write(mpu.memory, 0x0000, (0xd2, 0x10))
|
||||
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
|
||||
mpu.memory[0xABCD] = 0x42
|
||||
mpu.step()
|
||||
self.assertEqual(0x0002, mpu.pc)
|
||||
self.assertEqual(5, mpu.processorCycles)
|
||||
self.assertEqual(0x42, mpu.a)
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
|
||||
|
||||
def test_cmp_zpi_resets_z_flag_if_unequal(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.a = 0x43
|
||||
# $0000 AND ($10)
|
||||
# $0010 Vector to $ABCD
|
||||
self._write(mpu.memory, 0x0000, (0xd2, 0x10))
|
||||
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
|
||||
mpu.memory[0xABCD] = 0x42
|
||||
mpu.step()
|
||||
self.assertEqual(0x0002, mpu.pc)
|
||||
self.assertEqual(5, mpu.processorCycles)
|
||||
self.assertEqual(0x43, mpu.a)
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
|
||||
|
||||
# CMP Indirect, Indexed (X)
|
||||
|
||||
def test_cmp_ind_x_has_page_wrap_bug(self):
|
||||
def test_cmp_ind_x_does_not_have_page_wrap_bug(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.p = 0
|
||||
mpu.a = 0x42
|
||||
@ -944,7 +976,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
|
||||
# SBC Indirect, Indexed (X)
|
||||
|
||||
def test_sbc_ind_x_has_page_wrap_bug(self):
|
||||
def test_sbc_ind_x_does_not_have_page_wrap_bug(self):
|
||||
mpu = self._make_mpu()
|
||||
mpu.p = mpu.CARRY
|
||||
mpu.a = 0x03
|
||||
|
Loading…
Reference in New Issue
Block a user