mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-04 01:30:18 +00:00
fix two failing BCD tests: now passes the Bruce Clark exhaustive test for all flags
This commit is contained in:
parent
4bd92cf80e
commit
f4fba9b06a
@ -292,9 +292,13 @@ class MPU:
|
||||
nibble1 = ((data >> 4) & 0xf) + ((self.a >> 4) & 0xf) + halfcarry
|
||||
if nibble1 > 9:
|
||||
adjust1 = 6
|
||||
decimalcarry = 1 # may be a little more complicated than this
|
||||
decimalcarry = 1
|
||||
|
||||
# the ALU outputs are not decimally adjusted
|
||||
nibble0 = nibble0 & 0xf
|
||||
nibble1 = nibble1 & 0xf
|
||||
aluresult = (nibble1 << 4) + nibble0
|
||||
|
||||
# the final A contents will be decimally adjusted
|
||||
nibble0 = (nibble0 + adjust0) & 0xf
|
||||
nibble1 = (nibble1 + adjust1) & 0xf
|
||||
@ -403,7 +407,7 @@ class MPU:
|
||||
self.p |= aluresult & self.NEGATIVE
|
||||
if decimalcarry == 1:
|
||||
self.p |= self.CARRY
|
||||
if ( ~(self.a ^ data) & (self.a ^ aluresult) ) & 0x80:
|
||||
if ( (self.a ^ data) & (self.a ^ aluresult) ) & 0x80:
|
||||
self.p |= self.OVERFLOW
|
||||
self.a = (nibble1 << 4) + nibble0
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user