summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-09-11 14:33:52 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-09-11 14:33:52 +0000
commit2398d51941b3bf94c3b379a647428bd1c5b8bc36 (patch)
tree6bff141b0d57c3b11d2e3c022d39052b5686834b
parent1510ffd2e337e5b5885d59bf21d1c4da20089270 (diff)
Fixed memory handling of internal banks. They should be LOWER priority than
the driver's memory maps. Reverted recent changes to MCS-48 core that were very hacky and which crashed many games. You can now properly override the internal memory map and do your own banking. Also fixed 02204: masao: Memory bank error.
-rw-r--r--src/emu/cpu/mcs48/mcs48.c8
-rw-r--r--src/emu/cpu/mcs48/mcs48.h6
-rw-r--r--src/emu/memory.c8
-rw-r--r--src/mame/audio/mario.c20
-rw-r--r--src/mame/includes/mario.h1
5 files changed, 21 insertions, 22 deletions
diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c
index a7c6566fbeb..11017e76d33 100644
--- a/src/emu/cpu/mcs48/mcs48.c
+++ b/src/emu/cpu/mcs48/mcs48.c
@@ -956,11 +956,11 @@ static int mcs48_execute(int cycles)
/* FIXME: the memory maps should probably support rom banking for EA */
static ADDRESS_MAP_START(program_10bit, ADDRESS_SPACE_PROGRAM, 8)
- AM_RANGE(0x00, 0x3ff) AM_ROMBANK(MCS48_INTERNAL_ROMBANK)
+ AM_RANGE(0x00, 0x3ff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START(program_11bit, ADDRESS_SPACE_PROGRAM, 8)
- AM_RANGE(0x00, 0x7ff) AM_ROMBANK(MCS48_INTERNAL_ROMBANK)
+ AM_RANGE(0x00, 0x7ff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START(data_6bit, ADDRESS_SPACE_DATA, 8)
@@ -1016,9 +1016,7 @@ static void mcs48_set_info(UINT32 state, cpuinfo *info)
{
/* --- the following bits of info are set as 64-bit signed integers --- */
case CPUINFO_INT_INPUT_STATE + MCS48_INPUT_IRQ: mcs48.irq_state = (info->i != CLEAR_LINE); break;
- case CPUINFO_INT_INPUT_STATE + MCS48_INPUT_EA: mcs48.ea = (info->i != CLEAR_LINE);
- memory_set_bank(MCS48_INTERNAL_ROMBANK, mcs48.ea);
- break;
+ case CPUINFO_INT_INPUT_STATE + MCS48_INPUT_EA: mcs48.ea = (info->i != CLEAR_LINE); break;
case CPUINFO_INT_PC:
case CPUINFO_INT_REGISTER + MCS48_PC: PC = info->i; break;
diff --git a/src/emu/cpu/mcs48/mcs48.h b/src/emu/cpu/mcs48/mcs48.h
index f64c2c92eae..00c097a0354 100644
--- a/src/emu/cpu/mcs48/mcs48.h
+++ b/src/emu/cpu/mcs48/mcs48.h
@@ -18,12 +18,6 @@
#include "cpuintrf.h"
/***************************************************************************
- DEFINES
-***************************************************************************/
-
-#define MCS48_INTERNAL_ROMBANK (31)
-
-/***************************************************************************
CONSTANTS
***************************************************************************/
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 56a02716d75..8ff44acf52f 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -861,16 +861,16 @@ address_map *address_map_alloc(const machine_config *config, const game_driver *
map = malloc_or_die(sizeof(*map));
memset(map, 0, sizeof(*map));
- /* start by constructing the internal CPU map */
- if (internal_map != NULL)
- address_map_detokenize(map, driver, internal_map);
-
/* construct the standard map */
if (config->cpu[cpunum].address_map[spacenum][0] != NULL)
address_map_detokenize(map, driver, config->cpu[cpunum].address_map[spacenum][0]);
if (config->cpu[cpunum].address_map[spacenum][1] != NULL)
address_map_detokenize(map, driver, config->cpu[cpunum].address_map[spacenum][1]);
+ /* append the internal CPU map (last so it can be overridden) */
+ if (internal_map != NULL)
+ address_map_detokenize(map, driver, internal_map);
+
return map;
}
diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c
index e0051d1d0af..ca1007b987c 100644
--- a/src/mame/audio/mario.c
+++ b/src/mame/audio/mario.c
@@ -240,9 +240,11 @@ DISCRETE_SOUND_END
static void set_ea(running_machine *machine, int ea)
{
+ mario_state *state = machine->driver_data;
//printf("ea: %d\n", ea);
- cputag_set_input_line(machine, "audio", MCS48_INPUT_EA, (ea) ? ASSERT_LINE : CLEAR_LINE);
- //memory_set_bank(MCS48_INTERNAL_ROMBANK, ea);
+ //cputag_set_input_line(machine, "audio", MCS48_INPUT_EA, (ea) ? ASSERT_LINE : CLEAR_LINE);
+ if (state->eabank != 0)
+ memory_set_bank(state->eabank, ea);
}
/****************************************************************
@@ -254,14 +256,20 @@ static void set_ea(running_machine *machine, int ea)
static SOUND_START( mario )
{
mario_state *state = machine->driver_data;
+ int audiocpu = mame_find_cpu_index(machine, "audio");
#if USE_8039
UINT8 *SND = memory_region(machine, "audio");
SND[0x1001] = 0x01;
#endif
- memory_configure_bank(MCS48_INTERNAL_ROMBANK, 0, 1, memory_region(machine, "audio"), 0);
- memory_configure_bank(MCS48_INTERNAL_ROMBANK, 1, 1, memory_region(machine, "audio") + 0x1000, 0x800);
+ state->eabank = 0;
+ if (audiocpu != -1 && machine->config->cpu[audiocpu].type != CPU_Z80)
+ {
+ state->eabank = 1;
+ memory_configure_bank(1, 0, 1, memory_region(machine, "audio"), 0);
+ memory_configure_bank(1, 1, 1, memory_region(machine, "audio") + 0x1000, 0x800);
+ }
state_save_register_global(state->last);
state_save_register_global(state->portT);
@@ -418,9 +426,7 @@ WRITE8_HANDLER( mario_sh3_w )
*************************************/
static ADDRESS_MAP_START( mario_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
-#if USE_8039
- AM_RANGE(0x0000, 0x07ff) AM_ROMBANK(MCS48_INTERNAL_ROMBANK)
-#endif
+ AM_RANGE(0x0000, 0x07ff) AM_ROMBANK(1) AM_REGION("audio", 0)
AM_RANGE(0x0800, 0x0fff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h
index 8f7db38b3f0..317b52590b8 100644
--- a/src/mame/includes/mario.h
+++ b/src/mame/includes/mario.h
@@ -40,6 +40,7 @@ struct _mario_state
/* sound state */
UINT8 last;
UINT8 portT;
+ UINT8 eabank;
/* video state */
UINT8 gfx_bank;