mirror of
https://github.com/holub/mame
synced 2025-10-08 09:30:17 +03:00
dotrikun: try another method for video timing
This commit is contained in:
parent
c2d6daa908
commit
bd83f8edd7
@ -39,12 +39,14 @@ public:
|
|||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag),
|
||||||
m_maincpu(*this, "maincpu"),
|
m_maincpu(*this, "maincpu"),
|
||||||
m_screen(*this, "screen"),
|
m_screen(*this, "screen"),
|
||||||
m_vram(*this, "vram")
|
m_vram(*this, "vram"),
|
||||||
|
m_scanline_off_timer(*this, "scanline_off")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
required_shared_ptr<UINT8> m_vram;
|
required_shared_ptr<UINT8> m_vram;
|
||||||
|
required_device<timer_device> m_scanline_off_timer;
|
||||||
|
|
||||||
UINT8 m_vram_latch;
|
UINT8 m_vram_latch;
|
||||||
UINT8 m_color;
|
UINT8 m_color;
|
||||||
@ -52,12 +54,32 @@ public:
|
|||||||
DECLARE_WRITE8_MEMBER(vram_w);
|
DECLARE_WRITE8_MEMBER(vram_w);
|
||||||
DECLARE_WRITE8_MEMBER(color_w);
|
DECLARE_WRITE8_MEMBER(color_w);
|
||||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
INTERRUPT_GEN_MEMBER(interrupt);
|
TIMER_DEVICE_CALLBACK_MEMBER(scanline_on);
|
||||||
|
TIMER_DEVICE_CALLBACK_MEMBER(scanline_off);
|
||||||
|
|
||||||
virtual void machine_start() override;
|
virtual void machine_start() override;
|
||||||
virtual void machine_reset() override;
|
virtual void machine_reset() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TIMER_DEVICE_CALLBACK_MEMBER(dotrikun_state::scanline_off)
|
||||||
|
{
|
||||||
|
m_maincpu->set_unscaled_clock(XTAL_4MHz);
|
||||||
|
}
|
||||||
|
|
||||||
|
TIMER_DEVICE_CALLBACK_MEMBER(dotrikun_state::scanline_on)
|
||||||
|
{
|
||||||
|
// on vram fetch(every 8 pixels during active display), z80 is stalled for 2 clocks
|
||||||
|
if (param >= 0 && param < 192)
|
||||||
|
{
|
||||||
|
m_maincpu->set_unscaled_clock(XTAL_4MHz * 0.75);
|
||||||
|
m_scanline_off_timer->adjust(m_screen->time_until_pos(param, 128), param);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vblank interrupt
|
||||||
|
else if (param == 192)
|
||||||
|
generic_pulse_irq_line(m_maincpu, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
@ -87,12 +109,9 @@ UINT32 dotrikun_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
|
|||||||
{
|
{
|
||||||
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
|
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
|
||||||
{
|
{
|
||||||
|
// vram fetch
|
||||||
if ((x & 7) == 0)
|
if ((x & 7) == 0)
|
||||||
{
|
|
||||||
// on vram fetch(every 8 pixels during active display), z80 is stalled for 2 clocks
|
|
||||||
m_maincpu->adjust_icount(-2);
|
|
||||||
m_vram_latch = m_vram[x >> 3 | y >> 1 << 4];
|
m_vram_latch = m_vram[x >> 3 | y >> 1 << 4];
|
||||||
}
|
|
||||||
|
|
||||||
bitmap.pix16(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3;
|
bitmap.pix16(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3;
|
||||||
}
|
}
|
||||||
@ -145,11 +164,6 @@ INPUT_PORTS_END
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
INTERRUPT_GEN_MEMBER(dotrikun_state::interrupt)
|
|
||||||
{
|
|
||||||
generic_pulse_irq_line(m_maincpu, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dotrikun_state::machine_start()
|
void dotrikun_state::machine_start()
|
||||||
{
|
{
|
||||||
save_item(NAME(m_vram_latch));
|
save_item(NAME(m_vram_latch));
|
||||||
@ -168,7 +182,8 @@ static MACHINE_CONFIG_START( dotrikun, dotrikun_state )
|
|||||||
MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz)
|
MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz)
|
||||||
MCFG_CPU_PROGRAM_MAP(dotrikun_map)
|
MCFG_CPU_PROGRAM_MAP(dotrikun_map)
|
||||||
MCFG_CPU_IO_MAP(io_map)
|
MCFG_CPU_IO_MAP(io_map)
|
||||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", dotrikun_state, interrupt)
|
MCFG_TIMER_DRIVER_ADD_SCANLINE("scanline_on", dotrikun_state, scanline_on, "screen", 0, 1)
|
||||||
|
MCFG_TIMER_DRIVER_ADD("scanline_off", dotrikun_state, scanline_off)
|
||||||
|
|
||||||
/* video hardware */
|
/* video hardware */
|
||||||
MCFG_SCREEN_ADD("screen", RASTER)
|
MCFG_SCREEN_ADD("screen", RASTER)
|
||||||
|
Loading…
Reference in New Issue
Block a user