summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/x68k_crtc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/x68k_crtc.cpp')
-rw-r--r--src/mame/video/x68k_crtc.cpp73
1 files changed, 14 insertions, 59 deletions
diff --git a/src/mame/video/x68k_crtc.cpp b/src/mame/video/x68k_crtc.cpp
index b3dd9bb62fb..3792ae68b4a 100644
--- a/src/mame/video/x68k_crtc.cpp
+++ b/src/mame/video/x68k_crtc.cpp
@@ -152,18 +152,14 @@ void x68k_crtc_device::refresh_mode()
{
// Calculate data from register values
m_vmultiple = 1;
- if ((m_reg[20] & 0x10) != 0 && (m_reg[20] & 0x0c) == 0)
- m_vmultiple = 2; // 31.5kHz + 256 lines = doublescan
if (m_interlace)
m_vmultiple = 0.5f; // 31.5kHz + 1024 lines or 15kHz + 512 lines = interlaced
m_htotal = (m_reg[0] + 1) * 8;
m_vtotal = (m_reg[4] + 1) / m_vmultiple; // default is 567 (568 scanlines)
m_hbegin = (m_reg[2] * 8) + 1;
- m_hend = (m_reg[3] * 8);
- m_vbegin = (m_reg[6]) / m_vmultiple;
+ m_hend = m_reg[3] * 8;
+ m_vbegin = m_reg[6] / m_vmultiple;
m_vend = (m_reg[7] - 1) / m_vmultiple;
- if ((m_vmultiple == 2) && !(m_reg[7] & 1)) // otherwise if the raster irq line == vblank line, the raster irq fires too late
- m_vend++;
m_hsync_end = (m_reg[1]) * 8;
m_vsync_end = (m_reg[5]) / m_vmultiple;
m_hsyncadjust = m_reg[8];
@@ -193,8 +189,8 @@ void x68k_crtc_device::refresh_mode()
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] & 0x0c) == 0)
- div *= 2;
+ if (!(m_reg[20] & 0x1f))
+ div = 8;
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());
@@ -211,59 +207,18 @@ TIMER_CALLBACK_MEMBER(x68k_crtc_device::hsync)
if (m_operation & 8)
text_copy((m_reg[22] & 0xff00) >> 8, (m_reg[22] & 0x00ff), (m_reg[21] & 0xf));
- if (m_vmultiple == 2) // 256-line (doublescan)
+ if (hstate == 1)
{
- if (hstate == 1)
- {
- if (m_oddscanline)
- {
- int scan = screen().vpos();
- hsync_time = screen().time_until_pos(scan, (m_htotal + m_hend) / 2);
- m_scanline_timer->adjust(hsync_time);
- if ((scan != 0) && (scan < m_vend))
- screen().update_partial(scan - 1);
- }
- else
- {
- int scan = screen().vpos();
- hsync_time = screen().time_until_pos(scan, m_hend / 2);
- m_scanline_timer->adjust(hsync_time);
- if ((scan != 0) && (scan < m_vend))
- screen().update_partial(scan - 1);
- }
- }
- if (hstate == 0)
- {
- if (m_oddscanline)
- {
- int scan = screen().vpos() + 1;
- hsync_time = screen().time_until_pos(scan, m_hbegin / 2);
- m_scanline_timer->adjust(hsync_time, 1);
- m_oddscanline = false;
- }
- else
- {
- hsync_time = screen().time_until_pos(screen().vpos(), (m_htotal + m_hbegin) / 2);
- m_scanline_timer->adjust(hsync_time, 1);
- m_oddscanline = true;
- }
- }
+ int scan = screen().vpos();
+ hsync_time = screen().time_until_pos(scan, m_hend);
+ m_scanline_timer->adjust(hsync_time);
+ if ((scan != 0) && (scan < m_vend))
+ screen().update_partial(scan - 1);
}
- else // 512-line
+ if (hstate == 0)
{
- if (hstate == 1)
- {
- int scan = screen().vpos();
- hsync_time = screen().time_until_pos(scan, m_hend);
- m_scanline_timer->adjust(hsync_time);
- if ((scan != 0) && (scan < m_vend))
- screen().update_partial(scan - 1);
- }
- if (hstate == 0)
- {
- hsync_time = screen().time_until_pos(screen().vpos() + 1, m_hbegin);
- m_scanline_timer->adjust(hsync_time, 1);
- }
+ hsync_time = screen().time_until_pos(screen().vpos() + 1, m_hbegin);
+ m_scanline_timer->adjust(hsync_time, 1);
}
}
@@ -390,7 +345,7 @@ void x68k_crtc_device::crtc_w(offs_t offset, u16 data, u16 mem_mask)
attotime irq_time = attotime::zero;
if ((data / m_vmultiple) != screen().vpos())
{
- irq_time = screen().time_until_pos((data) / m_vmultiple,2);
+ irq_time = screen().time_until_pos((data - 1) / m_vmultiple,2);
m_rint_callback(1);
}
m_raster_irq_timer->adjust(irq_time, (data) / m_vmultiple);