mirror of
https://github.com/holub/mame
synced 2025-06-30 07:58:56 +03:00
mhavoc: Use array finder for POKEYs (nw)
This commit is contained in:
parent
2a4a7e4465
commit
ee820fde51
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user