void pcd_run_cpus_normal(int m68k_cycles)
{
// TODO this is suspicious. ~1 cycle refresh delay every 256 cycles?
- SekAimM68k(m68k_cycles, 0x43); // Fhey area
+ SekAimM68k(m68k_cycles, 0x42); // Fhey area
while (CYCLES_GT(Pico.t.m68c_aim, Pico.t.m68c_cnt)) {
if (SekShouldInterrupt()) {
else
lines = 262;
- z80_resetCycles(Pico.t.z80c_aim);
PsndStartFrame();
if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
PsndGetSamples(lines);
timers_cycle(Pico.t.z80c_aim);
+ z80_resetCycles();
Pico.t.m68c_aim = Pico.t.m68c_cnt;
}
{\r
if (d)\r
{\r
- Pico.t.z80c_cnt = z80_cycles_from_68k() + (Pico.t.z80_busdelay >> 8);\r
+ Pico.t.z80c_aim = Pico.t.z80c_cnt = z80_cycles_from_68k() + (Pico.t.z80_busdelay >> 8) + 2;\r
Pico.t.z80_busdelay &= 0xff;\r
}\r
else\r
{\r
if ((PicoIn.opt & POPT_EN_Z80) && !Pico.m.z80_reset) {\r
- // Z80 grants bus 2 cycles after the next M cycle, even within an insn\r
+ // Z80 grants bus after the current M cycle, even within an insn\r
// simulate this by accumulating the last insn overhang in busdelay\r
- unsigned granted = z80_cycles_from_68k() + 6;\r
+ unsigned granted;\r
pprof_start(m68k);\r
PicoSyncZ80(SekCyclesDone());\r
+ pprof_end_sub(m68k);\r
+ granted = Pico.t.z80c_aim + 6; // M cycle is 3-6 cycles \r
Pico.t.z80_busdelay += (Pico.t.z80c_cnt - granted) << 8;\r
Pico.t.z80c_cnt = granted;\r
- pprof_end_sub(m68k);\r
}\r
}\r
Pico.m.z80Run = d;\r
PicoSyncZ80(SekCyclesDone());\r
pprof_end_sub(m68k);\r
}\r
+ Pico.t.z80_busdelay &= 0xff; // also resets bus request\r
YM2612ResetChip();\r
timers_reset();\r
}\r
else\r
{\r
- Pico.t.z80c_cnt = z80_cycles_from_68k() + 2;\r
+ Pico.t.z80c_aim = Pico.t.z80c_cnt = z80_cycles_from_68k() + 2;\r
z80_reset();\r
}\r
Pico.m.z80_reset = d;\r
static __inline void SekRunM68k(int cyc)
{
// TODO 0x100 would be 2 cycles/128, moreover far too sensitive
- SekAimM68k(cyc, 0x10c); // OutRunners, testpico, VDPFIFOTesting
+ SekAimM68k(cyc, 0x108); // OutRunners, testpico, VDPFIFOTesting
SekSyncM68k(0);
}
skip = PicoIn.skipFrame;
- z80_resetCycles(cycles_68k_to_z80(Pico.t.m68c_aim - Pico.t.m68c_frame_start));
Pico.t.m68c_frame_start = Pico.t.m68c_aim;
PsndStartFrame();
PsndGetSamples(y);
timers_cycle(cycles_68k_to_z80(Pico.t.m68c_aim - Pico.t.m68c_frame_start));
+ z80_resetCycles();
pv->hint_cnt = hint;
\r
#define Z80_STATE_SIZE 0x60\r
\r
-#define z80_resetCycles(aim) \\r
- Pico.t.z80c_cnt -= (aim < Pico.t.z80c_cnt ? aim : Pico.t.z80c_cnt), Pico.t.z80c_aim = Pico.t.z80_scanline = 0\r
+#define z80_resetCycles() \\r
+ Pico.t.z80c_cnt -= Pico.t.z80c_aim, Pico.t.z80c_aim = Pico.t.z80_scanline = 0\r
\r
#define z80_cyclesDone() \\r
(Pico.t.z80c_aim - z80_cyclesLeft)\r
int nmi;
int y;
- z80_resetCycles(Pico.t.z80c_aim);
PsndStartFrame();
// for SMS the pause button generates an NMI, for GG ths is not the case
z80_exec(Pico.t.z80c_line_start + cycles_line);
}
+ z80_resetCycles();
PsndGetSamplesMS(lines);
}