]> git.sesse.net Git - pistorm/blob - m68kconf.h
Add Meson build files.
[pistorm] / m68kconf.h
1 /* ======================================================================== */
2 /* ========================= LICENSING & COPYRIGHT ======================== */
3 /* ======================================================================== */
4 /*
5  *                                  MUSASHI
6  *                                Version 3.32
7  *
8  * A portable Motorola M680x0 processor emulation engine.
9  * Copyright Karl Stenerud.  All rights reserved.
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a copy
12  * of this software and associated documentation files (the "Software"), to deal
13  * in the Software without restriction, including without limitation the rights
14  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15  * copies of the Software, and to permit persons to whom the Software is
16  * furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in
19  * all copies or substantial portions of the Software.
20
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27  * THE SOFTWARE.
28  */
29
30
31
32 #ifndef M68KCONF__HEADER
33 #define M68KCONF__HEADER
34
35
36 /* Configuration switches.
37  * Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
38  * OPT_SPECIFY_HANDLER causes the core to link directly to the function
39  * or macro you specify, rather than using callback functions whose pointer
40  * must be passed in using m68k_set_xxx_callback().
41  */
42 #define OPT_OFF             0
43 #define OPT_ON              1
44 #define OPT_SPECIFY_HANDLER 2
45
46
47 /* ======================================================================== */
48 /* ============================== MAME STUFF ============================== */
49 /* ======================================================================== */
50
51 /* If you're compiling this for MAME, only change M68K_COMPILE_FOR_MAME
52  * to OPT_ON and use m68kmame.h to configure the 68k core.
53  */
54 #ifndef M68K_COMPILE_FOR_MAME
55 #define M68K_COMPILE_FOR_MAME      OPT_OFF
56 #endif /* M68K_COMPILE_FOR_MAME */
57
58
59 #if M68K_COMPILE_FOR_MAME == OPT_OFF
60
61
62 /* ======================================================================== */
63 /* ============================= CONFIGURATION ============================ */
64 /* ======================================================================== */
65
66 /* Turn ON if you want to use the following M68K variants */
67 #define M68K_EMULATE_010            OPT_ON
68 #define M68K_EMULATE_EC020          OPT_ON
69 #define M68K_EMULATE_020            OPT_ON
70 #define M68K_EMULATE_030            OPT_ON
71 #define M68K_EMULATE_040            OPT_ON
72
73
74 /* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
75  * and m68k_read_pcrelative_xx() for PC-relative addressing.
76  * If off, all read requests from the CPU will be redirected to m68k_read_xx()
77  */
78 #define M68K_SEPARATE_READS         OPT_ON
79
80 /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
81  * predecrement destination EA mode instead of m68k_write_32().
82  * To simulate real 68k behavior, m68k_write_32_pd() must first write the high
83  * word to [address+2], and then write the low word to [address].
84  */
85 #define M68K_SIMULATE_PD_WRITES     OPT_OFF
86
87 /* If ON, CPU will call the interrupt acknowledge callback when it services an
88  * interrupt.
89  * If off, all interrupts will be autovectored and all interrupt requests will
90  * auto-clear when the interrupt is serviced.
91  */
92 #define M68K_EMULATE_INT_ACK        OPT_OFF
93 #define M68K_INT_ACK_CALLBACK(...)  0xFFFFFFFF
94
95
96 /* If ON, CPU will call the breakpoint acknowledge callback when it encounters
97  * a breakpoint instruction and it is running a 68010+.
98  */
99 #define M68K_EMULATE_BKPT_ACK       OPT_OFF
100 #define M68K_BKPT_ACK_CALLBACK()    your_bkpt_ack_handler_function()
101
102
103 /* If ON, the CPU will monitor the trace flags and take trace exceptions
104  */
105 #define M68K_EMULATE_TRACE          OPT_OFF
106
107
108 /* If ON, CPU will call the output reset callback when it encounters a reset
109  * instruction.
110  */
111 #define M68K_EMULATE_RESET          OPT_SPECIFY_HANDLER
112 #define M68K_RESET_CALLBACK()       cpu_pulse_reset()
113
114 /* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn
115  * instruction.
116  */
117 #define M68K_CMPILD_HAS_CALLBACK     OPT_OFF
118 #define M68K_CMPILD_CALLBACK(v,r)    your_cmpild_handler_function(v,r)
119
120
121 /* If ON, CPU will call the callback when it encounters a rte
122  * instruction.
123  */
124 #define M68K_RTE_HAS_CALLBACK       OPT_OFF
125 #define M68K_RTE_CALLBACK()         your_rte_handler_function()
126
127 /* If ON, CPU will call the callback when it encounters a tas
128  * instruction.
129  */
130 #define M68K_TAS_HAS_CALLBACK       OPT_OFF
131 #define M68K_TAS_CALLBACK()         your_tas_handler_function()
132
133 /* If ON, CPU will call the callback when it encounters an illegal instruction
134  * passing the opcode as argument. If the callback returns 1, then it's considered
135  * as a normal instruction, and the illegal exception in canceled. If it returns 0,
136  * the exception occurs normally.
137  * The callback looks like int callback(int opcode)
138  * You should put OPT_SPECIFY_HANDLER here if you cant to use it, otherwise it will
139  * use a dummy default handler and you'll have to call m68k_set_illg_instr_callback explicitely
140  */
141 #define M68K_ILLG_HAS_CALLBACK      OPT_OFF
142 #define M68K_ILLG_CALLBACK(opcode)  op_illg(opcode)
143
144 /* If ON, CPU will call the set fc callback on every memory access to
145  * differentiate between user/supervisor, program/data access like a real
146  * 68000 would.  This should be enabled and the callback should be set if you
147  * want to properly emulate the m68010 or higher. (moves uses function codes
148  * to read/write data from different address spaces)
149  */
150 #define M68K_EMULATE_FC             OPT_OFF
151 #define M68K_SET_FC_CALLBACK(A)     cpu_set_fc(A)
152
153 /* If ON, CPU will call the pc changed callback when it changes the PC by a
154  * large value.  This allows host programs to be nicer when it comes to
155  * fetching immediate data and instructions on a banked memory system.
156  */
157 #define M68K_MONITOR_PC             OPT_OFF
158 #define M68K_SET_PC_CALLBACK(A)     your_pc_changed_handler_function(A)
159
160
161 /* If ON, CPU will call the instruction hook callback before every
162  * instruction.
163  */
164 #define M68K_INSTRUCTION_HOOK       OPT_OFF
165 #define M68K_INSTRUCTION_CALLBACK(pc) cpu_instr_callback(pc)
166
167
168 /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
169 #define M68K_EMULATE_PREFETCH       OPT_ON
170
171
172 /* If ON, the CPU will generate address error exceptions if it tries to
173  * access a word or longword at an odd address.
174  * NOTE: This is only emulated properly for 68000 mode.
175  */
176 #define M68K_EMULATE_ADDRESS_ERROR  OPT_OFF
177
178
179 /* Turn ON to enable logging of illegal instruction calls.
180  * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
181  * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
182  */
183 #define M68K_LOG_ENABLE             OPT_OFF
184 #define M68K_LOG_1010_1111          OPT_OFF
185 #define M68K_LOG_FILEHANDLE         some_file_handle
186
187
188 #define M68K_EMULATE_PMMU   OPT_OFF
189
190
191 /* ----------------------------- COMPATIBILITY ---------------------------- */
192
193 /* The following options set optimizations that violate the current ANSI
194  * standard, but will be compliant under the forthcoming C9X standard.
195  */
196
197
198 /* If ON, the enulation core will use 64-bit integers to speed up some
199  * operations.
200 */
201 #define M68K_USE_64_BIT  OPT_ON
202
203
204 #include "emulator.h"
205
206
207 //#define m68k_read_memory_8(A)  read16(A)
208 //#define m68k_read_memory_16(A) read16(A)
209 //#define m68k_read_memory_32(A) read16(A)
210
211 //#define m68k_read_disassembler_16(A) cpu_read_word_dasm(A)
212 //#define m68k_read_disassembler_32(A) cpu_read_long_dasm(A)
213
214 //#define m68k_write_memory_8(A, V)  write16(A, V)
215 //#define m68k_write_memory_16(A, V) write16(A, V)
216 //#define m68k_write_memory_32(A, V) write16(A, V)
217
218
219 #endif /* M68K_COMPILE_FOR_MAME */
220
221 /* ======================================================================== */
222 /* ============================== END OF FILE ============================= */
223 /* ======================================================================== */
224
225 #endif /* M68KCONF__HEADER */