summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-05-20 16:22:44 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-05-20 16:22:44 -0400
commitee820fde5113700a71f4c52a704f85e6339fb0ec (patch)
treee471f74126db581d06add4be2bd2725a1acb32f0
parent2a4a7e44652e07593139482fa5892c6f313a0970 (diff)
mhavoc: Use array finder for POKEYs (nw)
-rw-r--r--src/mame/drivers/mhavoc.cpp19
-rw-r--r--src/mame/includes/mhavoc.h3
2 files changed, 7 insertions, 15 deletions
diff --git a/src/mame/drivers/mhavoc.cpp b/src/mame/drivers/mhavoc.cpp
index f2f2b4ec471..d7cb481a4bf 100644
--- a/src/mame/drivers/mhavoc.cpp
+++ b/src/mame/drivers/mhavoc.cpp
@@ -193,7 +193,6 @@
#include "video/avgdvg.h"
#include "video/vector.h"
#include "sound/tms5220.h"
-#include "sound/pokey.h"
#include "machine/nvram.h"
#include "machine/watchdog.h"
#include "screen.h"
@@ -211,24 +210,20 @@ Address: 543210
*/
READ8_MEMBER(mhavoc_state::quad_pokeyn_r)
{
- static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
int pokey_reg = (offset & 0x7) | control;
- pokey_device *pokey = machine().device<pokey_device>(devname[pokey_num]);
- return pokey->read(pokey_reg);
+ return m_pokey[pokey_num]->read(pokey_reg);
}
WRITE8_MEMBER(mhavoc_state::quad_pokeyn_w)
{
- static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
int pokey_reg = (offset & 0x7) | control;
- pokey_device *pokey = machine().device<pokey_device>(devname[pokey_num]);
- pokey->write(pokey_reg, data);
+ m_pokey[pokey_num]->write(pokey_reg, data);
}
@@ -251,10 +246,7 @@ READ8_MEMBER(mhavoc_state::dual_pokey_r)
int control = (offset & 0x10) >> 1;
int pokey_reg = (offset & 0x7) | control;
- if (pokey_num == 0)
- return machine().device<pokey_device>("pokey1")->read(pokey_reg);
- else
- return machine().device<pokey_device>("pokey2")->read(pokey_reg);
+ return m_pokey[pokey_num]->read(pokey_reg);
}
@@ -264,10 +256,7 @@ WRITE8_MEMBER(mhavoc_state::dual_pokey_w)
int control = (offset & 0x10) >> 1;
int pokey_reg = (offset & 0x7) | control;
- if (pokey_num == 0)
- machine().device<pokey_device>("pokey1")->write(pokey_reg, data);
- else
- machine().device<pokey_device>("pokey2")->write(pokey_reg, data);
+ m_pokey[pokey_num]->write(pokey_reg, data);
}
diff --git a/src/mame/includes/mhavoc.h b/src/mame/includes/mhavoc.h
index c579a2a58c6..1b2aa3ec738 100644
--- a/src/mame/includes/mhavoc.h
+++ b/src/mame/includes/mhavoc.h
@@ -7,6 +7,7 @@
*************************************************************************/
#include "machine/timer.h"
+#include "sound/pokey.h"
#define MHAVOC_CLOCK 10000000
#define MHAVOC_CLOCK_5M (MHAVOC_CLOCK/2)
@@ -28,6 +29,7 @@ public:
m_zram1(*this, "zram1"),
m_alpha(*this, "alpha"),
m_gamma(*this, "gamma"),
+ m_pokey(*this, "pokey%u", 1U),
m_lamp(*this, "lamp%u", 0U)
{ }
@@ -73,6 +75,7 @@ protected:
required_shared_ptr<uint8_t> m_zram1;
required_device<cpu_device> m_alpha;
optional_device<cpu_device> m_gamma;
+ optional_device_array<pokey_device, 4> m_pokey;
output_finder<2> m_lamp;
uint8_t m_alpha_data;
uint8_t m_alpha_rcvd;