summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2013-03-05 08:01:06 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2013-03-05 08:01:06 +0000
commit56ad9c1a60531721924a225d56ab39285b925232 (patch)
tree693df68c7b07f20e44c86719239f0e648d371cc8 /src
parent9e5b47243924546a887d96abd3714a30c841dd5c (diff)
snes: shuffling some code around (part 6 and last). nw.
Diffstat (limited to 'src')
-rw-r--r--src/mame/includes/snes.h6
-rw-r--r--src/mame/machine/snes.c77
-rw-r--r--src/mame/machine/snes7110.c4
-rw-r--r--src/mame/machine/snesobc1.c2
-rw-r--r--src/mame/machine/snesrtc.c2
-rw-r--r--src/mame/machine/snessdd1.c6
-rw-r--r--src/mess/drivers/snes.c79
-rw-r--r--src/mess/machine/snescart.c16
-rw-r--r--src/mess/machine/snescart.h4
9 files changed, 93 insertions, 103 deletions
diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h
index a8aa8b98381..37a275a16ef 100644
--- a/src/mame/includes/snes.h
+++ b/src/mame/includes/snes.h
@@ -769,17 +769,21 @@ extern UINT8 *snes_ram; /* Main memory */
// add-on chips IO
void srtc_write(running_machine &machine, UINT16 addr, UINT8 data);
UINT8 srtc_read(address_space &space, UINT16 addr);
+void srtc_init(running_machine &machine);
extern DECLARE_READ8_HANDLER(obc1_read);
extern DECLARE_WRITE8_HANDLER(obc1_write);
+void obc1_init(running_machine &machine);
UINT8 CX4_read(UINT32 addr);
void CX4_write(running_machine &machine, UINT32 addr, UINT8 data);
UINT8 sdd1_mmio_read(address_space &space, UINT32 addr);
void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data);
+void sdd1_init(running_machine& machine);
UINT8 sdd1_read(running_machine& machine, UINT32 addr);
UINT8 spc7110_mmio_read(address_space &space, UINT32 addr);
void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data);
UINT8 spc7110_bank7_read(address_space &space, UINT32 offset);
-
+void spc7110_init(running_machine& machine);
+void spc7110rtc_init(running_machine& machine);
extern struct snes_cart_info snes_cart;
diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c
index dbbf2ccca54..a49958b1cf5 100644
--- a/src/mame/machine/snes.c
+++ b/src/mame/machine/snes.c
@@ -1183,70 +1183,6 @@ static void snes_init_ram( running_machine &machine )
// set up some known register power-up defaults
SNES_CPU_REG_STATE(WRIO) = 0xff;
- // see if there's a uPD7725 DSP in the machine config
- state->m_upd7725 = machine.device<upd7725_device>("dsp");
-
- // if we have a DSP, halt it for the moment
- if (state->m_upd7725)
- {
- machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
- }
-
- // ditto for a uPD96050 (Seta ST-010 or ST-011)
- state->m_upd96050 = machine.device<upd96050_device>("setadsp");
- if (state->m_upd96050)
- {
- machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
- }
-
- switch (state->m_has_addon_chip)
- {
- case HAS_DSP1:
- case HAS_DSP2:
- case HAS_DSP3:
- case HAS_DSP4:
- // cartridge uses the DSP, let 'er rip
- if (state->m_upd7725)
- {
- machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
- }
- else
- {
- logerror("SNES: Game uses a DSP, but the machine driver is missing the uPD7725!\n");
- state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device
- }
- break;
-
- case HAS_RTC:
- srtc_init(machine);
- break;
-
- case HAS_SDD1:
- sdd1_reset(machine);
- break;
-
- case HAS_OBC1:
- obc1_init(machine);
- break;
-
- case HAS_ST010:
- case HAS_ST011:
- // cartridge uses the DSP, let 'er rip
- if (state->m_upd96050)
- {
- machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
- }
- else
- {
- logerror("SNES: Game uses a Seta DSP, but the machine driver is missing the uPD96050!\n");
- state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device
- }
- break;
-
- default:
- break;
- }
-
// init frame counter so first line is 0
if (ATTOSECONDS_TO_HZ(machine.primary_screen->frame_period().attoseconds) >= 59)
state->m_ppu.m_beam.current_vert = SNES_VTOTAL_NTSC;
@@ -1286,19 +1222,6 @@ MACHINE_START( snes )
// SNES_CPU_REG_STATE(WRDIVL) = 0xff;
// SNES_CPU_REG_STATE(WRDIVH) = 0xff;
- switch (state->m_has_addon_chip)
- {
- case HAS_SDD1:
- sdd1_init(machine);
- break;
- case HAS_SPC7110:
- spc7110_init(machine);
- break;
- case HAS_SPC7110_RTC:
- spc7110rtc_init(machine);
- break;
- }
-
if (state->m_cart[0].mode == SNES_MODE_BSX)
bsx_init(machine);
diff --git a/src/mame/machine/snes7110.c b/src/mame/machine/snes7110.c
index e64bd411169..c6604e73c4e 100644
--- a/src/mame/machine/snes7110.c
+++ b/src/mame/machine/snes7110.c
@@ -863,7 +863,7 @@ struct snes_spc7110_t
static snes_spc7110_t snes_spc7110;
-static void spc7110_init(running_machine& machine)
+void spc7110_init(running_machine& machine)
{
snes_state *state = machine.driver_data<snes_state>();
@@ -925,7 +925,7 @@ static void spc7110_init(running_machine& machine)
snes_spc7110.decomp = auto_alloc(machine, SPC7110Decomp(machine, snes_spc7110.size));
}
-static void spc7110rtc_init(running_machine& machine)
+void spc7110rtc_init(running_machine& machine)
{
spc7110_init(machine);
diff --git a/src/mame/machine/snesobc1.c b/src/mame/machine/snesobc1.c
index 2fa3d52a3a9..22c82c0e402 100644
--- a/src/mame/machine/snesobc1.c
+++ b/src/mame/machine/snesobc1.c
@@ -104,7 +104,7 @@ WRITE8_HANDLER( obc1_write )
}
}
-static void obc1_init( running_machine &machine )
+void obc1_init( running_machine &machine )
{
obc1_state.offset = (snes_ram[0x1ff5] & 0x01) ? 0x1800 : 0x1c00;
obc1_state.address = (snes_ram[0x1ff6] & 0x7f);
diff --git a/src/mame/machine/snesrtc.c b/src/mame/machine/snesrtc.c
index f9e017234a8..2123eb583e2 100644
--- a/src/mame/machine/snesrtc.c
+++ b/src/mame/machine/snesrtc.c
@@ -210,7 +210,7 @@ void srtc_write( running_machine &machine, UINT16 addr, UINT8 data )
}
}
-static void srtc_init( running_machine &machine )
+void srtc_init( running_machine &machine )
{
rtc_state.mode = RTCM_Read;
rtc_state.index = -1;
diff --git a/src/mame/machine/snessdd1.c b/src/mame/machine/snessdd1.c
index c326dd296b4..911d88bf430 100644
--- a/src/mame/machine/snessdd1.c
+++ b/src/mame/machine/snessdd1.c
@@ -532,7 +532,7 @@ struct snes_sdd1_t
static snes_sdd1_t snes_sdd1;
-static void sdd1_init(running_machine& machine)
+void sdd1_init(running_machine& machine)
{
snes_sdd1.sdd1_enable = 0x00;
snes_sdd1.xfer_enable = 0x00;
@@ -675,7 +675,3 @@ UINT8 sdd1_read(running_machine& machine, UINT32 addr)
return ROM[snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff)];
}
-
-static void sdd1_reset(running_machine &machine)
-{
-}
diff --git a/src/mess/drivers/snes.c b/src/mess/drivers/snes.c
index c3323f81135..b5d59fea864 100644
--- a/src/mess/drivers/snes.c
+++ b/src/mess/drivers/snes.c
@@ -1094,6 +1094,33 @@ static UINT8 snes_oldjoy2_read( running_machine &machine )
*
*************************************/
+static MACHINE_START( snes_mess )
+{
+ snes_state *state = machine.driver_data<snes_state>();
+
+ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(snes_machine_stop),&machine));
+ MACHINE_START_CALL(snes);
+
+ switch (state->m_has_addon_chip)
+ {
+ case HAS_SDD1:
+ sdd1_init(machine);
+ break;
+ case HAS_SPC7110:
+ spc7110_init(machine);
+ break;
+ case HAS_SPC7110_RTC:
+ spc7110rtc_init(machine);
+ break;
+ }
+}
+
+static MACHINE_START( snesst )
+{
+ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sufami_machine_stop),&machine));
+ MACHINE_START_CALL(snes);
+}
+
static MACHINE_RESET( snes_mess )
{
snes_state *state = machine.driver_data<snes_state>();
@@ -1103,6 +1130,58 @@ static MACHINE_RESET( snes_mess )
state->m_io_read = snes_input_read;
state->m_oldjoy1_read = snes_oldjoy1_read;
state->m_oldjoy2_read = snes_oldjoy2_read;
+
+ // see if there's a uPD7725 DSP in the machine config
+ state->m_upd7725 = machine.device<upd7725_device>("dsp");
+
+ // if we have a DSP, halt it for the moment
+ if (state->m_upd7725)
+ machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+
+ // ditto for a uPD96050 (Seta ST-010 or ST-011)
+ state->m_upd96050 = machine.device<upd96050_device>("setadsp");
+ if (state->m_upd96050)
+ machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+
+ switch (state->m_has_addon_chip)
+ {
+ case HAS_DSP1:
+ case HAS_DSP2:
+ case HAS_DSP3:
+ case HAS_DSP4:
+ // cartridge uses the DSP, let 'er rip
+ if (state->m_upd7725)
+ machine.device("dsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
+ else
+ {
+ logerror("SNES: Game uses a DSP, but the machine driver is missing the uPD7725!\n");
+ state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device
+ }
+ break;
+
+ case HAS_RTC:
+ srtc_init(machine);
+ break;
+
+ case HAS_OBC1:
+ obc1_init(machine);
+ break;
+
+ case HAS_ST010:
+ case HAS_ST011:
+ // cartridge uses the DSP, let 'er rip
+ if (state->m_upd96050)
+ machine.device("setadsp")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
+ else
+ {
+ logerror("SNES: Game uses a Seta DSP, but the machine driver is missing the uPD96050!\n");
+ state->m_has_addon_chip = HAS_NONE; // prevent crash trying to access NULL device
+ }
+ break;
+
+ default:
+ break;
+ }
}
static MACHINE_CONFIG_START( snes_base, snes_state )
diff --git a/src/mess/machine/snescart.c b/src/mess/machine/snescart.c
index d436a9442f4..7d25ba8305d 100644
--- a/src/mess/machine/snescart.c
+++ b/src/mess/machine/snescart.c
@@ -211,7 +211,7 @@ static void snes_save_sram(running_machine &machine)
free(battery_ram);
}
-static void snes_machine_stop(running_machine &machine)
+void snes_machine_stop(running_machine &machine)
{
snes_state *state = machine.driver_data<snes_state>();
@@ -220,12 +220,6 @@ static void snes_machine_stop(running_machine &machine)
snes_save_sram(machine);
}
-MACHINE_START( snes_mess )
-{
- machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(snes_machine_stop),&machine));
- MACHINE_START_CALL(snes);
-}
-
static void sufami_load_sram(running_machine &machine, const char *cart_tag)
{
@@ -256,7 +250,7 @@ static void sufami_load_sram(running_machine &machine, const char *cart_tag)
free(battery_ram);
}
-static void sufami_machine_stop(running_machine &machine)
+void sufami_machine_stop(running_machine &machine)
{
snes_state *state = machine.driver_data<snes_state>();
UINT8 ii;
@@ -288,12 +282,6 @@ static void sufami_machine_stop(running_machine &machine)
free(battery_ram);
}
-MACHINE_START( snesst )
-{
- machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sufami_machine_stop),&machine));
- MACHINE_START_CALL(snes);
-}
-
/***************************************************************************
diff --git a/src/mess/machine/snescart.h b/src/mess/machine/snescart.h
index 1a72c837dbe..86278befec1 100644
--- a/src/mess/machine/snescart.h
+++ b/src/mess/machine/snescart.h
@@ -8,8 +8,8 @@
#include "imagedev/cartslot.h"
-MACHINE_START( snes_mess );
-MACHINE_START( snesst );
+void snes_machine_stop(running_machine &machine);
+void sufami_machine_stop(running_machine &machine);
MACHINE_CONFIG_EXTERN( snes_cartslot );
MACHINE_CONFIG_EXTERN( snesp_cartslot );