mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
debug menu unified, more debug tools
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@545 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
4c436138e4
commit
f579f7b891
17 changed files with 759 additions and 622 deletions
90
Pico/Pico.c
90
Pico/Pico.c
|
@ -348,93 +348,3 @@ void PicoGetInternal(pint_t which, pint_ret_t *r)
|
|||
// callback to output message from emu
|
||||
void (*PicoMessage)(const char *msg)=NULL;
|
||||
|
||||
#if 1 // defined(__DEBUG_PRINT)
|
||||
#define bit(r, x) ((r>>x)&1)
|
||||
#define MVP dstrp+=strlen(dstrp)
|
||||
void z80_debug(char *dstr);
|
||||
char *debugString(void)
|
||||
{
|
||||
#if 1
|
||||
static char dstr[1024];
|
||||
struct PicoVideo *pv=&Pico.video;
|
||||
unsigned char *reg=pv->reg, r;
|
||||
extern int HighPreSpr[];
|
||||
int i, sprites_lo, sprites_hi;
|
||||
char *dstrp;
|
||||
|
||||
sprites_lo = sprites_hi = 0;
|
||||
for (i = 0; HighPreSpr[i] != 0; i+=2)
|
||||
if (HighPreSpr[i+1] & 0x8000)
|
||||
sprites_hi++;
|
||||
else sprites_lo++;
|
||||
|
||||
dstrp = dstr;
|
||||
sprintf(dstrp, "mode set 1: %02x spr lo: %2i, spr hi: %2i\n", (r=reg[0]), sprites_lo, sprites_hi); MVP;
|
||||
sprintf(dstrp, "display_disable: %i, M3: %i, palette: %i, ?, hints: %i\n", bit(r,0), bit(r,1), bit(r,2), bit(r,4)); MVP;
|
||||
sprintf(dstrp, "mode set 2: %02x hcnt: %i\n", (r=reg[1]), pv->reg[10]); MVP;
|
||||
sprintf(dstrp, "SMS/gen: %i, pal: %i, dma: %i, vints: %i, disp: %i, TMS: %i\n",bit(r,2),bit(r,3),bit(r,4),bit(r,5),bit(r,6),bit(r,7)); MVP;
|
||||
sprintf(dstrp, "mode set 3: %02x\n", (r=reg[0xB])); MVP;
|
||||
sprintf(dstrp, "LSCR: %i, HSCR: %i, 2cell vscroll: %i, IE2: %i\n", bit(r,0), bit(r,1), bit(r,2), bit(r,3)); MVP;
|
||||
sprintf(dstrp, "mode set 4: %02x\n", (r=reg[0xC])); MVP;
|
||||
sprintf(dstrp, "interlace: %i%i, cells: %i, shadow: %i\n", bit(r,2), bit(r,1), (r&0x80) ? 40 : 32, bit(r,3)); MVP;
|
||||
sprintf(dstrp, "scroll size: w: %i, h: %i SRAM: %i; eeprom: %i (%i)\n", reg[0x10]&3, (reg[0x10]&0x30)>>4,
|
||||
bit(Pico.m.sram_reg, 4), bit(Pico.m.sram_reg, 2), SRam.eeprom_type); MVP;
|
||||
sprintf(dstrp, "sram range: %06x-%06x, reg: %02x\n", SRam.start, SRam.end, Pico.m.sram_reg); MVP;
|
||||
sprintf(dstrp, "pend int: v:%i, h:%i, vdp status: %04x\n", bit(pv->pending_ints,5), bit(pv->pending_ints,4), pv->status); MVP;
|
||||
sprintf(dstrp, "pal: %i, hw: %02x, frame#: %i\n", Pico.m.pal, Pico.m.hardware, Pico.m.frame_count); MVP;
|
||||
#if defined(EMU_C68K)
|
||||
sprintf(dstrp, "M68k: PC: %06x, st_flg: %x, cycles: %u\n", SekPc, PicoCpuCM68k.state_flags, SekCyclesDoneT()); MVP;
|
||||
sprintf(dstrp, "d0=%08x, a0=%08x, osp=%08x, irql=%i\n", PicoCpuCM68k.d[0], PicoCpuCM68k.a[0], PicoCpuCM68k.osp, PicoCpuCM68k.irq); MVP;
|
||||
sprintf(dstrp, "d1=%08x, a1=%08x, sr=%04x\n", PicoCpuCM68k.d[1], PicoCpuCM68k.a[1], CycloneGetSr(&PicoCpuCM68k)); dstrp+=strlen(dstrp); MVP;
|
||||
for(r=2; r < 8; r++) {
|
||||
sprintf(dstrp, "d%i=%08x, a%i=%08x\n", r, PicoCpuCM68k.d[r], r, PicoCpuCM68k.a[r]); MVP;
|
||||
}
|
||||
#elif defined(EMU_M68K)
|
||||
sprintf(dstrp, "M68k: PC: %06x, cycles: %u, irql: %i\n", SekPc, SekCyclesDoneT(), PicoCpuMM68k.int_level>>8); MVP;
|
||||
#elif defined(EMU_F68K)
|
||||
sprintf(dstrp, "M68k: PC: %06x, cycles: %u, irql: %i\n", SekPc, SekCyclesDoneT(), PicoCpuFM68k.interrupts[0]); MVP;
|
||||
#endif
|
||||
sprintf(dstrp, "z80Run: %i, z80_reset: %i, z80_bnk: %06x\n", Pico.m.z80Run, Pico.m.z80_reset, Pico.m.z80_bank68k<<15); MVP;
|
||||
z80_debug(dstrp); MVP;
|
||||
if (strlen(dstr) > sizeof(dstr))
|
||||
printf("warning: debug buffer overflow (%i/%i)\n", strlen(dstr), sizeof(dstr));
|
||||
|
||||
#else
|
||||
struct PicoVideo *pvid=&Pico.video;
|
||||
int table=0;
|
||||
int i,u,n,link=0;
|
||||
static char dstr[1024*8];
|
||||
dstr[0] = 0;
|
||||
|
||||
table=pvid->reg[5]&0x7f;
|
||||
if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode
|
||||
table<<=8; // Get sprite table address/2
|
||||
|
||||
for (i=u=n=0; u < 80 && n < 20; u++)
|
||||
{
|
||||
unsigned int *sprite;
|
||||
int code, code2, sx, sy, height;
|
||||
|
||||
sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
|
||||
// get sprite info
|
||||
code = sprite[0];
|
||||
|
||||
// check if it is on this line
|
||||
sy = (code&0x1ff);//-0x80;
|
||||
height = ((code>>24)&3)+1;
|
||||
|
||||
// masking sprite?
|
||||
code2 = sprite[1];
|
||||
sx = (code2>>16)&0x1ff;
|
||||
|
||||
printf("#%02i x: %03i y: %03i %ix%i\n", u, sx, sy, ((code>>26)&3)+1, height);
|
||||
|
||||
link=(code>>16)&0x7f;
|
||||
if(!link) break; // End of sprites
|
||||
}
|
||||
#endif
|
||||
|
||||
return dstr;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue