spyhunt: 4099 for lamps (nw)

This commit is contained in:
AJR 2017-12-04 16:35:19 -05:00
parent d57860efc2
commit 4081eac990
2 changed files with 35 additions and 8 deletions

View File

@ -415,25 +415,21 @@ WRITE8_MEMBER(mcr3_state::spyhunt_op4_w)
/*
Lamp Driver:
A 3-to-8 latching demuxer is connected to the input bits.
A 3-to-8 latching demuxer (MC14099) is connected to the input bits.
Three of the inputs (J1-11,10,12) specify which output to write
to, and the fourth input (J1-14) is the data value. A fifth input
(J1-13) controls the strobe to latch the data value for the
demuxer. The eight outputs directly control 8 lamps.
demuxer. The eight outputs control 8 lamps through a pair of
Darlington drivers (ULN2068B).
*/
/* bit 5 = STR1 (J1-13) */
if (((m_last_op4 ^ data) & 0x20) && !(data & 0x20))
{
static const char *const lampname[8] =
{
"lamp0", "lamp1", "lamp2", "lamp3",
"lamp4", "lamp5", "lamp6", "lamp7"
};
/* bit 3 -> J1-14 (DATA) */
/* bit 2 -> J1-11 (A2) */
/* bit 1 -> J1-10 (A1) */
/* bit 0 -> J1-12 (A0) */
output().set_value(lampname[data & 7], (data >> 3) & 1);
m_lamplatch->write_bit(data & 7, BIT(data, 3));
}
m_last_op4 = data;
@ -443,6 +439,16 @@ WRITE8_MEMBER(mcr3_state::spyhunt_op4_w)
}
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp0_w) { output().set_value("lamp0", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp1_w) { output().set_value("lamp1", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp2_w) { output().set_value("lamp2", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp3_w) { output().set_value("lamp3", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp4_w) { output().set_value("lamp4", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp5_w) { output().set_value("lamp5", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp6_w) { output().set_value("lamp6", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp7_w) { output().set_value("lamp7", state); }
/*************************************
*
@ -1189,6 +1195,16 @@ static MACHINE_CONFIG_DERIVED( mcrsc_csd, mcrscroll )
MCFG_SOUND_ADD("csd", MIDWAY_CHEAP_SQUEAK_DELUXE, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
MCFG_DEVICE_ADD("lamplatch", CD4099, 0) // U1 on Lamp Driver Board
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp0_w))
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp1_w))
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp2_w))
MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp3_w))
MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp4_w))
MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp5_w))
MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp6_w))
MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp7_w))
MACHINE_CONFIG_END

View File

@ -6,6 +6,7 @@
**************************************************************************/
#include "machine/74259.h"
#include "machine/adc0844.h"
#include "screen.h"
@ -16,11 +17,13 @@ public:
: mcr_state(mconfig, type, tag),
m_spyhunt_alpharam(*this, "spyhunt_alpha"),
m_maxrpm_adc(*this, "adc"),
m_lamplatch(*this, "lamplatch"),
m_screen(*this, "screen")
{ }
optional_shared_ptr<uint8_t> m_spyhunt_alpharam;
optional_device<adc0844_device> m_maxrpm_adc;
optional_device<cd4099_device> m_lamplatch;
required_device<screen_device> m_screen;
uint8_t m_input_mux;
@ -60,6 +63,14 @@ public:
DECLARE_READ8_MEMBER(spyhunt_ip1_r);
DECLARE_READ8_MEMBER(spyhunt_ip2_r);
DECLARE_WRITE8_MEMBER(spyhunt_op4_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp0_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp1_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp2_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp3_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp4_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp5_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp6_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp7_w);
DECLARE_READ8_MEMBER(turbotag_ip2_r);
DECLARE_READ8_MEMBER(turbotag_kludge_r);
DECLARE_DRIVER_INIT(crater);