cyclone_debug improvements

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@182 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-07-05 20:28:32 +00:00
parent 03c5768cb5
commit aa15fda82c
4 changed files with 111 additions and 70 deletions

View file

@ -1,11 +1,16 @@
#include "PicoInt.h"
// note: set SPLIT_MOVEL_PD to 0
typedef unsigned char u8;
static unsigned int pppc, ops=0;
extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16];
extern int lrp_cyc, lrp_mus, lwp_cyc, lwp_mus;
unsigned int old_regs[16], old_sr, ppop;
unsigned int old_regs[16], old_sr, ppop, have_illegal = 0;
#undef dprintf
#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
//static
void dumpPCandExit()
@ -15,6 +20,7 @@ void dumpPCandExit()
m68k_disassemble(buff, pppc, M68K_CPU_TYPE_68000);
dprintf("PC: %06x: %04x: %s", pppc, ppop, buff);
dprintf(" this | prev");
for(i=0; i < 8; i++)
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]);
dprintf("SR: %04x | %04x (??s? 0iii 000x nzvc)", CycloneGetSr(&PicoCpu), old_sr);
@ -31,12 +37,41 @@ int CM_compareRun(int cyc)
lrp_cyc = lrp_mus = 0;
while(cyc > cyc_done) {
while(cyc > cyc_done)
{
if (have_illegal && m68k_read_disassembler_16(m68ki_cpu.pc) != 0x4e73) // not rte
{
have_illegal = 0;
m68ki_cpu.pc += 2;
PicoCpu.pc=PicoCpu.checkpc(PicoCpu.pc + 2);
}
// hacks for test_misc2
if (m68ki_cpu.pc == 0x0002e0 && m68k_read_disassembler_16(m68ki_cpu.pc) == 0x4e73)
{
// get out of "priviledge violation" loop
have_illegal = 1;
//m68ki_cpu.s_flag = SFLAG_SET;
//PicoCpu.srh|=0x20;
}
if (PicoCpu.a[7] < 0x00ff0000 || PicoCpu.a[7] >= 0x01000000)
{
PicoCpu.a[7] = m68ki_cpu.dar[15] = 0xff8000;
}
pppc = SekPc;
ppop = m68k_read_disassembler_16(pppc);
memcpy(old_regs, PicoCpu.d, 4*16);
old_sr = CycloneGetSr(&PicoCpu);
//if (Pico.m.frame_count > 1400)
// dprintf("---");
{
char buff[128];
dprintf("---");
m68k_disassemble(buff, pppc, M68K_CPU_TYPE_68000);
dprintf("PC: %06x: %04x: %s", pppc, ppop, buff);
}
PicoCpu.cycles=1;
CycloneRun(&PicoCpu);
cyc_cyclone=1-PicoCpu.cycles;
@ -66,6 +101,7 @@ int CM_compareRun(int cyc)
}
// compare PC
m68ki_cpu.pc&=~1;
if( SekPc != (m68ki_cpu.pc&0xffffff) ) {
dprintf("PC: %06x vs %06x", SekPc, m68ki_cpu.pc&0xffffff);
err=1;
@ -84,7 +120,6 @@ int CM_compareRun(int cyc)
str = (i < 8) ? "d" : "a";
dprintf("reg: %s%i: %08x vs %08x", str, i&7, PicoCpu.d[i], m68ki_cpu.dar[i]);
err=1;
break;
}
}

View file

@ -8701,6 +8701,7 @@ M68KMAKE_OP(rol, 32, r, .)
*r_dst = res;
FLAG_C = (src >> (32 - shift)) << 8;
if (shift == 0) FLAG_C = src << 8; // notaz
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
FLAG_V = VFLAG_CLEAR;

View file

@ -1955,7 +1955,10 @@ void m68ki_exception_interrupt(uint int_level)
/* If we are halted, don't do anything */
if(CPU_STOPPED)
{
printf("mu stopped! (%x)\n", CPU_STOPPED);
return;
}
/* Acknowledge the interrupt */
vector = m68ki_int_ack(int_level);
@ -2012,6 +2015,7 @@ void m68ki_exception_interrupt(uint int_level)
/* ASG: Check for interrupts */
INLINE void m68ki_check_interrupts(void)
{
//printf("mu level, mask: %04x %04x\n", CPU_INT_LEVEL, FLAG_INT_MASK);
if(CPU_INT_LEVEL > FLAG_INT_MASK)
m68ki_exception_interrupt(CPU_INT_LEVEL>>8);
}

View file

@ -3181,6 +3181,7 @@ void m68k_op_rol_32_r(void)
*r_dst = res;
FLAG_C = (src >> (32 - shift)) << 8;
if (shift == 0) FLAG_C = src << 8; // notaz
FLAG_N = NFLAG_32(res);
FLAG_Z = res;
FLAG_V = VFLAG_CLEAR;