1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 01:31:33 +00:00

Fixed setting of carry flag by ADC in decimal mode

This commit is contained in:
Curtis F Kaylor 2020-09-27 13:54:02 -04:00
parent 0d45fa4cbd
commit a3a0b13c6f

View File

@ -192,12 +192,12 @@ enum {
/* inelegant & slow, but consistent with the hw for illegal digits */ \
l= (A & 0x0F) + (B & 0x0F) + getC(); \
h= (A & 0xF0) + (B & 0xF0); \
if (l >= 0x0A) { l -= 0x0A; h += 0x10; } \
if (h >= 0xA0) { h -= 0xA0; } \
if (l >= 0x0A) { l += 0x06; h += 0x10; } \
if (h >= 0xA0) { h += 0x60; } \
fetch(); \
s= h | (l & 0x0F); \
s= (h & 0xF0) | (l & 0x0F); \
/* only C is valid on NMOS 6502 */ \
setNVZC(s & 0x80, !(((A ^ B) & 0x80) && ((A ^ s) & 0x80)), !s, !!(h & 0x80)); \
setNVZC(s & 0x80, !(((A ^ B) & 0x80) && ((A ^ s) & 0x80)), (s==0), ((h & 0x100) > 0)); \
A= s; \
tick(1); \
next(); \