mirror of
https://github.com/mnaberez/py65.git
synced 2025-03-13 15:33:42 +00:00
SBC now properly sets the V flag. Closes #6.
This commit is contained in:
parent
5ea9dc9a70
commit
c33fd61b36
@ -25,6 +25,10 @@ Next Release
|
||||
at that address. Entering "a" alone will start it at the current
|
||||
program counter.
|
||||
|
||||
- Applied patch from Ed Spittles so that SBC now properly sets the
|
||||
Overflow (V) flag. This fixes a failure in Rob Finch's test suite.
|
||||
Closes #6.
|
||||
|
||||
0.6 (2009-08-11)
|
||||
|
||||
- Added monitor shortcut "a" for "assemble".
|
||||
|
@ -382,14 +382,15 @@ class MPU:
|
||||
else:
|
||||
borrow = 1
|
||||
|
||||
data = self.a - data - borrow
|
||||
result = self.a - data - borrow
|
||||
self.flags &= ~(self.CARRY + self.ZERO + self.OVERFLOW + self.NEGATIVE)
|
||||
if ( (self.a ^ data) & (self.a ^ result) ) & 0x80:
|
||||
self.flags |= self.OVERFLOW
|
||||
data = result
|
||||
if data == 0:
|
||||
self.flags |= self.ZERO + self.CARRY
|
||||
elif data > 0:
|
||||
self.flags |= self.CARRY
|
||||
else:
|
||||
self.flags |= self.OVERFLOW
|
||||
self.flags |= data & self.NEGATIVE
|
||||
self.a = data & 0xFF
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user