From f78f3e605a6188cf193ef6018634830d3743c78b Mon Sep 17 00:00:00 2001 From: EkeEke Date: Fri, 19 Apr 2013 16:54:55 +0200 Subject: [PATCH] Fixed broken 68k address error emulation --- source/cart_hw/md_cart.c | 5 ---- source/genesis.c | 1 + source/m68k/m68k.h | 60 ++++++++++++++++------------------------ 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/source/cart_hw/md_cart.c b/source/cart_hw/md_cart.c index 35a9ec8..8889e49 100644 --- a/source/cart_hw/md_cart.c +++ b/source/cart_hw/md_cart.c @@ -520,11 +520,6 @@ void md_cart_init(void) } } -#if M68K_EMULATE_ADDRESS_ERROR - /* default behavior */ - m68k.aerr_enabled = config.addr_error; -#endif - /* detect specific mappers */ if (strstr(rominfo.domestic,"SUPER STREET FIGHTER2") != NULL) { diff --git a/source/genesis.c b/source/genesis.c index 7eec88d..729d59b 100644 --- a/source/genesis.c +++ b/source/genesis.c @@ -67,6 +67,7 @@ void gen_init(void) { /* initialize main 68k */ m68k_init(); + m68k.aerr_enabled = config.addr_error; /* initialize main 68k memory map */ diff --git a/source/m68k/m68k.h b/source/m68k/m68k.h index c85319d..f93b3fc 100644 --- a/source/m68k/m68k.h +++ b/source/m68k/m68k.h @@ -39,9 +39,9 @@ /* ================================ INCLUDES ============================== */ /* ======================================================================== */ +#include #include "macros.h" - /* ======================================================================== */ /* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */ /* ======================================================================== */ @@ -231,30 +231,29 @@ typedef struct { cpu_memory_map memory_map[256]; /* memory mapping */ - cpu_idle_t poll; /* polling detection */ + cpu_idle_t poll; /* polling detection */ - uint cycles; /* current master cycle count */ - uint cycle_end; /* aimed master cycle count for current execution frame */ + uint cycles; /* current master cycle count */ + uint cycle_end; /* aimed master cycle count for current execution frame */ + + uint dar[16]; /* Data and Address Registers */ + uint pc; /* Program Counter */ + uint sp[5]; /* User and Interrupt Stack Pointers */ + uint ir; /* Instruction Register */ + uint t1_flag; /* Trace 1 */ + uint s_flag; /* Supervisor */ + uint x_flag; /* Extend */ + uint n_flag; /* Negative */ + uint not_z_flag; /* Zero, inverted for speedups */ + uint v_flag; /* Overflow */ + uint c_flag; /* Carry */ + uint int_mask; /* I0-I2 */ + uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ + uint stopped; /* Stopped state */ + + uint pref_addr; /* Last prefetch address */ + uint pref_data; /* Data in the prefetch queue */ - uint dar[16]; /* Data and Address Registers */ - uint pc; /* Program Counter */ - uint sp[5]; /* User and Interrupt Stack Pointers */ - uint ir; /* Instruction Register */ - uint t1_flag; /* Trace 1 */ - uint s_flag; /* Supervisor */ - uint x_flag; /* Extend */ - uint n_flag; /* Negative */ - uint not_z_flag; /* Zero, inverted for speedups */ - uint v_flag; /* Overflow */ - uint c_flag; /* Carry */ - uint int_mask; /* I0-I2 */ - uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ - uint stopped; /* Stopped state */ -#if M68K_EMULATE_PREFETCH - uint pref_addr; /* Last prefetch address */ - uint pref_data; /* Data in the prefetch queue */ -#endif -#if M68K_EMULATE_ADDRESS_ERROR uint instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */ uint run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */ uint aerr_enabled; /* Enables/deisables address error checks at runtime */ @@ -262,27 +261,16 @@ typedef struct uint aerr_address; /* Address error location */ uint aerr_write_mode; /* Address error write mode */ uint aerr_fc; /* Address error FC code */ -#endif -#if M68K_EMULATE_TRACE + uint tracing; /* Tracing enable flag */ -#endif -#if M68K_EMULATE_FC + uint address_space; /* Current FC code */ -#endif /* Callbacks to host */ -#if M68K_EMULATE_INT_ACK == OPT_ON int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */ -#endif -#if M68K_EMULATE_RESET == OPT_ON void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */ -#endif -#if M68K_TAS_HAS_CALLBACK == OPT_ON int (*tas_instr_callback)(void); /* Called when a TAS instruction is encountered, allows / disallows writeback */ -#endif -#if M68K_EMULATE_FC == OPT_ON void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */ -#endif } m68ki_cpu_core; /* CPU cores */