X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fdebug.c;h=5bbf8c4b431988ad16ec19c7783908a530016d82;hb=266c6afa84bde8d77a54d61ced8f227480247e24;hp=ac687f011cd93fda2294aaf5450bc55c99958023;hpb=1cfc5cc4ce06642b9bc45ca3b9d32793718e9455;p=picodrive.git diff --git a/pico/debug.c b/pico/debug.c index ac687f0..5bbf8c4 100644 --- a/pico/debug.c +++ b/pico/debug.c @@ -2,6 +2,7 @@ // (c) Copyright 2008 notaz, All rights reserved. #include "pico_int.h" +#include "sound/ym2612.h" #include "debug.h" #define bit(r, x) ((r>>x)&1) @@ -34,7 +35,7 @@ char *PDebugMain(void) 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; + !!(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, "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; @@ -58,6 +59,35 @@ char *PDebugMain(void) return dstr; } +char *PDebug32x(void) +{ + char *dstrp = dstr; + unsigned short *r; + int i; + + r = Pico32x.regs; + sprintf(dstrp, "regs:\n"); MVP; + for (i = 0; i < 0x40/2; i += 8) { + sprintf(dstrp, "%02x: %04x %04x %04x %04x %04x %04x %04x %04x\n", + i*2, r[i+0], r[i+1], r[i+2], r[i+3], r[i+4], r[i+5], r[i+6], r[i+7]); MVP; + } + + i = 0; + r = Pico32x.vdp_regs; + sprintf(dstrp, "VDP regs:\n"); MVP; + sprintf(dstrp, "%02x: %04x %04x %04x %04x %04x %04x %04x %04x\n", + i*2, r[i+0], r[i+1], r[i+2], r[i+3], r[i+4], r[i+5], r[i+6], r[i+7]); MVP; + + sprintf(dstrp, " mSH2 sSH2\n"); MVP; + sprintf(dstrp, "PC: %08x %08x\n", msh2_pc(), ssh2_pc()); MVP; + for (i = 0; i < 16/2; i++) { + sprintf(dstrp, "R%d,%2d %08x,%08x %08x,%08x\n", i, i + 8, + msh2_reg(i), msh2_reg(i+8), ssh2_reg(i), ssh2_reg(i+8)); MVP; + } + + return dstr; +} + char *PDebugSpriteList(void) { struct PicoVideo *pvid=&Pico.video; @@ -160,22 +190,14 @@ void PDebugShowSpriteStats(unsigned short *screen, int stride) void PDebugShowPalette(unsigned short *screen, int stride) { - unsigned int *spal=(void *)Pico.cram; - unsigned int *dpal=(void *)HighPal; - int x, y, i; + int x, y; - for (i = 0x3f/2; i >= 0; i--) -#ifdef USE_BGR555 - dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4); -#else - dpal[i] = ((spal[i]&0x000f000f)<<12)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)>>7); -#endif - for (i = 0x3f; i >= 0; i--) - HighPal[0x40|i] = (unsigned short)((HighPal[i]>>1)&0x738e); - for (i = 0x3f; i >= 0; i--) { - int t=HighPal[i]&0xe71c;t+=0x4208;if(t&0x20)t|=0x1c;if(t&0x800)t|=0x700;if(t&0x10000)t|=0xe000;t&=0xe71c; - HighPal[0x80|i] = (unsigned short)t; - } + Pico.m.dirtyPal = 1; + if (PicoAHW & PAHW_SMS) + PicoDoHighPal555M4(); + else + PicoDoHighPal555(1); + Pico.m.dirtyPal = 1; screen += 16*stride+8; for (y = 0; y < 8*4; y++) @@ -191,8 +213,6 @@ void PDebugShowPalette(unsigned short *screen, int stride) for (y = 0; y < 8*4; y++) for (x = 0; x < 8*16; x++) screen[x + y*stride] = HighPal[(x/8 + (y/8)*16) | 0x80]; - - Pico.m.dirtyPal = 1; } #if defined(DRAW2_OVERRIDE_LINE_WIDTH) @@ -279,11 +299,19 @@ void PDebugShowSprite(unsigned short *screen, int stride, int which) void PDebugDumpMem(void) { - dump_ram(Pico.ram, "dumps/ram.bin"); dump_ram_noswab(Pico.zram, "dumps/zram.bin"); - dump_ram(Pico.vram, "dumps/vram.bin"); dump_ram(Pico.cram, "dumps/cram.bin"); - dump_ram(Pico.vsram,"dumps/vsram.bin"); + + if (PicoAHW & PAHW_SMS) + { + dump_ram_noswab(Pico.vramb, "dumps/vram.bin"); + } + else + { + dump_ram(Pico.ram, "dumps/ram.bin"); + dump_ram(Pico.vram, "dumps/vram.bin"); + dump_ram(Pico.vsram,"dumps/vsram.bin"); + } if (PicoAHW & PAHW_MCD) { @@ -299,5 +327,64 @@ void PDebugDumpMem(void) dump_ram_noswab(Pico_mcd->pcm_ram,"dumps/pcm_ram.bin"); dump_ram_noswab(Pico_mcd->bram, "dumps/bram.bin"); } + + if (PicoAHW & PAHW_32X) + { + dump_ram(Pico32xMem->sdram, "dumps/sdram.bin"); + dump_ram(Pico32xMem->dram[0], "dumps/dram0.bin"); + dump_ram(Pico32xMem->dram[1], "dumps/dram1.bin"); + dump_ram(Pico32xMem->pal, "dumps/pal32x.bin"); + } +} + +void PDebugZ80Frame(void) +{ + int lines, line_sample; + + if (PicoAHW & PAHW_SMS) + return; + + if (Pico.m.pal) { + lines = 312; + line_sample = 68; + } else { + lines = 262; + line_sample = 93; + } + + z80_resetCycles(); + emustatus &= ~1; + + if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) + PicoSyncZ80(line_sample*488); + if (ym2612.dacen && PsndDacLine <= line_sample) + PsndDoDAC(line_sample); + if (PsndOut) + PsndGetSamples(line_sample); + + if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) { + PicoSyncZ80(224*488); + z80_int(); + } + if (ym2612.dacen && PsndDacLine <= 224) + PsndDoDAC(224); + if (PsndOut) + PsndGetSamples(224); + + // sync z80 + if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) + PicoSyncZ80(Pico.m.pal ? 151809 : 127671); // cycles adjusted for converter + if (PsndOut && ym2612.dacen && PsndDacLine <= lines-1) + PsndDoDAC(lines-1); + + timers_cycle(); +} + +void PDebugCPUStep(void) +{ + if (PicoAHW & PAHW_SMS) + z80_run_nr(1); + else + SekStepM68k(); }