do { \
uint8_t c = FLAG_GET(C); \
r = r & a; \
- uint16_t res = r + a + c; \
- FLAG_SET(N, (res & 0x100) >> 8); \
- FLAG_SET(V, ((r ^ res) & (a ^ res) & 0x80) >> 7); \
- FLAG_SET(C, r & 1); \
- r = (r >> 1) | (r << 7); \
+ r = (r >> 1) | (c << 7); \
+ FLAG_SET(C, (r & 0x40) >> 6); \
+ FLAG_SET(V, ((r & 0x40) ^ ((r & 0x20) << 1)) >> 6); \
+ FLAG_SET(N, (r & 0x80) >> 7); \
+ FLAG_SET(Z, (r == 0) ? 1 : 0); \
} while (0);
#define DCP(src, dst) \
uint8_t a;
R_IMM();
ARR();
- FLAG_SET(Z, (r == 0) ? 1 : 0);
cpu->a = r;
} while (0);
break;