summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2013-04-11 14:36:17 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2013-04-11 14:36:17 +0000
commitaa4935ce1c9a68030e74ebc12e97154d3435543f (patch)
treec257ad9cef9db01960523b849fdb7839691e6118 /src
parent3b4d2b39c2b498b1a0e85f39ec97e0963deaf953 (diff)
oki cleanup (nw)
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/aerofgt.c8
-rw-r--r--src/mame/drivers/astrocorp.c12
-rw-r--r--src/mame/drivers/bestleag.c8
-rw-r--r--src/mame/drivers/cps1.c3
-rw-r--r--src/mame/drivers/ddragon3.c4
-rw-r--r--src/mame/drivers/deniam.c8
-rw-r--r--src/mame/drivers/diverboy.c9
-rw-r--r--src/mame/drivers/drtomy.c8
-rw-r--r--src/mame/drivers/funybubl.c4
-rw-r--r--src/mame/drivers/fuukifg2.c4
-rw-r--r--src/mame/drivers/galpanic.c4
-rw-r--r--src/mame/drivers/gotcha.c4
-rw-r--r--src/mame/drivers/igs011.c8
-rw-r--r--src/mame/drivers/kaneko16.c4
-rw-r--r--src/mame/drivers/kickgoal.c62
-rw-r--r--src/mame/drivers/legionna.c5
-rw-r--r--src/mame/drivers/lordgun.c3
-rw-r--r--src/mame/drivers/m92.c3
-rw-r--r--src/mame/drivers/metro.c8
-rw-r--r--src/mame/drivers/midyunit.c3
-rw-r--r--src/mame/drivers/moo.c3
-rw-r--r--src/mame/drivers/nmg5.c7
-rw-r--r--src/mame/drivers/oneshot.c3
-rw-r--r--src/mame/drivers/othldrby.c3
-rw-r--r--src/mame/drivers/playmark.c4
-rw-r--r--src/mame/drivers/pzletime.c7
-rw-r--r--src/mame/drivers/rampart.c2
-rw-r--r--src/mame/drivers/seta2.c8
-rw-r--r--src/mame/drivers/shadfrce.c3
-rw-r--r--src/mame/drivers/snowbros.c11
-rw-r--r--src/mame/drivers/speedspn.c3
-rw-r--r--src/mame/drivers/sslam.c21
-rw-r--r--src/mame/drivers/stlforce.c3
-rw-r--r--src/mame/drivers/subsino2.c12
-rw-r--r--src/mame/drivers/tickee.c13
-rw-r--r--src/mame/drivers/tmaster.c7
-rw-r--r--src/mame/drivers/toaplan2.c3
-rw-r--r--src/mame/drivers/tumbleb.c8
-rw-r--r--src/mame/drivers/unico.c5
-rw-r--r--src/mame/drivers/vamphalf.c10
-rw-r--r--src/mame/drivers/wwfwfest.c3
-rw-r--r--src/mame/includes/aerofgt.h5
-rw-r--r--src/mame/includes/cps1.h5
-rw-r--r--src/mame/includes/ddragon3.h7
-rw-r--r--src/mame/includes/deniam.h6
-rw-r--r--src/mame/includes/funybubl.h6
-rw-r--r--src/mame/includes/fuukifg2.h6
-rw-r--r--src/mame/includes/gotcha.h6
-rw-r--r--src/mame/includes/kaneko16.h6
-rw-r--r--src/mame/includes/kickgoal.h4
-rw-r--r--src/mame/includes/legionna.h6
-rw-r--r--src/mame/includes/lordgun.h5
-rw-r--r--src/mame/includes/m92.h5
-rw-r--r--src/mame/includes/midyunit.h5
-rw-r--r--src/mame/includes/moo.h5
-rw-r--r--src/mame/includes/oneshot.h5
-rw-r--r--src/mame/includes/othldrby.h5
-rw-r--r--src/mame/includes/rampart.h5
-rw-r--r--src/mame/includes/seta2.h6
-rw-r--r--src/mame/includes/shadfrce.h6
-rw-r--r--src/mame/includes/snowbros.h4
-rw-r--r--src/mame/includes/speedspn.h6
-rw-r--r--src/mame/includes/sslam.h6
-rw-r--r--src/mame/includes/stlforce.h6
-rw-r--r--src/mame/includes/tatsumi.h6
-rw-r--r--src/mame/includes/toaplan2.h6
-rw-r--r--src/mame/includes/tumbleb.h5
-rw-r--r--src/mame/includes/unico.h6
-rw-r--r--src/mame/includes/wwfwfest.h5
-rw-r--r--src/mame/machine/tatsumi.c2
70 files changed, 247 insertions, 220 deletions
diff --git a/src/mame/drivers/aerofgt.c b/src/mame/drivers/aerofgt.c
index d11d109dc46..80375d171e1 100644
--- a/src/mame/drivers/aerofgt.c
+++ b/src/mame/drivers/aerofgt.c
@@ -113,19 +113,15 @@ WRITE8_MEMBER(aerofgt_state::aerofgt_sh_bankswitch_w)
WRITE16_MEMBER(aerofgt_state::pspikesb_oki_banking_w)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(0x40000 * (data & 3));
+ m_oki->set_bank_base(0x40000 * (data & 3));
}
/*TODO: sound banking. */
WRITE16_MEMBER(aerofgt_state::aerfboo2_okim6295_banking_w)
{
-// device_t *device = machine().device("oki");
// if(ACCESSING_BITS_8_15)
// {
-// okim6295_device *oki = downcast<okim6295_device *>(device);
-// oki->set_bank_base(0x40000 * ((data & 0xf00)>>8));
+// m_oki->set_bank_base(0x40000 * ((data & 0xf00)>>8));
// }
}
diff --git a/src/mame/drivers/astrocorp.c b/src/mame/drivers/astrocorp.c
index 97e99df2f2e..d0535a83f2b 100644
--- a/src/mame/drivers/astrocorp.c
+++ b/src/mame/drivers/astrocorp.c
@@ -46,7 +46,8 @@ public:
: driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_spriteram;
@@ -72,6 +73,7 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(skilldrp_scanline);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
/***************************************************************************
@@ -190,22 +192,18 @@ WRITE16_MEMBER(astrocorp_state::astrocorp_eeprom_w)
WRITE16_MEMBER(astrocorp_state::astrocorp_sound_bank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_8_15)
{
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(0x40000 * ((data >> 8) & 1));
+ m_oki->set_bank_base(0x40000 * ((data >> 8) & 1));
// logerror("CPU #0 PC %06X: OKI bank %08X\n", space.device().safe_pc(), data);
}
}
WRITE16_MEMBER(astrocorp_state::skilldrp_sound_bank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
{
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(0x40000 * (data & 1));
+ m_oki->set_bank_base(0x40000 * (data & 1));
// logerror("CPU #0 PC %06X: OKI bank %08X\n", space.device().safe_pc(), data);
}
}
diff --git a/src/mame/drivers/bestleag.c b/src/mame/drivers/bestleag.c
index 0ed06ea355f..094e1322a07 100644
--- a/src/mame/drivers/bestleag.c
+++ b/src/mame/drivers/bestleag.c
@@ -33,7 +33,8 @@ public:
m_txram(*this, "txram"),
m_vregs(*this, "vregs"),
m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
required_shared_ptr<UINT16> m_bgram;
required_shared_ptr<UINT16> m_fgram;
@@ -56,6 +57,7 @@ public:
UINT32 screen_update_bestleaw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
@@ -228,9 +230,7 @@ WRITE16_MEMBER(bestleag_state::bestleag_fgram_w)
WRITE16_MEMBER(bestleag_state::oki_bank_w)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(0x40000 * ((data & 3) - 1));
+ m_oki->set_bank_base(0x40000 * ((data & 3) - 1));
}
diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c
index 5c7d1f833f3..baeef079256 100644
--- a/src/mame/drivers/cps1.c
+++ b/src/mame/drivers/cps1.c
@@ -310,8 +310,7 @@ WRITE8_MEMBER(cps_state::cps1_snd_bankswitch_w)
WRITE8_MEMBER(cps_state::cps1_oki_pin7_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_pin7(data & 1);
+ m_oki->set_pin7(data & 1);
}
WRITE16_MEMBER(cps_state::cps1_soundlatch_w)
diff --git a/src/mame/drivers/ddragon3.c b/src/mame/drivers/ddragon3.c
index d8379ce81b6..6cc5c603806 100644
--- a/src/mame/drivers/ddragon3.c
+++ b/src/mame/drivers/ddragon3.c
@@ -156,9 +156,7 @@ ROMs (All ROMs are 27C010 EPROM. - means not populated)
WRITE8_MEMBER(ddragon3_state::oki_bankswitch_w)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((data & 1) * 0x40000);
+ m_oki->set_bank_base((data & 1) * 0x40000);
}
WRITE16_MEMBER(ddragon3_state::ddragon3_io_w)
diff --git a/src/mame/drivers/deniam.c b/src/mame/drivers/deniam.c
index d48521eb927..539b36498a5 100644
--- a/src/mame/drivers/deniam.c
+++ b/src/mame/drivers/deniam.c
@@ -60,19 +60,15 @@ WRITE16_MEMBER(deniam_state::sound_command_w)
WRITE8_MEMBER(deniam_state::deniam16b_oki_rom_bank_w)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((data & 0x40) ? 0x40000 : 0x00000);
+ m_oki->set_bank_base((data & 0x40) ? 0x40000 : 0x00000);
}
WRITE16_MEMBER(deniam_state::deniam16c_oki_rom_bank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
{
if ((data&0xFE) != 0) popmessage("OKI bank was not 0 or 1! contact MAMEDEV!");
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((data & 0x01) ? 0x40000 : 0x00000);
+ m_oki->set_bank_base((data & 0x01) ? 0x40000 : 0x00000);
}
}
diff --git a/src/mame/drivers/diverboy.c b/src/mame/drivers/diverboy.c
index 3f21e160b95..5cea3474a25 100644
--- a/src/mame/drivers/diverboy.c
+++ b/src/mame/drivers/diverboy.c
@@ -60,7 +60,8 @@ public:
: driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_audiocpu(*this, "audiocpu"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_spriteram;
@@ -75,6 +76,7 @@ public:
UINT32 screen_update_diverboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
@@ -136,12 +138,9 @@ WRITE16_MEMBER(diverboy_state::soundcmd_w)
WRITE8_MEMBER(diverboy_state::okibank_w)
{
- device_t *device = machine().device("oki");
/* bit 2 might be reset */
// popmessage("%02x",data);
-
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((data & 3) * 0x40000);
+ m_oki->set_bank_base((data & 3) * 0x40000);
}
diff --git a/src/mame/drivers/drtomy.c b/src/mame/drivers/drtomy.c
index ccc2274e43e..6bd9f66b410 100644
--- a/src/mame/drivers/drtomy.c
+++ b/src/mame/drivers/drtomy.c
@@ -19,7 +19,8 @@ public:
m_videoram_fg(*this, "videorafg"),
m_videoram_bg(*this, "videorabg"),
m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_videoram_fg;
@@ -44,6 +45,7 @@ public:
UINT32 screen_update_drtomy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
@@ -154,12 +156,10 @@ WRITE16_MEMBER(drtomy_state::drtomy_vram_bg_w)
WRITE16_MEMBER(drtomy_state::drtomy_okibank_w)
{
- device_t *device = machine().device("oki");
if (m_oki_bank != (data & 3))
{
m_oki_bank = data & 3;
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(m_oki_bank * 0x40000);
+ m_oki->set_bank_base(m_oki_bank * 0x40000);
}
/* unknown bit 2 -> (data & 4) */
diff --git a/src/mame/drivers/funybubl.c b/src/mame/drivers/funybubl.c
index 8b0ee6c0819..61fa2b3eab2 100644
--- a/src/mame/drivers/funybubl.c
+++ b/src/mame/drivers/funybubl.c
@@ -73,9 +73,7 @@ WRITE8_MEMBER(funybubl_state::funybubl_soundcommand_w)
WRITE8_MEMBER(funybubl_state::funybubl_oki_bank_sw)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(((data & 1) * 0x40000));
+ m_oki->set_bank_base(((data & 1) * 0x40000));
}
diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c
index 6386ebcc68b..c04934d8946 100644
--- a/src/mame/drivers/fuukifg2.c
+++ b/src/mame/drivers/fuukifg2.c
@@ -122,14 +122,12 @@ WRITE8_MEMBER(fuuki16_state::fuuki16_sound_rombank_w)
WRITE8_MEMBER(fuuki16_state::fuuki16_oki_banking_w)
{
- device_t *device = machine().device("oki");
/*
data & 0x06 is always equals to data & 0x60
data & 0x10 is always set
*/
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(((data & 6) >> 1) * 0x40000);
+ m_oki->set_bank_base(((data & 6) >> 1) * 0x40000);
}
static ADDRESS_MAP_START( fuuki16_sound_map, AS_PROGRAM, 8, fuuki16_state )
diff --git a/src/mame/drivers/galpanic.c b/src/mame/drivers/galpanic.c
index 139c8aa45ce..5825fb1155b 100644
--- a/src/mame/drivers/galpanic.c
+++ b/src/mame/drivers/galpanic.c
@@ -238,11 +238,9 @@ READ16_MEMBER(galpanic_state::comad_timer_r)
/* a kludge! */
READ8_MEMBER(galpanic_state::comad_okim6295_r)
{
-// device_t *device = machine().device("oki");
UINT16 retvalue;
-// okim6295_device *oki = downcast<okim6295_device *>(device);
-// retvalue = oki->read_status(); // doesn't work, causes lockups when girls change..
+// retvalue = m_oki->read_status(); // doesn't work, causes lockups when girls change..
retvalue = machine().rand();
return retvalue;
diff --git a/src/mame/drivers/gotcha.c b/src/mame/drivers/gotcha.c
index d3a357c9f6f..19b2064031e 100644
--- a/src/mame/drivers/gotcha.c
+++ b/src/mame/drivers/gotcha.c
@@ -86,11 +86,9 @@ WRITE16_MEMBER(gotcha_state::gotcha_lamps_w)
WRITE16_MEMBER(gotcha_state::gotcha_oki_bank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_8_15)
{
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((((~data & 0x0100) >> 8) * 0x40000));
+ m_oki->set_bank_base((((~data & 0x0100) >> 8) * 0x40000));
}
}
diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c
index febdbd74f53..fc89ec06416 100644
--- a/src/mame/drivers/igs011.c
+++ b/src/mame/drivers/igs011.c
@@ -86,7 +86,8 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_priority_ram(*this, "priority_ram"),
- m_vbowl_trackball(*this, "vbowl_trackball"){ }
+ m_vbowl_trackball(*this, "vbowl_trackball"),
+ m_oki(*this, "oki"){ }
required_device<cpu_device> m_maincpu;
required_shared_ptr<UINT16> m_priority_ram;
@@ -217,6 +218,7 @@ public:
void ryukobou_decrypt();
void lhb2_decrypt_gfx();
void drgnwrld_gfx_decrypt();
+ optional_device<okim6295_device> m_oki;
};
@@ -2373,11 +2375,9 @@ WRITE16_MEMBER(igs011_state::lhb_irq_enable_w)
WRITE16_MEMBER(igs011_state::lhb_okibank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_8_15)
{
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((data & 0x200) ? 0x40000 : 0);
+ m_oki->set_bank_base((data & 0x200) ? 0x40000 : 0);
}
if ( data & (~0x200) )
diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c
index 9abbd39da2a..23431658daf 100644
--- a/src/mame/drivers/kaneko16.c
+++ b/src/mame/drivers/kaneko16.c
@@ -267,10 +267,8 @@ ADDRESS_MAP_END
WRITE16_MEMBER(kaneko16_state::bakubrkr_oki_bank_sw)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7) {
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(0x40000 * (data & 0x7) );
+ m_oki->set_bank_base(0x40000 * (data & 0x7) );
logerror("%s:Selecting OKI bank %02X\n",machine().describe_context(),data&0xff);
}
}
diff --git a/src/mame/drivers/kickgoal.c b/src/mame/drivers/kickgoal.c
index 8e0c1b6522d..a5b554a2afd 100644
--- a/src/mame/drivers/kickgoal.c
+++ b/src/mame/drivers/kickgoal.c
@@ -151,14 +151,12 @@ void ::kickgoal_play(okim6295_device *oki, int melody, int data)
WRITE16_MEMBER(kickgoal_state::kickgoal_snd_w)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
if (ACCESSING_BITS_0_7)
{
logerror("PC:%06x Writing %04x to Sound CPU\n",space.device().safe_pcbase(),data);
if (data >= 0x40) {
if (data == 0xfe) {
- oki->write(0,0x40); /* Stop playing the melody */
+ m_oki->write(0,0x40); /* Stop playing the melody */
m_melody = 0x00;
m_melody_loop = 0x00;
}
@@ -167,37 +165,37 @@ WRITE16_MEMBER(kickgoal_state::kickgoal_snd_w)
}
}
else if (data == 0) {
- oki->write(0,0x38); /* Stop playing effects */
+ m_oki->write(0,0x38); /* Stop playing effects */
}
else {
kickgoal_sound = kickgoal_cmd_snd[data];
if (kickgoal_sound >= 0x70) {
if (kickgoal_snd_bank != 1)
- oki->set_bank_base((1 * 0x40000));
+ m_oki->set_bank_base((1 * 0x40000));
kickgoal_snd_bank = 1;
- kickgoal_play(oki, 0, data);
+ kickgoal_play(m_oki, 0, data);
}
else if (kickgoal_sound >= 0x69) {
if (kickgoal_snd_bank != 2)
- oki->set_bank_base((2 * 0x40000));
+ m_oki->set_bank_base((2 * 0x40000));
kickgoal_snd_bank = 2;
- kickgoal_play(oki, 4, data);
+ kickgoal_play(m_oki, 4, data);
}
else if (kickgoal_sound >= 0x65) {
if (kickgoal_snd_bank != 1)
- oki->set_bank_base((1 * 0x40000));
+ m_oki->set_bank_base((1 * 0x40000));
kickgoal_snd_bank = 1;
- kickgoal_play(oki, 4, data);
+ kickgoal_play(m_oki, 4, data);
}
else if (kickgoal_sound >= 0x60) {
kickgoal_snd_bank = 0;
- oki->set_bank_base(device, (0 * 0x40000));
+ m_oki->set_bank_base(device, (0 * 0x40000));
kickgoal_snd_bank = 0;
- kickgoal_play(oki, 4, data);
+ kickgoal_play(m_oki, 4, data);
}
else {
- kickgoal_play(oki, 0, data);
+ kickgoal_play(m_oki, 0, data);
}
}
}
@@ -206,21 +204,19 @@ WRITE16_MEMBER(kickgoal_state::kickgoal_snd_w)
WRITE16_MEMBER(kickgoal_state::actionhw_snd_w)
{
- device_t *device = machine().device("oki");
logerror("%s: Writing %04x to Sound CPU - mask %04x\n",machine().describe_context(),data,mem_mask);
if (!ACCESSING_BITS_0_7)
data >>= 8;
- okim6295_device *oki = downcast<okim6295_device *>(device);
switch (data)
{
- case 0xfc: oki->set_bank_base((0 * 0x40000)); break;
- case 0xfd: oki->set_bank_base((2 * 0x40000)); break;
- case 0xfe: oki->set_bank_base((1 * 0x40000)); break;
- case 0xff: oki->set_bank_base((3 * 0x40000)); break;
+ case 0xfc: m_oki->set_bank_base((0 * 0x40000)); break;
+ case 0xfd: m_oki->set_bank_base((2 * 0x40000)); break;
+ case 0xfe: m_oki->set_bank_base((1 * 0x40000)); break;
+ case 0xff: m_oki->set_bank_base((3 * 0x40000)); break;
case 0x78:
- oki->write_command(data);
+ m_oki->write_command(data);
m_snd_sam[0] = 00; m_snd_sam[1]= 00; m_snd_sam[2] = 00; m_snd_sam[3] = 00;
break;
default:
@@ -229,44 +225,44 @@ WRITE16_MEMBER(kickgoal_state::actionhw_snd_w)
if ((data & 0x80) && (m_snd_sam[3] != m_snd_new))
{
logerror("About to play sample %02x at vol %02x\n", m_snd_new, data);
- if ((oki->read_status() & 0x08) != 0x08)
+ if ((m_oki->read_status() & 0x08) != 0x08)
{
logerror("Playing sample %02x at vol %02x\n", m_snd_new, data);
- oki->write_command(m_snd_new);
- oki->write_command(data);
+ m_oki->write_command(m_snd_new);
+ m_oki->write_command(data);
}
m_snd_new = 00;
}
if ((data & 0x40) && (m_snd_sam[2] != m_snd_new))
{
logerror("About to play sample %02x at vol %02x\n", m_snd_new, data);
- if ((oki->read_status() & 0x04) != 0x04)
+ if ((m_oki->read_status() & 0x04) != 0x04)
{
logerror("Playing sample %02x at vol %02x\n", m_snd_new, data);
- oki->write_command(m_snd_new);
- oki->write_command(data);
+ m_oki->write_command(m_snd_new);
+ m_oki->write_command(data);
}
m_snd_new = 00;
}
if ((data & 0x20) && (m_snd_sam[1] != m_snd_new))
{
logerror("About to play sample %02x at vol %02x\n", m_snd_new, data);
- if ((oki->read_status() & 0x02) != 0x02)
+ if ((m_oki->read_status() & 0x02) != 0x02)
{
logerror("Playing sample %02x at vol %02x\n", m_snd_new, data);
- oki->write_command(m_snd_new);
- oki->write_command(data);
+ m_oki->write_command(m_snd_new);
+ m_oki->write_command(data);
}
m_snd_new = 00;
}
if ((data & 0x10) && (m_snd_sam[0] != m_snd_new))
{
logerror("About to play sample %02x at vol %02x\n", m_snd_new, data);
- if ((oki->read_status() & 0x01) != 0x01)
+ if ((m_oki->read_status() & 0x01) != 0x01)
{
logerror("Playing sample %02x at vol %02x\n", m_snd_new, data);
- oki->write_command(m_snd_new);
- oki->write_command(data);
+ m_oki->write_command(m_snd_new);
+ m_oki->write_command(data);
}
m_snd_new = 00;
}
@@ -281,7 +277,7 @@ WRITE16_MEMBER(kickgoal_state::actionhw_snd_w)
else /* Turn a channel off */
{
logerror("Turning channel %02x off\n", data);
- oki->write_command(data);
+ m_oki->write_command(data);
if (data & 0x40) m_snd_sam[3] = 00;
if (data & 0x20) m_snd_sam[2] = 00;
if (data & 0x10) m_snd_sam[1] = 00;
diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c
index 94362d99806..076b6dc9444 100644
--- a/src/mame/drivers/legionna.c
+++ b/src/mame/drivers/legionna.c
@@ -224,10 +224,9 @@ ADDRESS_MAP_END
WRITE8_MEMBER(legionna_state::okim_rombank_w)
-{
- device_t *device = machine().device("oki");
+{
// popmessage("%08x",0x40000 * (data & 0x07));
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (data & 0x7));
+ m_oki->set_bank_base(0x40000 * (data & 0x7));
}
static ADDRESS_MAP_START( cupsocbl_sound_mem, AS_PROGRAM, 8, legionna_state )
diff --git a/src/mame/drivers/lordgun.c b/src/mame/drivers/lordgun.c
index 86014cd3131..8b6817bf598 100644
--- a/src/mame/drivers/lordgun.c
+++ b/src/mame/drivers/lordgun.c
@@ -351,8 +351,7 @@ ADDRESS_MAP_END
WRITE8_MEMBER(lordgun_state::lordgun_okibank_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base((data & 2) ? 0x40000 : 0);
+ m_oki->set_bank_base((data & 2) ? 0x40000 : 0);
if (data & ~3) logerror("%s: unknown okibank bits %02x\n", machine().describe_context(), data);
// popmessage("OKI %x", data);
}
diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c
index 3e75f48c325..d3e3f8165b0 100644
--- a/src/mame/drivers/m92.c
+++ b/src/mame/drivers/m92.c
@@ -375,8 +375,7 @@ ADDRESS_MAP_END
WRITE16_MEMBER(m92_state::oki_bank_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * ((data+1) & 0x3)); // +1?
+ m_oki->set_bank_base(0x40000 * ((data+1) & 0x3)); // +1?
}
static ADDRESS_MAP_START( ppan_portmap, AS_IO, 16, m92_state )
diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c
index e0bcd899786..d14fab71087 100644
--- a/src/mame/drivers/metro.c
+++ b/src/mame/drivers/metro.c
@@ -1177,23 +1177,19 @@ static void gakusai_oki_bank_set(device_t *device)
WRITE16_MEMBER(metro_state::gakusai_oki_bank_hi_w)
{
- device_t *device = machine().device("oki");
-
if (ACCESSING_BITS_0_7)
{
m_gakusai_oki_bank_hi = data & 0xff;
- gakusai_oki_bank_set(device);
+ gakusai_oki_bank_set(m_oki);
}
}
WRITE16_MEMBER(metro_state::gakusai_oki_bank_lo_w)
{
- device_t *device = machine().device("oki");
-
if (ACCESSING_BITS_0_7)
{
m_gakusai_oki_bank_lo = data & 0xff;
- gakusai_oki_bank_set(device);
+ gakusai_oki_bank_set(m_oki);
}
}
diff --git a/src/mame/drivers/midyunit.c b/src/mame/drivers/midyunit.c
index dc92935f924..bf02f5227b0 100644
--- a/src/mame/drivers/midyunit.c
+++ b/src/mame/drivers/midyunit.c
@@ -137,9 +137,8 @@ Notes:
WRITE8_MEMBER(midyunit_state::yawdim_oki_bank_w)
{
- device_t *device = machine().device("oki");
if (data & 4)
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (data & 3));
+ m_oki->set_bank_base(0x40000 * (data & 3));
}
diff --git a/src/mame/drivers/moo.c b/src/mame/drivers/moo.c
index 54ddea16970..c226172384e 100644
--- a/src/mame/drivers/moo.c
+++ b/src/mame/drivers/moo.c
@@ -249,10 +249,9 @@ WRITE16_MEMBER(moo_state::moo_prot_w)
WRITE16_MEMBER(moo_state::moobl_oki_bank_w)
{
- device_t *device = machine().device("oki");
logerror("%x to OKI bank\n", data);
- downcast<okim6295_device *>(device)->set_bank_base((data & 0x0f) * 0x40000);
+ m_oki->set_bank_base((data & 0x0f) * 0x40000);
}
static ADDRESS_MAP_START( moo_map, AS_PROGRAM, 16, moo_state )
diff --git a/src/mame/drivers/nmg5.c b/src/mame/drivers/nmg5.c
index 3170d9e57cd..69ef76d50a6 100644
--- a/src/mame/drivers/nmg5.c
+++ b/src/mame/drivers/nmg5.c
@@ -238,7 +238,8 @@ public:
m_bitmap(*this, "bitmap"),
m_sprgen(*this, "spritegen"),
m_maincpu(*this, "maincpu"),
- m_soundcpu(*this, "soundcpu")
+ m_soundcpu(*this, "soundcpu"),
+ m_oki(*this, "oki")
{ }
/* memory pointers */
@@ -263,6 +264,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
+ required_device<okim6295_device> m_oki;
DECLARE_WRITE16_MEMBER(fg_videoram_w);
DECLARE_WRITE16_MEMBER(bg_videoram_w);
DECLARE_WRITE16_MEMBER(nmg5_soundlatch_w);
@@ -337,8 +339,7 @@ WRITE16_MEMBER(nmg5_state::priority_reg_w)
WRITE8_MEMBER(nmg5_state::oki_banking_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base((data & 1) ? 0x40000 : 0);
+ m_oki->set_bank_base((data & 1) ? 0x40000 : 0);
}
/*******************************************************************
diff --git a/src/mame/drivers/oneshot.c b/src/mame/drivers/oneshot.c
index 510bd90661f..512a08c05b7 100644
--- a/src/mame/drivers/oneshot.c
+++ b/src/mame/drivers/oneshot.c
@@ -90,10 +90,9 @@ READ16_MEMBER(oneshot_state::oneshot_gun_y_p2_r)
WRITE16_MEMBER(oneshot_state::soundbank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
{
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * ((data & 0x03) ^ 0x03));
+ m_oki->set_bank_base(0x40000 * ((data & 0x03) ^ 0x03));
}
}
diff --git a/src/mame/drivers/othldrby.c b/src/mame/drivers/othldrby.c
index 0d8606d29f7..2e1f094104b 100644
--- a/src/mame/drivers/othldrby.c
+++ b/src/mame/drivers/othldrby.c
@@ -32,9 +32,8 @@ READ16_MEMBER(othldrby_state::othldrby_scanline_r)
WRITE16_MEMBER(othldrby_state::oki_bankswitch_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
- downcast<okim6295_device *>(device)->set_bank_base((data & 1) * 0x40000);
+ m_oki->set_bank_base((data & 1) * 0x40000);
}
WRITE16_MEMBER(othldrby_state::coinctrl_w)
diff --git a/src/mame/drivers/playmark.c b/src/mame/drivers/playmark.c
index b9afd4d846d..bfee0eb3ffc 100644
--- a/src/mame/drivers/playmark.c
+++ b/src/mame/drivers/playmark.c
@@ -157,15 +157,13 @@ READ8_MEMBER(playmark_state::playmark_snd_flag_r)
WRITE8_MEMBER(playmark_state::playmark_oki_banking_w)
{
- device_t *device = machine().device("oki");
-
if (m_old_oki_bank != (data & 7))
{
m_old_oki_bank = data & 7;
if (((m_old_oki_bank - 1) * 0x40000) < memregion("oki")->bytes())
{
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (m_old_oki_bank - 1));
+ m_oki->set_bank_base(0x40000 * (m_old_oki_bank - 1));
}
}
}
diff --git a/src/mame/drivers/pzletime.c b/src/mame/drivers/pzletime.c
index 86c4f0ed429..95aaf060f41 100644
--- a/src/mame/drivers/pzletime.c
+++ b/src/mame/drivers/pzletime.c
@@ -30,7 +30,8 @@ public:
m_mid_videoram(*this, "mid_videoram"),
m_txt_videoram(*this, "txt_videoram"),
m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_video_regs;
@@ -62,6 +63,7 @@ public:
virtual void palette_init();
UINT32 screen_update_pzletime(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
@@ -211,8 +213,7 @@ WRITE16_MEMBER(pzletime_state::video_regs_w)
WRITE16_MEMBER(pzletime_state::oki_bank_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (data & 0x3));
+ m_oki->set_bank_base(0x40000 * (data & 0x3));
}
CUSTOM_INPUT_MEMBER(pzletime_state::ticket_status_r)
diff --git a/src/mame/drivers/rampart.c b/src/mame/drivers/rampart.c
index 7bb0079de13..9eac8a72c93 100644
--- a/src/mame/drivers/rampart.c
+++ b/src/mame/drivers/rampart.c
@@ -106,7 +106,7 @@ WRITE16_MEMBER(rampart_state::latch_w)
{
set_oki6295_volume((data & 0x0020) ? 100 : 0);
if (!(data & 0x0010))
- machine().device("oki")->reset();
+ m_oki->reset();
set_ym2413_volume(((data >> 1) & 7) * 100 / 7);
if (!(data & 0x0001))
machine().device("ymsnd")->reset();
diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c
index a5372fe9c7d..01f9c5bc233 100644
--- a/src/mame/drivers/seta2.c
+++ b/src/mame/drivers/seta2.c
@@ -588,21 +588,19 @@ READ32_MEMBER(seta2_state::funcube_debug_r)
READ32_MEMBER(seta2_state::oki_read)
{
- device_t *device = machine().device("oki");
- return downcast<okim9810_device *>(device)->read_status() << 16;
+ return m_oki->read_status() << 16;
}
WRITE32_MEMBER(seta2_state::oki_write)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
{
const UINT8 tmp = (data & 0x000000ff);
- downcast<okim9810_device *>(device)->write_TMP_register(tmp);
+ m_oki->write_TMP_register(tmp);
}
else if (ACCESSING_BITS_16_23)
{
const UINT8 cmd = (data & 0x00ff0000) >> 16;
- downcast<okim9810_device *>(device)->write_command(cmd);
+ m_oki->write_command(cmd);
}
}
diff --git a/src/mame/drivers/shadfrce.c b/src/mame/drivers/shadfrce.c
index ad27bc9a4a4..ff387796c0c 100644
--- a/src/mame/drivers/shadfrce.c
+++ b/src/mame/drivers/shadfrce.c
@@ -390,8 +390,7 @@ ADDRESS_MAP_END
WRITE8_MEMBER(shadfrce_state::oki_bankswitch_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base((data & 1) * 0x40000);
+ m_oki->set_bank_base((data & 1) * 0x40000);
}
static ADDRESS_MAP_START( shadfrce_sound_map, AS_PROGRAM, 8, shadfrce_state )
diff --git a/src/mame/drivers/snowbros.c b/src/mame/drivers/snowbros.c
index 28857b522b4..4f6574a34c9 100644
--- a/src/mame/drivers/snowbros.c
+++ b/src/mame/drivers/snowbros.c
@@ -351,12 +351,11 @@ ADDRESS_MAP_END
WRITE8_MEMBER(snowbros_state::twinadv_oki_bank_w)
{
- device_t *device = machine().device("oki");
int bank = (data &0x02)>>1;
if (data&0xfd) logerror ("Unused bank bits! %02x\n",data);
- downcast<okim6295_device *>(device)->set_bank_base(bank * 0x40000);
+ m_oki->set_bank_base(bank * 0x40000);
}
static ADDRESS_MAP_START( twinadv_sound_io_map, AS_IO, 8, snowbros_state )
@@ -471,12 +470,10 @@ void snowbros_state::sb3_play_sound (okim6295_device *oki, int data)
WRITE16_MEMBER(snowbros_state::sb3_sound_w)
{
- device_t *device = machine().device("oki");
- okim6295_device *oki = downcast<okim6295_device *>(device);
if (data == 0x00fe)
{
m_sb3_music_is_playing = 0;
- oki->write_command(0x78); /* Stop sounds */
+ m_oki->write_command(0x78); /* Stop sounds */
}
else /* the alternating 0x00-0x2f or 0x30-0x5f might be something to do with the channels */
{
@@ -484,7 +481,7 @@ WRITE16_MEMBER(snowbros_state::sb3_sound_w)
if (data <= 0x21)
{
- sb3_play_sound(oki, data);
+ sb3_play_sound(m_oki, data);
}
if (data>=0x22 && data<=0x31)
@@ -494,7 +491,7 @@ WRITE16_MEMBER(snowbros_state::sb3_sound_w)
if ((data>=0x30) && (data<=0x51))
{
- sb3_play_sound(oki, data-0x30);
+ sb3_play_sound(m_oki, data-0x30);
}
if (data>=0x52 && data<=0x5f)
diff --git a/src/mame/drivers/speedspn.c b/src/mame/drivers/speedspn.c
index 7dc3d9dd42b..9c62e417f64 100644
--- a/src/mame/drivers/speedspn.c
+++ b/src/mame/drivers/speedspn.c
@@ -98,8 +98,7 @@ WRITE8_MEMBER(speedspn_state::speedspn_sound_w)
WRITE8_MEMBER(speedspn_state::oki_banking_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (data & 3));
+ m_oki->set_bank_base(0x40000 * (data & 3));
}
/*** MEMORY MAPS *************************************************************/
diff --git a/src/mame/drivers/sslam.c b/src/mame/drivers/sslam.c
index b5c9389620b..88222140477 100644
--- a/src/mame/drivers/sslam.c
+++ b/src/mame/drivers/sslam.c
@@ -295,7 +295,6 @@ static void sslam_play(device_t *device, int track, int data)
WRITE16_MEMBER(sslam_state::sslam_snd_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
{
logerror("%s Writing %04x to Sound CPU\n",machine().describe_context(),data);
@@ -303,7 +302,7 @@ WRITE16_MEMBER(sslam_state::sslam_snd_w)
if (data == 0xfe) {
/* This should reset the sound MCU and stop audio playback, but here, it */
/* chops the first coin insert. So let's only stop any playing melodies. */
- sslam_play(device, 1, (0x80 | 0x40)); /* Stop playing the melody */
+ sslam_play(m_oki, 1, (0x80 | 0x40)); /* Stop playing the melody */
}
else {
logerror("Unknown command (%02x) sent to the Sound controller\n",data);
@@ -323,13 +322,13 @@ WRITE16_MEMBER(sslam_state::sslam_snd_w)
else if (m_sound >= 0x70) {
/* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
// if (m_snd_bank != 1)
-// downcast<okim6295_device *>(device)->set_bank_base((1 * 0x40000));
+// m_oki->set_bank_base((1 * 0x40000));
// sslam_snd_bank = 1;
- sslam_play(device, 0, m_sound);
+ sslam_play(m_oki, 0, m_sound);
}
else if (m_sound >= 0x69) {
if (m_snd_bank != 2)
- downcast<okim6295_device *>(device)->set_bank_base(2 * 0x40000);
+ m_oki->set_bank_base(2 * 0x40000);
m_snd_bank = 2;
switch (m_sound)
{
@@ -338,18 +337,18 @@ WRITE16_MEMBER(sslam_state::sslam_snd_w)
case 0x6c: m_melody = 7; break;
default: m_melody = 0; m_bar = 0; break; /* Invalid */
}
- sslam_play(device, m_melody, m_sound);
+ sslam_play(m_oki, m_melody, m_sound);
}
else if (m_sound >= 0x65) {
if (m_snd_bank != 1)
- downcast<okim6295_device *>(device)->set_bank_base(1 * 0x40000);
+ m_oki->set_bank_base(1 * 0x40000);
m_snd_bank = 1;
m_melody = 4;
- sslam_play(device, m_melody, m_sound);
+ sslam_play(m_oki, m_melody, m_sound);
}
else if (m_sound >= 0x60) {
if (m_snd_bank != 0)
- downcast<okim6295_device *>(device)->set_bank_base(0 * 0x40000);
+ m_oki->set_bank_base(0 * 0x40000);
m_snd_bank = 0;
switch (m_sound)
{
@@ -358,10 +357,10 @@ WRITE16_MEMBER(sslam_state::sslam_snd_w)
case 0x64: m_melody = 3; break;
default: m_melody = 0; m_bar = 0; break; /* Invalid */
}
- sslam_play(device, m_melody, m_sound);
+ sslam_play(m_oki, m_melody, m_sound);
}
else {
- sslam_play(device, 0, m_sound);
+ sslam_play(m_oki, 0, m_sound);
}
}
}
diff --git a/src/mame/drivers/stlforce.c b/src/mame/drivers/stlforce.c
index 9ec34ecb4c8..494323a5215 100644
--- a/src/mame/drivers/stlforce.c
+++ b/src/mame/drivers/stlforce.c
@@ -88,8 +88,7 @@ WRITE16_MEMBER(stlforce_state::eeprom_w)
WRITE16_MEMBER(stlforce_state::oki_bank_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * ((data>>8) & 3));
+ m_oki->set_bank_base(0x40000 * ((data>>8) & 3));
}
static ADDRESS_MAP_START( stlforce_map, AS_PROGRAM, 16, stlforce_state )
diff --git a/src/mame/drivers/subsino2.c b/src/mame/drivers/subsino2.c
index 8f2f3de7e39..ee0906cdb38 100644
--- a/src/mame/drivers/subsino2.c
+++ b/src/mame/drivers/subsino2.c
@@ -81,7 +81,8 @@ public:
m_outputs16(*this, "outputs16"),
m_outputs(*this, "outputs"),
m_am188em_regs(*this, "am188em_regs"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
UINT8 *m_hm86171_colorram;
layer_t m_layers[2];
@@ -170,6 +171,7 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(am188em_timer2_irq);
TIMER_DEVICE_CALLBACK_MEMBER(h8_timer_irq);
required_device<cpu_device> m_maincpu;
+ optional_device<okim6295_device> m_oki;
};
@@ -819,18 +821,14 @@ READ8_MEMBER(subsino2_state::vblank_bit6_r)
WRITE8_MEMBER(subsino2_state::oki_bank_bit0_w)
{
- device_t *device = machine().device("oki");
// it writes 0x32 or 0x33
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base((data & 1) * 0x40000);
+ m_oki->set_bank_base((data & 1) * 0x40000);
}
WRITE8_MEMBER(subsino2_state::oki_bank_bit4_w)
{
- device_t *device = machine().device("oki");
// it writes 0x23 or 0x33
- okim6295_device *oki = downcast<okim6295_device *>(device);
- oki->set_bank_base(((data >> 4) & 1) * 0x40000);
+ m_oki->set_bank_base(((data >> 4) & 1) * 0x40000);
}
diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c
index 49546207aed..b2ced754c0a 100644
--- a/src/mame/drivers/tickee.c
+++ b/src/mame/drivers/tickee.c
@@ -36,7 +36,8 @@ public:
m_tlc34076(*this, "tlc34076"),
m_vram(*this, "vram"),
m_control(*this, "control"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
required_device<tlc34076_device> m_tlc34076;
required_shared_ptr<UINT16> m_vram;
@@ -63,6 +64,7 @@ public:
TIMER_CALLBACK_MEMBER(clear_gun_interrupt);
TIMER_CALLBACK_MEMBER(setup_gun_interrupts);
required_device<cpu_device> m_maincpu;
+ optional_device<okim6295_device> m_oki;
};
@@ -355,23 +357,22 @@ WRITE16_MEMBER(tickee_state::rapidfir_control_w)
WRITE16_MEMBER(tickee_state::sound_bank_w)
{
- device_t *device = machine().device("oki");
switch (data & 0xff)
{
case 0x2c:
- downcast<okim6295_device *>(device)->set_bank_base(0x00000);
+ m_oki->set_bank_base(0x00000);
break;
case 0x2d:
- downcast<okim6295_device *>(device)->set_bank_base(0x40000);
+ m_oki->set_bank_base(0x40000);
break;
case 0x1c:
- downcast<okim6295_device *>(device)->set_bank_base(0x80000);
+ m_oki->set_bank_base(0x80000);
break;
case 0x1d:
- downcast<okim6295_device *>(device)->set_bank_base(0xc0000);
+ m_oki->set_bank_base(0xc0000);
break;
default:
diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c
index 70061f3cd99..99f1786cab5 100644
--- a/src/mame/drivers/tmaster.c
+++ b/src/mame/drivers/tmaster.c
@@ -124,12 +124,14 @@ public:
m_maincpu(*this,"maincpu"),
m_microtouch(*this,"microtouch"),
m_regs(*this, "regs"),
- m_galgames_ram(*this, "galgames_ram"){ }
+ m_galgames_ram(*this, "galgames_ram"),
+ m_oki(*this, "oki"){ }
required_device<cpu_device> m_maincpu;
optional_device<microtouch_device> m_microtouch;
required_shared_ptr<UINT16> m_regs;
optional_shared_ptr<UINT16> m_galgames_ram;
+ required_device<okim6295_device> m_oki;
int m_okibank;
UINT8 m_rtc_ram[8];
@@ -201,12 +203,11 @@ public:
WRITE16_MEMBER(tmaster_state::tmaster_oki_bank_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_8_15)
{
// data & 0x0800?
m_okibank = ((data >> 8) & 3);
- downcast<okim6295_device *>(device)->set_bank_base(m_okibank * 0x40000);
+ m_oki->set_bank_base(m_okibank * 0x40000);
}
if (ACCESSING_BITS_0_7)
diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c
index 1751ceead97..e96eeba63a3 100644
--- a/src/mame/drivers/toaplan2.c
+++ b/src/mame/drivers/toaplan2.c
@@ -746,10 +746,9 @@ WRITE16_MEMBER(toaplan2_state::fixeight_subcpu_ctrl_w)
WRITE16_MEMBER(toaplan2_state::oki_bankswitch_w)
{
- device_t *device = machine().device("oki");
if (ACCESSING_BITS_0_7)
{
- downcast<okim6295_device *>(device)->set_bank_base((data & 1) * 0x40000);
+ m_oki->set_bank_base((data & 1) * 0x40000);
}
}
diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c
index b57adb3ec49..d5a4ecc040b 100644
--- a/src/mame/drivers/tumbleb.c
+++ b/src/mame/drivers/tumbleb.c
@@ -605,8 +605,6 @@ void tumbleb_state::process_tumbleb2_music_command( okim6295_device *oki, int da
WRITE16_MEMBER(tumbleb_state::tumbleb2_soundmcu_w)
{
- device_t *device = machine().device("oki");
-
int sound = tumbleb_sound_lookup[data & 0xff];
if (sound == 0x00)
@@ -616,11 +614,11 @@ WRITE16_MEMBER(tumbleb_state::tumbleb2_soundmcu_w)
}
else if (sound == -2)
{
- process_tumbleb2_music_command(downcast<okim6295_device *>(device), data);
+ process_tumbleb2_music_command(m_oki, data);
}
else
{
- tumbleb2_play_sound(downcast<okim6295_device *>(device), sound);
+ tumbleb2_play_sound(m_oki, sound);
}
}
@@ -1944,8 +1942,6 @@ GFXDECODE_END
MACHINE_START_MEMBER(tumbleb_state,tumbleb)
{
- m_oki = machine().device("oki");
-
save_item(NAME(m_music_command));
save_item(NAME(m_music_bank));
save_item(NAME(m_music_is_playing));
diff --git a/src/mame/drivers/unico.c b/src/mame/drivers/unico.c
index 5792b465753..262afba82a6 100644
--- a/src/mame/drivers/unico.c
+++ b/src/mame/drivers/unico.c
@@ -49,12 +49,11 @@ Year + Game PCB Notes
***************************************************************************/
WRITE16_MEMBER(unico_state::burglarx_sound_bank_w)
-{
- device_t *device = machine().device("oki");
+{
if (ACCESSING_BITS_8_15)
{
int bank = (data >> 8 ) & 1;
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * bank );
+ m_oki->set_bank_base(0x40000 * bank );
}
}
diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c
index d99fa554712..470b5ca8dd8 100644
--- a/src/mame/drivers/vamphalf.c
+++ b/src/mame/drivers/vamphalf.c
@@ -77,7 +77,8 @@ public:
m_wram(*this,"wram"),
m_tiles32(*this,"tiles32"),
m_wram32(*this,"wram32"),
- m_maincpu(*this, "maincpu") {
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") {
m_has_extra_gfx = 0;
}
@@ -167,6 +168,7 @@ public:
UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_aoh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
+ optional_device<okim6295_device> m_oki;
};
READ16_MEMBER(vamphalf_state::eeprom_r)
@@ -288,8 +290,7 @@ F94B
WRITE32_MEMBER(vamphalf_state::finalgdr_oki_bank_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * ((data & 0x300) >> 8));
+ m_oki->set_bank_base(0x40000 * ((data & 0x300) >> 8));
}
WRITE32_MEMBER(vamphalf_state::finalgdr_backupram_bank_w)
@@ -333,9 +334,8 @@ WRITE32_MEMBER(vamphalf_state::aoh_oki_bank_w)
WRITE16_MEMBER(vamphalf_state::boonggab_oki_bank_w)
{
- device_t *device = machine().device("oki");
if(offset)
- downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (data & 0x7));
+ m_oki->set_bank_base(0x40000 * (data & 0x7));
}
WRITE16_MEMBER(vamphalf_state::boonggab_prize_w)
diff --git a/src/mame/drivers/wwfwfest.c b/src/mame/drivers/wwfwfest.c
index 99065e622a4..25c40e870b3 100644
--- a/src/mame/drivers/wwfwfest.c
+++ b/src/mame/drivers/wwfwfest.c
@@ -158,8 +158,7 @@ WRITE16_MEMBER(wwfwfest_state::wwfwfest_scroll_write)
WRITE8_MEMBER(wwfwfest_state::oki_bankswitch_w)
{
- device_t *device = machine().device("oki");
- downcast<okim6295_device *>(device)->set_bank_base((data & 1) * 0x40000);
+ m_oki->set_bank_base((data & 1) * 0x40000);
}
WRITE16_MEMBER(wwfwfest_state::wwfwfest_soundwrite)
diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h
index 9887052cf64..5236b674ddc 100644
--- a/src/mame/includes/aerofgt.h
+++ b/src/mame/includes/aerofgt.h
@@ -1,5 +1,6 @@
#include "video/vsystem_spr.h"
#include "video/vsystem_spr2.h"
+#include "sound/okim6295.h"
class aerofgt_state : public driver_device
{
@@ -18,7 +19,8 @@ public:
m_spr_old(*this, "vsystem_spr_old"),
m_spr_old2(*this, "vsystem_spr_ol2"),
m_audiocpu(*this, "audiocpu"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_bg1videoram;
@@ -121,4 +123,5 @@ public:
void wbbc97_draw_bitmap( bitmap_rgb32 &bitmap );
DECLARE_WRITE_LINE_MEMBER(irqhandler);
required_device<cpu_device> m_maincpu;
+ optional_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h
index 972e2d18db7..9c974ec2273 100644
--- a/src/mame/includes/cps1.h
+++ b/src/mame/includes/cps1.h
@@ -3,6 +3,7 @@
#include "sound/msm5205.h"
#include "sound/qsound.h"
+#include "sound/okim6295.h"
struct gfx_range
{
@@ -75,7 +76,8 @@ public:
m_objram2(*this, "objram2"),
m_output(*this, "output"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu")
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki")
{ }
/* memory pointers */
@@ -164,6 +166,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
+ optional_device<okim6295_device> m_oki;
msm5205_device *m_msm_1; // fcrash
msm5205_device *m_msm_2; // fcrash
DECLARE_READ16_MEMBER(cps1_hack_dsw_r);
diff --git a/src/mame/includes/ddragon3.h b/src/mame/includes/ddragon3.h
index ddf13d8b3b1..65454bfa417 100644
--- a/src/mame/includes/ddragon3.h
+++ b/src/mame/includes/ddragon3.h
@@ -3,7 +3,7 @@
Double Dragon 3 & The Combatribes
*************************************************************************/
-
+#include "sound/okim6295.h"
class ddragon3_state : public driver_device
{
@@ -14,7 +14,8 @@ public:
m_fg_videoram(*this, "fg_videoram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"){ }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki"){ }
/* memory pointers */
required_shared_ptr<UINT16> m_bg_videoram;
@@ -38,6 +39,8 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
+
DECLARE_WRITE16_MEMBER(ddragon3_io_w);
DECLARE_WRITE16_MEMBER(ddragon3_scroll_w);
DECLARE_READ16_MEMBER(ddragon3_scroll_r);
diff --git a/src/mame/includes/deniam.h b/src/mame/includes/deniam.h
index fb23dbb5dad..6dad11d6d78 100644
--- a/src/mame/includes/deniam.h
+++ b/src/mame/includes/deniam.h
@@ -3,7 +3,7 @@
Deniam games
*************************************************************************/
-
+#include "sound/okim6295.h"
class deniam_state : public driver_device
{
@@ -15,7 +15,8 @@ public:
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_videoram;
@@ -69,4 +70,5 @@ public:
DECLARE_WRITE_LINE_MEMBER(irqhandler);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu; // system 16c does not have sound CPU
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/funybubl.h b/src/mame/includes/funybubl.h
index 1eccc0b818b..27a626947c8 100644
--- a/src/mame/includes/funybubl.h
+++ b/src/mame/includes/funybubl.h
@@ -1,4 +1,4 @@
-
+#include "sound/okim6295.h"
class funybubl_state : public driver_device
{
@@ -7,7 +7,8 @@ public:
: driver_device(mconfig, type, tag),
m_paletteram(*this, "paletteram"),
m_audiocpu(*this, "audiocpu"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT8> m_paletteram;
@@ -27,4 +28,5 @@ public:
UINT32 screen_update_funybubl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/fuukifg2.h b/src/mame/includes/fuukifg2.h
index cdf7355fe16..15023c07b81 100644
--- a/src/mame/includes/fuukifg2.h
+++ b/src/mame/includes/fuukifg2.h
@@ -1,4 +1,4 @@
-
+#include "sound/okim6295.h"
class fuuki16_state : public driver_device
{
@@ -11,7 +11,8 @@ public:
m_unknown(*this, "unknown"),
m_priority(*this, "priority"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"){ }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki"){ }
/* memory pointers */
required_shared_ptr_array<UINT16,4> m_vram;
@@ -54,4 +55,5 @@ public:
void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
void fuuki16_draw_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri );
DECLARE_WRITE_LINE_MEMBER(soundirq);
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/gotcha.h b/src/mame/includes/gotcha.h
index fe7d645ca1b..9bef59cec55 100644
--- a/src/mame/includes/gotcha.h
+++ b/src/mame/includes/gotcha.h
@@ -3,7 +3,7 @@
Gotcha
*************************************************************************/
-
+#include "sound/okim6295.h"
#include "video/decospr.h"
class gotcha_state : public driver_device
@@ -16,7 +16,8 @@ public:
m_spriteram(*this, "spriteram"),
m_sprgen(*this, "spritegen"),
m_audiocpu(*this, "audiocpu"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_fgvideoram;
@@ -50,4 +51,5 @@ public:
UINT32 screen_update_gotcha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs);
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/kaneko16.h b/src/mame/includes/kaneko16.h
index 0162ab6bd12..55947d7fc03 100644
--- a/src/mame/includes/kaneko16.h
+++ b/src/mame/includes/kaneko16.h
@@ -12,7 +12,7 @@
#include "video/kaneko_spr.h"
#include "machine/kaneko_calc3.h"
#include "machine/kaneko_toybox.h"
-
+#include "sound/okim6295.h"
@@ -27,7 +27,8 @@ public:
m_view2_0(*this, "view2_0"),
m_view2_1(*this, "view2_1"),
m_kaneko_spr(*this, "kan_spr"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
required_device<cpu_device> m_maincpu;
optional_shared_ptr<UINT16> m_spriteram;
@@ -72,6 +73,7 @@ public:
void kaneko16_unscramble_tiles(const char *region);
void kaneko16_expand_sample_banks(const char *region);
optional_device<cpu_device> m_audiocpu;
+ optional_device<okim6295_device> m_oki;
};
class kaneko16_gtmr_state : public kaneko16_state
diff --git a/src/mame/includes/kickgoal.h b/src/mame/includes/kickgoal.h
index 97742b127e4..8939e9b4f57 100644
--- a/src/mame/includes/kickgoal.h
+++ b/src/mame/includes/kickgoal.h
@@ -19,7 +19,8 @@ public:
m_spriteram(*this, "spriteram"),
m_adpcm(*this, "oki"),
m_eeprom(*this, "eeprom") ,
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
required_shared_ptr<UINT16> m_fgram;
@@ -80,4 +81,5 @@ public:
void kickgoal_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void kickgoal_play(okim6295_device *oki, int melody, int data);
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/legionna.h b/src/mame/includes/legionna.h
index ff5f9394a22..6d0c54e41fb 100644
--- a/src/mame/includes/legionna.h
+++ b/src/mame/includes/legionna.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class legionna_state : public driver_device
{
public:
@@ -9,7 +11,8 @@ public:
m_mid_data(*this, "mid_data"),
m_textram(*this, "textram"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
required_shared_ptr<UINT16> m_spriteram;
required_shared_ptr<UINT16> m_back_data;
@@ -58,6 +61,7 @@ public:
void descramble_legionnaire_gfx(UINT8* src);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
};
/*----------- defined in video/legionna.c -----------*/
diff --git a/src/mame/includes/lordgun.h b/src/mame/includes/lordgun.h
index 178f81ccd89..51db4ffeeea 100644
--- a/src/mame/includes/lordgun.h
+++ b/src/mame/includes/lordgun.h
@@ -3,6 +3,7 @@
-= IGS Lord Of Gun =-
*************************************************************************/
+#include "sound/okim6295.h"
struct lordgun_gun_data
{
@@ -22,7 +23,8 @@ public:
m_scroll_x(*this, "scroll_x"),
m_scroll_y(*this, "scroll_y") ,
m_maincpu(*this, "maincpu"),
- m_soundcpu(*this, "soundcpu") { }
+ m_soundcpu(*this, "soundcpu"),
+ m_oki(*this, "oki") { }
required_shared_ptr<UINT16> m_priority_ram;
required_shared_ptr<UINT16> m_scrollram;
@@ -78,6 +80,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(soundirq);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
+ required_device<okim6295_device> m_oki;
};
/*----------- defined in video/lordgun.c -----------*/
diff --git a/src/mame/includes/m92.h b/src/mame/includes/m92.h
index 6d76d46ef1f..f85d801ae0c 100644
--- a/src/mame/includes/m92.h
+++ b/src/mame/includes/m92.h
@@ -5,6 +5,7 @@
*************************************************************************/
#include "video/bufsprite.h"
+#include "sound/okim6295.h"
struct pf_layer_info
{
@@ -23,7 +24,8 @@ public:
m_vram_data(*this, "vram_data"),
m_spritecontrol(*this, "spritecontrol"),
m_maincpu(*this, "maincpu"),
- m_soundcpu(*this, "soundcpu")
+ m_soundcpu(*this, "soundcpu"),
+ m_oki(*this, "oki")
{ }
required_device<buffered_spriteram16_device> m_spriteram;
@@ -84,6 +86,7 @@ public:
void m92_update_scroll_positions();
void m92_draw_tiles(bitmap_ind16 &bitmap,const rectangle &cliprect);
void m92_sprite_interrupt();
+ optional_device<okim6295_device> m_oki;
};
/*----------- defined in drivers/m92.c -----------*/
diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h
index b7d67d8805d..7e3979f88ed 100644
--- a/src/mame/includes/midyunit.h
+++ b/src/mame/includes/midyunit.h
@@ -7,6 +7,7 @@
#include "cpu/tms34010/tms34010.h"
#include "audio/williams.h"
#include "machine/nvram.h"
+#include "sound/okim6295.h"
/* protection data types */
struct protection_data
@@ -38,7 +39,8 @@ public:
m_adpcm_sound(*this, "adpcm"),
m_gfx_rom(*this, "gfx_rom", 16) ,
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
optional_device<williams_narc_sound_device> m_narc_sound;
optional_device<williams_cvsd_sound_device> m_cvsd_sound;
@@ -113,6 +115,7 @@ public:
TIMER_CALLBACK_MEMBER(autoerase_line);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
+ optional_device<okim6295_device> m_oki;
};
/*----------- defined in video/midyunit.c -----------*/
void midyunit_to_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg);
diff --git a/src/mame/includes/moo.h b/src/mame/includes/moo.h
index c7aafdc5013..4aecaa978da 100644
--- a/src/mame/includes/moo.h
+++ b/src/mame/includes/moo.h
@@ -3,6 +3,7 @@
Wild West C.O.W.boys of Moo Mesa / Bucky O'Hare
*************************************************************************/
+#include "sound/okim6295.h"
class moo_state : public driver_device
{
@@ -12,7 +13,8 @@ public:
m_workram(*this, "workram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
- m_soundcpu(*this, "soundcpu"){ }
+ m_soundcpu(*this, "soundcpu"),
+ m_oki(*this, "oki"){ }
/* memory pointers */
optional_shared_ptr<UINT16> m_workram;
@@ -33,6 +35,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_soundcpu;
+ optional_device<okim6295_device> m_oki;
device_t *m_k054539;
device_t *m_k053246;
device_t *m_k053251;
diff --git a/src/mame/includes/oneshot.h b/src/mame/includes/oneshot.h
index 42271c36680..ec9562e3ea4 100644
--- a/src/mame/includes/oneshot.h
+++ b/src/mame/includes/oneshot.h
@@ -1,3 +1,4 @@
+#include "sound/okim6295.h"
class oneshot_state : public driver_device
{
@@ -10,7 +11,8 @@ public:
m_fg_videoram(*this, "fg_videoram"),
m_scroll(*this, "scroll"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"){ }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki"){ }
/* memory pointers */
required_shared_ptr<UINT16> m_sprites;
@@ -56,4 +58,5 @@ public:
void draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
DECLARE_WRITE_LINE_MEMBER(irqhandler);
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/othldrby.h b/src/mame/includes/othldrby.h
index 8985a584b70..d72a330b881 100644
--- a/src/mame/includes/othldrby.h
+++ b/src/mame/includes/othldrby.h
@@ -3,6 +3,7 @@
Othello Derby
*************************************************************************/
+#include "sound/okim6295.h"
#define OTHLDRBY_VREG_SIZE 18
@@ -11,7 +12,8 @@ class othldrby_state : public driver_device
public:
othldrby_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) ,
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
/* memory pointers */
UINT16 * m_vram;
@@ -47,4 +49,5 @@ public:
inline void get_tile_info( tile_data &tileinfo, int tile_index, int plane );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/rampart.h b/src/mame/includes/rampart.h
index 8a98899a3cc..35b78d0ba1d 100644
--- a/src/mame/includes/rampart.h
+++ b/src/mame/includes/rampart.h
@@ -5,13 +5,15 @@
*************************************************************************/
#include "machine/atarigen.h"
+#include "sound/okim6295.h"
class rampart_state : public atarigen_state
{
public:
rampart_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag),
- m_bitmap(*this, "bitmap") { }
+ m_bitmap(*this, "bitmap"),
+ m_oki(*this, "oki") { }
required_shared_ptr<UINT16> m_bitmap;
UINT8 m_has_mo;
@@ -24,4 +26,5 @@ public:
DECLARE_VIDEO_START(rampart);
UINT32 screen_update_rampart(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/seta2.h b/src/mame/includes/seta2.h
index 964591c2e59..778e5c9144e 100644
--- a/src/mame/includes/seta2.h
+++ b/src/mame/includes/seta2.h
@@ -1,3 +1,5 @@
+#include "sound/okim9810.h"
+
class seta2_state : public driver_device
{
public:
@@ -9,7 +11,8 @@ public:
m_vregs(*this, "vregs", 0),
m_coldfire_regs(*this, "coldfire_regs"),
m_funcube_outputs(*this, "funcube_outputs"),
- m_funcube_leds(*this, "funcube_leds"){ }
+ m_funcube_leds(*this, "funcube_leds"),
+ m_oki(*this, "oki"){ }
required_device<cpu_device> m_maincpu;
optional_shared_ptr<UINT16> m_nvram;
@@ -77,4 +80,5 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(funcube_interrupt);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void funcube_debug_outputs();
+ optional_device<okim9810_device> m_oki;
};
diff --git a/src/mame/includes/shadfrce.h b/src/mame/includes/shadfrce.h
index a06fce2f193..b9989a98650 100644
--- a/src/mame/includes/shadfrce.h
+++ b/src/mame/includes/shadfrce.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class shadfrce_state : public driver_device
{
public:
@@ -8,7 +10,8 @@ public:
m_bg1videoram(*this, "bg1videoram"),
m_spvideoram(*this, "spvideoram"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
tilemap_t *m_fgtilemap;
tilemap_t *m_bg0tilemap;
@@ -50,4 +53,5 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/snowbros.h b/src/mame/includes/snowbros.h
index 56865f48776..b4c4e19e034 100644
--- a/src/mame/includes/snowbros.h
+++ b/src/mame/includes/snowbros.h
@@ -9,7 +9,8 @@ public:
m_hyperpac_ram(*this, "hyperpac_ram"),
m_bootleg_spriteram16(*this, "spriteram16b"),
m_maincpu(*this,"maincpu"),
- m_soundcpu(*this, "soundcpu"){ }
+ m_soundcpu(*this, "soundcpu"),
+ m_oki(*this, "oki"){ }
optional_shared_ptr<UINT16> m_hyperpac_ram;
int m_sb3_music_is_playing;
@@ -57,4 +58,5 @@ public:
void sb3_play_sound (okim6295_device *oki, int data);
DECLARE_WRITE_LINE_MEMBER(irqhandler);
optional_device<cpu_device> m_soundcpu;
+ optional_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/speedspn.h b/src/mame/includes/speedspn.h
index d1e0a649581..95fd99139b5 100644
--- a/src/mame/includes/speedspn.h
+++ b/src/mame/includes/speedspn.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class speedspn_state : public driver_device
{
public:
@@ -5,7 +7,8 @@ public:
: driver_device(mconfig, type, tag),
m_attram(*this, "attram"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
required_shared_ptr<UINT8> m_attram;
tilemap_t *m_tilemap;
@@ -27,4 +30,5 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/sslam.h b/src/mame/includes/sslam.h
index f331f745296..112e68eaa9a 100644
--- a/src/mame/includes/sslam.h
+++ b/src/mame/includes/sslam.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class sslam_state : public driver_device
{
public:
@@ -9,7 +11,8 @@ public:
m_regs(*this, "regs"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
emu_timer *m_music_timer;
@@ -58,4 +61,5 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/stlforce.h b/src/mame/includes/stlforce.h
index b50e4a1c1ef..75768b21728 100644
--- a/src/mame/includes/stlforce.h
+++ b/src/mame/includes/stlforce.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class stlforce_state : public driver_device
{
public:
@@ -12,7 +14,8 @@ public:
m_mhigh_scrollram(*this, "mhigh_scrollram"),
m_vidattrram(*this, "vidattrram"),
m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
tilemap_t *m_bg_tilemap;
tilemap_t *m_mlow_tilemap;
@@ -47,4 +50,5 @@ public:
UINT32 screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h
index 73ee5da2f16..326cf492340 100644
--- a/src/mame/includes/tatsumi.h
+++ b/src/mame/includes/tatsumi.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class tatsumi_state : public driver_device
{
public:
@@ -23,7 +25,8 @@ public:
m_spriteram(*this, "spriteram") ,
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
- m_subcpu(*this, "sub") { }
+ m_subcpu(*this, "sub"),
+ m_oki(*this, "oki") { }
optional_shared_ptr<UINT16> m_videoram;
optional_shared_ptr<UINT16> m_cyclwarr_cpua_ram;
@@ -133,6 +136,7 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_subcpu;
+ required_device<okim6295_device> m_oki;
};
/*----------- defined in machine/tatsumi.c -----------*/
diff --git a/src/mame/includes/toaplan2.h b/src/mame/includes/toaplan2.h
index 42833baaf4b..b878866f8e0 100644
--- a/src/mame/includes/toaplan2.h
+++ b/src/mame/includes/toaplan2.h
@@ -7,7 +7,7 @@
// VDP related
#include "video/gp9001.h"
-
+#include "sound/okim6295.h"
// Cache the CPUs and VDPs for faster access
class toaplan2_state : public driver_device
{
@@ -22,7 +22,8 @@ public:
m_tx_gfxram16(*this, "tx_gfxram16"),
m_mainram16(*this, "mainram16"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") {
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") {
m_vdp0 = NULL;
m_vdp1 = NULL;
}
@@ -141,4 +142,5 @@ public:
DECLARE_WRITE_LINE_MEMBER(bbakraid_irqhandler);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
+ optional_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/tumbleb.h b/src/mame/includes/tumbleb.h
index 44551ae3bd2..5e98bdb10c9 100644
--- a/src/mame/includes/tumbleb.h
+++ b/src/mame/includes/tumbleb.h
@@ -14,7 +14,8 @@ public:
m_control(*this, "control"),
m_sprgen(*this, "spritegen"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu")
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki")
{ }
/* memory pointers */
@@ -43,7 +44,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
- device_t *m_oki;
+ required_device<okim6295_device> m_oki;
UINT8 m_semicom_prot_offset;
UINT16 m_protbase;
DECLARE_WRITE16_MEMBER(tumblepb_oki_w);
diff --git a/src/mame/includes/unico.h b/src/mame/includes/unico.h
index a2080c0ccea..1c896159766 100644
--- a/src/mame/includes/unico.h
+++ b/src/mame/includes/unico.h
@@ -1,3 +1,5 @@
+#include "sound/okim6295.h"
+
class unico_state : public driver_device
{
public:
@@ -8,7 +10,8 @@ public:
m_vram32(*this, "vram32"),
m_scroll32(*this, "scroll32"),
m_spriteram(*this, "spriteram", 0),
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu"),
+ m_oki(*this, "oki") { }
optional_shared_ptr<UINT16> m_vram;
optional_shared_ptr<UINT16> m_scroll;
@@ -46,4 +49,5 @@ public:
void unico_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void zeropnt2_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
+ optional_device<okim6295_device> m_oki;
};
diff --git a/src/mame/includes/wwfwfest.h b/src/mame/includes/wwfwfest.h
index 6119db00368..854a3f9718c 100644
--- a/src/mame/includes/wwfwfest.h
+++ b/src/mame/includes/wwfwfest.h
@@ -1,4 +1,5 @@
#include "video/bufsprite.h"
+#include "sound/okim6295.h"
class wwfwfest_state : public driver_device
{
@@ -10,7 +11,8 @@ public:
m_bg1_videoram(*this, "bg1_videoram"),
m_spriteram(*this, "spriteram") ,
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki") { }
required_shared_ptr<UINT16> m_fg0_videoram;
required_shared_ptr<UINT16> m_bg0_videoram;
@@ -50,4 +52,5 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
};
diff --git a/src/mame/machine/tatsumi.c b/src/mame/machine/tatsumi.c
index 2531e8f384a..fc25c170a44 100644
--- a/src/mame/machine/tatsumi.c
+++ b/src/mame/machine/tatsumi.c
@@ -350,7 +350,7 @@ READ8_MEMBER(tatsumi_state::tatsumi_hack_ym2151_r)
// Mame really should emulate the OKI status reads even with Mame sound off.
READ8_MEMBER(tatsumi_state::tatsumi_hack_oki_r)
{
- int r=downcast<okim6295_device *>(machine().device("oki"))->read(space,0);
+ int r=m_oki->read(space,0);
if (space.device().safe_pc()==0x2b70 || space.device().safe_pc()==0x2bb5
|| space.device().safe_pc()==0x2acc