chk2cmp2 32 . pcix 0000010011111011 .......... . . U U . . 23 23\r
chk2cmp2 32 . . 0000010011...... A..DXWL... . . U U . . 18 18\r
clr 8 . d 0100001000000... .......... U U U U 4 4 2 2\r
-clr 8 . . 0100001000...... A+-DXWL... U U U U 6 4 4 4 notaz hack: changed 000 cycles 8 -> 6 like in starscream for Fatal Rewind\r
+clr 8 . . 0100001000...... A+-DXWL... U U U U 8 4 4 4\r
clr 16 . d 0100001001000... .......... U U U U 4 4 2 2\r
-clr 16 . . 0100001001...... A+-DXWL... U U U U 6 4 4 4 notaz hack: ditto\r
+clr 16 . . 0100001001...... A+-DXWL... U U U U 8 4 4 4\r
clr 32 . d 0100001010000... .......... U U U U 6 6 2 2\r
clr 32 . . 0100001010...... A+-DXWL... U U U U 12 6 4 4\r
cmp 8 . d 1011...000000... .......... U U U U 4 4 2 2\r
uint src = DY;\r
uint dst = *r_dst;\r
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();\r
-\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ uint corf = 0;\r
\r
if(res > 9)\r
- res += 6;\r
+ corf = 6;\r
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);\r
- FLAG_X = FLAG_C = (res > 0x99) << 8;\r
+ FLAG_V = ~res; /* Undefined V behavior */\r
+\r
+ res += corf;\r
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;\r
if(FLAG_C)\r
res -= 0xa0;\r
\r
uint ea = EA_A7_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();\r
-\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ uint corf = 0;\r
\r
if(res > 9)\r
- res += 6;\r
+ corf = 6;\r
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);\r
- FLAG_X = FLAG_C = (res > 0x99) << 8;\r
+ FLAG_V = ~res; /* Undefined V behavior */\r
+\r
+ res += corf;\r
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;\r
if(FLAG_C)\r
res -= 0xa0;\r
\r
uint ea = EA_AX_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();\r
-\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ uint corf = 0;\r
\r
if(res > 9)\r
- res += 6;\r
+ corf = 6;\r
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);\r
- FLAG_X = FLAG_C = (res > 0x99) << 8;\r
+ FLAG_V = ~res; /* Undefined V behavior */\r
+\r
+ res += corf;\r
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;\r
if(FLAG_C)\r
res -= 0xa0;\r
\r
uint ea = EA_A7_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();\r
-\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ uint corf = 0;\r
\r
if(res > 9)\r
- res += 6;\r
+ corf = 6;\r
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);\r
- FLAG_X = FLAG_C = (res > 0x99) << 8;\r
+ FLAG_V = ~res; /* Undefined V behavior */\r
+\r
+ res += corf;\r
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;\r
if(FLAG_C)\r
res -= 0xa0;\r
\r
uint ea = EA_AX_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();\r
-\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ uint corf = 0;\r
\r
if(res > 9)\r
- res += 6;\r
+ corf = 6;\r
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);\r
- FLAG_X = FLAG_C = (res > 0x99) << 8;\r
+ FLAG_V = ~res; /* Undefined V behavior */\r
+\r
+ res += corf;\r
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;\r
if(FLAG_C)\r
res -= 0xa0;\r
\r
M68KMAKE_OP(adda, 32, ., .)\r
{\r
uint* r_dst = &AX;\r
+ uint src = M68KMAKE_GET_OPER_AY_32; // notaz\r
\r
- *r_dst = MASK_OUT_ABOVE_32(*r_dst + M68KMAKE_GET_OPER_AY_32);\r
+ *r_dst = MASK_OUT_ABOVE_32(*r_dst + src);\r
}\r
\r
\r
if(register_list & (1 << i))\r
{\r
ea -= 4;\r
+#if 0\r
+ m68ki_write_32(ea, REG_DA[15-i] ); // notaz Cyclone hack\r
+#else\r
m68ki_write_16(ea+2, REG_DA[15-i] & 0xFFFF );\r
m68ki_write_16(ea, (REG_DA[15-i] >> 16) & 0xFFFF );\r
+#endif\r
count++;\r
}\r
AY = ea;\r
M68KMAKE_OP(nbcd, 8, ., d)\r
{\r
uint* r_dst = &DY;\r
- uint dst = *r_dst;\r
- uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1());\r
+ uint dst = MASK_OUT_ABOVE_8(*r_dst);\r
+ uint res = -dst - XFLAG_AS_1();\r
\r
- if(res != 0x9a)\r
+ if(res != 0)\r
{\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ FLAG_V = res; /* Undefined V behavior */\r
\r
- if((res & 0x0f) == 0xa)\r
- res = (res & 0xf0) + 0x10;\r
+ if(((res|dst) & 0x0f) == 0)\r
+ res = (res & 0xf0) + 6;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res + 0x9a);\r
\r
- FLAG_V &= res; /* Undefined V behavior part II */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
\r
*r_dst = MASK_OUT_BELOW_8(*r_dst) | res;\r
\r
{\r
uint ea = M68KMAKE_GET_EA_AY_8;\r
uint dst = m68ki_read_8(ea);\r
- uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1());\r
+ uint res = -dst - XFLAG_AS_1();\r
\r
- if(res != 0x9a)\r
+ if(res != 0)\r
{\r
- FLAG_V = ~res; /* Undefined V behavior */\r
+ FLAG_V = res; /* Undefined V behavior */\r
\r
- if((res & 0x0f) == 0xa)\r
- res = (res & 0xf0) + 0x10;\r
+ if(((res|dst) & 0x0f) == 0)\r
+ res = (res & 0xf0) + 6;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res + 0x9a);\r
\r
- FLAG_V &= res; /* Undefined V behavior part II */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
\r
m68ki_write_8(ea, MASK_OUT_ABOVE_8(res));\r
\r
uint src = DY;\r
uint dst = *r_dst;\r
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();\r
+ uint corf = 0;\r
\r
-// FLAG_V = ~res; /* Undefined V behavior */\r
- FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to assume cleared. */\r
-\r
- if(res > 9)\r
- res -= 6;\r
+ if(res > 0xf)\r
+ corf = 6;\r
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);\r
- if(res > 0x99)\r
+ FLAG_V = res; /* Undefined V behavior */\r
+ if(res > 0xff)\r
{\r
res += 0xa0;\r
FLAG_X = FLAG_C = CFLAG_SET;\r
- FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */\r
}\r
+ else if(res < corf)\r
+ FLAG_X = FLAG_C = CFLAG_SET;\r
else\r
- FLAG_N = FLAG_X = FLAG_C = 0;\r
+ FLAG_X = FLAG_C = 0;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res - corf);\r
\r
-// FLAG_V &= res; /* Undefined V behavior part II */\r
-// FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
+ FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
FLAG_Z |= res;\r
\r
*r_dst = MASK_OUT_BELOW_8(*r_dst) | res;\r
uint ea = EA_A7_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();\r
+ uint corf = 0;\r
\r
-// FLAG_V = ~res; /* Undefined V behavior */\r
- FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */\r
-\r
- if(res > 9)\r
- res -= 6;\r
+ if(res > 0xf)\r
+ corf = 6;\r
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);\r
- if(res > 0x99)\r
+ FLAG_V = res; /* Undefined V behavior */\r
+ if(res > 0xff)\r
{\r
res += 0xa0;\r
FLAG_X = FLAG_C = CFLAG_SET;\r
- FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */\r
}\r
+ else if(res < corf)\r
+ FLAG_X = FLAG_C = CFLAG_SET;\r
else\r
- FLAG_N = FLAG_X = FLAG_C = 0;\r
+ FLAG_X = FLAG_C = 0;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res - corf);\r
\r
-// FLAG_V &= res; /* Undefined V behavior part II */\r
-// FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
+ FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
FLAG_Z |= res;\r
\r
m68ki_write_8(ea, res);\r
uint ea = EA_AX_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();\r
+ uint corf = 0;\r
\r
-// FLAG_V = ~res; /* Undefined V behavior */\r
- FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */\r
-\r
- if(res > 9)\r
- res -= 6;\r
+ if(res > 0xf)\r
+ corf = 6;\r
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);\r
- if(res > 0x99)\r
+ FLAG_V = res; /* Undefined V behavior */\r
+ if(res > 0xff)\r
{\r
res += 0xa0;\r
FLAG_X = FLAG_C = CFLAG_SET;\r
- FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */\r
}\r
+ else if(res < corf)\r
+ FLAG_X = FLAG_C = CFLAG_SET;\r
else\r
- FLAG_N = FLAG_X = FLAG_C = 0;\r
+ FLAG_X = FLAG_C = 0;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res - corf);\r
\r
-// FLAG_V &= res; /* Undefined V behavior part II */\r
-// FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
+ FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
FLAG_Z |= res;\r
\r
m68ki_write_8(ea, res);\r
uint ea = EA_A7_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();\r
+ uint corf = 0;\r
\r
-// FLAG_V = ~res; /* Undefined V behavior */\r
- FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */\r
-\r
- if(res > 9)\r
- res -= 6;\r
+ if(res > 0xf)\r
+ corf = 6;\r
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);\r
- if(res > 0x99)\r
+ FLAG_V = res; /* Undefined V behavior */\r
+ if(res > 0xff)\r
{\r
res += 0xa0;\r
FLAG_X = FLAG_C = CFLAG_SET;\r
- FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */\r
}\r
+ else if(res < corf)\r
+ FLAG_X = FLAG_C = CFLAG_SET;\r
else\r
- FLAG_N = FLAG_X = FLAG_C = 0;\r
+ FLAG_X = FLAG_C = 0;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res - corf);\r
\r
-// FLAG_V &= res; /* Undefined V behavior part II */\r
-// FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
+ FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
FLAG_Z |= res;\r
\r
m68ki_write_8(ea, res);\r
uint ea = EA_AX_PD_8();\r
uint dst = m68ki_read_8(ea);\r
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();\r
+ uint corf = 0;\r
\r
-// FLAG_V = ~res; /* Undefined V behavior */\r
- FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */\r
-\r
- if(res > 9)\r
- res -= 6;\r
+ if(res > 0xf)\r
+ corf = 6;\r
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);\r
- if(res > 0x99)\r
+ FLAG_V = res; /* Undefined V behavior */\r
+ if(res > 0xff)\r
{\r
res += 0xa0;\r
FLAG_X = FLAG_C = CFLAG_SET;\r
- FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */\r
}\r
+ else if(res < corf)\r
+ FLAG_X = FLAG_C = CFLAG_SET;\r
else\r
- FLAG_N = FLAG_X = FLAG_C = 0;\r
+ FLAG_X = FLAG_C = 0;\r
\r
- res = MASK_OUT_ABOVE_8(res);\r
+ res = MASK_OUT_ABOVE_8(res - corf);\r
\r
-// FLAG_V &= res; /* Undefined V behavior part II */\r
-// FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
+ FLAG_V &= ~res; /* Undefined V behavior part II */\r
+ FLAG_N = NFLAG_8(res); /* Undefined N behavior */\r
FLAG_Z |= res;\r
\r
m68ki_write_8(ea, res);\r
M68KMAKE_OP(suba, 32, ., .)\r
{\r
uint* r_dst = &AX;\r
+ uint src = M68KMAKE_GET_OPER_AY_32; // notaz\r
\r
- *r_dst = MASK_OUT_ABOVE_32(*r_dst - M68KMAKE_GET_OPER_AY_32);\r
+ *r_dst = MASK_OUT_ABOVE_32(*r_dst - src);\r
}\r
\r
\r