#include "PicoInt.h"\r
\r
+// note: set SPLIT_MOVEL_PD to 0\r
+\r
typedef unsigned char u8;\r
\r
static unsigned int pppc, ops=0;\r
extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16];\r
extern int lrp_cyc, lrp_mus, lwp_cyc, lwp_mus;\r
-unsigned int old_regs[16], old_sr, ppop;\r
+unsigned int old_regs[16], old_sr, ppop, have_illegal = 0;\r
+\r
+#undef dprintf\r
+#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
\r
//static\r
void dumpPCandExit()\r
\r
m68k_disassemble(buff, pppc, M68K_CPU_TYPE_68000);\r
dprintf("PC: %06x: %04x: %s", pppc, ppop, buff);\r
+ dprintf(" this | prev");\r
for(i=0; i < 8; i++)\r
dprintf("d%i=%08x, a%i=%08x | d%i=%08x, a%i=%08x", i, PicoCpu.d[i], i, PicoCpu.a[i], i, old_regs[i], i, old_regs[i+8]);\r
- dprintf("SR: %04x | %04x (??s? 0iii 000x nzvc)", CycloneGetSr(&PicoCpu), old_sr);\r
+ dprintf("SR: %04x | %04x (??s? 0iii 000x nzvc)", CycloneGetSr(&PicoCpu), old_sr);\r
dprintf("last_read: %08x @ %06x", lastread_d[--lrp_cyc&15], lastread_a);\r
dprintf("ops done: %i", ops);\r
exit(1);\r
\r
lrp_cyc = lrp_mus = 0;\r
\r
- while(cyc > cyc_done) {\r
- pppc = SekPc;\r
- ppop = m68k_read_disassembler_16(pppc);\r
- memcpy(old_regs, PicoCpu.d, 4*16);\r
- old_sr = CycloneGetSr(&PicoCpu);\r
+ while(cyc > cyc_done)\r
+ {\r
+ if (have_illegal && m68k_read_disassembler_16(m68ki_cpu.pc) != 0x4e73) // not rte\r
+ {\r
+ have_illegal = 0;\r
+ m68ki_cpu.pc += 2;\r
+ PicoCpu.pc=PicoCpu.checkpc(PicoCpu.pc + 2);\r
+ }\r
+ // hacks for test_misc2\r
+ if (m68ki_cpu.pc == 0x0002e0 && m68k_read_disassembler_16(m68ki_cpu.pc) == 0x4e73)\r
+ {\r
+ // get out of "priviledge violation" loop\r
+ have_illegal = 1;\r
+ //m68ki_cpu.s_flag = SFLAG_SET;\r
+ //PicoCpu.srh|=0x20;\r
+ }\r
+ if (PicoCpu.a[7] < 0x00ff0000 || PicoCpu.a[7] >= 0x01000000)\r
+ {\r
+ PicoCpu.a[7] = m68ki_cpu.dar[15] = 0xff8000;\r
+ }\r
\r
- PicoCpu.cycles=1;\r
+ pppc = SekPc;\r
+ ppop = m68k_read_disassembler_16(pppc);\r
+ memcpy(old_regs, PicoCpu.d, 4*16);\r
+ old_sr = CycloneGetSr(&PicoCpu);\r
+\r
+ //if (Pico.m.frame_count > 1400)\r
+ // dprintf("---");\r
+ {\r
+ char buff[128];\r
+ dprintf("---");\r
+ m68k_disassemble(buff, pppc, M68K_CPU_TYPE_68000);\r
+ dprintf("PC: %06x: %04x: %s", pppc, ppop, buff);\r
+ }\r
+\r
+ PicoCpu.cycles=1;\r
CycloneRun(&PicoCpu);\r
- cyc_cyclone=1-PicoCpu.cycles;\r
- cyc_musashi=m68k_execute(1);\r
-\r
- if(cyc_cyclone != cyc_musashi) {\r
- dprintf("cycles: %i vs %i", cyc_cyclone, cyc_musashi);\r
- err=1;\r
- }\r
-\r
- if(lrp_cyc != lrp_mus) {\r
- dprintf("lrp: %i vs %i", lrp_cyc&15, lrp_mus&15);\r
- err=1;\r
- }\r
-\r
- if(lwp_cyc != lwp_mus) {\r
- dprintf("lwp: %i vs %i", lwp_cyc&15, lwp_mus&15);\r
- err=1;\r
- }\r
-\r
- for(i=0; i < 16; i++) {\r
- if(lastwrite_cyc_d[i] != lastwrite_mus_d[i]) {\r
- dprintf("lastwrite: [%i]= %08x vs %08x", i, lastwrite_cyc_d[i], lastwrite_mus_d[i]);\r
- err=1;\r
- break;\r
- }\r
- }\r
-\r
- // compare PC\r
- if( SekPc != (m68ki_cpu.pc&0xffffff) ) {\r
- dprintf("PC: %06x vs %06x", SekPc, m68ki_cpu.pc&0xffffff);\r
- err=1;\r
- }\r
+ cyc_cyclone=1-PicoCpu.cycles;\r
+ cyc_musashi=m68k_execute(1);\r
+\r
+ if(cyc_cyclone != cyc_musashi) {\r
+ dprintf("cycles: %i vs %i", cyc_cyclone, cyc_musashi);\r
+ err=1;\r
+ }\r
+\r
+ if(lrp_cyc != lrp_mus) {\r
+ dprintf("lrp: %i vs %i", lrp_cyc&15, lrp_mus&15);\r
+ err=1;\r
+ }\r
+\r
+ if(lwp_cyc != lwp_mus) {\r
+ dprintf("lwp: %i vs %i", lwp_cyc&15, lwp_mus&15);\r
+ err=1;\r
+ }\r
+\r
+ for(i=0; i < 16; i++) {\r
+ if(lastwrite_cyc_d[i] != lastwrite_mus_d[i]) {\r
+ dprintf("lastwrite: [%i]= %08x vs %08x", i, lastwrite_cyc_d[i], lastwrite_mus_d[i]);\r
+ err=1;\r
+ break;\r
+ }\r
+ }\r
+\r
+ // compare PC\r
+ m68ki_cpu.pc&=~1;\r
+ if( SekPc != (m68ki_cpu.pc&0xffffff) ) {\r
+ dprintf("PC: %06x vs %06x", SekPc, m68ki_cpu.pc&0xffffff);\r
+ err=1;\r
+ }\r
\r
#if 0\r
- if( SekPc > Pico.romsize || SekPc < 0x200 ) {\r
- dprintf("PC out of bounds: %06x", SekPc);\r
- err=1;\r
- }\r
+ if( SekPc > Pico.romsize || SekPc < 0x200 ) {\r
+ dprintf("PC out of bounds: %06x", SekPc);\r
+ err=1;\r
+ }\r
#endif\r
\r
// compare regs\r
- for(i=0; i < 16; i++) {\r
- if(PicoCpu.d[i] != m68ki_cpu.dar[i]) {\r
- str = (i < 8) ? "d" : "a";\r
- dprintf("reg: %s%i: %08x vs %08x", str, i&7, PicoCpu.d[i], m68ki_cpu.dar[i]);\r
- err=1;\r
- break;\r
- }\r
- }\r
-\r
- // SR\r
- if((CycloneGetSr(&PicoCpu)) != (mu_sr = m68k_get_reg(NULL, M68K_REG_SR))) {\r
- dprintf("SR: %04x vs %04x (??s? 0iii 000x nzvc)", CycloneGetSr(&PicoCpu), mu_sr);\r
- err=1;\r
- }\r
-\r
- // IRQl\r
- if(PicoCpu.irq != (m68ki_cpu.int_level>>8)) {\r
- dprintf("IRQ: %i vs %i", PicoCpu.irq, (m68ki_cpu.int_level>>8));\r
- err=1;\r
- }\r
-\r
- // OSP/USP\r
- if(PicoCpu.osp != m68ki_cpu.sp[((mu_sr>>11)&4)^4]) {\r
- dprintf("OSP: %06x vs %06x", PicoCpu.osp, m68ki_cpu.sp[0]);\r
- err=1;\r
- }\r
-\r
- // stopped\r
- if((PicoCpu.stopped && !m68ki_cpu.stopped) || (!PicoCpu.stopped && m68ki_cpu.stopped)) {\r
- dprintf("stopped: %i vs %i", PicoCpu.stopped, m68ki_cpu.stopped);\r
- err=1;\r
- }\r
+ for(i=0; i < 16; i++) {\r
+ if(PicoCpu.d[i] != m68ki_cpu.dar[i]) {\r
+ str = (i < 8) ? "d" : "a";\r
+ dprintf("reg: %s%i: %08x vs %08x", str, i&7, PicoCpu.d[i], m68ki_cpu.dar[i]);\r
+ err=1;\r
+ }\r
+ }\r
+\r
+ // SR\r
+ if((CycloneGetSr(&PicoCpu)) != (mu_sr = m68k_get_reg(NULL, M68K_REG_SR))) {\r
+ dprintf("SR: %04x vs %04x (??s? 0iii 000x nzvc)", CycloneGetSr(&PicoCpu), mu_sr);\r
+ err=1;\r
+ }\r
+\r
+ // IRQl\r
+ if(PicoCpu.irq != (m68ki_cpu.int_level>>8)) {\r
+ dprintf("IRQ: %i vs %i", PicoCpu.irq, (m68ki_cpu.int_level>>8));\r
+ err=1;\r
+ }\r
+\r
+ // OSP/USP\r
+ if(PicoCpu.osp != m68ki_cpu.sp[((mu_sr>>11)&4)^4]) {\r
+ dprintf("OSP: %06x vs %06x", PicoCpu.osp, m68ki_cpu.sp[0]);\r
+ err=1;\r
+ }\r
+\r
+ // stopped\r
+ if((PicoCpu.stopped && !m68ki_cpu.stopped) || (!PicoCpu.stopped && m68ki_cpu.stopped)) {\r
+ dprintf("stopped: %i vs %i", PicoCpu.stopped, m68ki_cpu.stopped);\r
+ err=1;\r
+ }\r
\r
if(err) dumpPCandExit();\r
\r
#if 0\r
m68k_set_reg(M68K_REG_SR, ((mu_sr-1)&~0x2000)|(mu_sr&0x2000)); // broken\r
- CycloneSetSr(&PicoCpu, ((mu_sr-1)&~0x2000)|(mu_sr&0x2000));\r
+ CycloneSetSr(&PicoCpu, ((mu_sr-1)&~0x2000)|(mu_sr&0x2000));\r
PicoCpu.stopped = m68ki_cpu.stopped = 0;\r
- if(SekPc > 0x400 && (PicoCpu.a[7] < 0xff0000 || PicoCpu.a[7] > 0xffffff)) \r
- PicoCpu.a[7] = m68ki_cpu.dar[15] = 0xff8000;\r
+ if(SekPc > 0x400 && (PicoCpu.a[7] < 0xff0000 || PicoCpu.a[7] > 0xffffff))\r
+ PicoCpu.a[7] = m68ki_cpu.dar[15] = 0xff8000;\r
#endif\r
\r
- cyc_done += cyc_cyclone;\r
- ops++;\r
+ cyc_done += cyc_cyclone;\r
+ ops++;\r
}\r
\r
return cyc_done;\r