drop some unnecessary inlines
[picodrive.git] / cpu / fame / fame.h
CommitLineData
70357ce5 1/*****************************************************************************/\r
2/* FAME Fast and Accurate Motorola 68000 Emulation Core */\r
3/* (c) 2005 Oscar Orallo Pelaez */\r
4/* Version: 1.24 */\r
5/* Date: 08-20-2005 */\r
6/* See FAME.HTML for documentation and license information */\r
7/*****************************************************************************/\r
8\r
9#ifndef __FAME_H__\r
10#define __FAME_H__\r
11\r
12#ifdef __cplusplus\r
13extern "C" {\r
14#endif\r
15\r
16// PicoDrive hacks\r
17#define FAMEC_FETCHBITS 8\r
18#define M68K_FETCHBANK1 (1 << FAMEC_FETCHBITS)\r
19\r
20//#define M68K_RUNNING 0x01\r
03e4f2a3 21#define FM68K_HALTED 0x80\r
22//#define M68K_WAITING 0x04\r
23//#define M68K_DISABLE 0x20\r
24//#define M68K_FAULTED 0x40\r
25#define FM68K_EMULATE_GROUP_0 0x02\r
26#define FM68K_EMULATE_TRACE 0x08\r
27#define FM68K_DO_TRACE 0x10\r
70357ce5 28\r
29\r
30/************************************/\r
31/* General library defines */\r
32/************************************/\r
33\r
34#ifndef M68K_OK\r
35 #define M68K_OK 0\r
36#endif\r
37#ifndef M68K_RUNNING\r
38 #define M68K_RUNNING 1\r
39#endif\r
40#ifndef M68K_NO_SUP_ADDR_SPACE\r
41 #define M68K_NO_SUP_ADDR_SPACE 2\r
42#endif\r
43#ifndef M68K_DOUBLE_BUS_FAULT\r
44 #define M68K_DOUBLE_BUS_FAULT -1\r
45#endif\r
46#ifndef M68K_INV_REG\r
47 #define M68K_INV_REG -1\r
48#endif\r
49\r
50/* Hardware interrupt state */\r
51\r
52#ifndef M68K_IRQ_LEVEL_ERROR\r
53 #define M68K_IRQ_LEVEL_ERROR -1\r
54#endif\r
55#ifndef M68K_IRQ_INV_PARAMS\r
56 #define M68K_IRQ_INV_PARAMS -2\r
57#endif\r
58\r
59/* Defines to specify hardware interrupt type */\r
60\r
61#ifndef M68K_AUTOVECTORED_IRQ\r
62 #define M68K_AUTOVECTORED_IRQ -1\r
63#endif\r
64#ifndef M68K_SPURIOUS_IRQ\r
65 #define M68K_SPURIOUS_IRQ -2\r
66#endif\r
67\r
68#ifndef M68K_AUTO_LOWER_IRQ\r
69 #define M68K_AUTO_LOWER_IRQ 1\r
70#endif\r
71#ifndef M68K_MANUAL_LOWER_IRQ\r
72 #define M68K_MANUAL_LOWER_IRQ 0\r
73#endif\r
74\r
75/* Defines to specify address space */\r
76\r
77#ifndef M68K_SUP_ADDR_SPACE\r
78 #define M68K_SUP_ADDR_SPACE 0\r
79#endif\r
80#ifndef M68K_USER_ADDR_SPACE\r
81 #define M68K_USER_ADDR_SPACE 2\r
82#endif\r
83#ifndef M68K_PROG_ADDR_SPACE\r
84 #define M68K_PROG_ADDR_SPACE 0\r
85#endif\r
86#ifndef M68K_DATA_ADDR_SPACE\r
87 #define M68K_DATA_ADDR_SPACE 1\r
88#endif\r
89\r
90\r
91/*******************/\r
92/* Data definition */\r
93/*******************/\r
94\r
70357ce5 95typedef union\r
96{\r
97 unsigned char B;\r
98 signed char SB;\r
99 unsigned short W;\r
100 signed short SW;\r
101 unsigned int D;\r
102 signed int SD;\r
103} famec_union32;\r
104\r
70357ce5 105/* M68K CPU CONTEXT */\r
106typedef struct\r
107{\r
108 unsigned int (*read_byte )(unsigned int a);\r
109 unsigned int (*read_word )(unsigned int a);\r
110 unsigned int (*read_long )(unsigned int a);\r
111 void (*write_byte)(unsigned int a,unsigned char d);\r
112 void (*write_word)(unsigned int a,unsigned short d);\r
113 void (*write_long)(unsigned int a,unsigned int d);\r
114 void (*reset_handler)(void);\r
115 void (*iack_handler)(unsigned level);\r
116 famec_union32 dreg[8];\r
117 famec_union32 areg[8];\r
118 unsigned asp;\r
119 unsigned pc;\r
120 unsigned char interrupts[8];\r
121 unsigned short sr;\r
122 unsigned short execinfo;\r
123 // PD extension\r
124 int io_cycle_counter; // cycles left\r
95049eea 125\r
126 unsigned int Opcode;\r
127 signed int cycles_needed;\r
ecc8036e 128\r
95049eea 129 unsigned short *PC;\r
130 unsigned long BasePC;\r
131 unsigned int flag_C;\r
132 unsigned int flag_V;\r
133 unsigned int flag_NotZ;\r
134 unsigned int flag_N;\r
135 unsigned int flag_X;\r
136 unsigned int flag_T;\r
137 unsigned int flag_S;\r
138 unsigned int flag_I;\r
139\r
ecc8036e 140 unsigned char not_polling;\r
141 unsigned char pad[3];\r
142\r
be26eb23 143 unsigned long Fetch[M68K_FETCHBANK1];\r
70357ce5 144} M68K_CONTEXT;\r
145\r
146extern M68K_CONTEXT *g_m68kcontext;\r
147\r
148/************************/\r
149/* Function definition */\r
150/************************/\r
151\r
152/* General purpose functions */\r
03e4f2a3 153void fm68k_init(void);\r
154int fm68k_reset(void);\r
99ade2ee 155int fm68k_emulate(int n, int idle_mode);\r
03e4f2a3 156int fm68k_would_interrupt(void); // to be called from fm68k_emulate()\r
70357ce5 157\r
03e4f2a3 158unsigned fm68k_get_pc(M68K_CONTEXT *context);\r
70357ce5 159\r
160\r
161#ifdef __cplusplus\r
162}\r
163#endif\r
164\r
165#endif\r