From f68748ee6e533e967ff072601191bed7b25411f6 Mon Sep 17 00:00:00 2001 From: cracyc Date: Sat, 29 May 2021 11:10:48 -0500 Subject: x68k: adjust special priority mode and screen timings hd63450: correctly add link chain mode --- src/devices/machine/hd63450.cpp | 13 +++++++++++-- src/mame/video/x68k.cpp | 3 ++- src/mame/video/x68k_crtc.cpp | 28 +++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/devices/machine/hd63450.cpp b/src/devices/machine/hd63450.cpp index 5787dde4b3b..27ef55487f1 100644 --- a/src/devices/machine/hd63450.cpp +++ b/src/devices/machine/hd63450.cpp @@ -279,7 +279,7 @@ void hd63450_device::dma_transfer_start(int channel) m_reg[channel].csr &= ~0xe0; m_reg[channel].csr |= 0x08; // Channel active m_reg[channel].csr &= ~0x30; // Reset Error and Normal termination bits - if ((m_reg[channel].ocr & 0x0c) != 0x00) // Array chain or Link array chain + if ((m_reg[channel].ocr & 0x0c) == 0x08) // Array chain { m_reg[channel].mar = space.read_word(m_reg[channel].bar) << 16; m_reg[channel].mar |= space.read_word(m_reg[channel].bar+2); @@ -287,6 +287,15 @@ void hd63450_device::dma_transfer_start(int channel) if (m_reg[channel].btc > 0) m_reg[channel].btc--; } + else if ((m_reg[channel].ocr & 0x0c) == 0x0c) // Link array chain + { + u32 bar = m_reg[channel].bar; + m_reg[channel].mar = space.read_word(bar) << 16; + m_reg[channel].mar |= space.read_word(bar+2); + m_reg[channel].mtc = space.read_word(bar+4); + m_reg[channel].bar = space.read_word(bar+6) << 16; + m_reg[channel].bar |= space.read_word(bar+8); + } // Burst transfers will halt the CPU until the transfer is complete if ((m_reg[channel].dcr & 0xc0) == 0x00) // Burst transfer @@ -469,7 +478,7 @@ void hd63450_device::single_transfer(int x) m_reg[x].mar |= space.read_word(bar+2); m_reg[x].mtc = space.read_word(bar+4); m_reg[x].bar = space.read_word(bar+6) << 16; - m_reg[x].bar |= space.read_word(bar+10); + m_reg[x].bar |= space.read_word(bar+8); return; } else if (m_reg[x].ccr & 0x40) diff --git a/src/mame/video/x68k.cpp b/src/mame/video/x68k.cpp index 07f8e8579b8..f0d7303f134 100644 --- a/src/mame/video/x68k.cpp +++ b/src/mame/video/x68k.cpp @@ -809,7 +809,8 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { colour = m_special.pix(scanline / divisor, pixel) & 0xff; - if(colour) + // XXX: this might check the pen color not the palette index + if(colour & ~1) bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour & ~1); } } diff --git a/src/mame/video/x68k_crtc.cpp b/src/mame/video/x68k_crtc.cpp index 5fa05e74499..a5f0131da62 100644 --- a/src/mame/video/x68k_crtc.cpp +++ b/src/mame/video/x68k_crtc.cpp @@ -186,11 +186,29 @@ void x68k_crtc_device::refresh_mode() // LOG("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i\n", m_reg[0], m_reg[1], m_reg[2], m_reg[3], // m_reg[4], m_reg[5], m_reg[6], m_reg[7], m_reg[8], m_reg[9]); - unsigned div = (m_reg[20] & 0x03) == 0 ? 4 : 2; - if (BIT(m_reg[20], 4) && !BIT(m_reg[20], 1)) - div = BIT(m_reg[20], 0) ? 3 : 6; - if (!(m_reg[20] & 0x1f)) - div = 8; + int div; + switch (m_reg[20] & 0x1f) + { + case 0: + div = 8; + break; + default: + logerror("Invalid mode %d", m_reg[20] & 0x1f); [[fallthrough]]; + case 1: + case 5: + div = 4; + break; + case 0x16: + div = 2; + break; + case 0x10: + div = 6; + break; + case 0x11: + case 0x15: + div = 3; + break; + } attotime refresh = attotime::from_hz((BIT(m_reg[20], 4) ? clock_69m() : clock_39m()) / div) * (scr.max_x * scr.max_y); LOG("screen().configure(%i,%i,[%i,%i,%i,%i],%f)\n", scr.max_x, scr.max_y, visiblescr.min_x, visiblescr.min_y, visiblescr.max_x, visiblescr.max_y, refresh.as_hz()); screen().configure(scr.max_x, scr.max_y, visiblescr, refresh.as_attoseconds()); -- cgit v1.2.3