From db260f64bb2339e2e92cbc8c7edd1ff84e65673b Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Tue, 6 May 2014 21:40:45 +0000 Subject: [PATCH] (MESS) a7800.c: - Brought initial Maria cycle counts inline from measurements taken with logic analyzer/tests. [Mike Saarna/Robert Tuccitto] - Added interrupts to DMA cycle eating. Updates to LL, OL, and spin accounting for HALT behavior. [Mike Saarna] --- src/mame/drivers/taotaido.c | 2 +- src/mess/drivers/a7800.c | 7 +++++-- src/mess/video/a7800.c | 27 ++++++++++++++++++++------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/taotaido.c b/src/mame/drivers/taotaido.c index eb93af9996f..8bc824f0b85 100644 --- a/src/mame/drivers/taotaido.c +++ b/src/mame/drivers/taotaido.c @@ -470,6 +470,6 @@ ROM_START( taotaido3 ) ROM_LOAD( "u15.bin", 0x000000, 0x200000, CRC(e95823e9) SHA1(362583944ad4fdde4f9e29928cf34376c7ad931f) ) ROM_END -GAME( 1993, taotaido, 0, taotaido, taotaido, driver_device, 0, ROT0, "Video System Co.", "Tao Taido (2 button verison)", GAME_NO_COCKTAIL ) +GAME( 1993, taotaido, 0, taotaido, taotaido, driver_device, 0, ROT0, "Video System Co.", "Tao Taido (2 button version)", GAME_NO_COCKTAIL ) GAME( 1993, taotaidoa,taotaido, taotaido, taotaido6,driver_device, 0, ROT0, "Video System Co.", "Tao Taido (6 button version)", GAME_NO_COCKTAIL ) // maybe a prototype? has various debug features GAME( 1993, taotaido3,taotaido, taotaido, taotaido3,driver_device, 0, ROT0, "Video System Co.", "Tao Taido (2/3 button version)", GAME_NO_COCKTAIL ) diff --git a/src/mess/drivers/a7800.c b/src/mess/drivers/a7800.c index 92c1e909755..71ea30ffc4c 100644 --- a/src/mess/drivers/a7800.c +++ b/src/mess/drivers/a7800.c @@ -82,6 +82,9 @@ regarding the potentiometer. 2014/03/25 Mike Saarna Fixed Riot Timer + + 2014/05/06 Mike Saarna/Robert Tuccitto Brought initial Maria cycle counts ++ inline from measurements taken with logic analyzer and tests. ***************************************************************************/ #include "emu.h" @@ -1139,7 +1142,7 @@ static MACHINE_CONFIG_START( a7800_ntsc, a7800_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( 7159090, 456, 0, 320, 263, 27, 27 + 192 + 32 ) + MCFG_SCREEN_RAW_PARAMS( 7159090, 454, 0, 320, 263, 27, 27 + 192 + 32 ) MCFG_SCREEN_UPDATE_DRIVER(a7800_state, screen_update_a7800) MCFG_SCREEN_PALETTE("palette") @@ -1181,7 +1184,7 @@ static MACHINE_CONFIG_DERIVED( a7800_pal, a7800_ntsc ) // MCFG_TIMER_ADD_SCANLINE("scantimer", a7800_interrupt, "screen", 0, 1) MCFG_SCREEN_MODIFY( "screen" ) - MCFG_SCREEN_RAW_PARAMS( 7093788, 456, 0, 320, 313, 35, 35 + 228 + 32 ) + MCFG_SCREEN_RAW_PARAMS( 7093788, 454, 0, 320, 313, 35, 35 + 228 + 32 ) MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_INIT_OWNER(a7800_state, a7800p ) diff --git a/src/mess/video/a7800.c b/src/mess/video/a7800.c index afe40687431..992fa6d0d66 100644 --- a/src/mess/video/a7800.c +++ b/src/mess/video/a7800.c @@ -4,6 +4,9 @@ Routines to control the Atari 7800 video hardware + 2014-05-06 Mike Saarna Added interrupts to DMA cycle eating. Updates to + LL, OL, and spin accounting for HALT behavior. + 2014-03-24 Mike Saarna Fixed DMA regarding startup, shutdown and cycle stealing. @@ -126,10 +129,17 @@ void a7800_state::maria_draw_scanline() int x, d, c, i, pixel_cell, cells; int maria_cycles; - if ( m_maria_offset == 0 ) - maria_cycles = 5+21; // DMA startup + last line shutdown - else - maria_cycles = 5+16; // DMA startup + other line shutdown + if ( m_maria_offset == 0 ) + { + if(READ_MEM(m_maria_dll+3) & 0x80) + maria_cycles=40; // DMA + maria interrupt overhead + else + maria_cycles=19; // DMA + } + else + { + maria_cycles = 16; // DMA + } cells = 0; @@ -202,9 +212,12 @@ void a7800_state::maria_draw_scanline() } } } - // spin the CPU for Maria DMA, if it's not already spinning for WSYNC - if ( ! m_maria_wsync ) - m_maincpu->spin_until_time(m_maincpu->cycles_to_attotime(maria_cycles/4)); // Maria clock rate is 4 times that of the CPU + // Spin the CPU for Maria DMA, if it's not already spinning for WSYNC. + // MARIA generates the 6502 clock by dividing its own clock by 4. It needs to HALT and unHALT + // the 6502 on ths same clock phase, so MARIA will wait until its clock divides evenly by 4. + // To spin until an even divisor, we just round-up any would-be truncations by adding 3. + if ( ! m_maria_wsync ) + m_maincpu->spin_until_time(m_maincpu->cycles_to_attotime((maria_cycles+3)/4)); // draw line buffer to screen m_active_buffer = !m_active_buffer; // switch buffers