#define UTYPES_DEFINED\r
#endif\r
\r
+int (*PicoDmaHook)(unsigned int source, int len, unsigned short **srcp, unsigned short **limitp) = NULL;\r
\r
static __inline void AutoIncrement(void)\r
{\r
case 3: Pico.m.dirtyPal = 1;\r
Pico.cram [(a>>1)&0x003f]=d; break; // wraps (Desert Strike)\r
case 5: Pico.vsram[(a>>1)&0x003f]=d; break;\r
- default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break;\r
+ //default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break;\r
}\r
\r
//dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone());\r
if ((source&0xe00000)==0xe00000) { // Ram\r
pd=(u16 *)(Pico.ram+(source&0xfffe));\r
pdend=(u16 *)(Pico.ram+0x10000);\r
- } else if(PicoMCD & 1) {\r
+ } else if (PicoMCD & 1) {\r
elprintf(EL_VDPDMA, "DmaSlow CD, r3=%02x", Pico_mcd->s68k_regs[3]);\r
if(source<0x20000) { // Bios area\r
pd=(u16 *)(Pico_mcd->bios+(source&~1));\r
pd=(u16 *)(prg_ram+(source&0x1fffe));\r
pdend=(u16 *)(prg_ram+0x20000);\r
} else {\r
- elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow FIXME: unsupported src");\r
+ elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow[%i] %06x->%04x: FIXME: unsupported src", Pico.video.type, source, a);\r
return;\r
}\r
} else {\r
- if(source<Pico.romsize) { // Rom\r
+ // if we have DmaHook, let it handle ROM because of possible DMA delay\r
+ if (PicoDmaHook && PicoDmaHook(source, len, &pd, &pdend));\r
+ else if (source<Pico.romsize) { // Rom\r
pd=(u16 *)(Pico.rom+(source&~1));\r
pdend=(u16 *)(Pico.rom+Pico.romsize);\r
- } else {\r
- elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow: invalid dma src");\r
+ }\r
+ else {\r
+ elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow[%i] %06x->%04x: invalid src", Pico.video.type, source, a);\r
return;\r
}\r
}\r
else\r
{\r
// preliminary FIFO emulation for Chaos Engine, The (E)\r
- if(!(pvid->status&8) && (pvid->reg[1]&0x40) && Pico.m.scanline!=-1) // active display, accurate mode?\r
+ if(!(pvid->status&8) && (pvid->reg[1]&0x40) && Pico.m.scanline!=-1 && !(PicoOpt&0x10000)) // active display, accurate mode?\r
{\r
pvid->status&=~0x200; // FIFO no longer empty\r
pvid->lwrite_cnt++;\r
{\r
// Register write:\r
int num=(d>>8)&0x1f;\r
- if(num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[0]&0x10)>>4,\r
+ int dold=pvid->reg[num];\r
+ if (num > 0x0a && !(pvid->reg[1]&4)) {\r
+ elprintf(EL_ANOMALY, "%02x written to reg %02x in SMS mode @ %06x", d, num, SekPc);\r
+ } else\r
+ pvid->reg[num]=(unsigned char)d;\r
+ if (num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x10)>>4,\r
(d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);\r
- if(num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[1]&0x20)>>5,\r
+ if (num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x20)>>5,\r
(d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);\r
- //if(num==01) dprintf("set_blank: %i @ %06x [%i|%i]", !((d&0x40)>>6), SekPc, Pico.m.scanline, SekCyclesDone());\r
- //if(num==10) dprintf("hint_set: %i @ %06x [%i|%i]", (unsigned char)d, SekPc, Pico.m.scanline, SekCyclesDone());\r
- pvid->reg[num]=(unsigned char)d;\r
-#if !(defined(EMU_C68K) && defined(EMU_M68K)) // not debugging Cyclone\r
+ if (num == 5 && (d^dold)) rendstatus|=1;\r
+ // renderers should update their palettes if sh/hi mode is changed\r
+ else if (num == 0xc && ((d^dold)&8)) Pico.m.dirtyPal = 2;\r
+#ifndef EMU_CORE_DEBUG\r
// update IRQ level (Lemmings, Wiz 'n' Liz intro, ... )\r
// may break if done improperly:\r
// International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx),\r
- // Fatal Rewind (hang), Sesame Street Counting Cafe\r
- if(num < 2) {\r
-#ifdef EMU_C68K\r
- // hack: make sure we do not touch the irq line if Cyclone is just about to take the IRQ\r
- if (PicoCpu.irq <= (PicoCpu.srh&7)) {\r
-#endif\r
- int lines, pints;\r
+ // Fatal Rewind (crash), Sesame Street Counting Cafe\r
+ else if (num < 2)\r
+ {\r
+ if (!SekShouldInterrupt) // hack\r
+ {\r
+ int lines, pints, irq=0;\r
lines = (pvid->reg[1] & 0x20) | (pvid->reg[0] & 0x10);\r
pints = (pvid->pending_ints&lines);\r
- if(pints & 0x20) SekInterrupt(6);\r
- else if(pints & 0x10) SekInterrupt(4);\r
- else SekInterrupt(0);\r
-#ifdef EMU_C68K\r
- // adjust cycles for Cyclone so it would take the int "in time"\r
- if(PicoCpu.irq) {\r
- SekEndRun(24);\r
- }\r
+ if(pints & 0x20) irq = 6;\r
+ else if(pints & 0x10) irq = 4;\r
+ SekInterrupt(irq); // update line\r
+\r
+ if (irq && Pico.m.scanline!=-1) SekEndRun(24); // make it delayed\r
}\r
-#endif\r
}\r
- else\r
#endif\r
- if(num == 5) rendstatus|=1;\r
- else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed\r
pvid->type=0; // register writes clear command (else no Sega logo in Golden Axe II)\r
} else {\r
// High word of command:\r