mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-02 03:29:26 +00:00
Applied patch from Ed Spittles to fix Z and C flags for SBC. Closes #15.
This commit is contained in:
parent
7a54ad06f3
commit
460cc4e48e
@ -29,6 +29,11 @@ Next Release
|
||||
Overflow (V) flag. This fixes a failure in Rob Finch's test suite.
|
||||
Closes #6.
|
||||
|
||||
- Applied patch from Ed Spittles so that SBC now properly sets the
|
||||
Carry (C) and Zero (Z) flags. This fixes failures caught by Ed's
|
||||
own tests (see http://forum.6502.org/viewtopic.php?p=8854#8854).
|
||||
Closes #15.
|
||||
|
||||
- A new "save" command has been added to the monitor that will save
|
||||
a range of memory to a binary file.
|
||||
|
||||
|
@ -382,17 +382,17 @@ class MPU:
|
||||
else:
|
||||
borrow = 1
|
||||
|
||||
result = self.a - data - borrow
|
||||
result = self.a + (~data & 0xFF) + (self.p & self.CARRY)
|
||||
self.p &= ~(self.CARRY + self.ZERO + self.OVERFLOW + self.NEGATIVE)
|
||||
if ( (self.a ^ data) & (self.a ^ result) ) & 0x80:
|
||||
self.p |= self.OVERFLOW
|
||||
data = result
|
||||
data = result & 0xFF
|
||||
if data == 0:
|
||||
self.p |= self.ZERO + self.CARRY
|
||||
elif data > 0:
|
||||
self.p |= self.ZERO
|
||||
if result & 0x100:
|
||||
self.p |= self.CARRY
|
||||
self.p |= data & self.NEGATIVE
|
||||
self.a = data & 0xFF
|
||||
self.a = data
|
||||
|
||||
def opDECR(self, x):
|
||||
if x is None:
|
||||
|
Loading…
Reference in New Issue
Block a user