-// This is part of Pico Library
-
-// (c) Copyright 2004 Dave, All rights reserved.
// (c) Copyright 2007 notaz, All rights reserved.
-// Free for non-commercial use.
-
-// For commercial use, separate licencing terms must be obtained.
#include "../PicoInt.h"
extern unsigned char formatted_bram[4*0x10];
extern unsigned int s68k_poll_adclk;
+void (*PicoMCDopenTray)(void) = NULL;
+int (*PicoMCDcloseTray)(void) = NULL;
#define dump_ram(ram,fname) \
{ \
//PicoMemResetCDdecode(1); // don't have to call this in 2M mode
#endif
+ // use SRam.data for RAM cart
+ if (SRam.data) free(SRam.data);
+ SRam.data = NULL;
+ if (PicoOpt&0x8000)
+ SRam.data = calloc(1, 0x12000);
+
return 0;
}
// delayed setting of DMNA bit (needed for Silpheed)
if (Pico_mcd->m.state_flags & 2) {
Pico_mcd->m.state_flags &= ~2;
- Pico_mcd->s68k_regs[3] |= 2;
- Pico_mcd->s68k_regs[3] &= ~1;
+ if (!(Pico_mcd->s68k_regs[3] & 4)) {
+ Pico_mcd->s68k_regs[3] |= 2;
+ Pico_mcd->s68k_regs[3] &= ~1;
#ifdef USE_POLL_DETECT
- if ((s68k_poll_adclk&0xfe) == 2) {
- SekSetStopS68k(0); s68k_poll_adclk = 0;
- }
+ if ((s68k_poll_adclk&0xfe) == 2) {
+ SekSetStopS68k(0); s68k_poll_adclk = 0;
+ }
#endif
+ }
}
}
}
if ((PicoOpt&4) && Pico.m.z80Run) {
- Pico.m.z80Run|=2;
- z80CycleAim+=cycles_z80;
+ if (Pico.m.z80Run & 2) z80CycleAim+=cycles_z80;
+ else {
+ int cnt = SekCyclesDone() - z80startCycle;
+ cnt = (cnt>>1)-(cnt>>5);
+ //if (cnt > cycles_z80) printf("FIXME: z80 cycles: %i\n", cnt);
+ if (cnt > cycles_z80) cnt = cycles_z80;
+ Pico.m.z80Run |= 2;
+ z80CycleAim+=cnt;
+ }
total_z80+=z80_run(z80CycleAim-total_z80);
}