summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-04-13 04:05:35 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-04-13 04:05:35 +0000
commit700d2d546d7abc5f7be934c86485d401b0608e33 (patch)
treeeaa9a5e1626b743448a5a1b5dee952f9e4291fa5
parentecac25b281a0d7bcdc5da1515f35a52427243014 (diff)
Corrected System 1 Z80 clocking:
* each opcode fetch is 2 cycles with /M1 low, so each byte of opcode fetching causes slightly longer delays than the previous tables * implemented approximate wait state timing for videoram access; further accuracy will rely on getting a dump of the PAL16R4 that controls the horizontal video timing
-rw-r--r--src/mame/drivers/system1.c178
-rw-r--r--src/mame/video/system1.c16
2 files changed, 98 insertions, 96 deletions
diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c
index 405111c6cff..e056c1f5d72 100644
--- a/src/mame/drivers/system1.c
+++ b/src/mame/drivers/system1.c
@@ -4,11 +4,6 @@ Sega System 1 / System 2
driver by Jarek Parchanski, Nicola Salmoria, Mirko Buffoni
-
-Issues:
- * pitfall2 - missing title
-
-
Up'n Down, Mister Viking, Flicky, SWAT, Water Match and Bull Fight are known
to run on IDENTICAL hardware (they were sold by Bally-Midway as ROM swaps).
@@ -233,99 +228,99 @@ static UINT8 i8751_active;
count is 11, which means the clock is divided by 5.
To account for this, we install custom cycle tables for the Z80. We clock the Z80
- at 20MHz and count 5 cycles for each original Z80 cycle, plus an extra cycle for
- each opcode fetch.
+ at 20MHz and count 5 cycles for each original Z80 cycle, plus an extra 2 cycles for
+ each opcode fetch (since the M1 line is low for 2 cycles per byte).
*/
static const UINT8 cc_op[0x100] = {
- 4*5+1,10*5+3, 7*5+1, 6*5+1, 4*5+1, 4*5+1, 7*5+2, 4*5+1, 4*5+1,11*5+1, 7*5+1, 6*5+1, 4*5+1, 4*5+1, 7*5+2, 4*5+1,
- 8*5+2,10*5+3, 7*5+1, 6*5+1, 4*5+1, 4*5+1, 7*5+2, 4*5+1,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*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,
-20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,
-20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,
-20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,20*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,
-23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4,23*5+4};
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
+20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
+20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
+20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
+23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2};
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
static const UINT8 cc_ex[0x100] = {
@@ -2023,7 +2018,6 @@ static MACHINE_DRIVER_START( sys1ppi )
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
- MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
MDRV_SCREEN_SIZE(256, 256)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
@@ -2078,14 +2072,6 @@ MACHINE_DRIVER_END
-/* main CPU hacked speed */
-static MACHINE_DRIVER_START( pitfall2 )
- MDRV_IMPORT_FROM( sys1pio )
-
- /* basic machine hardware */
- MDRV_CPU_REPLACE( "maincpu", Z80, 3600000 )/* should be 4 MHz but that value makes the title screen disappear */
-MACHINE_DRIVER_END
-
/* alternate program map with RAM/collision swapped */
static MACHINE_DRIVER_START( nob )
MDRV_IMPORT_FROM( sys1ppis )
diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c
index 23a4c0116c1..0df1babeb6c 100644
--- a/src/mame/video/system1.c
+++ b/src/mame/video/system1.c
@@ -246,15 +246,31 @@ WRITE8_HANDLER( system1_sprite_collision_reset_w )
* Video RAM access
*
*************************************/
+
+INLINE void videoram_wait_states(const device_config *cpu)
+{
+ /* The main Z80's CPU clock is halted whenever an access to VRAM happens,
+ and is only restarted by the FIXST signal, which occurs once every
+ 'n' pixel clocks. 'n' is determined by the horizontal control PAL. */
+
+ /* this assumes 4 5MHz pixel clocks per FIXST, or 4*4 20MHz CPU clocks */
+ /* this is just a guess until we get a good dump of the PAL */
+ const UINT32 cpu_cycles_per_fixst = 4 * 4;
+ UINT32 cycles_until_next_fixst = cpu_cycles_per_fixst - (cpu_get_total_cycles(cpu) % cpu_cycles_per_fixst);
+
+ cpu_adjust_icount(cpu, -cycles_until_next_fixst);
+}
READ8_HANDLER( system1_videoram_r )
{
+ videoram_wait_states(space->cpu);
offset |= 0x1000 * ((videoram_bank >> 1) % (tilemap_pages / 2));
return videoram[offset];
}
WRITE8_HANDLER( system1_videoram_w )
{
+ videoram_wait_states(space->cpu);
offset |= 0x1000 * ((videoram_bank >> 1) % (tilemap_pages / 2));
videoram[offset] = data;