Open EtchedPixels opened 5 years ago
From what you are saying, the correct writing to cacr would be in m68k_in.c, function M68KMAKE_OP(movec, 32, rc, .), it looks like this : case 0x002: / CACR / if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) { if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) { REG_CACR = REG_DA[(word2 >> 12) & 15]; } else { / non 68040 can only set the lower 4 bits (C,CE,F,E) / REG_CACR = REG_DA[(word2 >> 12) & 15] & 0x0f; } return; } m68ki_exception_illegal(); return; it's a customized musashi here including a patch for the 68040, but you get the idea The function to read is the one just before this one, the equivalent code looks like this : case 0x002: / CACR / if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) { REG_DA[(word2 >> 12) & 15] = REG_CACR; return; } return; So the fix would take only 1 line, adding m68ki_exception_illegal(); just before the return. I have no doc to confirm this (afaik), and mame didn't find the problem yet apparently (at least not until the 209 version, after that they changed so much the m68k_in.c file that it becomes very hard to follow). At least it's easy to fix on your side for now...
The instruction
acts as a no-op in the emulator on a 68010 rather than trapping with an illegal. It behaves correctly on all other CPU types.
I think there is an m68ki_exception_illegal() missing in the switch. Writing CACR behaves correctly.