Musashi icon indicating copy to clipboard operation
Musashi copied to clipboard

Opcode $f620 (move16 on 68040)

Open dirkwhoffmann opened this issue 6 years ago • 0 comments

According to

{m68k_op_move16_32           , 0xfff8, 0xf620, {  0,   0,   0,   4}},

move16_32 is only available on the 68040, but there is no CPU type check inside the execution handler:

static void m68k_op_move16_32(void)
{
	uint16 w2 = OPER_I_16();
	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));

	REG_A[ax] += 16;
	REG_A[ay] += 16;
}

I guess, it should be something like this:

static void m68k_op_move16_32(void)
{
    if(CPU_TYPE_IS_040_PLUS(CPU_TYPE))
    {
        uint16 w2 = OPER_I_16();
        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));

        REG_A[ax] += 16;
        REG_A[ay] += 16;
        return;
    }

    m68ki_exception_1111();
}

dirkwhoffmann avatar Jan 04 '20 09:01 dirkwhoffmann