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