M68KMAKE_OP(1010, 0, ., .)
{
- m68ki_exception_1010();
+ m68ki_exception_1010(state);
}
M68KMAKE_OP(1111, 0, ., .)
{
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
// printf("FPU 040fpu0 HAS_FPU=%d\n",!!HAS_FPU);
if(HAS_FPU)
{
- void m68040_fpu_op0(m68ki_cpu_core *state);
+ m68040_fpu_op0(state);
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
// printf("FPU 040fpu1 HAS_FPU=%d\n",!!HAS_FPU);
if(HAS_FPU)
{
- void m68040_fpu_op1(m68ki_cpu_core *state);
+ m68040_fpu_op1(state);
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
uint corf = 0;
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
uint corf = 0;
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
uint corf = 0;
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1();
uint corf = 0;
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint ea = M68KMAKE_GET_EA_AY_8;
uint src = MASK_OUT_ABOVE_8(DX);
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_8(res);
FLAG_X = FLAG_C = CFLAG_8(res);
FLAG_Z = MASK_OUT_ABOVE_8(res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
{
uint ea = M68KMAKE_GET_EA_AY_16;
uint src = MASK_OUT_ABOVE_16(DX);
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_16(res);
FLAG_X = FLAG_C = CFLAG_16(res);
FLAG_Z = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
{
uint ea = M68KMAKE_GET_EA_AY_32;
uint src = DX;
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_32(res);
FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res);
FLAG_Z = MASK_OUT_ABOVE_32(res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
{
uint src = OPER_I_8(state);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_8(res);
FLAG_X = FLAG_C = CFLAG_8(res);
FLAG_Z = MASK_OUT_ABOVE_8(res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
{
uint src = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_16;
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_16(res);
FLAG_X = FLAG_C = CFLAG_16(res);
FLAG_Z = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
{
uint src = OPER_I_32(state);
uint ea = M68KMAKE_GET_EA_AY_32;
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_32(res);
FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res);
FLAG_Z = MASK_OUT_ABOVE_32(res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
{
uint src = (((REG_IR >> 9) - 1) & 7) + 1;
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_8(res);
FLAG_X = FLAG_C = CFLAG_8(res);
FLAG_Z = MASK_OUT_ABOVE_8(res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
{
uint src = (((REG_IR >> 9) - 1) & 7) + 1;
uint ea = M68KMAKE_GET_EA_AY_16;
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = src + dst;
FLAG_N = NFLAG_16(res);
FLAG_X = FLAG_C = CFLAG_16(res);
FLAG_Z = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
{
uint src = (((REG_IR >> 9) - 1) & 7) + 1;
uint ea = M68KMAKE_GET_EA_AY_32;
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = src + dst;
FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res);
FLAG_Z = MASK_OUT_ABOVE_32(res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst + XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst + XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst + XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = src + dst + XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_AY_PD_16(state);
uint ea = EA_AX_PD_16();
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = src + dst + XFLAG_AS_1();
FLAG_N = NFLAG_16(res);
res = MASK_OUT_ABOVE_16(res);
FLAG_Z |= res;
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
}
{
uint src = OPER_AY_PD_32(state);
uint ea = EA_AX_PD_32();
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = src + dst + XFLAG_AS_1();
FLAG_N = NFLAG_32(res);
res = MASK_OUT_ABOVE_32(res);
FLAG_Z |= res;
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
}
M68KMAKE_OP(and, 8, re, .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = DX & m68ki_read_8(ea);
+ uint res = DX & m68ki_read_8(state, ea);
FLAG_N = NFLAG_8(res);
FLAG_C = CFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
FLAG_Z = MASK_OUT_ABOVE_8(res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
M68KMAKE_OP(and, 16, re, .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = DX & m68ki_read_16(ea);
+ uint res = DX & m68ki_read_16(state, ea);
FLAG_N = NFLAG_16(res);
FLAG_C = CFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
FLAG_Z = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
M68KMAKE_OP(and, 32, re, .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = DX & m68ki_read_32(ea);
+ uint res = DX & m68ki_read_32(state, ea);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
FLAG_C = CFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
}
{
uint src = OPER_I_8(state);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = src & m68ki_read_8(ea);
+ uint res = src & m68ki_read_8(state, ea);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
FLAG_C = CFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = src & m68ki_read_16(ea);
+ uint res = src & m68ki_read_16(state, ea);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
FLAG_C = CFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
}
{
uint src = OPER_I_32(state);
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = src & m68ki_read_32(ea);
+ uint res = src & m68ki_read_32(state, ea);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
FLAG_C = CFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
}
m68ki_set_sr(state, m68ki_get_sr() & src);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
M68KMAKE_OP(asr, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = src >> 1;
if(GET_MSB_16(src))
res |= 0x8000;
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(asl, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = MASK_OUT_ABOVE_16(src << 1);
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(bchg, 8, r, .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
uint mask = 1 << (DX & 7);
FLAG_Z = src & mask;
- m68ki_write_8(ea, src ^ mask);
+ m68ki_write_8(state, ea, src ^ mask);
}
{
uint mask = 1 << (OPER_I_8(state) & 7);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
FLAG_Z = src & mask;
- m68ki_write_8(ea, src ^ mask);
+ m68ki_write_8(state, ea, src ^ mask);
}
M68KMAKE_OP(bclr, 8, r, .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
uint mask = 1 << (DX & 7);
FLAG_Z = src & mask;
- m68ki_write_8(ea, src & ~mask);
+ m68ki_write_8(state, ea, src & ~mask);
}
{
uint mask = 1 << (OPER_I_8(state) & 7);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
FLAG_Z = src & mask;
- m68ki_write_8(ea, src & ~mask);
+ m68ki_write_8(state, ea, src & ~mask);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width));
mask_long = mask_base >> offset;
- data_long = m68ki_read_32(ea);
+ data_long = m68ki_read_32(state, ea);
FLAG_N = NFLAG_32(data_long << offset);
FLAG_Z = data_long & mask_long;
FLAG_V = VFLAG_CLEAR;
FLAG_C = CFLAG_CLEAR;
- m68ki_write_32(ea, data_long ^ mask_long);
+ m68ki_write_32(state, ea, data_long ^ mask_long);
if((width + offset) > 32)
{
mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset);
- data_byte = m68ki_read_8(ea+4);
+ data_byte = m68ki_read_8(state, ea+4);
FLAG_Z |= (data_byte & mask_byte);
- m68ki_write_8(ea+4, data_byte ^ mask_byte);
+ m68ki_write_8(state, ea+4, data_byte ^ mask_byte);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width));
mask_long = mask_base >> offset;
- data_long = m68ki_read_32(ea);
+ data_long = m68ki_read_32(state, ea);
FLAG_N = NFLAG_32(data_long << offset);
FLAG_Z = data_long & mask_long;
FLAG_V = VFLAG_CLEAR;
FLAG_C = CFLAG_CLEAR;
- m68ki_write_32(ea, data_long & ~mask_long);
+ m68ki_write_32(state, ea, data_long & ~mask_long);
if((width + offset) > 32)
{
mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset);
- data_byte = m68ki_read_8(ea+4);
+ data_byte = m68ki_read_8(state, ea+4);
FLAG_Z |= (data_byte & mask_byte);
- m68ki_write_8(ea+4, data_byte & ~mask_byte);
+ m68ki_write_8(state, ea+4, data_byte & ~mask_byte);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
}
width = ((width-1) & 31) + 1;
- data = (offset+width) < 8 ? (m68ki_read_8(ea) << 24) :
- (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
+ data = (offset+width) < 8 ? (m68ki_read_8(state, ea) << 24) :
+ (offset+width) < 16 ? (m68ki_read_16(state, ea) << 16) : m68ki_read_32(state, ea);
data = MASK_OUT_ABOVE_32(data<<offset);
if((offset+width) > 32)
- data |= (m68ki_read_8(ea+4) << offset) >> 8;
+ data |= (m68ki_read_8(state, ea+4) << offset) >> 8;
FLAG_N = NFLAG_32(data);
data = MAKE_INT_32(data) >> (32 - width);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
}
width = ((width-1) & 31) + 1;
- data = (offset+width) < 8 ? (m68ki_read_8(ea) << 24) :
- (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
+ data = (offset+width) < 8 ? (m68ki_read_8(state, ea) << 24) :
+ (offset+width) < 16 ? (m68ki_read_16(state, ea) << 16) : m68ki_read_32(state, ea);
data = MASK_OUT_ABOVE_32(data<<offset);
if((offset+width) > 32)
- data |= (m68ki_read_8(ea+4) << offset) >> 8;
+ data |= (m68ki_read_8(state, ea+4) << offset) >> 8;
FLAG_N = NFLAG_32(data);
data >>= (32 - width);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
}
width = ((width-1) & 31) + 1;
- data = (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
+ data = (offset+width) < 16 ? (m68ki_read_16(state, ea) << 16) : m68ki_read_32(state, ea);
data = MASK_OUT_ABOVE_32(data<<local_offset);
if((local_offset+width) > 32)
- data |= (m68ki_read_8(ea+4) << local_offset) >> 8;
+ data |= (m68ki_read_8(state, ea+4) << local_offset) >> 8;
FLAG_N = NFLAG_32(data);
data >>= (32 - width);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_Z = insert_base;
insert_long = insert_base >> offset;
- data_long = (offset+width) < 8 ? (m68ki_read_8(ea) << 24) :
- (offset+width) < 16 ? (m68ki_read_16(ea) << 16) : m68ki_read_32(ea);
+ data_long = (offset+width) < 8 ? (m68ki_read_8(state, ea) << 24) :
+ (offset+width) < 16 ? (m68ki_read_16(state, ea) << 16) : m68ki_read_32(state, ea);
FLAG_V = VFLAG_CLEAR;
FLAG_C = CFLAG_CLEAR;
if((width + offset) < 8) {
- m68ki_write_8(ea, ((data_long & ~mask_long) | insert_long) >> 24);
+ m68ki_write_8(state, ea, ((data_long & ~mask_long) | insert_long) >> 24);
} else if((width + offset) < 16) {
- m68ki_write_16(ea, ((data_long & ~mask_long) | insert_long) >> 16);
+ m68ki_write_16(state, ea, ((data_long & ~mask_long) | insert_long) >> 16);
} else {
- m68ki_write_32(ea, (data_long & ~mask_long) | insert_long);
+ m68ki_write_32(state, ea, (data_long & ~mask_long) | insert_long);
}
if((width + offset) > 32)
{
mask_byte = MASK_OUT_ABOVE_8(mask_base);
insert_byte = MASK_OUT_ABOVE_8(insert_base);
- data_byte = m68ki_read_8(ea+4);
+ data_byte = m68ki_read_8(state, ea+4);
FLAG_Z |= (data_byte & mask_byte);
- m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte);
+ m68ki_write_8(state, ea+4, (data_byte & ~mask_byte) | insert_byte);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width));
mask_long = mask_base >> offset;
- data_long = m68ki_read_32(ea);
+ data_long = m68ki_read_32(state, ea);
FLAG_N = NFLAG_32(data_long << offset);
FLAG_Z = data_long & mask_long;
FLAG_V = VFLAG_CLEAR;
FLAG_C = CFLAG_CLEAR;
- m68ki_write_32(ea, data_long | mask_long);
+ m68ki_write_32(state, ea, data_long | mask_long);
if((width + offset) > 32)
{
mask_byte = MASK_OUT_ABOVE_8(mask_base);
- data_byte = m68ki_read_8(ea+4);
+ data_byte = m68ki_read_8(state, ea+4);
FLAG_Z |= (data_byte & mask_byte);
- m68ki_write_8(ea+4, data_byte | mask_byte);
+ m68ki_write_8(state, ea+4, data_byte | mask_byte);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width));
mask_long = mask_base >> offset;
- data_long = m68ki_read_32(ea);
+ data_long = m68ki_read_32(state, ea);
FLAG_N = ((data_long & (0x80000000 >> offset))<<offset)>>24;
FLAG_Z = data_long & mask_long;
FLAG_V = VFLAG_CLEAR;
if((width + offset) > 32)
{
mask_byte = MASK_OUT_ABOVE_8(mask_base);
- data_byte = m68ki_read_8(ea+4);
+ data_byte = m68ki_read_8(state, ea+4);
FLAG_Z |= (data_byte & mask_byte);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
m68ki_bkpt_ack(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE) ? REG_IR & 7 : 0); /* auto-disable (see m68kcpu.h) */
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
else
{
// TODO: review this...
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
// m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
// m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
// if(REG_PC == REG_PPC)
M68KMAKE_OP(bset, 8, r, .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
uint mask = 1 << (DX & 7);
FLAG_Z = src & mask;
- m68ki_write_8(ea, src | mask);
+ m68ki_write_8(state, ea, src | mask);
}
{
uint mask = 1 << (OPER_I_8(state) & 7);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
FLAG_Z = src & mask;
- m68ki_write_8(ea, src | mask);
+ m68ki_write_8(state, ea, src | mask);
}
M68KMAKE_OP(bsr, 8, ., .)
{
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_push_32(REG_PC);
+ m68ki_push_32(state, REG_PC);
m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
}
{
uint offset = OPER_I_16(state);
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_push_32(REG_PC);
+ m68ki_push_32(state, REG_PC);
REG_PC -= 2;
m68ki_branch_16(offset);
}
{
uint offset = OPER_I_32(state);
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_push_32(REG_PC);
+ m68ki_push_32(state, REG_PC);
REG_PC -= 4;
m68ki_branch_32(offset);
return;
else
{
// TODO: review this...
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
// m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
-// m68ki_push_32(REG_PC);
+// m68ki_push_32(state, REG_PC);
// m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR));
}
}
m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
uint word2 = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dest = m68ki_read_8(ea);
+ uint dest = m68ki_read_8(state, ea);
uint* compare = ®_D[word2 & 7];
uint res = dest - MASK_OUT_ABOVE_8(*compare);
else
{
USE_CYCLES(3);
- m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7]));
+ m68ki_write_8(state, ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7]));
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
uint word2 = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_16;
- uint dest = m68ki_read_16(ea);
+ uint dest = m68ki_read_16(state, ea);
uint* compare = ®_D[word2 & 7];
uint res = dest - MASK_OUT_ABOVE_16(*compare);
else
{
USE_CYCLES(3);
- m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7]));
+ m68ki_write_16(state, ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7]));
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
uint word2 = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_32;
- uint dest = m68ki_read_32(ea);
+ uint dest = m68ki_read_32(state, ea);
uint* compare = ®_D[word2 & 7];
uint res = dest - *compare;
else
{
USE_CYCLES(3);
- m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]);
+ m68ki_write_32(state, ea, REG_D[(word2 >> 6) & 7]);
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
uint word2 = OPER_I_32(state);
uint* compare1 = ®_D[(word2 >> 16) & 7];
uint ea1 = REG_DA[(word2 >> 28) & 15];
- uint dest1 = m68ki_read_16(ea1);
+ uint dest1 = m68ki_read_16(state, ea1);
uint res1 = dest1 - MASK_OUT_ABOVE_16(*compare1);
uint* compare2 = ®_D[word2 & 7];
uint ea2 = REG_DA[(word2 >> 12) & 15];
- uint dest2 = m68ki_read_16(ea2);
+ uint dest2 = m68ki_read_16(state, ea2);
uint res2;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
if(COND_EQ())
{
USE_CYCLES(3);
- m68ki_write_16(ea1, REG_D[(word2 >> 22) & 7]);
- m68ki_write_16(ea2, REG_D[(word2 >> 6) & 7]);
+ m68ki_write_16(state, ea1, REG_D[(word2 >> 22) & 7]);
+ m68ki_write_16(state, ea2, REG_D[(word2 >> 6) & 7]);
return;
}
}
*compare2 = BIT_F(word2) ? (uint)MAKE_INT_16(dest2) : MASK_OUT_BELOW_16(*compare2) | dest2;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
uint word2 = OPER_I_32(state);
uint* compare1 = ®_D[(word2 >> 16) & 7];
uint ea1 = REG_DA[(word2 >> 28) & 15];
- uint dest1 = m68ki_read_32(ea1);
+ uint dest1 = m68ki_read_32(state, ea1);
uint res1 = dest1 - *compare1;
uint* compare2 = ®_D[word2 & 7];
uint ea2 = REG_DA[(word2 >> 12) & 15];
- uint dest2 = m68ki_read_32(ea2);
+ uint dest2 = m68ki_read_32(state, ea2);
uint res2;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
if(COND_EQ())
{
USE_CYCLES(3);
- m68ki_write_32(ea1, REG_D[(word2 >> 22) & 7]);
- m68ki_write_32(ea2, REG_D[(word2 >> 6) & 7]);
+ m68ki_write_32(state, ea1, REG_D[(word2 >> 22) & 7]);
+ m68ki_write_32(state, ea2, REG_D[(word2 >> 6) & 7]);
return;
}
}
*compare2 = dest2;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
FLAG_N = (src < 0)<<7;
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
}
return;
}
FLAG_N = (src < 0)<<7;
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
}
return;
}
FLAG_N = (src < 0)<<7;
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
return;
}
FLAG_N = (src < 0)<<7;
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
compare &= 0xff;
uint ea = EA_PCDI_8();
- sint lower_bound = m68ki_read_pcrel_8(ea);
- sint upper_bound = m68ki_read_pcrel_8(ea + 1);
+ sint lower_bound = m68ki_read_pcrel_8(state, ea);
+ sint upper_bound = m68ki_read_pcrel_8(state, ea + 1);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x80) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
compare &= 0xff;
uint ea = EA_PCIX_8();
- sint lower_bound = m68ki_read_pcrel_8(ea);
- sint upper_bound = m68ki_read_pcrel_8(ea + 1);
+ sint lower_bound = m68ki_read_pcrel_8(state, ea);
+ sint upper_bound = m68ki_read_pcrel_8(state, ea + 1);
if (lower_bound & 0x80) {
lower_bound = (int32)(int8)lower_bound;
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
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);
+ sint lower_bound = (int8)m68ki_read_8(state, ea);
+ sint upper_bound = (int8)m68ki_read_8(state, ea + 1);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x80) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
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);
+ sint lower_bound = (int16)m68ki_read_pcrel_16(state, ea);
+ sint upper_bound = (int16)m68ki_read_pcrel_16(state, ea + 2);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x8000) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
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);
+ sint lower_bound = (int16)m68ki_read_pcrel_16(state, ea);
+ sint upper_bound = (int16)m68ki_read_pcrel_16(state, ea + 2);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x8000) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
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);
+ sint lower_bound = (int16)m68ki_read_16(state, ea);
+ sint upper_bound = (int16)m68ki_read_16(state, ea + 2);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x8000) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
uint32 word2 = OPER_I_16(state);
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);
+ sint64 lower_bound = m68ki_read_pcrel_32(state, ea);
+ sint64 upper_bound = m68ki_read_pcrel_32(state, ea + 4);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x80000000) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
uint32 word2 = OPER_I_16(state);
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);
+ sint64 lower_bound = m68ki_read_32(state, ea);
+ sint64 upper_bound = m68ki_read_32(state, ea + 4);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x80000000) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
uint32 word2 = OPER_I_16(state);
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);
+ sint64 lower_bound = m68ki_read_32(state, ea);
+ sint64 upper_bound = m68ki_read_32(state, ea + 4);
// for signed compare, the arithmetically smaller value is the lower bound
if (lower_bound & 0x80000000) {
FLAG_Z = ((upper_bound == compare) || (lower_bound == compare)) ? 0 : 1;
if(COND_CS() && BIT_B(word2))
- m68ki_exception_trap(EXCEPTION_CHK);
+ m68ki_exception_trap(state, EXCEPTION_CHK);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
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);
+ m68ki_read_8(state, ea); /* the 68000 does a dummy read, the value is discarded */
+ m68ki_write_8(state, ea, 0);
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
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);
+ m68ki_read_16(state, ea); /* the 68000 does a dummy read, the value is discarded */
+ m68ki_write_16(state, ea, 0);
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
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);
+ m68ki_read_32(state, ea); /* the 68000 does a dummy read, the value is discarded */
+ m68ki_write_32(state, ea, 0);
FLAG_N = NFLAG_CLEAR;
FLAG_V = VFLAG_CLEAR;
FLAG_C = CFLAG_8(res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_8(res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_16(res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_16(res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_SUB_32(src, dst, res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_SUB_32(src, dst, res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
REG_PC += 4;
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
M68KMAKE_OP(ftrapcc,32, ., .)
{
m68881_ftrap(state);
} else {
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
}
FLAG_V = VFLAG_SET;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
}
FLAG_V = VFLAG_SET;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
}
FLAG_V = VFLAG_SET;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
}
FLAG_V = VFLAG_SET;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#else
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#endif
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#else
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE);
+ m68ki_exception_trap(state, EXCEPTION_ZERO_DIVIDE);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#endif
}
M68KMAKE_OP(eor, 8, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea));
+ uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(state, ea));
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
M68KMAKE_OP(eor, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea));
+ uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(state, ea));
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(eor, 32, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = DX ^ m68ki_read_32(ea);
+ uint res = DX ^ m68ki_read_32(state, ea);
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
{
uint src = OPER_I_8(state);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = src ^ m68ki_read_8(ea);
+ uint res = src ^ m68ki_read_8(state, ea);
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
{
uint src = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = src ^ m68ki_read_16(ea);
+ uint res = src ^ m68ki_read_16(state, ea);
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
{
uint src = OPER_I_32(state);
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = src ^ m68ki_read_32(ea);
+ uint res = src ^ m68ki_read_32(state, ea);
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
m68ki_set_sr(state, m68ki_get_sr() ^ src);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
M68KMAKE_OP(illegal, 0, ., .)
{
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
M68KMAKE_OP(jmp, 32, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_push_32(REG_PC);
+ m68ki_push_32(state, REG_PC);
m68ki_jump(ea);
}
M68KMAKE_OP(link, 16, ., a7)
{
REG_A[7] -= 4;
- m68ki_write_32(REG_A[7], REG_A[7]);
+ m68ki_write_32(state, REG_A[7], REG_A[7]);
REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16(state)));
}
{
uint* r_dst = &AY;
- m68ki_push_32(*r_dst);
+ m68ki_push_32(state, *r_dst);
*r_dst = REG_A[7];
REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16(state)));
}
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
REG_A[7] -= 4;
- m68ki_write_32(REG_A[7], REG_A[7]);
+ m68ki_write_32(state, REG_A[7], REG_A[7]);
REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + OPER_I_32(state));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
uint* r_dst = &AY;
- m68ki_push_32(*r_dst);
+ m68ki_push_32(state, *r_dst);
*r_dst = REG_A[7];
REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + OPER_I_32(state));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
M68KMAKE_OP(lsr, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = src >> 1;
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_CLEAR;
FLAG_Z = res;
M68KMAKE_OP(lsl, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = MASK_OUT_ABOVE_16(src << 1);
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AX_AI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AX_AI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_A7_PI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AX_PI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_A7_PI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AX_PI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_A7_PD_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AX_PD_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_A7_PD_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AX_PD_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AX_DI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AX_DI_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AX_IX_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AX_IX_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AW_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AW_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_8(DY);
uint ea = EA_AL_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_8;
uint ea = EA_AL_8();
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AX_AI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AX_AI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AX_AI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AX_PI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AX_PI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AX_PI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AX_PD_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AX_PD_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AX_PD_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AX_DI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AX_DI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AX_DI_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AX_IX_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AX_IX_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AX_IX_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AW_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AW_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AW_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(DY);
uint ea = EA_AL_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = MASK_OUT_ABOVE_16(AY);
uint ea = EA_AL_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_16;
uint ea = EA_AL_16();
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AX_AI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AX_AI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AX_AI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AX_PI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AX_PI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AX_PI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AX_PD_32();
- m68ki_write_16(ea+2, res & 0xFFFF );
- m68ki_write_16(ea, (res >> 16) & 0xFFFF );
+ m68ki_write_16(state, ea+2, res & 0xFFFF );
+ m68ki_write_16(state, ea, (res >> 16) & 0xFFFF );
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AX_PD_32();
- m68ki_write_16(ea+2, res & 0xFFFF );
- m68ki_write_16(ea, (res >> 16) & 0xFFFF );
+ m68ki_write_16(state, ea+2, res & 0xFFFF );
+ m68ki_write_16(state, ea, (res >> 16) & 0xFFFF );
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AX_PD_32();
- m68ki_write_16(ea+2, res & 0xFFFF );
- m68ki_write_16(ea, (res >> 16) & 0xFFFF );
+ m68ki_write_16(state, ea+2, res & 0xFFFF );
+ m68ki_write_16(state, ea, (res >> 16) & 0xFFFF );
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AX_DI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AX_DI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AX_DI_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AX_IX_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AX_IX_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AX_IX_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AW_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AW_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AW_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = DY;
uint ea = EA_AL_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = AY;
uint ea = EA_AL_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
uint res = M68KMAKE_GET_OPER_AY_32;
uint ea = EA_AL_32();
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
DY = MASK_OUT_BELOW_16(DY) | m68ki_get_ccr();
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
if(CPU_TYPE_IS_010_PLUS(CPU_TYPE))
{
- m68ki_write_16(M68KMAKE_GET_EA_AY_16, m68ki_get_ccr());
+ m68ki_write_16(state, M68KMAKE_GET_EA_AY_16, m68ki_get_ccr());
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
DY = MASK_OUT_BELOW_16(DY) | m68ki_get_sr();
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */
{
uint ea = M68KMAKE_GET_EA_AY_16;
- m68ki_write_16(ea, m68ki_get_sr());
+ m68ki_write_16(state, ea, m68ki_get_sr());
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
m68ki_set_sr(state, DY);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
m68ki_set_sr(state, new_sr);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
AY = REG_USP;
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
REG_USP = AY;
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
REG_DA[(word2 >> 12) & 15] = REG_CAAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
break;
case 0x803: /* MSP */
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = FLAG_M ? REG_SP : REG_MSP;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x804: /* ISP */
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = FLAG_M ? REG_ISP : REG_SP;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x003: /* TC */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_tc;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x004: /* ITT0 */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_itt0;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x005: /* ITT1 */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_itt1;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x006: /* DTT0 */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_dtt0;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x007: /* DTT1 */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_dtt1;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x805: /* MMUSR */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_sr_040;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x806: /* URP */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_urp_aptr;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x807: /* SRP */
if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
REG_DA[(word2 >> 12) & 15] = m68ki_cpu.mmu_srp_aptr;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
default:
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
}
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x800: /* USP */
REG_USP = REG_DA[(word2 >> 12) & 15];
REG_CAAR = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x803: /* MSP */
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
REG_SP = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x804: /* ISP */
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
REG_ISP = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x003: /* TC */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x004: /* ITT0 */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_itt0 = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x005: /* ITT1 */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_itt1 = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x006: /* DTT0 */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_dtt0 = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x007: /* DTT1 */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_dtt1 = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x805: /* MMUSR */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_sr_040 = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x806: /* URP */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_urp_aptr = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
case 0x807: /* SRP */
if (CPU_TYPE_IS_040_PLUS(CPU_TYPE))
m68ki_cpu.mmu_srp_aptr = REG_DA[(word2 >> 12) & 15];
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
default:
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
return;
}
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
if(register_list & (1 << i))
{
ea -= 2;
- m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_DA[15-i]));
+ m68ki_write_16(state, ea, MASK_OUT_ABOVE_16(REG_DA[15-i]));
count++;
}
AY = ea;
for(; i < 16; i++)
if(register_list & (1 << i))
{
- m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_DA[i]));
+ m68ki_write_16(state, ea, MASK_OUT_ABOVE_16(REG_DA[i]));
ea += 2;
count++;
}
if(register_list & (1 << i))
{
ea -= 4;
- m68ki_write_16(ea+2, REG_DA[15-i] & 0xFFFF );
- m68ki_write_16(ea, (REG_DA[15-i] >> 16) & 0xFFFF );
+ m68ki_write_16(state, ea+2, REG_DA[15-i] & 0xFFFF );
+ m68ki_write_16(state, ea, (REG_DA[15-i] >> 16) & 0xFFFF );
count++;
}
AY = ea;
for(; i < 16; i++)
if(register_list & (1 << i))
{
- m68ki_write_32(ea, REG_DA[i]);
+ m68ki_write_32(state, ea, REG_DA[i]);
ea += 4;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16(ea)));
+ REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16(state, ea)));
ea += 2;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_pcrel_16(ea)));
+ REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_pcrel_16(state, ea)));
ea += 2;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_pcrel_16(ea)));
+ REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_pcrel_16(state, ea)));
ea += 2;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16(ea)));
+ REG_DA[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16(state, ea)));
ea += 2;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = m68ki_read_32(ea);
+ REG_DA[i] = m68ki_read_32(state, ea);
ea += 4;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = m68ki_read_pcrel_32(ea);
+ REG_DA[i] = m68ki_read_pcrel_32(state, ea);
ea += 4;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = m68ki_read_pcrel_32(ea);
+ REG_DA[i] = m68ki_read_pcrel_32(state, ea);
ea += 4;
count++;
}
for(; i < 16; i++)
if(register_list & (1 << i))
{
- REG_DA[i] = m68ki_read_32(ea);
+ REG_DA[i] = m68ki_read_32(state, ea);
ea += 4;
count++;
}
uint ea = EA_AY_DI_16();
uint src = DX;
- m68ki_write_8(ea, MASK_OUT_ABOVE_8(src >> 8));
- m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src));
+ m68ki_write_8(state, ea, MASK_OUT_ABOVE_8(src >> 8));
+ m68ki_write_8(state, ea += 2, MASK_OUT_ABOVE_8(src));
}
uint ea = EA_AY_DI_32();
uint src = DX;
- m68ki_write_8(ea, MASK_OUT_ABOVE_8(src >> 24));
- m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src >> 16));
- m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src >> 8));
- m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src));
+ m68ki_write_8(state, ea, MASK_OUT_ABOVE_8(src >> 24));
+ m68ki_write_8(state, ea += 2, MASK_OUT_ABOVE_8(src >> 16));
+ m68ki_write_8(state, ea += 2, MASK_OUT_ABOVE_8(src >> 8));
+ m68ki_write_8(state, ea += 2, MASK_OUT_ABOVE_8(src));
}
uint ea = EA_AY_DI_16();
uint* r_dst = &DX;
- *r_dst = MASK_OUT_BELOW_16(*r_dst) | ((m68ki_read_8(ea) << 8) + m68ki_read_8(ea + 2));
+ *r_dst = MASK_OUT_BELOW_16(*r_dst) | ((m68ki_read_8(state, ea) << 8) + m68ki_read_8(state, ea + 2));
}
{
uint ea = EA_AY_DI_32();
- DX = (m68ki_read_8(ea) << 24) + (m68ki_read_8(ea + 2) << 16)
- + (m68ki_read_8(ea + 4) << 8) + m68ki_read_8(ea + 6);
+ DX = (m68ki_read_8(state, ea) << 24) + (m68ki_read_8(state, ea + 2) << 16)
+ + (m68ki_read_8(state, ea + 4) << 8) + m68ki_read_8(state, ea + 6);
}
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
if(BIT_B(word2)) /* Register to memory */
{
- m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15]));
+ m68ki_write_8_fc(state, ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15]));
return;
}
if(BIT_F(word2)) /* Memory to address register */
{
- REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC));
+ REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(state, ea, REG_SFC));
if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE))
USE_CYCLES(2);
return;
}
/* Memory to data register */
- REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC);
+ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(state, ea, REG_SFC);
if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE))
USE_CYCLES(2);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
if(BIT_B(word2)) /* Register to memory */
{
- m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15]));
+ m68ki_write_16_fc(state, ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15]));
return;
}
if(BIT_F(word2)) /* Memory to address register */
{
- REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC));
+ REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(state, ea, REG_SFC));
if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE))
USE_CYCLES(2);
return;
}
/* Memory to data register */
- REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC);
+ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(state, ea, REG_SFC);
if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE))
USE_CYCLES(2);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
if(BIT_B(word2)) /* Register to memory */
{
- m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]);
+ m68ki_write_32_fc(state, ea, REG_DFC, REG_DA[(word2 >> 12) & 15]);
if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE))
USE_CYCLES(2);
return;
}
/* Memory to register */
- REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC);
+ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(state, ea, REG_SFC);
if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE))
USE_CYCLES(2);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
int ax = REG_IR & 7;
int ay = (w2 >> 12) & 7;
- m68ki_write_32(REG_A[ay], m68ki_read_32(REG_A[ax]));
- m68ki_write_32(REG_A[ay]+4, m68ki_read_32(REG_A[ax]+4));
- m68ki_write_32(REG_A[ay]+8, m68ki_read_32(REG_A[ax]+8));
- m68ki_write_32(REG_A[ay]+12, m68ki_read_32(REG_A[ax]+12));
+ m68ki_write_32(state, REG_A[ay], m68ki_read_32(state, REG_A[ax]));
+ m68ki_write_32(state, REG_A[ay]+4, m68ki_read_32(state, REG_A[ax]+4));
+ m68ki_write_32(state, REG_A[ay]+8, m68ki_read_32(state, REG_A[ax]+8));
+ m68ki_write_32(state, REG_A[ay]+12, m68ki_read_32(state, REG_A[ax]+12));
REG_A[ax] += 16;
REG_A[ay] += 16;
REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#else
FLAG_V = (hi != 0) << 7;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#endif
}
REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#else
FLAG_V = (hi != 0) << 7;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
#endif
}
M68KMAKE_OP(nbcd, 8, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = - dst - XFLAG_AS_1();
if(res != 0)
FLAG_V &= ~res; /* Undefined V behavior part II */
- m68ki_write_8(ea, MASK_OUT_ABOVE_8(res));
+ m68ki_write_8(state, ea, MASK_OUT_ABOVE_8(res));
FLAG_Z |= res;
FLAG_C = CFLAG_SET;
M68KMAKE_OP(neg, 8, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
uint res = 0 - src;
FLAG_N = NFLAG_8(res);
FLAG_V = src & res;
FLAG_Z = MASK_OUT_ABOVE_8(res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
M68KMAKE_OP(neg, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = 0 - src;
FLAG_N = NFLAG_16(res);
FLAG_V = (src & res)>>8;
FLAG_Z = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
M68KMAKE_OP(neg, 32, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
- uint src = m68ki_read_32(ea);
+ uint src = m68ki_read_32(state, ea);
uint res = 0 - src;
FLAG_N = NFLAG_32(res);
FLAG_V = (src & res)>>24;
FLAG_Z = MASK_OUT_ABOVE_32(res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
M68KMAKE_OP(negx, 8, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint src = m68ki_read_8(ea);
+ uint src = m68ki_read_8(state, ea);
uint res = 0 - src - XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
M68KMAKE_OP(negx, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1();
FLAG_N = NFLAG_16(res);
res = MASK_OUT_ABOVE_16(res);
FLAG_Z |= res;
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
}
M68KMAKE_OP(negx, 32, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
- uint src = m68ki_read_32(ea);
+ uint src = m68ki_read_32(state, ea);
uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1();
FLAG_N = NFLAG_32(res);
res = MASK_OUT_ABOVE_32(res);
FLAG_Z |= res;
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
}
M68KMAKE_OP(not, 8, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea));
+ uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(state, ea));
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
M68KMAKE_OP(not, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea));
+ uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(state, ea));
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(not, 32, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea));
+ uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(state, ea));
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
M68KMAKE_OP(or, 8, re, .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea));
+ uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(state, ea));
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
M68KMAKE_OP(or, 16, re, .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea));
+ uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(state, ea));
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(or, 32, re, .)
{
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = DX | m68ki_read_32(ea);
+ uint res = DX | m68ki_read_32(state, ea);
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
{
uint src = OPER_I_8(state);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea));
+ uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(state, ea));
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
FLAG_N = NFLAG_8(res);
FLAG_Z = res;
{
uint src = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_16;
- uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea));
+ uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(state, ea));
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
{
uint src = OPER_I_32(state);
uint ea = M68KMAKE_GET_EA_AY_32;
- uint res = src | m68ki_read_32(ea);
+ uint res = src | m68ki_read_32(state, ea);
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
m68ki_set_sr(state, m68ki_get_sr() | src);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
*r_dst = MASK_OUT_BELOW_8(*r_dst) | ((src >> 4) & 0x00f0) | (src & 0x000f);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
/* Note: AX and AY are reversed in Motorola's docs */
uint ea_src = EA_AY_PD_8();
- uint src = m68ki_read_8(ea_src);
+ uint src = m68ki_read_8(state, ea_src);
ea_src = EA_AY_PD_8();
- src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(state);
+ src = ((src << 8) | m68ki_read_8(state, ea_src)) + OPER_I_16(state);
- m68ki_write_8(EA_A7_PD_8(), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0));
+ m68ki_write_8(state, EA_A7_PD_8(), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
/* Note: AX and AY are reversed in Motorola's docs */
uint ea_src = EA_A7_PD_8();
- uint src = m68ki_read_8(ea_src);
+ uint src = m68ki_read_8(state, ea_src);
ea_src = EA_A7_PD_8();
- src = (src | (m68ki_read_8(ea_src) << 8)) + OPER_I_16(state);
+ src = (src | (m68ki_read_8(state, ea_src) << 8)) + OPER_I_16(state);
- m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
+ m68ki_write_8(state, EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
uint ea_src = EA_A7_PD_8();
- uint src = m68ki_read_8(ea_src);
+ uint src = m68ki_read_8(state, ea_src);
ea_src = EA_A7_PD_8();
- src = (src | (m68ki_read_8(ea_src) << 8)) + OPER_I_16(state);
+ src = (src | (m68ki_read_8(state, ea_src) << 8)) + OPER_I_16(state);
- m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
+ m68ki_write_8(state, EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
/* Note: AX and AY are reversed in Motorola's docs */
uint ea_src = EA_AY_PD_8();
- uint src = m68ki_read_8(ea_src);
+ uint src = m68ki_read_8(state, ea_src);
ea_src = EA_AY_PD_8();
- src = (src | (m68ki_read_8(ea_src) << 8)) + OPER_I_16(state);
+ src = (src | (m68ki_read_8(state, ea_src) << 8)) + OPER_I_16(state);
- m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
+ m68ki_write_8(state, EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
uint ea = M68KMAKE_GET_EA_AY_32;
- m68ki_push_32(ea);
+ m68ki_push_32(state, ea);
}
M68KMAKE_OP(pflusha, 32, ., .)
fprintf(stderr,"68040: unhandled PFLUSHA (ir=%04x)\n", REG_IR);
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
M68KMAKE_OP(pflushan, 32, ., .)
fprintf(stderr,"68040: unhandled PFLUSHAN (ir=%04x)\n", REG_IR);
return;
}
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
M68KMAKE_OP(pmmu, 32, ., .)
{
if ((CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) && (HAS_PMMU))
{
- void m68851_mmu_ops(m68ki_cpu_core *state);
+ m68851_mmu_ops(state);
}
else
{
- m68ki_exception_1111();
+ m68ki_exception_1111(state);
}
}
USE_CYCLES(CYC_RESET);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
M68KMAKE_OP(ror, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = ROR_16(src, 1);
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(rol, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1));
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(roxr, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1);
FLAG_C = FLAG_X = res >> 8;
res = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
M68KMAKE_OP(roxl, 16, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_16;
- uint src = m68ki_read_16(ea);
+ uint src = m68ki_read_16(state, ea);
uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1);
FLAG_C = FLAG_X = res >> 8;
res = MASK_OUT_ABOVE_16(res);
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
FLAG_N = NFLAG_16(res);
FLAG_Z = res;
{
if(CPU_TYPE_IS_010_PLUS(CPU_TYPE))
{
- uint new_pc = m68ki_pull_32();
+ uint new_pc = m68ki_pull_32(state);
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16(state)));
m68ki_jump(new_pc);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
if(CPU_TYPE_IS_000(CPU_TYPE))
{
- new_sr = m68ki_pull_16();
- new_pc = m68ki_pull_32();
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
m68ki_jump(new_pc);
m68ki_set_sr(state, new_sr);
if(CPU_TYPE_IS_010(CPU_TYPE))
{
- format_word = m68ki_read_16(REG_A[7]+6) >> 12;
+ format_word = m68ki_read_16(state, REG_A[7]+6) >> 12;
if(format_word == 0)
{
- new_sr = m68ki_pull_16();
- new_pc = m68ki_pull_32();
- m68ki_fake_pull_16(); /* format word */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* format word */
m68ki_jump(new_pc);
m68ki_set_sr(state, new_sr);
CPU_INSTR_MODE = INSTRUCTION_YES;
return;
} else if (format_word == 8) {
/* Format 8 stack frame -- 68010 only. 29 word bus/address error */
- new_sr = m68ki_pull_16();
- new_pc = m68ki_pull_32();
- m68ki_fake_pull_16(); /* format word */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* format word */
m68ki_jump(new_pc);
m68ki_set_sr(state, 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_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_fake_pull_16(state); /* special status */
+ m68ki_fake_pull_32(state); /* fault address */
+ m68ki_fake_pull_32(state); /* reserved and data output buffer */
+ m68ki_fake_pull_32(state); /* reserved and data input buffer */
+ m68ki_fake_pull_32(state); /* reserved and instruction input buffer */
+ m68ki_fake_pull_32(state); /* 8 dwords of CPU specific undocumented data */
+ m68ki_fake_pull_32(state);
+ m68ki_fake_pull_32(state);
+ m68ki_fake_pull_32(state);
+ m68ki_fake_pull_32(state);
+ m68ki_fake_pull_32(state);
+ m68ki_fake_pull_32(state);
+ m68ki_fake_pull_32(state);
return;
}
CPU_INSTR_MODE = INSTRUCTION_YES;
CPU_RUN_MODE = RUN_MODE_NORMAL;
/* Not handling other exception types (9) */
- m68ki_exception_format_error();
+ m68ki_exception_format_error(state);
return;
}
/* Otherwise it's 020 */
rte_loop:
- format_word = m68ki_read_16(REG_A[7]+6) >> 12;
+ format_word = m68ki_read_16(state, REG_A[7]+6) >> 12;
switch(format_word)
{
case 0: /* Normal */
- new_sr = m68ki_pull_16();
- new_pc = m68ki_pull_32();
- m68ki_fake_pull_16(); /* format word */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* format word */
m68ki_jump(new_pc);
m68ki_set_sr(state, new_sr);
CPU_INSTR_MODE = INSTRUCTION_YES;
CPU_RUN_MODE = RUN_MODE_NORMAL;
return;
case 1: /* Throwaway */
- new_sr = m68ki_pull_16();
- m68ki_fake_pull_32(); /* program counter */
- m68ki_fake_pull_16(); /* format word */
+ new_sr = m68ki_pull_16(state);
+ m68ki_fake_pull_32(state); /* program counter */
+ m68ki_fake_pull_16(state); /* format word */
m68ki_set_sr_noint(state, new_sr);
goto rte_loop;
case 2: /* Trap */
- new_sr = m68ki_pull_16();
- new_pc = m68ki_pull_32();
- m68ki_fake_pull_16(); /* format word */
- m68ki_fake_pull_32(); /* address */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* format word */
+ m68ki_fake_pull_32(state); /* address */
m68ki_jump(new_pc);
m68ki_set_sr(state, 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 */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* $06: format word */
+ m68ki_fake_pull_32(state); /* $08: effective address */
+ m68ki_fake_pull_16(state); /* $0c: special status word */
+ m68ki_fake_pull_16(state); /* $0e: wb3s */
+ m68ki_fake_pull_16(state); /* $10: wb2s */
+ m68ki_fake_pull_16(state); /* $12: wb1s */
+ m68ki_fake_pull_32(state); /* $14: data fault address */
+ m68ki_fake_pull_32(state); /* $18: wb3a */
+ m68ki_fake_pull_32(state); /* $1c: wb3d */
+ m68ki_fake_pull_32(state); /* $20: wb2a */
+ m68ki_fake_pull_32(state); /* $24: wb2d */
+ m68ki_fake_pull_32(state); /* $28: wb1a */
+ m68ki_fake_pull_32(state); /* $2c: wb1d/pd0 */
+ m68ki_fake_pull_32(state); /* $30: pd1 */
+ m68ki_fake_pull_32(state); /* $34: pd2 */
+ m68ki_fake_pull_32(state); /* $38: pd3 */
m68ki_jump(new_pc);
m68ki_set_sr(state, new_sr);
CPU_INSTR_MODE = INSTRUCTION_YES;
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 */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* $06: format word */
+ m68ki_fake_pull_16(state); /* $08: internal register */
+ m68ki_fake_pull_16(state); /* $0a: special status word */
+ m68ki_fake_pull_16(state); /* $0c: instruction pipe stage c */
+ m68ki_fake_pull_16(state); /* $0e: instruction pipe stage b */
+ m68ki_fake_pull_32(state); /* $10: data fault address */
+ m68ki_fake_pull_32(state); /* $14: internal registers */
+ m68ki_fake_pull_32(state); /* $18: data output buffer */
+ m68ki_fake_pull_32(state); /* $1c: internal registers */
m68ki_jump(new_pc);
m68ki_set_sr(state, new_sr);
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: */
+ new_sr = m68ki_pull_16(state);
+ new_pc = m68ki_pull_32(state);
+ m68ki_fake_pull_16(state); /* $06: format word */
+ m68ki_fake_pull_16(state); /* $08: internal register */
+ m68ki_fake_pull_16(state); /* $0a: special status word */
+ m68ki_fake_pull_16(state); /* $0c: instruction pipe stage c */
+ m68ki_fake_pull_16(state); /* $0e: instruction pipe stage b */
+ m68ki_fake_pull_32(state); /* $10: data fault address */
+ m68ki_fake_pull_32(state); /* $14: internal registers */
+ m68ki_fake_pull_32(state); /* $18: data output buffer */
+ m68ki_fake_pull_32(state); /* $1c: internal registers */
+ m68ki_fake_pull_32(state); /* $20: */
+ m68ki_fake_pull_32(state); /* $24: stage B address */
+ m68ki_fake_pull_32(state); /* $28: */
+ m68ki_fake_pull_32(state); /* $2c: data input buffer */
+ m68ki_fake_pull_32(state); /* $30: */
+ m68ki_fake_pull_16(state); /* $34: */
+ m68ki_fake_pull_16(state); /* $36: version #, internal information */
+ m68ki_fake_pull_32(state); /* $38: */
+ m68ki_fake_pull_32(state); /* $3c: */
+ m68ki_fake_pull_32(state); /* $40: */
+ m68ki_fake_pull_32(state); /* $44: */
+ m68ki_fake_pull_32(state); /* $48: */
+ m68ki_fake_pull_32(state); /* $4c: */
+ m68ki_fake_pull_32(state); /* $50: */
+ m68ki_fake_pull_32(state); /* $54: */
+ m68ki_fake_pull_32(state); /* $58: */
m68ki_jump(new_pc);
m68ki_set_sr(state, new_sr);
/* Not handling long or short bus fault */
CPU_INSTR_MODE = INSTRUCTION_YES;
CPU_RUN_MODE = RUN_MODE_NORMAL;
- m68ki_exception_format_error();
+ m68ki_exception_format_error(state);
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
m68ki_disassemble_quick(ADDRESS_68K(REG_PC - 2),CPU_TYPE)));
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
M68KMAKE_OP(rtr, 32, ., .)
{
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_set_ccr(m68ki_pull_16());
- m68ki_jump(m68ki_pull_32());
+ m68ki_set_ccr(m68ki_pull_16(state));
+ m68ki_jump(m68ki_pull_32(state));
}
M68KMAKE_OP(rts, 32, ., .)
{
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
- m68ki_jump(m68ki_pull_32());
+ m68ki_jump(m68ki_pull_32(state));
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
uint corf = 0;
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
uint corf = 0;
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
uint corf = 0;
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1();
uint corf = 0;
FLAG_N = NFLAG_8(res); /* Undefined N behavior */
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
M68KMAKE_OP(st, 8, ., .)
{
- m68ki_write_8(M68KMAKE_GET_EA_AY_8, 0xff);
+ m68ki_write_8(state, M68KMAKE_GET_EA_AY_8, 0xff);
}
M68KMAKE_OP(sf, 8, ., .)
{
- m68ki_write_8(M68KMAKE_GET_EA_AY_8, 0);
+ m68ki_write_8(state, M68KMAKE_GET_EA_AY_8, 0);
}
M68KMAKE_OP(scc, 8, ., .)
{
- m68ki_write_8(M68KMAKE_GET_EA_AY_8, M68KMAKE_CC ? 0xff : 0);
+ m68ki_write_8(state, M68KMAKE_GET_EA_AY_8, M68KMAKE_CC ? 0xff : 0);
}
USE_ALL_CYCLES();
return;
}
- m68ki_exception_privilege_violation();
+ m68ki_exception_privilege_violation(state);
}
{
uint ea = M68KMAKE_GET_EA_AY_8;
uint src = MASK_OUT_ABOVE_8(DX);
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_8(res);
FLAG_X = FLAG_C = CFLAG_8(res);
FLAG_V = VFLAG_SUB_8(src, dst, res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
{
uint ea = M68KMAKE_GET_EA_AY_16;
uint src = MASK_OUT_ABOVE_16(DX);
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_16(res);
FLAG_X = FLAG_C = CFLAG_16(res);
FLAG_V = VFLAG_SUB_16(src, dst, res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
{
uint ea = M68KMAKE_GET_EA_AY_32;
uint src = DX;
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_32(res);
FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res);
FLAG_V = VFLAG_SUB_32(src, dst, res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
{
uint src = OPER_I_8(state);
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_8(res);
FLAG_X = FLAG_C = CFLAG_8(res);
FLAG_V = VFLAG_SUB_8(src, dst, res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
{
uint src = OPER_I_16(state);
uint ea = M68KMAKE_GET_EA_AY_16;
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_16(res);
FLAG_X = FLAG_C = CFLAG_16(res);
FLAG_V = VFLAG_SUB_16(src, dst, res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
{
uint src = OPER_I_32(state);
uint ea = M68KMAKE_GET_EA_AY_32;
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_32(res);
FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res);
FLAG_V = VFLAG_SUB_32(src, dst, res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
{
uint src = (((REG_IR >> 9) - 1) & 7) + 1;
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_8(res);
FLAG_X = FLAG_C = CFLAG_8(res);
FLAG_V = VFLAG_SUB_8(src, dst, res);
- m68ki_write_8(ea, FLAG_Z);
+ m68ki_write_8(state, ea, FLAG_Z);
}
{
uint src = (((REG_IR >> 9) - 1) & 7) + 1;
uint ea = M68KMAKE_GET_EA_AY_16;
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_16(res);
FLAG_X = FLAG_C = CFLAG_16(res);
FLAG_V = VFLAG_SUB_16(src, dst, res);
- m68ki_write_16(ea, FLAG_Z);
+ m68ki_write_16(state, ea, FLAG_Z);
}
{
uint src = (((REG_IR >> 9) - 1) & 7) + 1;
uint ea = M68KMAKE_GET_EA_AY_32;
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = dst - src;
FLAG_N = NFLAG_32(res);
FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res);
FLAG_V = VFLAG_SUB_32(src, dst, res);
- m68ki_write_32(ea, FLAG_Z);
+ m68ki_write_32(state, ea, FLAG_Z);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src - XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src - XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_A7_PD_8(state);
uint ea = EA_A7_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src - XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_AY_PD_8(state);
uint ea = EA_AX_PD_8();
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint res = dst - src - XFLAG_AS_1();
FLAG_N = NFLAG_8(res);
res = MASK_OUT_ABOVE_8(res);
FLAG_Z |= res;
- m68ki_write_8(ea, res);
+ m68ki_write_8(state, ea, res);
}
{
uint src = OPER_AY_PD_16(state);
uint ea = EA_AX_PD_16();
- uint dst = m68ki_read_16(ea);
+ uint dst = m68ki_read_16(state, ea);
uint res = dst - src - XFLAG_AS_1();
FLAG_N = NFLAG_16(res);
res = MASK_OUT_ABOVE_16(res);
FLAG_Z |= res;
- m68ki_write_16(ea, res);
+ m68ki_write_16(state, ea, res);
}
{
uint src = OPER_AY_PD_32(state);
uint ea = EA_AX_PD_32();
- uint dst = m68ki_read_32(ea);
+ uint dst = m68ki_read_32(state, ea);
uint res = dst - src - XFLAG_AS_1();
FLAG_N = NFLAG_32(res);
res = MASK_OUT_ABOVE_32(res);
FLAG_Z |= res;
- m68ki_write_32(ea, res);
+ m68ki_write_32(state, ea, res);
}
M68KMAKE_OP(tas, 8, ., .)
{
uint ea = M68KMAKE_GET_EA_AY_8;
- uint dst = m68ki_read_8(ea);
+ uint dst = m68ki_read_8(state, ea);
uint allow_writeback;
FLAG_Z = dst;
will be needed. */
allow_writeback = m68ki_tas_callback();
- if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80);
+ if (allow_writeback==1) m68ki_write_8(state, ea, dst | 0x80);
}
M68KMAKE_OP(trap, 0, ., .)
{
/* Trap#n stacks exception frame type 0 */
- m68ki_exception_trapN(EXCEPTION_TRAP_BASE + (REG_IR & 0xf)); /* HJB 990403 */
+ m68ki_exception_trapN(state, EXCEPTION_TRAP_BASE + (REG_IR & 0xf)); /* HJB 990403 */
}
{
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
- m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
// 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 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
// 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 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
REG_PC += 2;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
REG_PC += 4;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
if(M68KMAKE_CC)
- m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
REG_PC += 2; /* JFF increase before or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */
if(M68KMAKE_CC)
{
- m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
return;
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
REG_PC += 4; /* JFF increase before or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */
if(M68KMAKE_CC)
{
- m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
return;
}
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
{
return;
}
- m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */
+ m68ki_exception_trap(state, EXCEPTION_TRAPV); /* HJB 990403 */
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
FLAG_C = CFLAG_CLEAR;
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
M68KMAKE_OP(unlk, 32, ., a7)
{
- REG_A[7] = m68ki_read_32(REG_A[7]);
+ REG_A[7] = m68ki_read_32(state, REG_A[7]);
}
uint* r_dst = &AY;
REG_A[7] = *r_dst;
- *r_dst = m68ki_pull_32();
+ *r_dst = m68ki_pull_32(state);
}
*r_dst = MASK_OUT_BELOW_16(*r_dst) | (((((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(state)) & 0xffff);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(state);
ea_dst = EA_A7_PD_8();
- m68ki_write_8(ea_dst, src & 0xff);
+ m68ki_write_8(state, ea_dst, src & 0xff);
ea_dst = EA_A7_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
+ m68ki_write_8(state, ea_dst, (src >> 8) & 0xff);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(state);
ea_dst = EA_AX_PD_8();
- m68ki_write_8(ea_dst, src & 0xff);
+ m68ki_write_8(state, ea_dst, src & 0xff);
ea_dst = EA_AX_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
+ m68ki_write_8(state, ea_dst, (src >> 8) & 0xff);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(state);
ea_dst = EA_A7_PD_8();
- m68ki_write_8(ea_dst, src & 0xff);
+ m68ki_write_8(state, ea_dst, src & 0xff);
ea_dst = EA_A7_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
+ m68ki_write_8(state, ea_dst, (src >> 8) & 0xff);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(state);
ea_dst = EA_AX_PD_8();
- m68ki_write_8(ea_dst, src & 0xff);
+ m68ki_write_8(state, ea_dst, src & 0xff);
ea_dst = EA_AX_PD_8();
- m68ki_write_8(ea_dst, (src >> 8) & 0xff);
+ m68ki_write_8(state, ea_dst, (src >> 8) & 0xff);
return;
}
- m68ki_exception_illegal();
+ m68ki_exception_illegal(state);
}
#if !M68K_SEPARATE_READS
-#define m68k_read_immediate_16(A) m68ki_read_program_16(A)
-#define m68k_read_immediate_32(A) m68ki_read_program_32(A)
+#define m68k_read_immediate_16(state, A) m68ki_read_program_16(state, A)
+#define m68k_read_immediate_32(state, A) m68ki_read_program_32(state, A)
-#define m68k_read_pcrelative_8(A) m68ki_read_program_8(A)
-#define m68k_read_pcrelative_16(A) m68ki_read_program_16(A)
-#define m68k_read_pcrelative_32(A) m68ki_read_program_32(A)
+#define m68k_read_pcrelative_8(state, A) m68ki_read_program_8(state, A)
+#define m68k_read_pcrelative_16(state, A) m68ki_read_program_16(state, A)
+#define m68k_read_pcrelative_32(state, A) m68ki_read_program_32(state, A)
#endif /* M68K_SEPARATE_READS */
/* ----------------------------- Read / Write ----------------------------- */
/* Read from the current address space */
-#define m68ki_read_8(A) m68ki_read_8_fc (A, FLAG_S | m68ki_get_address_space())
-#define m68ki_read_16(A) m68ki_read_16_fc(A, FLAG_S | m68ki_get_address_space())
-#define m68ki_read_32(A) m68ki_read_32_fc(A, FLAG_S | m68ki_get_address_space())
+#define m68ki_read_8(state, A) m68ki_read_8_fc (state, A, FLAG_S | m68ki_get_address_space())
+#define m68ki_read_16(state, A) m68ki_read_16_fc(state, A, FLAG_S | m68ki_get_address_space())
+#define m68ki_read_32(state, A) m68ki_read_32_fc(state, A, FLAG_S | m68ki_get_address_space())
/* Write to the current data space */
-#define m68ki_write_8(A, V) m68ki_write_8_fc (A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
-#define m68ki_write_16(A, V) m68ki_write_16_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
-#define m68ki_write_32(A, V) m68ki_write_32_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
+#define m68ki_write_8(state, A, V) m68ki_write_8_fc (state, A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
+#define m68ki_write_16(state, A, V) m68ki_write_16_fc(state, A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
+#define m68ki_write_32(state, A, V) m68ki_write_32_fc(state, A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
#if M68K_SIMULATE_PD_WRITES
#define m68ki_write_32_pd(A, V) m68ki_write_32_pd_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
#else
-#define m68ki_write_32_pd(A, V) m68ki_write_32_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
+#define m68ki_write_32_pd(state, A, V) m68ki_write_32_fc(state, A, FLAG_S | FUNCTION_CODE_USER_DATA, V)
#endif
/* Map PC-relative reads */
-#define m68ki_read_pcrel_8(A) m68k_read_pcrelative_8(A)
-#define m68ki_read_pcrel_16(A) m68k_read_pcrelative_16(A)
-#define m68ki_read_pcrel_32(A) m68k_read_pcrelative_32(A)
+#define m68ki_read_pcrel_8(state, A) m68k_read_pcrelative_8(state, A)
+#define m68ki_read_pcrel_16(state, A) m68k_read_pcrelative_16(state, A)
+#define m68ki_read_pcrel_32(state, A) m68k_read_pcrelative_32(state, A)
/* Read from the program space */
-#define m68ki_read_program_8(A) m68ki_read_8_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM)
-#define m68ki_read_program_16(A) m68ki_read_16_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM)
-#define m68ki_read_program_32(A) m68ki_read_32_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM)
+#define m68ki_read_program_8(state, A) m68ki_read_8_fc(state, A, FLAG_S | FUNCTION_CODE_USER_PROGRAM)
+#define m68ki_read_program_16(state, A) m68ki_read_16_fc(state, A, FLAG_S | FUNCTION_CODE_USER_PROGRAM)
+#define m68ki_read_program_32(state, A) m68ki_read_32_fc(state, A, FLAG_S | FUNCTION_CODE_USER_PROGRAM)
/* Read from the data space */
-#define m68ki_read_data_8(A) m68ki_read_8_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA)
-#define m68ki_read_data_16(A) m68ki_read_16_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA)
-#define m68ki_read_data_32(A) m68ki_read_32_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA)
+#define m68ki_read_data_8(state, A) m68ki_read_8_fc(state, A, FLAG_S | FUNCTION_CODE_USER_DATA)
+#define m68ki_read_data_16(state, A) m68ki_read_16_fc(state, A, FLAG_S | FUNCTION_CODE_USER_DATA)
+#define m68ki_read_data_32(state, A) m68ki_read_32_fc(state, A, FLAG_S | FUNCTION_CODE_USER_DATA)
extern uint m68ki_aerr_fc;
/* Forward declarations to keep some of the macros happy */
-static inline uint m68ki_read_16_fc (uint address, uint fc);
-static inline uint m68ki_read_32_fc (uint address, uint fc);
+static inline uint m68ki_read_16_fc(m68ki_cpu_core *state, uint address, uint fc);
+static inline uint m68ki_read_32_fc(m68ki_cpu_core *state, uint address, uint fc);
static inline uint m68ki_get_ea_ix(m68ki_cpu_core *state, uint An);
static inline void m68ki_check_interrupts(m68ki_cpu_core *state); /* ASG: check for interrupts */
// read immediate word using the instruction cache
-static inline uint32 m68ki_ic_readimm16(uint32 address)
+static inline uint32 m68ki_ic_readimm16(m68ki_cpu_core *state, uint32 address)
{
if (m68ki_cpu.cacr & M68K_CACR_EI)
{
// if the cache is frozen, don't update it
if (m68ki_cpu.cacr & M68K_CACR_FI)
{
- return m68k_read_immediate_16(address);
+ return m68k_read_immediate_16(state, address);
}
- uint32 data = m68ki_read_32(address & ~3);
+ uint32 data = m68ki_read_32(state, address & ~3);
//printf("m68k: doing cache fill at %08x (tag %08x idx %d)\n", address, tag, idx);
}
else
{
- return m68k_read_immediate_16(address);
+ return m68k_read_immediate_16(state, address);
}
}
}
}
}
- return m68k_read_immediate_16(address);
+ return m68k_read_immediate_16(state, address);
}
/* Handles all immediate reads, does address error check, function code setting,
* and prefetching if they are enabled in m68kconf.h
*/
-uint m68ki_read_imm6_addr_slowpath(uint32_t pc, address_translation_cache *cache);
+uint m68ki_read_imm16_addr_slowpath(m68ki_cpu_core *state, uint32_t pc, address_translation_cache *cache);
REG_PC += 2;
return be16toh(((unsigned short *)(cache->offset + pc))[0]);
}
- return m68ki_read_imm6_addr_slowpath(pc, cache);
+ return m68ki_read_imm16_addr_slowpath(state, pc, cache);
}
static inline uint m68ki_read_imm_8(m68ki_cpu_core *state)
if(REG_PC != CPU_PREF_ADDR)
{
CPU_PREF_ADDR = REG_PC;
- CPU_PREF_DATA = m68ki_ic_readimm16(ADDRESS_68K(CPU_PREF_ADDR));
+ CPU_PREF_DATA = m68ki_ic_readimm16(state, ADDRESS_68K(CPU_PREF_ADDR));
}
temp_val = MASK_OUT_ABOVE_16(CPU_PREF_DATA);
REG_PC += 2;
CPU_PREF_ADDR = REG_PC;
- CPU_PREF_DATA = m68ki_ic_readimm16(ADDRESS_68K(CPU_PREF_ADDR));
+ CPU_PREF_DATA = m68ki_ic_readimm16(state, ADDRESS_68K(CPU_PREF_ADDR));
temp_val = MASK_OUT_ABOVE_32((temp_val << 16) | MASK_OUT_ABOVE_16(CPU_PREF_DATA));
REG_PC += 2;
- CPU_PREF_DATA = m68ki_ic_readimm16(REG_PC);
+ CPU_PREF_DATA = m68ki_ic_readimm16(state, REG_PC);
CPU_PREF_ADDR = m68ki_cpu.mmu_tmp_buserror_occurred ? ((uint32)~0) : REG_PC;
return temp_val;
* code if they are enabled in m68kconf.h.
*/
-static inline uint m68ki_read_8_fc(uint address, uint fc)
+static inline uint m68ki_read_8_fc(m68ki_cpu_core *state, uint address, uint fc)
{
(void)fc;
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
return m68k_read_memory_8(ADDRESS_68K(address));
}
-static inline uint m68ki_read_16_fc(uint address, uint fc)
+static inline uint m68ki_read_16_fc(m68ki_cpu_core *state, uint address, uint fc)
{
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
m68ki_cpu.mmu_tmp_fc = fc;
#if M68K_EMULATE_PMMU
if (PMMU_ENABLED)
- address = pmmu_translate_addr(address,1);
+ address = pmmu_translate_addr(state, address,1);
#endif
for (int i = 0; i < m68ki_cpu.read_ranges; i++) {
return m68k_read_memory_16(ADDRESS_68K(address));
}
-static inline uint m68ki_read_32_fc(uint address, uint fc)
+static inline uint m68ki_read_32_fc(m68ki_cpu_core *state, uint address, uint fc)
{
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
m68ki_cpu.mmu_tmp_fc = fc;
#if M68K_EMULATE_PMMU
if (PMMU_ENABLED)
- address = pmmu_translate_addr(address,1);
+ address = pmmu_translate_addr(state, address,1);
#endif
for (int i = 0; i < m68ki_cpu.read_ranges; i++) {
return m68k_read_memory_32(ADDRESS_68K(address));
}
-static inline void m68ki_write_8_fc(uint address, uint fc, uint value)
+static inline void m68ki_write_8_fc(m68ki_cpu_core *state, uint address, uint fc, uint value)
{
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
m68ki_cpu.mmu_tmp_fc = fc;
m68k_write_memory_8(ADDRESS_68K(address), value);
}
-static inline void m68ki_write_16_fc(uint address, uint fc, uint value)
+static inline void m68ki_write_16_fc(m68ki_cpu_core *state, uint address, uint fc, uint value)
{
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
m68ki_cpu.mmu_tmp_fc = fc;
m68k_write_memory_16(ADDRESS_68K(address), value);
}
-static inline void m68ki_write_32_fc(uint address, uint fc, uint value)
+static inline void m68ki_write_32_fc(m68ki_cpu_core *state, uint address, uint fc, uint value)
{
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
m68ki_cpu.mmu_tmp_fc = fc;
/* Postindex */
if(BIT_2(extension)) /* I/IS: 0 = preindex, 1 = postindex */
- return m68ki_read_32(An + bd) + Xn + od;
+ return m68ki_read_32(state, An + bd) + Xn + od;
/* Preindex */
- return m68ki_read_32(An + bd + Xn) + od;
+ return m68ki_read_32(state, An + bd + Xn) + od;
}
/* Fetch operands */
-static inline uint OPER_AY_AI_8(m68ki_cpu_core *state) {uint ea = EA_AY_AI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AY_AI_16(m68ki_cpu_core *state) {uint ea = EA_AY_AI_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AY_AI_32(m68ki_cpu_core *state) {uint ea = EA_AY_AI_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AY_PI_8(m68ki_cpu_core *state) {uint ea = EA_AY_PI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AY_PI_16(m68ki_cpu_core *state) {uint ea = EA_AY_PI_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AY_PI_32(m68ki_cpu_core *state) {uint ea = EA_AY_PI_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AY_PD_8(m68ki_cpu_core *state) {uint ea = EA_AY_PD_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AY_PD_16(m68ki_cpu_core *state) {uint ea = EA_AY_PD_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AY_PD_32(m68ki_cpu_core *state) {uint ea = EA_AY_PD_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AY_DI_8(m68ki_cpu_core *state) {uint ea = EA_AY_DI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AY_DI_16(m68ki_cpu_core *state) {uint ea = EA_AY_DI_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AY_DI_32(m68ki_cpu_core *state) {uint ea = EA_AY_DI_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AY_IX_8(m68ki_cpu_core *state) {uint ea = EA_AY_IX_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AY_IX_16(m68ki_cpu_core *state) {uint ea = EA_AY_IX_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AY_IX_32(m68ki_cpu_core *state) {uint ea = EA_AY_IX_32(); return m68ki_read_32(ea);}
-
-static inline uint OPER_AX_AI_8(m68ki_cpu_core *state) {uint ea = EA_AX_AI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AX_AI_16(m68ki_cpu_core *state) {uint ea = EA_AX_AI_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AX_AI_32(m68ki_cpu_core *state) {uint ea = EA_AX_AI_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AX_PI_8(m68ki_cpu_core *state) {uint ea = EA_AX_PI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AX_PI_16(m68ki_cpu_core *state) {uint ea = EA_AX_PI_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AX_PI_32(m68ki_cpu_core *state) {uint ea = EA_AX_PI_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AX_PD_8(m68ki_cpu_core *state) {uint ea = EA_AX_PD_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AX_PD_16(m68ki_cpu_core *state) {uint ea = EA_AX_PD_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AX_PD_32(m68ki_cpu_core *state) {uint ea = EA_AX_PD_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AX_DI_8(m68ki_cpu_core *state) {uint ea = EA_AX_DI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AX_DI_16(m68ki_cpu_core *state) {uint ea = EA_AX_DI_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AX_DI_32(m68ki_cpu_core *state) {uint ea = EA_AX_DI_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AX_IX_8(m68ki_cpu_core *state) {uint ea = EA_AX_IX_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AX_IX_16(m68ki_cpu_core *state) {uint ea = EA_AX_IX_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AX_IX_32(m68ki_cpu_core *state) {uint ea = EA_AX_IX_32(); return m68ki_read_32(ea);}
-
-static inline uint OPER_A7_PI_8(m68ki_cpu_core *state) {uint ea = EA_A7_PI_8(); return m68ki_read_8(ea); }
-static inline uint OPER_A7_PD_8(m68ki_cpu_core *state) {uint ea = EA_A7_PD_8(); return m68ki_read_8(ea); }
-
-static inline uint OPER_AW_8(m68ki_cpu_core *state) {uint ea = EA_AW_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AW_16(m68ki_cpu_core *state) {uint ea = EA_AW_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AW_32(m68ki_cpu_core *state) {uint ea = EA_AW_32(); return m68ki_read_32(ea);}
-static inline uint OPER_AL_8(m68ki_cpu_core *state) {uint ea = EA_AL_8(); return m68ki_read_8(ea); }
-static inline uint OPER_AL_16(m68ki_cpu_core *state) {uint ea = EA_AL_16(); return m68ki_read_16(ea);}
-static inline uint OPER_AL_32(m68ki_cpu_core *state) {uint ea = EA_AL_32(); return m68ki_read_32(ea);}
-static inline uint OPER_PCDI_8(m68ki_cpu_core *state) {uint ea = EA_PCDI_8(); return m68ki_read_pcrel_8(ea); }
-static inline uint OPER_PCDI_16(m68ki_cpu_core *state) {uint ea = EA_PCDI_16(); return m68ki_read_pcrel_16(ea);}
-static inline uint OPER_PCDI_32(m68ki_cpu_core *state) {uint ea = EA_PCDI_32(); return m68ki_read_pcrel_32(ea);}
-static inline uint OPER_PCIX_8(m68ki_cpu_core *state) {uint ea = EA_PCIX_8(); return m68ki_read_pcrel_8(ea); }
-static inline uint OPER_PCIX_16(m68ki_cpu_core *state) {uint ea = EA_PCIX_16(); return m68ki_read_pcrel_16(ea);}
-static inline uint OPER_PCIX_32(m68ki_cpu_core *state) {uint ea = EA_PCIX_32(); return m68ki_read_pcrel_32(ea);}
+static inline uint OPER_AY_AI_8(m68ki_cpu_core *state) {uint ea = EA_AY_AI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AY_AI_16(m68ki_cpu_core *state) {uint ea = EA_AY_AI_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AY_AI_32(m68ki_cpu_core *state) {uint ea = EA_AY_AI_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AY_PI_8(m68ki_cpu_core *state) {uint ea = EA_AY_PI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AY_PI_16(m68ki_cpu_core *state) {uint ea = EA_AY_PI_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AY_PI_32(m68ki_cpu_core *state) {uint ea = EA_AY_PI_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AY_PD_8(m68ki_cpu_core *state) {uint ea = EA_AY_PD_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AY_PD_16(m68ki_cpu_core *state) {uint ea = EA_AY_PD_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AY_PD_32(m68ki_cpu_core *state) {uint ea = EA_AY_PD_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AY_DI_8(m68ki_cpu_core *state) {uint ea = EA_AY_DI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AY_DI_16(m68ki_cpu_core *state) {uint ea = EA_AY_DI_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AY_DI_32(m68ki_cpu_core *state) {uint ea = EA_AY_DI_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AY_IX_8(m68ki_cpu_core *state) {uint ea = EA_AY_IX_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AY_IX_16(m68ki_cpu_core *state) {uint ea = EA_AY_IX_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AY_IX_32(m68ki_cpu_core *state) {uint ea = EA_AY_IX_32(); return m68ki_read_32(state, ea);}
+
+static inline uint OPER_AX_AI_8(m68ki_cpu_core *state) {uint ea = EA_AX_AI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AX_AI_16(m68ki_cpu_core *state) {uint ea = EA_AX_AI_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AX_AI_32(m68ki_cpu_core *state) {uint ea = EA_AX_AI_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AX_PI_8(m68ki_cpu_core *state) {uint ea = EA_AX_PI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AX_PI_16(m68ki_cpu_core *state) {uint ea = EA_AX_PI_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AX_PI_32(m68ki_cpu_core *state) {uint ea = EA_AX_PI_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AX_PD_8(m68ki_cpu_core *state) {uint ea = EA_AX_PD_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AX_PD_16(m68ki_cpu_core *state) {uint ea = EA_AX_PD_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AX_PD_32(m68ki_cpu_core *state) {uint ea = EA_AX_PD_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AX_DI_8(m68ki_cpu_core *state) {uint ea = EA_AX_DI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AX_DI_16(m68ki_cpu_core *state) {uint ea = EA_AX_DI_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AX_DI_32(m68ki_cpu_core *state) {uint ea = EA_AX_DI_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AX_IX_8(m68ki_cpu_core *state) {uint ea = EA_AX_IX_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AX_IX_16(m68ki_cpu_core *state) {uint ea = EA_AX_IX_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AX_IX_32(m68ki_cpu_core *state) {uint ea = EA_AX_IX_32(); return m68ki_read_32(state, ea);}
+
+static inline uint OPER_A7_PI_8(m68ki_cpu_core *state) {uint ea = EA_A7_PI_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_A7_PD_8(m68ki_cpu_core *state) {uint ea = EA_A7_PD_8(); return m68ki_read_8(state, ea); }
+
+static inline uint OPER_AW_8(m68ki_cpu_core *state) {uint ea = EA_AW_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AW_16(m68ki_cpu_core *state) {uint ea = EA_AW_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AW_32(m68ki_cpu_core *state) {uint ea = EA_AW_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_AL_8(m68ki_cpu_core *state) {uint ea = EA_AL_8(); return m68ki_read_8(state, ea); }
+static inline uint OPER_AL_16(m68ki_cpu_core *state) {uint ea = EA_AL_16(); return m68ki_read_16(state, ea);}
+static inline uint OPER_AL_32(m68ki_cpu_core *state) {uint ea = EA_AL_32(); return m68ki_read_32(state, ea);}
+static inline uint OPER_PCDI_8(m68ki_cpu_core *state) {uint ea = EA_PCDI_8(); return m68ki_read_pcrel_8(state, ea);}
+static inline uint OPER_PCDI_16(m68ki_cpu_core *state) {uint ea = EA_PCDI_16(); return m68ki_read_pcrel_16(state, ea);}
+static inline uint OPER_PCDI_32(m68ki_cpu_core *state) {uint ea = EA_PCDI_32(); return m68ki_read_pcrel_32(state, ea);}
+static inline uint OPER_PCIX_8(m68ki_cpu_core *state) {uint ea = EA_PCIX_8(); return m68ki_read_pcrel_8(state, ea);}
+static inline uint OPER_PCIX_16(m68ki_cpu_core *state) {uint ea = EA_PCIX_16(); return m68ki_read_pcrel_16(state, ea);}
+static inline uint OPER_PCIX_32(m68ki_cpu_core *state) {uint ea = EA_PCIX_32(); return m68ki_read_pcrel_32(state, ea);}
/* ---------------------------- Stack Functions --------------------------- */
/* Push/pull data from the stack */
-static inline void m68ki_push_16(uint value)
+static inline void m68ki_push_16(m68ki_cpu_core *state, uint value)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2);
- m68ki_write_16(REG_SP, value);
+ m68ki_write_16(state, REG_SP, value);
}
-static inline void m68ki_push_32(uint value)
+static inline void m68ki_push_32(m68ki_cpu_core *state, uint value)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4);
- m68ki_write_32(REG_SP, value);
+ m68ki_write_32(state, REG_SP, value);
}
-static inline uint m68ki_pull_16(void)
+static inline uint m68ki_pull_16(m68ki_cpu_core *state)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2);
- return m68ki_read_16(REG_SP-2);
+ return m68ki_read_16(state, REG_SP - 2);
}
-static inline uint m68ki_pull_32(void)
+static inline uint m68ki_pull_32(m68ki_cpu_core *state)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4);
- return m68ki_read_32(REG_SP-4);
+ return m68ki_read_32(state, REG_SP - 4);
}
/* Increment/decrement the stack as if doing a push/pull but
* don't do any memory access.
*/
-static inline void m68ki_fake_push_16(void)
+static inline void m68ki_fake_push_16(m68ki_cpu_core *state)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2);
}
-static inline void m68ki_fake_push_32(void)
+static inline void m68ki_fake_push_32(m68ki_cpu_core *state)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4);
}
-static inline void m68ki_fake_pull_16(void)
+static inline void m68ki_fake_pull_16(m68ki_cpu_core *state)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2);
}
-static inline void m68ki_fake_pull_32(void)
+static inline void m68ki_fake_pull_32(m68ki_cpu_core *state)
{
REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4);
}
m68ki_pc_changed(REG_PC);
}
-static inline void m68ki_jump_vector(uint vector)
+static inline void m68ki_jump_vector(m68ki_cpu_core *state, uint vector)
{
REG_PC = (vector<<2) + REG_VBR;
- REG_PC = m68ki_read_data_32(REG_PC);
+ REG_PC = m68ki_read_data_32(state, REG_PC);
m68ki_pc_changed(REG_PC);
}
}
/* 3 word stack frame (68000 only) */
-static inline void m68ki_stack_frame_3word(uint pc, uint sr)
+static inline void m68ki_stack_frame_3word(m68ki_cpu_core *state, uint pc, uint sr)
{
- m68ki_push_32(pc);
- m68ki_push_16(sr);
+ m68ki_push_32(state, pc);
+ m68ki_push_16(state, sr);
}
/* Format 0 stack frame.
* This is the standard stack frame for 68010+.
*/
-static inline void m68ki_stack_frame_0000(uint pc, uint sr, uint vector)
+static inline void m68ki_stack_frame_0000(m68ki_cpu_core *state, uint pc, uint sr, uint vector)
{
/* Stack a 3-word frame if we are 68000 */
if(CPU_TYPE == CPU_TYPE_000)
{
- m68ki_stack_frame_3word(pc, sr);
+ m68ki_stack_frame_3word(state, pc, sr);
return;
}
- m68ki_push_16(vector<<2);
- m68ki_push_32(pc);
- m68ki_push_16(sr);
+ m68ki_push_16(state, vector << 2);
+ m68ki_push_32(state, pc);
+ m68ki_push_16(state, sr);
}
/* Format 1 stack frame (68020).
* For 68020, this is the 4 word throwaway frame.
*/
-static inline void m68ki_stack_frame_0001(uint pc, uint sr, uint vector)
+static inline void m68ki_stack_frame_0001(m68ki_cpu_core *state, uint pc, uint sr, uint vector)
{
- m68ki_push_16(0x1000 | (vector<<2));
- m68ki_push_32(pc);
- m68ki_push_16(sr);
+ m68ki_push_16(state, 0x1000 | (vector << 2));
+ m68ki_push_32(state, pc);
+ m68ki_push_16(state, sr);
}
/* Format 2 stack frame.
* This is used only by 68020 for trap exceptions.
*/
-static inline void m68ki_stack_frame_0010(uint sr, uint vector)
+static inline void m68ki_stack_frame_0010(m68ki_cpu_core *state, uint sr, uint vector)
{
- m68ki_push_32(REG_PPC);
- m68ki_push_16(0x2000 | (vector<<2));
- m68ki_push_32(REG_PC);
- m68ki_push_16(sr);
+ m68ki_push_32(state, REG_PPC);
+ m68ki_push_16(state, 0x2000 | (vector << 2));
+ m68ki_push_32(state, REG_PC);
+ m68ki_push_16(state, sr);
}
/* Bus error stack frame (68000 only).
*/
-static inline void m68ki_stack_frame_buserr(uint sr)
+static inline void m68ki_stack_frame_buserr(m68ki_cpu_core *state, uint sr)
{
- m68ki_push_32(REG_PC);
- m68ki_push_16(sr);
- m68ki_push_16(REG_IR);
- m68ki_push_32(m68ki_aerr_address); /* access address */
+ m68ki_push_32(state, REG_PC);
+ m68ki_push_16(state, sr);
+ m68ki_push_16(state, REG_IR);
+ m68ki_push_32(state, m68ki_aerr_address); /* access address */
/* 0 0 0 0 0 0 0 0 0 0 0 R/W I/N FC
* R/W 0 = write, 1 = read
* I/N 0 = instruction, 1 = not
* FC 3-bit function code
*/
- m68ki_push_16(m68ki_aerr_write_mode | CPU_INSTR_MODE | m68ki_aerr_fc);
+ m68ki_push_16(state, m68ki_aerr_write_mode | CPU_INSTR_MODE | m68ki_aerr_fc);
}
/* Format 8 stack frame (68010).
* 68010 only. This is the 29 word bus/address error frame.
*/
-static inline void m68ki_stack_frame_1000(uint pc, uint sr, uint vector)
+static inline void m68ki_stack_frame_1000(m68ki_cpu_core *state, uint pc, uint sr, uint vector)
{
/* VERSION
* NUMBER
* INTERNAL INFORMATION, 16 WORDS
*/
- m68ki_fake_push_32();
- m68ki_fake_push_32();
- m68ki_fake_push_32();
- m68ki_fake_push_32();
- m68ki_fake_push_32();
- m68ki_fake_push_32();
- m68ki_fake_push_32();
- m68ki_fake_push_32();
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
+ m68ki_fake_push_32(state);
/* INSTRUCTION INPUT BUFFER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* UNUSED, RESERVED (not written) */
- m68ki_fake_push_16();
+ m68ki_fake_push_16(state);
/* DATA INPUT BUFFER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* UNUSED, RESERVED (not written) */
- m68ki_fake_push_16();
+ m68ki_fake_push_16(state);
/* DATA OUTPUT BUFFER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* UNUSED, RESERVED (not written) */
- m68ki_fake_push_16();
+ m68ki_fake_push_16(state);
/* FAULT ADDRESS */
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
/* SPECIAL STATUS WORD */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* 1000, VECTOR OFFSET */
- m68ki_push_16(0x8000 | (vector<<2));
+ m68ki_push_16(state, 0x8000 | (vector << 2));
/* PROGRAM COUNTER */
- m68ki_push_32(pc);
+ m68ki_push_32(state, pc);
/* STATUS REGISTER */
- m68ki_push_16(sr);
+ m68ki_push_16(state, sr);
}
/* Format A stack frame (short bus fault).
* if the error happens at an instruction boundary.
* PC stacked is address of next instruction.
*/
-static inline void m68ki_stack_frame_1010(uint sr, uint vector, uint pc, uint fault_address)
+static inline void m68ki_stack_frame_1010(m68ki_cpu_core *state, uint sr, uint vector, uint pc, uint fault_address)
{
int orig_rw = m68ki_cpu.mmu_tmp_buserror_rw; // this gets splatted by the following pushes, so save it now
int orig_fc = m68ki_cpu.mmu_tmp_buserror_fc;
int orig_sz = m68ki_cpu.mmu_tmp_buserror_sz;
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* DATA OUTPUT BUFFER (2 words) */
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* DATA CYCLE FAULT ADDRESS (2 words) */
- m68ki_push_32(fault_address);
+ m68ki_push_32(state, fault_address);
/* INSTRUCTION PIPE STAGE B */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* INSTRUCTION PIPE STAGE C */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* SPECIAL STATUS REGISTER */
// set bit for: Rerun Faulted bus Cycle, or run pending prefetch
// set FC
- m68ki_push_16(0x0100 | orig_fc | orig_rw<<6 | orig_sz<<4);
+ m68ki_push_16(state, 0x0100 | orig_fc | orig_rw << 6 | orig_sz << 4);
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* 1010, VECTOR OFFSET */
- m68ki_push_16(0xa000 | (vector<<2));
+ m68ki_push_16(state, 0xa000 | (vector << 2));
/* PROGRAM COUNTER */
- m68ki_push_32(pc);
+ m68ki_push_32(state, pc);
/* STATUS REGISTER */
- m68ki_push_16(sr);
+ m68ki_push_16(state, sr);
}
/* Format B stack frame (long bus fault).
* if the error happens during instruction execution.
* PC stacked is address of instruction in progress.
*/
-static inline void m68ki_stack_frame_1011(uint sr, uint vector, uint pc, uint fault_address)
+static inline void m68ki_stack_frame_1011(m68ki_cpu_core *state, uint sr, uint vector, uint pc, uint fault_address)
{
int orig_rw = m68ki_cpu.mmu_tmp_buserror_rw; // this gets splatted by the following pushes, so save it now
int orig_fc = m68ki_cpu.mmu_tmp_buserror_fc;
int orig_sz = m68ki_cpu.mmu_tmp_buserror_sz;
/* INTERNAL REGISTERS (18 words) */
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
/* VERSION# (4 bits), INTERNAL INFORMATION */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* INTERNAL REGISTERS (3 words) */
- m68ki_push_32(0);
- m68ki_push_16(0);
+ m68ki_push_32(state, 0);
+ m68ki_push_16(state, 0);
/* DATA INTPUT BUFFER (2 words) */
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
/* INTERNAL REGISTERS (2 words) */
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
/* STAGE B ADDRESS (2 words) */
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
/* INTERNAL REGISTER (4 words) */
- m68ki_push_32(0);
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
/* DATA OUTPUT BUFFER (2 words) */
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* DATA CYCLE FAULT ADDRESS (2 words) */
- m68ki_push_32(fault_address);
+ m68ki_push_32(state, fault_address);
/* INSTRUCTION PIPE STAGE B */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* INSTRUCTION PIPE STAGE C */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* SPECIAL STATUS REGISTER */
- m68ki_push_16(0x0100 | orig_fc | (orig_rw<<6) | (orig_sz<<4));
+ m68ki_push_16(state, 0x0100 | orig_fc | (orig_rw << 6) | (orig_sz << 4));
/* INTERNAL REGISTER */
- m68ki_push_16(0);
+ m68ki_push_16(state, 0);
/* 1011, VECTOR OFFSET */
- m68ki_push_16(0xb000 | (vector<<2));
+ m68ki_push_16(state, 0xb000 | (vector << 2));
/* PROGRAM COUNTER */
- m68ki_push_32(pc);
+ m68ki_push_32(state, pc);
/* STATUS REGISTER */
- m68ki_push_16(sr);
+ m68ki_push_16(state, sr);
}
/* Type 7 stack frame (access fault).
* This is used by the 68040 for bus fault and mmu trap
* 30 words
*/
-static inline void m68ki_stack_frame_0111(uint sr, uint vector, uint pc, uint fault_address, uint8 in_mmu)
+static inline void
+m68ki_stack_frame_0111(m68ki_cpu_core *state, uint sr, uint vector, uint pc, uint fault_address, uint8 in_mmu)
{
int orig_rw = m68ki_cpu.mmu_tmp_buserror_rw; // this gets splatted by the following pushes, so save it now
int orig_fc = m68ki_cpu.mmu_tmp_buserror_fc;
/* INTERNAL REGISTERS (18 words) */
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
- m68ki_push_32(0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
+ m68ki_push_32(state, 0);
/* FAULT ADDRESS (2 words) */
- m68ki_push_32(fault_address);
+ m68ki_push_32(state, fault_address);
/* INTERNAL REGISTERS (3 words) */
- m68ki_push_32(0);
- m68ki_push_16(0);
+ m68ki_push_32(state, 0);
+ m68ki_push_16(state, 0);
/* SPECIAL STATUS REGISTER (1 word) */
- m68ki_push_16((in_mmu ? 0x400 : 0) | orig_fc | (orig_rw<<8));
+ m68ki_push_16(state, (in_mmu ? 0x400 : 0) | orig_fc | (orig_rw << 8));
/* EFFECTIVE ADDRESS (2 words) */
- m68ki_push_32(fault_address);
+ m68ki_push_32(state, fault_address);
/* 0111, VECTOR OFFSET (1 word) */
- m68ki_push_16(0x7000 | (vector<<2));
+ m68ki_push_16(state, 0x7000 | (vector << 2));
/* PROGRAM COUNTER (2 words) */
- m68ki_push_32(pc);
+ m68ki_push_32(state, pc);
/* STATUS REGISTER (1 word) */
- m68ki_push_16(sr);
+ m68ki_push_16(state, sr);
}
/* Used for Group 2 exceptions.
* These stack a type 2 frame on the 020.
*/
-static inline void m68ki_exception_trap(uint vector)
+static inline void m68ki_exception_trap(m68ki_cpu_core *state, uint vector)
{
uint sr = m68ki_init_exception();
if(CPU_TYPE_IS_010_LESS(CPU_TYPE))
- m68ki_stack_frame_0000(REG_PC, sr, vector);
+ m68ki_stack_frame_0000(state, REG_PC, sr, vector);
else
- m68ki_stack_frame_0010(sr, vector);
+ m68ki_stack_frame_0010(state, sr, vector);
- m68ki_jump_vector(vector);
+ m68ki_jump_vector(state, vector);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[vector] - CYC_INSTRUCTION[REG_IR]);
}
/* Trap#n stacks a 0 frame but behaves like group2 otherwise */
-static inline void m68ki_exception_trapN(uint vector)
+static inline void m68ki_exception_trapN(m68ki_cpu_core *state, uint vector)
{
uint sr = m68ki_init_exception();
- m68ki_stack_frame_0000(REG_PC, sr, vector);
- m68ki_jump_vector(vector);
+ m68ki_stack_frame_0000(state, REG_PC, sr, vector);
+ m68ki_jump_vector(state, vector);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[vector] - CYC_INSTRUCTION[REG_IR]);
}
/* Exception for trace mode */
-static inline void m68ki_exception_trace(void)
+static inline void m68ki_exception_trace(m68ki_cpu_core *state)
{
uint sr = m68ki_init_exception();
CPU_INSTR_MODE = INSTRUCTION_NO;
}
#endif /* M68K_EMULATE_ADDRESS_ERROR */
- m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_TRACE);
+ m68ki_stack_frame_0000(state, REG_PC, sr, EXCEPTION_TRACE);
}
else
- m68ki_stack_frame_0010(sr, EXCEPTION_TRACE);
+ m68ki_stack_frame_0010(state, sr, EXCEPTION_TRACE);
- m68ki_jump_vector(EXCEPTION_TRACE);
+ m68ki_jump_vector(state, EXCEPTION_TRACE);
/* Trace nullifies a STOP instruction */
CPU_STOPPED &= ~STOP_LEVEL_STOP;
}
/* Exception for privilege violation */
-static inline void m68ki_exception_privilege_violation(void)
+static inline void m68ki_exception_privilege_violation(m68ki_cpu_core *state)
{
uint sr = m68ki_init_exception();
}
#endif /* M68K_EMULATE_ADDRESS_ERROR */
- m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_PRIVILEGE_VIOLATION);
- m68ki_jump_vector(EXCEPTION_PRIVILEGE_VIOLATION);
+ m68ki_stack_frame_0000(state, REG_PPC, sr, EXCEPTION_PRIVILEGE_VIOLATION);
+ m68ki_jump_vector(state, EXCEPTION_PRIVILEGE_VIOLATION);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[EXCEPTION_PRIVILEGE_VIOLATION] - CYC_INSTRUCTION[REG_IR]);
#define m68ki_check_bus_error_trap() setjmp(m68ki_bus_error_jmp_buf)
/* Exception for bus error */
-static inline void m68ki_exception_bus_error(void)
+static inline void m68ki_exception_bus_error(m68ki_cpu_core *state)
{
int i;
}
uint sr = m68ki_init_exception();
- m68ki_stack_frame_1000(REG_PPC, sr, EXCEPTION_BUS_ERROR);
+ m68ki_stack_frame_1000(state, REG_PPC, sr, EXCEPTION_BUS_ERROR);
- m68ki_jump_vector(EXCEPTION_BUS_ERROR);
+ m68ki_jump_vector(state, EXCEPTION_BUS_ERROR);
longjmp(m68ki_bus_error_jmp_buf, 1);
}
extern int cpu_log_enabled;
/* Exception for A-Line instructions */
-static inline void m68ki_exception_1010(void)
+static inline void m68ki_exception_1010(m68ki_cpu_core *state)
{
uint sr;
#if M68K_LOG_1010_1111 == OPT_ON
#endif
sr = m68ki_init_exception();
- m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_1010);
- m68ki_jump_vector(EXCEPTION_1010);
+ m68ki_stack_frame_0000(state, REG_PPC, sr, EXCEPTION_1010);
+ m68ki_jump_vector(state, EXCEPTION_1010);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[EXCEPTION_1010] - CYC_INSTRUCTION[REG_IR]);
}
/* Exception for F-Line instructions */
-static inline void m68ki_exception_1111(void)
+static inline void m68ki_exception_1111(m68ki_cpu_core *state)
{
uint sr;
#endif
sr = m68ki_init_exception();
- m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_1111);
- m68ki_jump_vector(EXCEPTION_1111);
+ m68ki_stack_frame_0000(state, REG_PPC, sr, EXCEPTION_1111);
+ m68ki_jump_vector(state, EXCEPTION_1111);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[EXCEPTION_1111] - CYC_INSTRUCTION[REG_IR]);
#endif
/* Exception for illegal instructions */
-static inline void m68ki_exception_illegal(void)
+static inline void m68ki_exception_illegal(m68ki_cpu_core *state)
{
uint sr;
}
#endif /* M68K_EMULATE_ADDRESS_ERROR */
- m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_ILLEGAL_INSTRUCTION);
- m68ki_jump_vector(EXCEPTION_ILLEGAL_INSTRUCTION);
+ m68ki_stack_frame_0000(state, REG_PPC, sr, EXCEPTION_ILLEGAL_INSTRUCTION);
+ m68ki_jump_vector(state, EXCEPTION_ILLEGAL_INSTRUCTION);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[EXCEPTION_ILLEGAL_INSTRUCTION] - CYC_INSTRUCTION[REG_IR]);
}
/* Exception for format errror in RTE */
-static inline void m68ki_exception_format_error(void)
+static inline void m68ki_exception_format_error(m68ki_cpu_core *state)
{
uint sr = m68ki_init_exception();
- m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_FORMAT_ERROR);
- m68ki_jump_vector(EXCEPTION_FORMAT_ERROR);
+ m68ki_stack_frame_0000(state, REG_PC, sr, EXCEPTION_FORMAT_ERROR);
+ m68ki_jump_vector(state, EXCEPTION_FORMAT_ERROR);
/* Use up some clock cycles and undo the instruction's cycles */
USE_CYCLES(CYC_EXCEPTION[EXCEPTION_FORMAT_ERROR] - CYC_INSTRUCTION[REG_IR]);
}
/* Exception for address error */
-static inline void m68ki_exception_address_error(void)
+static inline void m68ki_exception_address_error(m68ki_cpu_core *state)
{
uint32 sr = m68ki_init_exception();
if (CPU_TYPE_IS_000(CPU_TYPE))
{
/* Note: This is implemented for 68000 only! */
- m68ki_stack_frame_buserr(sr);
+ m68ki_stack_frame_buserr(state, sr);
}
else if (CPU_TYPE_IS_010(CPU_TYPE))
{
/* only the 68010 throws this unique type-1000 frame */
- m68ki_stack_frame_1000(REG_PPC, sr, EXCEPTION_BUS_ERROR);
+ m68ki_stack_frame_1000(state, REG_PPC, sr, EXCEPTION_BUS_ERROR);
}
else if (m68ki_cpu.mmu_tmp_buserror_address == REG_PPC)
{
- m68ki_stack_frame_1010(sr, EXCEPTION_BUS_ERROR, REG_PPC, m68ki_cpu.mmu_tmp_buserror_address);
+ m68ki_stack_frame_1010(state, sr, EXCEPTION_BUS_ERROR, REG_PPC, m68ki_cpu.mmu_tmp_buserror_address);
}
else
{
- m68ki_stack_frame_1011(sr, EXCEPTION_BUS_ERROR, REG_PPC, m68ki_cpu.mmu_tmp_buserror_address);
+ m68ki_stack_frame_1011(state, sr, EXCEPTION_BUS_ERROR, REG_PPC, m68ki_cpu.mmu_tmp_buserror_address);
}
- m68ki_jump_vector(EXCEPTION_ADDRESS_ERROR);
+ m68ki_jump_vector(state, EXCEPTION_ADDRESS_ERROR);
m68ki_cpu.run_mode = RUN_MODE_BERR_AERR_RESET;
/* Service an interrupt request and start exception processing */
-static inline void m68ki_exception_interrupt(uint int_level)
+static inline void m68ki_exception_interrupt(m68ki_cpu_core *state, uint int_level)
{
uint vector;
uint sr;
FLAG_INT_MASK = int_level<<8;
/* Get the new PC */
- new_pc = m68ki_read_data_32((vector<<2) + REG_VBR);
+ new_pc = m68ki_read_data_32(state, (vector << 2) + REG_VBR);
/* If vector is uninitialized, call the uninitialized interrupt vector */
if(new_pc == 0)
- new_pc = m68ki_read_data_32((EXCEPTION_UNINITIALIZED_INTERRUPT<<2) + REG_VBR);
+ new_pc = m68ki_read_data_32(state, (EXCEPTION_UNINITIALIZED_INTERRUPT << 2) + REG_VBR);
/* Generate a stack frame */
- m68ki_stack_frame_0000(REG_PC, sr, vector);
+ m68ki_stack_frame_0000(state, REG_PC, sr, vector);
if(FLAG_M && CPU_TYPE_IS_EC020_PLUS(CPU_TYPE))
{
/* Create throwaway frame */
m68ki_set_sm_flag(FLAG_S); /* clear M */
sr |= 0x2000; /* Same as SR in master stack frame except S is forced high */
- m68ki_stack_frame_0001(REG_PC, sr, vector);
+ m68ki_stack_frame_0001(state, REG_PC, sr, vector);
}
m68ki_jump(new_pc);
if(m68ki_cpu.nmi_pending)
{
m68ki_cpu.nmi_pending = FALSE;
- m68ki_exception_interrupt(7);
+ m68ki_exception_interrupt(state, 7);
}
else if(CPU_INT_LEVEL > FLAG_INT_MASK)
- m68ki_exception_interrupt(CPU_INT_LEVEL>>8);
+ m68ki_exception_interrupt(state, CPU_INT_LEVEL >> 8);
}
#include <stdarg.h>
#include "softfloat/softfloat.h"
+#include "m68kcpu.h"
float_status status;
return float64_to_floatx80(*d, &status);
}
-static inline floatx80 load_extended_float80(uint32 ea)
+static inline floatx80 load_extended_float80(m68ki_cpu_core *state, uint32 ea)
{
uint32 d1,d2;
uint16 d3;
floatx80 fp;
- d3 = m68ki_read_16(ea);
- d1 = m68ki_read_32(ea+4);
- d2 = m68ki_read_32(ea+8);
+ d3 = m68ki_read_16(state, ea);
+ d1 = m68ki_read_32(state, ea + 4);
+ d2 = m68ki_read_32(state, ea + 8);
fp.high = d3;
fp.low = ((uint64)d1<<32) | (d2 & 0xffffffff);
return fp;
}
-static inline void store_extended_float80(uint32 ea, floatx80 fpr)
+static inline void store_extended_float80(m68ki_cpu_core *state, uint32 ea, floatx80 fpr)
{
- m68ki_write_16(ea+0, fpr.high);
- m68ki_write_16(ea+2, 0);
- m68ki_write_32(ea+4, (fpr.low>>32)&0xffffffff);
- m68ki_write_32(ea+8, fpr.low&0xffffffff);
+ m68ki_write_16(state, ea + 0, fpr.high);
+ m68ki_write_16(state, ea + 2, 0);
+ m68ki_write_32(state, ea + 4, (fpr.low >> 32) & 0xffffffff);
+ m68ki_write_32(state, ea + 8, fpr.low & 0xffffffff);
}
-static inline floatx80 load_pack_float80(uint32 ea)
+static inline floatx80 load_pack_float80(m68ki_cpu_core *state, uint32 ea)
{
uint32 dw1, dw2, dw3;
floatx80 result;
double tmp;
char str[128], *ch;
- dw1 = m68ki_read_32(ea);
- dw2 = m68ki_read_32(ea+4);
- dw3 = m68ki_read_32(ea+8);
+ dw1 = m68ki_read_32(state, ea);
+ dw2 = m68ki_read_32(state, ea + 4);
+ dw3 = m68ki_read_32(state, ea + 8);
ch = &str[0];
if (dw1 & 0x80000000) // mantissa sign
return result;
}
-static inline void store_pack_float80(uint32 ea, int k, floatx80 fpr)
+static inline void store_pack_float80(m68ki_cpu_core *state, uint32 ea, int k, floatx80 fpr)
{
uint32 dw1, dw2, dw3;
char str[128], *ch;
dw1 |= (j << 16);
}
- m68ki_write_32(ea, dw1);
- m68ki_write_32(ea+4, dw2);
- m68ki_write_32(ea+8, dw3);
+ m68ki_write_32(state, ea, dw1);
+ m68ki_write_32(state, ea + 4, dw2);
+ m68ki_write_32(state, ea + 8, dw3);
}
-static inline void SET_CONDITION_CODES(floatx80 reg)
+static inline void SET_CONDITION_CODES(m68ki_cpu_core *state, floatx80 reg)
{
// u64 *regi;
}
}
-static inline int TEST_CONDITION(int condition)
+static inline int TEST_CONDITION(m68ki_cpu_core *state, int condition)
{
int n = (REG_FPSR & FPCC_N) != 0;
int z = (REG_FPSR & FPCC_Z) != 0;
case 2: // (An)
{
uint32 ea = REG_A[reg];
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 3: // (An)+
{
uint32 ea = EA_AY_PI_8();
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 4: // -(An)
{
uint32 ea = EA_AY_PD_8();
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_8();
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_8();
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 7:
{
case 0: // (xxx).W
{
uint32 ea = (uint32) OPER_I_16(state);
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 1: // (xxx).L
{
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_8();
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 3: // (PC) + (Xn) + d8
{
uint32 ea = EA_PCIX_8();
- return m68ki_read_8(ea);
+ return m68ki_read_8(state, ea);
}
case 4: // #<data>
{
case 2: // (An)
{
uint32 ea = REG_A[reg];
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 3: // (An)+
{
uint32 ea = EA_AY_PI_16();
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 4: // -(An)
{
uint32 ea = EA_AY_PD_16();
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_16();
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_16();
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 7:
{
case 0: // (xxx).W
{
uint32 ea = (uint32) OPER_I_16(state);
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 1: // (xxx).L
{
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_16();
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 3: // (PC) + (Xn) + d8
{
uint32 ea = EA_PCIX_16();
- return m68ki_read_16(ea);
+ return m68ki_read_16(state, ea);
}
case 4: // #<data>
{
case 2: // (An)
{
uint32 ea = REG_A[reg];
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 3: // (An)+
{
uint32 ea = EA_AY_PI_32();
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 4: // -(An)
{
uint32 ea = EA_AY_PD_32();
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_32();
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_32();
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 7:
{
case 0: // (xxx).W
{
uint32 ea = (uint32) OPER_I_16(state);
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 1: // (xxx).L
{
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_32();
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 3: // (PC) + (Xn) + d8
{
uint32 ea = EA_PCIX_32();
- return m68ki_read_32(ea);
+ return m68ki_read_32(state, ea);
}
case 4: // #<data>
{
case 2: // (An)
{
uint32 ea = REG_A[reg];
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
case 3: // (An)+
{
uint32 ea = REG_A[reg];
REG_A[reg] += 8;
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
case 4: // -(An)
{
uint32 ea = REG_A[reg]-8;
REG_A[reg] -= 8;
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_32();
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_32();
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
case 7:
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- return (uint64)(m68ki_read_32(ea)) << 32 | (uint64)(m68ki_read_32(ea+4));
+ return (uint64)(m68ki_read_32(state, ea)) << 32 | (uint64)(m68ki_read_32(state, ea + 4));
}
case 3: // (PC) + (Xn) + d8
{
uint32 ea = EA_PCIX_32();
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
case 4: // #<data>
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_32();
- h1 = m68ki_read_32(ea+0);
- h2 = m68ki_read_32(ea+4);
+ h1 = m68ki_read_32(state, ea + 0);
+ h2 = m68ki_read_32(state, ea + 4);
return (uint64)(h1) << 32 | (uint64)(h2);
}
default: fatalerror("M68kFPU: READ_EA_64: unhandled mode %d, reg %d at %08X\n", mode, reg, REG_PC);
case 2: // (An)
{
uint32 ea = REG_A[reg];
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
break;
}
{
uint32 ea = REG_A[reg];
REG_A[reg] += 12;
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
break;
}
case 4: // -(An)
{
uint32 ea = REG_A[reg]-12;
REG_A[reg] -= 12;
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
break;
}
case 5: // (d16, An)
{
// FIXME: will fail for fmovem
uint32 ea = EA_AY_DI_32();
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
break;
}
case 6: // (An) + (Xn) + d8
{
// FIXME: will fail for fmovem
uint32 ea = EA_AY_IX_32();
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
break;
}
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
}
break;
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_32();
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
}
break;
case 3: // (d16,PC,Dx.w)
{
uint32 ea = EA_PCIX_32();
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
}
break;
case 4: // immediate (JFF)
{
uint32 ea = REG_PC;
- fpr = load_extended_float80(ea);
+ fpr = load_extended_float80(state, ea);
REG_PC += 12;
}
break;
case 2: // (An)
{
uint32 ea = REG_A[reg];
- fpr = load_pack_float80(ea);
+ fpr = load_pack_float80(state, ea);
break;
}
{
uint32 ea = REG_A[reg];
REG_A[reg] += 12;
- fpr = load_pack_float80(ea);
+ fpr = load_pack_float80(state, ea);
break;
}
case 3: // (d16,PC,Dx.w)
{
uint32 ea = EA_PCIX_32();
- fpr = load_pack_float80(ea);
+ fpr = load_pack_float80(state, ea);
}
break;
case 2: // (An)
{
uint32 ea = REG_A[reg];
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
case 3: // (An)+
{
uint32 ea = EA_AY_PI_8();
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
case 4: // -(An)
{
uint32 ea = EA_AY_PD_8();
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_8();
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_8();
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
case 7:
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_16();
- m68ki_write_8(ea, data);
+ m68ki_write_8(state, ea, data);
break;
}
default: fatalerror("M68kFPU: WRITE_EA_8: unhandled mode %d, reg %d at %08X\n", mode, reg, REG_PC);
case 2: // (An)
{
uint32 ea = REG_A[reg];
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
case 3: // (An)+
{
uint32 ea = EA_AY_PI_16();
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
case 4: // -(An)
{
uint32 ea = EA_AY_PD_16();
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_16();
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_16();
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
case 7:
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_16();
- m68ki_write_16(ea, data);
+ m68ki_write_16(state, ea, data);
break;
}
default: fatalerror("M68kFPU: WRITE_EA_16: unhandled mode %d, reg %d at %08X\n", mode, reg, REG_PC);
case 2: // (An)
{
uint32 ea = REG_A[reg];
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 3: // (An)+
{
uint32 ea = EA_AY_PI_32();
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 4: // -(An)
{
uint32 ea = EA_AY_PD_32();
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_32();
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_32();
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 7:
case 0: // (xxx).W
{
uint32 ea = OPER_I_16(state);
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 1: // (xxx).L
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_32();
- m68ki_write_32(ea, data);
+ m68ki_write_32(state, ea, data);
break;
}
default: fatalerror("M68kFPU: WRITE_EA_32: unhandled mode %d, reg %d at %08X\n", mode, reg, REG_PC);
case 2: // (An)
{
uint32 ea = REG_A[reg];
- m68ki_write_32(ea, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
case 3: // (An)+
{
uint32 ea = REG_A[reg];
REG_A[reg] += 8;
- m68ki_write_32(ea+0, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea + 0, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
case 4: // -(An)
uint32 ea;
REG_A[reg] -= 8;
ea = REG_A[reg];
- m68ki_write_32(ea+0, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea + 0, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_32();
- m68ki_write_32(ea+0, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea + 0, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
case 6: // (An) + (Xn) + d8
{
uint32 ea = EA_AY_IX_32();
- m68ki_write_32(ea+0, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea + 0, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
case 7:
uint32 d1 = OPER_I_16(state);
uint32 d2 = OPER_I_16(state);
uint32 ea = (d1 << 16) | d2;
- m68ki_write_32(ea+0, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea + 0, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
case 2: // (d16, PC)
{
uint32 ea = EA_PCDI_32();
- m68ki_write_32(ea+0, (uint32)(data >> 32));
- m68ki_write_32(ea+4, (uint32)(data));
+ m68ki_write_32(state, ea + 0, (uint32) (data >> 32));
+ m68ki_write_32(state, ea + 4, (uint32) (data));
break;
}
default: fatalerror("M68kFPU: WRITE_EA_64: unhandled mode %d, reg %d at %08X\n", mode, reg, REG_PC);
{
uint32 ea;
ea = REG_A[reg];
- store_extended_float80(ea, fpr);
+ store_extended_float80(state, ea, fpr);
break;
}
{
uint32 ea;
ea = REG_A[reg];
- store_extended_float80(ea, fpr);
+ store_extended_float80(state, ea, fpr);
REG_A[reg] += 12;
break;
}
uint32 ea;
REG_A[reg] -= 12;
ea = REG_A[reg];
- store_extended_float80(ea, fpr);
+ store_extended_float80(state, ea, fpr);
break;
}
case 5: // (d16, An)
{
uint32 ea = EA_AY_DI_32();
- store_extended_float80(ea, fpr);
+ store_extended_float80(state, ea, fpr);
break;
}
{
uint32 ea;
ea = REG_A[reg];
- store_pack_float80(ea, k, fpr);
+ store_pack_float80(state, ea, k, fpr);
break;
}
{
uint32 ea;
ea = REG_A[reg];
- store_pack_float80(ea, k, fpr);
+ store_pack_float80(state, ea, k, fpr);
REG_A[reg] += 12;
break;
}
uint32 ea;
REG_A[reg] -= 12;
ea = REG_A[reg];
- store_pack_float80(ea, k, fpr);
+ store_pack_float80(state, ea, k, fpr);
break;
}
// handle it right here, the usual opmode bits aren't valid in the FMOVECR case
REG_FP[dst] = source;
//FIXME mame doesn't use SET_CONDITION_CODES here
- SET_CONDITION_CODES(REG_FP[dst]); // JFF when destination is a register, we HAVE to update FPCR
+ SET_CONDITION_CODES(state, REG_FP[dst]); // JFF when destination is a register, we HAVE to update FPCR
USE_CYCLES(4);
return;
}
case 0x00: // FMOVE
{
REG_FP[dst] = source;
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(4);
break;
}
temp = floatx80_to_int32(source, &status);
REG_FP[dst] = int32_to_floatx80(temp);
//FIXME mame doesn't use SET_CONDITION_CODES here
- SET_CONDITION_CODES(REG_FP[dst]); // JFF needs update condition codes
+ SET_CONDITION_CODES(state, REG_FP[dst]); // JFF needs update condition codes
USE_CYCLES(4);
break;
}
case 0x02: // FSINH
{
REG_FP[dst] = floatx80_sinh(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
temp = floatx80_to_int32_round_to_zero(source, &status);
REG_FP[dst] = int32_to_floatx80(temp);
//FIXME mame doesn't use SET_CONDITION_CODES here
- SET_CONDITION_CODES(REG_FP[dst]); // JFF needs update condition codes
+ SET_CONDITION_CODES(state, REG_FP[dst]); // JFF needs update condition codes
break;
}
case 0x45: // FDSQRT
case 0x05: // FSQRT
{
REG_FP[dst] = floatx80_sqrt(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(109);
break;
}
case 0x07: // FLOGNP1
{
REG_FP[dst] = floatx80_lognp1 (source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(594); // for MC68881
break;
}
case 0x08: // FETOXM1
{
REG_FP[dst] = floatx80_etoxm1(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(6);
break;
}
case 0x09: // FTANH
{
REG_FP[dst] = floatx80_tanh(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x0b: // FATAN
{
REG_FP[dst] = floatx80_atan(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x0c: // FASIN
{
REG_FP[dst] = floatx80_asin(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x0d: // FATANH
{
REG_FP[dst] = floatx80_atanh(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x0e: // FSIN
{
REG_FP[dst] = floatx80_sin(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x0f: // FTAN
{
REG_FP[dst] = floatx80_tan(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x10: // FETOX
{
REG_FP[dst] = floatx80_etox(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x11: // FTWOTOX
{
REG_FP[dst] = floatx80_twotox(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x13: // FTENTOX
{
REG_FP[dst] = floatx80_tentox(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x14: // FLOGN
{
REG_FP[dst] = floatx80_logn(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(548); // for MC68881
break;
}
case 0x15: // FLOG10
{
REG_FP[dst] = floatx80_log10(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(604); // for MC68881
break;
}
case 0x17: // FLOG2
{
REG_FP[dst] = floatx80_log2(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(604); // for MC68881
break;
}
{
REG_FP[dst] = source;
REG_FP[dst].high &= 0x7fff;
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(3);
break;
}
case 0x19: // FCOSH
{
REG_FP[dst] = floatx80_cosh(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(64);
break;
}
{
REG_FP[dst] = source;
REG_FP[dst].high ^= 0x8000;
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(3);
break;
}
case 0x1c: // FACOS
{
REG_FP[dst] = floatx80_acos(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(604); // for MC68881
break;
break;
case 0x1d: // FCOS
{
REG_FP[dst] = floatx80_cos(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
}
case 0x1e: // FGETEXP
{
REG_FP[dst] = floatx80_getexp(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(6);
break;
}
case 0x1f: // FGETMAN
{
REG_FP[dst] = floatx80_getman(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(6);
break;
}
{
REG_FP[dst] = floatx80_div(REG_FP[dst], source, &status);
//FIXME mame doesn't use SET_CONDITION_CODES here
- SET_CONDITION_CODES(REG_FP[dst]); // JFF
+ SET_CONDITION_CODES(state, REG_FP[dst]); // JFF
USE_CYCLES(43);
break;
}
uint64_t q;
flag s;
REG_FP[dst] = floatx80_rem(REG_FP[dst], source, &q, &s, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
status.float_rounding_mode = mode;
USE_CYCLES(43); // guess
break;
case 0x22: // FADD
{
REG_FP[dst] = floatx80_add(REG_FP[dst], source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(9);
break;
}
case 0x23: // FMUL
{
REG_FP[dst] = floatx80_mul(REG_FP[dst], source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(11);
break;
}
uint64_t q;
flag s;
REG_FP[dst] = floatx80_rem(REG_FP[dst], source, &q, &s, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
status.float_rounding_mode = mode;
USE_CYCLES(43); // guess
break;
case 0x26: // FSCALE
{
REG_FP[dst] = floatx80_scale(REG_FP[dst], source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(46); // (better?) guess
break;
}
case 0x27: // FSGLMUL
{
REG_FP[dst] = floatx80_sglmul(REG_FP[dst], source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(11); // ? (value is from FMUL)
break;
}
case 0x2f: // FSUB
{
REG_FP[dst] = floatx80_sub(REG_FP[dst], source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(9);
break;
}
{
REG_FP[dst] = floatx80_cos(source, &status);
REG_FP[w2&7] = floatx80_sin(source, &status);
- SET_CONDITION_CODES(REG_FP[dst]);
+ SET_CONDITION_CODES(state, REG_FP[dst]);
USE_CYCLES(75);
break;
{
floatx80 res;
res = floatx80_sub(REG_FP[dst], source, &status);
- SET_CONDITION_CODES(res);
+ SET_CONDITION_CODES(state, res);
USE_CYCLES(7);
break;
}
{
floatx80 res;
res = source;
- SET_CONDITION_CODES(res);
+ SET_CONDITION_CODES(state, res);
USE_CYCLES(7);
break;
}
if (dir) // From system control reg to <ea>
{
- if (regsel & 4) { m68ki_write_32(address, REG_FPCR); address += 4; }
- if (regsel & 2) { m68ki_write_32(address, REG_FPSR); address += 4; }
- if (regsel & 1) { m68ki_write_32(address, REG_FPIAR); address += 4; }
+ if (regsel & 4) { m68ki_write_32(state, address, REG_FPCR); address += 4; }
+ if (regsel & 2) { m68ki_write_32(state, address, REG_FPSR); address += 4; }
+ if (regsel & 1) { m68ki_write_32(state, address, REG_FPIAR); address += 4; }
}
else // From <ea> to system control reg
{
- if (regsel & 4) { REG_FPCR = m68ki_read_32(address); address += 4; }
- if (regsel & 2) { REG_FPSR = m68ki_read_32(address); address += 4; }
- if (regsel & 1) { REG_FPIAR = m68ki_read_32(address); address += 4; }
+ if (regsel & 4) { REG_FPCR = m68ki_read_32(state, address); address += 4; }
+ if (regsel & 2) { REG_FPSR = m68ki_read_32(state, address); address += 4; }
+ if (regsel & 1) { REG_FPIAR = m68ki_read_32(state, address); address += 4; }
}
}
else
{
case 5: // (d16, An)
case 6: // (An) + (Xn) + d8
- store_extended_float80(mem_addr, REG_FP[i]);
+ store_extended_float80(state, mem_addr, REG_FP[i]);
mem_addr += 12;
break;
default:
{
case 5: // (d16, An)
case 6: // (An) + (Xn) + d8
- store_extended_float80(mem_addr, REG_FP[7-i]);
+ store_extended_float80(state, mem_addr, REG_FP[7 - i]);
mem_addr += 12;
break;
default:
{
case 5: // (d16, An)
case 6: // (An) + (Xn) + d8
- REG_FP[7-i] = load_extended_float80(mem_addr);
+ REG_FP[7-i] = load_extended_float80(state, mem_addr);
mem_addr += 12;
break;
default:
int ea = REG_IR & 0x3f;
int condition = (sint16)(OPER_I_16(state));
- WRITE_EA_8(state, ea, TEST_CONDITION(condition) ? 0xff : 0);
+ WRITE_EA_8(state, ea, TEST_CONDITION(state, condition) ? 0xff : 0);
USE_CYCLES(7); // ???
}
static void fbcc16(m68ki_cpu_core *state)
offset = (sint16)(OPER_I_16(state));
// TODO: condition and jump!!!
- if (TEST_CONDITION(condition))
+ if (TEST_CONDITION(state, condition))
{
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
m68ki_branch_16(offset-2);
offset = OPER_I_32(state);
// TODO: condition and jump!!!
- if (TEST_CONDITION(condition))
+ if (TEST_CONDITION(state, condition))
{
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
m68ki_branch_32(offset-4);
{
if(inc)
{
- m68ki_write_32(addr, 0x41000000);
+ m68ki_write_32(state, addr, 0x41000000);
return 4 -4;
}
else
{
- m68ki_write_32(addr, 0x41000000);
+ m68ki_write_32(state, addr, 0x41000000);
return -4 +4;
}
}
if (inc)
{
// 68881 IDLE, version 0x1f
- m68ki_write_32(addr, 0x1f180000);
- m68ki_write_32(addr+4, 0);
- m68ki_write_32(addr+8, 0);
- m68ki_write_32(addr+12, 0);
- m68ki_write_32(addr+16, 0);
- m68ki_write_32(addr+20, 0);
- m68ki_write_32(addr+24, 0x70000000);
+ m68ki_write_32(state, addr, 0x1f180000);
+ m68ki_write_32(state, addr + 4, 0);
+ m68ki_write_32(state, addr + 8, 0);
+ m68ki_write_32(state, addr + 12, 0);
+ m68ki_write_32(state, addr + 16, 0);
+ m68ki_write_32(state, addr + 20, 0);
+ m68ki_write_32(state, addr + 24, 0x70000000);
return 7*4 -4;
}
else
{
- m68ki_write_32(addr+4-4, 0x70000000);
- m68ki_write_32(addr+4-8, 0);
- m68ki_write_32(addr+4-12, 0);
- m68ki_write_32(addr+4-16, 0);
- m68ki_write_32(addr+4-20, 0);
- m68ki_write_32(addr+4-24, 0);
- m68ki_write_32(addr+4-28, 0x1f180000);
+ m68ki_write_32(state, addr + 4 - 4, 0x70000000);
+ m68ki_write_32(state, addr + 4 - 8, 0);
+ m68ki_write_32(state, addr + 4 - 12, 0);
+ m68ki_write_32(state, addr + 4 - 16, 0);
+ m68ki_write_32(state, addr + 4 - 20, 0);
+ m68ki_write_32(state, addr + 4 - 24, 0);
+ m68ki_write_32(state, addr + 4 - 28, 0x1f180000);
return -7*4 +4;
}
}
{
if (m68ki_cpu.fpu_just_reset)
{
- m68ki_write_32(addr, 0);
+ m68ki_write_32(state, addr, 0);
}
else
{
void m68040_do_frestore(m68ki_cpu_core *state, uint32 addr, int reg)
{
- uint32 temp = m68ki_read_32(addr);
+ uint32 temp = m68ki_read_32(state, addr);
// check for nullptr frame
if (temp & 0xff000000)
{
uint16 w2 = OPER_I_16(state);
// now check the condition
- if (TEST_CONDITION(w2 & 0x3f))
+ if (TEST_CONDITION(state, w2 & 0x3f))
{
// trap here
- m68ki_exception_trap(EXCEPTION_TRAPV);
+ m68ki_exception_trap(state, EXCEPTION_TRAPV);
}
else // fall through, requires eating the operand
{