]> git.sesse.net Git - pistorm/blob - m68kconf.h
first commit
[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_040            OPT_ON
71
72
73 /* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
74  * and m68k_read_pcrelative_xx() for PC-relative addressing.
75  * If off, all read requests from the CPU will be redirected to m68k_read_xx()
76  */
77 #define M68K_SEPARATE_READS         OPT_OFF
78
79 /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
80  * predecrement destination EA mode instead of m68k_write_32().
81  * To simulate real 68k behavior, m68k_write_32_pd() must first write the high
82  * word to [address+2], and then write the low word to [address].
83  */
84 #define M68K_SIMULATE_PD_WRITES     OPT_OFF
85
86 /* If ON, CPU will call the interrupt acknowledge callback when it services an
87  * interrupt.
88  * If off, all interrupts will be autovectored and all interrupt requests will
89  * auto-clear when the interrupt is serviced.
90  */
91 #define M68K_EMULATE_INT_ACK        OPT_OFF
92 #define M68K_INT_ACK_CALLBACK(A)    cpu_irq_ack(A)
93
94
95 /* If ON, CPU will call the breakpoint acknowledge callback when it encounters
96  * a breakpoint instruction and it is running a 68010+.
97  */
98 #define M68K_EMULATE_BKPT_ACK       OPT_OFF
99 #define M68K_BKPT_ACK_CALLBACK()    your_bkpt_ack_handler_function()
100
101
102 /* If ON, the CPU will monitor the trace flags and take trace exceptions
103  */
104 #define M68K_EMULATE_TRACE          OPT_OFF
105
106
107 /* If ON, CPU will call the output reset callback when it encounters a reset
108  * instruction.
109  */
110 #define M68K_EMULATE_RESET          OPT_SPECIFY_HANDLER
111 #define M68K_RESET_CALLBACK()       cpu_pulse_reset()
112
113 /* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn
114  * instruction.
115  */
116 #define M68K_CMPILD_HAS_CALLBACK     OPT_OFF
117 #define M68K_CMPILD_CALLBACK(v,r)    your_cmpild_handler_function(v,r)
118
119
120 /* If ON, CPU will call the callback when it encounters a rte
121  * instruction.
122  */
123 #define M68K_RTE_HAS_CALLBACK       OPT_OFF
124 #define M68K_RTE_CALLBACK()         your_rte_handler_function()
125
126 /* If ON, CPU will call the callback when it encounters a tas
127  * instruction.
128  */
129 #define M68K_TAS_HAS_CALLBACK       OPT_OFF
130 #define M68K_TAS_CALLBACK()         your_tas_handler_function()
131
132 /* If ON, CPU will call the callback when it encounters an illegal instruction
133  * passing the opcode as argument. If the callback returns 1, then it's considered
134  * as a normal instruction, and the illegal exception in canceled. If it returns 0,
135  * the exception occurs normally.
136  * The callback looks like int callback(int opcode)
137  * You should put OPT_SPECIFY_HANDLER here if you cant to use it, otherwise it will
138  * use a dummy default handler and you'll have to call m68k_set_illg_instr_callback explicitely
139  */
140 #define M68K_ILLG_HAS_CALLBACK      OPT_OFF
141 #define M68K_ILLG_CALLBACK(opcode)  op_illg(opcode)
142
143 /* If ON, CPU will call the set fc callback on every memory access to
144  * differentiate between user/supervisor, program/data access like a real
145  * 68000 would.  This should be enabled and the callback should be set if you
146  * want to properly emulate the m68010 or higher. (moves uses function codes
147  * to read/write data from different address spaces)
148  */
149 #define M68K_EMULATE_FC             OPT_OFF
150 #define M68K_SET_FC_CALLBACK(A)     cpu_set_fc(A)
151
152 /* If ON, CPU will call the pc changed callback when it changes the PC by a
153  * large value.  This allows host programs to be nicer when it comes to
154  * fetching immediate data and instructions on a banked memory system.
155  */
156 #define M68K_MONITOR_PC             OPT_OFF
157 #define M68K_SET_PC_CALLBACK(A)     your_pc_changed_handler_function(A)
158
159
160 /* If ON, CPU will call the instruction hook callback before every
161  * instruction.
162  */
163 #define M68K_INSTRUCTION_HOOK       OPT_OFF
164 #define M68K_INSTRUCTION_CALLBACK(pc) cpu_instr_callback(pc)
165
166
167 /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
168 #define M68K_EMULATE_PREFETCH       OPT_ON
169
170
171 /* If ON, the CPU will generate address error exceptions if it tries to
172  * access a word or longword at an odd address.
173  * NOTE: This is only emulated properly for 68000 mode.
174  */
175 #define M68K_EMULATE_ADDRESS_ERROR  OPT_OFF
176
177
178 /* Turn ON to enable logging of illegal instruction calls.
179  * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
180  * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
181  */
182 #define M68K_LOG_ENABLE             OPT_OFF
183 #define M68K_LOG_1010_1111          OPT_OFF
184 #define M68K_LOG_FILEHANDLE         some_file_handle
185
186
187 /* ----------------------------- COMPATIBILITY ---------------------------- */
188
189 /* The following options set optimizations that violate the current ANSI
190  * standard, but will be compliant under the forthcoming C9X standard.
191  */
192
193
194 /* If ON, the enulation core will use 64-bit integers to speed up some
195  * operations.
196 */
197 #define M68K_USE_64_BIT  OPT_ON
198
199
200 #include "main.h"
201
202
203 //#define m68k_read_memory_8(A)  read16(A)
204 //#define m68k_read_memory_16(A) read16(A)
205 //#define m68k_read_memory_32(A) read16(A)
206
207 //#define m68k_read_disassembler_16(A) cpu_read_word_dasm(A)
208 //#define m68k_read_disassembler_32(A) cpu_read_long_dasm(A)
209
210 //#define m68k_write_memory_8(A, V)  write16(A, V)
211 //#define m68k_write_memory_16(A, V) write16(A, V)
212 //#define m68k_write_memory_32(A, V) write16(A, V)
213
214
215 #endif /* M68K_COMPILE_FOR_MAME */
216
217 /* ======================================================================== */
218 /* ============================== END OF FILE ============================= */
219 /* =======================================x================================= */
220
221 #endif /* M68KCONF__HEADER */