int emustatus = 0; // rapid_ym2612, multi_ym_updates\r
void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware\r
void (*PicoResetHook)(void) = NULL;\r
-void (*PicoLineHook)(void) = NULL;\r
+void (*PicoLineHook)(int count) = NULL;\r
\r
struct PicoSRAM SRam = {0,};\r
int z80startCycle, z80stopCycle; // in 68k cycles\r
z80_init(); // init even if we aren't going to use it\r
\r
PicoInitMCD();\r
+ PicoSVPInit();\r
\r
SRam.data=0;\r
\r
\r
if (Pico.romsize<=0) return 1;\r
\r
+ /* must call now, so that banking is reset, and correct vectors get fetched */\r
+ if (PicoResetHook) PicoResetHook();\r
+\r
PicoMemReset();\r
SekReset();\r
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).\r
Pico.video.pending_ints=0;\r
emustatus = 0;\r
\r
- if(hard) {\r
+ if (hard) {\r
// clear all memory of the emulated machine\r
memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram);\r
}\r
\r
PsndReset(); // pal must be known here\r
\r
- if (PicoResetHook) PicoResetHook();\r
-\r
if (PicoMCD & 1) {\r
PicoResetMCD(hard);\r
return 0;\r
\r
// dma2vram settings are just hacks to unglitch Legend of Galahad (needs <= 104 to work)\r
// same for Outrunners (92-121, when active is set to 24)\r
+// 96 is VR hack\r
static const int dma_timings[] = {\r
-83, 167, 166, 83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy\r
+96, 167, 166, 83, // vblank: 32cell: dma2vram dma2[vs|c]ram vram_fill vram_copy\r
102, 205, 204, 102, // vblank: 40cell:\r
16, 16, 15, 8, // active: 32cell:\r
24, 18, 17, 9 // ...\r
};\r
\r
static const int dma_bsycles[] = {\r
-(488<<8)/82, (488<<8)/167, (488<<8)/166, (488<<8)/83,\r
+(488<<8)/96, (488<<8)/167, (488<<8)/166, (488<<8)/83,\r
(488<<8)/102, (488<<8)/205, (488<<8)/204, (488<<8)/102,\r
(488<<8)/16, (488<<8)/16, (488<<8)/15, (488<<8)/8,\r
(488<<8)/24, (488<<8)/18, (488<<8)/17, (488<<8)/9\r
// to be called on 224 or line_sample scanlines only\r
static __inline void getSamples(int y)\r
{\r
+#if SIMPLE_WRITE_SOUND\r
+ if (y != 224) return;\r
+ PsndRender(0, PsndLen);\r
+ if (PicoWriteSound) PicoWriteSound(PsndLen);\r
+ PsndClear();\r
+#else\r
static int curr_pos = 0;\r
\r
if(y == 224) {\r
emustatus&=~1;\r
curr_pos = PsndRender(0, PsndLen/2);\r
}\r
+#endif\r
}\r
\r
\r
SekRunM68k(cycles_68k_block);\r
\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(lines_step);\r
line=lines;\r
}\r
\r
\r
lines += sects*lines_step;\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(sects*lines_step);\r
}\r
\r
// render screen\r
SekRunM68k(cycles_68k_vblock);\r
\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(lines_step);\r
line=lines;\r
\r
sects--;\r
if (sects) {\r
lines += sects*lines_step;\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(sects*lines_step);\r
}\r
\r
return 0;\r
for (y=0;y<224;y++) PicoLine(y);\r
}\r
\r
+int PicoGetStat(pstat_t which)\r
+{\r
+ switch (which)\r
+ {\r
+ case PS_PAL: return Pico.m.pal;\r
+ case PS_40_CELL: return Pico.video.reg[12]&1;\r
+ case PS_240_LINES: return Pico.m.pal && (Pico.video.reg[1]&8);\r
+ }\r
+ return 0;\r
+}\r
+\r
// callback to output message from emu\r
void (*PicoMessage)(const char *msg)=NULL;\r
\r
}\r
#endif\r
\r
-#if 0\r
- {\r
- FILE *f = fopen("zram", "wb");\r
- fwrite(Pico.zram, 1, 0x2000, f);\r
- fclose(f);\r
- }\r
-#endif\r
-\r
return dstr;\r
}\r
#endif\r