mirror of
https://github.com/holub/mame
synced 2025-06-29 23:48:56 +03:00
(MESS) maria.c: improved DMA accuracy. [Mike Saarna, Robert Tuccitto]
- Last Line DMA value corrected to 6. GCC and Atari docs both show a difference between Other Line and Last Line as +6 at the lowest part of the range. - Blank scanlines are drawn when DMA is off, like real hardware. - If MARIA hits the DMA limit, the CPU doesn't run until the next scanline.
This commit is contained in:
parent
0ed3636613
commit
9f7b18a05c
@ -4,7 +4,16 @@
|
||||
|
||||
|
||||
- some history:
|
||||
2014-10-03 Mike Saarna, Robert Tuccitto reorganized DMA penalties to
|
||||
2014-10-05 Mike Saarna, Robert Tuccitto Last Line DMA value corrected
|
||||
to 6. GCC and Atari docs both show a difference between
|
||||
Other Line and Last Line as +6 at the lowest part of the
|
||||
range.
|
||||
Blank scanlines are drawn when DMA is off, like real
|
||||
hardware.
|
||||
If MARIA hits the DMA limit, the CPU doesn't run until
|
||||
the next scanline.
|
||||
|
||||
2014-09-03 Mike Saarna, Robert Tuccitto reorganized DMA penalties to
|
||||
support new rendering timeout code.
|
||||
|
||||
2014-08-29 Mike Saarna Timeout rendering added.
|
||||
@ -165,18 +174,22 @@ void atari_maria_device::draw_scanline()
|
||||
int d, c, pixel_cell, cells;
|
||||
int maria_cycles;
|
||||
|
||||
cells = 0;
|
||||
|
||||
if(m_dmaon)
|
||||
{
|
||||
// All lines in a zone have the same initial DMA startup time. We'll adjust
|
||||
// cycles for the special last zone line later, as those penalties happen after
|
||||
// MARIA is done rendering, or after its hit the maximum rendering time.
|
||||
maria_cycles = 16;
|
||||
|
||||
cells = 0;
|
||||
|
||||
/* Process this DLL entry */
|
||||
dl = m_dl;
|
||||
|
||||
/* DMA */
|
||||
/* Step through DL's while we're within maximum rendering time. max render time = ( scanline length - DMA start ) */
|
||||
/* Step through DL's while we're within maximum rendering time. */
|
||||
/* max render time = ( scanline length - DMA start ) */
|
||||
/* 426 = ( 454 - 28 ) */
|
||||
|
||||
while (((READ_MEM(dl + 1) & 0x5f) != 0) && (maria_cycles<426))
|
||||
@ -251,9 +264,16 @@ void atari_maria_device::draw_scanline()
|
||||
// Last Line post-render DMA cycle penalties...
|
||||
if (m_offset == 0)
|
||||
{
|
||||
maria_cycles += 3; // extra shutdown time
|
||||
maria_cycles += 6; // extra shutdown time
|
||||
if (READ_MEM(m_dll + 3) & 0x80)
|
||||
maria_cycles += 21; // interrupt overhead
|
||||
maria_cycles += 17; // interrupt overhead
|
||||
}
|
||||
|
||||
// If MARIA used up all of the DMA time then the CPU can't run until next line...
|
||||
if (maria_cycles>=426)
|
||||
{
|
||||
m_cpu->spin_until_trigger(TRIGGER_HSYNC);
|
||||
m_wsync = 1;
|
||||
}
|
||||
|
||||
// Spin the CPU for Maria DMA, if it's not already spinning for WSYNC.
|
||||
@ -262,6 +282,7 @@ void atari_maria_device::draw_scanline()
|
||||
// To spin until an even divisor, we just round-up any would-be truncations by adding 3.
|
||||
if (!m_wsync)
|
||||
m_cpu->spin_until_time(m_cpu->cycles_to_attotime((maria_cycles+3)/4));
|
||||
}
|
||||
|
||||
// draw line buffer to screen
|
||||
m_active_buffer = !m_active_buffer; // switch buffers
|
||||
@ -335,13 +356,13 @@ void atari_maria_device::startdma(int lines)
|
||||
m_holey = (READ_MEM(m_dll) & 0x60) >> 5;
|
||||
m_nmi = READ_MEM(m_dll) & 0x80;
|
||||
/* logerror("DLL=%x\n",m_dll); */
|
||||
draw_scanline();
|
||||
}
|
||||
|
||||
if ((frame_scanline > 15) && (frame_scanline < (lines - 5)))
|
||||
draw_scanline();
|
||||
|
||||
if ((frame_scanline > 16) && (frame_scanline < (lines - 5)) && m_dmaon)
|
||||
{
|
||||
draw_scanline();
|
||||
if (m_offset == 0)
|
||||
{
|
||||
m_dll += 3;
|
||||
|
Loading…
Reference in New Issue
Block a user