From 48d67ae6be9a43730b17ca0d3cdfa55e7c81fb3c Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 24 Aug 2019 23:44:41 -0400 Subject: [PATCH] gameplan.cpp, trvquest.cpp: Use callblank to drive CA1 from VBLANK; eliminate some old-style overrides (nw) --- src/mame/drivers/gameplan.cpp | 3 -- src/mame/drivers/trvquest.cpp | 7 ----- src/mame/includes/gameplan.h | 14 +++------ src/mame/video/gameplan.cpp | 57 ++--------------------------------- 4 files changed, 7 insertions(+), 74 deletions(-) diff --git a/src/mame/drivers/gameplan.cpp b/src/mame/drivers/gameplan.cpp index 3d7ffd75385..8e63b24593b 100644 --- a/src/mame/drivers/gameplan.cpp +++ b/src/mame/drivers/gameplan.cpp @@ -970,9 +970,6 @@ void gameplan_state::gameplan(machine_config &config) m_riot->out_pb_callback().set(FUNC(gameplan_state::r6532_soundlatch_w)); m_riot->irq_callback().set(FUNC(gameplan_state::r6532_irq)); - MCFG_MACHINE_START_OVERRIDE(gameplan_state,gameplan) - MCFG_MACHINE_RESET_OVERRIDE(gameplan_state,gameplan) - /* video hardware */ gameplan_video(config); diff --git a/src/mame/drivers/trvquest.cpp b/src/mame/drivers/trvquest.cpp index adbbd0cf2f2..587e37b2ad5 100644 --- a/src/mame/drivers/trvquest.cpp +++ b/src/mame/drivers/trvquest.cpp @@ -172,17 +172,10 @@ MACHINE_RESET_MEMBER(gameplan_state,trvquest) m_video_data = 0; } -INTERRUPT_GEN_MEMBER(gameplan_state::trvquest_interrupt) -{ - m_via_2->write_ca1(1); - m_via_2->write_ca1(0); -} - void gameplan_state::trvquest(machine_config &config) { M6809(config, m_maincpu, XTAL(6'000'000)/4); m_maincpu->set_addrmap(AS_PROGRAM, &gameplan_state::cpu_map); - m_maincpu->set_vblank_int("screen", FUNC(gameplan_state::trvquest_interrupt)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); diff --git a/src/mame/includes/gameplan.h b/src/mame/includes/gameplan.h index 7acd9397a98..dcab096a92d 100644 --- a/src/mame/includes/gameplan.h +++ b/src/mame/includes/gameplan.h @@ -55,6 +55,10 @@ public: void trvquest(machine_config &config); void trvquest_video(machine_config &config); +protected: + virtual void video_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + private: /* machine state */ uint8_t m_current_port; @@ -67,7 +71,6 @@ private: uint8_t m_video_y; uint8_t m_video_command; uint8_t m_video_data; - emu_timer *m_via_0_ca1_timer; /* devices */ required_device m_maincpu; @@ -92,17 +95,10 @@ private: DECLARE_MACHINE_RESET(gameplan); DECLARE_MACHINE_START(trvquest); DECLARE_MACHINE_RESET(trvquest); - DECLARE_VIDEO_START(gameplan); - DECLARE_VIDEO_RESET(gameplan); - DECLARE_VIDEO_START(leprechn); - DECLARE_VIDEO_START(trvquest); - DECLARE_VIDEO_START(common); uint32_t screen_update_gameplan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_leprechn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(trvquest_interrupt); TIMER_CALLBACK_MEMBER(clear_screen_done_callback); TIMER_CALLBACK_MEMBER(via_irq_delayed); - TIMER_CALLBACK_MEMBER(via_0_ca1_timer_callback); DECLARE_WRITE8_MEMBER(video_data_w); DECLARE_WRITE8_MEMBER(gameplan_video_command_w); DECLARE_WRITE8_MEMBER(leprechn_video_command_w); @@ -119,6 +115,4 @@ private: void gameplan_audio_map(address_map &map); void gameplan_main_map(address_map &map); void leprechn_audio_map(address_map &map); - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; diff --git a/src/mame/video/gameplan.cpp b/src/mame/video/gameplan.cpp index 4a32b30d685..b7214ac02e2 100644 --- a/src/mame/video/gameplan.cpp +++ b/src/mame/video/gameplan.cpp @@ -47,9 +47,6 @@ void gameplan_state::device_timer(emu_timer &timer, device_timer_id id, int para case TIMER_VIA_IRQ_DELAYED: via_irq_delayed(ptr, param); break; - case TIMER_VIA_0_CAL: - via_0_ca1_timer_callback(ptr, param); - break; default: assert_always(false, "Unknown id in gameplan_state::device_timer"); } @@ -247,67 +244,22 @@ WRITE_LINE_MEMBER(gameplan_state::via_irq) } -TIMER_CALLBACK_MEMBER(gameplan_state::via_0_ca1_timer_callback) -{ - /* !VBLANK is connected to CA1 */ - m_via_0->write_ca1(param); - - if (param) - m_via_0_ca1_timer->adjust(m_screen->time_until_pos(VBSTART)); - else - m_via_0_ca1_timer->adjust(m_screen->time_until_pos(VBEND), 1); -} - - /************************************* * * Start * *************************************/ -VIDEO_START_MEMBER(gameplan_state,common) +void gameplan_state::video_start() { m_videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND); m_videoram = std::make_unique(m_videoram_size); - m_via_0_ca1_timer = timer_alloc(TIMER_VIA_0_CAL); - /* register for save states */ save_pointer(NAME(m_videoram), m_videoram_size); } -VIDEO_START_MEMBER(gameplan_state,gameplan) -{ - VIDEO_START_CALL_MEMBER(common); -} - - -VIDEO_START_MEMBER(gameplan_state,leprechn) -{ - VIDEO_START_CALL_MEMBER(common); -} - - -VIDEO_START_MEMBER(gameplan_state,trvquest) -{ - VIDEO_START_CALL_MEMBER(common); -} - - - -/************************************* - * - * Reset - * - *************************************/ - -VIDEO_RESET_MEMBER(gameplan_state,gameplan) -{ - m_via_0_ca1_timer->adjust(m_screen->time_until_pos(VBSTART)); -} - - /************************************* * @@ -317,23 +269,20 @@ VIDEO_RESET_MEMBER(gameplan_state,gameplan) void gameplan_state::gameplan_video(machine_config &config) { - MCFG_VIDEO_START_OVERRIDE(gameplan_state,gameplan) - MCFG_VIDEO_RESET_OVERRIDE(gameplan_state,gameplan) - SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(GAMEPLAN_PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART); m_screen->set_screen_update(FUNC(gameplan_state::screen_update_gameplan)); + m_screen->screen_vblank().set(m_via_0, FUNC(via6522_device::write_ca1)).invert(); // !VBLANK is connected to CA1 } void gameplan_state::leprechn_video(machine_config &config) { - MCFG_VIDEO_START_OVERRIDE(gameplan_state,leprechn) m_screen->set_screen_update(FUNC(gameplan_state::screen_update_leprechn)); } void gameplan_state::trvquest_video(machine_config &config) { gameplan_video(config); - MCFG_VIDEO_START_OVERRIDE(gameplan_state,trvquest) m_screen->set_screen_update(FUNC(gameplan_state::screen_update_gameplan)); + m_screen->screen_vblank().set(m_via_2, FUNC(via6522_device::write_ca1)); }