1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-11-19 06:31:08 +00:00

add simple benchmark to support pypy testing

This commit is contained in:
BigEd 2011-08-19 13:38:44 +01:00 committed by Mike Naberezny
parent 3bed1d2247
commit 460ad72449

View File

@ -17,6 +17,30 @@ class Common6502Tests:
self.assertEqual(0, mpu.y)
self.assertEqual(mpu.BREAK | mpu.UNUSED, mpu.p)
# Benchmark
# $0000 d8 CLD
# $0001 18 CLC
# $0002 a9 00 LDA #$00
# $0004 a2 00 LDX #$00
# $0006 a0 00 LDY #$00
# $0008 c8 INY
# $0009 d0 fd BNE $0008
# $000b e8 INX
# $000c d0 f8 BNE $0006
# $000e 69 01 ADC #$01
# $0010 d0 f2 BNE $0004
# $0012 00 BRK
def test_benchmark(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xd8, 0x18, 0xa9, 0x00, 0xa2, 0x00, 0xa0, 0x00, 0xc8, 0xd0, 0xfd, 0xe8, 0xd0, 0xf8, 0x69, 0x01, 0xd0, 0xf2, 0x00, 0xed))
for i in range(1,100): # need a larger limit for this test to dominate the test time (but when benchmarking it doesn't need to pass)
mpu.step()
self.assertEqual(47, mpu.y)
self.assertEqual(0, mpu.x)
self.assertEqual(0, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Absolute
def test_adc_bcd_off_absolute_carry_clear_in_accumulator_zeroes(self):