1 /*  Copyright 2007 Guillaume Duhamel
2 
3     This file is part of Yabause.
4 
5     Yabause is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     Yabause is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with Yabause; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18 */
19 
20 #ifndef M68KCORE_H
21 #define M68KCORE_H
22 
23 #include "core.h"
24 
25 #define M68KCORE_DEFAULT -1
26 #define M68KCORE_DUMMY    0
27 #define M68KCORE_C68K     1
28 #define M68KCORE_Q68      2
29 #define M68KCORE_MUSASHI  3
30 
31 typedef u32 FASTCALL M68K_READ(const u32 adr);
32 typedef void FASTCALL M68K_WRITE(const u32 adr, u32 data);
33 
34 typedef struct {
35 	int id;
36 	const char *Name;
37 
38 	int (*Init)(void);
39 	void (*DeInit)(void);
40 	void (*Reset)(void);
41 
42 	s32 FASTCALL (*Exec)(s32 cycle);
43         void (*Sync)(void);
44 
45 	u32 (*GetDReg)(u32 num);
46 	u32 (*GetAReg)(u32 num);
47 	u32 (*GetPC)(void);
48 	u32 (*GetSR)(void);
49 	u32 (*GetUSP)(void);
50 	u32 (*GetMSP)(void);
51 
52 	void (*SetDReg)(u32 num, u32 val);
53 	void (*SetAReg)(u32 num, u32 val);
54 	void (*SetPC)(u32 val);
55 	void (*SetSR)(u32 val);
56 	void (*SetUSP)(u32 val);
57 	void (*SetMSP)(u32 val);
58 
59 	void (*SetFetch)(u32 low_adr, u32 high_adr, pointer fetch_adr);
60 	void FASTCALL (*SetIRQ)(s32 level);
61 	void FASTCALL (*WriteNotify)(u32 address, u32 size);
62 
63 	void (*SetReadB)(M68K_READ *Func);
64 	void (*SetReadW)(M68K_READ *Func);
65 	void (*SetWriteB)(M68K_WRITE *Func);
66 	void (*SetWriteW)(M68K_WRITE *Func);
67 
68    void (*SaveState)(FILE* fp);
69    void (*LoadState)(FILE* fp);
70 } M68K_struct;
71 
72 extern M68K_struct * M68K;
73 
74 int M68KInit(int coreid);
75 
76 extern M68K_struct M68KDummy;
77 extern M68K_struct M68KC68K;
78 extern M68K_struct M68KQ68;
79 extern M68K_struct M68KMusashi;
80 
81 #endif
82