int PicoRegionOverride = 0; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
int PicoAutoRgnOrder = 0;\r
int emustatus = 0; // rapid_ym2612, multi_ym_updates\r
-void (*PicoWriteSound)(int len) = 0; // called once per frame at the best time to send sound buffer (PsndOut) to hardware\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
\r
struct PicoSRAM SRam = {0,};\r
int z80startCycle, z80stopCycle; // in 68k cycles\r
Pico.m.pal=pal;\r
Pico.video.status = 0x3408 | pal; // always set bits | vblank | pal\r
\r
- sound_reset(); // pal must be known here\r
+ PsndReset(); // pal must be known here\r
+\r
+ if (PicoResetHook) PicoResetHook();\r
\r
if (PicoMCD & 1) {\r
PicoResetMCD(hard);\r
{\r
int cyc_do;\r
SekCycleAim+=cyc;\r
- //printf("aim: %i, cnt: %i\n", SekCycleAim, SekCycleCnt);\r
if((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return;\r
- //printf("cyc_do: %i\n", cyc_do);\r
-#if defined(EMU_C68K) && defined(EMU_M68K)\r
- // this means we do run-compare Cyclone vs Musashi\r
- SekCycleCnt+=CM_compareRun(cyc_do);\r
+#if defined(EMU_CORE_DEBUG)\r
+ // this means we do run-compare\r
+ SekCycleCnt+=CM_compareRun(cyc_do, 0);\r
#elif defined(EMU_C68K)\r
PicoCpuCM68k.cycles=cyc_do;\r
CycloneRun(&PicoCpuCM68k);\r
#elif defined(EMU_M68K)\r
SekCycleCnt+=m68k_execute(cyc_do);\r
#elif defined(EMU_F68K)\r
- SekCycleCnt+=m68k_emulate(cyc_do);\r
+ SekCycleCnt+=fm68k_emulate(cyc_do+1, 0);\r
#endif\r
}\r
\r
{\r
// this is required for timing sensitive stuff to work\r
int realaim=SekCycleAim; SekCycleAim=SekCycleCnt+1;\r
-#if defined(EMU_C68K) && defined(EMU_M68K)\r
- // this means we do run-compare Cyclone vs Musashi\r
- SekCycleCnt+=CM_compareRun(1);\r
+#if defined(EMU_CORE_DEBUG)\r
+ SekCycleCnt+=CM_compareRun(1, 0);\r
#elif defined(EMU_C68K)\r
PicoCpuCM68k.cycles=1;\r
CycloneRun(&PicoCpuCM68k);\r
#elif defined(EMU_M68K)\r
SekCycleCnt+=m68k_execute(1);\r
#elif defined(EMU_F68K)\r
- SekCycleCnt+=m68k_emulate(1);\r
+ SekCycleCnt+=fm68k_emulate(1, 0);\r
#endif\r
SekCycleAim=realaim;\r
}\r
\r
if(y == 224) {\r
if(emustatus & 2)\r
- curr_pos += sound_render(curr_pos, PsndLen-PsndLen/2);\r
- else curr_pos = sound_render(0, PsndLen);\r
+ curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2);\r
+ else curr_pos = PsndRender(0, PsndLen);\r
if (emustatus&1) emustatus|=2; else emustatus&=~2;\r
if (PicoWriteSound) PicoWriteSound(curr_pos);\r
// clear sound buffer\r
- sound_clear();\r
+ PsndClear();\r
}\r
else if(emustatus & 3) {\r
emustatus|= 2;\r
emustatus&=~1;\r
- curr_pos = sound_render(0, PsndLen/2);\r
+ curr_pos = PsndRender(0, PsndLen/2);\r
}\r
}\r
\r
if (PicoOpt&1) {\r
// we have ym2612 enabled, so we have to run Z80 in lines, so we could update DAC and timers\r
for (line = line_from; line < line_to; line++) {\r
- sound_timers_and_dac(line);\r
+ Psnd_timers_and_dac(line);\r
if ((line == 224 || line == line_sample) && PsndOut) getSamples(line);\r
if (line == 32 && PsndOut) emustatus &= ~1;\r
if (line >= line_from_r && line < line_to_r)\r
- z80_run(228);\r
+ z80_run_nr(228);\r
}\r
} else if (line_to_r-line_from_r > 0) {\r
- z80_run(228*(line_to_r-line_from_r));\r
+ z80_run_nr(228*(line_to_r-line_from_r));\r
// samples will be taken by caller\r
}\r
}\r
int cycles_68k_vblock,cycles_68k_block;\r
\r
// split to 16 run calls for active scan, for vblank split to 2 (ntsc), 3 (pal 240), 4 (pal 224)\r
- if (Pico.m.pal && (pv->reg[1]&8)) { // 240 lines\r
+ if (Pico.m.pal && (pv->reg[1]&8)) {\r
if(pv->reg[1]&8) { // 240 lines\r
cycles_68k_block = 7329; // (488*240+148)/16.0, -4\r
cycles_68k_vblock = 11640; // (72*488-148-68)/3.0, 0\r
PicoRunZ80Simple(line, lines);\r
}\r
\r
- // here we render sound if ym2612 is disabled\r
- if (!(PicoOpt&1) && PsndOut) {\r
- int len = sound_render(0, PsndLen);\r
- if (PicoWriteSound) PicoWriteSound(len);\r
- // clear sound buffer\r
- sound_clear();\r
- }\r
-\r
// render screen\r
if (!PicoSkipFrame)\r
{\r
for (y=0;y<224;y++) PicoLine(y);\r
#endif\r
else PicoFrameFull();\r
+#ifdef DRAW_FINISH_FUNC\r
+ DRAW_FINISH_FUNC();\r
+#endif\r
+ }\r
+\r
+ // here we render sound if ym2612 is disabled\r
+ if (!(PicoOpt&1) && PsndOut) {\r
+ int len = PsndRender(0, PsndLen);\r
+ if (PicoWriteSound) PicoWriteSound(len);\r
+ // clear sound buffer\r
+ PsndClear();\r
}\r
\r
// a gap between flags set and vint\r