Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opcode $f620 (move16 on 68040) #65

Open
dirkwhoffmann opened this issue Jan 4, 2020 · 0 comments
Open

Opcode $f620 (move16 on 68040) #65

dirkwhoffmann opened this issue Jan 4, 2020 · 0 comments

Comments

@dirkwhoffmann
Copy link

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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant