gfx chip faker, hint vector
[picodrive.git] / Pico / cd / Sek.c
CommitLineData
cc68a136 1// This is part of Pico Library
2
3// (c) Copyright 2004 Dave, All rights reserved.
4// (c) Copyright 2006 notaz, All rights reserved.
5// Free for non-commercial use.
6
7// For commercial use, separate licencing terms must be obtained.
8
9
10#include "../PicoInt.h"
11
12
13int SekCycleCntS68k=0; // cycles done in this frame
14int SekCycleAimS68k=0; // cycle aim
15
16#ifdef EMU_M68K
17// ---------------------- MUSASHI 68000 ----------------------
18m68ki_cpu_core PicoS68kCPU; // Mega CD's CPU
19#endif
20
21
22#ifdef EMU_M68K
23int SekIntAckS68k(int level)
24{
672ad671 25 dprintf("s68kACK %i", level);
cc68a136 26 CPU_INT_LEVEL = 0;
27 return M68K_INT_ACK_AUTOVECTOR;
28}
29#endif
30
31
32int SekInitS68k()
33{
34#ifdef EMU_M68K
35 {
36 // Musashi is not very context friendly..
37 void *oldcontext = m68ki_cpu_p;
38 m68k_set_context(&PicoS68kCPU);
39 m68k_set_cpu_type(M68K_CPU_TYPE_68000);
40 m68k_init();
41 m68k_set_int_ack_callback(SekIntAckS68k);
42// m68k_pulse_reset(); // not yet, memmap is not set up
43 m68k_set_context(oldcontext);
44 }
45#endif
46
47 return 0;
48}
49
50// Reset the 68000:
51int SekResetS68k()
52{
53 if (Pico.rom==NULL) return 1;
54
55#ifdef EMU_M68K
56 {
57 void *oldcontext = m68ki_cpu_p;
58
59 m68k_set_context(&PicoS68kCPU);
60 m68k_pulse_reset();
61 m68k_set_context(oldcontext);
62 }
63#endif
64
65 return 0;
66}
67
68int SekInterruptS68k(int irq)
69{
70#ifdef EMU_M68K
71 void *oldcontext = m68ki_cpu_p;
72 m68k_set_context(&PicoS68kCPU);
73 m68k_set_irq(irq); // raise irq (gets lowered after taken or must be done in ack)
74 m68k_set_context(oldcontext);
75#endif
76 return 0;
77}
78