ygv608.cpp: fix CRTC vblank period, fixes NCV2: Dig Dug Original regression [Angelo Salese]

This commit is contained in:
angelosa 2017-09-28 03:45:18 +02:00
parent d77fd4db55
commit 80956d2011
2 changed files with 8 additions and 4 deletions

View File

@ -209,6 +209,8 @@ static ADDRESS_MAP_START( abcheck_map, AS_PROGRAM, 16, namcond1_state )
AM_RANGE(0x400000, 0x40ffff) AM_RAM AM_SHARE("shared_ram")
AM_RANGE(0x600000, 0x607fff) AM_RAM AM_SHARE("zpr1")
AM_RANGE(0x608000, 0x60ffff) AM_RAM AM_SHARE("zpr2")
AM_RANGE(0x700000, 0x700001) AM_WRITENOP
AM_RANGE(0x740000, 0x740001) AM_WRITENOP
AM_RANGE(0x780000, 0x780001) AM_READ(printer_r)
AM_RANGE(0x800000, 0x80000f) AM_DEVICE8("ygv608", ygv608_device, port_map, 0xff00)
AM_RANGE(0xa00000, 0xa00fff) AM_DEVREADWRITE8("at28c16", at28c16_device, read, write, 0xff00)

View File

@ -2089,7 +2089,7 @@ WRITE8_MEMBER( ygv608_device::crtc_w )
int new_display_width = (data & 0x3f) * 16;
m_crtc.htotal &= ~0x600;
m_crtc.htotal |= (data & 0xc0) << 3;
m_crtc.htotal |= ((data & 0xc0) << 3);
if(new_display_width != m_crtc.display_width)
m_screen_resize = 1;
@ -2108,7 +2108,7 @@ WRITE8_MEMBER( ygv608_device::crtc_w )
case 42:
{
m_crtc.htotal &= ~0x1fe;
m_crtc.htotal |= (data & 0xff) << 1;
m_crtc.htotal |= ((data & 0xff) << 1);
//printf("H %d %d %d %d %d\n",m_crtc.htotal,m_crtc.display_hstart,m_crtc.display_width,m_crtc.display_hsync,m_crtc.border_width);
break;
@ -2148,7 +2148,7 @@ WRITE8_MEMBER( ygv608_device::crtc_w )
{
m_crtc.vtotal &= ~0xff;
m_crtc.vtotal |= data & 0xff;
// TODO: call it for all mods in the CRTC, add sanity checks
screen_configure();
@ -2170,7 +2170,9 @@ void ygv608_device::screen_configure()
//rectangle visarea(m_crtc.display_hstart, display_hend, m_crtc.display_vstart, display_vend);
rectangle visarea(0, display_hend, 0, display_vend);
attoseconds_t period = HZ_TO_ATTOSECONDS(m_screen->clock()) * m_crtc.vtotal * (m_crtc.htotal / 2);
// TODO: Dig Dug Original wants this to be 60.60 Hz (like original Namco HW), lets compensate somehow
// (clock is really 6144000 x 8 = 49152000, so it must have same parameters in practice)
attoseconds_t period = HZ_TO_ATTOSECONDS(m_screen->clock()) * (m_crtc.vtotal + m_crtc.display_vsync) * ((m_crtc.htotal + 12 - m_crtc.display_hsync) / 2);
m_screen->configure(m_crtc.htotal / 2, m_crtc.vtotal, visarea, period );