diff options
author | 2008-11-06 10:17:31 +0000 | |
---|---|---|
committer | 2008-11-06 10:17:31 +0000 | |
commit | 67db279bb2505252caf8f3250cee55e78a5a0bed (patch) | |
tree | 328f223defb5dc097d57ac0f18cc2053669cfdf3 /src/emu/cpu/m68000 | |
parent | 31ae2af798310c81b778e81b8c3753d731a809a7 (diff) |
Fixed compilation issues with 68000 changes.
Began the process of pruning options from the 68000 core, hard-coding it
for MAME's needs. We've hacked on it sufficiently that it is no longer
generic, so this is a good opportunity to simplify the code so that it
can actually be followed.
Diffstat (limited to 'src/emu/cpu/m68000')
-rw-r--r-- | src/emu/cpu/m68000/m68k.h | 28 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kconf.h | 202 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kcpu.c | 14 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kcpu.h | 193 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kdasm.c | 5 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kmame.c | 6 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kmame.h | 71 |
7 files changed, 48 insertions, 471 deletions
diff --git a/src/emu/cpu/m68000/m68k.h b/src/emu/cpu/m68000/m68k.h index f92366497e6..1f8666d0aeb 100644 --- a/src/emu/cpu/m68000/m68k.h +++ b/src/emu/cpu/m68000/m68k.h @@ -181,8 +181,6 @@ void m68k_write_memory_32(m68ki_cpu_core *m68k, unsigned int address, unsigned i * predecrement destination mode is executed. * To simulate real 68k behavior, first write the high word to * [address+2], and then write the low word to [address]. - * - * Enable this functionality with M68K_SIMULATE_PD_WRITES in m68kconf.h. */ void m68k_write_memory_32_pd(m68ki_cpu_core *m68k, unsigned int address, unsigned int value); @@ -201,7 +199,6 @@ void m68k_write_memory_32_pd(m68ki_cpu_core *m68k, unsigned int address, unsigne */ /* Set the callback for an interrupt acknowledge. - * You must enable M68K_EMULATE_INT_ACK in m68kconf.h. * The CPU will call the callback with the interrupt level being acknowledged. * The host program must return either a vector from 0x02-0xff, or one of the * special interrupt acknowledge values specified earlier in this header. @@ -214,7 +211,6 @@ void m68k_set_int_ack_callback(m68ki_cpu_core *m68k, void *param, int (*callbac /* Set the callback for a breakpoint acknowledge (68010+). - * You must enable M68K_EMULATE_BKPT_ACK in m68kconf.h. * The CPU will call the callback with whatever was in the data field of the * BKPT instruction for 68020+, or 0 for 68010. * Default behavior: do nothing. @@ -223,7 +219,6 @@ void m68k_set_bkpt_ack_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned /* Set the callback for the RESET instruction. - * You must enable M68K_EMULATE_RESET in m68kconf.h. * The CPU calls this callback every time it encounters a RESET instruction. * Default behavior: do nothing. */ @@ -231,7 +226,6 @@ void m68k_set_reset_instr_callback(m68ki_cpu_core *m68k, void (*callback)(void) /* Set the callback for the CMPI.L #v, Dn instruction. - * You must enable M68K_CMPILD_HAS_CALLBACK in m68kconf.h. * The CPU calls this callback every time it encounters a CMPI.L #v, Dn instruction. * Default behavior: do nothing. */ @@ -239,14 +233,12 @@ void m68k_set_cmpild_instr_callback(m68ki_cpu_core *m68k, void (*callback)(unsi /* Set the callback for the RTE instruction. - * You must enable M68K_RTE_HAS_CALLBACK in m68kconf.h. * The CPU calls this callback every time it encounters a RTE instruction. * Default behavior: do nothing. */ void m68k_set_rte_instr_callback(m68ki_cpu_core *m68k, void (*callback)(void)); /* Set the callback for the TAS instruction. - * You must enable M68K_TAS_HAS_CALLBACK in m68kconf.h. * The CPU calls this callback every time it encounters a TAS instruction. * Default behavior: return 1, allow writeback. */ @@ -254,15 +246,6 @@ void m68k_set_tas_instr_callback(m68ki_cpu_core *m68k, int (*callback)(void)); -/* Set the callback for informing of a large PC change. - * You must enable M68K_MONITOR_PC in m68kconf.h. - * The CPU calls this callback with the new PC value every time the PC changes - * by a large value (currently set for changes by longwords). - * Default behavior: do nothing. - */ -void m68k_set_pc_changed_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned int new_pc)); - - /* Set the callback for CPU function code changes. * You must enable M68K_EMULATE_FC in m68kconf.h. * The CPU calls this callback with the function code before every memory @@ -273,15 +256,6 @@ void m68k_set_pc_changed_callback(m68ki_cpu_core *m68k, void (*callback)(unsign void m68k_set_fc_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned int new_fc)); -/* Set a callback for the instruction cycle of the CPU. - * You must enable M68K_INSTRUCTION_HOOK in m68kconf.h. - * The CPU calls this callback just before fetching the opcode in the - * instruction cycle. - * Default behavior: do nothing. - */ -void m68k_set_instr_hook_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned int pc)); - - /* ======================================================================== */ /* ====================== FUNCTIONS TO ACCESS THE CPU ===================== */ @@ -378,9 +352,7 @@ unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigne /* ============================== MAME STUFF ============================== */ /* ======================================================================== */ -#if M68K_COMPILE_FOR_MAME == OPT_ON #include "m68kmame.h" -#endif /* M68K_COMPILE_FOR_MAME */ /* ======================================================================== */ diff --git a/src/emu/cpu/m68000/m68kconf.h b/src/emu/cpu/m68000/m68kconf.h index 61d250141b2..e69de29bb2d 100644 --- a/src/emu/cpu/m68000/m68kconf.h +++ b/src/emu/cpu/m68000/m68kconf.h @@ -1,202 +0,0 @@ -/* ======================================================================== */ -/* ========================= LICENSING & COPYRIGHT ======================== */ -/* ======================================================================== */ -/* - * MUSASHI - * Version 3.32 - * - * A portable Motorola M680x0 processor emulation engine. - * Copyright Karl Stenerud. All rights reserved. - * - * This code may be freely used for non-commercial purposes as long as this - * copyright notice remains unaltered in the source code and any binary files - * containing this code in compiled form. - * - * All other licensing terms must be negotiated with the author - * (Karl Stenerud). - * - * The latest version of this code can be obtained at: - * http://kstenerud.cjb.net - */ - - -#pragma once - -#ifndef __M68KCONF_H__ -#define __M68KCONF_H__ - - -/* Configuration switches. - * Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks. - * OPT_SPECIFY_HANDLER causes the core to link directly to the function - * or macro you specify, rather than using callback functions whose pointer - * must be passed in using m68k_set_xxx_callback(). - */ -#define OPT_OFF 0 -#define OPT_ON 1 -#define OPT_SPECIFY_HANDLER 2 - - -/* ======================================================================== */ -/* ============================== MAME STUFF ============================== */ -/* ======================================================================== */ - -/* If you're compiling this for MAME, only change M68K_COMPILE_FOR_MAME - * to OPT_ON and use m68kmame.h to configure the 68k core. - */ -#ifndef M68K_COMPILE_FOR_MAME -#define M68K_COMPILE_FOR_MAME OPT_ON -#endif /* M68K_COMPILE_FOR_MAME */ - - -#if M68K_COMPILE_FOR_MAME == OPT_OFF - - -/* ======================================================================== */ -/* ============================= CONFIGURATION ============================ */ -/* ======================================================================== */ - -/* Turn ON if you want to use the following M68K variants */ -#define M68K_EMULATE_008 OPT_ON -#define M68K_EMULATE_010 OPT_ON -#define M68K_EMULATE_EC020 OPT_ON -#define M68K_EMULATE_020 OPT_ON -#define M68K_EMULATE_040 OPT_ON - - -/* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing - * and m68k_read_pcrelative_xx() for PC-relative addressing. - * If off, all read requests from the CPU will be redirected to m68k_read_xx() - */ -#define M68K_SEPARATE_READS OPT_OFF - -/* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a - * predecrement destination EA mode instead of m68k_write_32(). - * To simulate real 68k behavior, m68k_write_32_pd() must first write the high - * word to [address+2], and then write the low word to [address]. - */ -#define M68K_SIMULATE_PD_WRITES OPT_OFF - -/* If ON, CPU will call the interrupt acknowledge callback when it services an - * interrupt. - * If off, all interrupts will be autovectored and all interrupt requests will - * auto-clear when the interrupt is serviced. - */ -#define M68K_EMULATE_INT_ACK OPT_OFF -#define M68K_INT_ACK_CALLBACK(A) your_int_ack_handler_function(A) - - -/* If ON, CPU will call the breakpoint acknowledge callback when it encounters - * a breakpoint instruction and it is running a 68010+. - */ -#define M68K_EMULATE_BKPT_ACK OPT_OFF -#define M68K_BKPT_ACK_CALLBACK() your_bkpt_ack_handler_function() - - -/* If ON, the CPU will monitor the trace flags and take trace exceptions - */ -#define M68K_EMULATE_TRACE OPT_OFF - - -/* If ON, CPU will call the output reset callback when it encounters a reset - * instruction. - */ -#define M68K_EMULATE_RESET OPT_OFF -#define M68K_RESET_CALLBACK() your_reset_handler_function() - - -/* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn - * instruction. - */ -#define M68K_CMPILD_HAS_CALLBACK OPT_OFF -#define M68K_CMPILD_CALLBACK(v,r) your_cmpild_handler_function(v,r) - - -/* If ON, CPU will call the callback when it encounters a rte - * instruction. - */ -#define M68K_RTE_HAS_CALLBACK OPT_OFF -#define M68K_RTE_CALLBACK() your_rte_handler_function() - -/* If ON, CPU will call the callback when it encounters a tas - * instruction. - */ -#define M68K_TAS_HAS_CALLBACK OPT_OFF -#define M68K_TAS_CALLBACK() your_tas_handler_function() - - -/* If ON, CPU will call the set fc callback on every memory access to - * differentiate between user/supervisor, program/data access like a real - * 68000 would. This should be enabled and the callback should be set if you - * want to properly emulate the m68010 or higher. (moves uses function codes - * to read/write data from different address spaces) - */ -#define M68K_EMULATE_FC OPT_OFF -#define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A) - - -/* If ON, CPU will call the pc changed callback when it changes the PC by a - * large value. This allows host programs to be nicer when it comes to - * fetching immediate data and instructions on a banked memory system. - */ -#define M68K_MONITOR_PC OPT_OFF -#define M68K_SET_PC_CALLBACK(A) your_pc_changed_handler_function(A) - - -/* If ON, CPU will call the instruction hook callback before every - * instruction. - */ -#define M68K_INSTRUCTION_HOOK OPT_OFF -#define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function() - - -/* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */ -#define M68K_EMULATE_PREFETCH OPT_OFF - - -/* If ON, the CPU will generate address error exceptions if it tries to - * access a word or longword at an odd address. - * NOTE: This is only emulated properly for 68000 mode. - */ -#define M68K_EMULATE_ADDRESS_ERROR OPT_OFF - - -/* Turn ON to enable logging of illegal instruction calls. - * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream. - * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls. - */ -#define M68K_LOG_ENABLE OPT_OFF -#define M68K_LOG_1010_1111 OPT_OFF -#define M68K_LOG_FILEHANDLE some_file_handle - - -/* ----------------------------- COMPATIBILITY ---------------------------- */ - -/* The following options set optimizations that violate the current ANSI - * standard, but will be compliant under the forthcoming C9X standard. - */ - - -/* If ON, the enulation core will use 64-bit integers to speed up some - * operations. -*/ -#define M68K_USE_64_BIT OPT_OFF - - -/* Set to your compiler's static inline keyword to enable it, or - * set it to blank to disable it. - * If you define INLINE in the makefile, it will override this value. - * NOTE: not enabling inline functions will SEVERELY slow down emulation. - */ -#ifndef INLINE -#define INLINE static __inline__ -#endif /* INLINE */ - -#endif /* M68K_COMPILE_FOR_MAME */ - - -/* ======================================================================== */ -/* ============================== END OF FILE ============================= */ -/* ======================================================================== */ - -#endif /* __M68KCONF_H__ */ diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index e86b182cbfb..9a947595438 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -32,6 +32,7 @@ static const char copyright_notice[] = /* ================================ INCLUDES ============================== */ /* ======================================================================== */ +#include <setjmp.h> #include "m68kcpu.h" #include "m68kops.h" #include "m68kfpu.c" @@ -443,10 +444,8 @@ static int default_int_ack_callback(void *param, int int_level) } /* Breakpoint acknowledge */ -static unsigned int default_bkpt_ack_callback_data; static void default_bkpt_ack_callback(unsigned int data) { - default_bkpt_ack_callback_data = data; } /* Called when a reset instruction is executed */ @@ -490,11 +489,6 @@ static void default_instr_hook_callback(unsigned int pc) } -#if M68K_EMULATE_ADDRESS_ERROR - #include <setjmp.h> -#endif /* M68K_EMULATE_ADDRESS_ERROR */ - - /* ======================================================================== */ /* ================================= API ================================== */ /* ======================================================================== */ @@ -925,10 +919,8 @@ void m68k_pulse_reset(m68ki_cpu_core *m68k) m68ki_set_sm_flag(m68k, SFLAG_SET | MFLAG_CLEAR); /* Invalidate the prefetch queue */ -#if M68K_EMULATE_PREFETCH /* Set to arbitrary number since our first fetch is from 0 */ CPU_PREF_ADDR = 0x1000; -#endif /* M68K_EMULATE_PREFETCH */ /* Read the initial stack pointer and program counter */ m68ki_jump(m68k, 0); @@ -959,8 +951,6 @@ unsigned int m68k_context_size() /* ============================== MAME STUFF ============================== */ /* ======================================================================== */ -#if M68K_COMPILE_FOR_MAME == OPT_ON - #include "deprecat.h" static struct { @@ -1010,8 +1000,6 @@ void m68k_state_register(m68ki_cpu_core *m68k, const char *type, int index) state_save_register_postload(Machine, m68k_post_load, m68k); } -#endif /* M68K_COMPILE_FOR_MAME */ - /* ======================================================================== */ /* ============================== END OF FILE ============================= */ /* ======================================================================== */ diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h index bcbb31ad0cc..0fbaf7e6acd 100644 --- a/src/emu/cpu/m68000/m68kcpu.h +++ b/src/emu/cpu/m68000/m68kcpu.h @@ -30,10 +30,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; #include "m68k.h" #include <limits.h> - -#if M68K_EMULATE_ADDRESS_ERROR #include <setjmp.h> -#endif /* M68K_EMULATE_ADDRESS_ERROR */ /* ======================================================================== */ /* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */ @@ -374,7 +371,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; /* These defines are dependant on the configuration defines in m68kconf.h */ /* Disable certain comparisons if we're not using all CPU types */ -#if M68K_EMULATE_040 +#if HAS_M68040 #define CPU_TYPE_IS_040_PLUS(A) ((A) & CPU_TYPE_040) #define CPU_TYPE_IS_040_LESS(A) 1 #else @@ -382,7 +379,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; #define CPU_TYPE_IS_040_LESS(A) 1 #endif -#if M68K_EMULATE_020 +#if HAS_M68020 #define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040)) #define CPU_TYPE_IS_020_LESS(A) 1 #else @@ -390,7 +387,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; #define CPU_TYPE_IS_020_LESS(A) 1 #endif -#if M68K_EMULATE_EC020 +#if HAS_M68EC020 #define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) #define CPU_TYPE_IS_EC020_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020)) #else @@ -398,7 +395,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; #define CPU_TYPE_IS_EC020_LESS(A) CPU_TYPE_IS_020_LESS(A) #endif -#if M68K_EMULATE_010 +#if HAS_M68010 #define CPU_TYPE_IS_010(A) ((A) == CPU_TYPE_010) #define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) #define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010)) @@ -408,13 +405,13 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; #define CPU_TYPE_IS_010_LESS(A) CPU_TYPE_IS_EC020_LESS(A) #endif -#if M68K_EMULATE_020 || M68K_EMULATE_EC020 +#if HAS_M68020 || HAS_M68EC020 #define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020)) #else #define CPU_TYPE_IS_020_VARIANT(A) 0 #endif -#if M68K_EMULATE_040 || M68K_EMULATE_020 || M68K_EMULATE_EC020 || M68K_EMULATE_010 +#if HAS_M68040 || HAS_M68020 || HAS_M68EC020 || HAS_M68010 #define CPU_TYPE_IS_000(A) ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008) #else #define CPU_TYPE_IS_000(A) 1 @@ -432,87 +429,21 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; /* Enable or disable callback functions */ -#if M68K_EMULATE_INT_ACK - #if M68K_EMULATE_INT_ACK == OPT_SPECIFY_HANDLER - #define m68ki_int_ack(M, A) M68K_INT_ACK_CALLBACK(M, A) - #else - #define m68ki_int_ack(M, A) CALLBACK_INT_ACK((M)->int_ack_param, A) - #endif -#else - /* Default action is to used autovector mode, which is most common */ - #define m68ki_int_ack(M, A) M68K_INT_ACK_AUTOVECTOR -#endif /* M68K_EMULATE_INT_ACK */ +#define m68ki_int_ack(M, A) CALLBACK_INT_ACK((M)->int_ack_param, A) -#if M68K_EMULATE_BKPT_ACK - #if M68K_EMULATE_BKPT_ACK == OPT_SPECIFY_HANDLER - #define m68ki_bkpt_ack(A) M68K_BKPT_ACK_CALLBACK(A) - #else - #define m68ki_bkpt_ack(A) CALLBACK_BKPT_ACK(A) - #endif -#else - #define m68ki_bkpt_ack(A) -#endif /* M68K_EMULATE_BKPT_ACK */ +#define m68ki_bkpt_ack(A) CALLBACK_BKPT_ACK(A) -#if M68K_EMULATE_RESET - #if M68K_EMULATE_RESET == OPT_SPECIFY_HANDLER - #define m68ki_output_reset() M68K_RESET_CALLBACK() - #else - #define m68ki_output_reset() CALLBACK_RESET_INSTR() - #endif -#else - #define m68ki_output_reset() -#endif /* M68K_EMULATE_RESET */ +#define m68ki_output_reset() CALLBACK_RESET_INSTR() -#if M68K_CMPILD_HAS_CALLBACK - #if M68K_CMPILD_HAS_CALLBACK == OPT_SPECIFY_HANDLER - #define m68ki_cmpild_callback(v,r) M68K_CMPILD_CALLBACK(v,r) - #else - #define m68ki_cmpild_callback(v,r) CALLBACK_CMPILD_INSTR(v,r) - #endif -#else - #define m68ki_cmpild_callback(v,r) -#endif /* M68K_CMPILD_HAS_CALLBACK */ +#define m68ki_cmpild_callback(v,r) CALLBACK_CMPILD_INSTR(v,r) -#if M68K_RTE_HAS_CALLBACK - #if M68K_RTE_HAS_CALLBACK == OPT_SPECIFY_HANDLER - #define m68ki_rte_callback() M68K_RTE_CALLBACK() - #else - #define m68ki_rte_callback() CALLBACK_RTE_INSTR() - #endif -#else - #define m68ki_rte_callback() -#endif /* M68K_RTE_HAS_CALLBACK */ +#define m68ki_rte_callback() CALLBACK_RTE_INSTR() -#if M68K_TAS_HAS_CALLBACK - #if M68K_TAS_HAS_CALLBACK == OPT_SPECIFY_HANDLER - #define m68ki_tas_callback() M68K_TAS_CALLBACK() - #else - #define m68ki_tas_callback() CALLBACK_TAS_INSTR() - #endif -#else - #define m68ki_tas_callback() -#endif /* M68K_TAS_HAS_CALLBACK */ +#define m68ki_tas_callback() CALLBACK_TAS_INSTR() +#define m68ki_instr_hook(pc) debugger_instruction_hook(Machine, pc) -#if M68K_INSTRUCTION_HOOK - #if M68K_INSTRUCTION_HOOK == OPT_SPECIFY_HANDLER - #define m68ki_instr_hook(pc) M68K_INSTRUCTION_CALLBACK(pc) - #else - #define m68ki_instr_hook(pc) CALLBACK_INSTR_HOOK(pc) - #endif -#else - #define m68ki_instr_hook() -#endif /* M68K_INSTRUCTION_HOOK */ - -#if M68K_MONITOR_PC - #if M68K_MONITOR_PC == OPT_SPECIFY_HANDLER - #define m68ki_pc_changed(A) M68K_SET_PC_CALLBACK(ADDRESS_68K(A)) - #else - #define m68ki_pc_changed(A) CALLBACK_PC_CHANGED(ADDRESS_68K(A)) - #endif -#else - #define m68ki_pc_changed(A) -#endif /* M68K_MONITOR_PC */ +#define m68ki_pc_changed(A) change_pc(ADDRESS_68K(A)) /* Enable or disable function code emulation */ @@ -553,39 +484,31 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; /* Address error */ -#if M68K_EMULATE_ADDRESS_ERROR - #include <setjmp.h> - - #define m68ki_set_address_error_trap(m68k) \ - if(setjmp(m68k->aerr_trap) != 0) \ +#define m68ki_set_address_error_trap(m68k) \ + if(setjmp(m68k->aerr_trap) != 0) \ + { \ + m68ki_exception_address_error(m68k); \ + if(CPU_STOPPED) \ { \ - m68ki_exception_address_error(m68k); \ - if(CPU_STOPPED) \ - { \ - SET_CYCLES(m68k, 0); \ - return m68k->initial_cycles; \ - } \ - } + SET_CYCLES(m68k, 0); \ + return m68k->initial_cycles; \ + } \ + } - #define m68ki_check_address_error(m68k, ADDR, WRITE_MODE, FC) \ - if((ADDR)&1) \ - { \ - m68k->aerr_address = ADDR; \ - m68k->aerr_write_mode = WRITE_MODE; \ - m68k->aerr_fc = FC; \ - longjmp(m68k->aerr_trap, 1); \ - } +#define m68ki_check_address_error(m68k, ADDR, WRITE_MODE, FC) \ + if((ADDR)&1) \ + { \ + m68k->aerr_address = ADDR; \ + m68k->aerr_write_mode = WRITE_MODE; \ + m68k->aerr_fc = FC; \ + longjmp(m68k->aerr_trap, 1); \ + } - #define m68ki_check_address_error_010_less(m68k, ADDR, WRITE_MODE, FC) \ - if (CPU_TYPE_IS_010_LESS(CPU_TYPE)) \ - { \ - m68ki_check_address_error(m68k, ADDR, WRITE_MODE, FC) \ - } -#else - #define m68ki_set_address_error_trap(M) - #define m68ki_check_address_error(M, ADDR, WRITE_MODE, FC) - #define m68ki_check_address_error_010_less(M, ADDR, WRITE_MODE, FC) -#endif /* M68K_ADDRESS_ERROR */ +#define m68ki_check_address_error_010_less(m68k, ADDR, WRITE_MODE, FC) \ + if (CPU_TYPE_IS_010_LESS(CPU_TYPE)) \ + { \ + m68ki_check_address_error(m68k, ADDR, WRITE_MODE, FC) \ + } /* Logging */ #if M68K_LOG_ENABLE @@ -809,12 +732,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core; #define m68ki_write_8(M, A, V) m68ki_write_8_fc (M, A, FLAG_S | FUNCTION_CODE_USER_DATA, V) #define m68ki_write_16(M, A, V) m68ki_write_16_fc(M, A, FLAG_S | FUNCTION_CODE_USER_DATA, V) #define m68ki_write_32(M, A, V) m68ki_write_32_fc(M, A, FLAG_S | FUNCTION_CODE_USER_DATA, V) - -#if M68K_SIMULATE_PD_WRITES #define m68ki_write_32_pd(M, A, V) m68ki_write_32_pd_fc(M, A, FLAG_S | FUNCTION_CODE_USER_DATA, V) -#else -#define m68ki_write_32_pd(M, A, V) m68ki_write_32_fc(M, A, FLAG_S | FUNCTION_CODE_USER_DATA, V) -#endif /* map read immediate 8 to read immediate 16 */ #define m68ki_read_imm_8(M) MASK_OUT_ABOVE_8(m68ki_read_imm_16(M)) @@ -900,10 +818,7 @@ struct _m68ki_cpu_core uint tracing; uint address_space; -#if M68K_EMULATE_ADDRESS_ERROR jmp_buf aerr_trap; -#endif /* M68K_EMULATE_ADDRESS_ERROR */ - uint aerr_address; uint aerr_write_mode; uint aerr_fc; @@ -949,9 +864,7 @@ INLINE uint m68ki_read_32_fc (m68ki_cpu_core *m68k, uint address, uint fc); INLINE void m68ki_write_8_fc (m68ki_cpu_core *m68k, uint address, uint fc, uint value); INLINE void m68ki_write_16_fc(m68ki_cpu_core *m68k, uint address, uint fc, uint value); INLINE void m68ki_write_32_fc(m68ki_cpu_core *m68k, uint address, uint fc, uint value); -#if M68K_SIMULATE_PD_WRITES INLINE void m68ki_write_32_pd_fc(m68ki_cpu_core *m68k, uint address, uint fc, uint value); -#endif /* M68K_SIMULATE_PD_WRITES */ /* Indexed and PC-relative ea fetching */ INLINE uint m68ki_get_ea_pcdi(m68ki_cpu_core *m68k); @@ -1068,11 +981,11 @@ char* m68ki_disassemble_quick(unsigned int pc, unsigned int cpu_type); */ INLINE uint m68ki_read_imm_16(m68ki_cpu_core *m68k) { + uint result; + m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ m68ki_check_address_error(m68k, REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ -#if M68K_EMULATE_PREFETCH -{ - uint result; + if(REG_PC != CPU_PREF_ADDR) { CPU_PREF_ADDR = REG_PC; @@ -1084,14 +997,9 @@ INLINE uint m68ki_read_imm_16(m68ki_cpu_core *m68k) CPU_PREF_DATA = m68k_read_immediate_16(m68k, ADDRESS_68K(CPU_PREF_ADDR)); return result; } -#else - REG_PC += 2; - return m68k_read_immediate_16(m68k, ADDRESS_68K(REG_PC-2)); -#endif /* M68K_EMULATE_PREFETCH */ -} + INLINE uint m68ki_read_imm_32(m68ki_cpu_core *m68k) { -#if M68K_EMULATE_PREFETCH uint temp_val; m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ @@ -1113,12 +1021,6 @@ INLINE uint m68ki_read_imm_32(m68ki_cpu_core *m68k) CPU_PREF_DATA = m68k_read_immediate_16(m68k, ADDRESS_68K(CPU_PREF_ADDR)); return temp_val; -#else - m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error(m68k, REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - REG_PC += 4; - return m68k_read_immediate_32(m68k, ADDRESS_68K(REG_PC-4)); -#endif /* M68K_EMULATE_PREFETCH */ } @@ -1167,14 +1069,12 @@ INLINE void m68ki_write_32_fc(m68ki_cpu_core *m68k, uint address, uint fc, uint m68k_write_memory_32(m68k, ADDRESS_68K(address), value); } -#if M68K_SIMULATE_PD_WRITES INLINE void m68ki_write_32_pd_fc(m68ki_cpu_core *m68k, uint address, uint fc, uint value) { m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ m68ki_check_address_error_010_less(m68k, address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ m68k_write_memory_32_pd(m68k, ADDRESS_68K(address), value); } -#endif /* --------------------- Effective Address Calculation -------------------- */ @@ -1828,12 +1728,10 @@ INLINE void m68ki_exception_trace(m68ki_cpu_core *m68k) if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) { - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON if(CPU_TYPE_IS_000(CPU_TYPE)) { CPU_INSTR_MODE = INSTRUCTION_NO; } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ m68ki_stack_frame_0000(m68k, REG_PC, sr, EXCEPTION_TRACE); } else @@ -1853,12 +1751,10 @@ INLINE void m68ki_exception_privilege_violation(m68ki_cpu_core *m68k) { uint sr = m68ki_init_exception(m68k); - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON if(CPU_TYPE_IS_000(CPU_TYPE)) { CPU_INSTR_MODE = INSTRUCTION_NO; } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ m68ki_stack_frame_0000(m68k, REG_PPC, sr, EXCEPTION_PRIVILEGE_VIOLATION); m68ki_jump_vector(m68k, EXCEPTION_PRIVILEGE_VIOLATION); @@ -1915,12 +1811,10 @@ INLINE void m68ki_exception_illegal(m68ki_cpu_core *m68k) sr = m68ki_init_exception(m68k); - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON if(CPU_TYPE_IS_000(CPU_TYPE)) { CPU_INSTR_MODE = INSTRUCTION_NO; } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ m68ki_stack_frame_0000(m68k, REG_PPC, sr, EXCEPTION_ILLEGAL_INSTRUCTION); m68ki_jump_vector(m68k, EXCEPTION_ILLEGAL_INSTRUCTION); @@ -1974,12 +1868,10 @@ void m68ki_exception_interrupt(m68ki_cpu_core *m68k, uint int_level) uint sr; uint new_pc; - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON if(CPU_TYPE_IS_000(CPU_TYPE)) { CPU_INSTR_MODE = INSTRUCTION_NO; } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ /* Turn off the stopped state */ CPU_STOPPED &= ~STOP_LEVEL_STOP; @@ -2032,11 +1924,6 @@ void m68ki_exception_interrupt(m68ki_cpu_core *m68k, uint int_level) /* Defer cycle counting until later */ USE_CYCLES(m68k, CYC_EXCEPTION[vector]); - -#if !M68K_EMULATE_INT_ACK - /* Automatically clear IRQ if we are not using an acknowledge scheme */ - CPU_INT_LEVEL = 0; -#endif /* M68K_EMULATE_INT_ACK */ } diff --git a/src/emu/cpu/m68000/m68kdasm.c b/src/emu/cpu/m68000/m68kdasm.c index 4dca7f577bb..d8bf1ecb903 100644 --- a/src/emu/cpu/m68000/m68kdasm.c +++ b/src/emu/cpu/m68000/m68kdasm.c @@ -125,13 +125,8 @@ /* Opcode flags */ -#if M68K_COMPILE_FOR_MAME == OPT_ON #define SET_OPCODE_FLAGS(x) g_opcode_type = x; #define COMBINE_OPCODE_FLAGS(x) ((x) | g_opcode_type | DASMFLAG_SUPPORTED) -#else -#define SET_OPCODE_FLAGS(x) -#define COMBINE_OPCODE_FLAGS(X) (x) -#endif /* ======================================================================== */ diff --git a/src/emu/cpu/m68000/m68kmame.c b/src/emu/cpu/m68000/m68kmame.c index af0f06d02e3..f129b7ecac8 100644 --- a/src/emu/cpu/m68000/m68kmame.c +++ b/src/emu/cpu/m68000/m68kmame.c @@ -197,7 +197,6 @@ static void m68000_set_context(void *src) static offs_t m68000_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { - M68K_SET_PC_CALLBACK(pc); return m68k_disassemble_raw(buffer, pc, oprom, opram, M68K_CPU_TYPE_68000); } @@ -245,7 +244,6 @@ static void m68008_set_context(void *src) static offs_t m68008_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { - M68K_SET_PC_CALLBACK(pc); return m68k_disassemble_raw(buffer, pc, oprom, opram, M68K_CPU_TYPE_68008); } @@ -267,7 +265,6 @@ static void m68010_init(int index, int clock, const void *config, int (*irqcallb static offs_t m68010_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { - M68K_SET_PC_CALLBACK(pc); return m68k_disassemble_raw(buffer, pc, oprom, opram, M68K_CPU_TYPE_68010); } @@ -316,7 +313,6 @@ static void m68020_set_context(void *src) static offs_t m68020_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { - M68K_SET_PC_CALLBACK(pc); return m68k_disassemble_raw(buffer, pc, oprom, opram, M68K_CPU_TYPE_68020); } @@ -337,7 +333,6 @@ static void m68ec020_init(int index, int clock, const void *config, int (*irqcal static offs_t m68ec020_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { - M68K_SET_PC_CALLBACK(pc); return m68k_disassemble_raw(buffer, pc, oprom, opram, M68K_CPU_TYPE_68EC020); } @@ -387,7 +382,6 @@ static void m68040_set_context(void *src) static offs_t m68040_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { - M68K_SET_PC_CALLBACK(pc); return m68k_disassemble_raw(buffer, pc, oprom, opram, M68K_CPU_TYPE_68040); } diff --git a/src/emu/cpu/m68000/m68kmame.h b/src/emu/cpu/m68000/m68kmame.h index 31b0f75c7f0..12cce886481 100644 --- a/src/emu/cpu/m68000/m68kmame.h +++ b/src/emu/cpu/m68000/m68kmame.h @@ -11,48 +11,25 @@ #include "deprecat.h" #include "m68000.h" -/* Configuration switches (see m68kconf.h for explanation) */ -#define M68K_SEPARATE_READS OPT_ON - -#define M68K_SIMULATE_PD_WRITES OPT_ON +#ifndef __M68KCPU_H__ +#define m68ki_cpu_core void +#endif -#define M68K_EMULATE_INT_ACK OPT_ON -#define M68K_INT_ACK_CALLBACK(A) +#define OPT_ON 1 +#define OPT_OFF 0 -#define M68K_EMULATE_BKPT_ACK OPT_OFF -#define M68K_BKPT_ACK_CALLBACK() +/* Configuration switches (see m68kconf.h for explanation) */ +#define M68K_SEPARATE_READS OPT_ON #define M68K_EMULATE_TRACE OPT_OFF -#define M68K_EMULATE_RESET OPT_ON -#define M68K_RESET_CALLBACK() - -#define M68K_CMPILD_HAS_CALLBACK OPT_ON -#define M68K_CMPILD_CALLBACK() - -#define M68K_RTE_HAS_CALLBACK OPT_ON -#define M68K_RTE_CALLBACK() - -#define M68K_TAS_HAS_CALLBACK OPT_ON -#define M68K_TAS_CALLBACK() - #define M68K_EMULATE_FC OPT_OFF #define M68K_SET_FC_CALLBACK(A) -#define M68K_MONITOR_PC OPT_SPECIFY_HANDLER -#define M68K_SET_PC_CALLBACK(A) change_pc(A) - -#define M68K_INSTRUCTION_HOOK OPT_SPECIFY_HANDLER -#define M68K_INSTRUCTION_CALLBACK(A) debugger_instruction_hook(Machine, A) - -#define M68K_EMULATE_PREFETCH OPT_ON - #define M68K_LOG_ENABLE OPT_OFF #define M68K_LOG_1010_1111 OPT_OFF #define M68K_LOG_FILEHANDLE errorlog -#define M68K_EMULATE_ADDRESS_ERROR OPT_ON - #define M68K_USE_64_BIT OPT_OFF @@ -134,40 +111,6 @@ INLINE void m68kx_write_memory_32_pd(m68ki_cpu_core *m68k, unsigned int address, void m68k_set_encrypted_opcode_range(int cpunum, offs_t start, offs_t end); -/* M68K Variants */ -#if HAS_M68008 -#define M68K_EMULATE_008 OPT_ON -#else -#define M68K_EMULATE_008 OPT_OFF -#endif - -#if HAS_M68010 -#define M68K_EMULATE_010 OPT_ON -#else -#define M68K_EMULATE_010 OPT_OFF -#endif - -#undef M68K_EMULATE_010 -#define M68K_EMULATE_010 OPT_ON - -#if HAS_M68EC020 -#define M68K_EMULATE_EC020 OPT_ON -#else -#define M68K_EMULATE_EC020 OPT_OFF -#endif - -#if HAS_M68020 -#define M68K_EMULATE_020 OPT_ON -#else -#define M68K_EMULATE_020 OPT_OFF -#endif - -#if HAS_M68040 -#define M68K_EMULATE_040 OPT_ON -#else -#define M68K_EMULATE_040 OPT_OFF -#endif - /* ======================================================================== */ /* ============================== END OF FILE ============================= */ /* ======================================================================== */ |