}
/* -- Helper function for MMU instructions -- */
-static uae_u32 mmu_op30_helper_get_fc(uae_u16 next) {
+static bool mmu_op30_helper_get_fc(uae_u16 next, uae_u32 *fc) {
switch (next & 0x0018) {
case 0x0010:
- return (next & 0x7);
+ *fc = next & 0x7;
+ return true;
case 0x0008:
- return (m68k_dreg(regs, next & 0x7) & 0x7);
+ *fc = m68k_dreg(regs, next & 0x7) & 0x7;
+ return true;
case 0x0000:
if (next & 1) {
- return (regs.dfc);
+ *fc = regs.dfc;
} else {
- return (regs.sfc);
+ *fc = regs.sfc;
}
+ return true;
default:
write_log(_T("MMU_OP30 ERROR: bad fc source! (%04X)\n"), next & 0x0018);
- return 0;
+ return false;
}
}
int rw = (next >> 9) & 1;
int a = (next >> 8) & 1;
int areg = (next&0xE0)>>5;
- uae_u32 fc = mmu_op30_helper_get_fc(next);
- bool write = rw ? false : true;
+ uae_u32 fc;
+ bool write = rw ? false : true;
uae_u32 ret = 0;
if (mmu_op30_invea(opcode))
return true;
- if (!level && a) {
+ if (!mmu_op30_helper_get_fc(next, &fc))
+ return true;
+ if (!level && a) {
write_log(_T("PTEST: Bad instruction causing F-line unimplemented instruction exception!\n"));
return true;
}
{
int rw = (next >> 9) & 1;
int unused = (next & (0x100 | 0x80 | 0x40 | 0x20));
- uae_u32 fc = mmu_op30_helper_get_fc(next);
+ uae_u32 fc;
bool write = rw ? false : true;
if (mmu_op30_invea(opcode))
return true;
if (unused)
return true;
+ if (!mmu_op30_helper_get_fc(next, &fc))
+ return true;
#if 0
write_log (_T("PLOAD%c: Create ATC entry for %08X, FC = %i\n"), write?'W':'R', extra, fc);
bool mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
{
uae_u16 mode = (next >> 8) & 31;
- uae_u32 fc_mask = (uae_u32)(next & 0x00E0) >> 5;
- uae_u32 fc_base = mmu_op30_helper_get_fc(next);
+ uae_u32 fc_mask = (next & 0x00E0) >> 5;
+ uae_u32 fc_base;
uae_u32 fc_bits = next & 0x7f;
#if 0
mmu030_flush_atc_all();
break;
case 0x10:
+ if (!mmu_op30_helper_get_fc(next, &fc_base))
+ return true;
mmu030_flush_atc_fc(fc_base, fc_mask);
break;
case 0x18:
if (mmu_op30_invea(opcode))
return true;
- mmu030_flush_atc_page_fc(extra, fc_base, fc_mask);
+ if (!mmu_op30_helper_get_fc(next, &fc_base))
+ return true;
+ mmu030_flush_atc_page_fc(extra, fc_base, fc_mask);
break;
default:
write_log(_T("PFLUSH %04x-%04x ERROR: bad mode! (%i)\n"), opcode, next, mode);
}
}
-static void mmu_op30_helper_get_fc(uae_u16 extra, TCHAR *out)
+static bool mmu_op30_helper_get_fc(uae_u16 extra, TCHAR *out)
{
switch (extra & 0x0018) {
case 0x0010:
_stprintf(out, _T("#%d"), extra & 7);
- return;
+ return true;
case 0x0008:
_stprintf(out, _T("D%d"), extra & 7);
- return;
+ return true;
case 0x0000:
if (extra & 1) {
_tcscpy(out, _T("DFC"));
} else {
_tcscpy(out, _T("SFC"));
}
- return;
+ return true;
default:
- _tcscpy(out, _T("??"));
- return;
+ return false;
}
}
{
int type = extra >> 13;
+ _tcscpy(instrname, _T("F-LINE (MMU 68030)"));
pc += 2;
+
switch (type)
{
case 0:
int unused = (extra & 0xff);
TCHAR *r = NULL;
- _tcscpy(instrname, _T("PMOVE"));
- if (fd)
- _tcscat(instrname, _T("FD"));
- _tcscat(instrname, _T(" "));
-
- if (!rw) {
- pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, safemode);
- _tcscat(instrname, _T(","));
- }
+ if (mmu_op30_invea(opcode))
+ break;
+ if (unused)
+ break;
+ if (rw && fd)
+ break;
switch (preg)
{
case 0x10:
case 0x03:
r = _T("TT1");
break;
- default:
- r = _T("??");
+ }
+ if (!r)
break;
+
+ _tcscpy(instrname, _T("PMOVE"));
+ if (fd)
+ _tcscat(instrname, _T("FD"));
+ _tcscat(instrname, _T(" "));
+
+ if (!rw) {
+ pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, safemode);
+ _tcscat(instrname, _T(","));
}
_tcscat(instrname, r);
if (rw) {
{
// PLOAD/PFLUSH
uae_u16 mode = (extra >> 8) & 31;
+ int unused = (extra & (0x100 | 0x80 | 0x40 | 0x20));
uae_u16 fc_mask = (extra & 0x00E0) >> 5;
uae_u16 fc_bits = extra & 0x7f;
TCHAR fc[10];
- mmu_op30_helper_get_fc(extra, fc);
+ if (unused)
+ break;
+
switch (mode) {
case 0x00: // PLOAD W
case 0x02: // PLOAD R
+ if (mmu_op30_invea(opcode))
+ break;
_stprintf(instrname, _T("PLOAD%c %s,"), mode == 0 ? 'W' : 'R', fc);
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, safemode);
break;
case 0x04: // PFLUSHA
+ if (fc_bits)
+ break;
_tcscpy(instrname, _T("PFLUSHA"));
break;
case 0x10: // FC
- case 0x18: // FC + EA
+ if (!mmu_op30_helper_get_fc(extra, fc))
+ break;
_stprintf(instrname, _T("PFLUSH %s,%d"), fc, fc_mask);
- if (mode == 0x18) {
- _tcscat(instrname, _T(","));
- pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, safemode);
- }
break;
- default:
- _tcscpy(instrname, _T("PFLUSH??"));
+ case 0x18: // FC + EA
+ if (mmu_op30_invea(opcode))
+ break;
+ if (!mmu_op30_helper_get_fc(extra, fc))
+ break;
+ _stprintf(instrname, _T("PFLUSH %s,%d"), fc, fc_mask);
+ _tcscat(instrname, _T(","));
+ pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, safemode);
break;
}
break;
int areg = (extra & 0xE0) >> 5;
TCHAR fc[10];
- mmu_op30_helper_get_fc(extra, fc);
+ if (mmu_op30_invea(opcode))
+ break;
+ if (!mmu_op30_helper_get_fc(extra, fc))
+ break;
+ if (!level && a)
+ break;
_stprintf(instrname, _T("PTEST%c %s,"), rw ? 'R' : 'W', fc);
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, safemode);
_stprintf(instrname + _tcslen(instrname), _T(",#%d"), level);
_stprintf(instrname + _tcslen(instrname), _T(",A%d"), areg);
break;
}
- default:
- _tcscpy(instrname, _T("F-LINE"));
- break;
}
return pc;
}