From c72791ff69685e4a38cfe0b93ce9da3a75b134d0 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 14 Sep 2019 21:47:32 -0400 Subject: dp8350: Apply some subtle timing fixes; save one more variable --- src/devices/video/dp8350.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/devices/video/dp8350.cpp b/src/devices/video/dp8350.cpp index 4443b58348b..bf77c913f89 100644 --- a/src/devices/video/dp8350.cpp +++ b/src/devices/video/dp8350.cpp @@ -178,7 +178,10 @@ dp835x_a_device::dp835x_a_device(const machine_config &mconfig, const char *tag, void dp835x_device::device_config_complete() { - if (has_screen() && screen().refresh_attoseconds() == 0) + if (!has_screen()) + return; + + if (screen().refresh_attoseconds() == 0) { int lines_per_frame = m_video_scan_lines + m_vblank_interval[m_60hz_refresh ? 1 : 0]; if (m_half_shift) @@ -227,6 +230,7 @@ void dp835x_device::device_start() save_item(NAME(m_rsr)); save_item(NAME(m_cr)); save_item(NAME(m_row_start)); + save_item(NAME(m_line)); } @@ -475,7 +479,7 @@ TIMER_CALLBACK_MEMBER(dp835x_device::hblank_start) m_lrc_callback(0); // increment line counter or reset it - if (m_lc < m_char_height - 1 && m_line != lines_per_frame - m_char_height) + if (m_lc < m_char_height - 1 && m_line != lines_per_frame - m_char_height - 1) m_lc++; else { @@ -492,17 +496,6 @@ TIMER_CALLBACK_MEMBER(dp835x_device::hblank_start) bool lbre = m_lc != (m_cgpi ? 0 : m_char_height - 1); m_lbre_callback(lbre ? 1 : 0); - if (m_line >= lines_per_frame - m_char_height && m_line < lines_per_frame) - { - m_row_start = m_rsr = m_topr; - } - else if (!lbre || m_line >= m_video_scan_lines) - { - // calculate starting address of next row (address counter runs continuously during VBLANK) - m_row_start = m_rsr; - m_rsr = (m_row_start + m_chars_per_row) & 0xfff; - } - // update vertical blanking output if (m_line == m_video_scan_lines) m_vblank_callback(m_vblank_active); @@ -531,6 +524,18 @@ TIMER_CALLBACK_MEMBER(dp835x_device::hblank_near_end) m_lrc_callback(1); if (m_lc == 0) m_clc_callback(1); + + int last_line = m_video_scan_lines + m_vblank_interval[m_60hz_refresh ? 1 : 0] - (m_cgpi ? 0 : 1); + if (m_line >= last_line - m_char_height && m_line < last_line) + { + m_row_start = m_rsr = m_topr; + } + else if (m_lc == (m_cgpi ? 0 : m_char_height - 1) || m_line >= m_video_scan_lines) + { + // calculate starting address of next row (address counter runs continuously during VBLANK) + m_row_start = m_rsr; + m_rsr = (m_row_start + m_chars_per_row) & 0xfff; + } } -- cgit v1.2.3