int stop_before = SekCyclesDone() - z80stopCycle;
//elprintf(EL_BUSREQ, "get_zrun: stop before: %i", stop_before);
// note: if we use 20 or more here, Barkley Shut Up and Jam! will purposedly crash itself.
- // TODO: CD Terminator
+ // but CD Terminator needs at least 32, so it only works because next frame cycle wrap.
if (stop_before > 0 && stop_before < 20) // Gens uses 16 here
d = 1; // bus not yet available
}
#endif
if (a==0xa11100) { z80WriteBusReq(d); return; }
if (a==0xa11200) {
- dprintf("write z80Reset: %02x", d);
+ elprintf(EL_BUSREQ, "write z80Reset: %02x", d);
if(!(d&1)) z80_reset();
return;
}
{ \
if ((PicoOpt&4) && Pico.m.z80Run) \
{ \
+ int cnt; \
if (Pico.m.z80Run & 2) z80CycleAim += z80_cycles; \
else { \
- int cnt = SekCyclesDone() - z80startCycle; \
+ cnt = SekCyclesDone() - z80startCycle; \
cnt = (cnt>>1)-(cnt>>5); \
if (cnt > (z80_cycles)) cnt = z80_cycles; \
Pico.m.z80Run |= 2; \
z80CycleAim+=cnt; \
} \
- total_z80+=z80_run(z80CycleAim-total_z80); \
+ cnt=z80CycleAim-total_z80; \
+ if (cnt > 0) total_z80+=z80_run(cnt); \
} \
}
static int PicoFrameHints(void)
{
struct PicoVideo *pv=&Pico.video;
- int total_z80=0,lines,y,lines_vis = 224,z80CycleAim = 0,line_sample;
+ int lines,y,lines_vis = 224,total_z80 = 0,z80CycleAim = 0,line_sample;
int skip=PicoSkipFrame || (PicoOpt&0x10);
int hint; // Hint counter
//dprintf("-hint: %i", hint);
// This is to make active scan longer (needed for Double Dragon 2, mainly)
- CPUS_RUN(CYCLES_M68K_ASD, CYCLES_Z80_ASD, CYCLES_S68K_ASD);
+ // also trying to adjust for z80 overclock here (due to int line cycle counts)
+ z80CycleAim = Pico.m.pal ? -40 : 7;
+ CPUS_RUN(CYCLES_M68K_ASD, 0, CYCLES_S68K_ASD);
for (y=0;y<lines_vis;y++)
{
#define EL_INTSW 0x0010 /* log irq switching on/off */\r
#define EL_ASVDP 0x0020 /* VDP accesses during active scan */\r
#define EL_VDPDMA 0x0040 /* VDP DMA transfers and their timing */\r
-#define EL_BUSREQ 0x0080 /* z80 busreq r/w */\r
+#define EL_BUSREQ 0x0080 /* z80 busreq r/w or reset w */\r
#define EL_Z80BNK 0x0100 /* z80 i/o through bank area */\r
#define EL_SRAMIO 0x0200 /* sram i/o */\r
#define EL_EEPROM 0x0400 /* eeprom debug */\r
#define EL_UIO 0x0800 /* unmapped i/o */\r
-#define EL_IO 0x1000 /* all i/o */\r
+#define EL_IO 0x1000 /* all i/o (TODO) */\r
\r
#define EL_STATUS 0x4000 /* status messages */\r
#define EL_ANOMALY 0x8000 /* some unexpected conditions */\r
#define CAN_HANDLE_240_LINES 1\r
\r
// logging emu events\r
-#define EL_LOGMASK 0 // (EL_STATUS|EL_ANOMALY|EL_UIO) // xffff\r
+#define EL_LOGMASK 0 // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO) // xffff\r
\r
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
#define dprintf(x...)\r