mirror of
https://github.com/holub/mame
synced 2025-04-16 21:44:32 +03:00
gameplan.cpp, trvquest.cpp: Use callblank to drive CA1 from VBLANK; eliminate some old-style overrides (nw)
This commit is contained in:
parent
7031c31c00
commit
48d67ae6be
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<cpu_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;
|
||||
};
|
||||
|
@ -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<uint8_t[]>(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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user