summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar AJR <ajrhacker@users.noreply.github.com>2018-02-03 21:11:14 -0500
committerGravatarGravatar AJR <ajrhacker@users.noreply.github.com>2018-02-03 21:13:25 -0500
commit5051f3c3f7ec45204836eae8ad0bab4bf4a04c01 (patch) (github)
tree9359f5e739bf100ecccdddddf7fbeb3d8fa6b6bc
parent14d484fe9474b10f9773e765f20a56d35cdf5eb7 (diff)
downloadmame-5051f3c3f7ec45204836eae8ad0bab4bf4a04c01.tar.bz2
mame-5051f3c3f7ec45204836eae8ad0bab4bf4a04c01.zip
madmotor.cpp: General cleanup (nw)
-rw-r--r--scripts/target/mame/arcade.lua2
-rw-r--r--src/mame/drivers/madmotor.cpp60
-rw-r--r--src/mame/includes/madmotor.h49
-rw-r--r--src/mame/video/madmotor.cpp38
4 files changed, 43 insertions, 106 deletions
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua
index b5d03c8e346..efe9a981e51 100644
--- a/scripts/target/mame/arcade.lua
+++ b/scripts/target/mame/arcade.lua
@@ -1597,8 +1597,6 @@ files {
MAME_DIR .. "src/mame/audio/madalien.cpp",
MAME_DIR .. "src/mame/video/madalien.cpp",
MAME_DIR .. "src/mame/drivers/madmotor.cpp",
- MAME_DIR .. "src/mame/includes/madmotor.h",
- MAME_DIR .. "src/mame/video/madmotor.cpp",
MAME_DIR .. "src/mame/drivers/metlclsh.cpp",
MAME_DIR .. "src/mame/includes/metlclsh.h",
MAME_DIR .. "src/mame/video/metlclsh.cpp",
diff --git a/src/mame/drivers/madmotor.cpp b/src/mame/drivers/madmotor.cpp
index 51014db315e..3a14e69c13b 100644
--- a/src/mame/drivers/madmotor.cpp
+++ b/src/mame/drivers/madmotor.cpp
@@ -12,30 +12,48 @@
Emulation by Bryan McPhail, mish@tendril.co.uk
+ Notes: Playfield 3 can change size between 512x1024 and 2048x256
+
***************************************************************************/
#include "emu.h"
-#include "includes/madmotor.h"
#include "cpu/m68000/m68000.h"
#include "cpu/h6280/h6280.h"
+#include "machine/gen_latch.h"
#include "sound/2203intf.h"
#include "sound/ym2151.h"
#include "sound/okim6295.h"
+#include "video/decbac06.h"
+#include "video/decmxc06.h"
#include "screen.h"
#include "speaker.h"
-/******************************************************************************/
-
-WRITE16_MEMBER(madmotor_state::madmotor_sound_w)
+class madmotor_state : public driver_device
{
- if (ACCESSING_BITS_0_7)
- {
- m_soundlatch->write(space, 0, data & 0xff);
- m_audiocpu->set_input_line(0, HOLD_LINE);
- }
-}
+public:
+ madmotor_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag),
+ m_spriteram(*this, "spriteram"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_tilegen(*this, "tilegen%u", 1),
+ m_spritegen(*this, "spritegen") { }
+
+ /* memory pointers */
+ required_shared_ptr<uint16_t> m_spriteram;
+
+ /* devices */
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device_array<deco_bac06_device, 3> m_tilegen;
+ required_device<deco_mxc06_device> m_spritegen;
+
+ DECLARE_DRIVER_INIT(madmotor);
+ uint32_t screen_update_madmotor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void madmotor(machine_config &config);
+};
/******************************************************************************/
@@ -63,7 +81,7 @@ static ADDRESS_MAP_START( madmotor_map, AS_PROGRAM, 16, madmotor_state )
AM_RANGE(0x3f8002, 0x3f8003) AM_READ_PORT("P1_P2")
AM_RANGE(0x3f8004, 0x3f8005) AM_READ_PORT("DSW")
AM_RANGE(0x3f8006, 0x3f8007) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x3fc004, 0x3fc005) AM_WRITE(madmotor_sound_w)
+ AM_RANGE(0x3fc004, 0x3fc005) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
ADDRESS_MAP_END
/******************************************************************************/
@@ -222,15 +240,22 @@ GFXDECODE_END
/******************************************************************************/
-void madmotor_state::machine_start()
+uint32_t madmotor_state::screen_update_madmotor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- save_item(NAME(m_flipscreen));
+ bool flip = m_tilegen[0]->get_flip_state();
+ m_tilegen[0]->set_flip_screen(flip);
+ m_tilegen[1]->set_flip_screen(flip);
+ m_tilegen[2]->set_flip_screen(flip);
+ m_spritegen->set_flip_screen(flip);
+
+ m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
+ m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
+ m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram, 0x00, 0x00, 0x0f);
+ m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
+ return 0;
}
-void madmotor_state::machine_reset()
-{
- m_flipscreen = 0;
-}
+/******************************************************************************/
MACHINE_CONFIG_START(madmotor_state::madmotor)
@@ -277,6 +302,7 @@ MACHINE_CONFIG_START(madmotor_state::madmotor)
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", 0))
MCFG_SOUND_ADD("ym1", YM2203, 21470000/6)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
diff --git a/src/mame/includes/madmotor.h b/src/mame/includes/madmotor.h
deleted file mode 100644
index 81c3f28d8dd..00000000000
--- a/src/mame/includes/madmotor.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail
-/*************************************************************************
-
- Mad Motor
-
-*************************************************************************/
-
-#include "machine/gen_latch.h"
-#include "video/decbac06.h"
-#include "video/decmxc06.h"
-
-class madmotor_state : public driver_device
-{
-public:
- madmotor_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_tilegen1(*this, "tilegen1"),
- m_tilegen2(*this, "tilegen2"),
- m_tilegen3(*this, "tilegen3"),
- m_spritegen(*this, "spritegen"),
- m_soundlatch(*this, "soundlatch") { }
-
- /* memory pointers */
- required_shared_ptr<uint16_t> m_spriteram;
-
- /* video-related */
- int m_flipscreen;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<deco_bac06_device> m_tilegen1;
- required_device<deco_bac06_device> m_tilegen2;
- required_device<deco_bac06_device> m_tilegen3;
- required_device<deco_mxc06_device> m_spritegen;
- required_device<generic_latch_8_device> m_soundlatch;
-
- DECLARE_WRITE16_MEMBER(madmotor_sound_w);
- DECLARE_DRIVER_INIT(madmotor);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- uint32_t screen_update_madmotor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void madmotor(machine_config &config);
-};
diff --git a/src/mame/video/madmotor.cpp b/src/mame/video/madmotor.cpp
deleted file mode 100644
index 035374c277a..00000000000
--- a/src/mame/video/madmotor.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail
-/***************************************************************************
-
- Mad Motor video emulation - Bryan McPhail, mish@tendril.co.uk
-
- Notes: Playfield 3 can change size between 512x1024 and 2048x256
-
-***************************************************************************/
-
-#include "emu.h"
-#include "includes/madmotor.h"
-
-/******************************************************************************/
-
-void madmotor_state::video_start()
-{
-}
-
-/******************************************************************************/
-
-
-/******************************************************************************/
-
-uint32_t madmotor_state::screen_update_madmotor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- bool flip = m_tilegen1->get_flip_state();
- m_tilegen1->set_flip_screen(flip);
- m_tilegen2->set_flip_screen(flip);
- m_tilegen3->set_flip_screen(flip);
- m_spritegen->set_flip_screen(flip);
-
- m_tilegen3->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
- m_tilegen2->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
- m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram, 0x00, 0x00, 0x0f);
- m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
- return 0;
-}