From a5a874ad9e645ee2f864b4fa2593163752381984 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 1 Aug 2018 23:52:11 -0400 Subject: efdt: Various things (nw) - Use line callback instead of VBLANK_INT and acknowledge interrupt - Use (likely) addressable latches instead of pointers to (fake?) RAM - Add watchdog timer - Clean up audio CPU ROM region length --- src/mame/drivers/efdt.cpp | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'src/mame/drivers/efdt.cpp') diff --git a/src/mame/drivers/efdt.cpp b/src/mame/drivers/efdt.cpp index 78c113c60cc..7a6bfbb2280 100644 --- a/src/mame/drivers/efdt.cpp +++ b/src/mame/drivers/efdt.cpp @@ -162,6 +162,7 @@ #include "includes/efdt.h" #include "cpu/z80/z80.h" #include "cpu/m6800/m6800.h" +#include "machine/watchdog.h" #include "sound/ay8910.h" #include "screen.h" #include "speaker.h" @@ -229,12 +230,22 @@ VIDEO_START_MEMBER(efdt_state, efdt) m_tilemap[1]->set_transparent_pen(0); } -uint32_t efdt_state::screen_update_efdt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +WRITE_LINE_MEMBER(efdt_state::vblank_nmi_w) { - int bank = m_vregs1[7]; + if (state && m_vlatch[0]->q0_r()) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + +WRITE_LINE_MEMBER(efdt_state::nmi_clear_w) +{ + if (!state) + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); +} - if (m_vregs1[4] != 0xff) //startup tests require tile bank 1, but 0 is set to the vregs (reset sets it to 1?) - bank = 1; +uint32_t efdt_state::screen_update_efdt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int bank = m_vlatch[0]->q7_r() | (m_vlatch[1]->q0_r() << 1) | (m_vlatch[1]->q1_r() << 2); + //startup tests require tile bank 1, but 0 is set to the vregs (reset sets it to 1?) m_tilebank = bank << 8; @@ -336,7 +347,7 @@ uint32_t efdt_state::screen_update_efdt(screen_device &screen, bitmap_ind16 &bit void efdt_state::efdt_map(address_map &map) { - map(0x0000, 0x7fff).rom(); + map(0x0000, 0x7fff).rom().region("maincpu", 0); map(0x8000, 0x87ff).ram(); map(0x8800, 0x8803).rw(FUNC(efdt_state::main_soundlatch_r), FUNC(efdt_state::main_soundlatch_w)); @@ -346,13 +357,16 @@ void efdt_state::efdt_map(address_map &map) map(0x9400, 0x97ff).portr("P2"); map(0xa000, 0xafff).ram().share("videoram"); - map(0xb400, 0xb40f).ram().share("vregs1"); - map(0xb800, 0xb80f).ram().share("vregs2"); + map(0xb000, 0xb000).r("watchdog", FUNC(watchdog_timer_device::reset_r)); + map(0xb400, 0xb407).w(m_vlatch[0], FUNC(ls259_device::write_d0)); + map(0xb800, 0xb807).w(m_vlatch[1], FUNC(ls259_device::write_d0)); } void efdt_state::efdt_snd_map(address_map &map) { map(0x0000, 0x007f).ram(); + map(0x6000, 0x6000).nopw(); + map(0x7000, 0x7000).nopw(); map(0x8000, 0x83ff).ram(); map(0x9000, 0x9000).rw("ay1", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w)); @@ -361,7 +375,7 @@ void efdt_state::efdt_snd_map(address_map &map) map(0x9400, 0x9400).rw("ay2", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w)); map(0x9600, 0x9600).w("ay2", FUNC(ay8910_device::address_w)); - map(0xe000, 0xffff).rom(); + map(0xe000, 0xffff).rom().region("audiocpu", 0); } @@ -537,12 +551,18 @@ MACHINE_CONFIG_START( efdt_state::efdt ) /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, Z80_CLOCK) MCFG_DEVICE_PROGRAM_MAP(efdt_map) - MCFG_DEVICE_VBLANK_INT_DRIVER("screen", efdt_state, nmi_line_pulse) MCFG_DEVICE_ADD("audiocpu", M6802, F6802_CLOCK) MCFG_DEVICE_PROGRAM_MAP(efdt_snd_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(efdt_state, irq0_line_hold, F6802_CLOCK / 8192) + LS259(config, m_vlatch[0]); + m_vlatch[0]->q_out_cb<0>().set(FUNC(efdt_state::nmi_clear_w)); + + LS259(config, m_vlatch[1]); + + WATCHDOG_TIMER(config, "watchdog"); + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -551,6 +571,7 @@ MACHINE_CONFIG_START( efdt_state::efdt ) MCFG_SCREEN_VISIBLE_AREA(0, 32*8 - 1, 16, 30*8 - 1) MCFG_SCREEN_UPDATE_DRIVER(efdt_state, screen_update_efdt) MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, efdt_state, vblank_nmi_w)) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_efdt) MCFG_PALETTE_ADD("palette", 64) @@ -591,9 +612,9 @@ ROM_START( efdt ) ROM_LOAD( "22801.a10", 0x4000, 0x1000, CRC(ea646049) SHA1(bca30cb2dde8b5c78f6108cb9a43e0dce697f761)) ROM_LOAD( "22802.a9", 0x5000, 0x1000, CRC(74457952) SHA1(f5f4ece564cbdb650204ccd5abdf39d0d3c595b3)) - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "1811.d8", 0xE000, 0x1000, CRC(0ff5d0c2) SHA1(93df487d3236284765dd3d690474c130464e3e27)) - ROM_LOAD( "1812.d7", 0xF000, 0x1000, CRC(48e5a4ac) SHA1(9da4800215c91b2be9df3375f9601b19353c0ec0)) + ROM_REGION( 0x2000, "audiocpu", 0 ) + ROM_LOAD( "1811.d8", 0x0000, 0x1000, CRC(0ff5d0c2) SHA1(93df487d3236284765dd3d690474c130464e3e27)) + ROM_LOAD( "1812.d7", 0x1000, 0x1000, CRC(48e5a4ac) SHA1(9da4800215c91b2be9df3375f9601b19353c0ec0)) ROM_REGION( 0x9000, "gfx1", 0 ) ROM_LOAD( "12822.j3", 0x2000, 0x1000, CRC(f4d28a60) SHA1(bc1d7f4392805cd204ecfe9c3301990a7b710567) ) -- cgit v1.2.3