devices/machine/74157.cpp : Simplify handlers, Fix naming

dec0.cpp : Reduce duplicate
This commit is contained in:
cam900 2019-03-22 20:33:05 +09:00
parent 464750e988
commit 9172f07969
11 changed files with 29 additions and 35 deletions

View File

@ -35,7 +35,7 @@ DEFINE_DEVICE_TYPE(LS157_X2, ls157_x2_device, "ls157_x2", "74LS157 Quad 2-to-1 M
// ls157_device - constructor
//-------------------------------------------------
ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
ls157_device::ls157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ls157_device(mconfig, LS157, tag, owner, clock, 0x0f)
{
}
@ -58,7 +58,7 @@ ls157_device::ls157_device(const machine_config &mconfig, device_type type, cons
// ls157_x2_device - constructor
//-------------------------------------------------
ls157_x2_device::ls157_x2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
ls157_x2_device::ls157_x2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ls157_device(mconfig, LS157_X2, tag, owner, clock, 0xff)
{
}
@ -92,7 +92,7 @@ void ls157_device::device_start()
// a_w -- write nibble to A1-A4
//-------------------------------------------------
void ls157_device::write_a(u8 data)
void ls157_device::a_w(u8 data)
{
m_a = data & m_data_mask;
update_output();
@ -103,7 +103,7 @@ void ls157_device::write_a(u8 data)
// b_w -- write nibble to B1-B4
//-------------------------------------------------
void ls157_device::write_b(u8 data)
void ls157_device::b_w(u8 data)
{
m_b = data & m_data_mask;
update_output();
@ -115,7 +115,7 @@ void ls157_device::write_b(u8 data)
// low nibble to B1-B4
//-------------------------------------------------
void ls157_device::write_ab(u8 data)
void ls157_device::ab_w(u8 data)
{
assert(m_data_mask == 0x0f);
m_a = data >> 4;
@ -129,7 +129,7 @@ void ls157_device::write_ab(u8 data)
// low nibble to A1-A4
//-------------------------------------------------
void ls157_device::write_ba(u8 data)
void ls157_device::ba_w(u8 data)
{
assert(m_data_mask == 0x0f);
m_b = data >> 4;
@ -143,7 +143,7 @@ void ls157_device::write_ba(u8 data)
// A1-A4 and write odd-numbered bits to B1-B4
//-------------------------------------------------
void ls157_device::write_interleave(u8 data)
void ls157_device::interleave_w(u8 data)
{
assert(m_data_mask == 0x0f);
m_b = bitswap<4>(data, 7, 5, 3, 1);
@ -260,7 +260,7 @@ void ls157_device::update_output()
// DATA OUTPUTS
//**************************************************************************
READ8_MEMBER(ls157_device::output_r)
u8 ls157_device::output_r()
{
if (m_strobe)
return 0;
@ -277,7 +277,7 @@ READ8_MEMBER(ls157_device::output_r)
DEFINE_DEVICE_TYPE(HC157, hc157_device, "hc157", "74HC157 Quad 2-to-1 Multiplexer")
hc157_device::hc157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
hc157_device::hc157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ls157_device(mconfig, HC157, tag, owner, clock, 0x0f)
{
}
@ -289,7 +289,7 @@ hc157_device::hc157_device(const machine_config &mconfig, const char *tag, devic
DEFINE_DEVICE_TYPE(HCT157, hct157_device, "hct157", "74HCT157 Quad 2-to-1 Multiplexer")
hct157_device::hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
hct157_device::hct157_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ls157_device(mconfig, HCT157, tag, owner, clock, 0x0f)
{
}

View File

@ -42,16 +42,11 @@ public:
auto out_callback() { return m_out_cb.bind(); }
// data writes
DECLARE_WRITE8_MEMBER(a_w) { write_a(data); }
void write_a(u8 data);
DECLARE_WRITE8_MEMBER(b_w) { write_b(data); }
void write_b(u8 data);
DECLARE_WRITE8_MEMBER(ab_w) { write_ab(data); }
void write_ab(u8 data);
DECLARE_WRITE8_MEMBER(ba_w) { write_ba(data); }
void write_ba(u8 data);
DECLARE_WRITE8_MEMBER(interleave_w) { write_interleave(data); }
void write_interleave(u8 data);
void a_w(u8 data);
void b_w(u8 data);
void ab_w(u8 data);
void ba_w(u8 data);
void interleave_w(u8 data);
// data line writes
DECLARE_WRITE_LINE_MEMBER(a0_w);
@ -68,7 +63,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(strobe_w);
// output read
DECLARE_READ8_MEMBER(output_r);
u8 output_r();
protected:
ls157_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 mask);

View File

@ -228,7 +228,7 @@ WRITE_LINE_MEMBER(es8712_device::msm_int)
}
else
{
m_adpcm_select->write_ab(read_byte(m_base_offset));
m_adpcm_select->ab_w(read_byte(m_base_offset));
m_adpcm_select->select_w(m_adpcm_trigger);
m_adpcm_trigger ^= 1;
if (m_adpcm_trigger == 0)

View File

@ -275,7 +275,7 @@ WRITE_LINE_MEMBER(asuka_state::asuka_msm5205_vck)
if (m_adpcm_ff)
{
m_adpcm_select->write_ba(m_sound_data[m_adpcm_pos]);
m_adpcm_select->ba_w(m_sound_data[m_adpcm_pos]);
m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff;
}
}

View File

@ -339,7 +339,7 @@ WRITE_LINE_MEMBER(firetrap_state::firetrap_adpcm_int)
WRITE8_MEMBER(firetrap_state::adpcm_data_w)
{
m_audiocpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
m_adpcm_select->write_ba(data);
m_adpcm_select->ba_w(data);
}
WRITE8_MEMBER(firetrap_state::flip_screen_w)

View File

@ -1268,9 +1268,9 @@ WRITE8_MEMBER( inder_state::sndbank_w )
void inder_state::update_mus()
{
if ((m_sound_addr < 0x40000) && (m_sndbank != 0xff))
m_13->write_ba(m_p_speech[m_sound_addr]);
m_13->ba_w(m_p_speech[m_sound_addr]);
else
m_13->write_ba(0);
m_13->ba_w(0);
}
WRITE_LINE_MEMBER( inder_state::qc7a_w )

View File

@ -366,10 +366,10 @@ READ8_MEMBER(namcos1_state::dsw_r)
// ------1- ls257 dsw selector 3y
// -------0 ls257 dsw selector 4y
m_dsw_sel->write_ba(m_io_dipsw->read());
m_dsw_sel->ba_w(m_io_dipsw->read());
m_dsw_sel->select_w(BIT(offset, 1));
return 0xf0 | bitswap<4>(m_dsw_sel->output_r(space, 0), 0, 1, 2, 3);
return 0xf0 | bitswap<4>(m_dsw_sel->output_r(), 0, 1, 2, 3);
}
WRITE8_MEMBER(namcos1_state::coin_w)

View File

@ -184,7 +184,7 @@ WRITE_LINE_MEMBER(rastan_state::rastan_msm5205_vck)
if (m_adpcm_ff)
{
m_adpcm_sel->write_ba(m_adpcm_data[m_adpcm_pos]);
m_adpcm_sel->ba_w(m_adpcm_data[m_adpcm_pos]);
m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff;
}
}

View File

@ -8039,7 +8039,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(seta_state::calibr50_interrupt)
void usclssic_state::machine_start()
{
m_buttonmux->write_ab(0xff);
m_buttonmux->ab_w(0xff);
}

View File

@ -461,17 +461,17 @@ WRITE8_MEMBER( spinb_state::sndbank_m_w )
void spinb_state::update_sound_a()
{
if (m_sndbank_a != 0xff)
m_ic14a->write_ba(m_p_audio[m_sound_addr_a]);
m_ic14a->ba_w(m_p_audio[m_sound_addr_a]);
else
m_ic14a->write_ba(0);
m_ic14a->ba_w(0);
}
void spinb_state::update_sound_m()
{
if (m_sndbank_m != 0xff)
m_ic14m->write_ba(m_p_music[m_sound_addr_m]);
m_ic14m->ba_w(m_p_music[m_sound_addr_m]);
else
m_ic14m->write_ba(0);
m_ic14m->ba_w(0);
}
WRITE_LINE_MEMBER( spinb_state::ic5a_w )

View File

@ -5,7 +5,6 @@
#pragma once
#include "machine/74157.h"
#include "cpu/h6280/h6280.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/74157.h"