From 2d897bec09c770a57f39bff70131ccf8e87d1a2b Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 27 Jun 2018 19:48:25 -0400 Subject: [PATCH] Eliminate "Atari VG EAROM" in favor of newer ER2055 device digdug: Use MCFG_DEVCB_RSHIFT for MCU DSW inputs (nw) runaway, qwak: Add addressable latch (nw) --- scripts/target/mame/arcade.lua | 2 - src/devices/machine/er2055.cpp | 5 +- src/devices/machine/er2055.h | 2 +- src/mame/drivers/asteroid.cpp | 35 ++++++- src/mame/drivers/bwidow.cpp | 51 +++++++--- src/mame/drivers/bzone.cpp | 39 +++++++- src/mame/drivers/centiped.cpp | 64 ++++++++---- src/mame/drivers/galaga.cpp | 48 ++++++--- src/mame/drivers/mhavoc.cpp | 1 - src/mame/drivers/runaway.cpp | 60 ++++++++---- src/mame/drivers/tempest.cpp | 42 +++++++- src/mame/includes/asteroid.h | 7 ++ src/mame/includes/bwidow.h | 24 +++-- src/mame/includes/bzone.h | 7 ++ src/mame/includes/centiped.h | 6 ++ src/mame/includes/digdug.h | 13 ++- src/mame/includes/runaway.h | 19 ++-- src/mame/machine/asteroid.cpp | 5 +- src/mame/machine/atari_vg.cpp | 172 --------------------------------- src/mame/machine/atari_vg.h | 59 ----------- src/mame/video/runaway.cpp | 6 +- 21 files changed, 335 insertions(+), 332 deletions(-) delete mode 100644 src/mame/machine/atari_vg.cpp delete mode 100644 src/mame/machine/atari_vg.h diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index e609bfa5d30..d395e66ccb8 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1257,8 +1257,6 @@ files { MAME_DIR .. "src/mame/video/xybots.cpp", MAME_DIR .. "src/mame/machine/asic65.cpp", MAME_DIR .. "src/mame/machine/asic65.h", - MAME_DIR .. "src/mame/machine/atari_vg.cpp", - MAME_DIR .. "src/mame/machine/atari_vg.h", MAME_DIR .. "src/mame/machine/atarigen.cpp", MAME_DIR .. "src/mame/machine/atarigen.h", MAME_DIR .. "src/mame/machine/mathbox.cpp", diff --git a/src/devices/machine/er2055.cpp b/src/devices/machine/er2055.cpp index 0d8ec833de8..c9d3563dab4 100644 --- a/src/devices/machine/er2055.cpp +++ b/src/devices/machine/er2055.cpp @@ -4,7 +4,10 @@ er2055.c - GI 512 bit electrically alterable read-only memory. + GI 64 word x 8 bit electrically alterable read-only memory. + + Atari often called this part "137161-001" on their technical manuals, + but their schematics usually called it by its proper ER-2055 name. ***************************************************************************/ diff --git a/src/devices/machine/er2055.h b/src/devices/machine/er2055.h index ac6e9a55371..49497ed7241 100644 --- a/src/devices/machine/er2055.h +++ b/src/devices/machine/er2055.h @@ -28,7 +28,7 @@ class er2055_device : public device_t, { public: // construction/destruction - er2055_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + er2055_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // I/O operations uint8_t data() const { return m_data; } diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp index 0616f396276..d652d35c06d 100644 --- a/src/mame/drivers/asteroid.cpp +++ b/src/mame/drivers/asteroid.cpp @@ -249,7 +249,6 @@ NOTE: Previous program versions, for the second line would only show 4 digits. #include "includes/asteroid.h" #include "cpu/m6502/m6502.h" #include "machine/74259.h" -#include "machine/atari_vg.h" #include "machine/output_latch.h" #include "machine/watchdog.h" #include "sound/pokey.h" @@ -285,6 +284,32 @@ WRITE_LINE_MEMBER(asteroid_state::coin_counter_right_w) +/************************************* + * + * High score EAROM + * + *************************************/ + +READ8_MEMBER(asteroid_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(asteroid_state::earom_write) +{ + m_earom->set_address(offset & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(asteroid_state::earom_control_w) +{ + // CK = DB0, C1 = /DB2, C2 = DB1, CS1 = DB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 2), BIT(data, 1)); + m_earom->set_clk(BIT(data, 0)); +} + + + /************************************* * * Main CPU memory handlers @@ -323,12 +348,12 @@ void asteroid_state::astdelux_map(address_map &map) map(0x2400, 0x2407).r(FUNC(asteroid_state::asteroid_IN1_r)).nopw(); /* IN1 */ map(0x2800, 0x2803).r(FUNC(asteroid_state::asteroid_DSW1_r)); /* DSW1 */ map(0x2c00, 0x2c0f).rw("pokey", FUNC(pokey_device::read), FUNC(pokey_device::write)); - map(0x2c40, 0x2c7f).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x2c40, 0x2c7f).r(FUNC(asteroid_state::earom_read)); map(0x3000, 0x3000).w(m_dvg, FUNC(dvg_device::go_w)); - map(0x3200, 0x323f).w("earom", FUNC(atari_vg_earom_device::write)).nopr(); + map(0x3200, 0x323f).w(FUNC(asteroid_state::earom_write)).nopr(); map(0x3400, 0x3400).w("watchdog", FUNC(watchdog_timer_device::reset_w)); map(0x3600, 0x3600).w(FUNC(asteroid_state::asteroid_explode_w)); - map(0x3a00, 0x3a00).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); + map(0x3a00, 0x3a00).w(FUNC(asteroid_state::earom_control_w)); map(0x3c00, 0x3c07).w("audiolatch", FUNC(ls259_device::write_d7)); map(0x3e00, 0x3e00).w(FUNC(asteroid_state::asteroid_noise_reset_w)); map(0x4000, 0x47ff).ram().share("vectorram").region("maincpu", 0x4000); @@ -762,7 +787,7 @@ MACHINE_CONFIG_START(asteroid_state::astdelux) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(astdelux_map) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) /* sound hardware */ astdelux_sound(config); diff --git a/src/mame/drivers/bwidow.cpp b/src/mame/drivers/bwidow.cpp index eb41b77ea1d..c71167bfae6 100644 --- a/src/mame/drivers/bwidow.cpp +++ b/src/mame/drivers/bwidow.cpp @@ -225,7 +225,6 @@ #include "machine/watchdog.h" #include "video/vector.h" #include "video/avgdvg.h" -#include "machine/atari_vg.h" #include "sound/pokey.h" #include "sound/discrete.h" @@ -357,6 +356,36 @@ WRITE8_MEMBER(bwidow_state::spacduel_coin_counter_w) m_lastdata = data; } +/************************************* + * + * High score EAROM + * + *************************************/ + +READ8_MEMBER(bwidow_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(bwidow_state::earom_write) +{ + m_earom->set_address(offset & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(bwidow_state::earom_control_w) +{ + // CK = DB0, C1 = /DB2, C2 = DB1, CS1 = DB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 2), BIT(data, 1)); + m_earom->set_clk(BIT(data, 0)); +} + +void bwidow_state::machine_reset() +{ + earom_control_w(machine().dummy_space(), 0, 0); +} + + /************************************* * * Interrupt ack @@ -382,7 +411,7 @@ void bwidow_state::bwidow_map(address_map &map) map(0x2800, 0x5fff).rom(); map(0x6000, 0x67ff).rw("pokey1", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x6800, 0x6fff).rw("pokey2", FUNC(pokey_device::read), FUNC(pokey_device::write)); - map(0x7000, 0x7000).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x7000, 0x7000).r(FUNC(bwidow_state::earom_read)); map(0x7800, 0x7800).portr("IN0"); map(0x8000, 0x8000).portr("IN3"); map(0x8800, 0x8800).portr("IN4"); @@ -390,8 +419,8 @@ void bwidow_state::bwidow_map(address_map &map) map(0x8840, 0x8840).w("avg", FUNC(avg_device::go_w)); map(0x8880, 0x8880).w("avg", FUNC(avg_device::reset_w)); map(0x88c0, 0x88c0).w(FUNC(bwidow_state::irq_ack_w)); /* interrupt acknowledge */ - map(0x8900, 0x8900).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x8940, 0x897f).w("earom", FUNC(atari_vg_earom_device::write)); + map(0x8900, 0x8900).w(FUNC(bwidow_state::earom_control_w)); + map(0x8940, 0x897f).w(FUNC(bwidow_state::earom_write)); map(0x8980, 0x89ed).nopw(); /* watchdog clear */ map(0x9000, 0xffff).rom(); } @@ -410,9 +439,9 @@ void bwidow_state::bwidowp_map(address_map &map) map(0x4000, 0x47ff).ram().share("vectorram").region("maincpu", 0x4000); map(0x4800, 0x6fff).rom(); map(0x6000, 0x6000).w(FUNC(bwidow_state::irq_ack_w)); /* interrupt acknowledge */ - map(0x8000, 0x803f).w("earom", FUNC(atari_vg_earom_device::write)); - map(0x8800, 0x8800).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x9000, 0x9000).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x8000, 0x803f).w(FUNC(bwidow_state::earom_write)); + map(0x8800, 0x8800).w(FUNC(bwidow_state::earom_control_w)); + map(0x9000, 0x9000).r(FUNC(bwidow_state::earom_read)); map(0x9800, 0x9800).nopw(); /* ? written once at startup */ map(0xa000, 0xffff).rom(); } @@ -423,14 +452,14 @@ void bwidow_state::spacduel_map(address_map &map) map(0x0800, 0x0800).portr("IN0"); map(0x0900, 0x0907).r(FUNC(bwidow_state::spacduel_IN3_r)); /* IN1 */ map(0x0905, 0x0906).nopw(); /* ignore? */ - map(0x0a00, 0x0a00).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x0a00, 0x0a00).r(FUNC(bwidow_state::earom_read)); map(0x0c00, 0x0c00).w(FUNC(bwidow_state::spacduel_coin_counter_w)); /* coin out */ map(0x0c80, 0x0c80).w("avg", FUNC(avg_device::go_w)); map(0x0d00, 0x0d00).nopw(); /* watchdog clear */ map(0x0d80, 0x0d80).w("avg", FUNC(avg_device::reset_w)); map(0x0e00, 0x0e00).w(FUNC(bwidow_state::irq_ack_w)); /* interrupt acknowledge */ - map(0x0e80, 0x0e80).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x0f00, 0x0f3f).w("earom", FUNC(atari_vg_earom_device::write)); + map(0x0e80, 0x0e80).w(FUNC(bwidow_state::earom_control_w)); + map(0x0f00, 0x0f3f).w(FUNC(bwidow_state::earom_write)); map(0x1000, 0x10ff).rw("pokey1", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x1400, 0x14ff).rw("pokey2", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x2000, 0x27ff).ram().share("vectorram").region("maincpu", 0x2000); @@ -741,7 +770,7 @@ MACHINE_CONFIG_START(bwidow_state::bwidow) MCFG_DEVICE_PROGRAM_MAP(bwidow_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(bwidow_state, irq0_line_assert, CLOCK_3KHZ / 12) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) /* video hardware */ MCFG_VECTOR_ADD("vector") diff --git a/src/mame/drivers/bzone.cpp b/src/mame/drivers/bzone.cpp index dba73af808c..84e8bb1d58c 100644 --- a/src/mame/drivers/bzone.cpp +++ b/src/mame/drivers/bzone.cpp @@ -213,7 +213,6 @@ #include "machine/watchdog.h" #include "video/vector.h" #include "video/avgdvg.h" -#include "machine/atari_vg.h" #include "sound/pokey.h" #include "screen.h" #include "speaker.h" @@ -242,6 +241,12 @@ void redbaron_state::machine_start() } +void redbaron_state::machine_reset() +{ + earom_control_w(machine().dummy_space(), 0, 0); +} + + /************************************* * @@ -295,6 +300,32 @@ WRITE8_MEMBER(redbaron_state::redbaron_joysound_w) +/************************************* + * + * Red Baron EAROM + * + *************************************/ + +READ8_MEMBER(redbaron_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(redbaron_state::earom_write) +{ + m_earom->set_address((offset ^ 0x20) & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(redbaron_state::earom_control_w) +{ + // CK = EDB0, C1 = /EDB2, C2 = EDB1, CS1 = EDB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 2), BIT(data, 1)); + m_earom->set_clk(BIT(data, 0)); +} + + + /************************************* * * Main CPU memory handlers @@ -339,9 +370,9 @@ void redbaron_state::redbaron_map(address_map &map) map(0x1806, 0x1806).r("mathbox", FUNC(mathbox_device::hi_r)); map(0x1808, 0x1808).w(FUNC(redbaron_state::redbaron_joysound_w)); /* and select joystick pot also */ map(0x180a, 0x180a).nopw(); /* sound reset, yet todo */ - map(0x180c, 0x180c).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); + map(0x180c, 0x180c).w(FUNC(redbaron_state::earom_control_w)); map(0x1810, 0x181f).rw("pokey", FUNC(pokey_device::read), FUNC(pokey_device::write)); - map(0x1820, 0x185f).rw("earom", FUNC(atari_vg_earom_device::read), FUNC(atari_vg_earom_device::write)); + map(0x1820, 0x185f).rw(FUNC(redbaron_state::earom_read), FUNC(redbaron_state::earom_write)); map(0x1860, 0x187f).w("mathbox", FUNC(mathbox_device::go_w)); map(0x2000, 0x2fff).ram().share("vectorram").region("maincpu", 0x2000); map(0x3000, 0x7fff).rom(); @@ -580,7 +611,7 @@ MACHINE_CONFIG_START(redbaron_state::redbaron) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(redbaron_map) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) /* video hardware */ MCFG_SCREEN_MODIFY("screen") diff --git a/src/mame/drivers/centiped.cpp b/src/mame/drivers/centiped.cpp index dff31e015e6..404e900c10c 100644 --- a/src/mame/drivers/centiped.cpp +++ b/src/mame/drivers/centiped.cpp @@ -421,7 +421,6 @@ each direction to assign the boundries. #include "cpu/s2650/s2650.h" #include "machine/74259.h" #include "machine/watchdog.h" -#include "machine/atari_vg.h" #include "sound/sn76496.h" #include "sound/pokey.h" #include "speaker.h" @@ -457,6 +456,9 @@ MACHINE_RESET_MEMBER(centiped_state,centiped) { m_maincpu->set_input_line(0, CLEAR_LINE); m_prg_bank = 0; + + if (m_earom.found()) + earom_control_w(machine().dummy_space(), 0, 0); } @@ -645,6 +647,32 @@ WRITE_LINE_MEMBER(centiped_state::bullsdrt_coin_count_w) +/************************************* + * + * High score EAROM + * + *************************************/ + +READ8_MEMBER(centiped_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(centiped_state::earom_write) +{ + m_earom->set_address(offset & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(centiped_state::earom_control_w) +{ + // CK = DB0, C1 = /DB1, C2 = DB2, CS1 = DB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 1), BIT(data, 2)); + m_earom->set_clk(BIT(data, 0)); +} + + + /************************************* * * Centipede CPU memory handlers @@ -664,9 +692,9 @@ void centiped_state::centiped_base_map(address_map &map) map(0x0c02, 0x0c02).r(FUNC(centiped_state::centiped_IN2_r)); map(0x0c03, 0x0c03).portr("IN3"); map(0x1400, 0x140f).w(FUNC(centiped_state::centiped_paletteram_w)).share("paletteram"); - map(0x1600, 0x163f).nopr().w("earom", FUNC(atari_vg_earom_device::write)); - map(0x1680, 0x1680).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x1700, 0x173f).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x1600, 0x163f).nopr().w(FUNC(centiped_state::earom_write)); + map(0x1680, 0x1680).w(FUNC(centiped_state::earom_control_w)); + map(0x1700, 0x173f).r(FUNC(centiped_state::earom_read)); map(0x1800, 0x1800).w(FUNC(centiped_state::irq_ack_w)); map(0x1c00, 0x1c07).nopr().w("outlatch", FUNC(ls259_device::write_d7)); map(0x2000, 0x2000).w("watchdog", FUNC(watchdog_timer_device::reset_w)); @@ -706,9 +734,9 @@ void centiped_state::centipdb_map(address_map &map) map(0x1000, 0x1001).mirror(0x4000).w(m_aysnd, FUNC(ay8910_device::data_address_w)); map(0x1001, 0x1001).mirror(0x4000).r(m_aysnd, FUNC(ay8910_device::data_r)); map(0x1400, 0x140f).mirror(0x4000).w(FUNC(centiped_state::centiped_paletteram_w)).share("paletteram"); - map(0x1600, 0x163f).mirror(0x4000).w("earom", FUNC(atari_vg_earom_device::write)); - map(0x1680, 0x1680).mirror(0x4000).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x1700, 0x173f).mirror(0x4000).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x1600, 0x163f).mirror(0x4000).w(FUNC(centiped_state::earom_write)); + map(0x1680, 0x1680).mirror(0x4000).w(FUNC(centiped_state::earom_control_w)); + map(0x1700, 0x173f).mirror(0x4000).r(FUNC(centiped_state::earom_read)); map(0x1800, 0x1800).mirror(0x4000).w(FUNC(centiped_state::irq_ack_w)); map(0x1c00, 0x1c07).mirror(0x4000).w("outlatch", FUNC(ls259_device::write_d7)); map(0x2000, 0x27ff).rom(); @@ -764,13 +792,13 @@ void centiped_state::milliped_map(address_map &map) map(0x2001, 0x2001).r(FUNC(centiped_state::milliped_IN1_r)); map(0x2010, 0x2010).r(FUNC(centiped_state::milliped_IN2_r)); map(0x2011, 0x2011).portr("IN3"); - map(0x2030, 0x2030).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x2030, 0x2030).r(FUNC(centiped_state::earom_read)); map(0x2480, 0x249f).w(FUNC(centiped_state::milliped_paletteram_w)).share("paletteram"); map(0x2500, 0x2507).w("outlatch", FUNC(ls259_device::write_d7)); map(0x2600, 0x2600).w(FUNC(centiped_state::irq_ack_w)); map(0x2680, 0x2680).w("watchdog", FUNC(watchdog_timer_device::reset_w)); - map(0x2700, 0x2700).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x2780, 0x27bf).w("earom", FUNC(atari_vg_earom_device::write)); + map(0x2700, 0x2700).w(FUNC(centiped_state::earom_control_w)); + map(0x2780, 0x27bf).w(FUNC(centiped_state::earom_write)); map(0x4000, 0x7fff).rom(); } @@ -909,14 +937,14 @@ void centiped_state::mazeinv_map(address_map &map) map(0x2010, 0x2010).portr("IN2"); map(0x2011, 0x2011).portr("IN3"); map(0x2020, 0x2020).r(FUNC(centiped_state::mazeinv_input_r)); - map(0x2030, 0x2030).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x2030, 0x2030).r(FUNC(centiped_state::earom_read)); map(0x2480, 0x249f).w(FUNC(centiped_state::mazeinv_paletteram_w)).share("paletteram"); map(0x2500, 0x2507).w("outlatch", FUNC(ls259_device::write_d7)); map(0x2580, 0x2583).w(FUNC(centiped_state::mazeinv_input_select_w)); map(0x2600, 0x2600).w(FUNC(centiped_state::irq_ack_w)); map(0x2680, 0x2680).w("watchdog", FUNC(watchdog_timer_device::reset_w)); - map(0x2700, 0x2700).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x2780, 0x27bf).w("earom", FUNC(atari_vg_earom_device::write)); + map(0x2700, 0x2700).w(FUNC(centiped_state::earom_control_w)); + map(0x2780, 0x27bf).w(FUNC(centiped_state::earom_write)); map(0x3000, 0x7fff).rom(); } @@ -935,8 +963,8 @@ void centiped_state::bullsdrt_map(address_map &map) map(0x1080, 0x1080).mirror(0x6000).r(FUNC(centiped_state::centiped_IN0_r)); map(0x1081, 0x1081).mirror(0x6000).portr("IN1"); map(0x1082, 0x1082).mirror(0x6000).r(FUNC(centiped_state::centiped_IN2_r)); - map(0x1200, 0x123f).mirror(0x6000).rw("earom", FUNC(atari_vg_earom_device::read), FUNC(atari_vg_earom_device::write)); - map(0x1280, 0x1280).mirror(0x6000).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); + map(0x1200, 0x123f).mirror(0x6000).rw(FUNC(centiped_state::earom_read), FUNC(centiped_state::earom_write)); + map(0x1280, 0x1280).mirror(0x6000).w(FUNC(centiped_state::earom_control_w)); map(0x1300, 0x1300).mirror(0x6000).portr("DSW2"); map(0x1400, 0x140f).mirror(0x6000).w(FUNC(centiped_state::centiped_paletteram_w)).share("paletteram"); map(0x1480, 0x1487).mirror(0x6000).w("outlatch", FUNC(ls259_device::write_d7)); @@ -1719,7 +1747,7 @@ MACHINE_CONFIG_START(centiped_state::centiped_base) MCFG_MACHINE_START_OVERRIDE(centiped_state,centiped) MCFG_MACHINE_RESET_OVERRIDE(centiped_state,centiped) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) MCFG_DEVICE_ADD("outlatch", LS259, 0) MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, centiped_state, coin_counter_left_w)) @@ -1884,6 +1912,8 @@ MACHINE_CONFIG_START(centiped_state::warlords) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(warlords_map) + MCFG_DEVICE_REMOVE("earom") + // these extra LEDs also appear on Centipede schematics MCFG_DEVICE_MODIFY("outlatch") // P9 MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT // LED 3 @@ -1934,7 +1964,7 @@ MACHINE_CONFIG_START(centiped_state::bullsdrt) MCFG_DEVICE_IO_MAP(bullsdrt_port_map) MCFG_DEVICE_DATA_MAP(bullsdrt_data_map) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) MCFG_DEVICE_ADD("outlatch", LS259, 0) MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, centiped_state, bullsdrt_coin_count_w)) diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index fa0c5aa4bd8..9b6dbb5377f 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -708,7 +708,6 @@ TODO: #include "cpu/mb88xx/mb88xx.h" #include "cpu/z80/z80.h" -#include "machine/atari_vg.h" #include "machine/namco06.h" #include "machine/namco50.h" #include "machine/namco51.h" @@ -758,8 +757,6 @@ WRITE_LINE_MEMBER(galaga_state::nmion_w) m_sub2_nmi_mask = !state; } -CUSTOM_INPUT_MEMBER(digdug_state::shifted_port_r){ return ioport((const char *)param)->read() >> 4; } - WRITE8_MEMBER(galaga_state::out_0) { m_leds[1] = BIT(data, 0); @@ -810,6 +807,25 @@ TIMER_CALLBACK_MEMBER(galaga_state::cpu3_interrupt_callback) } +READ8_MEMBER(digdug_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(digdug_state::earom_write) +{ + m_earom->set_address(offset & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(digdug_state::earom_control_w) +{ + // CK = DB0, C1 = /DB1, C2 = DB2, CS1 = DB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 1), BIT(data, 2)); + m_earom->set_clk(BIT(data, 0)); +} + + void galaga_state::machine_start() { m_leds.resolve(); @@ -820,6 +836,12 @@ void galaga_state::machine_start() save_item(NAME(m_sub2_nmi_mask)); } +void digdug_state::machine_start() +{ + galaga_state::machine_start(); + earom_control_w(machine().dummy_space(), 0, 0); +} + void galaga_state::machine_reset() { m_cpu3_interrupt_timer->adjust(m_screen->time_until_pos(64), 64); @@ -919,8 +941,8 @@ void digdug_state::digdug_map(address_map &map) map(0x9000, 0x93ff).ram().share("digdug_posram"); /* work RAM + sprite registers */ map(0x9800, 0x9bff).ram().share("digdug_flpram"); /* work RAM + sprite registers */ map(0xa000, 0xa007).nopr().w(m_videolatch, FUNC(ls259_device::write_d0)); /* video latches (spurious reads when setting latch bits) */ - map(0xb800, 0xb83f).rw("earom", FUNC(atari_vg_earom_device::read), FUNC(atari_vg_earom_device::write)); /* non volatile memory data */ - map(0xb840, 0xb840).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); /* non volatile memory control */ + map(0xb800, 0xb83f).rw(FUNC(digdug_state::earom_read), FUNC(digdug_state::earom_write)); /* non volatile memory data */ + map(0xb840, 0xb840).w(FUNC(digdug_state::earom_control_w)); /* non volatile memory control */ } @@ -1347,9 +1369,6 @@ static INPUT_PORTS_START( digdug ) PORT_DIPSETTING( 0x80, "3" ) // factory default = "3" PORT_DIPSETTING( 0xc0, "5" ) - PORT_START("DSWA_HI") - PORT_BIT( 0x0f, 0x00, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, digdug_state,shifted_port_r, "DSWA") - PORT_START("DSWB") // reverse order against SWA PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWB:1,2") PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) ) @@ -1373,9 +1392,6 @@ static INPUT_PORTS_START( digdug ) PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x03, DEF_STR( Hardest ) ) - - PORT_START("DSWB_HI") - PORT_BIT( 0x0f, 0x00, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, digdug_state,shifted_port_r, "DSWB") INPUT_PORTS_END /* @@ -1906,10 +1922,10 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_DEVCB_CHAIN_INPUT(READLINE("misclatch", ls259_device, q6_r)) MCFG_DEVCB_BIT(2) // MOD 1 = K2 MCFG_DEVCB_CHAIN_INPUT(READLINE("misclatch", ls259_device, q5_r)) MCFG_DEVCB_BIT(1) // MOD 0 = K1 // K0 is left unconnected - MCFG_NAMCO_53XX_INPUT_0_CB(IOPORT("DSWA")) - MCFG_NAMCO_53XX_INPUT_1_CB(IOPORT("DSWA_HI")) - MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWB")) - MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWB_HI")) + MCFG_NAMCO_53XX_INPUT_0_CB(IOPORT("DSWA")) MCFG_DEVCB_MASK(0x0f) + MCFG_NAMCO_53XX_INPUT_1_CB(IOPORT("DSWA")) MCFG_DEVCB_RSHIFT(4) + MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWB")) MCFG_DEVCB_MASK(0x0f) + MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWB")) MCFG_DEVCB_RSHIFT(4) MCFG_NAMCO_06XX_ADD("06xx", MASTER_CLOCK/6/64) MCFG_NAMCO_06XX_MAINCPU("maincpu") @@ -1927,7 +1943,7 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/mhavoc.cpp b/src/mame/drivers/mhavoc.cpp index 41d736f17ac..3c012bcf564 100644 --- a/src/mame/drivers/mhavoc.cpp +++ b/src/mame/drivers/mhavoc.cpp @@ -189,7 +189,6 @@ #include "includes/mhavoc.h" #include "cpu/m6502/m6502.h" -#include "machine/atari_vg.h" #include "video/avgdvg.h" #include "video/vector.h" #include "machine/eeprompar.h" diff --git a/src/mame/drivers/runaway.cpp b/src/mame/drivers/runaway.cpp index 82d8dad2f93..023d33fcb6d 100644 --- a/src/mame/drivers/runaway.cpp +++ b/src/mame/drivers/runaway.cpp @@ -16,7 +16,7 @@ #include "includes/runaway.h" #include "cpu/m6502/m6502.h" -#include "machine/atari_vg.h" +#include "machine/74259.h" #include "sound/pokey.h" #include "speaker.h" @@ -38,13 +38,14 @@ TIMER_CALLBACK_MEMBER(runaway_state::interrupt_callback) void runaway_state::machine_start() { - m_leds.resolve(); m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(runaway_state::interrupt_callback),this)); } void runaway_state::machine_reset() { m_interrupt_timer->adjust(m_screen->time_until_pos(16), 16); + if (m_earom.found()) + earom_control_w(machine().dummy_space(), 0, 0); } @@ -71,41 +72,56 @@ READ8_MEMBER(runaway_state::runaway_pot_r) } -WRITE8_MEMBER(runaway_state::runaway_led_w) -{ - m_leds[offset] = BIT(~data, 0); -} - - WRITE8_MEMBER(runaway_state::runaway_irq_ack_w) { m_maincpu->set_input_line(0, CLEAR_LINE); } -void runaway_state::runaway_map(address_map &map) +READ8_MEMBER(runaway_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(runaway_state::earom_write) +{ + m_earom->set_address(offset & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(runaway_state::earom_control_w) +{ + // CK = DB0, C1 = /DB2, C2 = DB1, CS1 = DB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 2), BIT(data, 1)); + m_earom->set_clk(BIT(data, 0)); +} + + +void runaway_state::qwak_map(address_map &map) { map(0x0000, 0x03ff).ram(); map(0x0400, 0x07bf).ram().w(FUNC(runaway_state::runaway_video_ram_w)).share("video_ram"); map(0x07c0, 0x07ff).ram().share("sprite_ram"); map(0x1000, 0x1000).w(FUNC(runaway_state::runaway_irq_ack_w)); - map(0x1400, 0x143f).w("earom", FUNC(atari_vg_earom_device::write)); - map(0x1800, 0x1800).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); map(0x1c00, 0x1c0f).w(FUNC(runaway_state::runaway_paletteram_w)); - map(0x2000, 0x2000).nopw(); /* coin counter? */ - map(0x2001, 0x2001).nopw(); /* coin counter? */ - map(0x2003, 0x2004).w(FUNC(runaway_state::runaway_led_w)); - map(0x2005, 0x2005).w(FUNC(runaway_state::runaway_tile_bank_w)); + map(0x2000, 0x2007).w("mainlatch", FUNC(ls259_device::write_d0)); map(0x3000, 0x3007).r(FUNC(runaway_state::runaway_input_r)); map(0x4000, 0x4000).portr("4000"); - map(0x5000, 0x5000).r("earom", FUNC(atari_vg_earom_device::read)); map(0x6000, 0x600f).rw("pokey1", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x7000, 0x700f).rw("pokey2", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x8000, 0xcfff).rom(); map(0xf000, 0xffff).rom(); /* for the interrupt vectors */ } +void runaway_state::runaway_map(address_map &map) +{ + qwak_map(map); + map(0x1400, 0x143f).w(FUNC(runaway_state::earom_write)); + map(0x1800, 0x1800).w(FUNC(runaway_state::earom_control_w)); + map(0x5000, 0x5000).r(FUNC(runaway_state::earom_read)); +} + static INPUT_PORTS_START( qwak ) PORT_START("3000D7") /* 3000 D7 */ @@ -335,8 +351,14 @@ MACHINE_CONFIG_START(runaway_state::runaway) MCFG_DEVICE_ADD("maincpu", M6502, 12096000 / 8) /* ? */ MCFG_DEVICE_PROGRAM_MAP(runaway_map) + MCFG_DEVICE_ADD("mainlatch", LS259) + MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // coin counter? + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(NOOP) // coin counter? + MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT + MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT + MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, runaway_state, tile_bank_w)) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -374,6 +396,10 @@ MACHINE_CONFIG_START(runaway_state::qwak) runaway(config); /* basic machine hardware */ + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_PROGRAM_MAP(qwak_map) + + MCFG_DEVICE_REMOVE("earom") /* video hardware */ MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_qwak) diff --git a/src/mame/drivers/tempest.cpp b/src/mame/drivers/tempest.cpp index 4c4f4148cbf..3e21730f5a7 100644 --- a/src/mame/drivers/tempest.cpp +++ b/src/mame/drivers/tempest.cpp @@ -281,7 +281,7 @@ Note: Roms for Tempest Analog Vector-Generator PCB Assembly A037383-03 or A03738 #include "machine/watchdog.h" #include "video/avgdvg.h" #include "video/vector.h" -#include "machine/atari_vg.h" +#include "machine/er2055.h" #include "sound/pokey.h" #include "screen.h" #include "speaker.h" @@ -304,6 +304,7 @@ public: m_mathbox(*this, "mathbox"), m_watchdog(*this, "watchdog"), m_avg(*this, "avg"), + m_earom(*this, "earom"), m_rom(*this, "maincpu"), m_knob_p1(*this, TEMPEST_KNOB_P1_TAG), m_knob_p2(*this, TEMPEST_KNOB_P2_TAG), @@ -326,6 +327,10 @@ protected: DECLARE_READ8_MEMBER(input_port_1_bit_r); DECLARE_READ8_MEMBER(input_port_2_bit_r); + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); + DECLARE_READ8_MEMBER(rom_ae1f_r); virtual void machine_start() override; @@ -336,6 +341,7 @@ private: required_device m_mathbox; required_device m_watchdog; required_device m_avg; + required_device m_earom; required_region_ptr m_rom; required_ioport m_knob_p1; @@ -431,6 +437,32 @@ WRITE8_MEMBER(tempest_state::tempest_coin_w) +/************************************* + * + * High score EAROM + * + *************************************/ + +READ8_MEMBER(tempest_state::earom_read) +{ + return m_earom->data(); +} + +WRITE8_MEMBER(tempest_state::earom_write) +{ + m_earom->set_address(offset & 0x3f); + m_earom->set_data(data); +} + +WRITE8_MEMBER(tempest_state::earom_control_w) +{ + // CK = EDB0, C1 = /EDB2, C2 = EDB1, CS1 = EDB3, /CS2 = GND + m_earom->set_control(BIT(data, 3), 1, !BIT(data, 2), BIT(data, 1)); + m_earom->set_clk(BIT(data, 0)); +} + + + /************************************* * * Main CPU memory handlers @@ -461,9 +493,9 @@ void tempest_state::main_map(address_map &map) map(0x4800, 0x4800).w(m_avg, FUNC(avg_tempest_device::go_w)); map(0x5000, 0x5000).w(FUNC(tempest_state::wdclr_w)); map(0x5800, 0x5800).w(m_avg, FUNC(avg_tempest_device::reset_w)); - map(0x6000, 0x603f).w("earom", FUNC(atari_vg_earom_device::write)); - map(0x6040, 0x6040).r(m_mathbox, FUNC(mathbox_device::status_r)).w("earom", FUNC(atari_vg_earom_device::ctrl_w)); - map(0x6050, 0x6050).r("earom", FUNC(atari_vg_earom_device::read)); + map(0x6000, 0x603f).w(FUNC(tempest_state::earom_write)); + map(0x6040, 0x6040).r(m_mathbox, FUNC(mathbox_device::status_r)).w(FUNC(tempest_state::earom_control_w)); + map(0x6050, 0x6050).r(FUNC(tempest_state::earom_read)); map(0x6060, 0x6060).r(m_mathbox, FUNC(mathbox_device::lo_r)); map(0x6070, 0x6070).r(m_mathbox, FUNC(mathbox_device::hi_r)); map(0x6080, 0x609f).w(m_mathbox, FUNC(mathbox_device::go_w)); @@ -609,7 +641,7 @@ MACHINE_CONFIG_START(tempest_state::tempest) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(CLOCK_3KHZ / 256)) - MCFG_ATARIVGEAROM_ADD("earom") + MCFG_DEVICE_ADD("earom", ER2055) /* video hardware */ MCFG_VECTOR_ADD("vector") diff --git a/src/mame/includes/asteroid.h b/src/mame/includes/asteroid.h index 7d258190a3d..c8d0f58ef86 100644 --- a/src/mame/includes/asteroid.h +++ b/src/mame/includes/asteroid.h @@ -9,6 +9,7 @@ #include "sound/discrete.h" #include "video/avgdvg.h" #include "machine/74153.h" +#include "machine/er2055.h" class asteroid_state : public driver_device { @@ -17,6 +18,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_dvg(*this, "dvg"), + m_earom(*this, "earom"), m_discrete(*this, "discrete"), m_dsw1(*this, "DSW1"), m_dsw_sel(*this, "dsw_sel"), @@ -27,6 +29,7 @@ public: /* devices */ required_device m_maincpu; required_device m_dvg; + optional_device m_earom; required_device m_discrete; required_ioport m_dsw1; required_device m_dsw_sel; @@ -49,6 +52,10 @@ public: DECLARE_WRITE8_MEMBER(llander_snd_reset_w); DECLARE_WRITE8_MEMBER(llander_sounds_w); + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); + DECLARE_CUSTOM_INPUT_MEMBER(clock_r); INTERRUPT_GEN_MEMBER(asteroid_interrupt); diff --git a/src/mame/includes/bwidow.h b/src/mame/includes/bwidow.h index 642d86c28a8..bf3148bc548 100644 --- a/src/mame/includes/bwidow.h +++ b/src/mame/includes/bwidow.h @@ -4,6 +4,8 @@ #ifndef MAME_INCLUDES_BWIDOW_H #define MAME_INCLUDES_BWIDOW_H +#include "machine/er2055.h" + #define MASTER_CLOCK (XTAL(12'096'000)) #define CLOCK_3KHZ (MASTER_CLOCK / 4096) @@ -14,18 +16,13 @@ public: bwidow_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_earom(*this, "earom") , m_in3(*this, "IN3") , m_in4(*this, "IN4") , m_dsw2(*this, "DSW2") , m_leds(*this, "led%u", 0U) { } - DECLARE_READ8_MEMBER(spacduel_IN3_r); - DECLARE_READ8_MEMBER(bwidowp_in_r); - DECLARE_WRITE8_MEMBER(bwidow_misc_w); - DECLARE_WRITE8_MEMBER(spacduel_coin_counter_w); - DECLARE_WRITE8_MEMBER(irq_ack_w); - DECLARE_CUSTOM_INPUT_MEMBER(clock_r); void spacduel(machine_config &config); void gravitar(machine_config &config); void bwidowp(machine_config &config); @@ -33,15 +30,28 @@ public: void lunarbat(machine_config &config); void bwidow_audio(machine_config &config); void gravitar_audio(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(clock_r); +protected: + DECLARE_READ8_MEMBER(spacduel_IN3_r); + DECLARE_READ8_MEMBER(bwidowp_in_r); + DECLARE_WRITE8_MEMBER(bwidow_misc_w); + DECLARE_WRITE8_MEMBER(spacduel_coin_counter_w); + DECLARE_WRITE8_MEMBER(irq_ack_w); + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); + void bwidow_map(address_map &map); void bwidowp_map(address_map &map); void spacduel_map(address_map &map); -protected: virtual void machine_start() override { m_leds.resolve(); } + virtual void machine_reset() override; int m_lastdata; required_device m_maincpu; + required_device m_earom; optional_ioport m_in3; optional_ioport m_in4; optional_ioport m_dsw2; diff --git a/src/mame/includes/bzone.h b/src/mame/includes/bzone.h index b305818ef3a..345b23ef54f 100644 --- a/src/mame/includes/bzone.h +++ b/src/mame/includes/bzone.h @@ -11,6 +11,7 @@ #pragma once #include "audio/redbaron.h" +#include "machine/er2055.h" #include "machine/mathbox.h" #include "sound/discrete.h" @@ -59,6 +60,7 @@ class redbaron_state : public bzone_state public: redbaron_state(const machine_config &mconfig, device_type type, const char *tag) : bzone_state(mconfig, type, tag), + m_earom(*this, "earom"), m_redbaronsound(*this, "custom"), m_fake_ports(*this, "FAKE%u", 1U) { } @@ -68,12 +70,17 @@ public: protected: DECLARE_READ8_MEMBER(redbaron_joy_r); DECLARE_WRITE8_MEMBER(redbaron_joysound_w); + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); virtual void machine_start() override; + virtual void machine_reset() override; void redbaron_map(address_map &map); private: + required_device m_earom; required_device m_redbaronsound; required_ioport_array<2> m_fake_ports; uint8_t m_rb_input_select; diff --git a/src/mame/includes/centiped.h b/src/mame/includes/centiped.h index badd535148f..728f44d0b12 100644 --- a/src/mame/includes/centiped.h +++ b/src/mame/includes/centiped.h @@ -11,6 +11,7 @@ #pragma once #include "machine/eepromser.h" +#include "machine/er2055.h" #include "machine/timer.h" #include "sound/ay8910.h" #include "emupal.h" @@ -27,6 +28,7 @@ public: m_paletteram(*this, "paletteram"), m_bullsdrt_tiles_bankram(*this, "bullsdrt_bank"), m_maincpu(*this, "maincpu"), + m_earom(*this, "earom"), m_eeprom(*this, "eeprom"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), @@ -57,6 +59,7 @@ private: optional_shared_ptr m_bullsdrt_tiles_bankram; required_device m_maincpu; + optional_device m_earom; optional_device m_eeprom; required_device m_gfxdecode; required_device m_screen; @@ -89,6 +92,9 @@ private: DECLARE_WRITE_LINE_MEMBER(coin_counter_center_w); DECLARE_WRITE_LINE_MEMBER(coin_counter_right_w); DECLARE_WRITE_LINE_MEMBER(bullsdrt_coin_count_w); + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); DECLARE_READ8_MEMBER(caterplr_unknown_r); DECLARE_WRITE8_MEMBER(caterplr_AY8910_w); DECLARE_READ8_MEMBER(caterplr_AY8910_r); diff --git a/src/mame/includes/digdug.h b/src/mame/includes/digdug.h index 4f023bc6963..a9cc78f5b41 100644 --- a/src/mame/includes/digdug.h +++ b/src/mame/includes/digdug.h @@ -1,11 +1,14 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria +#include "machine/er2055.h" + class digdug_state : public galaga_state { public: digdug_state(const machine_config &mconfig, device_type type, const char *tag) : galaga_state(mconfig, type, tag), + m_earom(*this, "earom"), m_digdug_objram(*this, "digdug_objram"), m_digdug_posram(*this, "digdug_posram"), m_digdug_flpram(*this, "digdug_flpram") { } @@ -13,9 +16,8 @@ public: void dzigzag(machine_config &config); void digdug(machine_config &config); - DECLARE_CUSTOM_INPUT_MEMBER(shifted_port_r); - private: + required_device m_earom; required_shared_ptr m_digdug_objram; required_shared_ptr m_digdug_posram; required_shared_ptr m_digdug_flpram; @@ -24,6 +26,7 @@ private: uint8_t m_tx_color_mode; uint8_t m_bg_disable; uint8_t m_bg_color_bank; + TILEMAP_MAPPER_MEMBER(tilemap_scan); TILE_GET_INFO_MEMBER(bg_get_tile_info); TILE_GET_INFO_MEMBER(tx_get_tile_info); @@ -35,5 +38,11 @@ private: DECLARE_WRITE8_MEMBER(bg_select_w); DECLARE_WRITE_LINE_MEMBER(tx_color_mode_w); DECLARE_WRITE_LINE_MEMBER(bg_disable_w); + + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); + virtual void machine_start() override; + void digdug_map(address_map &map); }; diff --git a/src/mame/includes/runaway.h b/src/mame/includes/runaway.h index 1205065c186..08bf033c368 100644 --- a/src/mame/includes/runaway.h +++ b/src/mame/includes/runaway.h @@ -1,6 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Mike Balfour +#include "machine/er2055.h" #include "emupal.h" #include "screen.h" @@ -12,18 +13,24 @@ public: , m_video_ram(*this, "video_ram") , m_sprite_ram(*this, "sprite_ram") , m_maincpu(*this, "maincpu") + , m_earom(*this, "earom") , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_palette(*this, "palette") - , m_leds(*this, "led%u", 0U) { } + void qwak(machine_config &config); + void runaway(machine_config &config); + +protected: DECLARE_READ8_MEMBER(runaway_input_r); - DECLARE_WRITE8_MEMBER(runaway_led_w); DECLARE_WRITE8_MEMBER(runaway_irq_ack_w); + DECLARE_READ8_MEMBER(earom_read); + DECLARE_WRITE8_MEMBER(earom_write); + DECLARE_WRITE8_MEMBER(earom_control_w); DECLARE_WRITE8_MEMBER(runaway_paletteram_w); DECLARE_WRITE8_MEMBER(runaway_video_ram_w); - DECLARE_WRITE8_MEMBER(runaway_tile_bank_w); + DECLARE_WRITE_LINE_MEMBER(tile_bank_w); DECLARE_READ8_MEMBER(runaway_pot_r); TILE_GET_INFO_MEMBER(runaway_get_tile_info); TILE_GET_INFO_MEMBER(qwak_get_tile_info); @@ -31,11 +38,9 @@ public: uint32_t screen_update_runaway(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_qwak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(interrupt_callback); - void qwak(machine_config &config); - void runaway(machine_config &config); void runaway_map(address_map &map); + void qwak_map(address_map &map); -protected: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; @@ -46,8 +51,8 @@ protected: tilemap_t *m_bg_tilemap; int m_tile_bank; required_device m_maincpu; + optional_device m_earom; required_device m_gfxdecode; required_device m_screen; required_device m_palette; - output_finder<2> m_leds; }; diff --git a/src/mame/machine/asteroid.cpp b/src/mame/machine/asteroid.cpp index 7ea2b0e5408..8e24485a096 100644 --- a/src/mame/machine/asteroid.cpp +++ b/src/mame/machine/asteroid.cpp @@ -10,7 +10,6 @@ ***************************************************************************/ #include "emu.h" -#include "machine/atari_vg.h" #include "video/avgdvg.h" #include "includes/asteroid.h" @@ -132,7 +131,9 @@ void asteroid_state::machine_start() void asteroid_state::machine_reset() { - m_dvg->reset_w(m_maincpu->space(AS_PROGRAM), 0, 0); + m_dvg->reset_w(machine().dummy_space(), 0, 0); + if (m_earom.found()) + earom_control_w(machine().dummy_space(), 0, 0); /* reset RAM banks if present */ if (m_ram1.target() != nullptr) diff --git a/src/mame/machine/atari_vg.cpp b/src/mame/machine/atari_vg.cpp deleted file mode 100644 index 76281f54a23..00000000000 --- a/src/mame/machine/atari_vg.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles, Jonathan Gevaryahu -/*************************************************************************** - - General Instruments ER-2055 EAROM - 64 word x 8 bit Electrically Alterable Read Only Memory - - Atari often called this part "137161-001" on their technical manuals, - but their schematics usually called it by its proper ER-2055 name. - - Centipede, Millipede, Dig Dug CTRL port wiring: - 7 6 5 4 3 2 1 0 - x x x x | | | \-- EAROM CLK (directly connected) - x x x x | | \---- /EAROM C1 (note this is inverted! the value written here is inverted, then connected to EAROM C1 AND to the /OE of the 'input latch' which drive the EAROM bus when writing) - x x x x | \------ EAROM C2 (directly connected) - x x x x \-------- EAROM CS1 (positive enable, directly connected) - - Gravitar, Red Baron, Black Widow, Tempest, Liberator, Asteroids Deluxe, Runaway CTRL port wiring: - 7 6 5 4 3 2 1 0 - x x x x | | | \-- EAROM CLK (directly connected) - x x x x | | \---- EAROM C2 (directly connected) - x x x x | \------ /EAROM C1 (note this is inverted! the value written here is inverted, then connected to EAROM C1 AND to the /OE of the 'input latch' which drive the EAROM bus when writing) - x x x x \-------- EAROM CS1 (positive enable, directly connected) - -***************************************************************************/ - -#include "emu.h" -#include "atari_vg.h" - -#define ER2055_IDLE (0) -#define ER2055_READ_WAITING_FOR_CLOCK (1) -#define ER2055_READ_DRIVING_BUS (2) -#define ER2055_WRITING_BITS (3) -#define ER2055_ERASING_BITS (4) - - -// device type definition -DEFINE_DEVICE_TYPE(ATARIVGEAROM, atari_vg_earom_device, "atari_vg_earom", "Atari VG EAROM") - -//------------------------------------------------- -// atari_vg_earom_device - constructor -//------------------------------------------------- - -atari_vg_earom_device::atari_vg_earom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ATARIVGEAROM, tag, owner, clock), - device_nvram_interface(mconfig, *this) -{ -} - -// Activate the output buffer (LS244)'s /G1 and /G2 lines to read whatever is on the EAROM's output bus -READ8_MEMBER( atari_vg_earom_device::read ) -{ - logerror("read from earom output: %02x(%02x):%02x\n", m_in_offset, offset, m_out_data); - return (m_out_data); -} - -// Write to the address input (LS174) and data input (LS374) latches respectively -WRITE8_MEMBER( atari_vg_earom_device::write ) -{ - logerror("write to earom buffers: offset:data of %02x:%02x\n", offset, data); - m_in_offset = offset; - m_in_data = data; -} - -/* CTRL controls the CTRL latch (LS175): -See top of file: there are two possible wirings! - */ -WRITE8_MEMBER( atari_vg_earom_device::ctrl_w ) -{ - static const char *const er2055_State[5] = { "IDLE", "RD_WAIT", "RD_OUTPUT", "WRITE", "ERASE" }; - logerror("EAROM_CTRL written with %02x: ", data); - switch(data&0xe) - { - case 0x0: case 0x2: case 0x4: case 0x6: // CS was low, chip is idle - m_state = ER2055_IDLE; - break; - case 0x8: // C1 = 1, C2 = 0: Read, (wait for clock, if clock has arrived, idle). - if ((m_state==ER2055_READ_WAITING_FOR_CLOCK)&&(((m_old_ctrl&1)==0)&&((data&1)==1))) // rising clock edge? - m_state = ER2055_READ_DRIVING_BUS; - else if (m_state!=ER2055_READ_DRIVING_BUS) // if we're already driving the bus, stay driving it. otherwise we're still waiting. - m_state = ER2055_READ_WAITING_FOR_CLOCK; - break; - case 0xA: // C1 = 0, C2 = 0: Write (set gate 0 if the bit is a 0, set gate 1 if the bit is a 1) HACK: we treat this as WRITE always to handle both wiring variants - m_state = ER2055_WRITING_BITS; - break; - case 0xC: // C1 = 1, C2 = 1: Invalid // HACK: we treat this as WRITE always to handle both wiring variants - logerror("INVALID CTRL STATE!"); - m_state = ER2055_WRITING_BITS; - break; - case 0xE: // C1 = 0, C2 = 1: Erase (zero both gates for all bits of the current byte; byte will read as random garbage after this, different each time!) - m_state = ER2055_ERASING_BITS; - break; - } - logerror("state is now %s\n", er2055_State[m_state]); - - switch(m_state) - { - case ER2055_IDLE: // idle, do nothing. - case ER2055_READ_WAITING_FOR_CLOCK: // waiting for a clock rising edge which we haven't yet seen, do nothing - m_out_data = 0xFF; - break; - case ER2055_READ_DRIVING_BUS: // bus is being driven with data - m_out_data = m_rom[m_in_offset]; - break; - case ER2055_WRITING_BITS: // write contents of bus to rom - m_rom[m_in_offset] = m_in_data; - m_out_data = m_in_data; - break; - case ER2055_ERASING_BITS: // erase contents of rom - m_rom[m_in_offset] = 0; //TODO: this should actually set the rom contents to an invalid state which reads inconsistently until it is written to by a WRITE command - m_out_data = m_in_data; - break; - } - m_old_ctrl = data; -} - -//------------------------------------------------- -// nvram_default - called to initialize NVRAM to -// its default state -//------------------------------------------------- - -void atari_vg_earom_device::nvram_default() -{ - memset(m_rom,0,EAROM_SIZE); -} - -//------------------------------------------------- -// nvram_read - called to read NVRAM from the -// .nv file -//------------------------------------------------- - -void atari_vg_earom_device::nvram_read(emu_file &file) -{ - file.read(m_rom,EAROM_SIZE); -} - -//------------------------------------------------- -// nvram_write - called to write NVRAM to the -// .nv file -//------------------------------------------------- - -void atari_vg_earom_device::nvram_write(emu_file &file) -{ - file.write(m_rom,EAROM_SIZE); -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- -void atari_vg_earom_device::device_start() -{ - /* register for save states */ - save_item(NAME(m_state)); - save_item(NAME(m_old_ctrl)); - save_item(NAME(m_in_offset)); - save_item(NAME(m_in_data)); - save_item(NAME(m_out_data)); - save_item(NAME(m_rom)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void atari_vg_earom_device::device_reset() -{ - m_state = ER2055_READ_WAITING_FOR_CLOCK; // start in read mode - m_old_ctrl = 0; - m_in_offset = 0; - m_in_data = 0; - m_out_data = 0xFF; // the value driven to the bus by the resistors if EAROM is open bus -} diff --git a/src/mame/machine/atari_vg.h b/src/mame/machine/atari_vg.h deleted file mode 100644 index cc597a3b8a0..00000000000 --- a/src/mame/machine/atari_vg.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - Atari vector hardware - -***************************************************************************/ - -#ifndef MAME_MACHINE_ATARI_VG_H -#define MAME_MACHINE_ATARI_VG_H - -#pragma once - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_ATARIVGEAROM_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ATARIVGEAROM, 0) - - -#define EAROM_SIZE 0x40 - -// ======================> atari_vg_earom_device - -class atari_vg_earom_device : public device_t, - public device_nvram_interface -{ -public: - // construction/destruction - atari_vg_earom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE8_MEMBER( ctrl_w ); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - - // device_nvram_interface overrides - virtual void nvram_default() override; - virtual void nvram_read(emu_file &file) override; - virtual void nvram_write(emu_file &file) override; - -private: - int m_old_ctrl; - int m_state; - int m_in_offset; - int m_in_data; - int m_out_data; - char m_rom[EAROM_SIZE]; -}; - -// device type definition -DECLARE_DEVICE_TYPE(ATARIVGEAROM, atari_vg_earom_device) - -#endif // MAME_MACHINE_ATARI_VG_H diff --git a/src/mame/video/runaway.cpp b/src/mame/video/runaway.cpp index 65a4dd9a4c6..234355c3450 100644 --- a/src/mame/video/runaway.cpp +++ b/src/mame/video/runaway.cpp @@ -40,14 +40,14 @@ WRITE8_MEMBER(runaway_state::runaway_video_ram_w) -WRITE8_MEMBER(runaway_state::runaway_tile_bank_w) +WRITE_LINE_MEMBER(runaway_state::tile_bank_w) { - if ((data & 1) != m_tile_bank) + if (state != m_tile_bank) { m_bg_tilemap->mark_all_dirty(); } - m_tile_bank = data & 1; + m_tile_bank = state; }