mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
fix various logging issues
This commit is contained in:
parent
9db6a54485
commit
ebd70cb5d9
5 changed files with 38 additions and 21 deletions
|
@ -87,7 +87,7 @@ static u32 PicoRead16_svpr(u32 a)
|
||||||
a15004_looping = 0;
|
a15004_looping = 0;
|
||||||
|
|
||||||
if (!a15004_looping)
|
if (!a15004_looping)
|
||||||
elprintf(EL_SVP, "SVP r%i: [%06x] %04x @%06x", realsize, a, d, SekPc);
|
elprintf(EL_SVP, "SVP r: [%06x] %04x @%06x", a, d, SekPc);
|
||||||
|
|
||||||
if (a == 0xa15004 && !(d&1)) {
|
if (a == 0xa15004 && !(d&1)) {
|
||||||
if (!a15004_looping)
|
if (!a15004_looping)
|
||||||
|
|
23
pico/debug.c
23
pico/debug.c
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "pico_int.h"
|
#include "pico_int.h"
|
||||||
#include "sound/ym2612.h"
|
#include "sound/ym2612.h"
|
||||||
|
#include "memory.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#define bit(r, x) ((r>>x)&1)
|
#define bit(r, x) ((r>>x)&1)
|
||||||
|
@ -42,7 +43,7 @@ char *PDebugMain(void)
|
||||||
!!(SRam.flags & SRF_ENABLED), !!(SRam.flags & SRF_EEPROM), SRam.eeprom_type); MVP;
|
!!(SRam.flags & SRF_ENABLED), !!(SRam.flags & SRF_EEPROM), SRam.eeprom_type); MVP;
|
||||||
sprintf(dstrp, "sram range: %06x-%06x, reg: %02x\n", SRam.start, SRam.end, Pico.m.sram_reg); 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, "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, cycles: %i\n", Pico.m.pal, Pico.m.hardware, Pico.m.frame_count, SekCyclesDone()); MVP;
|
sprintf(dstrp, "pal: %i, hw: %02x, frame#: %i, cycles: %u\n", Pico.m.pal, Pico.m.hardware, Pico.m.frame_count, SekCyclesDone()); MVP;
|
||||||
sprintf(dstrp, "M68k: PC: %06x, SR: %04x, irql: %i\n", SekPc, SekSr, SekIrqLevel); MVP;
|
sprintf(dstrp, "M68k: PC: %06x, SR: %04x, irql: %i\n", SekPc, SekSr, SekIrqLevel); MVP;
|
||||||
for (r = 0; r < 8; r++) {
|
for (r = 0; r < 8; r++) {
|
||||||
sprintf(dstrp, "d%i=%08x, a%i=%08x\n", r, SekDar(r), r, SekDar(r+8)); MVP;
|
sprintf(dstrp, "d%i=%08x, a%i=%08x\n", r, SekDar(r), r, SekDar(r+8)); MVP;
|
||||||
|
@ -279,7 +280,7 @@ void PDebugShowSprite(unsigned short *screen, int stride, int which)
|
||||||
pvid->debug_p = olddbg;
|
pvid->debug_p = olddbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define dump_ram(ram,fname) \
|
#define dump_ram_m(ram,fname,mode) \
|
||||||
{ \
|
{ \
|
||||||
unsigned short *sram = (unsigned short *) ram; \
|
unsigned short *sram = (unsigned short *) ram; \
|
||||||
FILE *f; \
|
FILE *f; \
|
||||||
|
@ -287,7 +288,7 @@ void PDebugShowSprite(unsigned short *screen, int stride, int which)
|
||||||
\
|
\
|
||||||
for (i = 0; i < sizeof(ram)/2; i++) \
|
for (i = 0; i < sizeof(ram)/2; i++) \
|
||||||
sram[i] = (sram[i]<<8) | (sram[i]>>8); \
|
sram[i] = (sram[i]<<8) | (sram[i]>>8); \
|
||||||
f = fopen(fname, "wb"); \
|
f = fopen(fname, mode); \
|
||||||
if (f) { \
|
if (f) { \
|
||||||
fwrite(ram, 1, sizeof(ram), f); \
|
fwrite(ram, 1, sizeof(ram), f); \
|
||||||
fclose(f); \
|
fclose(f); \
|
||||||
|
@ -296,6 +297,9 @@ void PDebugShowSprite(unsigned short *screen, int stride, int which)
|
||||||
sram[i] = (sram[i]<<8) | (sram[i]>>8); \
|
sram[i] = (sram[i]<<8) | (sram[i]>>8); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define dump_ram(ram,fname) \
|
||||||
|
dump_ram_m(ram,fname,"wb")
|
||||||
|
|
||||||
#define dump_ram_noswab(ram,fname) \
|
#define dump_ram_noswab(ram,fname) \
|
||||||
{ \
|
{ \
|
||||||
FILE *f; \
|
FILE *f; \
|
||||||
|
@ -308,6 +312,19 @@ void PDebugShowSprite(unsigned short *screen, int stride, int which)
|
||||||
|
|
||||||
void PDebugDumpMem(void)
|
void PDebugDumpMem(void)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
char buf[1 << M68K_MEM_SHIFT];
|
||||||
|
unsigned int a;
|
||||||
|
for (a = 0; ; a++) {
|
||||||
|
uptr v = m68k_read16_map[a];
|
||||||
|
if (map_flag_set(v))
|
||||||
|
break;
|
||||||
|
v <<= 1;
|
||||||
|
v += a << M68K_MEM_SHIFT;
|
||||||
|
memcpy(buf, (void *)v, sizeof(buf));
|
||||||
|
dump_ram_m(buf, "dumps/cart.bin", a ? "ab" : "wb");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
dump_ram_noswab(Pico.zram, "dumps/zram.bin");
|
dump_ram_noswab(Pico.zram, "dumps/zram.bin");
|
||||||
dump_ram(Pico.cram, "dumps/cram.bin");
|
dump_ram(Pico.cram, "dumps/cram.bin");
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ static int z80_cycles_from_68k(void)
|
||||||
void NOINLINE ctl_write_z80busreq(u32 d)
|
void NOINLINE ctl_write_z80busreq(u32 d)
|
||||||
{
|
{
|
||||||
d&=1; d^=1;
|
d&=1; d^=1;
|
||||||
elprintf(EL_BUSREQ, "set_zrun: %i->%i [%i] @%06x", Pico.m.z80Run, d, SekCyclesDone(), SekPc);
|
elprintf(EL_BUSREQ, "set_zrun: %i->%i [%u] @%06x", Pico.m.z80Run, d, SekCyclesDone(), SekPc);
|
||||||
if (d ^ Pico.m.z80Run)
|
if (d ^ Pico.m.z80Run)
|
||||||
{
|
{
|
||||||
if (d)
|
if (d)
|
||||||
|
@ -363,7 +363,7 @@ void NOINLINE ctl_write_z80busreq(u32 d)
|
||||||
void NOINLINE ctl_write_z80reset(u32 d)
|
void NOINLINE ctl_write_z80reset(u32 d)
|
||||||
{
|
{
|
||||||
d&=1; d^=1;
|
d&=1; d^=1;
|
||||||
elprintf(EL_BUSREQ, "set_zreset: %i->%i [%i] @%06x", Pico.m.z80_reset, d, SekCyclesDone(), SekPc);
|
elprintf(EL_BUSREQ, "set_zreset: %i->%i [%u] @%06x", Pico.m.z80_reset, d, SekCyclesDone(), SekPc);
|
||||||
if (d ^ Pico.m.z80_reset)
|
if (d ^ Pico.m.z80_reset)
|
||||||
{
|
{
|
||||||
if (d)
|
if (d)
|
||||||
|
@ -593,7 +593,7 @@ u32 PicoRead8_io(u32 a)
|
||||||
|
|
||||||
if ((a & 0xff01) == 0x1100) { // z80 busreq (verified)
|
if ((a & 0xff01) == 0x1100) { // z80 busreq (verified)
|
||||||
d |= (Pico.m.z80Run | Pico.m.z80_reset) & 1;
|
d |= (Pico.m.z80Run | Pico.m.z80_reset) & 1;
|
||||||
elprintf(EL_BUSREQ, "get_zrun: %02x [%i] @%06x", d, SekCyclesDone(), SekPc);
|
elprintf(EL_BUSREQ, "get_zrun: %02x [%u] @%06x", d, SekCyclesDone(), SekPc);
|
||||||
}
|
}
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ u32 PicoRead16_io(u32 a)
|
||||||
|
|
||||||
if ((a & 0xff00) == 0x1100) { // z80 busreq
|
if ((a & 0xff00) == 0x1100) { // z80 busreq
|
||||||
d |= ((Pico.m.z80Run | Pico.m.z80_reset) & 1) << 8;
|
d |= ((Pico.m.z80Run | Pico.m.z80_reset) & 1) << 8;
|
||||||
elprintf(EL_BUSREQ, "get_zrun: %04x [%i] @%06x", d, SekCyclesDone(), SekPc);
|
elprintf(EL_BUSREQ, "get_zrun: %04x [%u] @%06x", d, SekCyclesDone(), SekPc);
|
||||||
}
|
}
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
12
pico/sek.c
12
pico/sek.c
|
@ -36,8 +36,8 @@ M68K_CONTEXT PicoCpuFM68k;
|
||||||
static int SekIntAck(int level)
|
static int SekIntAck(int level)
|
||||||
{
|
{
|
||||||
// try to emulate VDP's reaction to 68000 int ack
|
// try to emulate VDP's reaction to 68000 int ack
|
||||||
if (level == 4) { Pico.video.pending_ints = 0; elprintf(EL_INTS, "hack: @ %06x [%i]", SekPc, SekCycleCnt); }
|
if (level == 4) { Pico.video.pending_ints = 0; elprintf(EL_INTS, "hack: @ %06x [%u]", SekPc, SekCycleCnt); }
|
||||||
else if(level == 6) { Pico.video.pending_ints &= ~0x20; elprintf(EL_INTS, "vack: @ %06x [%i]", SekPc, SekCycleCnt); }
|
else if(level == 6) { Pico.video.pending_ints &= ~0x20; elprintf(EL_INTS, "vack: @ %06x [%u]", SekPc, SekCycleCnt); }
|
||||||
PicoCpuCM68k.irq = 0;
|
PicoCpuCM68k.irq = 0;
|
||||||
return CYCLONE_INT_ACK_AUTOVECTOR;
|
return CYCLONE_INT_ACK_AUTOVECTOR;
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,8 @@ static int SekUnrecognizedOpcode()
|
||||||
#ifdef EMU_M68K
|
#ifdef EMU_M68K
|
||||||
static int SekIntAckM68K(int level)
|
static int SekIntAckM68K(int level)
|
||||||
{
|
{
|
||||||
if (level == 4) { Pico.video.pending_ints = 0; elprintf(EL_INTS, "hack: @ %06x [%i]", SekPc, SekCycleCnt); }
|
if (level == 4) { Pico.video.pending_ints = 0; elprintf(EL_INTS, "hack: @ %06x [%u]", SekPc, SekCycleCnt); }
|
||||||
else if(level == 6) { Pico.video.pending_ints &= ~0x20; elprintf(EL_INTS, "vack: @ %06x [%i]", SekPc, SekCycleCnt); }
|
else if(level == 6) { Pico.video.pending_ints &= ~0x20; elprintf(EL_INTS, "vack: @ %06x [%u]", SekPc, SekCycleCnt); }
|
||||||
CPU_INT_LEVEL = 0;
|
CPU_INT_LEVEL = 0;
|
||||||
return M68K_INT_ACK_AUTOVECTOR;
|
return M68K_INT_ACK_AUTOVECTOR;
|
||||||
}
|
}
|
||||||
|
@ -94,11 +94,11 @@ static void SekIntAckF68K(unsigned level)
|
||||||
{
|
{
|
||||||
if (level == 4) {
|
if (level == 4) {
|
||||||
Pico.video.pending_ints = 0;
|
Pico.video.pending_ints = 0;
|
||||||
elprintf(EL_INTS, "hack: @ %06x [%i]", SekPc, SekCyclesDone());
|
elprintf(EL_INTS, "hack: @ %06x [%u]", SekPc, SekCyclesDone());
|
||||||
}
|
}
|
||||||
else if(level == 6) {
|
else if(level == 6) {
|
||||||
Pico.video.pending_ints &= ~0x20;
|
Pico.video.pending_ints &= ~0x20;
|
||||||
elprintf(EL_INTS, "vack: @ %06x [%i]", SekPc, SekCyclesDone());
|
elprintf(EL_INTS, "vack: @ %06x [%u]", SekPc, SekCyclesDone());
|
||||||
}
|
}
|
||||||
PicoCpuFM68k.interrupts[0] = 0;
|
PicoCpuFM68k.interrupts[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ static void DmaCopy(int len)
|
||||||
unsigned char *vr = (unsigned char *) Pico.vram;
|
unsigned char *vr = (unsigned char *) Pico.vram;
|
||||||
unsigned char inc=Pico.video.reg[0xf];
|
unsigned char inc=Pico.video.reg[0xf];
|
||||||
int source;
|
int source;
|
||||||
elprintf(EL_VDPDMA, "DmaCopy len %i [%i]", len, SekCyclesDone());
|
elprintf(EL_VDPDMA, "DmaCopy len %i [%u]", len, SekCyclesDone());
|
||||||
|
|
||||||
Pico.m.dma_xfers += len;
|
Pico.m.dma_xfers += len;
|
||||||
if (Pico.m.dma_xfers < len)
|
if (Pico.m.dma_xfers < len)
|
||||||
|
@ -254,7 +254,7 @@ static NOINLINE void DmaFill(int data)
|
||||||
int len, l;
|
int len, l;
|
||||||
|
|
||||||
len = GetDmaLength();
|
len = GetDmaLength();
|
||||||
elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%i]", len, inc, SekCyclesDone());
|
elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%u]", len, inc, SekCyclesDone());
|
||||||
|
|
||||||
Pico.m.dma_xfers += len;
|
Pico.m.dma_xfers += len;
|
||||||
if (Pico.m.dma_xfers < len) // lame 16bit var
|
if (Pico.m.dma_xfers < len) // lame 16bit var
|
||||||
|
@ -430,11 +430,11 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
|
||||||
switch (num)
|
switch (num)
|
||||||
{
|
{
|
||||||
case 0x00:
|
case 0x00:
|
||||||
elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x10)>>4,
|
elprintf(EL_INTSW, "hint_onoff: %i->%i [%u] pend=%i @ %06x", (dold&0x10)>>4,
|
||||||
(d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);
|
(d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);
|
||||||
goto update_irq;
|
goto update_irq;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x20)>>5,
|
elprintf(EL_INTSW, "vint_onoff: %i->%i [%u] pend=%i @ %06x", (dold&0x20)>>5,
|
||||||
(d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);
|
(d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);
|
||||||
goto update_irq;
|
goto update_irq;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
|
@ -551,7 +551,7 @@ PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a)
|
||||||
d = hcounts_40[d];
|
d = hcounts_40[d];
|
||||||
else d = hcounts_32[d];
|
else d = hcounts_32[d];
|
||||||
|
|
||||||
elprintf(EL_HVCNT, "hv: %02x %02x (%i) @ %06x", d, Pico.video.v_counter, SekCyclesDone(), SekPc);
|
elprintf(EL_HVCNT, "hv: %02x %02x [%u] @ %06x", d, Pico.video.v_counter, SekCyclesDone(), SekPc);
|
||||||
return d | (Pico.video.v_counter << 8);
|
return d | (Pico.video.v_counter << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ unsigned char PicoVideoRead8CtlL(void)
|
||||||
|
|
||||||
unsigned char PicoVideoRead8HV_H(void)
|
unsigned char PicoVideoRead8HV_H(void)
|
||||||
{
|
{
|
||||||
elprintf(EL_HVCNT, "vcounter: %02x (%i) @ %06x", Pico.video.v_counter, SekCyclesDone(), SekPc);
|
elprintf(EL_HVCNT, "vcounter: %02x [%u] @ %06x", Pico.video.v_counter, SekCyclesDone(), SekPc);
|
||||||
return Pico.video.v_counter;
|
return Pico.video.v_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ unsigned char PicoVideoRead8HV_L(void)
|
||||||
if (Pico.video.reg[12]&1)
|
if (Pico.video.reg[12]&1)
|
||||||
d = hcounts_40[d];
|
d = hcounts_40[d];
|
||||||
else d = hcounts_32[d];
|
else d = hcounts_32[d];
|
||||||
elprintf(EL_HVCNT, "hcounter: %02x (%i) @ %06x", d, SekCyclesDone(), SekPc);
|
elprintf(EL_HVCNT, "hcounter: %02x [%u] @ %06x", d, SekCyclesDone(), SekPc);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue