X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FVideoPort.c;h=cceab7c7cb6e6a79e92ddad5b2d13b320a7aba4d;hb=65ca3034d455b9934e7ff82813e3df49cf56cf87;hp=6f41dfaa855f0f6c7498dd29ffa3b020333b7c25;hpb=1dceadaee482ad3ca6f5ccbef57ea93893f45e82;p=picodrive.git diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index 6f41dfa..cceab7c 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -22,6 +22,7 @@ typedef unsigned int u32; #define UTYPES_DEFINED #endif +int (*PicoDmaHook)(unsigned int source, int len, unsigned short **srcp, unsigned short **limitp) = NULL; static __inline void AutoIncrement(void) { @@ -40,7 +41,7 @@ static void VideoWrite(u16 d) case 3: Pico.m.dirtyPal = 1; Pico.cram [(a>>1)&0x003f]=d; break; // wraps (Desert Strike) case 5: Pico.vsram[(a>>1)&0x003f]=d; break; - default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break; + //default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break; } //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone()); @@ -104,7 +105,7 @@ static void DmaSlow(int len) if ((source&0xe00000)==0xe00000) { // Ram pd=(u16 *)(Pico.ram+(source&0xfffe)); pdend=(u16 *)(Pico.ram+0x10000); - } else if(PicoMCD & 1) { + } else if (PicoMCD & 1) { elprintf(EL_VDPDMA, "DmaSlow CD, r3=%02x", Pico_mcd->s68k_regs[3]); if(source<0x20000) { // Bios area pd=(u16 *)(Pico_mcd->bios+(source&~1)); @@ -129,15 +130,18 @@ static void DmaSlow(int len) pd=(u16 *)(prg_ram+(source&0x1fffe)); pdend=(u16 *)(prg_ram+0x20000); } else { - elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow FIXME: unsupported src"); + elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow[%i] %06x->%04x: FIXME: unsupported src", Pico.video.type, source, a); return; } } else { - if(source%04x: invalid src", Pico.video.type, source, a); return; } } @@ -367,41 +371,38 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d) { // Register write: int num=(d>>8)&0x1f; - if(num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[0]&0x10)>>4, + int dold=pvid->reg[num]; + if (num > 0x0a && !(pvid->reg[1]&4)) { + elprintf(EL_ANOMALY, "%02x written to reg %02x in SMS mode @ %06x", d, num, SekPc); + } else + pvid->reg[num]=(unsigned char)d; + if (num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x10)>>4, (d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc); - if(num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[1]&0x20)>>5, + if (num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x20)>>5, (d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc); - //if(num==01) dprintf("set_blank: %i @ %06x [%i|%i]", !((d&0x40)>>6), SekPc, Pico.m.scanline, SekCyclesDone()); - //if(num==10) dprintf("hint_set: %i @ %06x [%i|%i]", (unsigned char)d, SekPc, Pico.m.scanline, SekCyclesDone()); - pvid->reg[num]=(unsigned char)d; -#if !(defined(EMU_C68K) && defined(EMU_M68K)) // not debugging Cyclone + if (num == 5 && (d^dold)) rendstatus|=1; + // renderers should update their palettes if sh/hi mode is changed + else if (num == 0xc && ((d^dold)&8)) Pico.m.dirtyPal = 2; +#ifndef EMU_CORE_DEBUG // update IRQ level (Lemmings, Wiz 'n' Liz intro, ... ) // may break if done improperly: // International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx), - // Fatal Rewind (hang), Sesame Street Counting Cafe - if(num < 2) { -#ifdef EMU_C68K - // hack: make sure we do not touch the irq line if Cyclone is just about to take the IRQ - if (PicoCpu.irq <= (PicoCpu.srh&7)) { -#endif - int lines, pints; + // Fatal Rewind (crash), Sesame Street Counting Cafe + else if (num < 2) + { + if (!SekShouldInterrupt) // hack + { + int lines, pints, irq=0; lines = (pvid->reg[1] & 0x20) | (pvid->reg[0] & 0x10); pints = (pvid->pending_ints&lines); - if(pints & 0x20) SekInterrupt(6); - else if(pints & 0x10) SekInterrupt(4); - else SekInterrupt(0); -#ifdef EMU_C68K - // adjust cycles for Cyclone so it would take the int "in time" - if(PicoCpu.irq) { - SekEndRun(24); - } + if(pints & 0x20) irq = 6; + else if(pints & 0x10) irq = 4; + SekInterrupt(irq); // update line + + if (irq && Pico.m.scanline!=-1) SekEndRun(24); // make it delayed } -#endif } - else #endif - if(num == 5) rendstatus|=1; - else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed pvid->type=0; // register writes clear command (else no Sega logo in Golden Axe II) } else { // High word of command: