1 /* ======================================================================== */
2 /* ========================= LICENSING & COPYRIGHT ======================== */
3 /* ======================================================================== */
4 /*
5  *                                  MUSASHI
6  *                                Version 3.4
7  *
8  * A portable Motorola M680x0 processor emulation engine.
9  * Copyright 1998-2001 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 /* Configuration switches.
36  * Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
37  * OPT_SPECIFY_HANDLER causes the core to link directly to the function
38  * or macro you specify, rather than using callback functions whose pointer
39  * must be passed in using m68k_set_xxx_callback().
40  */
41 #define OPT_OFF             0
42 #define OPT_ON              1
43 #define OPT_SPECIFY_HANDLER 2
44 
45 
46 /* ======================================================================== */
47 /* ============================== MAME STUFF ============================== */
48 /* ======================================================================== */
49 
50 /* If you're compiling this for MAME, only change M68K_COMPILE_FOR_MAME
51  * to OPT_ON and use m68kmame.h to configure the 68k core.
52  */
53 #ifndef M68K_COMPILE_FOR_MAME
54 #define M68K_COMPILE_FOR_MAME      OPT_OFF
55 #endif /* M68K_COMPILE_FOR_MAME */
56 
57 
58 #if M68K_COMPILE_FOR_MAME == OPT_OFF
59 
60 
61 /* ======================================================================== */
62 /* ============================= CONFIGURATION ============================ */
63 /* ======================================================================== */
64 
65 /* Turn ON if you want to use the following M68K variants */
66 #define M68K_EMULATE_010            OPT_OFF
67 #define M68K_EMULATE_EC020          OPT_OFF
68 #define M68K_EMULATE_020            OPT_OFF
69 
70 
71 /* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
72  * and m68k_read_pcrelative_xx() for PC-relative addressing.
73  * If off, all read requests from the CPU will be redirected to m68k_read_xx()
74  */
75 #define M68K_SEPARATE_READS         OPT_OFF
76 
77 /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
78  * predecrement destination EA mode instead of m68k_write_32().
79  * To simulate real 68k behavior, m68k_write_32_pd() must first write the high
80  * word to [address+2], and then write the low word to [address].
81  */
82 #define M68K_SIMULATE_PD_WRITES     OPT_OFF
83 
84 /* If ON, CPU will call the interrupt acknowledge callback when it services an
85  * interrupt.
86  * If off, all interrupts will be autovectored and all interrupt requests will
87  * auto-clear when the interrupt is serviced.
88  */
89 #define M68K_EMULATE_INT_ACK        OPT_OFF
90 #define M68K_INT_ACK_CALLBACK(A)    your_int_ack_handler_function(A)
91 
92 
93 /* If ON, CPU will call the breakpoint acknowledge callback when it encounters
94  * a breakpoint instruction and it is running a 68010+.
95  */
96 #define M68K_EMULATE_BKPT_ACK       OPT_OFF
97 #define M68K_BKPT_ACK_CALLBACK()    your_bkpt_ack_handler_function()
98 
99 
100 /* If ON, the CPU will monitor the trace flags and take trace exceptions
101  */
102 #define M68K_EMULATE_TRACE          OPT_OFF
103 
104 
105 /* If ON, CPU will call the output reset callback when it encounters a reset
106  * instruction.
107  */
108 #define M68K_EMULATE_RESET          OPT_ON
109 #define M68K_RESET_CALLBACK()       your_reset_handler_function()
110 
111 
112 /* If ON, CPU will call the set fc callback on every memory access to
113  * differentiate between user/supervisor, program/data access like a real
114  * 68000 would.  This should be enabled and the callback should be set if you
115  * want to properly emulate the m68010 or higher. (moves uses function codes
116  * to read/write data from different address spaces)
117  */
118 #define M68K_EMULATE_FC             OPT_OFF
119 #define M68K_SET_FC_CALLBACK(A)     your_set_fc_handler_function(A)
120 
121 
122 /* If ON, CPU will call the pc changed callback when it changes the PC by a
123  * large value.  This allows host programs to be nicer when it comes to
124  * fetching immediate data and instructions on a banked memory system.
125  */
126 #define M68K_MONITOR_PC             OPT_OFF
127 #define M68K_SET_PC_CALLBACK(A)     your_pc_changed_handler_function(A)
128 
129 
130 /* If ON, CPU will call the instruction hook callback before every
131  * instruction.
132  */
133 #define M68K_INSTRUCTION_HOOK       OPT_OFF
134 #define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function()
135 
136 
137 /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
138 #define M68K_EMULATE_PREFETCH       OPT_OFF
139 
140 
141 /* If ON, the CPU will generate address error exceptions if it tries to
142  * access a word or longword at an odd address.
143  * NOTE: This is only emulated properly for 68000 mode.
144  */
145 #define M68K_EMULATE_ADDRESS_ERROR  OPT_OFF
146 
147 
148 /* Turn ON to enable logging of illegal instruction calls.
149  * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
150  * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
151  */
152 #define M68K_LOG_ENABLE             OPT_OFF
153 #define M68K_LOG_1010_1111          OPT_OFF
154 #define M68K_LOG_FILEHANDLE         some_file_handle
155 
156 
157 /* ----------------------------- COMPATIBILITY ---------------------------- */
158 
159 /* The following options set optimizations that violate the current ANSI
160  * standard, but will be compliant under the forthcoming C9X standard.
161  */
162 
163 
164 /* If ON, the enulation core will use 64-bit integers to speed up some
165  * operations.
166 */
167 #define M68K_USE_64_BIT  OPT_OFF
168 
169 
170 /* Set to your compiler's static inline keyword to enable it, or
171  * set it to blank to disable it.
172  * If you define INLINE in the makefile, it will override this value.
173  * NOTE: not enabling inline functions will SEVERELY slow down emulation.
174  */
175 #ifndef INLINE
176 #ifdef _MSC_VER
177 #define INLINE _inline
178 #else
179 #define INLINE static inline
180 #endif
181 #endif /* INLINE */
182 
183 #endif /* M68K_COMPILE_FOR_MAME */
184 
185 
186 /* ======================================================================== */
187 /* ============================== END OF FILE ============================= */
188 /* ======================================================================== */
189 
190 #endif /* M68KCONF__HEADER */
191