From ada3d35a54f7456b9ee3167df8e355eefb6c8471 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 4 Apr 2018 13:40:37 -0400 Subject: [PATCH] imolagp: Use two-dimensional output finder (nw) --- src/mame/drivers/imolagp.cpp | 26 +++++++++++----- src/mame/layout/imolagp.lay | 60 ++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/mame/drivers/imolagp.cpp b/src/mame/drivers/imolagp.cpp index ba953c04470..853111e2961 100644 --- a/src/mame/drivers/imolagp.cpp +++ b/src/mame/drivers/imolagp.cpp @@ -98,13 +98,15 @@ public: m_maincpu(*this, "maincpu"), m_slavecpu(*this, "slave"), m_steer_pot_timer(*this, "pot"), - m_steer_inp(*this, "STEER") + m_steer_inp(*this, "STEER"), + m_digits(*this, "digit%u%u", 0U, 0U) { } required_device m_maincpu; required_device m_slavecpu; required_device m_steer_pot_timer; required_ioport m_steer_inp; + output_finder<5, 6> m_digits; uint8_t m_videoram[2][0x4000]; // 2 layers of 16KB uint8_t m_comms_latch[2]; @@ -124,7 +126,7 @@ public: DECLARE_WRITE8_MEMBER(vreg_control_w); DECLARE_WRITE8_MEMBER(vreg_data_w); DECLARE_CUSTOM_INPUT_MEMBER(imolagp_steerlatch_r); - INTERRUPT_GEN_MEMBER(slave_vblank_irq); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); TIMER_DEVICE_CALLBACK_MEMBER(imolagp_pot_callback); virtual void machine_start() override; @@ -228,10 +230,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(imolagp_state::imolagp_pot_callback) m_steer_pot_timer->adjust(attotime::from_msec(20)); } -INTERRUPT_GEN_MEMBER(imolagp_state::slave_vblank_irq) +WRITE_LINE_MEMBER(imolagp_state::vblank_irq) { - m_scroll = m_vreg[0xe]; // latch scroll - device.execute().set_input_line(0, HOLD_LINE); + if (state) + { + m_scroll = m_vreg[0xe]; // latch scroll + m_maincpu->set_input_line(0, HOLD_LINE); + m_slavecpu->set_input_line(0, HOLD_LINE); + } } @@ -270,7 +276,10 @@ WRITE8_MEMBER(imolagp_state::imola_led_board_w) static const uint8_t ls48_map[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 }; - output().set_digit_value(offset, ls48_map[data & 0x0f]); + int i = offset >> 3; + int j = offset & 7; + if (i < 5 && j < 6) + m_digits[i][j] = ls48_map[data & 0x0f]; /* score: 0, 1, 2, 3 time: 4, 5 @@ -478,6 +487,8 @@ INPUT_PORTS_END void imolagp_state::machine_start() { + m_digits.resolve(); + save_item(NAME(m_vcontrol)); save_item(NAME(m_vreg)); save_item(NAME(m_scroll)); @@ -500,13 +511,11 @@ MACHINE_CONFIG_START(imolagp_state::imolagp) MCFG_CPU_ADD("maincpu", Z80, 3000000) // ? (assume slower than slave) MCFG_CPU_PROGRAM_MAP(imolagp_master_map) MCFG_CPU_IO_MAP(imolagp_master_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", imolagp_state, irq0_line_hold) MCFG_TIMER_DRIVER_ADD("pot", imolagp_state, imolagp_pot_callback) // maincpu nmi MCFG_CPU_ADD("slave", Z80, 4000000) // ? MCFG_CPU_PROGRAM_MAP(imolagp_slave_map) MCFG_CPU_IO_MAP(imolagp_slave_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", imolagp_state, slave_vblank_irq) MCFG_QUANTUM_PERFECT_CPU("maincpu") @@ -526,6 +535,7 @@ MACHINE_CONFIG_START(imolagp_state::imolagp) MCFG_SCREEN_UPDATE_DRIVER(imolagp_state, screen_update_imolagp) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(imolagp_state, vblank_irq)) MCFG_PALETTE_ADD("palette", 0x20) MCFG_PALETTE_INIT_OWNER(imolagp_state, imolagp) diff --git a/src/mame/layout/imolagp.lay b/src/mame/layout/imolagp.lay index dfe1b69dffa..2da9c26a45e 100644 --- a/src/mame/layout/imolagp.lay +++ b/src/mame/layout/imolagp.lay @@ -286,16 +286,16 @@ - + - + - + - + @@ -322,17 +322,17 @@ - + - + - + - + @@ -365,10 +365,10 @@ - + - + @@ -388,16 +388,16 @@ - + - + - + - + @@ -407,16 +407,16 @@ - + - + - + - + @@ -426,16 +426,16 @@ - + - + - + - + @@ -445,16 +445,16 @@ - + - + - + - + @@ -464,16 +464,16 @@ - + - + - + - +