1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-11-07 21:05:41 +00:00

more bcd tests! okay, stop bcd tests.

This commit is contained in:
martti 2011-06-22 17:59:13 +02:00 committed by Mike Naberezny
parent 9b1e1d6465
commit df41a78c9c

View File

@ -361,6 +361,24 @@ class Common6502Tests:
self.assertEqual(0, mpu.p & mpu.ZERO) self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY) self.assertEqual(0, mpu.p & mpu.CARRY)
def test_adc_bcd_on_immediate_9c_plus_9d(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x9c
self._write(mpu.memory, 0x0000, (0x69, 0x9d)) #=> $0000 ADC #$9d
self._write(mpu.memory, 0x0002, (0x69, 0x9d)) #=> $0000 ADC #$9d
mpu.step()
self.assertEqual(0x9f, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x93, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ADC Absolute, X-Indexed # ADC Absolute, X-Indexed
def test_adc_bcd_off_abs_x_carry_clear_in_accumulator_zeroes(self): def test_adc_bcd_off_abs_x_carry_clear_in_accumulator_zeroes(self):
@ -4156,6 +4174,19 @@ class Common6502Tests:
self.assertEqual(0, mpu.p & mpu.ZERO) self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY) self.assertEqual(0, mpu.p & mpu.CARRY)
def test_sbc_bcd_on_immediate_20_minus_0a_carry_unset(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.a = 0x20
self._write(mpu.memory, 0x0000, (0xe9, 0x0a)) #=> $0000 SBC #$00
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x1f, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# SBC Absolute, X-Indexed # SBC Absolute, X-Indexed
def test_sbc_abs_x_all_zeros_and_no_borrow_is_zero(self): def test_sbc_abs_x_all_zeros_and_no_borrow_is_zero(self):