diff options
author | Vas Crabb <vas@vastheman.com> | 2021-06-24 14:38:59 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2021-06-24 14:38:59 +1000 |
commit | 0e6677c070975eb5c62512c24332234970210640 (patch) | |
tree | c1d9c2d0c0262218e601b87e1e80404068fb0db8 /src/mame | |
parent | 85a85ac93c8f10bb7e9bdde3a78766341e5ae73b (diff) |
machine/latch8.cpp: Clean up a little.
Making the bit read functions honour the XOR mask is easy in theory, but
dkong.cpp is doing scary things with the XOR mask and bit read handlers
on one of its latches, so it could end up breaking something. Honouring
the read callbacks would add two tests to each of the bit read functions,
which could hurt performance. The whole design of this device seems
somewhat incoherent.
Diffstat (limited to 'src/mame')
-rw-r--r-- | src/mame/audio/dkong.cpp | 22 | ||||
-rw-r--r-- | src/mame/drivers/ladybug.cpp | 22 |
2 files changed, 22 insertions, 22 deletions
diff --git a/src/mame/audio/dkong.cpp b/src/mame/audio/dkong.cpp index e623ef5530a..a2c69a86009 100644 --- a/src/mame/audio/dkong.cpp +++ b/src/mame/audio/dkong.cpp @@ -1233,7 +1233,7 @@ uint8_t dkong_state::dkong_tune_r(offs_t offset) if ( page & 0x40 ) { - return (m_ls175_3d->read(0) & 0x0F) | (dkong_voice_status_r() << 4); + return (m_ls175_3d->read(0) & 0x0f) | (dkong_voice_status_r() << 4); } else { @@ -1343,10 +1343,10 @@ void dkong_state::dkong2b_audio(machine_config &config) m_soundcpu->bus_in_cb().set(FUNC(dkong_state::dkong_tune_r)); m_soundcpu->bus_out_cb().set(FUNC(dkong_state::dkong_voice_w)); m_soundcpu->p1_out_cb().set(FUNC(dkong_state::dkong_p1_w)); // only write to dac - m_soundcpu->p2_in_cb().set("virtual_p2", FUNC(latch8_device::read)); - m_soundcpu->p2_out_cb().set("virtual_p2", FUNC(latch8_device::write)); - m_soundcpu->t0_in_cb().set("ls259.6h", FUNC(latch8_device::bit5_q_r)); - m_soundcpu->t1_in_cb().set("ls259.6h", FUNC(latch8_device::bit4_q_r)); + m_soundcpu->p2_in_cb().set(m_dev_vp2, FUNC(latch8_device::read)); + m_soundcpu->p2_out_cb().set(m_dev_vp2, FUNC(latch8_device::write)); + m_soundcpu->t0_in_cb().set(m_dev_6h, FUNC(latch8_device::bit5_q_r)); + m_soundcpu->t1_in_cb().set(m_dev_6h, FUNC(latch8_device::bit4_q_r)); SPEAKER(config, "mono").front_center(); DISCRETE(config, "discrete", dkong2b_discrete).add_route(ALL_OUTPUTS, "mono", 1.0); @@ -1401,11 +1401,11 @@ void dkong_state::dkongjr_audio(machine_config &config) latch8_device &dev_5h(LATCH8(config, "ls259.5h")); dev_5h.write_cb<1>().set("discrete", FUNC(discrete_device::write_line<DS_SOUND9_INP>)); - latch8_device &dev_4h(LATCH8(config, "ls259.4h")); + LATCH8(config, "ls259.4h"); LATCH8(config, m_dev_vp2); /* virtual latch for port B */ m_dev_vp2->set_xorvalue(0x70); /* all signals are inverted */ - m_dev_vp2->read_cb<6>().set(dev_4h, FUNC(latch8_device::bit1_r)); + m_dev_vp2->read_cb<6>().set("ls259.4h", FUNC(latch8_device::bit1_r)); m_dev_vp2->read_cb<5>().set(m_dev_6h, FUNC(latch8_device::bit3_r)); m_dev_vp2->read_cb<4>().set(m_dev_6h, FUNC(latch8_device::bit6_r)); m_dev_vp2->write_cb<7>().set("discrete", FUNC(discrete_device::write_line<DS_DISCHARGE_INV>)); @@ -1414,10 +1414,10 @@ void dkong_state::dkongjr_audio(machine_config &config) m_soundcpu->set_addrmap(AS_PROGRAM, &dkong_state::dkong_sound_map); m_soundcpu->set_addrmap(AS_IO, &dkong_state::dkongjr_sound_io_map); m_soundcpu->p1_out_cb().set(FUNC(dkong_state::dkong_p1_w)); // only write to dac - m_soundcpu->p2_in_cb().set("virtual_p2", FUNC(latch8_device::read)); - m_soundcpu->p2_out_cb().set("virtual_p2", FUNC(latch8_device::write)); - m_soundcpu->t0_in_cb().set("ls259.6h", FUNC(latch8_device::bit5_q_r)); - m_soundcpu->t1_in_cb().set("ls259.6h", FUNC(latch8_device::bit4_q_r)); + m_soundcpu->p2_in_cb().set(m_dev_vp2, FUNC(latch8_device::read)); + m_soundcpu->p2_out_cb().set(m_dev_vp2, FUNC(latch8_device::write)); + m_soundcpu->t0_in_cb().set(m_dev_6h, FUNC(latch8_device::bit5_q_r)); + m_soundcpu->t1_in_cb().set(m_dev_6h, FUNC(latch8_device::bit4_q_r)); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/ladybug.cpp b/src/mame/drivers/ladybug.cpp index ddd822e762b..b65ae59dd21 100644 --- a/src/mame/drivers/ladybug.cpp +++ b/src/mame/drivers/ladybug.cpp @@ -74,7 +74,7 @@ unknown dips #include "cpu/z80/z80.h" #include "machine/74259.h" -#include "machine/latch8.h" +#include "machine/gen_latch.h" #include "sound/sn76496.h" #include "screen.h" #include "speaker.h" @@ -157,8 +157,8 @@ void mrsdyna_state::mrsdyna_cpu1_map(address_map &map) // LS138 @ N3 (bottom 3 bits) // (all of these are read/write) map(0x8005, 0x8005).mirror(0x1ff8).r(FUNC(mrsdyna_state::mrsdyna_protection_r)); // OE on PAL @ K2 (16R6, U001) (100x xxxx xxxx x101) - map(0x8006, 0x8006).mirror(0x1ff8).w("soundlatch_low", FUNC(latch8_device::write)); // LS374 @ P6 - map(0x8007, 0x8007).mirror(0x1ff8).w("soundlatch_high", FUNC(latch8_device::write)); // LS374 @ R6 + map(0x8006, 0x8006).mirror(0x1ff8).w("soundlatch_low", FUNC(generic_latch_8_device::write)); // LS374 @ P6 + map(0x8007, 0x8007).mirror(0x1ff8).w("soundlatch_high", FUNC(generic_latch_8_device::write)); // LS374 @ R6 map(0x8000, 0x8000).mirror(0x1ff8).portr("IN0"); map(0x8001, 0x8001).mirror(0x1ff8).portr("IN1"); map(0x8002, 0x8002).mirror(0x1ff8).portr("DSW0"); @@ -176,8 +176,8 @@ void mrsdyna_state::mrsdyna_cpu2_map(address_map &map) // LS138 @ P7 map(0x0000, 0x5fff).rom(); // 2764s at H6,J6, and L6 map(0x6000, 0x63ff).mirror(0x0400).ram(); // 2x2114 @ M6/N6 - map(0x8000, 0x8000).mirror(0x1fff).r("soundlatch_low", FUNC(latch8_device::read)); // LS374 @ P6 - map(0xa000, 0xa000).mirror(0x1fff).r("soundlatch_high", FUNC(latch8_device::read)); // LS374 @ R6 + map(0x8000, 0x8000).mirror(0x1fff).r("soundlatch_low", FUNC(generic_latch_8_device::read)); // LS374 @ P6 + map(0xa000, 0xa000).mirror(0x1fff).r("soundlatch_high", FUNC(generic_latch_8_device::read)); // LS374 @ R6 map(0xc000, 0xc000).mirror(0x1fff).r(FUNC(mrsdyna_state::mrsdyna_rnd_r)); // LS125 @ P8 - reads 556 outputs to D1 and D0? // LS138 @ P7 (nY7) and LS139 @ H4 map(0xe000, 0xe0ff).mirror(0x0300).writeonly().share("grid_data"); // HD6148P @ D6 @@ -191,8 +191,8 @@ void sraider_state::sraider_cpu2_map(address_map &map) // LS138 @ P7 map(0x0000, 0x5fff).rom(); // 2764s at H6, J6, and L6 map(0x6000, 0x63ff).mirror(0x0400).ram(); // 2x2114 @ M6/N6 - map(0x8000, 0x8000).mirror(0x1fff).r("soundlatch_low", FUNC(latch8_device::read)); // LS374 @ P6 - map(0xa000, 0xa000).mirror(0x1fff).r("soundlatch_high", FUNC(latch8_device::read)); // LS374 @ R6 + map(0x8000, 0x8000).mirror(0x1fff).r("soundlatch_low", FUNC(generic_latch_8_device::read)); // LS374 @ P6 + map(0xa000, 0xa000).mirror(0x1fff).r("soundlatch_high", FUNC(generic_latch_8_device::read)); // LS374 @ R6 map(0xc000, 0xc000).mirror(0x1fff).r(FUNC(sraider_state::mrsdyna_rnd_r)); // LS125 @ P8 - reads 556 outputs to D1 and D0? // LS138 @ P7 (nY7) and LS139 @ H4 map(0xe000, 0xe0ff).mirror(0x0300).writeonly().share("grid_data"); // HD6148P @ D6 @@ -870,8 +870,8 @@ void mrsdyna_state::mrsdyna(machine_config &config) maincpu.set_addrmap(AS_PROGRAM, &mrsdyna_state::mrsdyna_cpu1_map); maincpu.set_vblank_int("screen", FUNC(mrsdyna_state::irq0_line_hold)); - LATCH8(config, "soundlatch_low"); - LATCH8(config, "soundlatch_high"); + GENERIC_LATCH_8(config, "soundlatch_low"); + GENERIC_LATCH_8(config, "soundlatch_high"); z80_device &sub(Z80(config, "sub", 4000000)); /* 4 MHz */ sub.set_addrmap(AS_PROGRAM, &mrsdyna_state::mrsdyna_cpu2_map); @@ -907,8 +907,8 @@ void sraider_state::sraider(machine_config &config) maincpu.set_addrmap(AS_PROGRAM, &sraider_state::mrsdyna_cpu1_map); maincpu.set_vblank_int("screen", FUNC(mrsdyna_state::irq0_line_hold)); - LATCH8(config, "soundlatch_low"); - LATCH8(config, "soundlatch_high"); + GENERIC_LATCH_8(config, "soundlatch_low"); + GENERIC_LATCH_8(config, "soundlatch_high"); z80_device &sub(Z80(config, "sub", 4000000)); /* 4 MHz */ sub.set_addrmap(AS_PROGRAM, &sraider_state::sraider_cpu2_map); |