3 * (C) notaz, 2009,2010,2013
4 * (C) irixxxx, 2019-2024
6 * This work is licensed under the terms of MAME license.
7 * See COPYING file in the top-level directory.
9 #include "../pico_int.h"
10 #include "../sound/ym2612.h"
11 #include <cpu/sh2/compiler.h>
13 struct Pico32x Pico32x;
16 #define SH2_IDLE_STATES (SH2_STATE_CPOLL|SH2_STATE_VPOLL|SH2_STATE_RPOLL|SH2_STATE_SLEEP)
18 static int REGPARM(2) sh2_irq_cb(SH2 *sh2, int level)
20 if (sh2->pending_irl > sh2->pending_int_irq) {
21 elprintf_sh2(sh2, EL_32X, "ack/irl %d @ %08x",
23 return 64 + sh2->pending_irl / 2;
25 elprintf_sh2(sh2, EL_32X, "ack/int %d/%d @ %08x",
26 level, sh2->pending_int_vector, sh2_pc(sh2));
27 sh2->pending_int_irq = 0; // auto-clear
28 sh2->pending_level = sh2->pending_irl;
29 return sh2->pending_int_vector;
33 // MUST specify active_sh2 when called from sh2 memhandlers
34 void p32x_update_irls(SH2 *active_sh2, unsigned int m68k_cycles)
36 int irqs, mlvl = 0, slvl = 0;
39 if ((Pico32x.regs[0] & (P32XS_nRES|P32XS_ADEN)) != (P32XS_nRES|P32XS_ADEN))
42 if (active_sh2 != NULL)
43 m68k_cycles = sh2_cycles_done_m68k(active_sh2);
45 // find top bit = highest irq number (0 <= irl <= 14/2) by binary search
48 irqs = Pico32x.sh2irqi[0];
49 if (irqs >= 0x10) mlvl += 8, irqs >>= 4;
50 if (irqs >= 0x04) mlvl += 4, irqs >>= 2;
51 if (irqs >= 0x02) mlvl += 2, irqs >>= 1;
54 irqs = Pico32x.sh2irqi[1];
55 if (irqs >= 0x10) slvl += 8, irqs >>= 4;
56 if (irqs >= 0x04) slvl += 4, irqs >>= 2;
57 if (irqs >= 0x02) slvl += 2, irqs >>= 1;
59 mrun = sh2_irl_irq(&msh2, mlvl, msh2.state & SH2_STATE_RUN);
61 p32x_sh2_poll_event(msh2.poll_addr, &msh2, SH2_IDLE_STATES & ~SH2_STATE_SLEEP, m68k_cycles);
62 if (msh2.state & SH2_STATE_RUN)
63 sh2_end_run(&msh2, 0);
66 srun = sh2_irl_irq(&ssh2, slvl, ssh2.state & SH2_STATE_RUN);
68 p32x_sh2_poll_event(ssh2.poll_addr, &ssh2, SH2_IDLE_STATES & ~SH2_STATE_SLEEP, m68k_cycles);
69 if (ssh2.state & SH2_STATE_RUN)
70 sh2_end_run(&ssh2, 0);
73 elprintf(EL_32X, "update_irls: m %d/%d, s %d/%d", mlvl, mrun, slvl, srun);
76 // the mask register is inconsistent, CMD is supposed to be a mask,
77 // while others are actually irq trigger enables?
79 void p32x_trigger_irq(SH2 *sh2, unsigned int m68k_cycles, unsigned int mask)
81 Pico32x.sh2irqi[0] |= mask & P32XI_VRES;
82 Pico32x.sh2irqi[1] |= mask & P32XI_VRES;
83 Pico32x.sh2irqi[0] |= mask & (Pico32x.sh2irq_mask[0] << 3);
84 Pico32x.sh2irqi[1] |= mask & (Pico32x.sh2irq_mask[1] << 3);
86 p32x_update_irls(sh2, m68k_cycles);
89 void p32x_update_cmd_irq(SH2 *sh2, unsigned int m68k_cycles)
91 if ((Pico32x.sh2irq_mask[0] & 2) && (Pico32x.regs[2 / 2] & 1))
92 Pico32x.sh2irqi[0] |= P32XI_CMD;
94 Pico32x.sh2irqi[0] &= ~P32XI_CMD;
96 if ((Pico32x.sh2irq_mask[1] & 2) && (Pico32x.regs[2 / 2] & 2))
97 Pico32x.sh2irqi[1] |= P32XI_CMD;
99 Pico32x.sh2irqi[1] &= ~P32XI_CMD;
101 p32x_update_irls(sh2, m68k_cycles);
104 void Pico32xStartup(void)
106 elprintf(EL_STATUS|EL_32X, "32X startup");
108 PicoIn.AHW |= PAHW_32X;
109 // TODO: OOM handling
110 if (Pico32xMem == NULL) {
111 Pico32xMem = plat_mmap(0x06000000, sizeof(*Pico32xMem), 0, 0);
112 if (Pico32xMem == NULL) {
113 elprintf(EL_STATUS, "OOM");
116 memset(Pico32xMem, 0, sizeof(struct Pico32xMem));
118 sh2_init(&msh2, 0, &ssh2);
119 msh2.irq_callback = sh2_irq_cb;
120 sh2_init(&ssh2, 1, &msh2);
121 ssh2.irq_callback = sh2_irq_cb;
125 p32x_pwm_ctl_changed();
126 p32x_timers_recalc();
128 Pico32x.regs[0] |= P32XS_ADEN;
130 Pico32x.sh2_regs[0] = P32XS2_ADEN;
132 Pico32x.sh2_regs[0] |= P32XS2_nCART;
135 Pico32x.vdp_regs[0] |= P32XV_nPAL;
137 Pico32x.vdp_regs[0] &= ~P32XV_nPAL;
145 void Pico32xShutdown(void)
147 elprintf(EL_STATUS|EL_32X, "32X shutdown");
148 Pico32x.sh2_regs[0] &= ~P32XS2_ADEN;
149 Pico32x.regs[0] &= ~P32XS_ADEN;
153 PicoIn.AHW &= ~PAHW_32X;
154 if (PicoIn.AHW & PAHW_MCD)
161 void p32x_reset_sh2s(void)
163 elprintf(EL_32X, "sh2 reset");
167 sh2_peripheral_reset(&msh2);
168 sh2_peripheral_reset(&ssh2);
170 // if we don't have BIOS set, perform it's work here.
172 if (p32x_bios_m == NULL) {
173 sh2_set_gbr(0, 0x20004000);
175 if (!Pico.m.ncart_in) { // copy IDL from cartridge
176 unsigned int idl_src, idl_dst, idl_size; // initial data load
179 idl_src = CPU_BE2(*(u32 *)(Pico.rom + 0x3d4)) & ~0xf0000000;
180 idl_dst = CPU_BE2(*(u32 *)(Pico.rom + 0x3d8)) & ~0xf0000000;
181 idl_size= CPU_BE2(*(u32 *)(Pico.rom + 0x3dc));
182 // copy in guest memory space
183 idl_src += 0x2000000;
184 idl_dst += 0x6000000;
185 while (idl_size >= 4) {
186 p32x_sh2_write32(idl_dst, p32x_sh2_read32(idl_src, &msh2), &msh2);
187 idl_src += 4, idl_dst += 4, idl_size -= 4;
191 vbr = CPU_BE2(*(u32 *)(Pico.rom + 0x3e8));
195 Pico32x.regs[0x28 / 2] = *(u16 *)(Pico.rom + 0x18e);
197 // program will set M_OK
201 if (p32x_bios_s == NULL) {
205 vbr = CPU_BE2(*(u32 *)(Pico.rom + 0x3ec));
206 sh2_set_gbr(1, 0x20004000);
208 // program will set S_OK
211 msh2.m68krcycles_done = ssh2.m68krcycles_done = SekCyclesDone();
214 void Pico32xInit(void)
218 void PicoPower32x(void)
220 memset(&Pico32x, 0, sizeof(Pico32x));
222 Pico32x.regs[0] = P32XS_REN|P32XS_nRES; // verified
223 Pico32x.regs[0x10/2] = 0xffff;
224 Pico32x.vdp_regs[0x0a/2] = P32XV_VBLK|P32XV_PEN;
227 void PicoUnload32x(void)
229 if (PicoIn.AHW & PAHW_32X)
235 if (Pico32xMem != NULL)
236 plat_munmap(Pico32xMem, sizeof(*Pico32xMem));
240 void PicoReset32x(void)
242 if (PicoIn.AHW & PAHW_32X) {
243 p32x_trigger_irq(NULL, SekCyclesDone(), P32XI_VRES);
244 p32x_sh2_poll_event(msh2.poll_addr, &msh2, SH2_IDLE_STATES, SekCyclesDone());
245 p32x_sh2_poll_event(ssh2.poll_addr, &ssh2, SH2_IDLE_STATES, SekCyclesDone());
246 p32x_pwm_ctl_changed();
247 p32x_timers_recalc();
251 static void Pico32xRenderSync(int lines)
253 if (Pico32xDrawMode != PDM32X_OFF && !PicoIn.skipFrame) {
259 if (Pico.video.reg[1] & 8)
262 if ((Pico32x.vdp_regs[0] & P32XV_Mx) != 0 && // 32x not blanking
263 (!(Pico.video.debug_p & PVD_KILL_32X)))
265 int md_bg = Pico.video.reg[7] & 0x3f;
267 // we draw lines up to the sync point (not line-by-line)
268 PicoDraw32xLayer(offs, lines-Pico32x.sync_line, md_bg);
270 else if (Pico32xDrawMode == PDM32X_BOTH)
271 PicoDraw32xLayerMdOnly(offs, lines-Pico32x.sync_line);
277 void Pico32xDrawSync(SH2 *sh2)
279 // the fast renderer isn't operating on a line-by-line base
280 if (sh2 && !(PicoIn.opt & POPT_ALT_RENDERER)) {
281 unsigned int cycle = (sh2 ? sh2_cycles_done_m68k(sh2) : SekCyclesDone());
282 int line = ((cycle - Pico.t.m68c_frame_start) * (long long)((1LL<<32)/488.5)) >> 32;
284 if (Pico32x.sync_line < line && line < (Pico.video.reg[1] & 8 ? 240 : 224)) {
285 // make sure the MD image is also sync'ed to this line for merging
286 PicoDrawSync(line, 0, 0);
288 // pfff... need to save and restore some persistent data for MD renderer
289 void *dest = Pico.est.DrawLineDest;
290 int incr = Pico.est.DrawLineDestIncr;
291 Pico32xRenderSync(line);
292 Pico.est.DrawLineDest = dest;
293 Pico.est.DrawLineDestIncr = incr;
296 // remember line we sync'ed to
297 Pico32x.sync_line = line;
301 static void p32x_render_frame(void)
303 if (Pico32xDrawMode != PDM32X_OFF && !PicoIn.skipFrame) {
309 if (Pico.video.reg[1] & 8)
312 Pico32xRenderSync(lines);
316 static void p32x_start_blank(void)
319 Pico32x.vdp_regs[0x0a/2] |= P32XV_VBLK|P32XV_PEN;
321 // FB swap waits until vblank
322 if ((Pico32x.vdp_regs[0x0a/2] ^ Pico32x.pending_fb) & P32XV_FS) {
323 Pico32x.vdp_regs[0x0a/2] ^= P32XV_FS;
324 Pico32xSwapDRAM(Pico32x.pending_fb ^ P32XV_FS);
327 p32x_trigger_irq(NULL, Pico.t.m68c_aim, P32XI_VINT);
328 p32x_sh2_poll_event(msh2.poll_addr, &msh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
329 p32x_sh2_poll_event(ssh2.poll_addr, &ssh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
332 static void p32x_end_blank(void)
335 Pico32x.vdp_regs[0x0a/2] &= ~P32XV_VBLK; // get out of vblank
336 if ((Pico32x.vdp_regs[0] & P32XV_Mx) != 0) // no forced blanking
337 Pico32x.vdp_regs[0x0a/2] &= ~P32XV_PEN; // no palette access
338 if (!(Pico32x.sh2_regs[0] & 0x80)) {
339 // NB must precede VInt per hw manual, min 4 SH-2 cycles to pass Mars Check
340 Pico32x.hint_counter = (int)(-1.5*0x10);
341 p32x_schedule_hint(NULL, Pico.t.m68c_aim);
344 p32x_sh2_poll_event(msh2.poll_addr, &msh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
345 p32x_sh2_poll_event(ssh2.poll_addr, &ssh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
348 void p32x_schedule_hint(SH2 *sh2, unsigned int m68k_cycles)
350 // rather rough, 32x hint is useless in practice
352 if (!((Pico32x.sh2irq_mask[0] | Pico32x.sh2irq_mask[1]) & 4))
353 return; // nobody cares
354 if (!(Pico32x.sh2_regs[0] & 0x80) && (Pico.video.status & PVS_VB2))
357 Pico32x.hint_counter += (Pico32x.sh2_regs[4 / 2] + 1) * (int)(488.5*0x10);
358 after = Pico32x.hint_counter >> 4;
359 Pico32x.hint_counter &= 0xf;
361 p32x_event_schedule_sh2(sh2, P32X_EVENT_HINT, after);
363 p32x_event_schedule(m68k_cycles, P32X_EVENT_HINT, after);
367 static void fillend_event(unsigned int now)
369 Pico32x.vdp_regs[0x0a/2] &= ~P32XV_nFEN;
370 p32x_sh2_poll_event(msh2.poll_addr, &msh2, SH2_STATE_VPOLL, now);
371 p32x_sh2_poll_event(ssh2.poll_addr, &ssh2, SH2_STATE_VPOLL, now);
374 static void hint_event(unsigned int now)
376 p32x_trigger_irq(NULL, now, P32XI_HINT);
377 p32x_schedule_hint(NULL, now);
380 typedef void (event_cb)(unsigned int now);
382 /* times are in m68k (7.6MHz) cycles */
383 unsigned int p32x_event_times[P32X_EVENT_COUNT];
384 static unsigned int event_time_next;
385 static event_cb *p32x_event_cbs[P32X_EVENT_COUNT] = {
386 p32x_pwm_irq_event, // P32X_EVENT_PWM
387 fillend_event, // P32X_EVENT_FILLEND
388 hint_event, // P32X_EVENT_HINT
391 // schedule event at some time 'after', in m68k clocks
392 void p32x_event_schedule(unsigned int now, enum p32x_event event, int after)
396 when = (now + after) | 1;
398 elprintf(EL_32X, "32x: new event #%u %u->%u", event, now, when);
399 p32x_event_times[event] = when;
401 if (event_time_next == 0 || CYCLES_GT(event_time_next, when))
402 event_time_next = when;
405 void p32x_event_schedule_sh2(SH2 *sh2, enum p32x_event event, int after)
407 unsigned int now = sh2_cycles_done_m68k(sh2);
410 p32x_event_schedule(now, event, after);
412 left_to_next = C_M68K_TO_SH2(sh2, (int)(event_time_next - now));
413 if (sh2_cycles_left(sh2) > left_to_next) {
414 if (left_to_next < 1)
416 sh2_end_run(sh2, left_to_next);
420 static void p32x_run_events(unsigned int until)
422 int oldest, oldest_diff, time;
426 oldest = -1, oldest_diff = 0x7fffffff;
428 for (i = 0; i < P32X_EVENT_COUNT; i++) {
429 if (p32x_event_times[i]) {
430 diff = p32x_event_times[i] - until;
431 if (diff < oldest_diff) {
438 if (oldest_diff <= 0) {
439 time = p32x_event_times[oldest];
440 p32x_event_times[oldest] = 0;
441 elprintf(EL_32X, "32x: run event #%d %u", oldest, time);
442 p32x_event_cbs[oldest](time);
444 else if (oldest_diff < 0x7fffffff) {
445 event_time_next = p32x_event_times[oldest];
455 elprintf(EL_32X, "32x: next event #%d at %u",
456 oldest, event_time_next);
459 static void run_sh2(SH2 *sh2, unsigned int m68k_cycles)
461 unsigned int cycles, done;
463 pevt_log_sh2_o(sh2, EVT_RUN_START);
464 sh2->state |= SH2_STATE_RUN;
465 cycles = C_M68K_TO_SH2(sh2, m68k_cycles);
466 elprintf_sh2(sh2, EL_32X, "+run %u %d @%08x",
467 sh2->m68krcycles_done, cycles, sh2->pc);
469 done = sh2_execute(sh2, cycles);
471 sh2->m68krcycles_done += C_SH2_TO_M68K(sh2, done);
472 sh2->state &= ~SH2_STATE_RUN;
473 pevt_log_sh2_o(sh2, EVT_RUN_END);
474 elprintf_sh2(sh2, EL_32X, "-run %u %d",
475 sh2->m68krcycles_done, done);
478 // sync other sh2 to this one
479 // note: recursive call
480 void p32x_sync_other_sh2(SH2 *sh2, unsigned int m68k_target)
482 SH2 *osh2 = sh2->other_sh2;
486 if (osh2->state & SH2_STATE_RUN)
489 m68k_cycles = m68k_target - osh2->m68krcycles_done;
490 if (m68k_cycles < 200)
493 if (osh2->state & SH2_IDLE_STATES) {
494 osh2->m68krcycles_done = m68k_target;
498 elprintf_sh2(osh2, EL_32X, "sync to %u %d",
499 m68k_target, m68k_cycles);
501 run_sh2(osh2, m68k_cycles);
503 // there might be new event to schedule current sh2 to
504 if (event_time_next) {
505 left_to_event = C_M68K_TO_SH2(sh2, (int)(event_time_next - m68k_target));
506 if (sh2_cycles_left(sh2) > left_to_event) {
507 if (left_to_event < 1)
509 sh2_end_run(sh2, left_to_event);
515 #define STEP_N 528 // at least one line (488)
517 #define sync_sh2s_normal p32x_sync_sh2s
518 //#define sync_sh2s_lockstep p32x_sync_sh2s
520 /* most timing is in 68k clock */
521 void sync_sh2s_normal(unsigned int m68k_target)
523 unsigned int now, target, next, timer_cycles;
526 elprintf(EL_32X, "sh2 sync to %u", m68k_target);
528 if ((Pico32x.regs[0] & (P32XS_nRES|P32XS_ADEN)) != (P32XS_nRES|P32XS_ADEN)) {
529 msh2.m68krcycles_done = ssh2.m68krcycles_done = m68k_target;
533 now = msh2.m68krcycles_done;
534 if (CYCLES_GT(now, ssh2.m68krcycles_done))
535 now = ssh2.m68krcycles_done;
539 while (CYCLES_GT(m68k_target, now))
541 if (event_time_next && CYCLES_GE(now, event_time_next))
542 p32x_run_events(now);
544 target = m68k_target;
545 if (event_time_next && CYCLES_GT(target, event_time_next))
546 target = event_time_next;
547 while (CYCLES_GT(target, now))
550 if (CYCLES_GT(target, now + STEP_N))
552 elprintf(EL_32X, "sh2 exec to %u %d,%d/%d, flags %x", next,
553 next - msh2.m68krcycles_done, next - ssh2.m68krcycles_done,
554 m68k_target - now, Pico32x.emu_flags);
557 if (!(ssh2.state & SH2_IDLE_STATES)) {
558 cycles = next - ssh2.m68krcycles_done;
560 run_sh2(&ssh2, cycles > 20U ? cycles : 20U);
562 if (event_time_next && CYCLES_GT(target, event_time_next))
563 target = event_time_next;
564 if (CYCLES_GT(next, target))
571 if (!(msh2.state & SH2_IDLE_STATES)) {
572 cycles = next - msh2.m68krcycles_done;
574 run_sh2(&msh2, cycles > 20U ? cycles : 20U);
576 if (event_time_next && CYCLES_GT(target, event_time_next))
577 target = event_time_next;
578 if (CYCLES_GT(next, target))
585 if (CYCLES_GT(now, msh2.m68krcycles_done)) {
586 if (!(msh2.state & SH2_IDLE_STATES))
587 now = msh2.m68krcycles_done;
589 if (CYCLES_GT(now, ssh2.m68krcycles_done)) {
590 if (!(ssh2.state & SH2_IDLE_STATES))
591 now = ssh2.m68krcycles_done;
593 if (CYCLES_GT(now, timer_cycles+STEP_N)) {
594 if (msh2.state & SH2_TIMER_RUN)
595 p32x_timer_do(&msh2, now - timer_cycles);
596 if (ssh2.state & SH2_TIMER_RUN)
597 p32x_timer_do(&ssh2, now - timer_cycles);
602 if (msh2.state & SH2_TIMER_RUN)
603 p32x_timer_do(&msh2, now - timer_cycles);
604 if (ssh2.state & SH2_TIMER_RUN)
605 p32x_timer_do(&ssh2, now - timer_cycles);
611 if (msh2.state & SH2_IDLE_STATES) {
612 if (CYCLES_GT(m68k_target, msh2.m68krcycles_done))
613 msh2.m68krcycles_done = m68k_target;
615 if (ssh2.state & SH2_IDLE_STATES) {
616 if (CYCLES_GT(m68k_target, ssh2.m68krcycles_done))
617 ssh2.m68krcycles_done = m68k_target;
620 // everyone is in sync now
621 Pico32x.comm_dirty = 0;
624 void sync_sh2s_lockstep(unsigned int m68k_target)
626 unsigned int mcycles;
628 mcycles = msh2.m68krcycles_done;
629 if (CYCLES_GT(mcycles, ssh2.m68krcycles_done))
630 mcycles = ssh2.m68krcycles_done;
632 while (CYCLES_GT(m68k_target, mcycles)) {
634 sync_sh2s_normal(mcycles);
638 #define CPUS_RUN(m68k_cycles) do { \
639 if (PicoIn.AHW & PAHW_MCD) \
640 pcd_run_cpus(m68k_cycles); \
642 SekRunM68k(m68k_cycles); \
644 if ((Pico32x.emu_flags & P32XF_Z80_32X_IO) && Pico.m.z80Run \
645 && !Pico.m.z80_reset && (PicoIn.opt & POPT_EN_Z80)) \
646 PicoSyncZ80(SekCyclesDone()); \
647 if (Pico32x.emu_flags & (P32XF_68KCPOLL|P32XF_68KVPOLL)) \
648 p32x_sync_sh2s(SekCyclesDone()); \
653 #include "../pico_cmn.c"
655 void PicoFrame32x(void)
657 if (PicoIn.AHW & PAHW_MCD)
661 Pico32x.sync_line = 0;
662 if (Pico32xDrawMode != PDM32X_BOTH)
663 Pico.est.rendstatus |= PDRAW_SYNC_NEEDED;
666 elprintf(EL_32X, "poll: %02x %02x %02x",
667 Pico32x.emu_flags & 3, msh2.state, ssh2.state);
670 // calculate multipliers against 68k clock (7670442)
671 // normally * 3, but effectively slower due to high latencies everywhere
672 // however using something lower breaks MK2 animations
673 void Pico32xSetClocks(int msh2_hz, int ssh2_hz)
675 float m68k_clk = (float)(OSC_NTSC / 7);
677 msh2.mult_m68k_to_sh2 = (int)((float)msh2_hz * (1 << CYCLE_MULT_SHIFT) / m68k_clk);
678 msh2.mult_sh2_to_m68k = (int)(m68k_clk * (1 << CYCLE_MULT_SHIFT) / (float)msh2_hz);
681 ssh2.mult_m68k_to_sh2 = (int)((float)ssh2_hz * (1 << CYCLE_MULT_SHIFT) / m68k_clk);
682 ssh2.mult_sh2_to_m68k = (int)(m68k_clk * (1 << CYCLE_MULT_SHIFT) / (float)ssh2_hz);
686 void Pico32xStateLoaded(int is_early)
689 Pico32xMemStateLoaded();
693 if (CYCLES_GE(sh2s[0].m68krcycles_done - Pico.t.m68c_aim, 500) ||
694 CYCLES_GE(sh2s[1].m68krcycles_done - Pico.t.m68c_aim, 500))
695 sh2s[0].m68krcycles_done = sh2s[1].m68krcycles_done = SekCyclesDone();
696 p32x_update_irls(NULL, SekCyclesDone());
697 p32x_timers_recalc();
698 p32x_pwm_state_loaded();
699 p32x_run_events(SekCyclesDone());
701 // TODO wakeup CPUs for now. poll detection stuff must go to the save state!
702 p32x_m68k_poll_event(0, -1);
703 p32x_sh2_poll_event(msh2.poll_addr, &msh2, SH2_IDLE_STATES, msh2.m68krcycles_done);
704 p32x_sh2_poll_event(ssh2.poll_addr, &ssh2, SH2_IDLE_STATES, ssh2.m68krcycles_done);
707 void Pico32xPrepare(void)
709 // fallback in case it was missing in saved config
710 if (msh2.mult_m68k_to_sh2 == 0 || msh2.mult_sh2_to_m68k == 0)
711 Pico32xSetClocks(PICO_MSH2_HZ, 0);
712 if (ssh2.mult_m68k_to_sh2 == 0 || ssh2.mult_sh2_to_m68k == 0)
713 Pico32xSetClocks(0, PICO_SSH2_HZ);
715 sh2_execute_prepare(&msh2, PicoIn.opt & POPT_EN_DRC);
716 sh2_execute_prepare(&ssh2, PicoIn.opt & POPT_EN_DRC);
719 // vim:shiftwidth=2:ts=2:expandtab