74157 updates, pinball division (nw) (#1841)

* 74157 updates, pinball division (nw)
- Add 74HCT157 device type alias
- Hook up 74HCT157 in inder.cpp and spinb.cpp as per schematics
- Change device and macro names

* Stylistic cleanups; avert potential crash in some drivers (nw)

* This doesn't seem quite right by the schematics, but gives better sound (nw)
This commit is contained in:
ajrhacker 2016-12-17 03:24:19 -05:00 committed by Ivan Vangelista
parent afbe64660d
commit 1f7a903fc3
9 changed files with 98 additions and 39 deletions

View File

@ -3,7 +3,7 @@
/***************************************************************************
74LS157 Quad 2-Line to 1-Line Data Selectors/Multiplexers (TTL)
74LS157/74HCT157 Quad 2 to 1-Line Data Selectors/Multiplexers (TTL)
Often used to help feed 8-bit ROM data into a MSM5205, and for many
other purposes.
@ -27,7 +27,12 @@ const device_type LS157 = &device_creator<ls157_device>;
//-------------------------------------------------
ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, LS157, "74LS157 Data Selectors/Multiplexers", tag, owner, clock, "74ls157", __FILE__)
: ls157_device(mconfig, LS157, "74LS157 Quad 2-to-1 Multiplexer", tag, owner, clock, "74ls157", __FILE__)
{
}
ls157_device::ls157_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
, m_out_cb(*this)
{
m_a = 0;
@ -200,3 +205,15 @@ void ls157_device::update_output()
if (!m_strobe)
m_out_cb(m_select ? m_b : m_a);
}
//**************************************************************************
// 74HCT157 DEVICE
//**************************************************************************
const device_type HCT157 = &device_creator<hct157_device>;
hct157_device::hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ls157_device(mconfig, HCT157, "74HCT157 Quad 2-to-1 Multiplexer", tag, owner, clock, "74hct157", __FILE__)
{
}

View File

@ -30,7 +30,7 @@
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_74LS157_OUT_CB(_devcb) \
#define MCFG_74157_OUT_CB(_devcb) \
devcb = &ls157_device::set_out_callback(*device, DEVCB_##_devcb);
@ -44,7 +44,8 @@ class ls157_device : public device_t
{
public:
// construction/destruction
ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
ls157_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source);
// static configuration
template<class _Object> static devcb_base &set_out_callback(device_t &device, _Object object) { return downcast<ls157_device &>(device).m_out_cb.set_callback(object); }
@ -83,6 +84,13 @@ private:
bool m_strobe;
};
class hct157_device : public ls157_device
{
public:
// construction/destruction
hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
//**************************************************************************
// GLOBAL VARIABLES
@ -90,6 +98,7 @@ private:
// device type definition
extern const device_type LS157;
extern const device_type HCT157;
#endif

View File

@ -1476,10 +1476,10 @@ static MACHINE_CONFIG_START( automat, dec0_automat_state )
MCFG_SOUND_ROUTE(3, "mono", 0.35)
MCFG_DEVICE_ADD("adpcm_select1", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w))
MCFG_DEVICE_ADD("adpcm_select2", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm2", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm2", msm5205_device, data_w))
MCFG_SOUND_ADD("msm1", MSM5205, 384000)
MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, msm1_vclk_cb))
@ -1547,10 +1547,10 @@ static MACHINE_CONFIG_START( secretab, dec0_automat_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MCFG_DEVICE_ADD("adpcm_select1", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w))
MCFG_DEVICE_ADD("adpcm_select2", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm2", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm2", msm5205_device, data_w))
MCFG_SOUND_ADD("msm1", MSM5205, 384000)
MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, msm1_vclk_cb))

View File

@ -518,7 +518,7 @@ static MACHINE_CONFIG_START( discoboy, discoboy_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.6)
MCFG_DEVICE_ADD("adpcm_select", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz)
MCFG_MSM5205_VCLK_CB(WRITELINE(discoboy_state, yunsung8_adpcm_int)) /* interrupt function */

View File

@ -35,6 +35,7 @@
#include "sound/ay8910.h"
#include "sound/msm5205.h"
#include "machine/7474.h"
#include "machine/74157.h"
#include "inder.lh"
class inder_state : public genpin_class
@ -49,6 +50,7 @@ public:
, m_7a(*this, "7a")
, m_9a(*this, "9a")
, m_9b(*this, "9b")
, m_13(*this, "13")
, m_switches(*this, "SW.%u", 0)
{ }
@ -77,6 +79,7 @@ public:
DECLARE_DRIVER_INIT(inder);
DECLARE_DRIVER_INIT(inder1);
private:
void update_mus();
bool m_pc0;
uint8_t m_game;
uint8_t m_portc;
@ -94,6 +97,7 @@ private:
optional_device<ttl7474_device> m_7a;
optional_device<ttl7474_device> m_9a;
optional_device<ttl7474_device> m_9b;
optional_device<hct157_device> m_13;
required_ioport_array<11> m_switches;
};
@ -1232,6 +1236,15 @@ WRITE8_MEMBER( inder_state::sndbank_w )
for (i = 0; i < 4; i++)
if (!(BIT(data, i)))
m_sound_addr = (m_sound_addr & 0x0ffff) | (i << 16);
update_mus();
}
void inder_state::update_mus()
{
if ((m_sound_addr < 0x40000) && (m_sndbank != 0xff))
m_13->ab_w(m_p_speech[m_sound_addr]);
else
m_13->ab_w(0);
}
WRITE_LINE_MEMBER( inder_state::vck_w )
@ -1240,16 +1253,6 @@ WRITE_LINE_MEMBER( inder_state::vck_w )
m_9b->clock_w(0);
m_9a->clock_w(1);
m_9b->clock_w(1);
if ((m_sound_addr < 0x40000) && (m_sndbank != 0xff))
{
if (!m_pc0)
m_msm->data_w(m_p_speech[m_sound_addr] & 15);
else
m_msm->data_w(m_p_speech[m_sound_addr] >> 4);
}
else
m_msm->data_w(0);
}
WRITE_LINE_MEMBER( inder_state::qc7a_w )
@ -1268,6 +1271,7 @@ WRITE_LINE_MEMBER( inder_state::qc9b_w )
{
m_9a->d_w(state);
m_9b->d_w(state);
m_13->select_w(state);
}
READ8_MEMBER( inder_state::ppic_r )
@ -1278,11 +1282,13 @@ READ8_MEMBER( inder_state::ppic_r )
WRITE8_MEMBER( inder_state::ppia_w )
{
m_sound_addr = (m_sound_addr & 0x3ff00) | data;
update_mus();
}
WRITE8_MEMBER( inder_state::ppib_w )
{
m_sound_addr = (m_sound_addr & 0x300ff) | (data << 8);
update_mus();
}
WRITE8_MEMBER( inder_state::ppic_w )
@ -1302,14 +1308,17 @@ void inder_state::machine_reset()
m_sound_addr = 0;
m_sndbank = 0xff;
m_row = 0;
if (m_7a)
if (m_7a.found())
{
m_7a->clear_w(1);
update_mus();
}
}
DRIVER_INIT_MEMBER( inder_state, inder )
{
m_p_speech = memregion("speech")->base();
if (m_7a)
if (m_7a.found())
{
m_7a->d_w(0);
m_7a->clear_w(0);
@ -1321,7 +1330,7 @@ DRIVER_INIT_MEMBER( inder_state, inder )
DRIVER_INIT_MEMBER( inder_state, inder1 )
{
m_p_speech = memregion("speech")->base();
if (m_7a)
if (m_7a.found())
{
m_7a->d_w(0);
m_7a->clear_w(0);
@ -1461,6 +1470,9 @@ static MACHINE_CONFIG_START( inder, inder_state )
MCFG_DEVICE_ADD("9b", TTL7474, 0)
MCFG_7474_COMP_OUTPUT_CB(WRITELINE(inder_state, qc9b_w))
MCFG_DEVICE_ADD("13", HCT157, 0)
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MACHINE_CONFIG_END

View File

@ -1299,7 +1299,7 @@ static MACHINE_CONFIG_DERIVED( spangbl, pangnv )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("adpcm_select", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( pangba, spangbl )

View File

@ -407,7 +407,7 @@ static MACHINE_CONFIG_START( rastan, rastan_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MCFG_DEVICE_ADD("adpcm_sel", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_DEVICE_ADD("tc0140syt", TC0140SYT, 0)
MCFG_TC0140SYT_MASTER_CPU("maincpu")

View File

@ -36,6 +36,7 @@ ToDo:
#include "machine/i8255.h"
#include "sound/msm5205.h"
#include "machine/7474.h"
#include "machine/74157.h"
class spinb_state : public genpin_class
{
@ -50,6 +51,8 @@ public:
, m_msm_m(*this, "msm_m")
, m_ic5a(*this, "ic5a")
, m_ic5m(*this, "ic5m")
, m_ic14a(*this, "ic14a")
, m_ic14m(*this, "ic14m")
, m_switches(*this, "SW.%u", 0)
{ }
@ -110,6 +113,8 @@ private:
uint8_t *m_p_dmdcpu;
virtual void machine_reset() override;
virtual void machine_start() override;
void update_sound_a();
void update_sound_m();
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_musiccpu;
@ -118,6 +123,8 @@ private:
required_device<msm5205_device> m_msm_m;
required_device<ttl7474_device> m_ic5a;
required_device<ttl7474_device> m_ic5m;
required_device<hct157_device> m_ic14a;
required_device<hct157_device> m_ic14m;
required_ioport_array<11> m_switches;
};
@ -407,6 +414,8 @@ WRITE8_MEMBER( spinb_state::sndbank_a_w )
m_sound_addr_a |= (2<<19);
else if (BIT(data, 7))
m_sndbank_a = 0xff;
update_sound_a();
}
WRITE8_MEMBER( spinb_state::sndbank_m_w )
@ -420,50 +429,50 @@ WRITE8_MEMBER( spinb_state::sndbank_m_w )
m_sound_addr_m |= (2<<19);
else if (BIT(data, 7))
m_sndbank_m = 0xff;
update_sound_m();
}
WRITE_LINE_MEMBER( spinb_state::vck_a_w )
{
m_ic5a->clock_w(0);
m_ic5a->clock_w(1);
}
void spinb_state::update_sound_a()
{
if (m_sndbank_a != 0xff)
{
if (!m_pc0a)
m_msm_a->data_w(m_p_audio[m_sound_addr_a] & 15);
else
m_msm_a->data_w(m_p_audio[m_sound_addr_a] >> 4);
}
m_ic14a->ab_w(m_p_audio[m_sound_addr_a]);
else
m_msm_a->data_w(0);
m_ic14a->ab_w(0);
}
WRITE_LINE_MEMBER( spinb_state::vck_m_w )
{
m_ic5m->clock_w(0);
m_ic5m->clock_w(1);
}
void spinb_state::update_sound_m()
{
if (m_sndbank_m != 0xff)
{
if (!m_pc0m)
m_msm_m->data_w(m_p_music[m_sound_addr_m] & 15);
else
m_msm_m->data_w(m_p_music[m_sound_addr_m] >> 4);
}
m_ic14m->ab_w(m_p_music[m_sound_addr_m]);
else
m_msm_m->data_w(0);
m_ic14m->ab_w(0);
}
WRITE_LINE_MEMBER( spinb_state::ic5a_w )
{
m_pc0a = state;
m_ic5a->d_w(state);
m_ic14a->select_w(state);
}
WRITE_LINE_MEMBER( spinb_state::ic5m_w )
{
m_pc0m = state;
m_ic5m->d_w(state);
m_ic14m->select_w(state);
}
READ8_MEMBER( spinb_state::ppia_c_r )
@ -479,21 +488,25 @@ READ8_MEMBER( spinb_state::ppim_c_r )
WRITE8_MEMBER( spinb_state::ppia_b_w )
{
m_sound_addr_a = (m_sound_addr_a & 0xffff00) | data;
update_sound_a();
}
WRITE8_MEMBER( spinb_state::ppim_b_w )
{
m_sound_addr_m = (m_sound_addr_m & 0xffff00) | data;
update_sound_m();
}
WRITE8_MEMBER( spinb_state::ppia_a_w )
{
m_sound_addr_a = (m_sound_addr_a & 0xff00ff) | (data << 8);
update_sound_a();
}
WRITE8_MEMBER( spinb_state::ppim_a_w )
{
m_sound_addr_m = (m_sound_addr_m & 0xff00ff) | (data << 8);
update_sound_m();
}
WRITE8_MEMBER( spinb_state::ppia_c_w )
@ -523,6 +536,8 @@ void spinb_state::machine_reset()
m_sndbank_a = 0xff;
m_sndbank_m = 0xff;
m_row = 0;
update_sound_a();
update_sound_m();
}
void spinb_state::machine_start()
@ -703,8 +718,14 @@ static MACHINE_CONFIG_START( spinb, spinb_state )
MCFG_DEVICE_ADD("ic5a", TTL7474, 0)
MCFG_7474_COMP_OUTPUT_CB(WRITELINE(spinb_state, ic5a_w))
MCFG_DEVICE_ADD("ic14a", HCT157, 0)
MCFG_74157_OUT_CB(DEVWRITE8("msm_a", msm5205_device, data_w))
MCFG_DEVICE_ADD("ic5m", TTL7474, 0)
MCFG_7474_COMP_OUTPUT_CB(WRITELINE(spinb_state, ic5m_w))
MCFG_DEVICE_ADD("ic14m", HCT157, 0)
MCFG_74157_OUT_CB(DEVWRITE8("msm_m", msm5205_device, data_w))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( vrnwrld, spinb )

View File

@ -377,7 +377,7 @@ static MACHINE_CONFIG_START( yunsung8, yunsung8_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
MCFG_DEVICE_ADD("adpcm_select", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_74157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w))
MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb */
MCFG_MSM5205_VCLK_CB(WRITELINE(yunsung8_state, adpcm_int)) /* interrupt function */