uint src = DY;
uint dst = *r_dst;
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
-
- FLAG_V = ~res; /* Undefined V behavior */
+ uint corf = 0;
if(res > 9)
- res += 6;
+ corf = 6;
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
+ FLAG_V = ~res; /* Undefined V behavior */
+ res += corf;
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;
if(FLAG_C)
res -= 0xa0;
uint ea = EA_A7_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
-
- FLAG_V = ~res; /* Undefined V behavior */
+ uint corf = 0;
if(res > 9)
- res += 6;
+ corf = 6;
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
+ FLAG_V = ~res; /* Undefined V behavior */
+ res += corf;
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;
if(FLAG_C)
res -= 0xa0;
uint ea = EA_AX_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
-
- FLAG_V = ~res; /* Undefined V behavior */
+ uint corf = 0;
if(res > 9)
- res += 6;
+ corf = 6;
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
+ FLAG_V = ~res; /* Undefined V behavior */
+ res += corf;
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;
if(FLAG_C)
res -= 0xa0;
uint ea = EA_A7_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
-
- FLAG_V = ~res; /* Undefined V behavior */
+ uint corf = 0;
if(res > 9)
- res += 6;
+ corf = 6;
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
+ FLAG_V = ~res; /* Undefined V behavior */
+ res += corf;
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;
if(FLAG_C)
res -= 0xa0;
uint ea = EA_AX_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
-
- FLAG_V = ~res; /* Undefined V behavior */
+ uint corf = 0;
if(res > 9)
- res += 6;
+ corf = 6;
res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
+ FLAG_V = ~res; /* Undefined V behavior */
+ res += corf;
+ FLAG_X = FLAG_C = (res > 0x9f) << 8;
if(FLAG_C)
res -= 0xa0;
if((width + offset) > 32)
{
- mask_byte = MASK_OUT_ABOVE_8(mask_base);
+ mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset);
data_byte = m68ki_read_8(ea+4);
FLAG_Z |= (data_byte & mask_byte);
m68ki_write_8(ea+4, data_byte ^ mask_byte);
if((width + offset) > 32)
{
- mask_byte = MASK_OUT_ABOVE_8(mask_base);
+ mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset);
data_byte = m68ki_read_8(ea+4);
FLAG_Z |= (data_byte & mask_byte);
m68ki_write_8(ea+4, data_byte & ~mask_byte);
if(BIT_5(word2))
width = REG_D[width&7];
- /* Offset is signed so we have to use ugly math =( */
- ea += offset / 8;
- offset %= 8;
- if(offset < 0)
- {
- offset += 8;
- ea--;
+ if(BIT_B(word2)) {
+ /* Offset is signed so we have to use ugly math =( */
+ ea += offset / 8;
+ offset %= 8;
+ if(offset < 0)
+ {
+ offset += 8;
+ ea--;
+ }
}
width = ((width-1) & 31) + 1;
- data = m68ki_read_32(ea);
+ data = (offset+width) < 8 ? (m68ki_read_8(ea) << 24) :
+ (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
data = MASK_OUT_ABOVE_32(data<<offset);
if(BIT_5(word2))
width = REG_D[width&7];
- /* Offset is signed so we have to use ugly math =( */
- ea += offset / 8;
- offset %= 8;
- if(offset < 0)
- {
- offset += 8;
- ea--;
+ if(BIT_B(word2)) {
+ /* Offset is signed so we have to use ugly math =( */
+ ea += offset / 8;
+ offset %= 8;
+ if(offset < 0)
+ {
+ offset += 8;
+ ea--;
+ }
}
width = ((width-1) & 31) + 1;
- data = m68ki_read_32(ea);
+ data = (offset+width) < 8 ? (m68ki_read_8(ea) << 24) :
+ (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
data = MASK_OUT_ABOVE_32(data<<offset);
if((offset+width) > 32)
}
width = ((width-1) & 31) + 1;
- data = m68ki_read_32(ea);
+ data = (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
data = MASK_OUT_ABOVE_32(data<<local_offset);
if((local_offset+width) > 32)
if(BIT_5(word2))
width = REG_D[width&7];
- /* Offset is signed so we have to use ugly math =( */
- ea += offset / 8;
- offset %= 8;
- if(offset < 0)
- {
- offset += 8;
- ea--;
+ if(BIT_B(word2)) {
+ /* Offset is signed so we have to use ugly math =( */
+ ea += offset / 8;
+ offset %= 8;
+ if(offset < 0)
+ {
+ offset += 8;
+ ea--;
+ }
}
width = ((width-1) & 31) + 1;
FLAG_Z = insert_base;
insert_long = insert_base >> offset;
- data_long = m68ki_read_32(ea);
+ data_long = (offset+width) < 8 ? (m68ki_read_8(ea) << 24) :
+ (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
FLAG_V = VFLAG_CLEAR;
FLAG_C = CFLAG_CLEAR;
- m68ki_write_32(ea, (data_long & ~mask_long) | insert_long);
+ if((width + offset) < 8) {
+ m68ki_write_8(ea, ((data_long & ~mask_long) | insert_long) >> 24);
+ } else if((width + offset) < 16) {
+ m68ki_write_16(ea, ((data_long & ~mask_long) | insert_long) >> 16);
+ } else {
+ m68ki_write_32(ea, (data_long & ~mask_long) | insert_long);
+ }
if((width + offset) > 32)
{
M68KMAKE_OP(bkpt, 0, ., .)
{
+// TODO: review this...
if(CPU_TYPE_IS_010_PLUS(CPU_TYPE))
{
m68ki_bkpt_ack(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE) ? REG_IR & 7 : 0); /* auto-disable (see m68kcpu.h) */
{
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
- if(REG_PC == REG_PPC)
- USE_ALL_CYCLES();
+// TODO: review this...
+// if(REG_PC == REG_PPC)
+// USE_ALL_CYCLES();
}
REG_PC -= 2;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
m68ki_branch_16(offset);
- if(REG_PC == REG_PPC)
- USE_ALL_CYCLES();
+// TODO: review this...
+// if(REG_PC == REG_PPC)
+// USE_ALL_CYCLES();
}
REG_PC -= 4;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
m68ki_branch_32(offset);
- if(REG_PC == REG_PPC)
- USE_ALL_CYCLES();
+// TODO: review this...
+// if(REG_PC == REG_PPC)
+// USE_ALL_CYCLES();
return;
}
else
{
- m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
- if(REG_PC == REG_PPC)
- USE_ALL_CYCLES();
+// TODO: review this...
+ m68ki_exception_illegal();
+// m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
+// m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
+// if(REG_PC == REG_PPC)
+// USE_ALL_CYCLES();
}
}
}
else
{
- m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_push_32(REG_PC);
- m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
+// TODO: review this...
+ m68ki_exception_illegal();
+// m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
+// m68ki_push_32(REG_PC);
+// m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
}
}
(void)ea; /* just to avoid an 'unused variable' warning */
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
m68ki_exception_illegal();
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15]&0xff;
+ sint compare = REG_DA[(word2 >> 12) & 15];
+ if(!BIT_F(word2))
+ compare &= 0xff;
+
uint ea = EA_PCDI_8();
sint lower_bound = m68ki_read_pcrel_8(ea);
sint upper_bound = m68ki_read_pcrel_8(ea + 1);
- if(!BIT_F(word2))
- compare = (int32)(int8)compare;
-
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x80) {
+ lower_bound = (int32)(int8)lower_bound;
+ upper_bound = (int32)(int8)upper_bound;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
+ if(!BIT_F(word2))
+ compare = (int32)(int8)compare;
+ }
+
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15]&0xff;
+ sint compare = REG_DA[(word2 >> 12) & 15];
+ if(!BIT_F(word2))
+ compare &= 0xff;
+
uint ea = EA_PCIX_8();
sint lower_bound = m68ki_read_pcrel_8(ea);
sint upper_bound = m68ki_read_pcrel_8(ea + 1);
- if(!BIT_F(word2))
- compare = (int32)(int8)compare;
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||, faster operation short circuits
+ if (lower_bound & 0x80) {
+ lower_bound = (int32)(int8)lower_bound;
+ upper_bound = (int32)(int8)upper_bound;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
+ if(!BIT_F(word2))
+ compare = (int32)(int8)compare;
+ }
+
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15]&0xff;
+ sint compare = REG_DA[(word2 >> 12) & 15];
+ if(!BIT_F(word2))
+ compare &= 0xff;
+
uint ea = M68KMAKE_GET_EA_AY_8;
sint lower_bound = (int8)m68ki_read_8(ea);
sint upper_bound = (int8)m68ki_read_8(ea + 1);
- if(!BIT_F(word2))
- compare = (int32)(int8)compare;
-
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x80) {
+ lower_bound = (int32)(int8)lower_bound;
+ upper_bound = (int32)(int8)upper_bound;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
+ if(!BIT_F(word2))
+ compare = (int32)(int8)compare;
+ }
+
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15]&0xffff;
+ sint compare = REG_DA[(word2 >> 12) & 15];
+ if(!BIT_F(word2))
+ compare &= 0xffff;
+
uint ea = EA_PCDI_16();
sint lower_bound = (int16)m68ki_read_pcrel_16(ea);
sint upper_bound = (int16)m68ki_read_pcrel_16(ea + 2);
- if(!BIT_F(word2))
- compare = (int32)(int16)compare;
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x8000) {
+ lower_bound = (int32)(int16)lower_bound;
+ upper_bound = (int32)(int16)upper_bound;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
+ if(!BIT_F(word2))
+ compare = (int32)(int16)compare;
+ }
+
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15]&0xffff;
+ sint compare = REG_DA[(word2 >> 12) & 15];
+ if(!BIT_F(word2))
+ compare &= 0xffff;
+
uint ea = EA_PCIX_16();
sint lower_bound = (int16)m68ki_read_pcrel_16(ea);
sint upper_bound = (int16)m68ki_read_pcrel_16(ea + 2);
- if(!BIT_F(word2))
- compare = (int32)(int16)compare;
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x8000) {
+ lower_bound = (int32)(int16)lower_bound;
+ upper_bound = (int32)(int16)upper_bound;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
+ if(!BIT_F(word2))
+ compare = (int32)(int16)compare;
+ }
+
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15]&0xffff;
+ sint compare = REG_DA[(word2 >> 12) & 15];
+ if(!BIT_F(word2))
+ compare &= 0xffff;
+
uint ea = M68KMAKE_GET_EA_AY_16;
sint lower_bound = (int16)m68ki_read_16(ea);
sint upper_bound = (int16)m68ki_read_16(ea + 2);
- if(!BIT_F(word2))
- compare = (int32)(int16)compare;
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x8000) {
+ lower_bound = (int32)(int16)lower_bound;
+ upper_bound = (int32)(int16)upper_bound;
+
+ if(!BIT_F(word2))
+ compare = (int32)(int16)compare;
+ }
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
- uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15];
- uint ea = EA_PCDI_32();
- sint lower_bound = m68ki_read_pcrel_32(ea);
- sint upper_bound = m68ki_read_pcrel_32(ea + 4);
+ uint32 word2 = OPER_I_16();
+ sint64 compare = REG_DA[(word2 >> 12) & 15];
+ uint32 ea = EA_PCDI_32();
+ sint64 lower_bound = m68ki_read_pcrel_32(ea);
+ sint64 upper_bound = m68ki_read_pcrel_32(ea + 4);
+
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x80000000) {
+ lower_bound = (int64)(int32)lower_bound;
+ upper_bound = (int64)(int32)upper_bound;
+ compare = (int64)(int32)compare;
+ }
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
-
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
return;
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
- uint word2 = OPER_I_16();
- sint compare = REG_DA[(word2 >> 12) & 15];
- uint ea = EA_PCIX_32();
- sint lower_bound = m68ki_read_32(ea);
- sint upper_bound = m68ki_read_32(ea + 4);
+ uint32 word2 = OPER_I_16();
+ sint64 compare = REG_DA[(word2 >> 12) & 15];
+ uint32 ea = EA_PCIX_32();
+ sint64 lower_bound = m68ki_read_32(ea);
+ sint64 upper_bound = m68ki_read_32(ea + 4);
+
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x80000000) {
+ lower_bound = (int64)(int32)lower_bound;
+ upper_bound = (int64)(int32)upper_bound;
+ compare = (int64)(int32)compare;
+ }
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
-
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
return;
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
- uint word2 = OPER_I_16();
- // JFF changed the logic. chk2/cmp2 uses signed values, not unsigned
- sint compare = REG_DA[(word2 >> 12) & 15];
- uint ea = M68KMAKE_GET_EA_AY_32;
- sint lower_bound = m68ki_read_32(ea);
- sint upper_bound = m68ki_read_32(ea + 4);
+ uint32 word2 = OPER_I_16();
+ sint64 compare = REG_DA[(word2 >> 12) & 15];
+ uint32 ea = M68KMAKE_GET_EA_AY_32;
+ sint64 lower_bound = m68ki_read_32(ea);
+ sint64 upper_bound = m68ki_read_32(ea + 4);
+
+ // for signed compare, the arithmetically smaller value is the lower bound
+ if (lower_bound & 0x80000000) {
+ lower_bound = (int64)(int32)lower_bound;
+ upper_bound = (int64)(int32)upper_bound;
+ compare = (int64)(int32)compare;
+ }
- FLAG_Z = !((upper_bound==compare) || (lower_bound==compare)); // JFF: | => ||
+ FLAG_C = (compare >= lower_bound && compare <= upper_bound) ? CFLAG_CLEAR : CFLAG_SET;
+ FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
- FLAG_C = (lower_bound <= upper_bound ? compare < lower_bound || compare > upper_bound : compare > upper_bound || compare < lower_bound) << 8;
-
if(COND_CS() && BIT_B(word2))
m68ki_exception_trap(EXCEPTION_CHK);
return;
M68KMAKE_OP(clr, 8, ., .)
{
- m68ki_write_8(M68KMAKE_GET_EA_AY_8, 0);
+ uint32 ea = M68KMAKE_GET_EA_AY_8;
+
+ if(CPU_TYPE_IS_000(CPU_TYPE))
+ m68ki_read_8(ea); /* the 68000 does a dummy read, the value is discarded */
+ m68ki_write_8(ea, 0);
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
M68KMAKE_OP(clr, 16, ., .)
{
- m68ki_write_16(M68KMAKE_GET_EA_AY_16, 0);
+ uint32 ea = M68KMAKE_GET_EA_AY_16;
+
+ if(CPU_TYPE_IS_000(CPU_TYPE))
+ m68ki_read_16(ea); /* the 68000 does a dummy read, the value is discarded */
+ m68ki_write_16(ea, 0);
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
M68KMAKE_OP(clr, 32, ., .)
{
- m68ki_write_32(M68KMAKE_GET_EA_AY_32, 0);
+ uint32 ea = M68KMAKE_GET_EA_AY_32;
+
+ if(CPU_TYPE_IS_000(CPU_TYPE))
+ m68ki_read_32(ea); /* the 68000 does a dummy read, the value is discarded */
+ m68ki_write_32(ea, 0);
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
{
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
m68ki_exception_1111();
{
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
m68ki_exception_1111();
M68KMAKE_OP(cpgen, 32, ., .)
{
+// TODO: what's the condition?
+// if(HAS_FPU || HAS_PMMU)
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
m68ki_exception_1111();
{
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
m68ki_exception_1111();
{
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
// JFF: unsupported, but at least if the trap doesn't occur, app should still work, so at least PC increase is correct
REG_PC += 4;
return;
if(src != 0)
{
+ FLAG_C = CFLAG_CLEAR;
if((uint32)*r_dst == 0x80000000 && src == -1)
{
FLAG_Z = 0;
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
- FLAG_C = CFLAG_CLEAR;
*r_dst = 0;
return;
}
FLAG_Z = quotient;
FLAG_N = NFLAG_16(quotient);
FLAG_V = VFLAG_CLEAR;
- FLAG_C = CFLAG_CLEAR;
*r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16));
return;
}
if(src != 0)
{
+ FLAG_C = CFLAG_CLEAR;
if((uint32)*r_dst == 0x80000000 && src == -1)
{
FLAG_Z = 0;
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
- FLAG_C = CFLAG_CLEAR;
*r_dst = 0;
return;
}
FLAG_Z = quotient;
FLAG_N = NFLAG_16(quotient);
FLAG_V = VFLAG_CLEAR;
- FLAG_C = CFLAG_CLEAR;
*r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16));
return;
}
if(src != 0)
{
+ FLAG_C = CFLAG_CLEAR;
uint quotient = *r_dst / src;
uint remainder = *r_dst % src;
FLAG_Z = quotient;
FLAG_N = NFLAG_16(quotient);
FLAG_V = VFLAG_CLEAR;
- FLAG_C = CFLAG_CLEAR;
*r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16));
return;
}
if(src != 0)
{
+ FLAG_C = CFLAG_CLEAR;
uint quotient = *r_dst / src;
uint remainder = *r_dst % src;
FLAG_Z = quotient;
FLAG_N = NFLAG_16(quotient);
FLAG_V = VFLAG_CLEAR;
- FLAG_C = CFLAG_CLEAR;
*r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16));
return;
}
{
m68ki_jump(M68KMAKE_GET_EA_AY_32);
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- if(REG_PC == REG_PPC)
- USE_ALL_CYCLES();
}
/* 68030 can write all bits except 5-7, 040 can write all */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
{
- REG_CACR = REG_DA[(word2 >> 12) & 15];
+ REG_CACR = REG_DA[(word2 >> 12) & 15] & 0xfffffffe; // Old I cache bit not working on 040
}
else if (CPU_TYPE_IS_030_PLUS(CPU_TYPE))
{
{
REG_CACR = REG_DA[(word2 >> 12) & 15] & 0x0f;
}
+
+ if (REG_CACR & (M68K_CACR_CI | M68K_CACR_CEI)) {
+ m68ki_ic_clear();
+ }
return;
}
m68ki_exception_illegal();
M68KMAKE_OP(nbcd, 8, ., d)
{
uint* r_dst = &DY;
- uint dst = *r_dst;
- uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1());
+ uint dst = MASK_OUT_ABOVE_8(*r_dst);
+ uint res = - dst - XFLAG_AS_1();
- if(res != 0x9a)
+ if(res != 0)
{
- FLAG_V = ~res; /* Undefined V behavior */
+ FLAG_V = res; /* Undefined V behavior */
- if((res & 0x0f) == 0xa)
- res = (res & 0xf0) + 0x10;
+ if(((res|dst) & 0x0f) == 0)
+ res = (res & 0xf0) + 6;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res + 0x9a);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
*r_dst = MASK_OUT_BELOW_8(*r_dst) | res;
{
uint ea = M68KMAKE_GET_EA_AY_8;
uint dst = m68ki_read_8(ea);
- uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1());
+ uint res = - dst - XFLAG_AS_1();
- if(res != 0x9a)
+ if(res != 0)
{
- FLAG_V = ~res; /* Undefined V behavior */
+ FLAG_V = res; /* Undefined V behavior */
- if((res & 0x0f) == 0xa)
- res = (res & 0xf0) + 0x10;
+ if(((res|dst) & 0x0f) == 0)
+ res = (res & 0xf0) + 6;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res + 0x9a);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
m68ki_write_8(ea, MASK_OUT_ABOVE_8(res));
ea_src = EA_AY_PD_8();
src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16();
- m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
+ m68ki_write_8(EA_A7_PD_8(), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0));
return;
}
m68ki_exception_illegal();
uint ea_src = EA_A7_PD_8();
uint src = m68ki_read_8(ea_src);
ea_src = EA_A7_PD_8();
- src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16();
+ src = (src | (m68ki_read_8(ea_src) << 8)) + OPER_I_16();
m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
return;
uint ea_src = EA_A7_PD_8();
uint src = m68ki_read_8(ea_src);
ea_src = EA_A7_PD_8();
- src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16();
+ src = (src | (m68ki_read_8(ea_src) << 8)) + OPER_I_16();
m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
return;
uint ea_src = EA_AY_PD_8();
uint src = m68ki_read_8(ea_src);
ea_src = EA_AY_PD_8();
- src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16();
+ src = (src | (m68ki_read_8(ea_src) << 8)) + OPER_I_16();
m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
return;
new_sr = m68ki_pull_16();
new_pc = m68ki_pull_32();
m68ki_fake_pull_16(); /* format word */
- m68ki_fake_pull_16(); /* special status word */
+ m68ki_jump(new_pc);
+ m68ki_set_sr(new_sr);
+ CPU_INSTR_MODE = INSTRUCTION_YES;
+ CPU_RUN_MODE = RUN_MODE_NORMAL;
+ m68ki_fake_pull_16(); /* special status */
m68ki_fake_pull_32(); /* fault address */
- m68ki_fake_pull_16(); /* unused/reserved */
- m68ki_fake_pull_16(); /* data output buffer */
- m68ki_fake_pull_16(); /* unused/reserved */
- m68ki_fake_pull_16(); /* data input buffer */
- m68ki_fake_pull_16(); /* unused/reserved */
- m68ki_fake_pull_16(); /* instruction input buffer */
- m68ki_fake_pull_32(); /* internal information, 16 words */
- m68ki_fake_pull_32(); /* (actually, we use 8 DWORDs) */
+ m68ki_fake_pull_32(); /* reserved and data output buffer */
+ m68ki_fake_pull_32(); /* reserved and data input buffer */
+ m68ki_fake_pull_32(); /* reserved and instruction input buffer */
+ m68ki_fake_pull_32(); /* 8 dwords of CPU specific undocumented data */
+ m68ki_fake_pull_32();
m68ki_fake_pull_32();
m68ki_fake_pull_32();
m68ki_fake_pull_32();
m68ki_fake_pull_32();
m68ki_fake_pull_32();
m68ki_fake_pull_32();
- m68ki_jump(new_pc);
- m68ki_set_sr(new_sr);
- CPU_INSTR_MODE = INSTRUCTION_YES;
- CPU_RUN_MODE = RUN_MODE_NORMAL;
return;
}
CPU_INSTR_MODE = INSTRUCTION_YES;
new_pc = m68ki_pull_32();
m68ki_fake_pull_16(); /* format word */
m68ki_fake_pull_32(); /* address */
+ m68ki_jump(new_pc);
+ m68ki_set_sr(new_sr);
+ CPU_INSTR_MODE = INSTRUCTION_YES;
+ CPU_RUN_MODE = RUN_MODE_NORMAL;
+ return;
+ case 7: /* 68040 access error */
+ new_sr = m68ki_pull_16();
+ new_pc = m68ki_pull_32();
+ m68ki_fake_pull_16(); /* $06: format word */
+ m68ki_fake_pull_32(); /* $08: effective address */
+ m68ki_fake_pull_16(); /* $0c: special status word */
+ m68ki_fake_pull_16(); /* $0e: wb3s */
+ m68ki_fake_pull_16(); /* $10: wb2s */
+ m68ki_fake_pull_16(); /* $12: wb1s */
+ m68ki_fake_pull_32(); /* $14: data fault address */
+ m68ki_fake_pull_32(); /* $18: wb3a */
+ m68ki_fake_pull_32(); /* $1c: wb3d */
+ m68ki_fake_pull_32(); /* $20: wb2a */
+ m68ki_fake_pull_32(); /* $24: wb2d */
+ m68ki_fake_pull_32(); /* $28: wb1a */
+ m68ki_fake_pull_32(); /* $2c: wb1d/pd0 */
+ m68ki_fake_pull_32(); /* $30: pd1 */
+ m68ki_fake_pull_32(); /* $34: pd2 */
+ m68ki_fake_pull_32(); /* $38: pd3 */
+ m68ki_jump(new_pc);
+ m68ki_set_sr(new_sr);
+ CPU_INSTR_MODE = INSTRUCTION_YES;
+ CPU_RUN_MODE = RUN_MODE_NORMAL;
+ return;
+
+ case 0x0a: /* Bus Error at instruction boundary */
+ new_sr = m68ki_pull_16();
+ new_pc = m68ki_pull_32();
+ m68ki_fake_pull_16(); /* $06: format word */
+ m68ki_fake_pull_16(); /* $08: internal register */
+ m68ki_fake_pull_16(); /* $0a: special status word */
+ m68ki_fake_pull_16(); /* $0c: instruction pipe stage c */
+ m68ki_fake_pull_16(); /* $0e: instruction pipe stage b */
+ m68ki_fake_pull_32(); /* $10: data fault address */
+ m68ki_fake_pull_32(); /* $14: internal registers */
+ m68ki_fake_pull_32(); /* $18: data output buffer */
+ m68ki_fake_pull_32(); /* $1c: internal registers */
+
+ m68ki_jump(new_pc);
+ m68ki_set_sr(new_sr);
+ CPU_INSTR_MODE = INSTRUCTION_YES;
+ CPU_RUN_MODE = RUN_MODE_NORMAL;
+ return;
+
+ case 0x0b: /* Bus Error - Instruction Execution in Progress */
+ new_sr = m68ki_pull_16();
+ new_pc = m68ki_pull_32();
+ m68ki_fake_pull_16(); /* $06: format word */
+ m68ki_fake_pull_16(); /* $08: internal register */
+ m68ki_fake_pull_16(); /* $0a: special status word */
+ m68ki_fake_pull_16(); /* $0c: instruction pipe stage c */
+ m68ki_fake_pull_16(); /* $0e: instruction pipe stage b */
+ m68ki_fake_pull_32(); /* $10: data fault address */
+ m68ki_fake_pull_32(); /* $14: internal registers */
+ m68ki_fake_pull_32(); /* $18: data output buffer */
+ m68ki_fake_pull_32(); /* $1c: internal registers */
+ m68ki_fake_pull_32(); /* $20: */
+ m68ki_fake_pull_32(); /* $24: stage B address */
+ m68ki_fake_pull_32(); /* $28: */
+ m68ki_fake_pull_32(); /* $2c: data input buffer */
+ m68ki_fake_pull_32(); /* $30: */
+ m68ki_fake_pull_16(); /* $34: */
+ m68ki_fake_pull_16(); /* $36: version #, internal information */
+ m68ki_fake_pull_32(); /* $38: */
+ m68ki_fake_pull_32(); /* $3c: */
+ m68ki_fake_pull_32(); /* $40: */
+ m68ki_fake_pull_32(); /* $44: */
+ m68ki_fake_pull_32(); /* $48: */
+ m68ki_fake_pull_32(); /* $4c: */
+ m68ki_fake_pull_32(); /* $50: */
+ m68ki_fake_pull_32(); /* $54: */
+ m68ki_fake_pull_32(); /* $58: */
+
m68ki_jump(new_pc);
m68ki_set_sr(new_sr);
CPU_INSTR_MODE = INSTRUCTION_YES;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR,
- m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2))));
+ m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
m68ki_exception_illegal();
uint src = DY;
uint dst = *r_dst;
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
+ uint corf = 0;
- FLAG_V = ~res; /* Undefined V behavior */
-
- if(res > 9)
- res -= 6;
+ if(res > 0xf)
+ corf = 6;
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
- if(FLAG_C)
+ FLAG_V = res; /* Undefined V behavior */
+ if(res > 0xff) {
res += 0xa0;
+ FLAG_X = FLAG_C = CFLAG_SET;
+ } else if(res < corf)
+ FLAG_X = FLAG_C = CFLAG_SET;
+ else
+ FLAG_N = FLAG_X = FLAG_C = 0;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res - corf);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
uint ea = EA_A7_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
+ uint corf = 0;
- FLAG_V = ~res; /* Undefined V behavior */
-
- if(res > 9)
- res -= 6;
+ if(res > 0xf)
+ corf = 6;
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
- if(FLAG_C)
+ FLAG_V = res; /* Undefined V behavior */
+ if(res > 0xff) {
res += 0xa0;
+ FLAG_X = FLAG_C = CFLAG_SET;
+ } else if(res < corf)
+ FLAG_X = FLAG_C = CFLAG_SET;
+ else
+ FLAG_N = FLAG_X = FLAG_C = 0;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res - corf);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
uint ea = EA_AX_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
+ uint corf = 0;
- FLAG_V = ~res; /* Undefined V behavior */
-
- if(res > 9)
- res -= 6;
+ if(res > 0xf)
+ corf = 6;
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
- if(FLAG_C)
+ FLAG_V = res; /* Undefined V behavior */
+ if(res > 0xff) {
res += 0xa0;
+ FLAG_X = FLAG_C = CFLAG_SET;
+ } else if(res < corf)
+ FLAG_X = FLAG_C = CFLAG_SET;
+ else
+ FLAG_N = FLAG_X = FLAG_C = 0;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res - corf);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
uint ea = EA_A7_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
+ uint corf = 0;
- FLAG_V = ~res; /* Undefined V behavior */
-
- if(res > 9)
- res -= 6;
+ if(res > 0xf)
+ corf = 6;
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
- if(FLAG_C)
+ FLAG_V = res; /* Undefined V behavior */
+ if(res > 0xff) {
res += 0xa0;
+ FLAG_X = FLAG_C = CFLAG_SET;
+ } else if(res < corf)
+ FLAG_X = FLAG_C = CFLAG_SET;
+ else
+ FLAG_N = FLAG_X = FLAG_C = 0;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res - corf);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
uint ea = EA_AX_PD_8();
uint dst = m68ki_read_8(ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
+ uint corf = 0;
- FLAG_V = ~res; /* Undefined V behavior */
-
- if(res > 9)
- res -= 6;
+ if(res > 0xf)
+ corf = 6;
res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src);
- FLAG_X = FLAG_C = (res > 0x99) << 8;
- if(FLAG_C)
+ FLAG_V = res; /* Undefined V behavior */
+ if(res > 0xff) {
res += 0xa0;
+ FLAG_X = FLAG_C = CFLAG_SET;
+ } else if(res < corf)
+ FLAG_X = FLAG_C = CFLAG_SET;
+ else
+ FLAG_N = FLAG_X = FLAG_C = 0;
- res = MASK_OUT_ABOVE_8(res);
+ res = MASK_OUT_ABOVE_8(res - corf);
- FLAG_V &= res; /* Undefined V behavior part II */
+ FLAG_V &= ~res; /* Undefined V behavior part II */
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
+ // TODO: review this... as mame is not using it...
REG_PC += 2; // JFF else stackframe & return addresses are incorrect
m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
return;
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
+ // TODO: review this... as mame is not using it...
REG_PC += 4; // JFF else stackframe & return addresses are incorrect
m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
return;
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
+ // TODO: review this... as mame is not using it...
REG_PC += 2; /* JFF increase before or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */
if(M68KMAKE_CC)
{
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
+ // TODO: review this... as mame is not using it...
REG_PC += 4; /* JFF increase before or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */
if(M68KMAKE_CC)
{
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16();
ea_dst = EA_A7_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
- ea_dst = EA_A7_PD_8();
m68ki_write_8(ea_dst, src & 0xff);
+ ea_dst = EA_A7_PD_8();
+ m68ki_write_8(ea_dst, (src >> 8) & 0xff);
return;
}
m68ki_exception_illegal();
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16();
ea_dst = EA_AX_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
- ea_dst = EA_AX_PD_8();
m68ki_write_8(ea_dst, src & 0xff);
+ ea_dst = EA_AX_PD_8();
+ m68ki_write_8(ea_dst, (src >> 8) & 0xff);
return;
}
m68ki_exception_illegal();
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16();
ea_dst = EA_A7_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
- ea_dst = EA_A7_PD_8();
m68ki_write_8(ea_dst, src & 0xff);
+ ea_dst = EA_A7_PD_8();
+ m68ki_write_8(ea_dst, (src >> 8) & 0xff);
return;
}
m68ki_exception_illegal();
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16();
ea_dst = EA_AX_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
- ea_dst = EA_AX_PD_8();
m68ki_write_8(ea_dst, src & 0xff);
+ ea_dst = EA_AX_PD_8();
+ m68ki_write_8(ea_dst, (src >> 8) & 0xff);
return;
}
m68ki_exception_illegal();