mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-01 11:29:32 +00:00
Fix Z flag handling for TSB and TRB. Closes #32
This commit is contained in:
parent
16d21704cc
commit
9d59f057d3
@ -9,6 +9,9 @@
|
||||
allow the addresses of the ``getc`` and ``putc`` handlers to be
|
||||
changed. Patch by Mario Keller.
|
||||
|
||||
- Fixed a 65C02 bug where the TSB and TRB instructions did not set
|
||||
the Z flag correctly. Thanks to Kris Kennaway for reporting it.
|
||||
|
||||
0.24 (2015-03-31)
|
||||
|
||||
- Released as a universal wheel.
|
||||
|
@ -50,7 +50,7 @@ class MPU(mpu6502.MPU):
|
||||
m = self.memory[address]
|
||||
self.p &= ~self.ZERO
|
||||
z = m & self.a
|
||||
if z != 0:
|
||||
if z == 0:
|
||||
self.p |= self.ZERO
|
||||
self.memory[address] = m | self.a
|
||||
|
||||
@ -59,7 +59,7 @@ class MPU(mpu6502.MPU):
|
||||
m = self.memory[address]
|
||||
self.p &= ~self.ZERO
|
||||
z = m & self.a
|
||||
if z != 0:
|
||||
if z == 0:
|
||||
self.p |= self.ZERO
|
||||
self.memory[address] = m & ~self.a
|
||||
|
||||
|
@ -1227,7 +1227,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0xE0, mpu.memory[0x00BB])
|
||||
mpu.step()
|
||||
self.assertEqual(0xF0, mpu.memory[0x00BB])
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0002, mpu.pc)
|
||||
self.assertEqual(5, mpu.processorCycles)
|
||||
|
||||
@ -1240,7 +1240,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0x80, mpu.memory[0x00BB])
|
||||
mpu.step()
|
||||
self.assertEqual(0xE0, mpu.memory[0x00BB])
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0002, mpu.pc)
|
||||
self.assertEqual(5, mpu.processorCycles)
|
||||
|
||||
@ -1255,7 +1255,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0xE0, mpu.memory[0xFEED])
|
||||
mpu.step()
|
||||
self.assertEqual(0xF0, mpu.memory[0xFEED])
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0003, mpu.pc)
|
||||
self.assertEqual(6, mpu.processorCycles)
|
||||
|
||||
@ -1268,7 +1268,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0x80, mpu.memory[0xFEED])
|
||||
mpu.step()
|
||||
self.assertEqual(0xE0, mpu.memory[0xFEED])
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0003, mpu.pc)
|
||||
self.assertEqual(6, mpu.processorCycles)
|
||||
|
||||
@ -1283,7 +1283,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0xE0, mpu.memory[0x00BB])
|
||||
mpu.step()
|
||||
self.assertEqual(0x80, mpu.memory[0x00BB])
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0002, mpu.pc)
|
||||
self.assertEqual(5, mpu.processorCycles)
|
||||
|
||||
@ -1296,7 +1296,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0x80, mpu.memory[0x00BB])
|
||||
mpu.step()
|
||||
self.assertEqual(0x80, mpu.memory[0x00BB])
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0002, mpu.pc)
|
||||
self.assertEqual(5, mpu.processorCycles)
|
||||
|
||||
@ -1311,7 +1311,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0xE0, mpu.memory[0xFEED])
|
||||
mpu.step()
|
||||
self.assertEqual(0x80, mpu.memory[0xFEED])
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0003, mpu.pc)
|
||||
self.assertEqual(6, mpu.processorCycles)
|
||||
|
||||
@ -1324,7 +1324,7 @@ class MPUTests(unittest.TestCase, Common6502Tests):
|
||||
self.assertEqual(0x80, mpu.memory[0xFEED])
|
||||
mpu.step()
|
||||
self.assertEqual(0x80, mpu.memory[0xFEED])
|
||||
self.assertEqual(0, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
|
||||
self.assertEqual(0x0003, mpu.pc)
|
||||
self.assertEqual(6, mpu.processorCycles)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user