diff -Nru src-old/emu/cpu/adsp2100/adsp2100.c src/emu/cpu/adsp2100/adsp2100.c
--- src-old/emu/cpu/adsp2100/adsp2100.c	2007-12-17 08:33:33.000000000 -0800
+++ src/emu/cpu/adsp2100/adsp2100.c	2007-12-21 08:12:20.000000000 -0800
@@ -27,8 +27,8 @@
             3c00-3fff = 1k Internal Control regs            3c00-3fff = 1k Internal Control regs
 
 
-    For ADSP-2105, ADSP-2115, ADSP-2104
-    -----------------------------------
+    For ADSP-2105, ADSP-2115
+    ------------------------
 
         MMAP = 0                                        MMAP = 1
 
@@ -50,6 +50,29 @@
             3c00-3fff = 1k Internal Control regs            3c00-3fff = 1k Internal Control regs
 
 
+    For ADSP-2104
+    -------------
+
+        MMAP = 0                                        MMAP = 1
+
+        Automatic boot loading                          No auto boot loading
+
+        Program Space:                                  Program Space:
+            0000-01ff = 512 Internal RAM (booted)           0000-37ff = 14k External access
+            0400-07ff = 1k Reserved                         3800-3bff = 1k Internal RAM
+            0800-3fff = 14k External access                 3c00-3fff = 1k Reserved
+
+        Data Space:                                     Data Space:
+            0000-03ff = 1k External DWAIT0                  0000-03ff = 1k External DWAIT0
+            0400-07ff = 1k External DWAIT1                  0400-07ff = 1k External DWAIT1
+            0800-2fff = 10k External DWAIT2                 0800-2fff = 10k External DWAIT2
+            3000-33ff = 1k External DWAIT3                  3000-33ff = 1k External DWAIT3
+            3400-37ff = 1k External DWAIT4                  3400-37ff = 1k External DWAIT4
+            3800-38ff = 256 Internal RAM                    3800-38ff = 256 Internal RAM
+            3a00-3bff = 512 Reserved                        3a00-3bff = 512 Reserved
+            3c00-3fff = 1k Internal Control regs            3c00-3fff = 1k Internal Control regs
+
+
     For ADSP-2181
     -------------
 
diff -Nru src-old/emu/cpu/i8051/i8051.c src/emu/cpu/i8051/i8051.c
--- src-old/emu/cpu/i8051/i8051.c	2007-12-17 08:39:40.000000000 -0800
+++ src/emu/cpu/i8051/i8051.c	2007-12-23 19:41:16.000000000 -0800
@@ -2319,16 +2319,6 @@
 void i8752_set_serial_rx_callback(int (*callback)(void))	{ i8051_set_serial_rx_callback(callback); }
 void i8752_state_save(void *file)				{ i8051_state_save(file); }
 void i8752_state_load(void *file)				{ i8051_state_load(file); }
-#if 0
-const char *i8752_info(void *context, int regnum)
-{
-	switch( regnum )
-	{
-		case CPU_INFO_NAME: return "I8752";
-	}
-	return i8051_info(context,regnum);
-}
-#endif
 
 /* The following two handlers are used by the MAME Debugger Memory Window...
    By keeping these functions separate from the internally used IRAM_W/IRAM_R functions,
diff -Nru src-old/emu/cpu/i8051/i8051.h src/emu/cpu/i8051/i8051.h
--- src-old/emu/cpu/i8051/i8051.h	2007-12-17 08:37:57.000000000 -0800
+++ src/emu/cpu/i8051/i8051.h	2007-12-23 19:41:16.000000000 -0800
@@ -106,7 +106,6 @@
 extern void i8051_set_irq_callback(int (*callback)(int irqline));
 extern void i8051_state_save(void *file);
 extern void i8051_state_load(void *file);
-extern const char *i8051_info(void *context, int regnum);
 
 WRITE8_HANDLER( i8051_internal_w );
 READ8_HANDLER( i8051_internal_r );
@@ -135,7 +134,6 @@
 extern void i8752_set_irq_callback(int (*callback)(int irqline));
 extern void i8752_state_save(void *file);
 extern void i8752_state_load(void *file);
-extern const char *i8752_info(void *context, int regnum);
 extern void i8752_set_serial_tx_callback(void (*callback)(int data));
 extern void i8752_set_serial_rx_callback(int (*callback)(void));
 WRITE8_HANDLER( i8752_internal_w );
diff -Nru src-old/emu/cpu/minx/minx.c src/emu/cpu/minx/minx.c
--- src-old/emu/cpu/minx/minx.c	2007-12-17 07:19:59.000000000 -0800
+++ src/emu/cpu/minx/minx.c	2007-12-23 19:41:16.000000000 -0800
@@ -87,7 +87,7 @@
 } minx_regs;
 
 static minx_regs regs;
-int minx_icount;
+static int minx_icount;
 
 #define rd(offset)	program_read_byte_8( offset )
 #define wr(offset,data)	program_write_byte_8( offset, data )
diff -Nru src-old/emu/cpu/mips/mdrc64.c src/emu/cpu/mips/mdrc64.c
--- src-old/emu/cpu/mips/mdrc64.c	2007-12-18 00:09:03.000000000 -0800
+++ src/emu/cpu/mips/mdrc64.c	2007-12-20 16:43:47.000000000 -0800
@@ -304,7 +304,7 @@
 static void append_explode_ccr31(drc_core *drc);
 static void append_recover_ccr31(drc_core *drc);
 static void append_check_interrupts(drc_core *drc, compiler_state *compiler, const opcode_desc *desc);
-static void append_check_sw_interrupts(drc_core *drc, int inline_generate);
+//static void append_check_sw_interrupts(drc_core *drc, int inline_generate);
 
 static void emit_update_cycles_pc_and_flush(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, offs_t destpc);
 
diff -Nru src-old/emu/machine/scsicd.c src/emu/machine/scsicd.c
--- src-old/emu/machine/scsicd.c	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/machine/scsicd.c	2007-12-23 19:41:16.000000000 -0800
@@ -11,6 +11,7 @@
 #ifdef MESS
 #include "devices/chd_cd.h"
 #endif
+#include "scsicd.h"
 
 typedef struct
 {
diff -Nru src-old/emu/machine/scsihd.c src/emu/machine/scsihd.c
--- src-old/emu/machine/scsihd.c	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/machine/scsihd.c	2007-12-23 19:41:16.000000000 -0800
@@ -11,6 +11,7 @@
 #ifdef MESS
 #include "devices/harddriv.h"
 #endif
+#include "scsihd.h"
 
 typedef struct
 {
diff -Nru src-old/emu/mame.h src/emu/mame.h
--- src-old/emu/mame.h	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/mame.h	2007-12-23 19:41:16.000000000 -0800
@@ -252,7 +252,7 @@
 extern const char mame_disclaimer[];
 extern char giant_string_buffer[];
 
-extern char build_version[];
+extern const char build_version[];
 
 
 
diff -Nru src-old/emu/sound/c140.c src/emu/sound/c140.c
--- src-old/emu/sound/c140.c	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/sound/c140.c	2007-12-23 20:03:00.000000000 -0800
@@ -401,12 +401,25 @@
 					if( cnt )
 					{
 						prevdt=lastdt;
-						lastdt=pSampleData[pos];
-						if ((v->mode & 0x40) && (info->banking_type == C140_TYPE_ASIC219))
+
+						if (info->banking_type == C140_TYPE_ASIC219)
 						{
-							lastdt ^= 0x80;	// flip signedness
+							lastdt = pSampleData[BYTE_XOR_BE(pos)];
+
+							// Sign + magnitude format
+							if ((v->mode & 0x01) && (lastdt & 0x80))
+								lastdt = -(lastdt & 0x7f);
+
+							// Sign flip
+							if (v->mode & 0x40)
+								lastdt = -lastdt;
 						}
-						dltdt=(lastdt - prevdt);
+						else
+						{
+							lastdt=pSampleData[pos];
+						}
+
+						dltdt = (lastdt - prevdt);
 					}
 
 					/* Caclulate the sample value */
diff -Nru src-old/emu/sound/fm.c src/emu/sound/fm.c
--- src-old/emu/sound/fm.c	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/sound/fm.c	2007-12-20 17:32:15.000000000 -0800
@@ -1394,7 +1394,8 @@
 }
 
 /* update phase increment counters */
-INLINE void refresh_fc_eg_chan(FM_CH *CH )
+/* Changed from INLINE to static to work around gcc 4.2.1 codegen bug */
+static void refresh_fc_eg_chan(FM_CH *CH )
 {
 	if( CH->SLOT[SLOT1].Incr==-1){
 		int fc = CH->fc;
diff -Nru src-old/emu/sound/sid.c src/emu/sound/sid.c
--- src-old/emu/sound/sid.c	2007-12-17 07:19:59.000000000 -0800
+++ src/emu/sound/sid.c	2007-12-23 19:41:16.000000000 -0800
@@ -22,7 +22,7 @@
 static float *filterTable;
 static float *bandPassParam;
 #define lowPassParam filterTable
-float filterResTable[16];
+static float filterResTable[16];
 
 #define maxLogicalVoices 4
 
@@ -30,7 +30,7 @@
 static UINT16 mix16mono[256*maxLogicalVoices];
 
 static UINT16 zero16bit=0;  /* either signed or unsigned */
-UINT32 splitBufferLen;
+//UINT32 splitBufferLen;
 
 void MixerInit(int threeVoiceAmplify)
 {
diff -Nru src-old/emu/sound/sidenvel.c src/emu/sound/sidenvel.c
--- src-old/emu/sound/sidenvel.c	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/sound/sidenvel.c	2007-12-23 19:41:16.000000000 -0800
@@ -87,7 +87,7 @@
   static UINT32 decayReleaseRatesP[16];
 #endif
 
-const UINT32 attackTabLen = 255;
+static const UINT32 attackTabLen = 255;
 static UINT32 releaseTabLen;
 static UINT32 releasePos[256];
 
diff -Nru src-old/emu/sound/sp0256.c src/emu/sound/sp0256.c
--- src-old/emu/sound/sp0256.c	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/sound/sp0256.c	2007-12-23 19:41:16.000000000 -0800
@@ -1225,7 +1225,7 @@
 	free( sp->scratch );
 }
 
-void sp0256_reset(void *token)
+static void sp0256_reset(void *token)
 {
 	struct sp0256 *sp = token;
 
diff -Nru src-old/emu/sound/wave.c src/emu/sound/wave.c
--- src-old/emu/sound/wave.c	2007-12-17 07:19:59.000000000 -0800
+++ src/emu/sound/wave.c	2007-12-23 19:41:16.000000000 -0800
@@ -15,6 +15,7 @@
 #include "utils.h"
 #include "devices/cassette.h"
 #endif
+#include "wave.h"
 
 #define ALWAYS_PLAY_SOUND	0
 #define WAVE_TOKEN_MASK		0xFFFF0000
diff -Nru src-old/emu/sound/ymf271.c src/emu/sound/ymf271.c
--- src-old/emu/sound/ymf271.c	2007-12-17 08:37:57.000000000 -0800
+++ src/emu/sound/ymf271.c	2007-12-23 20:06:02.000000000 -0800
@@ -158,6 +158,14 @@
 	11.41,		9.12,		7.60,		6.51,		5.69,		5.69,		5.69,		5.69
 };
 
+/* Notes about the LFO Frequency Table below;
+
+    There appears to be at least 2 errors in the table from the original manual.
+
+    Both 201 & 202 where listed as 3.74490.  202 has be changed to 3.92000 which is "about right"
+    232 was listed as 13.35547.  We use 14.35547 as it apears to be the correct value
+*/
+
 static const double LFO_frequency_table[256] =
 {
 	0.00066,	0.00068,	0.00070,	0.00073,	0.00075,	0.00078,	0.00081,	0.00084,
@@ -189,7 +197,7 @@
 	5.38330,	5.55696,	5.74219,	5.94019,	6.15234,	6.38021,	6.62560,	6.89062,
 	7.17773,	7.48981,	7.83026,	8.20312,	8.61328,	9.06661,	9.57031,	10.13327,
 	10.76660,	11.11391,	11.48438,	11.88039,	12.30469,	12.76042,	13.25120,	13.78125,
-	13.35547,	14.97962,	15.66051,	16.40625,	17.22656,	18.13322,	19.14062,	20.26654,
+	14.35547,	14.97962,	15.66051,	16.40625,	17.22656,	18.13322,	19.14062,	20.26654,
 	21.53320,	22.96875,	24.60938,	26.50240,	28.71094,	31.32102,	34.45312,	38.28125,
 	43.06641,	49.21875,	57.42188,	68.90625,	86.13281,	114.84375,	172.26562,	344.53125
 };
diff -Nru src-old/emu/video/vooddefs.h src/emu/video/vooddefs.h
--- src-old/emu/video/vooddefs.h	2007-12-17 08:41:39.000000000 -0800
+++ src/emu/video/vooddefs.h	2007-12-23 19:41:16.000000000 -0800
@@ -1817,7 +1817,7 @@
 
 INLINE INT32 fast_reciplog(INT64 value, INT32 *log2)
 {
-	extern UINT32 reciplog[];
+	extern UINT32 voodoo_reciplog[];
 	UINT32 temp, recip, rlog;
 	UINT32 interp;
 	UINT32 *table;
@@ -1855,7 +1855,7 @@
 	/* compute a pointer to the table entries we want */
 	/* math is a bit funny here because we shift one less than we need to in order */
 	/* to account for the fact that there are two UINT32's per table entry */
-	table = &reciplog[(temp >> (31 - RECIPLOG_LOOKUP_BITS - 1)) & ((2 << RECIPLOG_LOOKUP_BITS) - 2)];
+	table = &voodoo_reciplog[(temp >> (31 - RECIPLOG_LOOKUP_BITS - 1)) & ((2 << RECIPLOG_LOOKUP_BITS) - 2)];
 
 	/* compute the interpolation value */
 	interp = (temp >> (31 - RECIPLOG_LOOKUP_BITS - 8)) & 0xff;
diff -Nru src-old/emu/video/voodoo.c src/emu/video/voodoo.c
--- src-old/emu/video/voodoo.c	2007-12-17 08:37:57.000000000 -0800
+++ src/emu/video/voodoo.c	2007-12-23 19:41:16.000000000 -0800
@@ -183,7 +183,7 @@
 static UINT8 dither2_lookup[256*16*2];
 
 /* fast reciprocal+log2 lookup */
-UINT32 reciplog[(2 << RECIPLOG_LOOKUP_BITS) + 2];
+UINT32 voodoo_reciplog[(2 << RECIPLOG_LOOKUP_BITS) + 2];
 
 
 
@@ -300,8 +300,8 @@
 	for (val = 0; val <= (1 << RECIPLOG_LOOKUP_BITS); val++)
 	{
 		UINT32 value = (1 << RECIPLOG_LOOKUP_BITS) + val;
-		reciplog[val*2 + 0] = (1 << (RECIPLOG_LOOKUP_PREC + RECIPLOG_LOOKUP_BITS)) / value;
-		reciplog[val*2 + 1] = (UINT32)(LOGB2((double)value / (double)(1 << RECIPLOG_LOOKUP_BITS)) * (double)(1 << RECIPLOG_LOOKUP_PREC));
+		voodoo_reciplog[val*2 + 0] = (1 << (RECIPLOG_LOOKUP_PREC + RECIPLOG_LOOKUP_BITS)) / value;
+		voodoo_reciplog[val*2 + 1] = (UINT32)(LOGB2((double)value / (double)(1 << RECIPLOG_LOOKUP_BITS)) * (double)(1 << RECIPLOG_LOOKUP_PREC));
 	}
 
 	/* create dithering tables */
diff -Nru src-old/mame/audio/dcs.c src/mame/audio/dcs.c
--- src-old/mame/audio/dcs.c	2007-12-17 08:37:57.000000000 -0800
+++ src/mame/audio/dcs.c	2007-12-23 20:03:00.000000000 -0800
@@ -162,7 +162,7 @@
 #define LOG_DCS_IO					(0)
 #define LOG_BUFFER_FILLING			(0)
 
-#define HLE_TRANSFERS				(1)
+#define ENABLE_HLE_TRANSFERS		(1)
 
 
 
@@ -292,9 +292,9 @@
 	UINT8		channels;
 	UINT16		size;
 	UINT16		incs;
-	emu_timer *reg_timer;
-	emu_timer *sport_timer;
-	emu_timer *internal_timer;
+	emu_timer *	reg_timer;
+	emu_timer *	sport_timer;
+	emu_timer *	internal_timer;
 	INT32		ireg;
 	UINT16		ireg_base;
 	UINT16		control_regs[32];
@@ -334,6 +334,7 @@
 typedef struct _hle_transfer_state hle_transfer_state;
 struct _hle_transfer_state
 {
+	UINT8		hle_enabled;
 	INT32		dcs_state;
 	INT32		state;
 	INT32		start;
@@ -343,7 +344,7 @@
 	INT32		writes_left;
 	UINT16		sum;
 	INT32		fifo_entries;
-	emu_timer *watchdog;
+	emu_timer *	watchdog;
 };
 
 
@@ -477,13 +478,18 @@
  *
  *************************************/
 
-static ADDRESS_MAP_START( dcs2_program_map, ADDRESS_SPACE_PROGRAM, 32 )
+static ADDRESS_MAP_START( dcs2_2115_program_map, ADDRESS_SPACE_PROGRAM, 32 )
 	ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
 	AM_RANGE(0x0000, 0x03ff) AM_RAM	AM_BASE(&dcs_internal_program_ram)
 ADDRESS_MAP_END
 
+static ADDRESS_MAP_START( dcs2_2104_program_map, ADDRESS_SPACE_PROGRAM, 32 )
+	ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
+	AM_RANGE(0x0000, 0x01ff) AM_RAM	AM_BASE(&dcs_internal_program_ram)
+ADDRESS_MAP_END
+
 
-static ADDRESS_MAP_START( dcs2_data_map, ADDRESS_SPACE_DATA, 16 )
+static ADDRESS_MAP_START( dcs2_2115_data_map, ADDRESS_SPACE_DATA, 16 )
 	ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
 	AM_RANGE(0x0400, 0x0400) AM_READWRITE(input_latch_r, input_latch_ack_w)
 	AM_RANGE(0x0401, 0x0401) AM_WRITE(output_latch_w)
@@ -495,6 +501,18 @@
 	AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w)
 ADDRESS_MAP_END
 
+static ADDRESS_MAP_START( dcs2_2104_data_map, ADDRESS_SPACE_DATA, 16 )
+	ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
+	AM_RANGE(0x0400, 0x0400) AM_READWRITE(input_latch_r, input_latch_ack_w)
+	AM_RANGE(0x0401, 0x0401) AM_WRITE(output_latch_w)
+	AM_RANGE(0x0402, 0x0402) AM_READWRITE(output_control_r, output_control_w)
+	AM_RANGE(0x0403, 0x0403) AM_READ(latch_status_r)
+	AM_RANGE(0x0404, 0x0407) AM_READ(fifo_input_r)
+	AM_RANGE(0x0480, 0x0483) AM_READWRITE(sdrc_r, sdrc_w)
+	AM_RANGE(0x3800, 0x38ff) AM_RAM
+	AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w)
+ADDRESS_MAP_END
+
 
 
 /*************************************
@@ -608,8 +626,8 @@
 
 MACHINE_DRIVER_START( dcs2_audio_2115 )
 	MDRV_CPU_ADD_TAG("dcs2", ADSP2115, 16000000)
-	MDRV_CPU_PROGRAM_MAP(dcs2_program_map,0)
-	MDRV_CPU_DATA_MAP(dcs2_data_map,0)
+	MDRV_CPU_PROGRAM_MAP(dcs2_2115_program_map,0)
+	MDRV_CPU_DATA_MAP(dcs2_2115_data_map,0)
 
 	MDRV_SPEAKER_STANDARD_STEREO("left", "right")
 
@@ -624,6 +642,8 @@
 MACHINE_DRIVER_START( dcs2_audio_2104 )
 	MDRV_IMPORT_FROM(dcs2_audio_2115)
 	MDRV_CPU_REPLACE("dcs2", ADSP2104, 16000000)
+	MDRV_CPU_PROGRAM_MAP(dcs2_2104_program_map,0)
+	MDRV_CPU_DATA_MAP(dcs2_2104_data_map,0)
 MACHINE_DRIVER_END
 
 
@@ -954,7 +974,8 @@
 		dcs_polling_base = memory_install_read16_handler(dcs.cpunum, ADDRESS_SPACE_DATA, polling_offset, polling_offset, 0, 0, dcs_polling_r);
 
 	/* allocate a watchdog timer for HLE transfers */
-	if (HLE_TRANSFERS)
+	transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && dram_in_mb != 0);
+	if (transfer.hle_enabled)
 		transfer.watchdog = timer_alloc(transfer_watchdog_callback, NULL);
 
 	/* reset the system */
@@ -1435,7 +1456,7 @@
 int dcs_control_r(void)
 {
 	/* only boost for DCS2 boards */
-	if (!dcs.auto_ack && !HLE_TRANSFERS)
+	if (!dcs.auto_ack && !transfer.hle_enabled)
 		cpu_boost_interleave(ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
 	return dcs.latch_control;
 }
@@ -1466,9 +1487,9 @@
 		result |= 0x80;
 	if (IS_OUTPUT_EMPTY())
 		result |= 0x40;
-	if (dcs.fifo_status_r && (!HLE_TRANSFERS || transfer.state == 0))
+	if (dcs.fifo_status_r != NULL && (!transfer.hle_enabled || transfer.state == 0))
 		result |= (*dcs.fifo_status_r)() & 0x38;
-	if (HLE_TRANSFERS && transfer.state != 0)
+	if (transfer.hle_enabled && transfer.state != 0)
 		result |= 0x08;
 	return result;
 }
@@ -1805,6 +1826,7 @@
 			/* bit 9 forces a reset */
 			if (data & 0x0200)
 			{
+				logerror("%04X:Rebooting DCS due to SYSCONTROL write\n", activecpu_get_pc());
 				cpunum_set_input_line(dcs.cpunum, INPUT_LINE_RESET, PULSE_LINE);
 				dcs_boot();
 				dcs.control_regs[SYSCONTROL_REG] = 0;
@@ -2011,7 +2033,7 @@
 void dcs_fifo_notify(int count, int max)
 {
 	/* skip if not in mid-transfer */
-	if (!HLE_TRANSFERS || transfer.state == 0 || !dcs.fifo_data_r)
+	if (!transfer.hle_enabled || transfer.state == 0 || !dcs.fifo_data_r)
 	{
 		transfer.fifo_entries = 0;
 		return;
@@ -2075,22 +2097,26 @@
 			/* look for command 0x001a to transfer chunks of data */
 			if (data == 0x001a)
 			{
-				if (LOG_DCS_TRANSFERS) logerror("%08X:DCS Transfer command %04X\n", activecpu_get_pc(), data);
+				if (LOG_DCS_TRANSFERS)
+					logerror("%08X:DCS Transfer command %04X\n", activecpu_get_pc(), data);
 				transfer.state++;
-				if (HLE_TRANSFERS) return 1;
+				if (transfer.hle_enabled)
+					return 1;
 			}
 
 			/* look for command 0x002a to start booting the uploaded program */
 			else if (data == 0x002a)
 			{
-				if (LOG_DCS_TRANSFERS) logerror("%08X:DCS State change %04X\n", activecpu_get_pc(), data);
+				if (LOG_DCS_TRANSFERS)
+					logerror("%08X:DCS State change %04X\n", activecpu_get_pc(), data);
 				transfer.dcs_state = 1;
 			}
 
 			/* anything else is ignored */
 			else
 			{
-				if (LOG_DCS_TRANSFERS) logerror("Command: %04X\n", data);
+				if (LOG_DCS_TRANSFERS)
+					logerror("Command: %04X\n", data);
 			}
 			break;
 
@@ -2098,16 +2124,20 @@
 			/* first word is the start address */
 			transfer.start = data;
 			transfer.state++;
-			if (LOG_DCS_TRANSFERS) logerror("Start address = %04X\n", transfer.start);
-			if (HLE_TRANSFERS) return 1;
+			if (LOG_DCS_TRANSFERS)
+				logerror("Start address = %04X\n", transfer.start);
+			if (transfer.hle_enabled)
+				return 1;
 			break;
 
 		case 2:
 			/* second word is the stop address */
 			transfer.stop = data;
 			transfer.state++;
-			if (LOG_DCS_TRANSFERS) logerror("Stop address = %04X\n", transfer.stop);
-			if (HLE_TRANSFERS) return 1;
+			if (LOG_DCS_TRANSFERS)
+				logerror("Stop address = %04X\n", transfer.stop);
+			if (transfer.hle_enabled)
+				return 1;
 			break;
 
 		case 3:
@@ -2128,7 +2158,7 @@
 			transfer.sum = 0;
 
 			/* handle the HLE case */
-			if (HLE_TRANSFERS)
+			if (transfer.hle_enabled)
 			{
 				if (transfer.type == 1 && SDRC_SM_BK == 1)
 				{
@@ -2156,7 +2186,7 @@
 			}
 
 			/* handle the HLE case */
-			if (HLE_TRANSFERS)
+			if (transfer.hle_enabled)
 			{
 				/* write the new data to memory */
 				cpuintrf_push_context(dcs.cpunum);
@@ -2203,15 +2233,18 @@
 			/* look for command 0x55d0 or 0x55d1 to transfer chunks of data */
 			if (data == 0x55d0 || data == 0x55d1)
 			{
-				if (LOG_DCS_TRANSFERS) logerror("%08X:DCS Transfer command %04X\n", activecpu_get_pc(), data);
+				if (LOG_DCS_TRANSFERS)
+					logerror("%08X:DCS Transfer command %04X\n", activecpu_get_pc(), data);
 				transfer.state++;
-				if (HLE_TRANSFERS) return 1;
+				if (transfer.hle_enabled)
+					return 1;
 			}
 
 			/* anything else is ignored */
 			else
 			{
-				if (LOG_DCS_TRANSFERS) logerror("%08X:Command: %04X\n", activecpu_get_pc(), data);
+				if (LOG_DCS_TRANSFERS)
+					logerror("%08X:Command: %04X\n", activecpu_get_pc(), data);
 			}
 			break;
 
@@ -2219,36 +2252,41 @@
 			/* first word is the upper bits of the start address */
 			transfer.start = data << 16;
 			transfer.state++;
-			if (HLE_TRANSFERS) return 1;
+			if (transfer.hle_enabled)
+				return 1;
 			break;
 
 		case 2:
 			/* second word is the lower bits of the start address */
 			transfer.start |= data;
 			transfer.state++;
-			if (LOG_DCS_TRANSFERS) logerror("Start address = %08X\n", transfer.start);
-			if (HLE_TRANSFERS) return 1;
+			if (LOG_DCS_TRANSFERS)
+				logerror("Start address = %08X\n", transfer.start);
+			if (transfer.hle_enabled)
+				return 1;
 			break;
 
 		case 3:
 			/* third word is the upper bits of the stop address */
 			transfer.stop = data << 16;
 			transfer.state++;
-			if (HLE_TRANSFERS) return 1;
+			if (transfer.hle_enabled)
+				return 1;
 			break;
 
 		case 4:
 			/* fourth word is the lower bits of the stop address */
 			transfer.stop |= data;
 			transfer.state++;
-			if (LOG_DCS_TRANSFERS) logerror("Stop address = %08X\n", transfer.stop);
+			if (LOG_DCS_TRANSFERS)
+				logerror("Stop address = %08X\n", transfer.stop);
 
 			/* at this point, we can compute how many words to expect for the transfer */
 			transfer.writes_left = transfer.stop - transfer.start + 1;
 
 			/* reset the checksum */
 			transfer.sum = 0;
-			if (HLE_TRANSFERS)
+			if (transfer.hle_enabled)
 			{
 				timer_adjust(transfer.watchdog, ATTOTIME_IN_MSEC(1), transfer.writes_left, attotime_zero);
 				return 1;
@@ -2262,12 +2300,13 @@
 			/* if we're out, stop the transfer */
 			if (--transfer.writes_left == 0)
 			{
-				if (LOG_DCS_TRANSFERS) logerror("Transfer done, sum = %04X\n", transfer.sum);
+				if (LOG_DCS_TRANSFERS)
+					logerror("Transfer done, sum = %04X\n", transfer.sum);
 				transfer.state = 0;
 			}
 
 			/* handle the HLE case */
-			if (HLE_TRANSFERS)
+			if (transfer.hle_enabled)
 			{
 				/* write the new data to memory */
 				dcs.sounddata[transfer.start++] = data;
diff -Nru src-old/mame/audio/dkong.c src/mame/audio/dkong.c
--- src-old/mame/audio/dkong.c	2007-12-18 00:24:58.000000000 -0800
+++ src/mame/audio/dkong.c	2007-12-23 19:41:16.000000000 -0800
@@ -1099,7 +1099,7 @@
  *
  *************************************/
 
-static const char *dkongjr_sample_names[] =
+static const char *const dkongjr_sample_names[] =
 {
 	"*dkongjr",
 	"jump.wav",
@@ -1117,14 +1117,14 @@
 	0	/* end of array */
 };
 
-static struct Samplesinterface dkongjr_samples_interface =
+static const struct Samplesinterface dkongjr_samples_interface =
 {
 	8,	/* 8 channels */
 	dkongjr_sample_names
 };
 
 #if !RADARSC1_USE_M58817
-static const char *radarsc1_sample_names[] =
+static const char *const radarsc1_sample_names[] =
 {
 	"*radarsc1",
 	"10.wav",
@@ -1139,17 +1139,17 @@
 	0	/* end of array */
 };
 
-static struct Samplesinterface radarsc1_samples_interface =
+static const struct Samplesinterface radarsc1_samples_interface =
 {
 	8,	/* 8 channels */
 	radarsc1_sample_names
 };
 #endif
 
-static struct NESinterface nes_interface_1 = { REGION_CPU2 };
-static struct NESinterface nes_interface_2 = { REGION_CPU3 };
+static const struct NESinterface nes_interface_1 = { REGION_CPU2 };
+static const struct NESinterface nes_interface_2 = { REGION_CPU3 };
 
-static struct M58817interface m58817_interface =
+static const struct M58817interface m58817_interface =
 {
 #if !RADARSC1_USE_M58817
 	-1,
diff -Nru src-old/mame/audio/tx1.c src/mame/audio/tx1.c
--- src-old/mame/audio/tx1.c	1969-12-31 16:00:00.000000000 -0800
+++ src/mame/audio/tx1.c	2007-12-23 20:03:00.000000000 -0800
@@ -0,0 +1,333 @@
+/***************************************************************************
+
+    Tatsumi TX-1/Buggy Boy sound hardware
+
+***************************************************************************/
+#include "driver.h"
+#include "includes/tx1.h"
+#include "video/resnet.h"
+#include "sound/custom.h"
+#include "streams.h"
+
+static sound_stream *stream;
+static int freq_to_step;
+
+/*************************************
+ *
+ *  TX-1
+ *
+ *************************************/
+
+
+/*************************************
+ *
+ *  Buggy Boy
+ *
+ *************************************/
+
+#define BUGGYBOY_PIT_CLOCK		(BUGGYBOY_ZCLK / 8)
+#define BUGGYBOY_NOISE_CLOCK	(BUGGYBOY_PIT_CLOCK / 4)
+
+#define BUGGYBOY_R1		47000.0
+#define BUGGYBOY_R2		22000.0
+#define BUGGYBOY_R3		10000.0
+#define BUGGYBOY_R4		5600.0
+#define BUGGYBOY_SHUNT	250.0
+
+#define BUGGYBOY_R1S	(1.0/(1.0/BUGGYBOY_R1 + 1.0/BUGGYBOY_SHUNT))
+#define BUGGYBOY_R2S	(1.0/(1.0/BUGGYBOY_R2 + 1.0/BUGGYBOY_SHUNT))
+#define BUGGYBOY_R3S	(1.0/(1.0/BUGGYBOY_R3 + 1.0/BUGGYBOY_SHUNT))
+#define BUGGYBOY_R4S	(1.0/(1.0/BUGGYBOY_R4 + 1.0/BUGGYBOY_SHUNT))
+
+static int noise_lfsra;
+static int noise_lfsrb;
+static int noise_lfsrc;
+static int noise_lfsrd;
+static int noise_counter;
+static int step0;
+static int step1;
+static UINT8 ym_outputa;
+static UINT8 ym_outputb;
+static UINT16 buggyboy_eng_voltages[16];
+
+static const double bb_engine_gains[16] =
+{
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2  + BUGGYBOY_R3  + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2  + BUGGYBOY_R3  + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2  + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2  + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2S + BUGGYBOY_R3  + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2S + BUGGYBOY_R3  + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1  + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2  + BUGGYBOY_R3  + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2  + BUGGYBOY_R3  + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2  + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2  + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3  + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3  + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
+	-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
+};
+
+
+/*
+    8253 Programmable Interval Timer
+*/
+static struct
+{
+	union
+	{
+#ifdef LSB_FIRST
+		struct { UINT8 LSB; UINT8 MSB; };
+#else
+		struct { UINT8 MSB; UINT8 LSB; };
+#endif
+		UINT16 val;
+	} counts[3];
+
+	int idx[3];
+} pit8253;
+
+/*
+    Port A                     Port B
+    ======                     ======
+
+    0: Engine 1 gain (FR) #0    0: Coin Counter 1
+    1: Engine 1 gain (FR) #1    1: Coin Counter 2
+    2: Engine 1 gain (FR) #2    2: Coin Counter 3 (Unused)
+    3: Engine 1 gain (FR) #3    3: Engine 0 gain
+    4: Engine 1 gain (FL) #0    4: Noise EN1
+    5: Engine 1 gain (FL) #1    5: Noise EN2
+    6: Engine 1 gain (FL) #2    6: Enable YM IC24 output on RR
+    7: Engine 1 gain (FL) #3    7: Enable YM IC19 output on RL
+
+
+    The engine sounds are generated by an 8253. There are two channels.
+
+    #0 is the player's buggy
+    #1 is the opponents' buggies
+
+              +------------> GAIN[1] +--> FL
+              |                      +--> FR
+    8255 #0 --+--> BL
+              +--> BR
+
+    8255 #1 --+--> GAIN[2] ---> FL
+              +--> GAIN[3] ---> FR
+
+
+    [1] is used to amplify sound during tunnel.
+    [2] and [3] are stereo fades
+
+*/
+
+WRITE8_HANDLER( bb_ym1_a_w )
+{
+	stream_update(stream);
+
+	ym_outputa = data ^ 0xff;
+}
+
+WRITE8_HANDLER( bb_ym1_b_w )
+{
+	double gain;
+
+	stream_update(stream);
+
+	ym_outputb = data ^ 0xff;
+
+    coin_counter_w(0, data & 0x01);
+    coin_counter_w(1, data & 0x02);
+
+	/* Until we support > 2 speakers, double the gain of the front speakers */
+
+	/* Rear left speaker */
+	gain = data & 0x80 ? 1.0 : 2.0;
+	sndti_set_output_gain(SOUND_AY8910, 0, 0, gain);
+	sndti_set_output_gain(SOUND_AY8910, 0, 1, gain);
+	sndti_set_output_gain(SOUND_AY8910, 0, 2, gain);
+
+	/* Rear right speaker */
+	gain = data & 0x40 ? 1.0 : 2.0;
+	sndti_set_output_gain(SOUND_AY8910, 1, 0, gain);
+	sndti_set_output_gain(SOUND_AY8910, 1, 1, gain);
+	sndti_set_output_gain(SOUND_AY8910, 1, 2, gain);
+}
+
+
+WRITE8_HANDLER( pit8253_w )
+{
+	stream_update(stream);
+
+	if (offset < 3)
+	{
+		if (pit8253.idx[offset] == 0)
+		{
+			pit8253.counts[offset].LSB = data;
+			pit8253.idx[offset] = 1;
+		}
+		else
+		{
+			pit8253.counts[offset].MSB = data;
+			pit8253.idx[offset] = 0;
+		}
+	}
+	else
+	{
+		int mode = (data >> 1) & 7;
+
+		if (mode == 3)
+		{
+			int cntsel = (data >> 6) & 3;
+			pit8253.idx[cntsel] = 0;
+			pit8253.counts[cntsel].val = 0;
+		}
+		else
+			mame_printf_debug("PIT8253: Unsupported mode %d.\n", mode);
+
+	}
+}
+
+READ8_HANDLER( pit8253_r )
+{
+	mame_printf_debug("PIT R: %x", offset);
+	return 0;
+}
+
+static void tx1_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
+{
+
+}
+
+/*
+    This is admittedly a bit of a hack job...
+*/
+static void buggyboy_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
+{
+	int step_0, step_1;
+	int n1_en, n2_en;
+	double gain0, gain1_l, gain1_r;
+
+	stream_sample_t *fl = &buffer[0][0];
+	stream_sample_t *fr = &buffer[1][0];
+
+	/* Clear the buffers */
+	memset(buffer[0], 0, length * sizeof(*buffer[0]));
+	memset(buffer[1], 0, length * sizeof(*buffer[1]));
+
+	/* 8253 outputs for the player/opponent buggy engine sounds. */
+	step_0 = pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / pit8253.counts[0].val) * freq_to_step : 0;
+	step_1 = pit8253.counts[1].val ? (BUGGYBOY_PIT_CLOCK / pit8253.counts[1].val) * freq_to_step : 0;
+
+	gain0 = BIT(ym_outputb, 3) ? 1.0 : 2.0;
+	n1_en = BIT(ym_outputb, 4);
+	n2_en = BIT(ym_outputb, 5);
+
+	gain1_l = bb_engine_gains[ym_outputa >> 4] * 5;
+	gain1_r = bb_engine_gains[ym_outputa & 0xf] * 5;
+
+	while (length--)
+	{
+		int i;
+		stream_sample_t pit0, pit1, n1, n2;
+		pit0 = buggyboy_eng_voltages[(step0 >> 24) & 0xf];
+		pit1 = buggyboy_eng_voltages[(step1 >> 24) & 0xf];
+
+		/* Calculate the tyre screech noise source */
+		for (i = 0; i < BUGGYBOY_NOISE_CLOCK / Machine->sample_rate; ++i)
+		{
+			/* CD4006 is a 4-4-1-4-4-1 shift register */
+			int p13 = BIT(noise_lfsra, 3);
+			int p12 = BIT(noise_lfsrb, 4);
+			int p10 = BIT(noise_lfsrc, 3);
+			int p8 = BIT(noise_lfsrd, 3);
+
+			/* Update the register */
+			noise_lfsra = p12 | ((noise_lfsra << 1) & 0xf);
+			noise_lfsrb = (p8 ^ p12) | ((noise_lfsrb << 1) & 0x1f);
+			noise_lfsrc = p13 | ((noise_lfsrc << 1) & 0xf);
+			noise_lfsrd = p10 | ((noise_lfsrd << 1) & 0x1f);
+
+			/* 4040 12-bit counter is clocked on the falling edge of Q13 */
+			if ( !BIT(noise_lfsrc, 3) && p10 )
+				noise_counter = (noise_counter + 1) & 0x0fff;
+		}
+
+		if (n1_en)
+		{
+			n1 = !BIT(noise_counter, 7-1) * 16000;
+			if ( BIT(noise_counter, 11-1) ) n1 /=2;
+		}
+		else
+			n1 = 8192;
+
+		if (n2_en)
+		{
+			n2 = !BIT(noise_counter, 6-1) * 16000;
+			if ( BIT(noise_counter, 11-1) ) n2 /=2;
+		}
+		else
+			n2 = 8192;
+
+		*fl++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l);
+		*fr++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r);
+
+		step0 += step_0;
+		step1 += step_1;
+	}
+}
+
+void *buggyboy_sh_start(int clock, const struct CustomSound_interface *config)
+{
+	static const int resistors[4] = { 330000, 220000, 330000, 220000 };
+	double aweights[4];
+	int i;
+	static const int tmp[16] =
+	{
+		0x0, 0x1, 0xe, 0xf, 0x8, 0x9, 0x6, 0x7, 0xc, 0xd, 0xe, 0xf, 0x4, 0x5, 0x6, 0x7
+	};
+
+	compute_resistor_weights(0,	16384,	-1.0,
+							4,	&resistors[0], aweights, 0,	0,
+							0, 0, 0, 0, 0,
+							0, 0, 0, 0, 0 );
+
+	for (i = 0; i < 16; i++)
+		buggyboy_eng_voltages[i] = combine_4_weights(aweights, BIT(tmp[i], 0), BIT(tmp[i], 1), BIT(tmp[i], 2), BIT(tmp[i], 3));
+
+	/* Allocate the stream */
+	stream = stream_create(0, 2, Machine->sample_rate, NULL, buggyboy_stream_update);
+
+	freq_to_step = (double)(1 << 24) / (double)Machine->sample_rate;
+	step0 = step1 = 0;
+
+	return auto_malloc(1);
+}
+
+void buggyboy_sh_reset(void *token)
+{
+	step0 = step1 = 0;
+
+	/* Reset noise LFSR */
+	noise_lfsra = 0;
+	noise_lfsrb = 1;
+	noise_lfsrc = 0;
+	noise_lfsrd = 0;
+}
+
+void *tx1_sh_start(int clock, const struct CustomSound_interface *config)
+{
+	/* Allocate the stream */
+	stream = stream_create(0, 2, Machine->sample_rate, NULL, tx1_stream_update);
+
+	freq_to_step = (double)(1 << 24) / (double)Machine->sample_rate;
+	step0 = 0;
+	step1 = 0;
+
+	return auto_malloc(1);
+}
+
+void tx1_sh_reset(void *token)
+{
+}
diff -Nru src-old/mame/drivers/aerofgt.c src/mame/drivers/aerofgt.c
--- src-old/mame/drivers/aerofgt.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/aerofgt.c	2007-12-23 19:43:45.000000000 -0800
@@ -1603,12 +1603,12 @@
 static MACHINE_DRIVER_START( turbofrc )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000,20000000/2)	/* 10 MHz (?) */
+	MDRV_CPU_ADD(M68000,20000000/2)	/* 10 MHz (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(turbofrc_readmem,turbofrc_writemem)
 	MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
 
-	MDRV_CPU_ADD(Z80,8000000/2)
-	/* audio CPU */	/* 4 MHz ??? */
+	MDRV_CPU_ADD(Z80,5000000)
+	/* audio CPU */	/* 5 MHz (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
 	MDRV_CPU_IO_MAP(turbofrc_sound_readport,turbofrc_sound_writeport)
 								/* IRQs are triggered by the YM2610 */
@@ -1631,7 +1631,7 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_STEREO("left", "right")
 
-	MDRV_SOUND_ADD(YM2610, 8000000)
+	MDRV_SOUND_ADD(YM2610, 8000000) /* (verified on pcb) */
 	MDRV_SOUND_CONFIG(ym2610_interface)
 	MDRV_SOUND_ROUTE(0, "left",  0.25)
 	MDRV_SOUND_ROUTE(0, "right", 0.25)
@@ -1682,12 +1682,12 @@
 static MACHINE_DRIVER_START( aerofgt )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000,20000000/2)	/* 10 MHz (?) */
+	MDRV_CPU_ADD(M68000,20000000/2)	/* 10 MHz (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(aerofgt_readmem,aerofgt_writemem)
 	MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
 
-	MDRV_CPU_ADD(Z80,8000000/2)
-	/* audio CPU */	/* 4 MHz ??? */
+	MDRV_CPU_ADD(Z80,5000000)
+	/* audio CPU */	/* 5 MHz (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
 	MDRV_CPU_IO_MAP(aerofgt_sound_readport,aerofgt_sound_writeport)
 								/* IRQs are triggered by the YM2610 */
@@ -1711,7 +1711,7 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_STEREO("left", "right")
 
-	MDRV_SOUND_ADD(YM2610, 8000000)
+	MDRV_SOUND_ADD(YM2610, 8000000) /* (verified on pcb) */
 	MDRV_SOUND_CONFIG(ym2610_interface)
 	MDRV_SOUND_ROUTE(0, "left",  0.25)
 	MDRV_SOUND_ROUTE(0, "right", 0.25)
diff -Nru src-old/mame/drivers/afega.c src/mame/drivers/afega.c
--- src-old/mame/drivers/afega.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/afega.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,1928 +0,0 @@
-/***************************************************************************
-
-  NOTE: this hardware is a bootleg of the hardware in nmk16.c
-        twinactn is a bootleg of mustang with different graphics, different
-        sound hardware, and some code shifted around
-
-  todo: either merge this with nmk16.c, or split the bootlegs / non nmk
-        hardware from nmk16.c into an nmk16 bootlegs driver
-
-        understand the 'protection' it may just be some kind of mirroring.
-
-****************************************************************************
-
-                              -= Afega Games =-
-
-                    driver by   Luca Elia (l.elia@tin.it)
-
-
-Main  CPU   :   M68000
-Video Chips :   AFEGA AFI-GFSK  (68 Pin PLCC)
-                AFEGA AFI-GFLK (208 Pin PQFP)
-
-Sound CPU   :   Z80
-Sound Chips :   M6295 (AD-65)  +  YM2151 (BS901)  +  YM3012 (BS902)
-
----------------------------------------------------------------------------
-Year + Game                     Notes
----------------------------------------------------------------------------
-95 Twin Action                  Does not work for unknown reasons. Protection?
-97 Red Hawk                     US Version of Stagger 1
-98 Sen Jin - Guardian Storm     Some text missing (protection, see service mode)
-98 Stagger I
-98 Bubble 2000                  By Tuning, but it seems to be the same HW
-00 Spectrum 2000                By YomaTech -- NOTE sprite bugs happen on real hw!!
-01 Fire Hawk                    By ESD with different sound hardware: 2 M6295
----------------------------------------------------------------------------
-
-Notes:
-
-- Afega is a Korean company. Its name is an acronym of "Art-Fiction Electronic Game".
-- Sen Jin: protection supplies some 68k code seen in the 2760-29cf range.
-    - or service mode is just complete, these are korean hacks afterall
-- Twinactn: to enter the hidden test mode press both P2 buttons during boot, then
-  P1 button 1 repeatedly.
-
-***************************************************************************/
-
-#include "driver.h"
-#include "sound/2151intf.h"
-#include "sound/okim6295.h"
-
-/* Variables defined in video: */
-
-extern UINT16 *afega_vram_0, *afega_scroll_0;
-extern UINT16 *afega_vram_1, *afega_scroll_1;
-
-/* Functions defined in video: */
-
-WRITE16_HANDLER( afega_vram_0_w );
-WRITE16_HANDLER( afega_vram_1_w );
-WRITE16_HANDLER( afega_palette_w );
-
-PALETTE_INIT( grdnstrm );
-
-VIDEO_START( afega );
-VIDEO_START( firehawk );
-VIDEO_START( twinactn );
-VIDEO_UPDATE( afega );
-VIDEO_UPDATE( redhawkb );
-VIDEO_UPDATE( bubl2000 );
-VIDEO_UPDATE( firehawk );
-VIDEO_UPDATE( twinactn );
-
-static UINT16 *ram;
-
-/***************************************************************************
-
-
-                            Memory Maps - Main CPU
-
-
-***************************************************************************/
-
-static READ16_HANDLER( afega_unknown_r )
-{
-	/* This fixes the text in Service Mode. */
-	return 0x0100;
-}
-
-static WRITE16_HANDLER( afega_soundlatch_w )
-{
-	if (ACCESSING_LSB)
-	{
-		soundlatch_w(0,data&0xff);
-		cpunum_set_input_line(1, 0, HOLD_LINE);
-	}
-}
-
-static WRITE16_HANDLER( afega_scroll0_w )
-{
-	COMBINE_DATA(&afega_scroll_0[offset]);
-}
-
-static WRITE16_HANDLER( afega_scroll1_w )
-{
-	COMBINE_DATA(&afega_scroll_1[offset]);
-}
-
-/*
- Lines starting with an empty comment in the following MemoryReadAddress
- arrays are there for debug (e.g. the game does not read from those ranges
- AFAIK)
-*/
-
-
-static ADDRESS_MAP_START( afega, ADDRESS_SPACE_PROGRAM, 16 )
-	ADDRESS_MAP_FLAGS( AMEF_ABITS(20) )
-	AM_RANGE(0x000000, 0x07ffff) AM_ROM
-	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)		// Buttons
-	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)		// P1 + P2
-	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)		// 2 x DSW
-	AM_RANGE(0x080012, 0x080013) AM_READ(afega_unknown_r)
-	AM_RANGE(0x080000, 0x08001d) AM_WRITE(MWA16_RAM)				//
-	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(afega_soundlatch_w)		// To Sound CPU
-/**/AM_RANGE(0x084000, 0x084003) AM_RAM AM_WRITE(afega_scroll0_w)	// Scroll on redhawkb (mirror or changed?..)
-/**/AM_RANGE(0x084004, 0x084007) AM_RAM AM_WRITE(afega_scroll1_w)   // Scroll on redhawkb (mirror or changed?..)
-	AM_RANGE(0x080020, 0x087fff) AM_WRITE(MWA16_RAM)				//
-/**/AM_RANGE(0x088000, 0x0885ff) AM_READWRITE(MRA16_RAM, afega_palette_w) AM_BASE(&paletteram16) // Palette
-	AM_RANGE(0x088600, 0x08bfff) AM_WRITE(MWA16_RAM)				//
-/**/AM_RANGE(0x08c000, 0x08c003) AM_RAM AM_WRITE(afega_scroll0_w) AM_BASE(&afega_scroll_0)	// Scroll
-/**/AM_RANGE(0x08c004, 0x08c007) AM_RAM AM_WRITE(afega_scroll1_w) AM_BASE(&afega_scroll_1)	//
-	AM_RANGE(0x08c008, 0x08ffff) AM_WRITE(MWA16_RAM)				//
-/**/AM_RANGE(0x090000, 0x091fff) AM_READWRITE(MRA16_RAM, afega_vram_0_w) AM_BASE(&afega_vram_0)	// Layer 0
-/**/AM_RANGE(0x092000, 0x093fff) AM_RAM								// ?
-/**/AM_RANGE(0x09c000, 0x09c7ff) AM_READWRITE(MRA16_RAM, afega_vram_1_w) AM_BASE(&afega_vram_1)	// Layer 1
-	AM_RANGE(0x0c0000, 0x0c7fff) AM_RAM								// RAM
-	AM_RANGE(0x0c8000, 0x0c8fff) AM_RAM AM_SHARE(1) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)	// Sprites
-	AM_RANGE(0x0c9000, 0x0cffff) AM_RAM	AM_SHARE(2) AM_BASE(&ram)				// RAM
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_RAM AM_SHARE(1)					// Sprites Mirror
-	AM_RANGE(0x0f9000, 0x0fffff) AM_RAM	AM_SHARE(2)				// RAM Mirror (MangChi)
-ADDRESS_MAP_END
-
-
-// The high byte of the word written is the address to write to (byte offset), the low byte is data
-static WRITE16_HANDLER( twinactn_scroll0_w )
-{
-	int byte = ((data >> 8) & 3) ^ 2;
-	int bit  = ((byte & 1) ? 0 : 8);
-	afega_scroll_0[byte / 2] = (afega_scroll_0[byte / 2] & (0xff << (8-bit))) | ((data & 0xff) << bit);
-}
-static WRITE16_HANDLER( twinactn_scroll1_w )
-{
-	int byte = ((data >> 8) & 3) ^ 2;
-	int bit  = ((byte & 1) ? 0 : 8);
-	afega_scroll_1[byte / 2] = (afega_scroll_1[byte / 2] & (0xff << (8-bit))) | ((data & 0xff) << bit);
-}
-
-static WRITE16_HANDLER( twinactn_flipscreen_w )
-{
-	if (ACCESSING_LSB)
-		flip_screen_set(data & 1);
-
-	if (data & (~1))
-		logerror("%06x: unknown flip screen bit written %04x\n", activecpu_get_pc(), data);
-}
-
-static ADDRESS_MAP_START( twinactn, ADDRESS_SPACE_PROGRAM, 16 )
-//  ADDRESS_MAP_FLAGS( AMEF_ABITS(20) )
-	AM_RANGE(0x000000, 0x03ffff) AM_ROM
-	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)		// Buttons
-	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)		// P1 + P2
-	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)		// 2 x DSW
-	AM_RANGE(0x080014, 0x080015) AM_WRITE(twinactn_flipscreen_w)
-	AM_RANGE(0x080016, 0x080017) AM_WRITE(MWA16_NOP)
-	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(afega_soundlatch_w)		// To Sound CPU
-/**/AM_RANGE(0x088000, 0x0885ff) AM_READWRITE(MRA16_RAM, afega_palette_w) AM_BASE(&paletteram16) // Palette
-/**/AM_RANGE(0x08c000, 0x08c003) AM_RAM AM_WRITE(twinactn_scroll0_w) AM_BASE(&afega_scroll_0)	// Scroll
-/**/AM_RANGE(0x08c004, 0x08c007) AM_RAM AM_WRITE(twinactn_scroll1_w) AM_BASE(&afega_scroll_1)	//
-	AM_RANGE(0x08c008, 0x08c087) AM_WRITE(MWA16_RAM)				//
-/**/AM_RANGE(0x090000, 0x091fff) AM_READWRITE(MRA16_RAM, afega_vram_0_w) AM_BASE(&afega_vram_0)	// Layer 0
-/**/AM_RANGE(0x092000, 0x093fff) AM_RAM								// ?
-/**/AM_RANGE(0x09c000, 0x09c7ff) AM_READWRITE(MRA16_RAM, afega_vram_1_w) AM_BASE(&afega_vram_1)	// Layer 1
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_RAM								// Work RAM
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)	// Sprites
-	AM_RANGE(0x0f9000, 0x0fffff) AM_RAM	AM_BASE(&ram)							// Work RAM
-ADDRESS_MAP_END
-
-/***************************************************************************
-
-
-                            Memory Maps - Sound CPU
-
-
-***************************************************************************/
-static WRITE8_HANDLER( spec2k_oki1_banking_w )
-{
- 	if(data == 0xfe)
- 		OKIM6295_set_bank_base(1, 0);
- 	else if(data == 0xff)
- 		OKIM6295_set_bank_base(1, 0x40000);
-}
-
-static ADDRESS_MAP_START( afega_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
-	AM_RANGE(0x0003, 0x0003) AM_WRITE(MWA8_NOP) // bug in sound prg?
-	AM_RANGE(0x0004, 0x0004) AM_WRITE(MWA8_NOP) // bug in sound prg?
-	AM_RANGE(0x0000, 0xefff) AM_ROM
-	AM_RANGE(0xf000, 0xf7ff) AM_RAM									// RAM
-	AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)					// From Main CPU
-	AM_RANGE(0xf808, 0xf808) AM_WRITE(YM2151_register_port_0_w)		// YM2151
-	AM_RANGE(0xf809, 0xf809) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)	// YM2151
-	AM_RANGE(0xf80a, 0xf80a) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)		// M6295
-ADDRESS_MAP_END
-
-static ADDRESS_MAP_START( firehawk_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
-	AM_RANGE(0x0000, 0xefff) AM_ROM
-	AM_RANGE(0xf000, 0xf7ff) AM_RAM
-	AM_RANGE(0xfff0, 0xfff0) AM_READ(soundlatch_r)
-	AM_RANGE(0xfff2, 0xfff2) AM_WRITE(spec2k_oki1_banking_w )
-	AM_RANGE(0xfff8, 0xfff8) AM_READWRITE(OKIM6295_status_1_r, OKIM6295_data_1_w)
-	AM_RANGE(0xfffa, 0xfffa) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
-	AM_RANGE(0xf800, 0xffff) AM_RAM // not used, only tested
-ADDRESS_MAP_END
-
-
-static WRITE8_HANDLER( twinactn_oki_bank_w )
-{
-	OKIM6295_set_bank_base(0, (data & 3) * 0x40000);
-
-	if (data & (~3))
-		logerror("%04x: invalid oki bank %02x\n", activecpu_get_pc(), data);
-
-//  logerror("%04x: oki bank %02x\n", activecpu_get_pc(), data);
-}
-
-static ADDRESS_MAP_START( twinactn_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
-	AM_RANGE(0x0000, 0x7fff) AM_ROM
-	AM_RANGE(0x8000, 0x87ff) AM_RAM
-	AM_RANGE(0x9000, 0x9000) AM_WRITE(twinactn_oki_bank_w)
-	AM_RANGE(0x9800, 0x9800) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
-	AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)		// From Main CPU
-ADDRESS_MAP_END
-
-/***************************************************************************
-
-
-                                Input Ports
-
-
-***************************************************************************/
-
-/***************************************************************************
-                                Stagger I
-***************************************************************************/
-
-static INPUT_PORTS_START( stagger1 )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
-	PORT_START_TAG("IN2")	// $080004.w
-	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
-	PORT_DIPSETTING(      0x0000, "1" )
-	PORT_DIPSETTING(      0x0080, "2" )
-	PORT_DIPSETTING(      0x00c0, "3" )
-	PORT_DIPSETTING(      0x0040, "5" )
-	PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Flip_Screen ) )
-	PORT_DIPSETTING(      0x0300, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPSETTING(      0x0200, "Horizontally" )
-	PORT_DIPSETTING(      0x0100, "Vertically" )
-	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-/* everything seems active high.. not low */
-static INPUT_PORTS_START( redhawkb )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_HIGH, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_HIGH, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_HIGH, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_HIGH, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_HIGH, IPT_START2   )
-	PORT_BIT(  0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
-	PORT_BIT(  0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-	PORT_BIT(  0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-
-	PORT_START_TAG("IN2")	// $080004.w  -- probably just redhawk but inverted
-	PORT_SERVICE( 0x0001, IP_ACTIVE_HIGH )    /* not working */
-	PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
-	PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( Lives ) )
-	PORT_DIPSETTING(      0x00c0, "1" )
-	PORT_DIPSETTING(      0x0040, "2" )
-	PORT_DIPSETTING(      0x0000, "3" )
-	PORT_DIPSETTING(      0x0080, "5" )
-	PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Flip_Screen ) )    /* not supported */
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0300, DEF_STR( On ) )
-	PORT_DIPSETTING(      0x0100, "Horizontally" )
-	PORT_DIPSETTING(      0x0200, "Vertically" )
-	PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x0000, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-/***************************************************************************
-                            Sen Jin - Guardian Storm
-***************************************************************************/
-
-static INPUT_PORTS_START( grdnstrm )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// IN1 - $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
-	PORT_START_TAG("IN2")	// $080004.w
-	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0008, 0x0008, "Bombs" )
-	PORT_DIPSETTING(      0x0008, "2" )
-	PORT_DIPSETTING(      0x0000, "3" )
-	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
-	PORT_DIPSETTING(      0x0000, "1" )
-	PORT_DIPSETTING(      0x0080, "2" )
-	PORT_DIPSETTING(      0x00c0, "3" )
-	PORT_DIPSETTING(      0x0040, "5" )
-	PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Flip_Screen ) )
-	PORT_DIPSETTING(      0x0300, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPSETTING(      0x0200, "Horizontally" )
-	PORT_DIPSETTING(      0x0100, "Vertically" )
-	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-/* Pop's Pop's */
-
-static INPUT_PORTS_START( popspops )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// IN1 - $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
-	/* the dips on this are a mess.. service mode doesn't seem to be 100% trustable */
-	PORT_START_TAG("IN2")	// $080004.w
-	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) ) // if ON it tells you the answers?!
-	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
-	PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-
-
-/***************************************************************************
-                                Bubble 2000
-***************************************************************************/
-
-static INPUT_PORTS_START( bubl2000 )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
-	PORT_START_TAG("IN2")	// $080004.w
-	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x00c0, 0x00c0, "Free Credit" )
-	PORT_DIPSETTING(      0x0080, "500k" )
-	PORT_DIPSETTING(      0x00c0, "800k" )
-	PORT_DIPSETTING(      0x0040, "1000k" )
-	PORT_DIPSETTING(      0x0000, "1500k" )
-	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) )
-	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0200, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0x1c00, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0x1400, DEF_STR( 1C_3C ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( 1C_4C ) )
-//  PORT_DIPSETTING(      0x0000, "Disabled" )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coin_A ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 1C_4C ) )
-//  PORT_DIPSETTING(      0x0000, "Disabled" )
-INPUT_PORTS_END
-
-/***************************************************************************
-                                Mang Chi
-***************************************************************************/
-
-static INPUT_PORTS_START( mangchi )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
-	PORT_START_TAG("IN2")	// $080004.w
-    PORT_DIPNAME( 0x0001, 0x0001, "DSWS" )		/* Setting to on cuases screen issues, Flip Screen? or unfinished test mode? */
-    PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
-    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
-    PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0018, 0x0018, "Vs Rounds" )
-	PORT_DIPSETTING(      0x0018, "2" )
-	PORT_DIPSETTING(      0x0010, "3" )
-	PORT_DIPSETTING(      0x0008, "4" )
-	PORT_DIPSETTING(      0x0000, "5" )
-    PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
-    PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
-	PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
-    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-    PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
-    PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-    PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
-    PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-    PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
-    PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
-    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )	/* Hard to tell levels of difficulty by play :-( */
-	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-
-/***************************************************************************
-                                Fire Hawk
-***************************************************************************/
-
-static INPUT_PORTS_START( firehawk )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
-	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN2") 	// $080004.w
-	PORT_DIPNAME( 0x0001, 0x0001, "Show Dip-Switch Settings" )
-	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x000e, 0x000e, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0006, DEF_STR( Very_Easy) )
-	PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
-//  PORT_DIPSETTING(      0x000a, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x000e, DEF_STR( Normal ) )
-//  PORT_DIPSETTING(      0x0000, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( Hardest ) )
-	PORT_DIPSETTING(      0x000c, DEF_STR( Very_Hard ) )
-	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0020, "Number of Bombs" )
-	PORT_DIPSETTING(      0x0020, "2" )
-	PORT_DIPSETTING(      0x0000, "3" )
-	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
-	PORT_DIPSETTING(      0x0000, "1" )
-	PORT_DIPSETTING(      0x0080, "2" )
-	PORT_DIPSETTING(      0x00c0, "3" )
-	PORT_DIPSETTING(      0x0040, "4" )
-	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Region ) )
-	PORT_DIPSETTING(      0x0200, DEF_STR( English ) )
-	PORT_DIPSETTING(      0x0000, "China" )
-	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Free_Play ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x1800, "Continue Coins" )
-	PORT_DIPSETTING(      0x1800, "1 Coin" )
-	PORT_DIPSETTING(      0x0800, "2 Coins" )
-	PORT_DIPSETTING(      0x1000, "3 Coins" )
-	PORT_DIPSETTING(      0x0000, "4 Coins" )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-
-/***************************************************************************
-                             Spectrum 2000
-***************************************************************************/
-
-static INPUT_PORTS_START( spec2k )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
-	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN2") 	// $080004.w
-	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0008, 0x0008, "Number of Bombs" )
-	PORT_DIPSETTING(      0x0008, "2" )
-	PORT_DIPSETTING(      0x0000, "3" )
-	PORT_DIPNAME( 0x0010, 0x0010, "Copyright Notice" )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
-	PORT_DIPSETTING(      0x0000, "1" )
-	PORT_DIPSETTING(      0x0080, "2" )
-	PORT_DIPSETTING(      0x00c0, "3" )
-	PORT_DIPSETTING(      0x0040, "5" )
-	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
-	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
-INPUT_PORTS_END
-
-
-/***************************************************************************
-                                Twin Action
-***************************************************************************/
-
-static INPUT_PORTS_START( twinactn )
-	PORT_START_TAG("IN0")	// $080000.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
-	PORT_SERVICE_NO_TOGGLE(0x0020, IP_ACTIVE_LOW   )	// Test in service mode
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
-
-	PORT_START_TAG("IN1")	// $080002.w
-	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
-	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x0080, IP_ACTIVE_HIGH,IPT_UNKNOWN )	// Tested at boot
-	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT(  0x8000, IP_ACTIVE_HIGH,IPT_UNKNOWN )	// Tested at boot
-
-	PORT_START_TAG("IN2")	// $080004.w
-	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
-	PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) )
-	PORT_DIPSETTING(      0x0010, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x0018, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0x001c, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0x0014, DEF_STR( 1C_3C ) )
-	PORT_DIPSETTING(      0x0004, DEF_STR( 1C_4C ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
-	PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) )
-	PORT_DIPSETTING(      0x0080, DEF_STR( 4C_1C ) )
-	PORT_DIPSETTING(      0x0040, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(      0x00c0, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(      0x0060, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_3C ) )
-	PORT_DIPSETTING(      0x0020, DEF_STR( 1C_4C ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
-
-	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
-	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0c00, DEF_STR( Easy ) )
-	PORT_DIPSETTING(      0x0400, DEF_STR( Normal ) )
-	PORT_DIPSETTING(      0x0800, DEF_STR( Hard ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
-	PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
-	PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) )
-	PORT_DIPSETTING(      0x4000, "2" )
-	PORT_DIPSETTING(      0xc000, "3" )
-	PORT_DIPSETTING(      0x8000, "4" )
-	PORT_DIPSETTING(      0x0000, "5" )
-INPUT_PORTS_END
-
-
-/***************************************************************************
-
-
-                            Graphics Layouts
-
-
-***************************************************************************/
-
-static const gfx_layout layout_8x8x4 =
-{
-	8,8,
-	RGN_FRAC(1,1),
-	4,
-	{ STEP4(0,1)	},
-	{ STEP8(0,4)	},
-	{ STEP8(0,8*4)	},
-	8*8*4
-};
-
-static const gfx_layout layout_16x16x4 =
-{
-	16,16,
-	RGN_FRAC(1,1),
-	4,
-	{ STEP4(0,1)	},
-	{ STEP8(0,4),   STEP8(8*8*4*2,4)	},
-	{ STEP8(0,8*4), STEP8(8*8*4*1,8*4)	},
-	16*16*4
-};
-
-static const gfx_layout layout_16x16x8 =
-{
-	16,16,
-	RGN_FRAC(1,2),
-	8,
-	{ STEP4(RGN_FRAC(0,2),1), STEP4(RGN_FRAC(1,2),1)	},
-	{ STEP8(0,4),   STEP8(8*8*4*2,4)	},
-	{ STEP8(0,8*4), STEP8(8*8*4*1,8*4)	},
-	16*16*4
-};
-
-
-static const gfx_layout layout_16x16x4_swapped =
-{
-	16,16,
-	RGN_FRAC(1,1),
-	4,
-	{ STEP4(0,1)	},
-	{ 4,0,12,8,20,16,28,24, 512+4,512+0,512+12,512+8,512+20,512+16,512+28,512+24},
-	{ STEP8(0,8*4), STEP8(8*8*4*1,8*4)	},
-	16*16*4
-};
-
-static GFXDECODE_START( grdnstrm )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4,	256*1, 16 ) // [0] Sprites
-	GFXDECODE_ENTRY( REGION_GFX2, 0, layout_16x16x8,	256*3, 16 ) // [1] Layer 0
-	GFXDECODE_ENTRY( REGION_GFX3, 0, layout_8x8x4,	256*2, 16 ) // [2] Layer 1
-GFXDECODE_END
-
-static GFXDECODE_START( stagger1 )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4,	256*1, 16 ) // [0] Sprites
-	GFXDECODE_ENTRY( REGION_GFX2, 0, layout_16x16x4,	256*0, 16 ) // [1] Layer 0
-	GFXDECODE_ENTRY( REGION_GFX3, 0, layout_8x8x4,	256*2, 16 ) // [2] Layer 1
-GFXDECODE_END
-
-static GFXDECODE_START( redhawkb )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4_swapped,	256*1, 16 ) // [0] Sprites
-	GFXDECODE_ENTRY( REGION_GFX2, 0, layout_16x16x4_swapped,	256*0, 16 ) // [1] Layer 0
-	GFXDECODE_ENTRY( REGION_GFX3, 0, layout_8x8x4,			256*2, 16 ) // [2] Layer 1
-GFXDECODE_END
-
-
-/***************************************************************************
-
-
-                                Machine Drivers
-
-
-***************************************************************************/
-
-static void irq_handler(int irq)
-{
-	cpunum_set_input_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
-}
-
-static const struct YM2151interface afega_ym2151_intf =
-{
-	irq_handler
-};
-
-static INTERRUPT_GEN( interrupt_afega )
-{
-	switch ( cpu_getiloops() )
-	{
-		case 0:		irq2_line_hold();	break;
-		case 1:		irq4_line_hold();	break;
-	}
-}
-
-static MACHINE_DRIVER_START( stagger1 )
-
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000,12000000)
-	MDRV_CPU_PROGRAM_MAP(afega,0)
-	MDRV_CPU_VBLANK_INT(interrupt_afega,2)
-
-	MDRV_CPU_ADD(Z80, 4000000)
-	/* audio CPU */	/* ? */
-	MDRV_CPU_PROGRAM_MAP(afega_sound_cpu,0)
-
-	MDRV_SCREEN_REFRESH_RATE(56)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)	/* fixed */
-	MDRV_GFXDECODE(stagger1)
-	MDRV_PALETTE_LENGTH(768)
-
-	MDRV_VIDEO_START(afega)
-	MDRV_VIDEO_UPDATE(afega)
-
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_STEREO("left", "right")
-
-	MDRV_SOUND_ADD(YM2151, 4000000)
-	MDRV_SOUND_CONFIG(afega_ym2151_intf)
-	MDRV_SOUND_ROUTE(0, "left", 0.30)
-	MDRV_SOUND_ROUTE(1, "right", 0.30)
-
-	MDRV_SOUND_ADD(OKIM6295, 1000000)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.70)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.70)
-MACHINE_DRIVER_END
-
-static MACHINE_DRIVER_START( redhawkb )
-	/* basic machine hardware */
-	MDRV_IMPORT_FROM(stagger1)
-	/* video hardware */
-	MDRV_GFXDECODE(redhawkb)
-	MDRV_VIDEO_UPDATE(redhawkb)
-MACHINE_DRIVER_END
-
-static MACHINE_DRIVER_START( grdnstrm )
-
-	/* basic machine hardware */
-	MDRV_IMPORT_FROM(stagger1)
-
-	/* video hardware */
-	MDRV_GFXDECODE(grdnstrm)
-	MDRV_PALETTE_LENGTH(768)
-	MDRV_COLORTABLE_LENGTH(768 + 16*256)
-
-	MDRV_PALETTE_INIT(grdnstrm)
-MACHINE_DRIVER_END
-
-static MACHINE_DRIVER_START( popspops )
-
-	/* basic machine hardware */
-	MDRV_IMPORT_FROM(stagger1)
-
-	/* video hardware */
-	MDRV_GFXDECODE(grdnstrm)
-	MDRV_PALETTE_LENGTH(768)
-	MDRV_COLORTABLE_LENGTH(768 + 16*256)
-
-	MDRV_PALETTE_INIT(grdnstrm)
-
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1)
-	MDRV_VIDEO_UPDATE(bubl2000)
-MACHINE_DRIVER_END
-
-
-static MACHINE_DRIVER_START( bubl2000 )
-
-	/* basic machine hardware */
-	MDRV_IMPORT_FROM(grdnstrm)
-
-	/* video hardware */
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1)	/* added to do not break other games */
-	MDRV_VIDEO_UPDATE(bubl2000)
-MACHINE_DRIVER_END
-
-static MACHINE_DRIVER_START( firehawk )
-
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000,12000000)
-	MDRV_CPU_PROGRAM_MAP(afega,0)
-	MDRV_CPU_VBLANK_INT(interrupt_afega,2)
-
-	MDRV_CPU_ADD(Z80,4000000)
-	/* audio CPU */
-	MDRV_CPU_PROGRAM_MAP(firehawk_sound_cpu,0)
-
-	MDRV_SCREEN_REFRESH_RATE(56)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(8, 256-8-1, 16, 256-16-1)
-	MDRV_GFXDECODE(grdnstrm)
-	MDRV_PALETTE_LENGTH(768)
-	MDRV_COLORTABLE_LENGTH(768 + 16*256)
-
-	MDRV_PALETTE_INIT(grdnstrm)
-	MDRV_VIDEO_START(firehawk)
-	MDRV_VIDEO_UPDATE(firehawk)
-
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
-
-	MDRV_SOUND_ADD(OKIM6295, 1000000)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
-	MDRV_SOUND_ADD(OKIM6295, 1000000)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7high)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-MACHINE_DRIVER_END
-
-
-static INTERRUPT_GEN( interrupt_twinactn )
-{
-	switch ( cpu_getiloops() )
-	{
-		case 0:		irq1_line_hold();	break;
-		case 1:		irq2_line_hold();	break;
-		case 2:		irq4_line_hold();	break;
-	}
-}
-
-static MACHINE_DRIVER_START( twinactn )
-
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000,12000000)
-	MDRV_CPU_PROGRAM_MAP(twinactn,0)
-	MDRV_CPU_VBLANK_INT(interrupt_twinactn,3)
-
-	MDRV_CPU_ADD(Z80, 4000000)
-	/* audio CPU */	/* ? */
-	MDRV_CPU_PROGRAM_MAP(twinactn_sound_cpu,0)
-
-	MDRV_SCREEN_REFRESH_RATE(56)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1)
-	MDRV_GFXDECODE(stagger1)
-	MDRV_PALETTE_LENGTH(768)
-
-	MDRV_VIDEO_START(twinactn)
-	MDRV_VIDEO_UPDATE(twinactn)
-
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
-
-	MDRV_SOUND_ADD(OKIM6295, 1000000)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-MACHINE_DRIVER_END
-
-
-/***************************************************************************
-
-
-                                ROMs Loading
-
-
-***************************************************************************/
-
-/* Address lines scrambling */
-
-static void decryptcode( int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12,
-	int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 )
-{
-	int i;
-	UINT8 *RAM = memory_region( REGION_CPU1 );
-	size_t  size = memory_region_length( REGION_CPU1 );
-	UINT8 *buffer = malloc_or_die( size );
-
-		memcpy( buffer, RAM, size );
-		for( i = 0; i < size; i++ )
-		{
-			RAM[ i ] = buffer[ BITSWAP24( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
-				a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0 ) ];
-		}
-		free( buffer );
-}
-
-/***************************************************************************
-
-                                    Stagger I
-(AFEGA 1998)
-
-Parts:
-
-1 MC68HC000P10
-1 Z80
-2 Lattice ispLSI 1032E
-
-***************************************************************************/
-
-ROM_START( stagger1 )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x020000, CRC(8555929b) SHA1(b405d81c2a45191111b1a4458ac6b5c0a129b8f1) )
-	ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x020000, CRC(5b0b63ac) SHA1(239f793b6845a88d1630da790a2762da730a450d) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
-
-	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD16_BYTE( "7.bin", 0x00000, 0x80000, CRC(048f7683) SHA1(7235b7dcfbb72abf44e60b114e3f504f16d29ebf) )
-	ROM_LOAD16_BYTE( "6.bin", 0x00001, 0x80000, CRC(051d4a77) SHA1(664182748e72b3e44202caa20f337d02e946ca62) )
-
-	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x4 */
-	ROM_LOAD( "4.bin", 0x00000, 0x80000, CRC(46463d36) SHA1(4265bc4d24ff64e39d9273965701c740d7e3fee0) )
-
-	ROM_REGION( 0x00100, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
-	// Unused
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
-ROM_END
-
-
-/***************************************************************************
-
-                            Red Hawk (c)1997 Afega
-
-
-
-    6116         ym2151     MSM6295   5    4MHz
-    1
-    Z80        pLSI1032    4
-                                      76C88
-       6116   76C256                  76C88
-       6116   76C256
-    2  76C256 76C256
-    3  76C256 76C256
-
-    68000-10        6116
-                    6116
-   SW1                             6
-   SW21                pLSI1032    7
-    12MHz
-
-***************************************************************************/
-
-ROM_START( redhawk )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "2", 0x000000, 0x020000, CRC(3ef5f326) SHA1(e89c7c24a05886a14995d7c399958dc00ad35d63) )
-	ROM_LOAD16_BYTE( "3", 0x000001, 0x020000, CRC(9b3a10ef) SHA1(d03480329b23474e5a9e42a75b09d2140eed4443) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
-
-	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD16_BYTE( "6", 0x000001, 0x080000, CRC(61560164) SHA1(d727ab2d037dab40745dec9c4389744534fdf07d) )
-	ROM_LOAD16_BYTE( "7", 0x000000, 0x080000, CRC(66a8976d) SHA1(dd9b89cf29eb5557845599d55ef3a15f53c070a4) )
-
-	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "4", 0x000000, 0x080000, CRC(d6427b8a) SHA1(556de1b5ce29d1c3c54bb315dcaa4dd0848ca462) )
-
-	ROM_REGION( 0x00100, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
-	// Unused
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
-ROM_END
-
-static DRIVER_INIT( redhawk )
-{
-	decryptcode( 23, 22, 21, 20, 19, 18, 16, 15, 14, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
-}
-
-ROM_START( redhawkb )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "rhb-1.bin", 0x000000, 0x020000, CRC(e733ea07) SHA1(b1ffeda633d5e701f0e97c79930a54d7b89a85c5) )
-	ROM_LOAD16_BYTE( "rhb-2.bin", 0x000001, 0x020000, CRC(f9fa5684) SHA1(057ea3eebbaa1a208a72beef21b9368df7032ce1) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
-
-	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD( "rhb-3.bin", 0x000000, 0x080000, CRC(0318d68b) SHA1(c773de7b6f9c706e62349dc73af4339d1a3f9af6) )
-	ROM_LOAD( "rhb-4.bin", 0x080000, 0x080000, CRC(ba21c1ef) SHA1(66b0dee67acb5b3a21c7dba057be4093a92e10a9) )
-
-	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "rhb-5.bin", 0x000000, 0x080000, CRC(d0eaf6f2) SHA1(6e946e13b06df897a63e885c9842816ec908a709) )
-
-	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
-ROM_END
-
-
-/***************************************************************************
-
-                            Sen Jin - Guardian Storm
-
-(C) Afega 1998
-
-CPU: 68HC000FN10 (68000, 68 pin PLCC)
-SND: Z84C000FEC (Z80, 44 pin PQFP), AD-65 (OKI M6295),
-     BS901 (YM2151, 24 pin DIP), BS901 (YM3012, 16 pin DIP)
-OSC: 12.000MHz (near 68000), 4.000MHz (Near Z84000)
-RAM: LH52B256 x 8, 6116 x 7
-DIPS: 2 x 8 position
-
-Other Chips: AFEGA AFI-GFSK (68 pin PLCC, located next to 68000)
-             AFEGA AFI-GFLK (208 pin PQFP)
-
-ROMS:
-GST-01.U92   27C512, \
-GST-02.U95   27C2000  > Sound Related, all located near Z80
-GST-03.U4    27C512  /
-
-GST-04.112   27C2000 \
-GST-05.107   27C2000  /Main Program
-
-GST-06.C13   read as 27C160  label = AF1-SP (Sprites?)
-GST-07.C08   read as 27C160  label = AF1=B2 (Backgrounds?)
-GST-08.C03   read as 27C160  label = AF1=B1 (Backgrounds?)
-
-***************************************************************************/
-
-ROM_START( grdnstrm )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "gst-04.112", 0x000000, 0x040000, CRC(922c931a) SHA1(1d1511033c8c424535a73f5c5bf58560a8b1842e) )
-	ROM_LOAD16_BYTE( "gst-05.107", 0x000001, 0x040000, CRC(d22ca2dc) SHA1(fa21c8ec804570d64f4b167b7f65fd5811435e46) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "gst-01.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
-
-	ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD( "gst-06.c13", 0x000000, 0x200000, CRC(7d4d4985) SHA1(15c6c1aecd3f12050c1db2376f929f1a26a1d1cf) )
-
-	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "gst-07.c08", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) )
-	ROM_LOAD( "gst-08.c03", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) )
-
-	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
-	ROM_LOAD( "gst-03.u4",  0x00000, 0x10000, CRC(a1347297) SHA1(583f4da991eeedeb523cf4fa3b6900d40e342063) )
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "gst-02.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
-ROM_END
-
-static DRIVER_INIT( grdnstrm )
-{
-	decryptcode( 23, 22, 21, 20, 19, 18, 16, 17, 14, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
-}
-
-/* Pop's Pop's */
-
-/*
-
-Pop's Pop's by Afega (1999)
-
-The pcb might be missing an eprom in a socket
-  --- i just think it uses a generic PCB but no sprites in this case,.
-
-1x 68k
-1x z80
-1x Ad65 (oki 6295)
-1x OSC 12mhz (near 68k)
-1x OSC 4mhz (near z80)
-1x ym2151
-1x Afega AF1-CFLK custom chip Smt
-1x Afega AF1-CF5K custom chip socketed
-2x dipswitch banks
-
-*/
-
-ROM_START( popspops )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "afega4.u112", 0x000000, 0x040000, CRC(db191762) SHA1(901fdc20374473127d694513d4291e29e65eafe8) )
-	ROM_LOAD16_BYTE( "afega5.u107", 0x000001, 0x040000, CRC(17e0c48b) SHA1(833c61c4b3ee293b0bcddfa86dfa9c1014375115) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "afega1.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
-
-	ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	/* no sprite roms? */
-
-	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "afega6.uc8", 0x000000, 0x200000, CRC(6d506c97) SHA1(4909c0b530f9526c8bf76e502c914ef10a50d1fc) )
-	ROM_LOAD( "afega7.uc3", 0x200000, 0x200000, CRC(02d7f9de) SHA1(10102ffbf37a57afa300b01cb5067b7e672f4999) )
-
-	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
-	ROM_LOAD( "afega3.u4",  0x00000, 0x10000, CRC(f39dd5d2) SHA1(80d05d57a621b0063f63ce05be9314f718b3c111) )
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "afega2.u95", 0x00000, 0x40000, CRC(ecd8eeac) SHA1(849beba8f04cc322bb8435fa4c26551a6d0dec64) )
-ROM_END
-
-/*
-Mang-chi by Afega
-
-1x osc 4mhz
-1x osc 12mhz
-1x tmp68hc0000p-10
-1x z80c006
-1x AD65 (MSM6295)
-1x CY5001 (YM2151 rebadged)
-2x dipswitch
-1x fpga
-1x smd ASIC not marked
-
-Dumped by Corrado Tomaselli
-*/
-
-ROM_START( mangchi )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "afega9.u112", 0x00000, 0x40000, CRC(0b1517a5) SHA1(50e307641759bb2a35aff56ef9598364740803a0) )
-	ROM_LOAD16_BYTE( "afega10.u107", 0x00001, 0x40000, CRC(b1d0f33d) SHA1(68b5be3f7911f7299566c5bf5801e90099433613) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "sound.u92", 0x00000, 0x10000, CRC(bec4f9aa) SHA1(18fb2ee06892983c117a62b70cd72a98f60a08b6) )
-
-	ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD16_BYTE( "afega6.uc11", 0x000000, 0x040000, CRC(979efc30) SHA1(227fe1e20137253aac04585d2bbf67091d032e56) )
-	ROM_LOAD16_BYTE( "afega7.uc14", 0x000001, 0x040000, CRC(c5cbcc38) SHA1(86070a9598e80f90ec7892d623e1a975ccc68178) )
-
-	ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "afega5.uc6",  0x000000, 0x80000, CRC(c73261e0) SHA1(0bb66aa315aaecb26169812cf47a6504a74f0db5) )
-	ROM_LOAD( "afega4.uc1",  0x080000, 0x80000, CRC(73940917) SHA1(070305c81de959c9d00b6cf1cc20bbafa204976a) )
-
-	ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "afega2.u95", 0x00000, 0x40000, CRC(78c8c1f9) SHA1(eee0d03164a0ac0ddc5186ab56090320e9d33aa7) )
-ROM_END
-
-/***************************************************************************
-
-                            Bubble 2000 (c)1998 Tuning
-
-Bubble 2000
-Tuning, 1998
-
-CPU   : TMP68HC000P-10 (68000)
-SOUND : Z840006 (Z80, 44 pin QFP), YM2151, OKI M6295
-OSC   : 4.000MHZ, 12.000MHz
-DIPSW : 8 position (x2)
-RAM   : 6116 (x5, gfx related?) 6116 (x1, sound program ram), 6116 (x1, near rom3)
-        64256 (x4, gfx related?), 62256 (x2, main program ram), 6264 (x2, gfx related?)
-PALs/PROMs: None
-Custom: Unknown 208 pin QFP labelled LTC2 (Graphics generator)
-        Unknown 68 pin PLCC labelled LTC1 (?, near rom 2 and rom 3)
-ROMs  :
-
-Filename    Type        Possible Use
-----------------------------------------------
-rom01.92    27C512      Sound Program
-rom02.95    27C020      Oki Samples
-rom03.4     27C512      ? (located near rom 1 and 2 and near LTC1)
-rom04.1     27C040   \
-rom05.3     27C040    |
-rom06.6     27C040    |
-rom07.9     27C040    | Gfx
-rom08.11    27C040    |
-rom09.14    27C040    |
-rom12.2     27C040    |
-rom13.7     27C040   /
-
-rom10.112   27C040   \  Main Program
-rom11.107   27C040   /
-
-
-
-
-***************************************************************************/
-
-ROM_START( bubl2000 )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "rom10.112", 0x00000, 0x20000, CRC(87f960d7) SHA1(d22fe1740217ac20963bd9003245850598ccecf2) )
-	ROM_LOAD16_BYTE( "rom11.107", 0x00001, 0x20000, CRC(b386041a) SHA1(cac36e22a39b5be0c5cd54dce5c912ff811edb28) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "rom01.92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) /* same as the other games on this driver */
-
-	ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD16_BYTE( "rom08.11", 0x000000, 0x040000, CRC(519dfd82) SHA1(116b06f6e7b283a5417338f716bbaab6cfadb41d) )
-	ROM_LOAD16_BYTE( "rom09.14", 0x000001, 0x040000, CRC(04fcb5c6) SHA1(7594fa6bf98fc01b8848473a222a621c7c9ff00d) )
-
-	ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "rom06.6",  0x000000, 0x080000, CRC(ac1aabf5) SHA1(abce6ba381b189ab3ec703a8ef74bccbe10876e0) )
-	ROM_LOAD( "rom07.9",  0x080000, 0x080000, CRC(69aff769) SHA1(89b98c1023710861e622c8a186b6ec48f5109d42) )
-	ROM_LOAD( "rom13.7",  0x100000, 0x080000, CRC(3a5b7226) SHA1(1127740c5bc2f830d73a77c8831e1b0db6606375) )
-	ROM_LOAD( "rom04.1",  0x180000, 0x080000, CRC(46acd054) SHA1(1bd7a1b6b2ce6a3daa8c92843c546beb377af8fb) )
-	ROM_LOAD( "rom05.3",  0x200000, 0x080000, CRC(37deb6a1) SHA1(3a8a3d961800bb15fd389429b92fa1e5b5f416df) )
-	ROM_LOAD( "rom12.2",  0x280000, 0x080000, CRC(1fdc59dd) SHA1(d38e21c878241b4315a36e0590397211ca63f2c4) )
-
-	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
-	ROM_LOAD( "rom03.4",  0x00000, 0x10000, CRC(f4c15588) SHA1(a21ae71c0a8c7c1df63f9905fd86303bc2d3991c) )
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "rom02.95", 0x00000, 0x40000, CRC(859a86e5) SHA1(7b51964227411a40aac54b9cd9ff64f091bdf2b0) )
-ROM_END
-
-
-/*
-
-Hot Bubble
-Afega, 1998
-
-PCB Layout
-----------
-
-Bottom Board
-
-|------------------------------------------|
-| BS902  BS901   Z80                  4MHz |
-|                                          |
-|        6116    6295                      |
-|                                   62256  |
-|      6116                         62256  |
-|      6116                                |
-|J           6116           |------------| |
-|A           6116           |   68000    | |
-|M                          |------------| |
-|M  DSW2   6264                            |
-|A         6264                            |
-|                                          |
-|         |-------|                        |
-|         |       |                        |
-|         |       |                        |
-| DSW1    |       |     62256   62256      |
-|         |-------|                        |
-|              6116     62256   62256      |
-|12MHz         6116                        |
-|------------------------------------------|
-Notes:
-      68000 - running at 12.000MHz
-      Z80   - running at 4.000MHz
-      62256 - 32K x8 SRAM
-      6264  - 8K x8 SRAM
-      6116  - 2K x8 SRAM
-      BS901 - YM2151, running at 4.000MHz
-      BS902 - YM3012
-      6295  - OKI MSM6295 running at 1.000MHz [4/4], sample rate = 1000000 / 132
-      *     - Unknown QFP208
-      VSync - 56.2Hz (measured on 68000 IPL1)
-
-Top Board
-
-|---------------------------|
-|                           |
-|   S1     S2        T1     |
-|                           |
-|   CR5    CR7       C1     |
-|                           |
-|   CR6   +CR8       C2     |
-|                           |
-|          BR1       BR3    |
-|                           |
-|         +BR2      +BR4    |
-|                           |
-|  CR1     CR3     |------| |
-|                  |  *   | |
-|  CR2    +CR4     |      | |
-|                  |------| |
-|---------------------------|
-Notes:
-      * - Unknown PLCC68 IC
-      + - Not populated
-
-*/
-
-ROM_START( hotbubl )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "c1.uc1",  0x00001, 0x40000, CRC(7bb240e9) SHA1(99048fa275182c3da3bfb0dedd790f4b5858bd92) )
-	ROM_LOAD16_BYTE( "c2.uc9",  0x00000, 0x40000, CRC(7917b95d) SHA1(0344bae9c373c5943e7693720e5e531bc2e0d7ee) )
-
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "s1.uc14", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) /* same as the other games on this driver */
-
-	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD16_BYTE( "br1.uc3",  0x000000, 0x080000, CRC(6fc18de4) SHA1(57b4823fc41637780f64eadd1ddf61db531a2599) )
-	ROM_LOAD16_BYTE( "br3.uc10", 0x000001, 0x080000, CRC(bb677240) SHA1(d7a26bcd33d491cee441edda6d092a1d08308b0e) )
-
-	ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "cr6.uc16",  0x100000, 0x080000, CRC(99d6523c) SHA1(0b628585d749e175d5a4dc600af1ba9cb936bfeb) )
-	ROM_LOAD( "cr7.uc19",  0x080000, 0x080000, CRC(a89d9ce4) SHA1(5965b2b4b67bc91bc0e7474e593c7e1953b75adc) )
-	ROM_LOAD( "cr5.uc15",  0x000000, 0x080000, CRC(65bd5159) SHA1(627ccc0ab131e643c3c52ee9bb41c7a85153c35e) )
-
-	ROM_LOAD( "cr2.uc7",  0x280000, 0x080000, CRC(27ad6fc8) SHA1(00b1a5c5e1a245590b300b9baf71585d41813e3e) )
-	ROM_LOAD( "cr3.uc12", 0x200000, 0x080000, CRC(c841a4f6) SHA1(9b0ee5623c87a0cfc63d3741a65d399bd6593f18) )
-	ROM_LOAD( "cr1.uc6",  0x180000, 0x080000, CRC(fc9101d2) SHA1(1d5b8484264b6d73fe032946096a469226cce901) )
-
-	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
-	ROM_LOAD( "t1.uc2",  0x00000, 0x10000, CRC(ce683a93) SHA1(aeee2671051f1badf2255375cd7c5fa847d1746c) )
-
-	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "s2.uc18", 0x00000, 0x40000, CRC(401c980f) SHA1(e47710c47cfeecce3ccf87f845b219a9c9f21ee3) )
-ROM_END
-
-static DRIVER_INIT( bubl2000 )
-{
-	decryptcode( 23, 22, 21, 20, 19, 18, 13, 14, 15, 16, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
-}
-
-/*
-
-Fire Hawk - ESD
----------------
-
-- To enter test mode, hold on button 1 at boot up
-
-
-PCB Layout
-----------
-
-ESD-PROT-002
-|------------------------------------------------|
-|      FHAWK_S1.U40   FHAWK_S2.U36               |
-|      6116     6295  FHAWK_S3.U41               |
-|               6295                 FHAWK_G1.UC6|
-|    PAL   Z80                       FHAWK_G2.UC5|
-|    4MHz                             |--------| |
-|                                     | ACTEL  | |
-|J   6116             62256           |A54SX16A| |
-|A   6116             62256           |        | |
-|M                                    |(QFP208)| |
-|M                                    |--------| |
-|A     DSW1              FHAWK_G3.UC2            |
-|      DSW2                           |--------| |
-|      DSW3                           | ACTEL  | |
-|                     6116            |A54SX16A| |
-|                     6116            |        | |
-|      62256                          |(QFP208)| |
-| FHAWK_P1.U59                        |--------| |
-| FHAWK_P2.U60  PAL                  62256  62256|
-|                                                |
-|12MHz 62256   68000                 62256  62256|
-|------------------------------------------------|
-Notes:
-      68000 clock: 12.000MHz
-        Z80 clock: 4.000MHz
-      6295 clocks: 1.000MHz (both), sample rate = 1000000 / 132 (both)
-            VSync: 56Hz
-
-*/
-
-ROM_START( firehawk )
-	ROM_REGION( 0x100000, REGION_CPU1, 0 )	/* 68000 Code */
-	ROM_LOAD16_BYTE( "fhawk_p1.u59", 0x00001, 0x80000, CRC(d6d71a50) SHA1(e947720a0600d049b7ea9486442e1ba5582536c2) )
-	ROM_LOAD16_BYTE( "fhawk_p2.u60", 0x00000, 0x80000, CRC(9f35d245) SHA1(5a22146f16bff7db924550970ed2a3048bc3edab) )
-
-	ROM_REGION( 0x20000, REGION_CPU2, 0 )	/* Z80 Code */
-	ROM_LOAD( "fhawk_s1.u40", 0x00000, 0x20000, CRC(c6609c39) SHA1(fe9b5f6c3ab42c48cb493fecb1181901efabdb58) )
-
-	ROM_REGION( 0x200000, REGION_GFX1,ROMREGION_DISPOSE ) /* Sprites, 16x16x4 */
-	ROM_LOAD( "fhawk_g3.uc2", 0x00000, 0x200000,  CRC(cae72ff4) SHA1(7dca7164015228ea039deffd234778d0133971ab) )
-
-	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layer 0, 16x16x8 */
-	ROM_LOAD( "fhawk_g1.uc6", 0x000000, 0x200000, CRC(2ab0b06b) SHA1(25362f6a517f188c62bac28b1a7b7b49622b1518) )
-	ROM_LOAD( "fhawk_g2.uc5", 0x200000, 0x200000, CRC(d11bfa20) SHA1(15142004ab49f7f1e666098211dff0835c61df8d) )
-
-	ROM_REGION( 0x00100, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
-	// Unused
-
-	ROM_REGION( 0x040000, REGION_SOUND1, 0 ) /* Samples */
-	ROM_LOAD( "fhawk_s2.u36", 0x00000, 0x40000, CRC(d16aaaad) SHA1(96ca173ca433164ed0ae51b41b42343bd3cfb5fe) )
-
-	ROM_REGION( 0x040000, REGION_SOUND2, 0 ) /* Samples */
-	ROM_LOAD( "fhawk_s3.u41", 0x00000, 0x40000, CRC(3fdcfac2) SHA1(c331f2ea6fd682cfb00f73f9a5b995408eaab5cf) )
-ROM_END
-
-/*
-
-CPU
-1x unknown custom chip
-1x FPGA
-1x oscillator 4.000MHz
-1x oscillator 12.000MHz
-2x AD-65
-
-ROMs
-1x TMS27C512 (1)
-1x MX27C4000 (3)
-2x TMS27C010A (2,4)
-2x TMS27C020 (5,6)
-3x MX29F1610ML (uc1,uc2,uc3)
-
-Note
-1x JAMMA connector
-1x trimmer (volume)
-2x8 dip switches
-
-*/
-
-ROM_START( spec2k )
-	ROM_REGION( 0x80000, REGION_CPU1, 0 )	/* 68000 Code */
-	ROM_LOAD16_BYTE( "yonatech5.u124", 0x00000, 0x40000, CRC(72ab5c05) SHA1(182a811982b89b8cda0677547ef0625c274f5c6b) )
-	ROM_LOAD16_BYTE( "yonatech6.u120", 0x00001, 0x40000, CRC(7e44bd9c) SHA1(da59685be14a09ec037743fcec34fb293f7d588d) )
-
-	ROM_REGION( 0x20000, REGION_CPU2, 0 )	/* Z80 Code */
-	ROM_LOAD( "yonatech1.u103", 0x00000, 0x10000, CRC(ef5acda7) SHA1(e55b36a1598ecbbbad984997d61599dfa3958f60) )
-
-	ROM_REGION( 0x200000, REGION_GFX1,ROMREGION_DISPOSE ) /* Sprites, 16x16x4 */
-	ROM_LOAD( "u154.bin", 0x00000, 0x200000, CRC(f77b764e) SHA1(37e249bd4d7174c5232261880ce8debf42723716) )
-
-	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layer 0, 16x16x8 */
-	ROM_LOAD( "u153.bin", 0x000000, 0x200000, CRC(a00bbf8f) SHA1(622f52ef50d52cdd5e6b250d68439caae5c13404) )
-	ROM_LOAD( "u152.bin", 0x200000, 0x200000, CRC(f6423fab) SHA1(253e0791eb58efa1df42e9c74d397e6e65c8c252) )
-
-	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
-	ROM_LOAD( "yonatech4.u3", 0x00000, 0x20000, CRC(5626b08e) SHA1(63207ed6b4fc8684690bf3fe1991a4f3babd73e8) )
-
-	ROM_REGION( 0x020000, REGION_SOUND1, 0 ) /* Samples */
-	ROM_LOAD( "yonatech2.u101", 0x00000, 0x20000, CRC(4160f172) SHA1(0478a5a4bbba115e6cfb5501aa55aa2836c963bf) )
-
-	ROM_REGION( 0x080000, REGION_SOUND2, 0 ) /* Samples */
-	ROM_LOAD( "yonatech3.u106", 0x00000, 0x80000, CRC(6644c404) SHA1(b7ad3f9f08971432d024ef8be3fa3140f0bbae67) )
-ROM_END
-
-static DRIVER_INIT( spec2k )
-{
-	decryptcode( 23, 22, 21, 20,
-		         19, 18, 17, 13,
-	             14, 15, 16, 12,
-		         11, 10, 9,  8,
-		         7,  6,  5,  4,
-	             3,  2,  1,  0 );
-}
-
-/*
-    1995, Afega
-
-    1x TMP68000P-10 (main)
-    1x GOLDSTAR Z8400A (sound)
-    1x AD-65 (equivalent to OKI6295)
-    1x LATTICE pLSI 1032 60LJ A428A48
-    1x oscillator 8.000MHz
-    1x oscillator 12.000MHz
-
-    1x 27256 (SU6)
-    1x 27C010 (SU12)
-    1x 27C020 (SU13)
-    2x 27c4001 (UB11, UB13)
-    3x 27C010 (UJ11, UJ12, UJ13)
-    1x 27C4001 (UI20)
-
-    1x JAMMA edge connector
-    1x trimmer (volume)
-*/
-
-ROM_START( twinactn )
-	ROM_REGION( 0x40000, REGION_CPU1, 0 )		/* 68000 Code */
-	ROM_LOAD16_BYTE( "afega.uj13", 0x00000, 0x20000, CRC(9187701d) SHA1(1da8d1e3969f60c7b0521cd22c723cb51619df9d) )
-	ROM_LOAD16_BYTE( "afega.uj12", 0x00001, 0x20000, CRC(fe8cff9c) SHA1(a1a04deff9e2cb54c69601898cf4e5133c2bc437) )
-
-	ROM_REGION( 0x8000, REGION_CPU2, 0 )		/* Z80 Code */
-	ROM_LOAD( "afega.su6", 0x0000, 0x8000, CRC(3a52dc88) SHA1(87941987d34d93df6df9ff33ccfbd1f5d4a39c51) )	// 1111xxxxxxxxxxx = 0x00
-
-	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
-	ROM_LOAD16_BYTE( "afega.ub11", 0x00000, 0x80000, CRC(287f20d8) SHA1(11faa36b97593c0b5cee70343750ae1ecd2f5b71) )
-	ROM_LOAD16_BYTE( "afega.ub13", 0x00001, 0x80000, CRC(f525f819) SHA1(78ffcb709a3a900d3851392630a11ab58fc0bc75) )
-
-	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
-	ROM_LOAD( "afega.ui20", 0x00000, 0x80000, CRC(237c8f92) SHA1(bb3131b450bd78d03b789626a465fb9e7a4604a7) )
-
-	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
-	ROM_LOAD( "afega.uj11", 0x00000, 0x20000, CRC(3f439e92) SHA1(27e5b1b0aa3b13fa35e3f83793037314b2942aa2) )
-
-	ROM_REGION( 0x100000, REGION_SOUND1, 0 )	/* Samples */
-	ROM_LOAD( "afega.su12", 0x000000, 0x20000, CRC(91d665f3) SHA1(10b5b07ed28ea78b6d3493afc03e003a8468c007) )
-	ROM_RELOAD(             0x040000, 0x20000 )
-	ROM_RELOAD(             0x080000, 0x20000 )
-	ROM_RELOAD(             0x0c0000, 0x20000 )
-	ROM_RELOAD(             0x020000, 0x20000 )
-	ROM_RELOAD(             0x060000, 0x20000 )
-	ROM_LOAD( "afega.su13", 0x0a0000, 0x20000, CRC(30e1c306) SHA1(c859f11fd329793b11e96264e91c79a557b488a4) )
-	ROM_CONTINUE(           0x0e0000, 0x20000 )
-ROM_END
-
-static WRITE16_HANDLER ( test_2a_mustang_w )
-{
-	data = data >> 8;
-
-	ram[0x2a/2] = (data << 8) | data;
-
-	if (data == 1 || data == 2) {
-		ram[0x2e/2] = 10;
-		ram[0x2c/2] = 0;
-	}
-
-}
-
-static DRIVER_INIT( twinactn )
-{
-#if 0
-	UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1);
-	rom[0x4a2a/2]	=	0x4e71;	// no freeze on sound test + enable hidden "object test"
-#endif
-	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
-
-	// these are the patches for mustang from nmk16.c modified for twinactn
-	// we need to figure out how this _really_ works
-	rom[0x85c/2] = 0x4e71; // same as mustang
-	rom[0x85e/2] = 0x4e71; // same as mustang
-	rom[0x860/2] = 0x4e71; // same as mustang
-	rom[0x8c0/2] = 0x0300; // same as mustang
-	rom[0xbee/2] = 0x0300; // offset shifted..
-	rom[0x30c0/2] = 0x0300; // offset shifted..
-
-	memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf902a, 0xf902b, 0, 0, test_2a_mustang_w );
-}
-
-
-/***************************************************************************
-
-
-                                Game Drivers
-
-
-***************************************************************************/
-
-GAME( 1995, twinactn, 0,        twinactn, twinactn, twinactn, ROT0,               "Afega",    "Twin Action",                      0 )
-GAME( 1997, redhawk,  stagger1, stagger1, stagger1, redhawk,  ROT270,             "Afega",    "Red Hawk (US)",                    GAME_NOT_WORKING )
-GAME( 1997, redhawkb, stagger1, redhawkb, redhawkb, 0,        ROT0,               "bootleg",  "Red Hawk (bootleg)",               GAME_NOT_WORKING )
-GAME( 1998, stagger1, 0,        stagger1, stagger1, 0,        ROT270,             "Afega",    "Stagger I (Japan)",                GAME_NOT_WORKING )
-GAME( 1998, grdnstrm, 0,        grdnstrm, grdnstrm, grdnstrm, ROT270,             "Afega",    "Sen Jin - Guardian Storm (Korea)", GAME_NOT_WORKING )
-GAME( 1998, bubl2000, 0,        bubl2000, bubl2000, bubl2000, ROT0,               "Tuning",   "Bubble 2000",                      0 ) // on a tuning board (bootleg?)
-GAME( 1998, hotbubl,  bubl2000, bubl2000, bubl2000, bubl2000, ROT0,               "Pandora",  "Hot Bubble" ,                      0 ) // on an afega board ..
-GAME( 1999, popspops, 0,        popspops, popspops, grdnstrm, ROT0,               "Afega",    "Pop's Pop's",                      0 )
-GAME( 2000, mangchi,  0,        bubl2000, mangchi,  bubl2000, ROT0,               "Afega",    "Mang-Chi",                         0 )
-GAME( 2000, spec2k,   0,        firehawk, spec2k,   spec2k,   ORIENTATION_FLIP_Y, "Yonatech", "Spectrum 2000 (Euro)",             GAME_NOT_WORKING )
-GAME( 2001, firehawk, 0,        firehawk, firehawk, 0,        ORIENTATION_FLIP_Y, "ESD",      "Fire Hawk",                        GAME_NOT_WORKING )
diff -Nru src-old/mame/drivers/ashnojoe.c src/mame/drivers/ashnojoe.c
--- src-old/mame/drivers/ashnojoe.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/ashnojoe.c	2007-12-23 20:03:00.000000000 -0800
@@ -353,11 +353,11 @@
 static MACHINE_DRIVER_START( ashnojoe )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 8000000)	/* 8 MHz? */
+	MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(ashnojoe_readmem,ashnojoe_writemem)
 	MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
 
-	MDRV_CPU_ADD(Z80, 4000000)	/* 4 MHz ??? */
+	MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (verified on pcb) */
 	/* audio CPU */
 	MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
 	MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
@@ -380,7 +380,7 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 3000000)
+	MDRV_SOUND_ADD(YM2203, 4000000)  /* 4 MHz (verified on pcb) */
 	MDRV_SOUND_CONFIG(ym2203_interface)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
 
diff -Nru src-old/mame/drivers/crystal.c src/mame/drivers/crystal.c
--- src-old/mame/drivers/crystal.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/crystal.c	2007-12-23 19:41:16.000000000 -0800
@@ -687,7 +687,7 @@
 	tail=GetVidReg(0x80);
 	while((head&0x7ff)!=(tail&0x7ff))
 	{
-		DoFlip=ProcessPacket(0x03800000+head*64,DrawDest,(UINT8*)textureram);
+		DoFlip=vrender0_ProcessPacket(0x03800000+head*64,DrawDest,(UINT8*)textureram);
 		head++;
 		head&=0x7ff;
 		if(DoFlip)
diff -Nru src-old/mame/drivers/ddenlovr.c src/mame/drivers/ddenlovr.c
--- src-old/mame/drivers/ddenlovr.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/ddenlovr.c	2007-12-23 19:41:16.000000000 -0800
@@ -99,6 +99,8 @@
 #include "sound/2413intf.h"
 #include "machine/msm6242.h"
 #include "profiler.h"
+#include "includes/dynax.h"
+
 
 UINT8 *ddenlovr_pixmap[8];
 static mame_bitmap *framebuffer;
diff -Nru src-old/mame/drivers/dec0.c src/mame/drivers/dec0.c
--- src-old/mame/drivers/dec0.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/dec0.c	2007-12-23 19:43:45.000000000 -0800
@@ -1236,7 +1236,7 @@
 static MACHINE_DRIVER_START( midres )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 12000000)
+	MDRV_CPU_ADD(M68000, 10000000) /* verified on pcb */
 	MDRV_CPU_PROGRAM_MAP(midres_readmem,midres_writemem)
 	MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
 
@@ -1261,18 +1261,18 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_ADD(YM2203, 1500000) /* verified on pcb */
 	MDRV_SOUND_ROUTE(0, "mono", 0.90)
 	MDRV_SOUND_ROUTE(1, "mono", 0.90)
 	MDRV_SOUND_ROUTE(2, "mono", 0.90)
 	MDRV_SOUND_ROUTE(3, "mono", 0.35)
 
-	MDRV_SOUND_ADD(YM3812, 3000000)
+	MDRV_SOUND_ADD(YM3812, 3000000) /* verified on pcb */
 	MDRV_SOUND_CONFIG(ym3812b_interface)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
 
-	MDRV_SOUND_ADD(OKIM6295, 1023924)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
+	MDRV_SOUND_ADD(OKIM6295, 1000000) /* verified on pcb (1mhz crystal) */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // pin 7 verified on pcb
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.40)
 MACHINE_DRIVER_END
 
diff -Nru src-old/mame/drivers/drw80pkr.c src/mame/drivers/drw80pkr.c
--- src-old/mame/drivers/drw80pkr.c	2007-12-17 08:39:40.000000000 -0800
+++ src/mame/drivers/drw80pkr.c	2007-12-23 19:41:16.000000000 -0800
@@ -42,27 +42,27 @@
 * Write Handlers *
 ******************/
 
-WRITE8_HANDLER( p1_w )
+static WRITE8_HANDLER( p1_w )
 {
 	p1 = data;
 }
 
-WRITE8_HANDLER( p2_w )
+static WRITE8_HANDLER( p2_w )
 {
 	p2 = data;
 }
 
-WRITE8_HANDLER( p4_w )
+static WRITE8_HANDLER( p4_w )
 {
 	p4 = data;
 }
 
-WRITE8_HANDLER( bus_w )
+static WRITE8_HANDLER( bus_w )
 {
 	bus = data;
 }
 
-WRITE8_HANDLER( drw80pkr_cmos_w )
+static WRITE8_HANDLER( drw80pkr_cmos_w )
 {
     //if (p2 == 0xc7) CRTC Register
     //if (p2 == 0xd7) CRTC Address
@@ -73,22 +73,22 @@
 * Read Handlers *
 ****************/
 
-READ8_HANDLER( p1_r )
+static READ8_HANDLER( p1_r )
 {
     return p1;
 }
 
-READ8_HANDLER( p2_r )
+static READ8_HANDLER( p2_r )
 {
     return p2;
 }
 
-READ8_HANDLER( bus_r )
+static READ8_HANDLER( bus_r )
 {
     return bus;
 }
 
-READ8_HANDLER( drw80pkr_cmos_r )
+static READ8_HANDLER( drw80pkr_cmos_r )
 {
     return pkr_cmos_ram[offset];
 }
@@ -106,19 +106,19 @@
 	SET_TILE_INFO(0, code, color, 0);
 }
 
-VIDEO_START( drw80pkr )
+static VIDEO_START( drw80pkr )
 {
 	bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 40, 25);
 }
 
-VIDEO_UPDATE( drw80pkr )
+static VIDEO_UPDATE( drw80pkr )
 {
 	tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
 
 	return 0;
 }
 
-PALETTE_INIT( drw80pkr )
+static PALETTE_INIT( drw80pkr )
 {
 /*  prom bits
     7654 3210
diff -Nru src-old/mame/drivers/fitfight.c src/mame/drivers/fitfight.c
--- src-old/mame/drivers/fitfight.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/drivers/fitfight.c	2007-12-23 19:41:16.000000000 -0800
@@ -87,7 +87,12 @@
 
 
 UINT16 *fitfight_spriteram;
-UINT16 *fof_100000, *fof_600000, *fof_700000, *fof_800000, *fof_900000, *fof_a00000;
+static UINT16 *fof_100000;
+static UINT16 *fof_600000;
+UINT16 *fof_700000;
+static UINT16 *fof_800000;
+UINT16 *fof_900000;
+UINT16 *fof_a00000;
 
 UINT16 *fof_bak_tileram;
 UINT16 *fof_mid_tileram;
diff -Nru src-old/mame/drivers/halleys.c src/mame/drivers/halleys.c
--- src-old/mame/drivers/halleys.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/halleys.c	2007-12-23 19:13:19.000000000 -0800
@@ -1947,11 +1947,11 @@
 
 
 static MACHINE_DRIVER_START( halleys )
-	MDRV_CPU_ADD_TAG("main", M6809, 19968000/4) // 5Mhz?(19.968MHz XTAL)
+	MDRV_CPU_ADD_TAG("main", M6809, 1664000) /* 19968000/12 (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(readmem, writemem)
 	MDRV_CPU_VBLANK_INT(halleys_interrupt, 4)
 
-	MDRV_CPU_ADD(Z80, 6000000/2) // 3MHz(6MHz XTAL)
+	MDRV_CPU_ADD(Z80, 6000000/2) /* (verified on pcb) */
 	/* audio CPU */
 	MDRV_CPU_PROGRAM_MAP(sound_readmem, sound_writemem)
 	MDRV_CPU_PERIODIC_INT(irq0_line_hold, (double)6000000/(4*16*16*10*16))
@@ -1975,7 +1975,7 @@
 	// sound hardware
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(AY8910, 6000000/4)
+	MDRV_SOUND_ADD(AY8910, 6000000/4) /* (verified on pcb) */
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
 
 	MDRV_SOUND_ADD(AY8910, 6000000/4)
diff -Nru src-old/mame/drivers/itech32.c src/mame/drivers/itech32.c
--- src-old/mame/drivers/itech32.c	2007-12-18 00:09:03.000000000 -0800
+++ src/mame/drivers/itech32.c	2007-12-23 07:17:33.000000000 -0800
@@ -12,7 +12,7 @@
         * Hard Yardage (2 sets)
         * Pairs (2 sets)
         * Driver's Edge (1 set)
-        * World Class Bowling (7 sets)
+        * World Class Bowling (8 sets)
         * Street Fighter: The Movie (4 sets)
         * Shuffleshot (3 sets)
         * Golden Tee 3D Golf (11 sets)
@@ -822,7 +822,7 @@
 			((UINT8 *)nvram)[i] = mame_rand(Machine);
 }
 
-static NVRAM_HANDLER( gt3dt )
+static NVRAM_HANDLER( tournament )
 {
 	nvram_handler_itech020( machine, file, read_or_write );
 	nvram_handler_timekeeper_0( machine, file, read_or_write );
@@ -1585,21 +1585,12 @@
 MACHINE_DRIVER_END
 
 
-static MACHINE_DRIVER_START( gt3dt )
+static MACHINE_DRIVER_START( tourny )
 
 	/* basic machine hardware */
 	MDRV_IMPORT_FROM(sftm)
 
-	MDRV_NVRAM_HANDLER( gt3dt ) /* Make Tournament sets load/store the Timekeeper info */
-MACHINE_DRIVER_END
-
-
-static MACHINE_DRIVER_START( wcbowlt )
-
-	/* basic machine hardware */
-	MDRV_IMPORT_FROM(sftm)
-
-	MDRV_NVRAM_HANDLER( gt3dt ) /* Make WCB Tournament load/store the Timekeeper info */
+	MDRV_NVRAM_HANDLER( tournament ) /* Make Tournament sets load/store the Timekeeper info */
 MACHINE_DRIVER_END
 
 
@@ -1942,7 +1933,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "hotmem_snd.u17", 0x10000, 0x18000, CRC(805941c7) SHA1(4a6832d93ff2b986cb54052658af62584782cb59) )
-	ROM_CONTINUE(        0x08000, 0x08000 )
+	ROM_CONTINUE(               0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "hotmem.grom0",  0x000000, 0x80000, CRC(68f279ef) SHA1(66098e68474e692676662b03835d1b74f581b0f4) )
@@ -1961,7 +1952,7 @@
 	ROM_LOAD16_BYTE( "hotmem.srom0", 0x000000, 0x80000, CRC(c1103224) SHA1(52cf341ff9092ecb8cb94f66a96ee0c726bf1412) )
 ROM_END
 
-ROM_START( wcbowldx )	/* Deluxe version 2.00 (PCB P/N 1082 Rev 2) */
+ROM_START( wcbowldx )	/* Deluxe version 2.00 (PCB P/N 1082 Rev 2), This version is derived from the Tournament version, but tournament features have be removed/disabled */
 	ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
 	ROM_LOAD32_BYTE( "wcbdprm0.200", 0x00000, 0x20000, CRC(280df7f0) SHA1(dacffe8fc21263093b0f4a4fbf444abd49afbff1) )
 	ROM_LOAD32_BYTE( "wcbdprm1.200", 0x00001, 0x20000, CRC(526eded0) SHA1(106d5503ed4db2411e1f3446d613eac525a8a9cc) )
@@ -1970,7 +1961,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "wcb_snd.u88", 0x10000, 0x18000, CRC(e97a6d28) SHA1(96d7b7856918abcc460083f2a46582ba2a689288) ) /* Actual version is 4.01 but may be labeled V4.0 or V4.01 */
-	ROM_CONTINUE(             0x08000, 0x08000 )
+	ROM_CONTINUE(            0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
@@ -1997,6 +1988,42 @@
 ROM_END
 
 
+ROM_START( wcbwl140 )	/* Version 1.40 Tournament (PCB P/N 1082 Rev 2) */
+	ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
+	ROM_LOAD32_BYTE( "wcbtprm0.140", 0x00000, 0x20000, CRC(9d31ceb1) SHA1(d147976a763ba1e18d861351b12c5d275b94a562) )
+	ROM_LOAD32_BYTE( "wcbtprm1.140", 0x00001, 0x20000, CRC(c6669452) SHA1(ba58da7bee5120682e2306454da287c969014899) )
+	ROM_LOAD32_BYTE( "wcbtprm2.140", 0x00002, 0x20000, CRC(d2fc4d09) SHA1(17983759ad6137a2e67b8414ea58880865311534) )
+	ROM_LOAD32_BYTE( "wcbtprm3.140", 0x00003, 0x20000, CRC(c41258a4) SHA1(182e8a25bdb126a4de8a44a1c26fd8b66f06d66e) )
+
+	ROM_REGION( 0x28000, REGION_CPU2, 0 )
+	ROM_LOAD( "wcb_snd.u88", 0x10000, 0x18000, CRC(e97a6d28) SHA1(96d7b7856918abcc460083f2a46582ba2a689288) ) /* Actual version is 4.01 but may be labeled V4.0 or V4.01 */
+	ROM_CONTINUE(            0x08000, 0x08000 )
+
+	ROM_REGION( 0x880000, REGION_GFX1, 0 )
+	ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
+	ROM_LOAD32_BYTE( "wcb_grom.0_1", 0x000001, 0x080000, CRC(2ae31f45) SHA1(85218aa9a7ca7c6870427ffbd08b78255813ff90) )
+	ROM_LOAD32_BYTE( "wcb_grom.0_2", 0x000002, 0x080000, CRC(bccc0f35) SHA1(2389662e881e86f8cdb36eb2a082923d976676c8) )
+	ROM_LOAD32_BYTE( "wcb_grom.0_3", 0x000003, 0x080000, CRC(ab1da462) SHA1(3f3a4a083483d2d95d5ef540eea077cad799fcb7) )
+	ROM_LOAD32_BYTE( "wcb_grom.1_0", 0x200000, 0x080000, CRC(bdfafd1f) SHA1(bc0e6fe83d3f8e88c2e55ba3a436875d5470de5b) )
+	ROM_LOAD32_BYTE( "wcb_grom.1_1", 0x200001, 0x080000, CRC(7d6baa2e) SHA1(c47854b064aa96d2581c23afe13cd05a36f9dae3) )
+	ROM_LOAD32_BYTE( "wcb_grom.1_2", 0x200002, 0x080000, CRC(7513d3de) SHA1(b17650ed5210860c3bde53647a30f8fce67aaa38) )
+	ROM_LOAD32_BYTE( "wcb_grom.1_3", 0x200003, 0x080000, CRC(e46877e6) SHA1(f50c904ec5b2b8cbc92f2b28641433c91ee17af5) )
+	ROM_LOAD32_BYTE( "wcbdgrom.2_0", 0x400000, 0x040000, CRC(3b4c5a5c) SHA1(152cbc5d1aa84012f49fa13d91fd89a10f874508) )
+	ROM_LOAD32_BYTE( "wcbdgrom.2_1", 0x400001, 0x040000, CRC(ed0b9b26) SHA1(5173e3936cae419255b3034e2b8a69f6bd136b93) )
+	ROM_LOAD32_BYTE( "wcbdgrom.2_2", 0x400002, 0x040000, CRC(4b9e345e) SHA1(6842a8a6690db8478bdbb8e8119d3eef5e77439b) )
+	ROM_LOAD32_BYTE( "wcbdgrom.2_3", 0x400003, 0x040000, CRC(4e13ee7a) SHA1(245ce87cd6839119a9a976b9a90cd1028aa3e291) )
+	ROM_FILL(                        0x500000, 0x380000, 0xff )
+
+	ROM_REGION16_BE( 0x400000, REGION_SOUND1, ROMREGION_ERASE00 )
+	ROM_LOAD16_BYTE( "wcb_srom.0",  0x000000, 0x080000, CRC(d42dd283) SHA1(8ef75c398d1c51d2d7d299ac309a2352179864d9) ) /* Newer sound sample roms */
+	ROM_LOAD16_BYTE( "wcb_srom.1",  0x200000, 0x080000, CRC(7a69ab54) SHA1(d1f9194446e235af69c6ff28af0dccc44ab9b5d3) ) /* Newer sound sample roms */
+
+	ROM_REGION16_BE( 0x400000, REGION_SOUND2, ROMREGION_ERASE00 )
+	ROM_LOAD16_BYTE( "wcb_srom.2",  0x000000, 0x080000, CRC(346530a2) SHA1(9951971ad6d368fb718027e18331d12f0a72970c) ) /* Newer sound sample roms */
+	ROM_LOAD16_BYTE( "wcb_srom.3",  0x200000, 0x040000, CRC(1dfe3a31) SHA1(94947f495692288fbf14fc7796a84c5548a2e8a8) ) /* Newer sound sample roms, rom is a 27C020 in this set */
+ROM_END
+
+
 ROM_START( wcbowl )	/* Version 1.66 (PCB P/N 1082 Rev 2) */
 	ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
 	ROM_LOAD32_BYTE( "wcb_prm0.166", 0x00000, 0x20000, CRC(f6774112) SHA1(cb09bb3e40490b3cdc3a5f7d18168384b5b29d85) )
@@ -2006,7 +2033,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "wcb_snd.u88", 0x10000, 0x18000, CRC(e97a6d28) SHA1(96d7b7856918abcc460083f2a46582ba2a689288) ) /* Actual version is 4.01 but may be labeled V4.0 or V4.01 */
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(            0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
@@ -2038,7 +2065,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "wcb_snd.u88", 0x10000, 0x18000, CRC(e97a6d28) SHA1(96d7b7856918abcc460083f2a46582ba2a689288) ) /* Actual version is 4.01 but may be labeled V4.0 or V4.01 */
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(            0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
@@ -2070,7 +2097,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "wcbo_snd.u88", 0x10000, 0x18000, CRC(194a51d7) SHA1(c67b042008ff2a2713562d3789e5bc3a312fae17) ) /* Version 4.0 */
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
@@ -2093,51 +2120,50 @@
 ROM_END
 
 
-ROM_START( wcbwl140 )	/* Version 1.40 Tournament (PCB P/N 1082 Rev 2) */
-	ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
-	ROM_LOAD32_BYTE( "wcbtprm0.140", 0x00000, 0x20000, CRC(9d31ceb1) SHA1(d147976a763ba1e18d861351b12c5d275b94a562) )
-	ROM_LOAD32_BYTE( "wcbtprm1.140", 0x00001, 0x20000, CRC(c6669452) SHA1(ba58da7bee5120682e2306454da287c969014899) )
-	ROM_LOAD32_BYTE( "wcbtprm2.140", 0x00002, 0x20000, CRC(d2fc4d09) SHA1(17983759ad6137a2e67b8414ea58880865311534) )
-	ROM_LOAD32_BYTE( "wcbtprm3.140", 0x00003, 0x20000, CRC(c41258a4) SHA1(182e8a25bdb126a4de8a44a1c26fd8b66f06d66e) )
+ROM_START( wcbwl15 )	/* Version 1.5 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
+	/* v1.0 for this platform have been confirmed, but not dumped */
+	ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
+	ROM_LOAD16_BYTE( "wcb_v15.u83", 0x00000, 0x20000, CRC(3ca9ab85) SHA1(364946dceb3f7279b7d67d9d685a98ba7f4901aa) ) /* Labeled as "WCB V1.5 (U83)" */
+	ROM_LOAD16_BYTE( "wcb_v15.u88", 0x00001, 0x20000, CRC(d43e6fad) SHA1(fd72f6945e7f5ef86dc28503749d18086dd29906) ) /* Labeled as "WCB V1.5 (U88)" */
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
-	ROM_LOAD( "wcb_snd.u88", 0x10000, 0x18000, CRC(e97a6d28) SHA1(96d7b7856918abcc460083f2a46582ba2a689288) ) /* Actual version is 4.01 but may be labeled V4.0 or V4.01 */
+	ROM_LOAD( "wcb_snd2.u17", 0x10000, 0x18000, CRC(c14907ba) SHA1(e52fb87c1f9b5847efc0ef15eb7e6c04dcf38110) ) /* Labeled as "WCB SND V2.0" */
 	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
-	ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
-	ROM_LOAD32_BYTE( "wcb_grom.0_1", 0x000001, 0x080000, CRC(2ae31f45) SHA1(85218aa9a7ca7c6870427ffbd08b78255813ff90) )
-	ROM_LOAD32_BYTE( "wcb_grom.0_2", 0x000002, 0x080000, CRC(bccc0f35) SHA1(2389662e881e86f8cdb36eb2a082923d976676c8) )
-	ROM_LOAD32_BYTE( "wcb_grom.0_3", 0x000003, 0x080000, CRC(ab1da462) SHA1(3f3a4a083483d2d95d5ef540eea077cad799fcb7) )
-	ROM_LOAD32_BYTE( "wcb_grom.1_0", 0x200000, 0x080000, CRC(bdfafd1f) SHA1(bc0e6fe83d3f8e88c2e55ba3a436875d5470de5b) )
-	ROM_LOAD32_BYTE( "wcb_grom.1_1", 0x200001, 0x080000, CRC(7d6baa2e) SHA1(c47854b064aa96d2581c23afe13cd05a36f9dae3) )
-	ROM_LOAD32_BYTE( "wcb_grom.1_2", 0x200002, 0x080000, CRC(7513d3de) SHA1(b17650ed5210860c3bde53647a30f8fce67aaa38) )
-	ROM_LOAD32_BYTE( "wcb_grom.1_3", 0x200003, 0x080000, CRC(e46877e6) SHA1(f50c904ec5b2b8cbc92f2b28641433c91ee17af5) )
-	ROM_LOAD32_BYTE( "wcbdgrom.2_0", 0x400000, 0x040000, CRC(3b4c5a5c) SHA1(152cbc5d1aa84012f49fa13d91fd89a10f874508) )
-	ROM_LOAD32_BYTE( "wcbdgrom.2_1", 0x400001, 0x040000, CRC(ed0b9b26) SHA1(5173e3936cae419255b3034e2b8a69f6bd136b93) )
-	ROM_LOAD32_BYTE( "wcbdgrom.2_2", 0x400002, 0x040000, CRC(4b9e345e) SHA1(6842a8a6690db8478bdbb8e8119d3eef5e77439b) )
-	ROM_LOAD32_BYTE( "wcbdgrom.2_3", 0x400003, 0x040000, CRC(4e13ee7a) SHA1(245ce87cd6839119a9a976b9a90cd1028aa3e291) )
-	ROM_FILL(                        0x500000, 0x380000, 0xff )
+	/* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
+    ROM_LOAD32_BYTE( "wcb8grom.0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
+    ROM_LOAD32_BYTE( "wcb8grom.0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
+    ROM_LOAD32_BYTE( "wcb8grom.0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
+    ROM_LOAD32_BYTE( "wcb8grom.0_3", 0x000003, 0x100000, CRC(0348a7f0) SHA1(462f77514c0e9a28da63732a4f31e9483d4c483e) )
+    */
+	ROM_LOAD32_BYTE( "wcb_grm0.0", 0x000000, 0x080000, CRC(5d79aaae) SHA1(e1bf5c46843f69b8bac41dde73d89ba59b4c8b7f) )
+	ROM_LOAD32_BYTE( "wcb_grm0.1", 0x000001, 0x080000, CRC(e26dcedb) SHA1(15441b97dd3d50d28007062fe28841fa3f762ec9) )
+	ROM_LOAD32_BYTE( "wcb_grm0.2", 0x000002, 0x080000, CRC(32735875) SHA1(4017a8577d8efa8c5b95bd30723ebbf6ecaeba2b) )
+	ROM_LOAD32_BYTE( "wcb_grm0.3", 0x000003, 0x080000, CRC(019d0ab8) SHA1(3281eada296ad746da80ef6e5909c50b03b90d08) )
+	ROM_LOAD32_BYTE( "wcb_grm1.0", 0x200000, 0x080000, CRC(8bd31762) SHA1(a7274c8173b4fb04a6aed0b6a622b52a811a8c83) )
+	ROM_LOAD32_BYTE( "wcb_grm1.1", 0x200001, 0x080000, CRC(b3f761fc) SHA1(5880ca1423cea9a7ca3d0875c8db33787f4056d4) )
+	ROM_LOAD32_BYTE( "wcb_grm1.2", 0x200002, 0x080000, CRC(c22f44ad) SHA1(b25b11346ee1812b2be79105faf64faa0302c105) )
+	ROM_LOAD32_BYTE( "wcb_grm1.3", 0x200003, 0x080000, CRC(036084c4) SHA1(6d2e402d2f4565e037a2676ba676e4b1da2b5dfe) )
+	ROM_FILL(                      0x400000, 0x480000, 0xff )
 
 	ROM_REGION16_BE( 0x400000, REGION_SOUND1, ROMREGION_ERASE00 )
-	ROM_LOAD16_BYTE( "wcb_srom.0",  0x000000, 0x080000, CRC(d42dd283) SHA1(8ef75c398d1c51d2d7d299ac309a2352179864d9) ) /* Newer sound sample roms */
-	ROM_LOAD16_BYTE( "wcb_srom.1",  0x200000, 0x080000, CRC(7a69ab54) SHA1(d1f9194446e235af69c6ff28af0dccc44ab9b5d3) ) /* Newer sound sample roms */
+	ROM_LOAD16_BYTE( "ensoniq.2mx", 0x000000, 0x200000, CRC(0814ab80) SHA1(e92525f7cf58cf480510c278fea705f67225e58f) ) /* Ensoniq 2MX16U 1350901801 */
 
-	ROM_REGION16_BE( 0x400000, REGION_SOUND2, ROMREGION_ERASE00 )
-	ROM_LOAD16_BYTE( "wcb_srom.2",  0x000000, 0x080000, CRC(346530a2) SHA1(9951971ad6d368fb718027e18331d12f0a72970c) ) /* Newer sound sample roms */
-	ROM_LOAD16_BYTE( "wcb_srom.3",  0x200000, 0x040000, CRC(1dfe3a31) SHA1(94947f495692288fbf14fc7796a84c5548a2e8a8) ) /* Newer sound sample roms, rom is a 27C020 in this set */
+	ROM_REGION16_BE( 0x400000, REGION_SOUND3, ROMREGION_ERASE00 )
+	ROM_LOAD16_BYTE( "wcb_srm.0",  0x000000, 0x080000, CRC(115bcd1f) SHA1(c321bf3145c11de1351c8f9cd554ab3d6600e854) )
+	ROM_LOAD16_BYTE( "wcb_srm.1",  0x100000, 0x080000, CRC(87a4a4d8) SHA1(60db2f466686481857eb39b90ac7a19d0a96adac) )
 ROM_END
 
 
-ROM_START( wcbwl15 )	/* Version 1.5 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
-	/* v1.0 & v1.3 for this platform have been confirmed, but not dumped */
+ROM_START( wcbwl13 )	/* Version 1.3 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
 	ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
-	ROM_LOAD16_BYTE( "wcb_v15.u83", 0x00000, 0x20000, CRC(3ca9ab85) SHA1(364946dceb3f7279b7d67d9d685a98ba7f4901aa) ) /* Labeled as "WCB V1.5 (U83)" */
-	ROM_LOAD16_BYTE( "wcb_v15.u88", 0x00001, 0x20000, CRC(d43e6fad) SHA1(fd72f6945e7f5ef86dc28503749d18086dd29906) ) /* Labeled as "WCB V1.5 (U88)" */
+	ROM_LOAD16_BYTE( "wcb_v13.u83", 0x00000, 0x20000, CRC(2b6d284e) SHA1(339951661509d07b69c670b7249f30a616872bdf) ) /* Labeled as "WCB V1.3 (U83)" */
+	ROM_LOAD16_BYTE( "wcb_v13.u88", 0x00001, 0x20000, CRC(039af877) SHA1(2ac9a57e358ab1ccf9a4d18f7992b59f172e31cf) ) /* Labeled as "WCB V1.3 (U88)" */
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "wcb_snd2.u17", 0x10000, 0x18000, CRC(c14907ba) SHA1(e52fb87c1f9b5847efc0ef15eb7e6c04dcf38110) ) /* Labeled as "WCB SND V2.0" */
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	/* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
@@ -2172,7 +2198,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "wcb_snd2.u17", 0x10000, 0x18000, CRC(c14907ba) SHA1(e52fb87c1f9b5847efc0ef15eb7e6c04dcf38110) ) /* Labeled as "WCB SND V2.0" */
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x880000, REGION_GFX1, 0 )
 	/* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
@@ -2251,7 +2277,7 @@
 
 	ROM_REGION( 0x48000, REGION_CPU2, 0 )
 	ROM_LOAD( "sfmsndv1.u23", 0x10000, 0x38000, CRC(10d85366) SHA1(10d539c3ba37e277642c0c5888cb1886fb0f55fc) )
-	ROM_CONTINUE(            0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x2080000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "rm0-0.bin",  0x0000000, 0x400000, CRC(09ef29cb) SHA1(430da5b00554582391478849d5b1547fe12eedbe) )
@@ -2284,7 +2310,7 @@
 
 	ROM_REGION( 0x48000, REGION_CPU2, 0 )
 	ROM_LOAD( "sfmsndv1.u23", 0x10000, 0x38000, CRC(10d85366) SHA1(10d539c3ba37e277642c0c5888cb1886fb0f55fc) )
-	ROM_CONTINUE(            0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x2080000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "rm0-0.bin",  0x0000000, 0x400000, CRC(09ef29cb) SHA1(430da5b00554582391478849d5b1547fe12eedbe) )
@@ -2317,7 +2343,7 @@
 
 	ROM_REGION( 0x48000, REGION_CPU2, 0 )
 	ROM_LOAD( "sfmsndv1.u23", 0x10000, 0x38000, CRC(10d85366) SHA1(10d539c3ba37e277642c0c5888cb1886fb0f55fc) )
-	ROM_CONTINUE(            0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x2080000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "rm0-0.bin",  0x0000000, 0x400000, CRC(09ef29cb) SHA1(430da5b00554582391478849d5b1547fe12eedbe) )
@@ -2383,7 +2409,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "shotsnd.u88", 0x10000, 0x18000, CRC(e37d599d) SHA1(105f91e968ecf553d910a97726ddc536289bbb2b) )
-	ROM_CONTINUE(        0x08000, 0x08000 )
+	ROM_CONTINUE(            0x08000, 0x08000 )
 
 	ROM_REGION( 0x800000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "shf_grom.0_0", 0x000000, 0x80000, CRC(832a3d6a) SHA1(443328fa61b79c93ec6c9d24893b2ec38358a905) )
@@ -2418,7 +2444,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "shotsnd.u88", 0x10000, 0x18000, CRC(e37d599d) SHA1(105f91e968ecf553d910a97726ddc536289bbb2b) )
-	ROM_CONTINUE(        0x08000, 0x08000 )
+	ROM_CONTINUE(            0x08000, 0x08000 )
 
 	ROM_REGION( 0x800000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "shf_grom.0_0", 0x000000, 0x80000, CRC(832a3d6a) SHA1(443328fa61b79c93ec6c9d24893b2ec38358a905) )
@@ -2453,7 +2479,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "shotsnd.u88", 0x10000, 0x18000, CRC(e37d599d) SHA1(105f91e968ecf553d910a97726ddc536289bbb2b) )
-	ROM_CONTINUE(        0x08000, 0x08000 )
+	ROM_CONTINUE(            0x08000, 0x08000 )
 
 	ROM_REGION( 0x800000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "shf_grom.0_0", 0x000000, 0x80000, CRC(832a3d6a) SHA1(443328fa61b79c93ec6c9d24893b2ec38358a905) )
@@ -2488,7 +2514,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gtg3_grm.0_0", 0x000000, 0x80000, CRC(1b10379d) SHA1(b6d61771e2bc3909ea4229777867b217a3e9e580) )
@@ -2815,7 +2841,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gtg3_grm.0_0", 0x000000, 0x80000, CRC(1b10379d) SHA1(b6d61771e2bc3909ea4229777867b217a3e9e580) )
@@ -2846,7 +2872,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gtg38grm.0_0", 0x000000, 0x100000, CRC(22c481b7) SHA1(399bffec5e3b27aec2ebd8d7d49689b92f453e39) ) /* actually labeled "GTG3 GROM 0_0**" ect */
@@ -2877,7 +2903,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -2908,7 +2934,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -2939,7 +2965,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -2970,7 +2996,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt322_nr.u23", 0x10000, 0x18000, CRC(04effd73) SHA1(4277031655f8de851eba0e4134ba619a12f5dd4a) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -3001,7 +3027,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -3032,7 +3058,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -3063,7 +3089,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt97_grm.0_0", 0x000000, 0x80000, CRC(81784aaf) SHA1(9544ed2087ca5f71c747e3b782513614937a51ed) )
@@ -3094,7 +3120,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt98_grm.0_0", 0x000000, 0x80000, CRC(2d79492b) SHA1(16d66d937c34ddf616f31cba0d285326a31cad85) )
@@ -3125,7 +3151,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt98_grm.0_0", 0x000000, 0x80000, CRC(2d79492b) SHA1(16d66d937c34ddf616f31cba0d285326a31cad85) )
@@ -3156,7 +3182,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt322_nr.u23", 0x10000, 0x18000, CRC(04effd73) SHA1(4277031655f8de851eba0e4134ba619a12f5dd4a) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(             0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt98_grm.0_0", 0x000000, 0x80000, CRC(2d79492b) SHA1(16d66d937c34ddf616f31cba0d285326a31cad85) )
@@ -3187,7 +3213,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt98_grm.0_0", 0x000000, 0x80000, CRC(2d79492b) SHA1(16d66d937c34ddf616f31cba0d285326a31cad85) )
@@ -3218,7 +3244,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt99_grm.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3286,7 +3312,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt99_grm.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3320,7 +3346,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt99_grm.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3354,7 +3380,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt2k_grm.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3422,7 +3448,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt2k_grm.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3456,7 +3482,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gt2k_grm.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3491,7 +3517,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gtc_grom.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3525,7 +3551,7 @@
 
 	ROM_REGION( 0x28000, REGION_CPU2, 0 )
 	ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
-	ROM_CONTINUE(           0x08000, 0x08000 )
+	ROM_CONTINUE(          0x08000, 0x08000 )
 
 	ROM_REGION( 0x600000, REGION_GFX1, 0 )
 	ROM_LOAD32_BYTE( "gtc_grom.0_0", 0x000000, 0x80000, CRC(c22b50f9) SHA1(9e8acfce6cc30adc150b602d026c00fa1fb7747f) )
@@ -3857,8 +3883,8 @@
 GAME( 1995, wcbowl,   0,        sftm,     wcbowln,  wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.66)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
 GAME( 1995, wcbwl165, wcbowl,   sftm,     shufbowl, wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.65)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
 GAME( 1995, wcbwl161, wcbowl,   sftm,     shufbowl, wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.61)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
-GAME( 1997, wcbwl140, wcbowldx, wcbowlt,  wcbowldx, wcbowlt,  ROT0, "Incredible Technologies",        "World Class Bowling Tournament (v1.40)" , 0) /* PIC 16C54 labeled as ITBWL-4 */
 GAME( 1995, wcbwl15,  wcbowl,   bloodstm, wcbowl,   wcbowl,   ROT0, "Incredible Technologies",        "World Class Bowling (v1.5)" , 0) /* PIC 16C54 labeled as ITBWL-1 */
+GAME( 1995, wcbwl13,  wcbowl,   bloodstm, wcbowl,   wcbowl,   ROT0, "Incredible Technologies",        "World Class Bowling (v1.3)" , 0) /* PIC 16C54 labeled as ITBWL-1 */
 GAME( 1995, wcbwl12,  wcbowl,   bloodstm, wcbowl,   wcbowl,   ROT0, "Incredible Technologies",        "World Class Bowling (v1.2)" , 0) /* PIC 16C54 labeled as ITBWL-1 */
 GAME( 1995, sftm,     0,        sftm,     sftm,     sftm,     ROT0, "Capcom/Incredible Technologies", "Street Fighter: The Movie (v1.12)" , 0) /* PIC 16C54 labeled as ITSF-1 */
 GAME( 1995, sftm111,  sftm,     sftm,     sftm,     sftm110,  ROT0, "Capcom/Incredible Technologies", "Street Fighter: The Movie (v1.11)" , 0) /* PIC 16C54 labeled as ITSF-1 */
@@ -3867,6 +3893,7 @@
 GAME( 1997, shufshot, 0,        sftm,     shufshot, shufshot, ROT0, "Strata/Incredible Technologies", "Shuffleshot (v1.40)" , 0) /* PIC 16C54 labeled as ITSHF-1 */
 GAME( 1997, sshot139, shufshot, sftm,     shufshot, shufshot, ROT0, "Strata/Incredible Technologies", "Shuffleshot (v1.39)" , 0) /* PIC 16C54 labeled as ITSHF-1 */
 GAME( 1997, sshot137, shufshot, sftm,     shufbowl, shufshot, ROT0, "Strata/Incredible Technologies", "Shuffleshot (v1.37)" , 0) /* PIC 16C54 labeled as ITSHF-1 */
+GAME( 1997, wcbwl140, wcbowldx, tourny,   wcbowldx, wcbowlt,  ROT0, "Incredible Technologies",        "World Class Bowling Tournament (v1.40)" , 0) /* PIC 16C54 labeled as ITBWL-4 */
 GAME( 1999, wcbowldx, 0,        sftm,     wcbowldx, shufshot, ROT0, "Incredible Technologies",        "World Class Bowling Deluxe (v2.00)" , 0) /* PIC 16C54 labeled as ITBWL-4 */
 
 /*
@@ -3919,31 +3946,31 @@
 GAME( 1995, gt3dv16,  gt3d,     sftm,    gt3d,  gt3d,     ROT0, "Incredible Technologies", "Golden Tee 3D Golf (v1.6)" , 0) /* PIC 16C54 labeled as ITGF-1 */
 GAME( 1995, gt3dv15,  gt3d,     sftm,    gt3d,  gt3d,     ROT0, "Incredible Technologies", "Golden Tee 3D Golf (v1.5)" , 0) /* PIC 16C54 labeled as ITGF-1 */
 GAME( 1995, gt3dv14,  gt3d,     sftm,    gt3d,  gt3d,     ROT0, "Incredible Technologies", "Golden Tee 3D Golf (v1.4)" , 0) /* PIC 16C54 labeled as ITGF-1 */
-GAME( 1995, gt3dt231, gt3d,     gt3dt,   gt3d,  aamat,    ROT0, "Incredible Technologies", "Golden Tee 3D Golf Tournament (v2.31)" , 0) /* PIC 16C54 labeled as ITGF-2 */
-GAME( 1995, gt3dt211, gt3d,     gt3dt,   gt3d,  aamat,    ROT0, "Incredible Technologies", "Golden Tee 3D Golf Tournament (v2.11)" , 0) /* PIC 16C54 labeled as ITGF-2 */
+GAME( 1995, gt3dt231, gt3d,     tourny,  gt3d,  aamat,    ROT0, "Incredible Technologies", "Golden Tee 3D Golf Tournament (v2.31)" , 0) /* PIC 16C54 labeled as ITGF-2 */
+GAME( 1995, gt3dt211, gt3d,     tourny,  gt3d,  aamat,    ROT0, "Incredible Technologies", "Golden Tee 3D Golf Tournament (v2.11)" , 0) /* PIC 16C54 labeled as ITGF-2 */
 
 GAME( 1997, gt97,     0,        sftm,    gt97,  aama,     ROT0, "Incredible Technologies", "Golden Tee '97 (v1.30)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
 GAME( 1997, gt97v122, gt97,     sftm,    gt97o, aama,     ROT0, "Incredible Technologies", "Golden Tee '97 (v1.22)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
 GAME( 1997, gt97v121, gt97,     sftm,    gt97o, aama,     ROT0, "Incredible Technologies", "Golden Tee '97 (v1.21)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
 GAME( 1997, gt97s121, gt97,     sftm,    gt97s, s_ver,    ROT0, "Incredible Technologies", "Golden Tee '97 (v1.21S)" , 0) /* PIC 16C54 labeled as ITGFM-3 */
 GAME( 1997, gt97v120, gt97,     sftm,    gt97o, aama,     ROT0, "Incredible Technologies", "Golden Tee '97 (v1.20)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
-GAME( 1997, gt97t240, gt97,     gt3dt,   gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.40)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
-GAME( 1997, gt97t243, gt97,     gt3dt,   gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.43)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
+GAME( 1997, gt97t240, gt97,     tourny,  gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.40)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
+GAME( 1997, gt97t243, gt97,     tourny,  gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.43)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
 
 GAME( 1998, gt98,     0,        sftm,    aama,  aama,     ROT0, "Incredible Technologies", "Golden Tee '98 (v1.10)" , 0) /* PIC 16C54 labeled as ITGF98 */
 GAME( 1998, gt98v100, gt98,     sftm,    gt98,  aama,     ROT0, "Incredible Technologies", "Golden Tee '98 (v1.00)" , 0) /* PIC 16C54 labeled as ITGF98 */
 GAME( 1998, gt98s100, gt98,     sftm,    gt98s, s_ver,    ROT0, "Incredible Technologies", "Golden Tee '98 (v1.00S)" , 0) /* PIC 16C54 labeled as ITGF98-M */
-GAME( 1998, gt98t303, gt98,     gt3dt,   gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee '98 Tournament (v3.03)" , 0) /* PIC 16C54 labeled as ITGF98 */
+GAME( 1998, gt98t303, gt98,     tourny,  gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee '98 Tournament (v3.03)" , 0) /* PIC 16C54 labeled as ITGF98 */
 
 GAME( 1999, gt99,     0,        sftm,    aama,  aama,     ROT0, "Incredible Technologies", "Golden Tee '99 (v1.00)" , 0) /* PIC 16C54 labeled as ITGF99 */
 GAME( 1999, gt99s100, gt99,     sftm,    s_ver, s_ver,    ROT0, "Incredible Technologies", "Golden Tee '99 (v1.00S)" , 0) /* PIC 16C54 labeled as ITGF99-M */
-GAME( 1999, gt99t400, gt99,     gt3dt,   gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee '99 Tournament (v4.00)" , 0) /* PIC 16C54 labeled as ITGF99 */
-GAME( 1999, gtroyal,  gt99,     gt3dt,   gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee Royal Edition Tournament (v4.02)" , 0) /* PIC 16C54 labeled as ITGF99I */
+GAME( 1999, gt99t400, gt99,     tourny,  gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee '99 Tournament (v4.00)" , 0) /* PIC 16C54 labeled as ITGF99 */
+GAME( 1999, gtroyal,  gt99,     tourny,  gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee Royal Edition Tournament (v4.02)" , 0) /* PIC 16C54 labeled as ITGF99I */
 
 GAME( 2000, gt2k,     0,        sftm,    aama,  aama,     ROT0, "Incredible Technologies", "Golden Tee 2K (v1.00)" , 0) /* PIC 16C54 labeled as ITGF2K */
 GAME( 2000, gt2ks100, gt2k,     sftm,    s_ver, s_ver,    ROT0, "Incredible Technologies", "Golden Tee 2K (v1.00S)" , 0) /* PIC 16C54 labeled as ITGF2K-M */
-GAME( 2000, gt2kt500, gt2k,     gt3dt,   gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee 2K Tournament (v5.00)" , 0) /* PIC 16C54 labeled as ITGF2K */
-GAME( 2002, gtsuprem, gt2k,     gt3dt,   gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee Supreme Edition Tournament (v5.10)" , 0) /* PIC 16C54 labeled as ITGF2K-I */
+GAME( 2000, gt2kt500, gt2k,     tourny,  gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee 2K Tournament (v5.00)" , 0) /* PIC 16C54 labeled as ITGF2K */
+GAME( 2002, gtsuprem, gt2k,     tourny,  gt98s, aamat,    ROT0, "Incredible Technologies", "Golden Tee Supreme Edition Tournament (v5.10)" , 0) /* PIC 16C54 labeled as ITGF2K-I */
 
 GAME( 2001, gtclassc, 0,        sftm,    aama,  aama,     ROT0, "Incredible Technologies", "Golden Tee Classic (v1.00)" , 0) /* PIC 16C54 labeled as ITGFCL */
 GAME( 2001, gtclassp, gtclassc, sftm,    aama,  gtclassp, ROT0, "Incredible Technologies", "Golden Tee Classic (v1.00) Alt" , 0) /* PIC 16C54 labeled as ITGFCL */
diff -Nru src-old/mame/drivers/lethal.c src/mame/drivers/lethal.c
--- src-old/mame/drivers/lethal.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/lethal.c	2007-12-23 19:41:16.000000000 -0800
@@ -177,7 +177,7 @@
 
 VIDEO_START(lethalen);
 VIDEO_UPDATE(lethalen);
-WRITE8_HANDLER(le_palette_control);
+WRITE8_HANDLER(lethalen_palette_control);
 
 static int init_eeprom_count;
 static UINT8 cur_control2;
@@ -492,7 +492,7 @@
 	AM_RANGE(0x4090, 0x4090) AM_READNOP
 	AM_RANGE(0x40a0, 0x40a0) AM_READNOP
 	AM_RANGE(0x40c4, 0x40c4) AM_WRITE(control2_w)
-	AM_RANGE(0x40c8, 0x40d0) AM_WRITE(le_palette_control)	// PCU1-PCU3 on the schematics
+	AM_RANGE(0x40c8, 0x40d0) AM_WRITE(lethalen_palette_control)	// PCU1-PCU3 on the schematics
 	AM_RANGE(0x40d4, 0x40d7) AM_READ(guns_r)
 	AM_RANGE(0x40d8, 0x40d8) AM_READ(control2_r)
 	AM_RANGE(0x40d9, 0x40d9) AM_READ(input_port_0_r)
diff -Nru src-old/mame/drivers/macs.c src/mame/drivers/macs.c
--- src-old/mame/drivers/macs.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/macs.c	2007-12-23 19:41:16.000000000 -0800
@@ -62,7 +62,7 @@
 
 
 
-UINT8 macs_mux_data;
+static UINT8 macs_mux_data;
 
 static MACHINE_RESET(macs);
 
diff -Nru src-old/mame/drivers/midzeus.c src/mame/drivers/midzeus.c
--- src-old/mame/drivers/midzeus.c	2007-12-18 00:09:03.000000000 -0800
+++ src/mame/drivers/midzeus.c	2007-12-23 20:03:00.000000000 -0800
@@ -27,7 +27,7 @@
 
 #define BEAM_DY			3
 #define BEAM_DX			3
-#define BEAM_XOFFS		20		/* table in the code indicates an offset of 20 with a beam height of 7 */
+#define BEAM_XOFFS		40		/* table in the code indicates an offset of 20 with a beam height of 7 */
 
 static UINT32 			gun_control;
 static UINT8 			gun_irq_state;
@@ -35,6 +35,8 @@
 static INT32 			gun_x[2], gun_y[2];
 
 static UINT32 *ram_base;
+static UINT32 *zpram;
+static size_t zpram_size;
 static UINT8 cmos_protected;
 
 static emu_timer *timer[2];
@@ -63,6 +65,8 @@
 
 	gun_timer[0] = timer_alloc(invasn_gun_callback, NULL);
 	gun_timer[1] = timer_alloc(invasn_gun_callback, NULL);
+
+	cmos_protected = TRUE;
 }
 
 
@@ -75,7 +79,7 @@
 
 static WRITE32_HANDLER( cmos_protect_w )
 {
-	cmos_protected = 0;
+	cmos_protected = FALSE;
 }
 
 
@@ -83,6 +87,7 @@
 {
 	if (!cmos_protected)
 		COMBINE_DATA(generic_nvram32 + offset);
+	cmos_protected = TRUE;
 }
 
 
@@ -92,6 +97,41 @@
 }
 
 
+static WRITE32_HANDLER( zpram_w )
+{
+	/* ZPRAM seems to use the same protection control as CMOS */
+//  if (!cmos_protected)
+		COMBINE_DATA(zpram + offset);
+	cmos_protected = TRUE;
+}
+
+
+static READ32_HANDLER( zpram_r )
+{
+	return zpram[offset] | 0xffffff00;
+}
+
+
+static NVRAM_HANDLER( zeus2_nvram )
+{
+	if (read_or_write)
+	{
+		mame_fwrite(file, generic_nvram, generic_nvram_size);
+		mame_fwrite(file, zpram, zpram_size);
+	}
+	else if (file)
+	{
+		mame_fread(file, generic_nvram, generic_nvram_size);
+		mame_fread(file, zpram, zpram_size);
+	}
+	else
+	{
+		memset(generic_nvram, 0xff, generic_nvram_size);
+		memset(zpram, 0xff, zpram_size);
+	}
+}
+
+
 
 /*************************************
  *
@@ -138,6 +178,7 @@
 }
 
 
+
 /*************************************
  *
  *  Lightgun handling
@@ -146,6 +187,7 @@
 
 static void update_gun_irq(void)
 {
+	/* low 2 bits of gun_control seem to enable IRQs */
 	if (gun_irq_state & gun_control & 0x03)
 		cpunum_set_input_line(0, 3, ASSERT_LINE);
 	else
@@ -158,9 +200,11 @@
 	int player = param;
 	int beamy = video_screen_get_vpos(0);
 
+	/* set the appropriate IRQ in the internal gun control and update */
 	gun_irq_state |= 0x01 << player;
 	update_gun_irq();
 
+	/* generate another interrupt on the next scanline while we are within the BEAM_DY */
 	beamy++;
 	if (beamy <= machine->screen[0].visarea.max_y && beamy <= gun_y[player] + BEAM_DY)
 		timer_adjust(gun_timer[player], video_screen_get_time_until_pos(0, beamy, MAX(0, gun_x[player] - BEAM_DX)), player, attotime_never);
@@ -197,6 +241,7 @@
 	}
 }
 
+
 static READ32_HANDLER( invasn_gun_r )
 {
 	int beamx = video_screen_get_hpos(0);
@@ -215,6 +260,7 @@
 }
 
 
+
 /*************************************
  *
  *  Memory maps
@@ -225,6 +271,7 @@
 // read 8d0003, check bit 1, skip some stuff if 0
 // write junk to 9e0000
 
+static UINT32 *unknown_8a0000;
 static UINT32 *unknown_8d0000;
 static READ32_HANDLER( unknown_8d0000_r )
 {
@@ -232,10 +279,34 @@
 }
 static WRITE32_HANDLER( unknown_8d0000_w )
 {
-	logerror("%06X:write to %06X = %08X\n", activecpu_get_pc(), 0x8d0000 + offset, data);
+//  logerror("%06X:write to %06X = %08X\n", activecpu_get_pc(), 0x8d0000 + offset, data);
+	COMBINE_DATA(&unknown_8d0000[offset]);
+}
+static WRITE32_HANDLER( unknown_9d0000_w )
+{
+//  logerror("%06X:write to %06X = %08X\n", activecpu_get_pc(), 0x9d0000 + offset, data);
 	COMBINE_DATA(&unknown_8d0000[offset]);
 }
 
+static WRITE32_HANDLER( rombank_select_w )
+{
+	memory_set_bank(1, data);
+}
+
+static READ32_HANDLER( unknown_8a0000_r )
+{
+	logerror("%06X:unknown_8a000_r(%02X)\n", activecpu_get_pc(), offset);
+	if (offset == 0)
+		return 0x30313042;
+	return unknown_8a0000[offset];
+}
+
+static WRITE32_HANDLER( unknown_8a0000_w )
+{
+	logerror("%06X:unknown_8a000_w(%02X) = %08X\n", activecpu_get_pc(),  offset, data);
+	COMBINE_DATA(&unknown_8a0000[offset]);
+}
+
 
 static ADDRESS_MAP_START( zeus_map, ADDRESS_SPACE_PROGRAM, 32 )
 	ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
@@ -245,6 +316,7 @@
 	AM_RANGE(0x880000, 0x8803ff) AM_READWRITE(zeus_r, zeus_w) AM_BASE(&zeusbase)
 	AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000)
 	AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w)
+	AM_RANGE(0x9d0000, 0x9d0001) AM_WRITE(unknown_9d0000_w)
 	AM_RANGE(0x9e0000, 0x9e0000) AM_WRITENOP		// watchdog?
 	AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size)
 	AM_RANGE(0x9f8000, 0x9f8000) AM_WRITE(cmos_protect_w)
@@ -258,12 +330,16 @@
 	AM_RANGE(0x400000, 0x43ffff) AM_RAM
 	AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control)
 	AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(zeus2_r, zeus2_w) AM_BASE(&zeusbase)
+	AM_RANGE(0x8a0000, 0x8a0027) AM_READWRITE(unknown_8a0000_r, unknown_8a0000_w) AM_BASE(&unknown_8a0000)
 	AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000)
+	AM_RANGE(0x8d0005, 0x8d0005) AM_WRITE(rombank_select_w)
+	AM_RANGE(0x900000, 0x91ffff) AM_READWRITE(zpram_r, zpram_w) AM_BASE(&zpram) AM_SIZE(&zpram_size) AM_MIRROR(0x020000)
 	AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w)
 	AM_RANGE(0x9e0000, 0x9e0000) AM_WRITENOP		// watchdog?
 	AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size)
 	AM_RANGE(0x9f8000, 0x9f8000) AM_WRITE(cmos_protect_w)
-	AM_RANGE(0xa00000, 0xffffff) AM_ROM AM_REGION(REGION_USER1, 0)
+	AM_RANGE(0xa00000, 0xbfffff) AM_ROM AM_REGION(REGION_USER1, 0)
+	AM_RANGE(0xc00000, 0xffffff) AM_ROMBANK(1) AM_REGION(REGION_USER2, 0)
 ADDRESS_MAP_END
 
 
@@ -406,7 +482,7 @@
 	PORT_DIPNAME( 0x0040, 0x0040, "Flip Y" )
 	PORT_DIPSETTING(      0x0040, DEF_STR( Off ))
 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
-	PORT_DIPNAME( 0x0080, 0x0000, "Test Switch" )
+	PORT_DIPNAME( 0x0080, 0x0080, "Test Switch" )
 	PORT_DIPSETTING(      0x0080, DEF_STR( Off ))
 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
 	PORT_DIPNAME( 0x0100, 0x0100, "Mirrored Display" )
@@ -478,58 +554,58 @@
 
 static INPUT_PORTS_START( crusnexo )
 	PORT_START	    /* DS1 */
- 	PORT_DIPNAME( 0x0001, 0x0001, "Game Type" )	/* Manual states "*DIP 1, Switch 1 MUST be set */
- 	PORT_DIPSETTING(      0x0001, "Dedicated" )	/*   to OFF position for proper operation" */
+ 	PORT_DIPNAME( 0x001f, 0x001f, "Country Code" )
+ 	PORT_DIPSETTING(      0x001f, DEF_STR( USA ) )
+ 	PORT_DIPSETTING(      0x001e, "Germany" )
+ 	PORT_DIPSETTING(      0x001d, "France" )
+ 	PORT_DIPSETTING(      0x001c, "Canada" )
+ 	PORT_DIPSETTING(      0x001b, "Switzerland" )
+ 	PORT_DIPSETTING(      0x001a, "Italy" )
+ 	PORT_DIPSETTING(      0x0019, "UK" )
+ 	PORT_DIPSETTING(      0x0018, "Spain" )
+ 	PORT_DIPSETTING(      0x0017, "Austrilia" )
+ 	PORT_DIPSETTING(      0x0016, DEF_STR( Japan ) )
+ 	PORT_DIPSETTING(      0x0015, "Taiwan" )
+ 	PORT_DIPSETTING(      0x0014, "Austria" )
+ 	PORT_DIPSETTING(      0x0013, "Belgium" )
+ 	PORT_DIPSETTING(      0x000f, "Sweden" )
+ 	PORT_DIPSETTING(      0x000e, "Findland" )
+	PORT_DIPSETTING(      0x000d, "Netherlands" )
+ 	PORT_DIPSETTING(      0x000c, "Norway" )
+ 	PORT_DIPSETTING(      0x000b, "Denmark" )
+ 	PORT_DIPSETTING(      0x000a, "Hungary" )
+ 	PORT_DIPSETTING(      0x0008, "General" )
+ 	PORT_DIPNAME( 0x0060, 0x0060, "Coin Mode" )
+ 	PORT_DIPSETTING(      0x0060, "Mode 1" ) /* USA1/GER1/FRA1/SPN1/AUSTRIA1/GEN1/CAN1/SWI1/ITL1/JPN1/TWN1/BLGN1/NTHRLND1/FNLD1/NRWY1/DNMK1/HUN1 */
+ 	PORT_DIPSETTING(      0x0040, "Mode 2" ) /* USA3/GER1/FRA1/SPN1/AUSTRIA1/GEN3/CAN2/SWI2/ITL2/JPN2/TWN2/BLGN2/NTHRLND2 */
+ 	PORT_DIPSETTING(      0x0020, "Mode 3" ) /* USA7/GER1/FRA1/SPN1/AUSTRIA1/GEN5/CAN3/SWI3/ITL3/JPN3/TWN3/BLGN3 */
+ 	PORT_DIPSETTING(      0x0000, "Mode 4" ) /* USA8/GER1/FRA1/SPN1/AUSTRIA1/GEN7 */
+	PORT_DIPNAME( 0x0080, 0x0080, "Test Switch" )
+	PORT_DIPSETTING(      0x0080, DEF_STR( Off ))
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
+ 	PORT_DIPNAME( 0x0100, 0x0100, "Game Type" )	/* Manual states "*DIP 1, Switch 1 MUST be set */
+ 	PORT_DIPSETTING(      0x0100, "Dedicated" )	/*   to OFF position for proper operation" */
  	PORT_DIPSETTING(      0x0000, "Kit" )
- 	PORT_DIPNAME( 0x0002, 0x0002, "Seat Motion" )	/* For dedicated Sit Down models with Motion Seat */
-  	PORT_DIPSETTING(      0x0002, DEF_STR( Off ))
+ 	PORT_DIPNAME( 0x0200, 0x0200, "Seat Motion" )	/* For dedicated Sit Down models with Motion Seat */
+  	PORT_DIPSETTING(      0x0200, DEF_STR( Off ))
   	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
- 	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Cabinet ))
- 	PORT_DIPSETTING(      0x0004, "Stand Up" )
+ 	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Cabinet ))
+ 	PORT_DIPSETTING(      0x0400, "Stand Up" )
  	PORT_DIPSETTING(      0x0000, "Sit Down" )
- 	PORT_DIPNAME( 0x0008, 0x0008, "Wheel Invert" )
-  	PORT_DIPSETTING(      0x0000, DEF_STR( Off ))
-  	PORT_DIPSETTING(      0x0008, DEF_STR( On ))
- 	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ))	/* Manual lists this dip as Unused */
- 	PORT_DIPSETTING(      0x0010, DEF_STR( Off ))
+ 	PORT_DIPNAME( 0x0800, 0x0800, "Wheel Invert" )
+  	PORT_DIPSETTING(      0x0800, DEF_STR( Off ))
   	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
- 	PORT_DIPNAME( 0x0020, 0x0020, "Link" )
- 	PORT_DIPSETTING(      0x0020, DEF_STR( Off ))
+ 	PORT_DIPNAME( 0x1000, 0x1000, "ROM Configuration" )	/* Manual lists this dip as Unused */
+ 	PORT_DIPSETTING(      0x1000, "32M ROM Normal" )
+  	PORT_DIPSETTING(      0x0000, "16M ROM Split Active" )
+ 	PORT_DIPNAME( 0x2000, 0x2000, "Link" )
+ 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ))
   	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
- 	PORT_DIPNAME( 0x00c0, 0x00c0, "Linking I.D.")
- 	PORT_DIPSETTING(      0x00c0, "Master #1" )
- 	PORT_DIPSETTING(      0x0080, "Slave #2" )
- 	PORT_DIPSETTING(      0x0040, "Slave #3" )
+ 	PORT_DIPNAME( 0xc000, 0xc000, "Linking I.D.")
+ 	PORT_DIPSETTING(      0xc000, "Master #1" )
+ 	PORT_DIPSETTING(      0x8000, "Slave #2" )
+ 	PORT_DIPSETTING(      0x4000, "Slave #3" )
  	PORT_DIPSETTING(      0x0000, "Slave #4" )
- 	PORT_DIPNAME( 0x1f00, 0x1f00, "Country Code" )
- 	PORT_DIPSETTING(      0x1f00, DEF_STR( USA ) )
- 	PORT_DIPSETTING(      0x1e00, "Germany" )
- 	PORT_DIPSETTING(      0x1d00, "France" )
- 	PORT_DIPSETTING(      0x1c00, "Canada" )
- 	PORT_DIPSETTING(      0x1b00, "Switzerland" )
- 	PORT_DIPSETTING(      0x1a00, "Italy" )
- 	PORT_DIPSETTING(      0x1900, "UK" )
- 	PORT_DIPSETTING(      0x1800, "Spain" )
- 	PORT_DIPSETTING(      0x1700, "Austrilia" )
- 	PORT_DIPSETTING(      0x1600, DEF_STR( Japan ) )
- 	PORT_DIPSETTING(      0x1500, "Taiwan" )
- 	PORT_DIPSETTING(      0x1400, "Austria" )
- 	PORT_DIPSETTING(      0x1300, "Belgium" )
- 	PORT_DIPSETTING(      0x0f00, "Sweden" )
- 	PORT_DIPSETTING(      0x0e00, "Findland" )
-	PORT_DIPSETTING(      0x0d00, "Netherlands" )
- 	PORT_DIPSETTING(      0x0c00, "Norway" )
- 	PORT_DIPSETTING(      0x0b00, "Denmark" )
- 	PORT_DIPSETTING(      0x0a00, "Hungary" )
- 	PORT_DIPSETTING(      0x0800, "General" )
- 	PORT_DIPNAME( 0x6000, 0x6000, "Coin Mode" )
- 	PORT_DIPSETTING(      0x6000, "Mode 1" ) /* USA1/GER1/FRA1/SPN1/AUSTRIA1/GEN1/CAN1/SWI1/ITL1/JPN1/TWN1/BLGN1/NTHRLND1/FNLD1/NRWY1/DNMK1/HUN1 */
- 	PORT_DIPSETTING(      0x4000, "Mode 2" ) /* USA3/GER1/FRA1/SPN1/AUSTRIA1/GEN3/CAN2/SWI2/ITL2/JPN2/TWN2/BLGN2/NTHRLND2 */
- 	PORT_DIPSETTING(      0x2000, "Mode 3" ) /* USA7/GER1/FRA1/SPN1/AUSTRIA1/GEN5/CAN3/SWI3/ITL3/JPN3/TWN3/BLGN3 */
- 	PORT_DIPSETTING(      0x0000, "Mode 4" ) /* USA8/GER1/FRA1/SPN1/AUSTRIA1/GEN7 */
-	PORT_DIPNAME( 0x8000, 0x8000, "Test Switch" )
-	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
-	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
 
 	PORT_START
 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
@@ -546,35 +622,36 @@
 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_DOWN )
 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_VOLUME_UP )
 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
-	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 )	/* Bill */
+	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 )
 
 	PORT_START /* Listed "names" are via the manual's "JAMMA" pinout sheet" */
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(1) PORT_8WAY /* Not Used */
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(1) PORT_8WAY /* Radio Switch */
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(1) PORT_8WAY /* Not Used */
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY /* Not Used */
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* View 2 */
-	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* View 3 */
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* View 1 */
-	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
-	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(2) PORT_8WAY /* Gear 1 */
-	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(2) PORT_8WAY /* Gear 2 */
-	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(2) PORT_8WAY /* Gear 3 */
-	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY /* Gear 4 */
-	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) /* Not Used */
-	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* Not Used */
-	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* Not Used */
-	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* Not Used */
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON6 )	/* Radio Switch */
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* Not Used */
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* Not Used */
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* View 1 */
+	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) /* View 2 */
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* View 3 */
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) /* View 4 */
+	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) 	/* Gear 1 */
+	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) 	/* Gear 2 */
+	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON4 ) 	/* Gear 3 */
+	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 ) 	/* Gear 4 */
+	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* Not Used */
+	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* Not Used */
+	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* Not Used */
+	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
 	PORT_START
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED )
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
-	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
-	PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNUSED )
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)	/* keypad 3 */
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)	/* keypad 1 */
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)	/* keypad 2 */
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)	/* keypad 2 */
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3)	/* keypad 2 */
+	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(3)	/* keypad 2 */
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(3)	/* keypad 2 */
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(3)	/* keypad 2 */
+	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
 INPUT_PORTS_END
 
 
@@ -663,6 +740,7 @@
 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_VOLUME_UP )
 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 )	/* Bill */
+	PORT_BIT (0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED )
 
 	PORT_START /* Listed "names" are via the manual's "JAMMA" pinout sheet" */
 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(1) PORT_8WAY /* Not Used */
@@ -681,6 +759,7 @@
 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* No Connection */
 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* No Connection */
 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
+	PORT_BIT (0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED )
 
 	PORT_START
 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
@@ -691,6 +770,7 @@
 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
 	PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNUSED )
+	PORT_BIT (0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED )
 INPUT_PORTS_END
 
 
@@ -708,19 +788,17 @@
 	MDRV_CPU_PROGRAM_MAP(zeus_map,0)
 	MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
 
-	MDRV_SCREEN_REFRESH_RATE(57)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-
 	MDRV_MACHINE_RESET(midzeus)
 	MDRV_NVRAM_HANDLER(generic_1fill)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(512/*+256*/, 278/*+256*/)
-	MDRV_SCREEN_VISIBLE_AREA(0, 399/*+256*/, 0, 255/*+256*/)
 	MDRV_PALETTE_LENGTH(32768)
 
+	MDRV_SCREEN_ADD("main", 0)
+	MDRV_SCREEN_RAW_PARAMS(MIDZEUS_VIDEO_CLOCK/8, 529, 0, 400, 278, 0, 256)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+
 	MDRV_VIDEO_START(midzeus)
 	MDRV_VIDEO_UPDATE(midzeus)
 
@@ -730,11 +808,27 @@
 
 
 static MACHINE_DRIVER_START( midzeus2 )
-	MDRV_IMPORT_FROM(midzeus)
 
 	/* basic machine hardware */
-	MDRV_CPU_MODIFY("main")
+	MDRV_CPU_ADD_TAG("main", TMS32032, CPU_CLOCK)
 	MDRV_CPU_PROGRAM_MAP(zeus2_map,0)
+	MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
+
+	MDRV_MACHINE_RESET(midzeus)
+	MDRV_NVRAM_HANDLER(zeus2_nvram)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+
+	MDRV_SCREEN_ADD("main", 0)
+	MDRV_SCREEN_RAW_PARAMS(MIDZEUS_VIDEO_CLOCK/4, 666, 0, 512, 438, 0, 400)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
+
+	MDRV_VIDEO_START(midzeus2)
+	MDRV_VIDEO_UPDATE(midzeus2)
+
+	/* sound hardware */
+	MDRV_IMPORT_FROM(dcs2_audio_2104)
 MACHINE_DRIVER_END
 
 
@@ -810,23 +904,25 @@
 	ROM_LOAD( "exotica.u3", 0x400000, 0x400000, CRC(28a3a13d) SHA1(8d7d641b883df089adefdd144229afef79db9e8a) )
 	ROM_LOAD( "exotica.u4", 0x800000, 0x400000, CRC(213f7fd8) SHA1(8528d524a62bc41a8e3b39f0dbeeba33c862ee27) )
 
-	ROM_REGION32_LE( 0x3000000, REGION_USER1, 0 )
+	ROM_REGION32_LE( 0x0800000, REGION_USER1, 0 )
 	ROM_LOAD32_WORD( "exotica.u10", 0x0000000, 0x200000, CRC(65450140) SHA1(cad41a2cad48426de01feb78d3f71f768e3fc872) )
 	ROM_LOAD32_WORD( "exotica.u11", 0x0000002, 0x200000, CRC(e994891f) SHA1(bb088729b665864c7f3b79b97c3c86f9c8f68770) )
 	ROM_LOAD32_WORD( "exotica.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) )
 	ROM_LOAD32_WORD( "exotica.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) )
-	ROM_LOAD32_WORD( "exotica.u14", 0x0800000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) )
-	ROM_LOAD32_WORD( "exotica.u15", 0x0800002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) )
-	ROM_LOAD32_WORD( "exotica.u16", 0x1000000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) )
-	ROM_LOAD32_WORD( "exotica.u17", 0x1000002, 0x400000, CRC(71cf5404) SHA1(a6eed1a66fb4f4ddd749e4272a2cdb8e3e354029) )
-	ROM_LOAD32_WORD( "exotica.u18", 0x1800000, 0x200000, CRC(60cf5caa) SHA1(629870a305802d632bd2681131d1ffc0086280d2) )
-	ROM_LOAD32_WORD( "exotica.u19", 0x1800002, 0x200000, CRC(6b919a18) SHA1(20e40e195554146ed1d3fad54f7280823ae89d4b) )
-	ROM_LOAD32_WORD( "exotica.u20", 0x1c00002, 0x200000, CRC(4855b68b) SHA1(1f6e557590b2621d0d5c782b95577f1be5cbc51d) )
-	ROM_LOAD32_WORD( "exotica.u21", 0x1c00002, 0x200000, CRC(0011b9d6) SHA1(231d768c964a16b905857b0814d758fe93c2eefb) )
-	ROM_LOAD32_WORD( "exotica.u22", 0x2000002, 0x400000, CRC(ad6dcda7) SHA1(5c9291753e1659f9adbe7e59fa2d0e030efae5bc) )
-	ROM_LOAD32_WORD( "exotica.u23", 0x2000002, 0x400000, CRC(1f103a68) SHA1(3b3acc63a461677cd424e75e7211fa6f063a37ef) )
-	ROM_LOAD32_WORD( "exotica.u24", 0x2800002, 0x400000, CRC(6312feef) SHA1(4113e4e5d39c99e8131d41a57c973df475b67d18) )
-	ROM_LOAD32_WORD( "exotica.u25", 0x2800002, 0x400000, CRC(b8277b16) SHA1(1355e87affd78e195906aedc9aed9e230374e2bf) )
+
+	ROM_REGION32_LE( 0x3000000, REGION_USER2, 0 )
+	ROM_LOAD32_WORD( "exotica.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) )
+	ROM_LOAD32_WORD( "exotica.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) )
+	ROM_LOAD32_WORD( "exotica.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) )
+	ROM_LOAD32_WORD( "exotica.u17", 0x0800002, 0x400000, CRC(71cf5404) SHA1(a6eed1a66fb4f4ddd749e4272a2cdb8e3e354029) )
+	ROM_LOAD32_WORD( "exotica.u22", 0x1000000, 0x400000, CRC(ad6dcda7) SHA1(5c9291753e1659f9adbe7e59fa2d0e030efae5bc) )
+	ROM_LOAD32_WORD( "exotica.u23", 0x1000002, 0x400000, CRC(1f103a68) SHA1(3b3acc63a461677cd424e75e7211fa6f063a37ef) )
+	ROM_LOAD32_WORD( "exotica.u24", 0x1800000, 0x400000, CRC(6312feef) SHA1(4113e4e5d39c99e8131d41a57c973df475b67d18) )
+	ROM_LOAD32_WORD( "exotica.u25", 0x1800002, 0x400000, CRC(b8277b16) SHA1(1355e87affd78e195906aedc9aed9e230374e2bf) )
+	ROM_LOAD32_WORD( "exotica.u18", 0x2000000, 0x200000, CRC(60cf5caa) SHA1(629870a305802d632bd2681131d1ffc0086280d2) )
+	ROM_LOAD32_WORD( "exotica.u19", 0x2000002, 0x200000, CRC(6b919a18) SHA1(20e40e195554146ed1d3fad54f7280823ae89d4b) )
+	ROM_LOAD32_WORD( "exotica.u20", 0x2400000, 0x200000, CRC(4855b68b) SHA1(1f6e557590b2621d0d5c782b95577f1be5cbc51d) )
+	ROM_LOAD32_WORD( "exotica.u21", 0x2400002, 0x200000, CRC(0011b9d6) SHA1(231d768c964a16b905857b0814d758fe93c2eefb) )
 ROM_END
 
 
@@ -836,17 +932,19 @@
 	ROM_LOAD( "the_grid.u3", 0x400000, 0x400000, CRC(40be7585) SHA1(e481081edffa07945412a6eab17b4d3e7b42cfd3) )
 	ROM_LOAD( "the_grid.u4", 0x800000, 0x400000, CRC(7a15c203) SHA1(a0a49dd08bba92402640ed2d1fb4fee112c4ab5f) )
 
-	ROM_REGION32_LE( 0x3000000, REGION_USER1, 0 )
+	ROM_REGION32_LE( 0x0800000, REGION_USER1, 0 )
  	ROM_LOAD32_WORD( "thegrid-11.u10", 0x0000000, 0x100000, CRC(87ea0e9e) SHA1(618de2ca87b7a3e0225d1f7e65f8fc1356de1421) )
 	ROM_LOAD32_WORD( "thegrid-11.u11", 0x0000002, 0x100000, CRC(73d84b1a) SHA1(8dcfcab5ff64f46f8486e6439a10d91ad26fd48a) )
 	ROM_LOAD32_WORD( "thegrid-11.u12", 0x0200000, 0x100000, CRC(78d16ca1) SHA1(7b893ec8af2f44d8bc293861fd8622d68d41ccbe) )
 	ROM_LOAD32_WORD( "thegrid-11.u13", 0x0200002, 0x100000, CRC(8e00b400) SHA1(96581c5da62afc19e6d69b2352b3166665cb9918) )
-	ROM_LOAD32_WORD( "the_grid.u18",   0x0400000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) )
-	ROM_LOAD32_WORD( "the_grid.u19",   0x0400002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) )
-	ROM_LOAD32_WORD( "the_grid.u20",   0x0c00002, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) )
-	ROM_LOAD32_WORD( "the_grid.u21",   0x0c00002, 0x400000, CRC(48c03f8e) SHA1(50790bdae9f2234ffb4914c2c5c16374e3508b47) )
-	ROM_LOAD32_WORD( "the_grid.u22",   0x1400002, 0x400000, CRC(84c3a8b6) SHA1(de0dcf9daf7ada7a6952b9e29a29571b2aa9d0b2) )
-	ROM_LOAD32_WORD( "the_grid.u23",   0x1400002, 0x400000, CRC(f48ef409) SHA1(79d74b4fe38b06a02ae0351d13d7f0a7ed0f0c87) )
+
+	ROM_REGION32_LE( 0x3000000, REGION_USER2, 0 )
+	ROM_LOAD32_WORD( "the_grid.u18",   0x0000000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) )
+	ROM_LOAD32_WORD( "the_grid.u19",   0x0000002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) )
+	ROM_LOAD32_WORD( "the_grid.u20",   0x0800000, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) )
+	ROM_LOAD32_WORD( "the_grid.u21",   0x0800002, 0x400000, CRC(48c03f8e) SHA1(50790bdae9f2234ffb4914c2c5c16374e3508b47) )
+	ROM_LOAD32_WORD( "the_grid.u22",   0x1000000, 0x400000, CRC(84c3a8b6) SHA1(de0dcf9daf7ada7a6952b9e29a29571b2aa9d0b2) )
+	ROM_LOAD32_WORD( "the_grid.u23",   0x1000002, 0x400000, CRC(f48ef409) SHA1(79d74b4fe38b06a02ae0351d13d7f0a7ed0f0c87) )
 ROM_END
 
 
@@ -860,7 +958,7 @@
 static DRIVER_INIT( mk4 )
 {
 	dcs2_init(0, 0);
-	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* or 474 */, 94, NULL);
+	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* or 474 */, 97, NULL);
 	midway_ioasic_set_shuffle_state(1);
 }
 
@@ -868,7 +966,7 @@
 static DRIVER_INIT( invasn )
 {
 	dcs2_init(0, 0);
-	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 94, NULL);
+	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 97, NULL);
 	memory_install_readwrite32_handler(0, ADDRESS_SPACE_PROGRAM, 0x9c0000, 0x9c0000, 0, 0, invasn_gun_r, invasn_gun_w);
 }
 
@@ -876,7 +974,8 @@
 static DRIVER_INIT( crusnexo )
 {
 	dcs2_init(0, 0);
-	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* unknown */, 94, NULL);
+	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
+	memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4);
 }
 
 
@@ -884,7 +983,8 @@
 {
 	cpunum_set_input_line(0, INPUT_LINE_HALT, ASSERT_LINE);
 	dcs2_init(0, 0);
-	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* unknown */, 94, NULL);
+	midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL);
+	memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4);
 }
 
 
@@ -897,6 +997,6 @@
 
 GAME( 1997, mk4,      0,     midzeus,  mk4,      mk4,      ROT0, "Midway", "Mortal Kombat 4 (3.0)", GAME_IMPERFECT_GRAPHICS )
 GAME( 1997, mk4a,     mk4,   midzeus,  mk4,      mk4,      ROT0, "Midway", "Mortal Kombat 4 (2.1)", GAME_IMPERFECT_GRAPHICS )
-GAME( 1999, invasn,   0,     midzeus,  invasn,   invasn,   ROT0, "Midway", "Invasion (Midway)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
+GAME( 1999, invasn,   0,     midzeus,  invasn,   invasn,   ROT0, "Midway", "Invasion (Midway)", GAME_IMPERFECT_GRAPHICS )
 GAME( 1999, crusnexo, 0,     midzeus2, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
 GAME( 2001, thegrid,  0,     midzeus2, thegrid,  thegrid,  ROT0, "Midway", "The Grid (version 1.1)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
diff -Nru src-old/mame/drivers/mitchell.c src/mame/drivers/mitchell.c
--- src-old/mame/drivers/mitchell.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/mitchell.c	2007-12-23 19:13:19.000000000 -0800
@@ -1361,7 +1361,7 @@
 static MACHINE_DRIVER_START( pang )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD_TAG("main",Z80, 8000000)	/* Super Pang says 8MHZ ORIGINAL BOARD */
+	MDRV_CPU_ADD_TAG("main",Z80, 8000000)	/* (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(readmem,writemem)
 	MDRV_CPU_IO_MAP(readport,writeport)
 	MDRV_CPU_VBLANK_INT(irq0_line_hold,2)	/* ??? one extra irq seems to be needed for music (see input5_r) */
@@ -1385,11 +1385,11 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD_TAG("oki", OKIM6295, 990000)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
+	MDRV_SOUND_ADD_TAG("oki", OKIM6295, 1000000) /* (verified on pcb) */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 verified
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
 
-	MDRV_SOUND_ADD_TAG("ym2413",YM2413, 4000000)
+	MDRV_SOUND_ADD_TAG("ym2413",YM2413, 4000000) /* (verified on pcb) */
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
 MACHINE_DRIVER_END
 
diff -Nru src-old/mame/drivers/model1.c src/mame/drivers/model1.c
--- src-old/mame/drivers/model1.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/model1.c	2007-12-23 19:41:16.000000000 -0800
@@ -737,13 +737,11 @@
 	cpunum_set_irq_callback(0, irq_callback);
 }
 
-extern void tgp_tick(void);
 static INTERRUPT_GEN(model1_interrupt)
 {
 	if (cpu_getiloops())
 	{
 		irq_raise(1);
-		tgp_tick();
 	}
 	else
 	{
diff -Nru src-old/mame/drivers/namcona1.c src/mame/drivers/namcona1.c
--- src-old/mame/drivers/namcona1.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/namcona1.c	2007-12-19 11:46:12.000000000 -0800
@@ -1820,17 +1820,17 @@
 ROM_END
 
 // NA-1 (C69 MCU)
-GAME( 1992,bkrtmaq,  0,        namcona1w, namcona1_quiz,bkrtmaq,  ROT0, "Namco", "Bakuretsu Quiz Ma-Q Dai Bouken (Japan)", GAME_IMPERFECT_SOUND )
-GAME( 1992,cgangpzl, 0,        namcona1w, namcona1_joy,	cgangpzl, ROT0, "Namco", "Cosmo Gang the Puzzle (US)", GAME_IMPERFECT_SOUND )
-GAME( 1992,cgangpzj, cgangpzl, namcona1w, namcona1_joy,	cgangpzl, ROT0, "Namco", "Cosmo Gang the Puzzle (Japan)", GAME_IMPERFECT_SOUND )
-GAME( 1992,exvania,  0,        namcona1,  namcona1_joy,	exbania,  ROT0, "Namco", "Exvania (Japan)", GAME_IMPERFECT_SOUND )
-GAME( 1992,fghtatck, 0,        namcona1,  namcona1_joy,	fa,       ROT90,"Namco", "Fighter & Attacker (US)", GAME_IMPERFECT_SOUND )
-GAME( 1992,fa,       fghtatck, namcona1,  namcona1_joy,	fa,       ROT90,"Namco", "F/A (Japan)", GAME_IMPERFECT_SOUND )
-GAME( 1992,swcourt,  0,        namcona1w, namcona1_joy,	swcourt,  ROT0, "Namco", "Super World Court (World)", GAME_IMPERFECT_SOUND )
-GAME( 1992,swcourtj, swcourt,  namcona1w, namcona1_joy,	swcourt,  ROT0, "Namco", "Super World Court (Japan)", GAME_IMPERFECT_SOUND )
-GAME( 1993,emeraldj, emeralda, namcona1w, namcona1_joy,	emeraldj, ROT0, "Namco", "Emeraldia (Japan Version B)", GAME_IMPERFECT_SOUND ) /* Parent is below on NA-2 Hardware */
-GAME( 1993,emerldja, emeralda, namcona1w, namcona1_joy,	emeraldj, ROT0, "Namco", "Emeraldia (Japan)", GAME_IMPERFECT_SOUND ) /* Parent is below on NA-2 Hardware */
-GAME( 1993,tinklpit, 0,        namcona1w, namcona1_joy,	tinklpit, ROT0, "Namco", "Tinkle Pit (Japan)", GAME_IMPERFECT_SOUND )
+GAME( 1992,bkrtmaq,  0,        namcona1w, namcona1_quiz,bkrtmaq,  ROT0, "Namco", "Bakuretsu Quiz Ma-Q Dai Bouken (Japan)", 0 )
+GAME( 1992,cgangpzl, 0,        namcona1w, namcona1_joy,	cgangpzl, ROT0, "Namco", "Cosmo Gang the Puzzle (US)", 0 )
+GAME( 1992,cgangpzj, cgangpzl, namcona1w, namcona1_joy,	cgangpzl, ROT0, "Namco", "Cosmo Gang the Puzzle (Japan)", 0 )
+GAME( 1992,exvania,  0,        namcona1,  namcona1_joy,	exbania,  ROT0, "Namco", "Exvania (Japan)", 0 )
+GAME( 1992,fghtatck, 0,        namcona1,  namcona1_joy,	fa,       ROT90,"Namco", "Fighter & Attacker (US)", 0 )
+GAME( 1992,fa,       fghtatck, namcona1,  namcona1_joy,	fa,       ROT90,"Namco", "F/A (Japan)", 0 )
+GAME( 1992,swcourt,  0,        namcona1w, namcona1_joy,	swcourt,  ROT0, "Namco", "Super World Court (World)", 0 )
+GAME( 1992,swcourtj, swcourt,  namcona1w, namcona1_joy,	swcourt,  ROT0, "Namco", "Super World Court (Japan)", 0 )
+GAME( 1993,emeraldj, emeralda, namcona1w, namcona1_joy,	emeraldj, ROT0, "Namco", "Emeraldia (Japan Version B)", 0 ) /* Parent is below on NA-2 Hardware */
+GAME( 1993,emerldja, emeralda, namcona1w, namcona1_joy,	emeraldj, ROT0, "Namco", "Emeraldia (Japan)", 0 ) /* Parent is below on NA-2 Hardware */
+GAME( 1993,tinklpit, 0,        namcona1w, namcona1_joy,	tinklpit, ROT0, "Namco", "Tinkle Pit (Japan)", 0 )
 
 // NA-2 (C70 MCU)
 GAME( 1992,knckhead, 0,        namcona2,  namcona2_joy,	knckhead, ROT0, "Namco", "Knuckle Heads (World)", GAME_IMPERFECT_SOUND )
diff -Nru src-old/mame/drivers/ninjakd2.c src/mame/drivers/ninjakd2.c
--- src-old/mame/drivers/ninjakd2.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/ninjakd2.c	2007-12-23 19:43:45.000000000 -0800
@@ -471,12 +471,12 @@
 static MACHINE_DRIVER_START( ninjakd2 )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(Z80, 12000000/2)		/* 12000000/2 ??? */
+	MDRV_CPU_ADD(Z80, 12000000/2)		/* 12000000/2 (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(ninjakd2_main_cpu,0)	/* very sensitive to these settings */
 	MDRV_CPU_VBLANK_INT(ninjakd2_interrupt,1)
 
 	MDRV_CPU_ADD(Z80, 5000000)
-	/* audio CPU */		/* 5mhz crystal ??? */
+	/* audio CPU */		/* 5mhz crystal (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(ninjakd2_sound_cpu,0)
 	MDRV_CPU_IO_MAP(ninjakd2_sound_io,0)
 
@@ -497,11 +497,11 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_ADD(YM2203, 1500000) /* verified on pcb */
 	MDRV_SOUND_CONFIG(ym2203_interface)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_ADD(YM2203, 1500000) /* verified on pcb */
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
 
 	MDRV_SOUND_ADD(SAMPLES, 0)
diff -Nru src-old/mame/drivers/nmk16.c src/mame/drivers/nmk16.c
--- src-old/mame/drivers/nmk16.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/nmk16.c	2007-12-23 20:03:00.000000000 -0800
@@ -16,8 +16,8 @@
 Thunder Dragon 2         1993 NMK        68000 Z80           YM2203 2xOKIM6295
 Rapid Hero               1994 NMK        68000 tmp90c841     YM2203 2xOKIM6295
 
-S.S. Mission             1992 Comad      68000 Z80           OKIM6295
-Air Attack               1996 Comad      68000 Z80           OKIM6295
+S.S. Mission             1992 Comad      68000 Z80           OKIM6295 (hack of Thunder Dragon)
+Air Attack               1996 Comad      68000 Z80           OKIM6295 (hack of Thunder Dragon)
 
 Mustang (bootleg)                        68000 Z80           YM3812 OKIM6295
 Thunder Dragon (bootleg)                 68000 Z80           YM3812 OKIM6295
@@ -124,6 +124,24 @@
 Z80 program (but the music is intact and recognizable).  See audio/seibu.c
 for more info on this.
 
+---
+
+Afega Games
+
+95 Twin Action                  this is a hack of Mustang with new graphics
+97 Red Hawk                     US Version of Stagger 1
+98 Sen Jin - Guardian Storm
+98 Stagger I
+
+98 Bubble 2000                  By Tuning, but it seems to be the same HW
+  / Hot Bubble
+
+00 Spectrum 2000                By YomaTech -- NOTE sprite bugs happen on real hw!!
+
+01 Fire Hawk                    By ESD with different sound hardware: 2 M6295,
+                                this doesn't have the glitches present in spec2k
+
+
 ********************************************************************/
 
 #include "driver.h"
@@ -136,9 +154,46 @@
 #include "cpu/pic16c5x/pic16c5x.h"
 
 
+/**********************************************************
+  Protection: Memory Scrambling
+
+  Several NMK and Afega games (notably the ones running at
+  the lower resolution) require strange handling of work
+  RAM when performing 8-bit writes.  This handling breaks
+  some of the later games if used, but is essential for
+  Mustang, Black Heart, Task Force Harrier, and the Afega
+  shooters to work correctly without ROM patches.  Tests
+  on the board would help verify this as correct.
+
+  I'm not sure if this is actually protection, or just
+  poor board design.
+
+**********************************************************/
+
+UINT16* nmk16_mainram;
+
+static WRITE16_HANDLER( nmk16_mainram_strange_w )
+{
+	UINT16* dstram;
+
+ 	dstram = nmk16_mainram;
+
+	if (!ACCESSING_MSB)
+	{
+		dstram[offset] = (data & 0x00ff) |  ((data & 0x00ff)<<8);
+ 	}
+	else if (!ACCESSING_LSB)
+	{
+		dstram[offset] = (data & 0xff00) |  ((data & 0xff00)>>8);
+	}
+	else
+  	{
+		dstram[offset] = data;
+	}
+}
+
 extern UINT16 *nmk_bgvideoram,*nmk_fgvideoram,*nmk_txvideoram;
 extern UINT16 *gunnail_scrollram;
-extern UINT16 tharrier_scroll;
 
 READ16_HANDLER( nmk_bgvideoram_r );
 WRITE16_HANDLER( nmk_bgvideoram_w );
@@ -178,6 +233,27 @@
 VIDEO_UPDATE( tdragon );
 VIDEO_EOF( nmk );
 
+/* Variables defined in video: */
+
+extern UINT16 *afega_vram_0, *afega_scroll_0;
+extern UINT16 *afega_vram_1, *afega_scroll_1;
+
+/* Functions defined in video: */
+
+WRITE16_HANDLER( afega_vram_0_w );
+WRITE16_HANDLER( afega_vram_1_w );
+//WRITE16_HANDLER( afega_palette_w );
+
+PALETTE_INIT( grdnstrm );
+
+VIDEO_START( afega );
+VIDEO_START( firehawk );
+VIDEO_UPDATE( afega );
+VIDEO_UPDATE( redhawkb );
+VIDEO_UPDATE( bubl2000 );
+VIDEO_UPDATE( firehawk );
+
+
 
 static MACHINE_RESET( nmk16 )
 {
@@ -215,23 +291,9 @@
 }
 
 
-static UINT16 *ram;
 
 
-static WRITE16_HANDLER( tharrier_shared_w )
-{
-	if(offset==0xf00/2)
-		COMBINE_DATA(&tharrier_scroll);
-	COMBINE_DATA(&ram[offset]);
-}
-
-static READ16_HANDLER( tharrier_shared_r )
-{
-	if (ACCESSING_MSB && ACCESSING_LSB && (offset==0  || offset==0x6c/2 ))
-		return (ram[offset]>>8)|(ram[offset]&0xff00);
 
-	return ram[offset];
-}
 
 static WRITE16_HANDLER( tharrier_mcu_control_w )
 {
@@ -252,8 +314,8 @@
 
 		int res;
 
-		if (activecpu_get_pc()==0x8aa) res = (ram[0x064/2])|0x20; /* Task Force Harrier */
-		else if (activecpu_get_pc()==0x8ce) res = (ram[0x064/2])|0x60; /* Task Force Harrier */
+		if (activecpu_get_pc()==0x8aa) res = (nmk16_mainram[0x9064/2])|0x20; /* Task Force Harrier */
+		else if (activecpu_get_pc()==0x8ce) res = (nmk16_mainram[0x9064/2])|0x60; /* Task Force Harrier */
 		else
 		{
 			res = to_main[prot_count++];
@@ -303,6 +365,15 @@
 		memcpy(rom + 0x20000,rom + 0x40000 + data * 0x20000,0x20000);
 }
 
+static WRITE16_HANDLER( afega_soundlatch_w )
+{
+	if (ACCESSING_LSB)
+	{
+		soundlatch_w(0,data&0xff);
+		cpunum_set_input_line(1, 0, HOLD_LINE);
+	}
+}
+
 /***************************************************************************/
 
 static ADDRESS_MAP_START( vandyke_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -315,9 +386,7 @@
 	AM_RANGE(0x088000, 0x0887ff) AM_READ(MRA16_RAM)
 	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09d000, 0x09d7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( vandyke_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -330,16 +399,8 @@
 	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x094000, 0x097fff) AM_WRITE(MWA16_RAM) /* what is this */
 	AM_RANGE(0x09d000, 0x09d7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM) /* not tested in tests .. hardly used probably some registers not ram */
 ADDRESS_MAP_END
 
-static READ16_HANDLER(logr)
-{
-//logerror("Read input port 1 %05x\n",activecpu_get_pc());
-return ~input_port_0_word_r(0,0);
-}
 
 static ADDRESS_MAP_START( manybloc_readmem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
@@ -351,9 +412,7 @@
 	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09c000, 0x09cfff) AM_READ(MRA16_RAM)
 	AM_RANGE(0x09d000, 0x09d7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( manybloc_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -367,9 +426,6 @@
 	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x09c000, 0x09cfff) AM_WRITE(manybloc_scroll_w) AM_BASE(&gunnail_scrollram)
 	AM_RANGE(0x09d000, 0x09d7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( tharrier_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -404,16 +460,16 @@
 
 static ADDRESS_MAP_START( tharrier_readmem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
-	AM_RANGE(0x080000, 0x080001) AM_READ(logr)//input_port_0_word_r },
+	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)
 	AM_RANGE(0x080002, 0x080003) AM_READ(tharrier_mcu_r) //input_port_1_word_r },
 	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)
 	AM_RANGE(0x08000e, 0x08000f) AM_READ(soundlatch2_word_r)	/* from Z80 */
+	AM_RANGE(0x080202, 0x080203) AM_READ(input_port_3_word_r )
+
 	AM_RANGE(0x088000, 0x0883ff) AM_READ(MRA16_RAM)
 	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09d000, 0x09d7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(tharrier_shared_r)//MRA16_RAM)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_WRITE(nmk16_mainram_strange_w) AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( tharrier_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -424,66 +480,78 @@
 //  AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
 	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(soundlatch_word_w)
 	AM_RANGE(0x088000, 0x0883ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
-	AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w)
+//  AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w)
 	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x09c000, 0x09c7ff) AM_WRITE(MWA16_NOP) /* Unused txvideoram area? */
 	AM_RANGE(0x09d000, 0x09d7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(tharrier_shared_w) AM_BASE(&ram)	/* Work RAM again (fe000-fefff is shared with the sound CPU) */
 ADDRESS_MAP_END
 
 //Read input port 1 030c8/  BAD
 //3478  GOOD
 
-static ADDRESS_MAP_START( mustang_readmem, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
+static ADDRESS_MAP_START( mustang_map, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x000000, 0x03ffff) AM_ROM
 	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)
 	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)
 	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)
-	AM_RANGE(0x08000e, 0x08000f) AM_READ(NMK004_r)
-//  AM_RANGE(0x08000e, 0x08000f) AM_READ(soundlatch2_word_r)    /* from Z80 bootleg only? */
-	AM_RANGE(0x088000, 0x0887ff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
-	AM_RANGE(0x09c000, 0x09c7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
-ADDRESS_MAP_END
-
-static ADDRESS_MAP_START( mustang_writemem, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
-	AM_RANGE(0x08000e, 0x08000f) AM_WRITE(MWA16_NOP)
+	AM_RANGE(0x08000e, 0x08000f) AM_READWRITE(NMK004_r, MWA16_NOP)
 	AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
 	AM_RANGE(0x080016, 0x080017) AM_WRITE(MWA16_NOP)	// frame number?
 	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(NMK004_w)
-	AM_RANGE(0x088000, 0x0887ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
+	AM_RANGE(0x088000, 0x0887ff) AM_RAM AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
 	AM_RANGE(0x08c000, 0x08c001) AM_WRITE(mustang_scroll_w)
 	AM_RANGE(0x08c002, 0x08c087) AM_WRITE(MWA16_NOP)	// ??
-	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
-	AM_RANGE(0x09c000, 0x09c7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)	/* Work RAM */
+	AM_RANGE(0x090000, 0x093fff) AM_RAM AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
+	AM_RANGE(0x09c000, 0x09c7ff) AM_RAM AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_WRITE(nmk16_mainram_strange_w) AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
-static ADDRESS_MAP_START( mustangb_writemem, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
+static ADDRESS_MAP_START( mustangb_map, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x000000, 0x03ffff) AM_ROM
+	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)
+	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)
+	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)
+	AM_RANGE(0x08000e, 0x08000f) AM_READWRITE(MRA16_NOP, MWA16_NOP)
 	AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
 	AM_RANGE(0x080016, 0x080017) AM_WRITE(MWA16_NOP)	// frame number?
 	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(seibu_main_mustb_w)
-	AM_RANGE(0x088000, 0x0887ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
+	AM_RANGE(0x088000, 0x0887ff) AM_RAM AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
 	AM_RANGE(0x08c000, 0x08c001) AM_WRITE(mustang_scroll_w)
-	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
-	AM_RANGE(0x09c000, 0x09c7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)	/* Work RAM */
+	AM_RANGE(0x08c002, 0x08c087) AM_WRITE(MWA16_NOP)	// ??
+	AM_RANGE(0x090000, 0x093fff) AM_RAM AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
+	AM_RANGE(0x09c000, 0x09c7ff) AM_RAM AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_WRITE(nmk16_mainram_strange_w) AM_BASE(&nmk16_mainram)
+ADDRESS_MAP_END
+
+
+static ADDRESS_MAP_START( twinactn_map, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x000000, 0x03ffff) AM_ROM
+	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)
+	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)
+	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)
+	AM_RANGE(0x08000e, 0x08000f) AM_READWRITE(MRA16_NOP, MWA16_NOP)
+	AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
+	AM_RANGE(0x080016, 0x080017) AM_WRITE(MWA16_NOP)	// frame number?
+	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(afega_soundlatch_w)
+	AM_RANGE(0x088000, 0x0887ff) AM_RAM AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
+	AM_RANGE(0x08c000, 0x08c001) AM_WRITE(mustang_scroll_w)
+	AM_RANGE(0x08c002, 0x08c087) AM_WRITE(MWA16_NOP)	// ??
+	AM_RANGE(0x090000, 0x093fff) AM_RAM AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
+	AM_RANGE(0x09c000, 0x09c7ff) AM_RAM AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_WRITE(nmk16_mainram_strange_w) AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
+
+
+
+
+
+
 static ADDRESS_MAP_START( acrobatm_readmem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x00000, 0x3ffff) AM_READ(MRA16_ROM)
-	AM_RANGE(0x80000, 0x8ffff) AM_READ(MRA16_RAM)
+
+	AM_RANGE(0x80000, 0x8ffff) AM_RAM AM_BASE(&nmk16_mainram)
+
 	AM_RANGE(0xc0000, 0xc0001) AM_READ(input_port_0_word_r)
 	AM_RANGE(0xc0002, 0xc0003) AM_READ(input_port_1_word_r)
 	AM_RANGE(0xc0008, 0xc0009) AM_READ(input_port_2_word_r)
@@ -496,8 +564,6 @@
 
 static ADDRESS_MAP_START( acrobatm_writemem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x00000, 0x3ffff) AM_WRITE(MWA16_ROM)
-	AM_RANGE(0x88000, 0x88fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x80000, 0x8ffff) AM_WRITE(MWA16_RAM)
 	AM_RANGE(0xc0014, 0xc0015) AM_WRITE(nmk_flipscreen_w)
 	AM_RANGE(0xc0016, 0xc0017) AM_WRITENOP
 	AM_RANGE(0xc0018, 0xc0019) AM_WRITE(nmk_tilebank_w)
@@ -518,9 +584,7 @@
 	AM_RANGE(0x088000, 0x0887ff) AM_READ(MRA16_RAM)
 	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09c000, 0x09c7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( bioship_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -533,9 +597,6 @@
 	AM_RANGE(0x08c010, 0x08c017) AM_WRITE(bioship_scroll_w)
 	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x09c000, 0x09c7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM)	/* Work RAM again (fe000-fefff is shared with the sound CPU) */
 ADDRESS_MAP_END
 
 /******************************************************************************************
@@ -554,29 +615,29 @@
 
 ******************************************************************************************/
 
-UINT16 *nmk16_mcu_shared_ram;
-UINT16 *nmk16_mcu_work_ram;
 
 #define PROT_JSR(_offs_,_protvalue_,_pc_) \
-	if(nmk16_mcu_shared_ram[(_offs_)/2] == _protvalue_) \
+	if(nmk16_mainram[(_offs_)/2] == _protvalue_) \
 	{ \
-		nmk16_mcu_shared_ram[(_offs_)/2] = 0xffff;  /*(MCU job done)*/ \
-		nmk16_mcu_shared_ram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
-		nmk16_mcu_shared_ram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
-		nmk16_mcu_shared_ram[(_offs_+6-0x10)/2] = _pc_;  /*LO-DWORD*/\
+		nmk16_mainram[(_offs_)/2] = 0xffff;  /*(MCU job done)*/ \
+		nmk16_mainram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
+		nmk16_mainram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
+		nmk16_mainram[(_offs_+6-0x10)/2] = _pc_;  /*LO-DWORD*/\
 	} \
 
 #define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \
-	if(nmk16_mcu_shared_ram[_offs_] == _protvalue_) \
+	if(nmk16_mainram[_offs_] == _protvalue_) \
 	{\
-		nmk16_mcu_shared_ram[_protinput_] = ((_input_ & 0xffff0000)>>16);\
-		nmk16_mcu_shared_ram[_protinput_+1] = (_input_ & 0x0000ffff);\
+		nmk16_mainram[_protinput_] = ((_input_ & 0xffff0000)>>16);\
+		nmk16_mainram[_protinput_+1] = (_input_ & 0x0000ffff);\
 	}
 
+/*
 static READ16_HANDLER( mcu_shared_r )
 {
-	return nmk16_mcu_shared_ram[offset];
+    return nmk16_mcu_shared_ram[offset];
 }
+*/
 
 //td     - hmf
 //008D9E - 00796e
@@ -642,158 +703,151 @@
 
 */
 
-static WRITE16_HANDLER( hachamf_mcu_shared_w )
+static WRITE16_HANDLER( hachamf_mainram_w )
 {
-	COMBINE_DATA(&nmk16_mcu_shared_ram[offset]);
+	COMBINE_DATA(&nmk16_mainram[offset]);
 
 	switch(offset)
 	{
-		case 0x058/2: PROT_INPUT(0x058/2,0xc71f,0x000/2,0x00080000); break;
-		case 0x182/2: PROT_INPUT(0x182/2,0x865d,0x004/2,0x00080002); break;
-		case 0x51e/2: PROT_INPUT(0x51e/2,0x0f82,0x008/2,0x00080008); break;
-		case 0x6b4/2: PROT_INPUT(0x6b4/2,0x79be,0x00c/2,0x0008000a); break;
-		case 0x10e/2: PROT_JSR(0x10e,0x8007,0x870a);//870a not 9d66
-					  PROT_JSR(0x10e,0x8000,0xd9c6); break;
-		case 0x11e/2: PROT_JSR(0x11e,0x8038,0x972a);//972a
-					  PROT_JSR(0x11e,0x8031,0xd1f8); break;
-		case 0x12e/2: PROT_JSR(0x12e,0x8019,0x9642);//OK-9642
-					  PROT_JSR(0x12e,0x8022,0xda06); break;
-		case 0x13e/2: PROT_JSR(0x13e,0x802a,0x9d66);//9d66 not 9400 - OK
-					  PROT_JSR(0x13e,0x8013,0x81aa); break;
-		case 0x14e/2: PROT_JSR(0x14e,0x800b,0xb3f2);//b3f2 - OK
-					  PROT_JSR(0x14e,0x8004,0x8994); break;
-		case 0x15e/2: PROT_JSR(0x15e,0x803c,0xb59e);//b59e - OK
-					  PROT_JSR(0x15e,0x8035,0x8d0c); break;
-		case 0x16e/2: PROT_JSR(0x16e,0x801d,0x9ac2);//9ac2 - OK
-				 	  PROT_JSR(0x16e,0x8026,0x8c36); break;
-		case 0x17e/2: PROT_JSR(0x17e,0x802e,0xc366);//c366 - OK
-					  PROT_JSR(0x17e,0x8017,0x870a); break;
-		case 0x18e/2: PROT_JSR(0x18e,0x8004,0xd620);        //unused
-					  PROT_JSR(0x18e,0x8008,0x972a); break; //unused
-		case 0x19e/2: PROT_JSR(0x19e,0x8030,0xd9c6);//OK-d9c6
-					  PROT_JSR(0x19e,0x8039,0x9642); break;
-		case 0x1ae/2: PROT_JSR(0x1ae,0x8011,0xd1f8);//d1f8 not c67e
-					  PROT_JSR(0x1ae,0x802a,0x9d66); break;
-		case 0x1be/2: PROT_JSR(0x1be,0x8022,0xda06);//da06
-					  PROT_JSR(0x1be,0x801b,0xb3f2); break;
-		case 0x1ce/2: PROT_JSR(0x1ce,0x8003,0x81aa);//81aa
-					  PROT_JSR(0x1ce,0x800c,0xb59e); break;
-		case 0x1de/2: PROT_JSR(0x1de,0x8034,0x8994);//8994 - OK
-					  PROT_JSR(0x1de,0x803d,0x9ac2); break;
-		case 0x1ee/2: PROT_JSR(0x1ee,0x8015,0x8d0c);//8d0c not 82f6
-					  PROT_JSR(0x1ee,0x802e,0xc366); break;
-		case 0x1fe/2: PROT_JSR(0x1fe,0x8026,0x8c36);//8c36
-					  PROT_JSR(0x1fe,0x8016,0xd620); break;  //unused
-		case 0xf00/2:
-			if(nmk16_mcu_shared_ram[0xf00/2] == 0x60fe)
+		case 0xe058/2: PROT_INPUT(0xe058/2,0xc71f,0xe000/2,0x00080000); break;
+		case 0xe182/2: PROT_INPUT(0xe182/2,0x865d,0xe004/2,0x00080002); break;
+		case 0xe51e/2: PROT_INPUT(0xe51e/2,0x0f82,0xe008/2,0x00080008); break;
+		case 0xe6b4/2: PROT_INPUT(0xe6b4/2,0x79be,0xe00c/2,0x0008000a); break;
+		case 0xe10e/2: PROT_JSR(0xe10e,0x8007,0x870a);//870a not 9d66
+					  PROT_JSR(0xe10e,0x8000,0xd9c6); break;
+		case 0xe11e/2: PROT_JSR(0xe11e,0x8038,0x972a);//972a
+					  PROT_JSR(0xe11e,0x8031,0xd1f8); break;
+		case 0xe12e/2: PROT_JSR(0xe12e,0x8019,0x9642);//OK-9642
+					  PROT_JSR(0xe12e,0x8022,0xda06); break;
+		case 0xe13e/2: PROT_JSR(0xe13e,0x802a,0x9d66);//9d66 not 9400 - OK
+					  PROT_JSR(0xe13e,0x8013,0x81aa); break;
+		case 0xe14e/2: PROT_JSR(0xe14e,0x800b,0xb3f2);//b3f2 - OK
+					  PROT_JSR(0xe14e,0x8004,0x8994); break;
+		case 0xe15e/2: PROT_JSR(0xe15e,0x803c,0xb59e);//b59e - OK
+					  PROT_JSR(0xe15e,0x8035,0x8d0c); break;
+		case 0xe16e/2: PROT_JSR(0xe16e,0x801d,0x9ac2);//9ac2 - OK
+				 	  PROT_JSR(0xe16e,0x8026,0x8c36); break;
+		case 0xe17e/2: PROT_JSR(0xe17e,0x802e,0xc366);//c366 - OK
+					  PROT_JSR(0xe17e,0x8017,0x870a); break;
+		case 0xe18e/2: PROT_JSR(0xe18e,0x8004,0xd620);        //unused
+					  PROT_JSR(0xe18e,0x8008,0x972a); break; //unused
+		case 0xe19e/2: PROT_JSR(0xe19e,0x8030,0xd9c6);//OK-d9c6
+					  PROT_JSR(0xe19e,0x8039,0x9642); break;
+		case 0xe1ae/2: PROT_JSR(0xe1ae,0x8011,0xd1f8);//d1f8 not c67e
+					  PROT_JSR(0xe1ae,0x802a,0x9d66); break;
+		case 0xe1be/2: PROT_JSR(0xe1be,0x8022,0xda06);//da06
+					  PROT_JSR(0xe1be,0x801b,0xb3f2); break;
+		case 0xe1ce/2: PROT_JSR(0xe1ce,0x8003,0x81aa);//81aa
+					  PROT_JSR(0xe1ce,0x800c,0xb59e); break;
+		case 0xe1de/2: PROT_JSR(0xe1de,0x8034,0x8994);//8994 - OK
+					  PROT_JSR(0xe1de,0x803d,0x9ac2); break;
+		case 0xe1ee/2: PROT_JSR(0xe1ee,0x8015,0x8d0c);//8d0c not 82f6
+					  PROT_JSR(0xe1ee,0x802e,0xc366); break;
+		case 0xe1fe/2: PROT_JSR(0xe1fe,0x8026,0x8c36);//8c36
+					  PROT_JSR(0xe1fe,0x8016,0xd620); break;  //unused
+		case 0xef00/2:
+			if(nmk16_mainram[0xef00/2] == 0x60fe)
 			{
-				nmk16_mcu_shared_ram[0xf00/2] = 0x0000; //this is the coin counter
-				nmk16_mcu_shared_ram[0xf02/2] = 0x0000;
-				nmk16_mcu_shared_ram[0xf04/2] = 0x4ef9;
-				nmk16_mcu_shared_ram[0xf06/2] = 0x0000;
-				nmk16_mcu_shared_ram[0xf08/2] = 0x7dc2;
+				nmk16_mainram[0xef00/2] = 0x0000; //this is the coin counter
+				nmk16_mainram[0xef02/2] = 0x0000;
+				nmk16_mainram[0xef04/2] = 0x4ef9;
+				nmk16_mainram[0xef06/2] = 0x0000;
+				nmk16_mainram[0xef08/2] = 0x7dc2;
 			}
 			break;
 	}
 }
 
-static ADDRESS_MAP_START( hachamf_readmem, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
+
+static ADDRESS_MAP_START( hachamf_map, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x000000, 0x03ffff) AM_ROM
+	/* I/O Region */
 	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)
 	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)
 	AM_RANGE(0x080008, 0x080009) AM_READ(input_port_2_word_r)
 	AM_RANGE(0x08000a, 0x08000b) AM_READ(input_port_3_word_r)
 	AM_RANGE(0x08000e, 0x08000f) AM_READ(NMK004_r)
-	AM_RANGE(0x088000, 0x0887ff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
-	AM_RANGE(0x09c000, 0x09c7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	//AM_RANGE(0x0fe000, 0x0fe00b) AM_READ(hachamf_protection_hack_r)
-	AM_RANGE(0x0f9000, 0x0fdfff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0fe000, 0x0fefff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0ff000, 0x0fffff) AM_READ(MRA16_RAM)
-ADDRESS_MAP_END
-
-static ADDRESS_MAP_START( hachamf_writemem, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
 	AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
 	AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
 	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(NMK004_w)
-	AM_RANGE(0x088000, 0x0887ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
+	/* Video Region */
+	AM_RANGE(0x088000, 0x0887ff) AM_RAM AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
 	AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w)
-	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
-	AM_RANGE(0x09c000, 0x09c7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fdfff) AM_WRITE(MWA16_RAM) AM_BASE(&nmk16_mcu_work_ram) /* Work RAM */
-	AM_RANGE(0x0fe000, 0x0fefff) AM_RAM AM_READWRITE(mcu_shared_r,hachamf_mcu_shared_w) AM_BASE(&nmk16_mcu_shared_ram)	/* Work RAM */
-	AM_RANGE(0x0ff000, 0x0fffff) AM_WRITE(MWA16_RAM) /* Work RAM */
+	AM_RANGE(0x090000, 0x093fff) AM_RAM AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
+	AM_RANGE(0x09c000, 0x09c7ff) AM_RAM AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
+	/* Main RAM, inc sprites, shared with MCU */
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_WRITE(hachamf_mainram_w) AM_BASE(&nmk16_mainram) // ram is shared with MCU
 ADDRESS_MAP_END
 
-static WRITE16_HANDLER( tdragon_mcu_shared_w )
+
+
+static WRITE16_HANDLER( tdragon_mainram_w )
 {
-	COMBINE_DATA(&nmk16_mcu_shared_ram[offset]);
+	COMBINE_DATA(&nmk16_mainram[offset]);
 
 	switch(offset)
 	{
-		case 0x066/2: PROT_INPUT(0x066/2,0xe23e,0x000/2,0x000c0000); break;
-		case 0x144/2: PROT_INPUT(0x144/2,0xf54d,0x004/2,0x000c0002); break;
-		case 0x60e/2: PROT_INPUT(0x60e/2,0x067c,0x008/2,0x000c0008); break;
-		case 0x714/2: PROT_INPUT(0x714/2,0x198b,0x00c/2,0x000c000a); break;
-		case 0x70e/2: PROT_JSR(0x70e,0x8007,0x9e22);
-					  PROT_JSR(0x70e,0x8000,0xd518); break;
-		case 0x71e/2: PROT_JSR(0x71e,0x8038,0xaa0a);
-					  PROT_JSR(0x71e,0x8031,0x8e7c); break;
-		case 0x72e/2: PROT_JSR(0x72e,0x8019,0xac48);
-					  PROT_JSR(0x72e,0x8022,0xd558); break;
-		case 0x73e/2: PROT_JSR(0x73e,0x802a,0xb110);
-					  PROT_JSR(0x73e,0x8013,0x96da); break;
-		case 0x74e/2: PROT_JSR(0x74e,0x800b,0xb9b2);
-					  PROT_JSR(0x74e,0x8004,0xa062); break;
-		case 0x75e/2: PROT_JSR(0x75e,0x803c,0xbb4c);
-					  PROT_JSR(0x75e,0x8035,0xa154); break;
-		case 0x76e/2: PROT_JSR(0x76e,0x801d,0xafa6);
-				 	  PROT_JSR(0x76e,0x8026,0xa57a); break;
-		case 0x77e/2: PROT_JSR(0x77e,0x802e,0xc6a4);
-					  PROT_JSR(0x77e,0x8017,0x9e22); break;
-		case 0x78e/2: PROT_JSR(0x78e,0x8004,0xaa0a);
-					  PROT_JSR(0x78e,0x8008,0xaa0a); break;
-		case 0x79e/2: PROT_JSR(0x79e,0x8030,0xd518);
-					  PROT_JSR(0x79e,0x8039,0xac48); break;
-		case 0x7ae/2: PROT_JSR(0x7ae,0x8011,0x8e7c);
-					  PROT_JSR(0x7ae,0x802a,0xb110); break;
-		case 0x7be/2: PROT_JSR(0x7be,0x8022,0xd558);
-					  PROT_JSR(0x7be,0x801b,0xb9b2); break;
-		case 0x7ce/2: PROT_JSR(0x7ce,0x8003,0x96da);
-					  PROT_JSR(0x7ce,0x800c,0xbb4c); break;
-		case 0x7de/2: PROT_JSR(0x7de,0x8034,0xa062);
-					  PROT_JSR(0x7de,0x803d,0xafa6); break;
-		case 0x7ee/2: PROT_JSR(0x7ee,0x8015,0xa154);
-					  PROT_JSR(0x7ee,0x802e,0xc6a4); break;
-		case 0x7fe/2: PROT_JSR(0x7fe,0x8026,0xa57a);
-					  PROT_JSR(0x7fe,0x8016,0xa57a); break;
-		case 0xf00/2:
-			if(nmk16_mcu_shared_ram[0xf00/2] == 0x60fe)
+		case 0xe066/2: PROT_INPUT(0xe066/2,0xe23e,0xe000/2,0x000c0000); break;
+		case 0xe144/2: PROT_INPUT(0xe144/2,0xf54d,0xe004/2,0x000c0002); break;
+		case 0xe60e/2: PROT_INPUT(0xe60e/2,0x067c,0xe008/2,0x000c0008); break;
+		case 0xe714/2: PROT_INPUT(0xe714/2,0x198b,0xe00c/2,0x000c000a); break;
+		case 0xe70e/2: PROT_JSR(0xe70e,0x8007,0x9e22);
+					  PROT_JSR(0xe70e,0x8000,0xd518); break;
+		case 0xe71e/2: PROT_JSR(0xe71e,0x8038,0xaa0a);
+					  PROT_JSR(0xe71e,0x8031,0x8e7c); break;
+		case 0xe72e/2: PROT_JSR(0xe72e,0x8019,0xac48);
+					  PROT_JSR(0xe72e,0x8022,0xd558); break;
+		case 0xe73e/2: PROT_JSR(0xe73e,0x802a,0xb110);
+					  PROT_JSR(0xe73e,0x8013,0x96da); break;
+		case 0xe74e/2: PROT_JSR(0xe74e,0x800b,0xb9b2);
+					  PROT_JSR(0xe74e,0x8004,0xa062); break;
+		case 0xe75e/2: PROT_JSR(0xe75e,0x803c,0xbb4c);
+					  PROT_JSR(0xe75e,0x8035,0xa154); break;
+		case 0xe76e/2: PROT_JSR(0xe76e,0x801d,0xafa6);
+				 	  PROT_JSR(0xe76e,0x8026,0xa57a); break;
+		case 0xe77e/2: PROT_JSR(0xe77e,0x802e,0xc6a4);
+					  PROT_JSR(0xe77e,0x8017,0x9e22); break;
+		case 0xe78e/2: PROT_JSR(0xe78e,0x8004,0xaa0a);
+					  PROT_JSR(0xe78e,0x8008,0xaa0a); break;
+		case 0xe79e/2: PROT_JSR(0xe79e,0x8030,0xd518);
+					  PROT_JSR(0xe79e,0x8039,0xac48); break;
+		case 0xe7ae/2: PROT_JSR(0xe7ae,0x8011,0x8e7c);
+					  PROT_JSR(0xe7ae,0x802a,0xb110); break;
+		case 0xe7be/2: PROT_JSR(0xe7be,0x8022,0xd558);
+					  PROT_JSR(0xe7be,0x801b,0xb9b2); break;
+		case 0xe7ce/2: PROT_JSR(0xe7ce,0x8003,0x96da);
+					  PROT_JSR(0xe7ce,0x800c,0xbb4c); break;
+		case 0xe7de/2: PROT_JSR(0xe7de,0x8034,0xa062);
+					  PROT_JSR(0xe7de,0x803d,0xafa6); break;
+		case 0xe7ee/2: PROT_JSR(0xe7ee,0x8015,0xa154);
+					  PROT_JSR(0xe7ee,0x802e,0xc6a4); break;
+		case 0xe7fe/2: PROT_JSR(0xe7fe,0x8026,0xa57a);
+					  PROT_JSR(0xe7fe,0x8016,0xa57a); break;
+		case 0xef00/2:
+			if(nmk16_mainram[0xef00/2] == 0x60fe)
 			{
-				nmk16_mcu_shared_ram[0xf00/2] = 0x0000; //this is the coin counter
-				nmk16_mcu_shared_ram[0xf02/2] = 0x0000;
-				nmk16_mcu_shared_ram[0xf04/2] = 0x4ef9;
-				nmk16_mcu_shared_ram[0xf06/2] = 0x0000;
-				nmk16_mcu_shared_ram[0xf08/2] = 0x92f4;
+				nmk16_mainram[0xef00/2] = 0x0000; //this is the coin counter
+				nmk16_mainram[0xef02/2] = 0x0000;
+				nmk16_mainram[0xef04/2] = 0x4ef9;
+				nmk16_mainram[0xef06/2] = 0x0000;
+				nmk16_mainram[0xef08/2] = 0x92f4;
 			}
 			break;
 	}
 }
 
+
 static ADDRESS_MAP_START( tdragon_readmem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
 	AM_RANGE(0x044022, 0x044023) AM_READ(MRA16_NOP)  /* No Idea */
-	AM_RANGE(0x0b0000, 0x0b7fff) AM_READ(MRA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0b8000, 0x0b8fff) AM_READ(MRA16_RAM)	/* Sprite RAM */
-	AM_RANGE(0x0b9000, 0x0bdfff) AM_READ(MRA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0be000, 0x0befff) AM_READ(MRA16_RAM) /* Work RAM */
-	AM_RANGE(0x0bf000, 0x0bffff) AM_READ(MRA16_RAM)	/* Work RAM */
+//  AM_RANGE(0x0b0000, 0x0b7fff) AM_READ(MRA16_RAM) /* Work RAM */
+//  AM_RANGE(0x0b8000, 0x0b8fff) AM_READ(MRA16_RAM) /* Sprite RAM */
+//  AM_RANGE(0x0b9000, 0x0bdfff) AM_READ(MRA16_RAM) /* Work RAM */
+//  AM_RANGE(0x0be000, 0x0befff) AM_READ(MRA16_RAM) /* Work RAM */
+//  AM_RANGE(0x0bf000, 0x0bffff) AM_READ(MRA16_RAM) /* Work RAM */
+	AM_RANGE(0x0b0000, 0x0bffff) AM_RAM AM_WRITE( tdragon_mainram_w ) AM_BASE(&nmk16_mainram)
+
+
 	AM_RANGE(0x0c8000, 0x0c87ff) AM_READ(MRA16_RAM)  /* Palette RAM */
 	AM_RANGE(0x0c0000, 0x0c0001) AM_READ(input_port_0_word_r)
 	AM_RANGE(0x0c0002, 0x0c0003) AM_READ(input_port_1_word_r)
@@ -806,11 +860,11 @@
 
 static ADDRESS_MAP_START( tdragon_writemem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
-	AM_RANGE(0x0b0000, 0x0b7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0b8000, 0x0b8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)	/* Sprite RAM */
-	AM_RANGE(0x0b9000, 0x0bdfff) AM_WRITE(MWA16_RAM) AM_BASE(&nmk16_mcu_work_ram)	/* Work RAM */
-	AM_RANGE(0x0be000, 0x0befff) AM_RAM AM_READWRITE(mcu_shared_r,tdragon_mcu_shared_w) AM_BASE(&nmk16_mcu_shared_ram)	/* Work RAM */
-	AM_RANGE(0x0bf000, 0x0bffff) AM_WRITE(MWA16_RAM)	/* Work RAM */
+//  AM_RANGE(0x0b0000, 0x0b7fff) AM_WRITE(MWA16_RAM)    /* Work RAM */
+//  AM_RANGE(0x0b8000, 0x0b8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Sprite RAM */
+//  AM_RANGE(0x0b9000, 0x0bdfff) AM_WRITE(MWA16_RAM) AM_BASE(&nmk16_mcu_work_ram)   /* Work RAM */
+//  AM_RANGE(0x0be000, 0x0befff) AM_RAM AM_READWRITE(mcu_shared_r,tdragon_mcu_shared_w) AM_BASE(&nmk16_mcu_shared_ram)  /* Work RAM */
+//  AM_RANGE(0x0bf000, 0x0bffff) AM_WRITE(MWA16_RAM)    /* Work RAM */
 	AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(nmk_flipscreen_w) /* Maybe */
 	AM_RANGE(0x0c0018, 0x0c0019) AM_WRITE(nmk_tilebank_w) /* Tile Bank ? */
 	AM_RANGE(0x0c001e, 0x0c001f) AM_WRITE(NMK004_w)
@@ -822,9 +876,7 @@
 
 static ADDRESS_MAP_START( tdragonb_writemem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
-	AM_RANGE(0x0b0000, 0x0b7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0b8000, 0x0b8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)	/* Sprite RAM */
-	AM_RANGE(0x0b9000, 0x0bffff) AM_WRITE(MWA16_RAM)	/* Work RAM */
+	AM_RANGE(0x0b0000, 0x0bffff) AM_RAM AM_BASE(&nmk16_mainram)
 	AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(nmk_flipscreen_w) /* Maybe */
 	AM_RANGE(0x0c0018, 0x0c0019) AM_WRITE(nmk_tilebank_w) /* Tile Bank ? */
 	AM_RANGE(0x0c001e, 0x0c001f) AM_WRITE(seibu_main_mustb_w)
@@ -836,9 +888,7 @@
 
 static ADDRESS_MAP_START( ssmissin_readmem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
-	AM_RANGE(0x0b0000, 0x0b7fff) AM_READ(MRA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0b8000, 0x0b8fff) AM_READ(MRA16_RAM)	/* Sprite RAM */
-	AM_RANGE(0x0b9000, 0x0bffff) AM_READ(MRA16_RAM)	/* Work RAM */
+	AM_RANGE(0x0b0000, 0x0bffff) AM_RAM AM_BASE(&nmk16_mainram)
 	AM_RANGE(0x0c8000, 0x0c87ff) AM_READ(MRA16_RAM)  /* Palette RAM */
 	AM_RANGE(0x0c0000, 0x0c0001) AM_READ(input_port_0_word_r)
 	AM_RANGE(0x0c0004, 0x0c0005) AM_READ(input_port_1_word_r)
@@ -852,9 +902,6 @@
 
 static ADDRESS_MAP_START( ssmissin_writemem, ADDRESS_SPACE_PROGRAM, 16 )
 	AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
-	AM_RANGE(0x0b0000, 0x0b7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0b8000, 0x0b8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)	/* Sprite RAM */
-	AM_RANGE(0x0b9000, 0x0bffff) AM_WRITE(MWA16_RAM)	/* Work RAM */
 	AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(nmk_flipscreen_w) /* Maybe */
 	AM_RANGE(0x0c0018, 0x0c0019) AM_WRITE(nmk_tilebank_w) /* Tile Bank ? */
 	AM_RANGE(0x0c001e, 0x0c001f) AM_WRITE(ssmissin_sound_w)
@@ -894,9 +941,7 @@
 	AM_RANGE(0x90000, 0x93fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x94000, 0x97fff) AM_READ(nmk_fgvideoram_r)
 	AM_RANGE(0x9c000, 0x9c7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0xf0000, 0xf7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0xf8000, 0xfefff) AM_READ(MRA16_RAM)
-	AM_RANGE(0xff000, 0xfffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0xf0000, 0xfffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( strahl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -910,9 +955,6 @@
 	AM_RANGE(0x90000, 0x93fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x94000, 0x97fff) AM_WRITE(nmk_fgvideoram_w) AM_BASE(&nmk_fgvideoram)
 	AM_RANGE(0x9c000, 0x9c7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0xf0000, 0xf7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0xf8000, 0xfefff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)	/* Work RAM again */
-	AM_RANGE(0xff000, 0xfffff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( macross_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -925,9 +967,7 @@
 	AM_RANGE(0x088000, 0x0887ff) AM_READ(MRA16_RAM)
 	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09c000, 0x09c7ff) AM_READ(nmk_txvideoram_r)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_WRITE(nmk16_mainram_strange_w) AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( macross_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -940,9 +980,6 @@
 	AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w)
 	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x09c000, 0x09c7ff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)	/* Work RAM again */
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( gunnail_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -956,9 +993,7 @@
 	AM_RANGE(0x090000, 0x093fff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09c000, 0x09cfff) AM_READ(nmk_txvideoram_r)
 	AM_RANGE(0x09d000, 0x09dfff) AM_READ(nmk_txvideoram_r)	/* mirror */
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( gunnail_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -974,9 +1009,6 @@
 	AM_RANGE(0x090000, 0x093fff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x09c000, 0x09cfff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
 	AM_RANGE(0x09d000, 0x09dfff) AM_WRITE(nmk_txvideoram_w)	/* mirror */
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram) /* Work RAM again */
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( macross2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -990,9 +1022,7 @@
 	AM_RANGE(0x140000, 0x14ffff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x170000, 0x170fff) AM_READ(nmk_txvideoram_r)
 	AM_RANGE(0x171000, 0x171fff) AM_READ(nmk_txvideoram_r)	/* mirror */
-	AM_RANGE(0x1f0000, 0x1f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x1f8000, 0x1f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x1f9000, 0x1fffff) AM_READ(MRA16_RAM)
+	AM_RANGE(0x1f0000, 0x1fffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( macross2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1007,9 +1037,6 @@
 	AM_RANGE(0x140000, 0x14ffff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x170000, 0x170fff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
 	AM_RANGE(0x171000, 0x171fff) AM_WRITE(nmk_txvideoram_w)	/* mirror */
-	AM_RANGE(0x1f0000, 0x1f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x1f8000, 0x1f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x1f9000, 0x1fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)	/* Work RAM again */
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( raphero_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1023,9 +1050,6 @@
 	AM_RANGE(0x140000, 0x14ffff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x170000, 0x170fff) AM_WRITE(nmk_txvideoram_w) AM_BASE(&nmk_txvideoram)
 	AM_RANGE(0x171000, 0x171fff) AM_WRITE(nmk_txvideoram_w)	/* mirror */
-	AM_RANGE(0x1f0000, 0x1f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x1f8000, 0x1f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x1f9000, 0x1fffff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)	/* Work RAM again */
 ADDRESS_MAP_END
 
 #if 0
@@ -1105,9 +1129,6 @@
 	AM_RANGE(0x088000, 0x0887ff) AM_READ(MRA16_RAM)
 	AM_RANGE(0x09c000, 0x09cfff) AM_READ(nmk_bgvideoram_r)
 	AM_RANGE(0x09d000, 0x09dfff) AM_READ(nmk_bgvideoram_r)	/* mirror */
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_READ(MRA16_RAM)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_READ(MRA16_RAM)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( bjtwin_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1121,9 +1142,7 @@
 	AM_RANGE(0x094002, 0x094003) AM_WRITE(MWA16_NOP)	/* IRQ enable? */
 	AM_RANGE(0x09c000, 0x09cfff) AM_WRITE(nmk_bgvideoram_w) AM_BASE(&nmk_bgvideoram)
 	AM_RANGE(0x09d000, 0x09dfff) AM_WRITE(nmk_bgvideoram_w)	/* mirror */
-	AM_RANGE(0x0f0000, 0x0f7fff) AM_WRITE(MWA16_RAM)	/* Work RAM */
-	AM_RANGE(0x0f8000, 0x0f8fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
-	AM_RANGE(0x0f9000, 0x0fffff) AM_WRITE(MWA16_RAM)	/* Work RAM again */
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_BASE(&nmk16_mainram)
 ADDRESS_MAP_END
 
 
@@ -1354,42 +1373,42 @@
 	PORT_DIPSETTING(      0x8000, "Best" )
 INPUT_PORTS_END
 
+/**********************************************************
+  Input Ports: Task Force Harrier
+
+  this is a little strange compared to the other games, the
+  protection might be more involved here than it first
+  appears, however, this works.
+**********************************************************/
+
+
 static INPUT_PORTS_START( tharrier )
 	PORT_START		/* IN0 */
-	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
-	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
-	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
-	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
-	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
-	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
-	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
-	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
-	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT  ) PORT_8WAY
-	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_8WAY
-	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY
-	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_8WAY
-	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Mcu status? */
+	PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_COIN1 )
+	PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_COIN2 )
+	PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SERVICE1 )
+	PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START1 )
+	PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_START2 )
+	PORT_BIT( 0x7fe0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* Mcu status? */
 
 	PORT_START      /* IN1 */
-	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1)//IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
-	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2)//IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
-	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
-	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
-	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN) //IPT_COIN1 )
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1)
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2) //title
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN)
 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN2 )
-	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 )//COIN ? SERVICE ?
-	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 )//BUTTON3 ) PORT_PLAYER(1)
-	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT  ) PORT_8WAY
-	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_8WAY
-	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY
-	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_8WAY
-	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
-	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 )
+	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2  ) //in game
+	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
-	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
+	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
 	PORT_START	/* DSW */
 	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
@@ -1437,8 +1456,28 @@
 	PORT_DIPSETTING(      0xc000, "3" )
 	PORT_DIPSETTING(      0x8000, "4" )
 	PORT_DIPSETTING(      0x0000, "5" )
+
+	PORT_START      /* IN2 ? */
+	PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+	PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
+	PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1)
+	PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT  ) PORT_8WAY PORT_PLAYER(1)
+	PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  ) PORT_8WAY PORT_PLAYER(1)
+	PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(1)
+	PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP  ) PORT_8WAY PORT_PLAYER(1)
+	PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON3 )PORT_PLAYER(1)
+
+	PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNKNOWN )//coin ?
+	PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
+	PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2)
+	PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT  ) PORT_8WAY PORT_PLAYER(2)
+	PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  ) PORT_8WAY PORT_PLAYER(2)
+	PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(2)
+	PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP  ) PORT_8WAY PORT_PLAYER(2)
+	PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //coin ?
 INPUT_PORTS_END
 
+
 static INPUT_PORTS_START( mustang )
 	PORT_START		/* IN0 */
 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
@@ -2814,130 +2853,1372 @@
 
 
 
-static const gfx_layout charlayout =
-{
-	8,8,
-	RGN_FRAC(1,1),
-	4,
-	{ 0, 1, 2, 3 },
-	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
-	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
-	32*8
-};
-
-static const gfx_layout tilelayout =
-{
-	16,16,
-	RGN_FRAC(1,1),
-	4,
-	{ 0, 1, 2, 3 },
-	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
-			16*32+0*4, 16*32+1*4, 16*32+2*4, 16*32+3*4, 16*32+4*4, 16*32+5*4, 16*32+6*4, 16*32+7*4 },
-	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
-			8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
-	32*32
-};
-
-static GFXDECODE_START( tharrier )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x000, 16 )	/* color 0x200-0x2ff */
-	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
-GFXDECODE_END
 
-static GFXDECODE_START( macross )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x200, 16 )	/* color 0x200-0x2ff */
-	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
-GFXDECODE_END
+/***************************************************************************
 
-static GFXDECODE_START( macross2 )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x300, 16 )	/* color 0x300-0x3ff */
-	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 32 )	/* color 0x100-0x2ff */
-GFXDECODE_END
 
-static GFXDECODE_START( bjtwin )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x000, 16 )	/* color 0x000-0x0ff */
-	GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout, 0x000, 16 )	/* color 0x000-0x0ff */
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
-GFXDECODE_END
+                                Input Ports
 
-static GFXDECODE_START( bioship )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x300, 16 )	/* color 0x300-0x3ff */
-	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x200, 16 )	/* color 0x200-0x2ff */
-	GFXDECODE_ENTRY( REGION_GFX4, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
-GFXDECODE_END
 
-static GFXDECODE_START( strahl )
-	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x000, 16 )	/* color 0x000-0x0ff */
-	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x300, 16 )	/* color 0x300-0x3ff */
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
-	GFXDECODE_ENTRY( REGION_GFX4, 0, tilelayout, 0x200, 16 )	/* color 0x200-0x2ff */
-GFXDECODE_END
+***************************************************************************/
 
+/***************************************************************************
+                                Stagger I
+***************************************************************************/
+
+static INPUT_PORTS_START( stagger1 )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
+	PORT_START_TAG("IN2")	// $080004.w
+	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
+	PORT_DIPSETTING(      0x0000, "1" )
+	PORT_DIPSETTING(      0x0080, "2" )
+	PORT_DIPSETTING(      0x00c0, "3" )
+	PORT_DIPSETTING(      0x0040, "5" )
+	PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Flip_Screen ) )
+	PORT_DIPSETTING(      0x0300, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPSETTING(      0x0200, "Horizontally" )
+	PORT_DIPSETTING(      0x0100, "Vertically" )
+	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
 
-static const struct YM2203interface ym2203_nmk004_interface =
-{
-	0,0,0,0,NMK004_irq
-};
+/* everything seems active high.. not low */
+static INPUT_PORTS_START( redhawkb )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_HIGH, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_HIGH, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_HIGH, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_HIGH, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_HIGH, IPT_START2   )
+	PORT_BIT(  0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
+	PORT_BIT(  0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+	PORT_BIT(  0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+
+	PORT_START_TAG("IN2")	// $080004.w  -- probably just redhawk but inverted
+	PORT_SERVICE( 0x0001, IP_ACTIVE_HIGH )    /* not working */
+	PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
+	PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( Lives ) )
+	PORT_DIPSETTING(      0x00c0, "1" )
+	PORT_DIPSETTING(      0x0040, "2" )
+	PORT_DIPSETTING(      0x0000, "3" )
+	PORT_DIPSETTING(      0x0080, "5" )
+	PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Flip_Screen ) )    /* not supported */
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0300, DEF_STR( On ) )
+	PORT_DIPSETTING(      0x0100, "Horizontally" )
+	PORT_DIPSETTING(      0x0200, "Vertically" )
+	PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x0000, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
 
-static void ym2203_irqhandler(int irq)
-{
-	cpunum_set_input_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
-}
+/***************************************************************************
+                            Sen Jin - Guardian Storm
+***************************************************************************/
+
+static INPUT_PORTS_START( grdnstrm )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// IN1 - $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
-static const struct YM2203interface ym2203_interface =
-{
-	0,0,0,0,ym2203_irqhandler
-};
+	PORT_START_TAG("IN2")	// $080004.w
+	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0008, 0x0008, "Bombs" )
+	PORT_DIPSETTING(      0x0008, "2" )
+	PORT_DIPSETTING(      0x0000, "3" )
+	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
+	PORT_DIPSETTING(      0x0000, "1" )
+	PORT_DIPSETTING(      0x0080, "2" )
+	PORT_DIPSETTING(      0x00c0, "3" )
+	PORT_DIPSETTING(      0x0040, "5" )
+	PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Flip_Screen ) )
+	PORT_DIPSETTING(      0x0300, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPSETTING(      0x0200, "Horizontally" )
+	PORT_DIPSETTING(      0x0100, "Vertically" )
+	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
 
-static INTERRUPT_GEN( nmk_interrupt )
-{
-	if (cpu_getiloops() == 0) cpunum_set_input_line(0, 4, HOLD_LINE);
-	else cpunum_set_input_line(0, 2, HOLD_LINE);
-}
+/* Pop's Pop's */
 
+static INPUT_PORTS_START( popspops )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// IN1 - $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+	/* the dips on this are a mess.. service mode doesn't seem to be 100% trustable */
+	PORT_START_TAG("IN2")	// $080004.w
+	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) ) // if ON it tells you the answers?!
+	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
+	PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
+
+
+
+/***************************************************************************
+                                Bubble 2000
+***************************************************************************/
+
+static INPUT_PORTS_START( bubl2000 )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+	PORT_START_TAG("IN2")	// $080004.w
+	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x00c0, 0x00c0, "Free Credit" )
+	PORT_DIPSETTING(      0x0080, "500k" )
+	PORT_DIPSETTING(      0x00c0, "800k" )
+	PORT_DIPSETTING(      0x0040, "1000k" )
+	PORT_DIPSETTING(      0x0000, "1500k" )
+	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) )
+	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0200, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x1c00, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x1400, DEF_STR( 1C_3C ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( 1C_4C ) )
+//  PORT_DIPSETTING(      0x0000, "Disabled" )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coin_A ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 1C_4C ) )
+//  PORT_DIPSETTING(      0x0000, "Disabled" )
+INPUT_PORTS_END
+
+/***************************************************************************
+                                Mang Chi
+***************************************************************************/
+
+static INPUT_PORTS_START( mangchi )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+	PORT_START_TAG("IN2")	// $080004.w
+    PORT_DIPNAME( 0x0001, 0x0001, "DSWS" )		/* Setting to on cuases screen issues, Flip Screen? or unfinished test mode? */
+    PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
+    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
+    PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0018, 0x0018, "Vs Rounds" )
+	PORT_DIPSETTING(      0x0018, "2" )
+	PORT_DIPSETTING(      0x0010, "3" )
+	PORT_DIPSETTING(      0x0008, "4" )
+	PORT_DIPSETTING(      0x0000, "5" )
+    PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
+    PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
+	PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
+    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+    PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
+    PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+    PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
+    PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+    PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
+    PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
+    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )	/* Hard to tell levels of difficulty by play :-( */
+	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
+
+
+/***************************************************************************
+                                Fire Hawk
+***************************************************************************/
+
+static INPUT_PORTS_START( firehawk )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
+	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN2") 	// $080004.w
+	PORT_DIPNAME( 0x0001, 0x0001, "Show Dip-Switch Settings" )
+	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x000e, 0x000e, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0006, DEF_STR( Very_Easy) )
+	PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
+//  PORT_DIPSETTING(      0x000a, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x000e, DEF_STR( Normal ) )
+//  PORT_DIPSETTING(      0x0000, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( Hardest ) )
+	PORT_DIPSETTING(      0x000c, DEF_STR( Very_Hard ) )
+	PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0020, "Number of Bombs" )
+	PORT_DIPSETTING(      0x0020, "2" )
+	PORT_DIPSETTING(      0x0000, "3" )
+	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
+	PORT_DIPSETTING(      0x0000, "1" )
+	PORT_DIPSETTING(      0x0080, "2" )
+	PORT_DIPSETTING(      0x00c0, "3" )
+	PORT_DIPSETTING(      0x0040, "4" )
+	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Region ) )
+	PORT_DIPSETTING(      0x0200, DEF_STR( English ) )
+	PORT_DIPSETTING(      0x0000, "China" )
+	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Free_Play ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x1800, "Continue Coins" )
+	PORT_DIPSETTING(      0x1800, "1 Coin" )
+	PORT_DIPSETTING(      0x0800, "2 Coins" )
+	PORT_DIPSETTING(      0x1000, "3 Coins" )
+	PORT_DIPSETTING(      0x0000, "4 Coins" )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
+
+
+/***************************************************************************
+                             Spectrum 2000
+***************************************************************************/
+
+static INPUT_PORTS_START( spec2k )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
+	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN2") 	// $080004.w
+	PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0008, 0x0008, "Number of Bombs" )
+	PORT_DIPSETTING(      0x0008, "2" )
+	PORT_DIPSETTING(      0x0000, "3" )
+	PORT_DIPNAME( 0x0010, 0x0010, "Copyright Notice" )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) )
+	PORT_DIPSETTING(      0x0000, "1" )
+	PORT_DIPSETTING(      0x0080, "2" )
+	PORT_DIPSETTING(      0x00c0, "3" )
+	PORT_DIPSETTING(      0x0040, "5" )
+	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 3C_2C ) )
+	PORT_DIPSETTING(      0xe000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
+INPUT_PORTS_END
+
+
+/***************************************************************************
+                                Twin Action
+***************************************************************************/
+
+static INPUT_PORTS_START( twinactn )
+	PORT_START_TAG("IN0")	// $080000.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START1   )
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_START2   )
+	PORT_SERVICE_NO_TOGGLE(0x0020, IP_ACTIVE_LOW   )	// Test in service mode
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+	PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
+
+	PORT_START_TAG("IN1")	// $080002.w
+	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
+	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
+	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
+	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
+	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x0080, IP_ACTIVE_HIGH,IPT_UNKNOWN )	// Tested at boot
+	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
+	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+	PORT_BIT(  0x8000, IP_ACTIVE_HIGH,IPT_UNKNOWN )	// Tested at boot
+
+	PORT_START_TAG("IN2")	// $080004.w
+	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
+	PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) )
+	PORT_DIPSETTING(      0x0010, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x0018, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x001c, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x0014, DEF_STR( 1C_3C ) )
+	PORT_DIPSETTING(      0x0004, DEF_STR( 1C_4C ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
+	PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) )
+	PORT_DIPSETTING(      0x0080, DEF_STR( 4C_1C ) )
+	PORT_DIPSETTING(      0x0040, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x00c0, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x0060, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_3C ) )
+	PORT_DIPSETTING(      0x0020, DEF_STR( 1C_4C ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
+
+	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
+	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0c00, DEF_STR( Easy ) )
+	PORT_DIPSETTING(      0x0400, DEF_STR( Normal ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( Hard ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
+	PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
+	PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) )
+	PORT_DIPSETTING(      0x4000, "2" )
+	PORT_DIPSETTING(      0xc000, "3" )
+	PORT_DIPSETTING(      0x8000, "4" )
+	PORT_DIPSETTING(      0x0000, "5" )
+INPUT_PORTS_END
+
+
+
+static const gfx_layout charlayout =
+{
+	8,8,
+	RGN_FRAC(1,1),
+	4,
+	{ 0, 1, 2, 3 },
+	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
+	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
+	32*8
+};
+
+static const gfx_layout tilelayout =
+{
+	16,16,
+	RGN_FRAC(1,1),
+	4,
+	{ 0, 1, 2, 3 },
+	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
+			16*32+0*4, 16*32+1*4, 16*32+2*4, 16*32+3*4, 16*32+4*4, 16*32+5*4, 16*32+6*4, 16*32+7*4 },
+	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
+			8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
+	32*32
+};
+
+static GFXDECODE_START( tharrier )
+	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x000, 16 )	/* color 0x200-0x2ff */
+	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
+	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
+GFXDECODE_END
+
+static GFXDECODE_START( macross )
+	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x200, 16 )	/* color 0x200-0x2ff */
+	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
+	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
+GFXDECODE_END
+
+static GFXDECODE_START( macross2 )
+	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x300, 16 )	/* color 0x300-0x3ff */
+	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
+	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 32 )	/* color 0x100-0x2ff */
+GFXDECODE_END
+
+static GFXDECODE_START( bjtwin )
+	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x000, 16 )	/* color 0x000-0x0ff */
+	GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout, 0x000, 16 )	/* color 0x000-0x0ff */
+	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
+GFXDECODE_END
+
+static GFXDECODE_START( bioship )
+	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x300, 16 )	/* color 0x300-0x3ff */
+	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
+	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x200, 16 )	/* color 0x200-0x2ff */
+	GFXDECODE_ENTRY( REGION_GFX4, 0, tilelayout, 0x000, 16 )	/* color 0x000-0x0ff */
+GFXDECODE_END
+
+static GFXDECODE_START( strahl )
+	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x000, 16 )	/* color 0x000-0x0ff */
+	GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x300, 16 )	/* color 0x300-0x3ff */
+	GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x100, 16 )	/* color 0x100-0x1ff */
+	GFXDECODE_ENTRY( REGION_GFX4, 0, tilelayout, 0x200, 16 )	/* color 0x200-0x2ff */
+GFXDECODE_END
+
+
+
+static const struct YM2203interface ym2203_nmk004_interface =
+{
+	0,0,0,0,NMK004_irq
+};
+
+static void ym2203_irqhandler(int irq)
+{
+	cpunum_set_input_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
+}
+
+static const struct YM2203interface ym2203_interface =
+{
+	0,0,0,0,ym2203_irqhandler
+};
+
+static INTERRUPT_GEN( nmk_interrupt )
+{
+	if (cpu_getiloops() == 0) cpunum_set_input_line(0, 4, HOLD_LINE);
+	else cpunum_set_input_line(0, 2, HOLD_LINE);
+}
+
+
+/* Parameters: YM3812 frequency, Oki frequency, Oki memory region */
+SEIBU_SOUND_SYSTEM_YM3812_HARDWARE
+
+
+static MACHINE_DRIVER_START( tharrier )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz */
+	MDRV_CPU_PROGRAM_MAP(tharrier_readmem,tharrier_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	MDRV_CPU_ADD(Z80, 3000000)
+	/* audio CPU */
+	MDRV_CPU_PROGRAM_MAP(tharrier_sound_readmem,tharrier_sound_writemem)
+	MDRV_CPU_IO_MAP(tharrier_sound_readport,tharrier_sound_writeport)
+
+	MDRV_MACHINE_RESET(mustang_sound)
+
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+
+	MDRV_GFXDECODE(tharrier)
+	MDRV_PALETTE_LENGTH(512)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(tharrier)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( manybloc )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10? MHz - check */
+	MDRV_CPU_PROGRAM_MAP(manybloc_readmem,manybloc_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,56)/* this needs to equal the framerate on this, rather than being double it .. */
+
+	MDRV_CPU_ADD(Z80, 3000000)
+	/* audio CPU */
+	MDRV_CPU_PROGRAM_MAP(tharrier_sound_readmem,tharrier_sound_writemem)
+	MDRV_CPU_IO_MAP(tharrier_sound_readport,tharrier_sound_writeport)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
+	MDRV_GFXDECODE(tharrier)
+	MDRV_PALETTE_LENGTH(512)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(manybloc)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( mustang )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(mustang_map,0)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(NMK004)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
+
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( mustangb )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(mustangb_map,0)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	SEIBU_SOUND_SYSTEM_CPU(14318180/4)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(mustang_sound)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
+
+	/* sound hardware */
+	SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4, 1320000, 1)
+
+MACHINE_DRIVER_END
+
+/*
+
+S.B.S. Gomorrah
+UPL, 1993
+
+PCB Layout
+----------
+
+UPL-90062
+|-------------------------------------------------------------------------|
+| LA4460  4558  YM2203   6116       NMK004                   68000        |
+|         3014  M6295    6.IC120                                          |
+|               M6295               8MHz                 62256  10.IC15   |
+|        SBS-G_05.IC160                                                   |
+|               SBS-G_04.IC139                           62256  11.IC14   |
+|DSW2   DSW1             12MHz                                            |
+|                                   82S129.IC69                           |
+|    NMK005                                                               |
+|                           82S135.IC94                                   |
+|                                   NMK902                                |
+|J        6116                             NMK903     NMK901              |
+|A                                                                        |
+|M        6116                      7.IC46                                |
+|M           82S123.IC154     6116                 6264           NMK903  |
+|A                                                                        |
+|                     6116                         6264                   |
+|                             6116                            SBS-G_01.IC9|
+|                     6116                                                |
+|                                                                         |
+|                                                  NMK901                 |
+|                                                                         |
+|                                                                 NMK903  |
+|                                                                         |
+|                            62256    62256        8.IC27     SBS-G_02.IC4|
+|                                                                         |
+|                            62256    62256        9.IC26                 |
+|SBS-G_03.IC194                                                    10MHz  |
+|-------------------------------------------------------------------------|
+Notes:
+      680000 @ 10.0MHz
+      YM2203 @ 1.5MHz [12/8]
+      M6295 @ 4.0MHz [12/3], pin 7 HIGH
+      VSync 60Hz
+      HSync 15.27kHz
+
+*/
+
+#define BIOSHIP_CRYSTAL1 10000000
+#define BIOSHIP_CRYSTAL2 12000000
+
+static MACHINE_DRIVER_START( bioship )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, BIOSHIP_CRYSTAL1 ) /* 10.0 MHz (verified) */
+	MDRV_CPU_PROGRAM_MAP(bioship_readmem,bioship_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(NMK004)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(bioship)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(bioship)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(bioship)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, BIOSHIP_CRYSTAL2 / 8) /* 1.5 Mhz (verified) */
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, BIOSHIP_CRYSTAL2 / 3 ) /* 4.0 Mhz, Pin 7 High (verified) */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, BIOSHIP_CRYSTAL2 / 3 ) /* 4.0 Mhz, Pin 7 High (verified) */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( vandyke )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(vandyke_readmem,vandyke_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(NMK004)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( vandykeb )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(vandyke_readmem,vandyke_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	MDRV_CPU_ADD(PIC16C57, (12000000/PIC16C5x_CLOCK_DIVIDER))	/* 3MHz */
+	MDRV_CPU_FLAGS(CPU_DISABLE)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	//MDRV_MACHINE_RESET(NMK004) // no NMK004
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( acrobatm )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz (verified on pcb) */
+	MDRV_CPU_PROGRAM_MAP(acrobatm_readmem,acrobatm_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(NMK004)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, 1500000) /* (verified on pcb) */
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4) /* (verified on pcb) */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low) /* on the pcb pin7 is not connected to gnd or +5v! */
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4) /* (verified on pcb) */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low) /* on the pcb pin7 is not connected to gnd or +5v! */
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+
+/* bootleg using Raiden sound hardware */
+static MACHINE_DRIVER_START( tdragonb )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000)
+	MDRV_CPU_PROGRAM_MAP(tdragon_readmem,tdragonb_writemem)
+	//MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
+
+	SEIBU_SOUND_SYSTEM_CPU(14318180/4)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(mustang_sound)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
+
+	/* sound hardware */
+	SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4, 1320000, 1)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( tdragon )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000)
+	MDRV_CPU_PROGRAM_MAP(tdragon_readmem,tdragon_writemem)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	//MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(NMK004)
+
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(tdragon)
+
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
+
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( ssmissin )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 8000000) /* 8 Mhz */
+	MDRV_CPU_PROGRAM_MAP(ssmissin_readmem,ssmissin_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112) /* input related */
+
+	MDRV_CPU_ADD(Z80, 8000000/2) /* 4 Mhz */
+	MDRV_CPU_PROGRAM_MAP(ssmissin_sound_readmem,ssmissin_sound_writemem)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(nmk16)
 
-/* Parameters: YM3812 frequency, Oki frequency, Oki memory region */
-SEIBU_SOUND_SYSTEM_YM3812_HARDWARE
+	/* video hardware */
+	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
+
+	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(macross)
 
+	/* sound hardware */
+	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-static MACHINE_DRIVER_START( tharrier )
+	MDRV_SOUND_ADD(OKIM6295, 8000000/8) /* 1 Mhz, pin 7 high */
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+MACHINE_DRIVER_END
+
+
+static MACHINE_DRIVER_START( strahl )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz */
-	MDRV_CPU_PROGRAM_MAP(tharrier_readmem,tharrier_writemem)
+	MDRV_CPU_ADD(M68000, 12000000) /* 12 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(strahl_readmem,strahl_writemem)
 	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
 	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_CPU_ADD(Z80, 3000000)
-	/* audio CPU */
-	MDRV_CPU_PROGRAM_MAP(tharrier_sound_readmem,tharrier_sound_writemem)
-	MDRV_CPU_IO_MAP(tharrier_sound_readport,tharrier_sound_writeport)
-
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(mustang_sound)
+	MDRV_MACHINE_RESET(NMK004)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
 	MDRV_SCREEN_SIZE(256, 256)
 	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(tharrier)
-	MDRV_PALETTE_LENGTH(512)
+	MDRV_GFXDECODE(strahl)
+	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_START(strahl)
 	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(tharrier)
+	MDRV_VIDEO_UPDATE(strahl)
 
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
 	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
 	MDRV_SOUND_ROUTE(0, "mono", 0.50)
 	MDRV_SOUND_ROUTE(1, "mono", 0.50)
 	MDRV_SOUND_ROUTE(2, "mono", 0.50)
@@ -2952,39 +4233,36 @@
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( manybloc )
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10? MHz - check */
-	MDRV_CPU_PROGRAM_MAP(manybloc_readmem,manybloc_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,60)/* is this is too high it breaks the game on this one, too low sprites flicker */
+static MACHINE_DRIVER_START( hachamf )
 
-	MDRV_CPU_ADD(Z80, 3000000)
-	/* audio CPU */
-	MDRV_CPU_PROGRAM_MAP(tharrier_sound_readmem,tharrier_sound_writemem)
-	MDRV_CPU_IO_MAP(tharrier_sound_readport,tharrier_sound_writeport)
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(hachamf_map,0)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
+	MDRV_MACHINE_RESET(NMK004)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
 	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
-	MDRV_GFXDECODE(tharrier)
-	MDRV_PALETTE_LENGTH(512)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
+	MDRV_PALETTE_LENGTH(1024)
 
 	MDRV_VIDEO_START(macross)
-//  MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(manybloc)
+	MDRV_VIDEO_EOF(nmk)
+	MDRV_VIDEO_UPDATE(hachamf)
 
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
 	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
 	MDRV_SOUND_ROUTE(0, "mono", 0.50)
 	MDRV_SOUND_ROUTE(1, "mono", 0.50)
 	MDRV_SOUND_ROUTE(2, "mono", 0.50)
@@ -2999,15 +4277,16 @@
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( mustang )
+
+static MACHINE_DRIVER_START( macross )
 
 	/* basic machine hardware */
 	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(mustang_readmem,mustang_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_PROGRAM_MAP(macross_readmem,macross_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
 	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
 	MDRV_MACHINE_RESET(NMK004)
 
@@ -3023,7 +4302,6 @@
 	MDRV_VIDEO_EOF(nmk)
 	MDRV_VIDEO_UPDATE(macross)
 
-
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
@@ -3043,151 +4321,122 @@
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( mustangb )
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(mustang_readmem,mustangb_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+static MACHINE_DRIVER_START( gunnail )
 
-	SEIBU_SOUND_SYSTEM_CPU(14318180/4)
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz? */
+	MDRV_CPU_PROGRAM_MAP(gunnail_readmem,gunnail_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(mustang_sound)
+	MDRV_MACHINE_RESET(NMK004)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_SCREEN_SIZE(512, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
 	MDRV_GFXDECODE(macross)
 	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_START(gunnail)
 	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
+	MDRV_VIDEO_UPDATE(gunnail)
 
 	/* sound hardware */
-	SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4, 1320000, 1)
-
-MACHINE_DRIVER_END
-
-/*
-
-S.B.S. Gomorrah
-UPL, 1993
+	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-PCB Layout
-----------
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
+	MDRV_SOUND_ROUTE(0, "mono", 0.50)
+	MDRV_SOUND_ROUTE(1, "mono", 0.50)
+	MDRV_SOUND_ROUTE(2, "mono", 0.50)
+	MDRV_SOUND_ROUTE(3, "mono", 2.00)
 
-UPL-90062
-|-------------------------------------------------------------------------|
-| LA4460  4558  YM2203   6116       NMK004                   68000        |
-|         3014  M6295    6.IC120                                          |
-|               M6295               8MHz                 62256  10.IC15   |
-|        SBS-G_05.IC160                                                   |
-|               SBS-G_04.IC139                           62256  11.IC14   |
-|DSW2   DSW1             12MHz                                            |
-|                                   82S129.IC69                           |
-|    NMK005                                                               |
-|                           82S135.IC94                                   |
-|                                   NMK902                                |
-|J        6116                             NMK903     NMK901              |
-|A                                                                        |
-|M        6116                      7.IC46                                |
-|M           82S123.IC154     6116                 6264           NMK903  |
-|A                                                                        |
-|                     6116                         6264                   |
-|                             6116                            SBS-G_01.IC9|
-|                     6116                                                |
-|                                                                         |
-|                                                  NMK901                 |
-|                                                                         |
-|                                                                 NMK903  |
-|                                                                         |
-|                            62256    62256        8.IC27     SBS-G_02.IC4|
-|                                                                         |
-|                            62256    62256        9.IC26                 |
-|SBS-G_03.IC194                                                    10MHz  |
-|-------------------------------------------------------------------------|
-Notes:
-      680000 @ 10.0MHz
-      YM2203 @ 1.5MHz [12/8]
-      M6295 @ 4.0MHz [12/3], pin 7 HIGH
-      VSync 60Hz
-      HSync 15.27kHz
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 
-*/
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+MACHINE_DRIVER_END
 
-#define BIOSHIP_CRYSTAL1 10000000
-#define BIOSHIP_CRYSTAL2 12000000
 
-static MACHINE_DRIVER_START( bioship )
+static MACHINE_DRIVER_START( macross2 )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, BIOSHIP_CRYSTAL1 ) /* 10.0 MHz (verified) */
-	MDRV_CPU_PROGRAM_MAP(bioship_readmem,bioship_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(macross2_readmem,macross2_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
 	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_CPU_ADD(Z80, 4000000)
+	/* audio CPU */ /* 4 MHz ? */
+	MDRV_CPU_PROGRAM_MAP(macross2_sound_readmem,macross2_sound_writemem)
+	MDRV_CPU_IO_MAP(macross2_sound_readport,macross2_sound_writeport)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+	MDRV_MACHINE_RESET(nmk16)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(bioship)
+	MDRV_SCREEN_SIZE(512, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross2)
 	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(bioship)
+	MDRV_VIDEO_START(macross2)
 	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(bioship)
+	MDRV_VIDEO_UPDATE(macross)
 
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, BIOSHIP_CRYSTAL2 / 8) /* 1.5 Mhz (verified) */
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
 
-	MDRV_SOUND_ADD(OKIM6295, BIOSHIP_CRYSTAL2 / 3 ) /* 4.0 Mhz, Pin 7 High (verified) */
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 
-	MDRV_SOUND_ADD(OKIM6295, BIOSHIP_CRYSTAL2 / 3 ) /* 4.0 Mhz, Pin 7 High (verified) */
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( vandyke )
+static MACHINE_DRIVER_START( tdragon2 )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(vandyke_readmem,vandyke_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz  */
+	MDRV_CPU_PROGRAM_MAP(macross2_readmem,macross2_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
 	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_CPU_ADD(Z80, 4000000)
+	/* audio CPU */ /* 4 MHz  */
+	MDRV_CPU_PROGRAM_MAP(macross2_sound_readmem,macross2_sound_writemem)
+	MDRV_CPU_IO_MAP(macross2_sound_readport,macross2_sound_writeport)
+
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+	MDRV_MACHINE_RESET(nmk16)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
+	MDRV_SCREEN_SIZE(512, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross2)
 	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_START(tdragon2)
 	MDRV_VIDEO_EOF(nmk)
 	MDRV_VIDEO_UPDATE(macross)
 
@@ -3195,90 +4444,88 @@
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
 	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
 
 	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
 	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
 
 	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
 	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( vandykeb )
+static MACHINE_DRIVER_START( raphero )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(vandyke_readmem,vandyke_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+	MDRV_CPU_ADD(M68000, 14000000) /* 14 MHz measured */
+	MDRV_CPU_PROGRAM_MAP(macross2_readmem,raphero_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
 	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_CPU_ADD(PIC16C57, (12000000/PIC16C5x_CLOCK_DIVIDER))	/* 3MHz */
-	MDRV_CPU_FLAGS(CPU_DISABLE)
+	MDRV_CPU_ADD_TAG("sound",TMP90841, 8000000)
+	MDRV_CPU_PROGRAM_MAP(raphero_sound_mem_map,0)
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_SCREEN_REFRESH_RATE(56) // measured
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	//MDRV_MACHINE_RESET(NMK004) // no NMK004
+	MDRV_MACHINE_RESET(nmk16)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
+	MDRV_SCREEN_SIZE(512, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross2)
 	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_START(macross2)
 	MDRV_VIDEO_EOF(nmk)
 	MDRV_VIDEO_UPDATE(macross)
 
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
+	MDRV_SOUND_ADD(YM2203, 1500000)
+	MDRV_SOUND_CONFIG(ym2203_interface)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
+
 	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
 	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+
+	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( acrobatm )
+static MACHINE_DRIVER_START( bjtwin )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? 12 MHz? */
-	MDRV_CPU_PROGRAM_MAP(acrobatm_readmem,acrobatm_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz? It's a P12, but xtals are 10MHz and 16MHz */
+	MDRV_CPU_PROGRAM_MAP(bjtwin_readmem,bjtwin_writemem)
+	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+	MDRV_MACHINE_RESET(nmk16)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
+	MDRV_SCREEN_SIZE(512, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(bjtwin)
 	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
+	MDRV_VIDEO_START(bjtwin)
 	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
+	MDRV_VIDEO_UPDATE(bjtwin)
 
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
-
 	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
 	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
@@ -3289,460 +4536,667 @@
 MACHINE_DRIVER_END
 
 
-/* bootleg using Raiden sound hardware */
-static MACHINE_DRIVER_START( tdragonb )
+static UINT8 decode_byte(UINT8 src, const UINT8 *bitp)
+{
+	UINT8 ret, i;
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000)
-	MDRV_CPU_PROGRAM_MAP(tdragon_readmem,tdragonb_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
+	ret = 0;
+	for (i=0; i<8; i++)
+		ret |= (((src >> bitp[i]) & 1) << (7-i));
+
+	return ret;
+}
+
+static UINT32 bjtwin_address_map_bg0(UINT32 addr)
+{
+   return ((addr&0x00004)>> 2) | ((addr&0x00800)>> 10) | ((addr&0x40000)>>16);
+}
+
+
+static UINT16 decode_word(UINT16 src, const UINT8 *bitp)
+{
+	UINT16 ret, i;
+
+	ret=0;
+	for (i=0; i<16; i++)
+		ret |= (((src >> bitp[i]) & 1) << (15-i));
+
+	return ret;
+}
+
+
+static UINT32 bjtwin_address_map_sprites(UINT32 addr)
+{
+   return ((addr&0x00010)>> 4) | ((addr&0x20000)>>16) | ((addr&0x100000)>>18);
+}
+
+
+static void decode_gfx(void)
+{
+	/* GFX are scrambled.  We decode them here.  (BIG Thanks to Antiriad for descrambling info) */
+	UINT8 *rom;
+	int A;
+
+	static const UINT8 decode_data_bg[8][8] =
+	{
+		{0x3,0x0,0x7,0x2,0x5,0x1,0x4,0x6},
+		{0x1,0x2,0x6,0x5,0x4,0x0,0x3,0x7},
+		{0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0},
+		{0x7,0x6,0x5,0x0,0x1,0x4,0x3,0x2},
+		{0x2,0x0,0x1,0x4,0x3,0x5,0x7,0x6},
+		{0x5,0x3,0x7,0x0,0x4,0x6,0x2,0x1},
+		{0x2,0x7,0x0,0x6,0x5,0x3,0x1,0x4},
+		{0x3,0x4,0x7,0x6,0x2,0x0,0x5,0x1},
+	};
+
+	static const UINT8 decode_data_sprite[8][16] =
+	{
+		{0x9,0x3,0x4,0x5,0x7,0x1,0xb,0x8,0x0,0xd,0x2,0xc,0xe,0x6,0xf,0xa},
+		{0x1,0x3,0xc,0x4,0x0,0xf,0xb,0xa,0x8,0x5,0xe,0x6,0xd,0x2,0x7,0x9},
+		{0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0},
+		{0xf,0xe,0xc,0x6,0xa,0xb,0x7,0x8,0x9,0x2,0x3,0x4,0x5,0xd,0x1,0x0},
+
+		{0x1,0x6,0x2,0x5,0xf,0x7,0xb,0x9,0xa,0x3,0xd,0xe,0xc,0x4,0x0,0x8}, /* Haze 20/07/00 */
+		{0x7,0x5,0xd,0xe,0xb,0xa,0x0,0x1,0x9,0x6,0xc,0x2,0x3,0x4,0x8,0xf}, /* Haze 20/07/00 */
+		{0x0,0x5,0x6,0x3,0x9,0xb,0xa,0x7,0x1,0xd,0x2,0xe,0x4,0xc,0x8,0xf}, /* Antiriad, Corrected by Haze 20/07/00 */
+		{0x9,0xc,0x4,0x2,0xf,0x0,0xb,0x8,0xa,0xd,0x3,0x6,0x5,0xe,0x1,0x7}, /* Antiriad, Corrected by Haze 20/07/00 */
+	};
+
+
+	/* background */
+	rom = memory_region(REGION_GFX2);
+	for (A = 0;A < memory_region_length(REGION_GFX2);A++)
+	{
+		rom[A] = decode_byte( rom[A], decode_data_bg[bjtwin_address_map_bg0(A)]);
+	}
+
+	/* sprites */
+	rom = memory_region(REGION_GFX3);
+	for (A = 0;A < memory_region_length(REGION_GFX3);A += 2)
+	{
+		UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_sprite[bjtwin_address_map_sprites(A)]);
+		rom[A+1] = tmp >> 8;
+		rom[A] = tmp & 0xff;
+	}
+}
+
+static void decode_tdragonb(void)
+{
+	/* Descrambling Info Again Taken from Raine, Huge Thanks to Antiriad and the Raine Team for
+       going Open Source, best of luck in future development. */
+
+	UINT8 *rom;
+	int A;
+
+	/* The Main 68k Program of the Bootleg is Bitswapped */
+	static const UINT8 decode_data_tdragonb[1][16] =
+	{
+		{0xe,0xc,0xa,0x8,0x7,0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x6,0x4,0x2,0x0},
+	};
+
+	/* Graphic Roms Could Also Do With Rearranging to make things simpler */
+	static const UINT8 decode_data_tdragonbgfx[1][8] =
+	{
+		{0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
+	};
+
+	rom = memory_region(REGION_CPU1);
+	for (A = 0;A < memory_region_length(REGION_CPU1);A += 2)
+	{
+#ifdef LSB_FIRST
+		UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_tdragonb[0]);
+		rom[A+1] = tmp >> 8;
+		rom[A] = tmp & 0xff;
+#else
+		UINT16 tmp = decode_word( rom[A]*256 + rom[A+1], decode_data_tdragonb[0]);
+		rom[A] = tmp >> 8;
+		rom[A+1] = tmp & 0xff;
+#endif
+	}
+
+	rom = memory_region(REGION_GFX2);
+	for (A = 0;A < memory_region_length(REGION_GFX2);A++)
+	{
+		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
+	}
+
+	rom = memory_region(REGION_GFX3);
+	for (A = 0;A < memory_region_length(REGION_GFX3);A++)
+	{
+		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
+	}
+}
+
+static void decode_ssmissin(void)
+{
+	/* Like Thunder Dragon Bootleg without the Program Rom Swapping */
+	UINT8 *rom;
+	int A;
+
+	/* Graphic Roms Could Also Do With Rearranging to make things simpler */
+	static const UINT8 decode_data_tdragonbgfx[1][8] =
+	{
+		{0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
+	};
+
+	rom = memory_region(REGION_GFX2);
+	for (A = 0;A < memory_region_length(REGION_GFX2);A++)
+	{
+		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
+	}
+
+	rom = memory_region(REGION_GFX3);
+	for (A = 0;A < memory_region_length(REGION_GFX3);A++)
+	{
+		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
+	}
+}
+
+
+static DRIVER_INIT( nmk )
+{
+	decode_gfx();
+}
+
+static DRIVER_INIT( hachamf )
+{
+	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+
+	//rom[0x0006/2] = 0x7dc2;   /* replace reset vector with the "real" one */
+
+	// kludge the sound communication to let commands go through.
+	rom[0x048a/2] = 0x4e71;
+	rom[0x04aa/2] = 0x4e71;
+}
+
+static DRIVER_INIT( tdragonb )
+{
+	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+
+	decode_tdragonb();
+
+	/* The Following Patch is taken from Raine, Otherwise the game has no Sprites in Attract Mode or After Level 1
+       which is rather odd considering its a bootleg.. */
+	rom[0x00308/2] = 0x4e71; /* Sprite Problem */
+}
+
+static DRIVER_INIT( tdragon )
+{
+	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+
+	//rom[0x94b0/2] = 0; /* Patch out JMP to shared memory (protection) */
+	//rom[0x94b2/2] = 0x92f4;
+
+	// kludge the sound communication to let commands go through.
+	rom[0x048a/2] = 0x4e71;
+	rom[0x04aa/2] = 0x4e71;
+}
+
+static DRIVER_INIT( ssmissin )
+{
+	decode_ssmissin();
+}
+
+
+int is_blkheart;
+
+
+static DRIVER_INIT( bjtwin )
+{
+	driver_init_nmk(machine);
+
+	/* Patch rom to enable test mode */
 
-	SEIBU_SOUND_SYSTEM_CPU(14318180/4)
+/*  008F54: 33F9 0008 0000 000F FFFC move.w  $80000.l, $ffffc.l
+ *  008F5E: 3639 0008 0002           move.w  $80002.l, D3
+ *  008F64: 3003                     move.w  D3, D0             \
+ *  008F66: 3203                     move.w  D3, D1             |   This code remaps
+ *  008F68: 0041 BFBF                ori.w   #-$4041, D1        |   buttons 2 and 3 to
+ *  008F6C: E441                     asr.w   #2, D1             |   button 1, so
+ *  008F6E: 0040 DFDF                ori.w   #-$2021, D0        |   you can't enter
+ *  008F72: E240                     asr.w   #1, D0             |   service mode
+ *  008F74: C640                     and.w   D0, D3             |
+ *  008F76: C641                     and.w   D1, D3             /
+ *  008F78: 33C3 000F FFFE           move.w  D3, $ffffe.l
+ *  008F7E: 207C 000F 9000           movea.l #$f9000, A0
+ */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(mustang_sound)
+//  data 16_t *rom = (UINT16 *)memory_region(REGION_CPU1);
+//  rom[0x09172/2] = 0x6006;    /* patch checksum error */
+//  rom[0x08f74/2] = 0x4e71);
+}
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
-	MDRV_PALETTE_LENGTH(1024)
+/* NO NMK004, it has a PIC instead */
+static READ16_HANDLER( vandykeb_r ) { return 0x0000; };
+static DRIVER_INIT (vandykeb)
+{
+	memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x08000e, 0x08000f, 0, 0, vandykeb_r );
+	memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x08001e, 0x08001f, 0, 0, MWA16_NOP );
+}
 
-	MDRV_VIDEO_START(macross)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
 
-	/* sound hardware */
-	SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4, 1320000, 1)
-MACHINE_DRIVER_END
+/***************************************************************************
 
-static MACHINE_DRIVER_START( tdragon )
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000)
-	MDRV_CPU_PROGRAM_MAP(tdragon_readmem,tdragon_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
+                            Memory Maps - Main CPU
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
-	MDRV_PALETTE_LENGTH(1024)
+***************************************************************************/
 
-	MDRV_VIDEO_START(macross)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(tdragon)
+static READ16_HANDLER( afega_unknown_r )
+{
+	/* This fixes the text in Service Mode. */
+	return 0x0100;
+}
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+static WRITE16_HANDLER( afega_scroll0_w )
+{
+	COMBINE_DATA(&afega_scroll_0[offset]);
+}
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
-MACHINE_DRIVER_END
+static WRITE16_HANDLER( afega_scroll1_w )
+{
+	COMBINE_DATA(&afega_scroll_1[offset]);
+}
 
-static MACHINE_DRIVER_START( ssmissin )
+/*
+ Lines starting with an empty comment in the following MemoryReadAddress
+ arrays are there for debug (e.g. the game does not read from those ranges
+ AFAIK)
+*/
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 8000000) /* 8 Mhz */
-	MDRV_CPU_PROGRAM_MAP(ssmissin_readmem,ssmissin_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112) /* input related */
 
-	MDRV_CPU_ADD(Z80, 8000000/2) /* 4 Mhz */
-	MDRV_CPU_PROGRAM_MAP(ssmissin_sound_readmem,ssmissin_sound_writemem)
+static ADDRESS_MAP_START( afega, ADDRESS_SPACE_PROGRAM, 16 )
+	ADDRESS_MAP_FLAGS( AMEF_ABITS(20) )
+	AM_RANGE(0x000000, 0x07ffff) AM_ROM
+	AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)		// Buttons
+	AM_RANGE(0x080002, 0x080003) AM_READ(input_port_1_word_r)		// P1 + P2
+	AM_RANGE(0x080004, 0x080005) AM_READ(input_port_2_word_r)		// 2 x DSW
+	AM_RANGE(0x080012, 0x080013) AM_READ(afega_unknown_r)
+	AM_RANGE(0x080000, 0x08001d) AM_WRITE(MWA16_RAM)				//
+	AM_RANGE(0x08001e, 0x08001f) AM_WRITE(afega_soundlatch_w)		// To Sound CPU
+/**/AM_RANGE(0x084000, 0x084003) AM_RAM AM_WRITE(afega_scroll0_w)	// Scroll on redhawkb (mirror or changed?..)
+/**/AM_RANGE(0x084004, 0x084007) AM_RAM AM_WRITE(afega_scroll1_w)   // Scroll on redhawkb (mirror or changed?..)
+	AM_RANGE(0x080020, 0x087fff) AM_WRITE(MWA16_RAM)				//
+/**/AM_RANGE(0x088000, 0x0885ff) AM_READWRITE(MRA16_RAM, paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16) // Palette
+	AM_RANGE(0x088600, 0x08bfff) AM_WRITE(MWA16_RAM)				//
+/**/AM_RANGE(0x08c000, 0x08c003) AM_RAM AM_WRITE(afega_scroll0_w) AM_BASE(&afega_scroll_0)	// Scroll
+/**/AM_RANGE(0x08c004, 0x08c007) AM_RAM AM_WRITE(afega_scroll1_w) AM_BASE(&afega_scroll_1)	//
+	AM_RANGE(0x08c008, 0x08ffff) AM_WRITE(MWA16_RAM)				//
+/**/AM_RANGE(0x090000, 0x091fff) AM_READWRITE(MRA16_RAM, afega_vram_0_w) AM_BASE(&afega_vram_0)	// Layer 0
+/**/AM_RANGE(0x092000, 0x093fff) AM_RAM								// ?
+/**/AM_RANGE(0x09c000, 0x09c7ff) AM_READWRITE(MRA16_RAM, afega_vram_1_w) AM_BASE(&afega_vram_1)	// Layer 1
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(nmk16)
+	AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE(1) AM_WRITE(nmk16_mainram_strange_w) AM_BASE(&nmk16_mainram)
+	AM_RANGE(0x0f0000, 0x0fffff) AM_RAM AM_SHARE(1) AM_WRITE(nmk16_mainram_strange_w)
+ADDRESS_MAP_END
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
-	MDRV_PALETTE_LENGTH(1024)
+#if 0
+// The high byte of the word written is the address to write to (byte offset), the low byte is data
+static WRITE16_HANDLER( twinactn_scroll0_w )
+{
+	int byte = ((data >> 8) & 3) ^ 2;
+	int bit  = ((byte & 1) ? 0 : 8);
+	afega_scroll_0[byte / 2] = (afega_scroll_0[byte / 2] & (0xff << (8-bit))) | ((data & 0xff) << bit);
+}
+static WRITE16_HANDLER( twinactn_scroll1_w )
+{
+	int byte = ((data >> 8) & 3) ^ 2;
+	int bit  = ((byte & 1) ? 0 : 8);
+	afega_scroll_1[byte / 2] = (afega_scroll_1[byte / 2] & (0xff << (8-bit))) | ((data & 0xff) << bit);
+}
 
-	MDRV_VIDEO_START(macross)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
+static WRITE16_HANDLER( twinactn_flipscreen_w )
+{
+	if (ACCESSING_LSB)
+		flip_screen_set(data & 1);
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
+	if (data & (~1))
+		logerror("%06x: unknown flip screen bit written %04x\n", activecpu_get_pc(), data);
+}
+#endif
 
-	MDRV_SOUND_ADD(OKIM6295, 8000000/8) /* 1 Mhz, pin 7 high */
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-MACHINE_DRIVER_END
+/***************************************************************************
 
 
-static MACHINE_DRIVER_START( strahl )
+                            Memory Maps - Sound CPU
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 12000000) /* 12 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(strahl_readmem,strahl_writemem)
-	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+***************************************************************************/
+static WRITE8_HANDLER( spec2k_oki1_banking_w )
+{
+ 	if(data == 0xfe)
+ 		OKIM6295_set_bank_base(1, 0);
+ 	else if(data == 0xff)
+ 		OKIM6295_set_bank_base(1, 0x40000);
+}
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(strahl)
-	MDRV_PALETTE_LENGTH(1024)
+static ADDRESS_MAP_START( afega_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
+	AM_RANGE(0x0003, 0x0003) AM_WRITE(MWA8_NOP) // bug in sound prg?
+	AM_RANGE(0x0004, 0x0004) AM_WRITE(MWA8_NOP) // bug in sound prg?
+	AM_RANGE(0x0000, 0xefff) AM_ROM
+	AM_RANGE(0xf000, 0xf7ff) AM_RAM									// RAM
+	AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)					// From Main CPU
+	AM_RANGE(0xf808, 0xf808) AM_WRITE(YM2151_register_port_0_w)		// YM2151
+	AM_RANGE(0xf809, 0xf809) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)	// YM2151
+	AM_RANGE(0xf80a, 0xf80a) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)		// M6295
+ADDRESS_MAP_END
 
-	MDRV_VIDEO_START(strahl)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(strahl)
+static ADDRESS_MAP_START( firehawk_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
+	AM_RANGE(0x0000, 0xefff) AM_ROM
+	AM_RANGE(0xf000, 0xf7ff) AM_RAM
+	AM_RANGE(0xfff0, 0xfff0) AM_READ(soundlatch_r)
+	AM_RANGE(0xfff2, 0xfff2) AM_WRITE(spec2k_oki1_banking_w )
+	AM_RANGE(0xfff8, 0xfff8) AM_READWRITE(OKIM6295_status_1_r, OKIM6295_data_1_w)
+	AM_RANGE(0xfffa, 0xfffa) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
+	AM_RANGE(0xf800, 0xffff) AM_RAM // not used, only tested
+ADDRESS_MAP_END
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+static WRITE8_HANDLER( twinactn_oki_bank_w )
+{
+	OKIM6295_set_bank_base(0, (data & 3) * 0x40000);
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+	if (data & (~3))
+		logerror("%04x: invalid oki bank %02x\n", activecpu_get_pc(), data);
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
-MACHINE_DRIVER_END
+//  logerror("%04x: oki bank %02x\n", activecpu_get_pc(), data);
+}
 
+static ADDRESS_MAP_START( twinactn_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
+	AM_RANGE(0x0000, 0x7fff) AM_ROM
+	AM_RANGE(0x8000, 0x87ff) AM_RAM
+	AM_RANGE(0x9000, 0x9000) AM_WRITE(twinactn_oki_bank_w)
+	AM_RANGE(0x9800, 0x9800) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
+	AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)		// From Main CPU
+ADDRESS_MAP_END
 
-static MACHINE_DRIVER_START( hachamf )
+/***************************************************************************
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(hachamf_readmem,hachamf_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+                            Graphics Layouts
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
-	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(hachamf)
+***************************************************************************/
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
+static const gfx_layout layout_8x8x4 =
+{
+	8,8,
+	RGN_FRAC(1,1),
+	4,
+	{ STEP4(0,1)	},
+	{ STEP8(0,4)	},
+	{ STEP8(0,8*4)	},
+	8*8*4
+};
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+static const gfx_layout layout_16x16x4 =
+{
+	16,16,
+	RGN_FRAC(1,1),
+	4,
+	{ STEP4(0,1)	},
+	{ STEP8(0,4),   STEP8(8*8*4*2,4)	},
+	{ STEP8(0,8*4), STEP8(8*8*4*1,8*4)	},
+	16*16*4
+};
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+static const gfx_layout layout_16x16x8 =
+{
+	16,16,
+	RGN_FRAC(1,2),
+	8,
+	{ STEP4(RGN_FRAC(0,2),1), STEP4(RGN_FRAC(1,2),1)	},
+	{ STEP8(0,4),   STEP8(8*8*4*2,4)	},
+	{ STEP8(0,8*4), STEP8(8*8*4*1,8*4)	},
+	16*16*4
+};
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
-MACHINE_DRIVER_END
 
+static const gfx_layout layout_16x16x4_swapped =
+{
+	16,16,
+	RGN_FRAC(1,1),
+	4,
+	{ STEP4(0,1)	},
+	{ 4,0,12,8,20,16,28,24, 512+4,512+0,512+12,512+8,512+20,512+16,512+28,512+24},
+	{ STEP8(0,8*4), STEP8(8*8*4*1,8*4)	},
+	16*16*4
+};
 
-static MACHINE_DRIVER_START( macross )
+static GFXDECODE_START( grdnstrm )
+	GFXDECODE_ENTRY( REGION_GFX2, 0, layout_16x16x8,	256*3, 16 ) // [1] Layer 0
+	GFXDECODE_ENTRY( REGION_GFX3, 0, layout_8x8x4,	256*2, 16 ) // [2] Layer 1
+	GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4,	256*1, 16 ) // [0] Sprites
+GFXDECODE_END
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(macross_readmem,macross_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+static GFXDECODE_START( stagger1 )
+	GFXDECODE_ENTRY( REGION_GFX2, 0, layout_16x16x4,	256*0, 16 ) // [1] Layer 0
+	GFXDECODE_ENTRY( REGION_GFX3, 0, layout_8x8x4,	256*2, 16 ) // [2] Layer 1
+	GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4,	256*1, 16 ) // [0] Sprites
+GFXDECODE_END
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+static GFXDECODE_START( redhawkb )
+	GFXDECODE_ENTRY( REGION_GFX2, 0, layout_16x16x4_swapped,	256*0, 16 ) // [1] Layer 0
+	GFXDECODE_ENTRY( REGION_GFX3, 0, layout_8x8x4,			256*2, 16 ) // [2] Layer 1
+	GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4_swapped,	256*1, 16 ) // [0] Sprites
+GFXDECODE_END
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
-	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
+/***************************************************************************
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+                                Machine Drivers
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
-MACHINE_DRIVER_END
+***************************************************************************/
 
+static void irq_handler(int irq)
+{
+	cpunum_set_input_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
+}
+
+static const struct YM2151interface afega_ym2151_intf =
+{
+	irq_handler
+};
 
-static MACHINE_DRIVER_START( gunnail )
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz? */
-	MDRV_CPU_PROGRAM_MAP(gunnail_readmem,gunnail_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(NMK004)
+static MACHINE_DRIVER_START( stagger1 )
+
+	/* basic machine hardware */
+	MDRV_CPU_ADD(M68000,12000000)
+	MDRV_CPU_PROGRAM_MAP(afega,0)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
+
+	MDRV_CPU_ADD(Z80, 4000000)
+	/* audio CPU */	/* ? */
+	MDRV_CPU_PROGRAM_MAP(afega_sound_cpu,0)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(512, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross)
-	MDRV_PALETTE_LENGTH(1024)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
 
-	MDRV_VIDEO_START(gunnail)
+	MDRV_GFXDECODE(stagger1)
+	MDRV_PALETTE_LENGTH(768)
+
+	MDRV_VIDEO_START(afega)
+	MDRV_VIDEO_UPDATE(afega)
 	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(gunnail)
 
 	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
-
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_nmk004_interface)
-	MDRV_SOUND_ROUTE(0, "mono", 0.50)
-	MDRV_SOUND_ROUTE(1, "mono", 0.50)
-	MDRV_SOUND_ROUTE(2, "mono", 0.50)
-	MDRV_SOUND_ROUTE(3, "mono", 2.00)
+	MDRV_SPEAKER_STANDARD_STEREO("left", "right")
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+	MDRV_SOUND_ADD(YM2151, 4000000)
+	MDRV_SOUND_CONFIG(afega_ym2151_intf)
+	MDRV_SOUND_ROUTE(0, "left", 0.30)
+	MDRV_SOUND_ROUTE(1, "right", 0.30)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+	MDRV_SOUND_ADD(OKIM6295, 1000000)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.70)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.70)
 MACHINE_DRIVER_END
 
+static MACHINE_DRIVER_START( redhawkb )
+	/* basic machine hardware */
+	MDRV_IMPORT_FROM(stagger1)
+	/* video hardware */
+	MDRV_GFXDECODE(redhawkb)
+	MDRV_VIDEO_UPDATE(redhawkb)
+MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( macross2 )
+static MACHINE_DRIVER_START( grdnstrm )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(macross2_readmem,macross2_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
+	MDRV_IMPORT_FROM(stagger1)
 
-	MDRV_CPU_ADD(Z80, 4000000)
-	/* audio CPU */ /* 4 MHz ? */
-	MDRV_CPU_PROGRAM_MAP(macross2_sound_readmem,macross2_sound_writemem)
-	MDRV_CPU_IO_MAP(macross2_sound_readport,macross2_sound_writeport)
+	/* video hardware */
+	MDRV_GFXDECODE(grdnstrm)
+	MDRV_PALETTE_LENGTH(768)
+	MDRV_COLORTABLE_LENGTH(768 + 16*256)
 
-	MDRV_SCREEN_REFRESH_RATE(57)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(nmk16)
+	MDRV_PALETTE_INIT(grdnstrm)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( popspops )
+
+	/* basic machine hardware */
+	MDRV_IMPORT_FROM(stagger1)
 
 	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(512, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross2)
-	MDRV_PALETTE_LENGTH(1024)
+	MDRV_GFXDECODE(grdnstrm)
+	MDRV_PALETTE_LENGTH(768)
+	MDRV_COLORTABLE_LENGTH(768 + 16*256)
 
-	MDRV_VIDEO_START(macross2)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
+	MDRV_PALETTE_INIT(grdnstrm)
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
+	MDRV_VIDEO_UPDATE(bubl2000)
+MACHINE_DRIVER_END
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_interface)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+static MACHINE_DRIVER_START( bubl2000 )
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
+	/* basic machine hardware */
+	MDRV_IMPORT_FROM(grdnstrm)
+
+	/* video hardware */
+	MDRV_VIDEO_UPDATE(bubl2000)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( tdragon2 )
+static MACHINE_DRIVER_START( firehawk )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz  */
-	MDRV_CPU_PROGRAM_MAP(macross2_readmem,macross2_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
-
-	MDRV_CPU_ADD(Z80, 4000000)
-	/* audio CPU */ /* 4 MHz  */
-	MDRV_CPU_PROGRAM_MAP(macross2_sound_readmem,macross2_sound_writemem)
-	MDRV_CPU_IO_MAP(macross2_sound_readport,macross2_sound_writeport)
+	MDRV_CPU_ADD(M68000,12000000)
+	MDRV_CPU_PROGRAM_MAP(afega,0)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
 
-	MDRV_SCREEN_REFRESH_RATE(57)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(nmk16)
+	MDRV_CPU_ADD(Z80,4000000)
+	/* audio CPU */
+	MDRV_CPU_PROGRAM_MAP(firehawk_sound_cpu,0)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
+	MDRV_SCREEN_REFRESH_RATE(56)
+	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(512, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross2)
-	MDRV_PALETTE_LENGTH(1024)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
 
-	MDRV_VIDEO_START(tdragon2)
+	MDRV_GFXDECODE(grdnstrm)
+	MDRV_PALETTE_LENGTH(768)
+	MDRV_COLORTABLE_LENGTH(768 + 16*256)
+
+	MDRV_PALETTE_INIT(grdnstrm)
+	MDRV_VIDEO_START(firehawk)
+	MDRV_VIDEO_UPDATE(firehawk)
 	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(macross)
 
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_interface)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
+	MDRV_SOUND_ADD(OKIM6295, 1000000)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
+	MDRV_SOUND_ADD(OKIM6295, 1000000)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
 MACHINE_DRIVER_END
 
-static MACHINE_DRIVER_START( raphero )
+
+
+static MACHINE_DRIVER_START( twinactn )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 14000000) /* 14 MHz measured */
-	MDRV_CPU_PROGRAM_MAP(macross2_readmem,raphero_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
+	MDRV_CPU_ADD(M68000,12000000)
+	MDRV_CPU_PROGRAM_MAP(twinactn_map,0)
+	MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
 	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
 
-	MDRV_CPU_ADD_TAG("sound",TMP90841, 8000000)
-	MDRV_CPU_PROGRAM_MAP(raphero_sound_mem_map,0)
+	MDRV_CPU_ADD(Z80, 4000000)
+	MDRV_CPU_PROGRAM_MAP(twinactn_sound_cpu,0)
 
-	MDRV_SCREEN_REFRESH_RATE(56) // measured
+	MDRV_SCREEN_REFRESH_RATE(56)
 	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(nmk16)
 
 	/* video hardware */
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(512, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(macross2)
+	MDRV_SCREEN_SIZE(256, 256)
+	MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
+	MDRV_GFXDECODE(macross)
 	MDRV_PALETTE_LENGTH(1024)
 
-	MDRV_VIDEO_START(macross2)
+	MDRV_VIDEO_START(macross)
 	MDRV_VIDEO_EOF(nmk)
 	MDRV_VIDEO_UPDATE(macross)
 
+
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 1500000)
-	MDRV_SOUND_CONFIG(ym2203_interface)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
+	MDRV_SOUND_ADD(OKIM6295, 1000000)
+	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+MACHINE_DRIVER_END
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
-MACHINE_DRIVER_END
+/***************************************************************************
 
-static MACHINE_DRIVER_START( bjtwin )
 
-	/* basic machine hardware */
-	MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz? It's a P12, but xtals are 10MHz and 16MHz */
-	MDRV_CPU_PROGRAM_MAP(bjtwin_readmem,bjtwin_writemem)
-	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
-	MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
+                                ROMs Loading
 
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET(nmk16)
 
-	/* video hardware */
-	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_SIZE(512, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
-	MDRV_GFXDECODE(bjtwin)
-	MDRV_PALETTE_LENGTH(1024)
+***************************************************************************/
 
-	MDRV_VIDEO_START(bjtwin)
-	MDRV_VIDEO_EOF(nmk)
-	MDRV_VIDEO_UPDATE(bjtwin)
+/* Address lines scrambling */
 
-	/* sound hardware */
-	MDRV_SPEAKER_STANDARD_MONO("mono")
+static void decryptcode( int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12,
+	int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 )
+{
+	int i;
+	UINT8 *RAM = memory_region( REGION_CPU1 );
+	size_t  size = memory_region_length( REGION_CPU1 );
+	UINT8 *buffer = malloc_or_die( size );
+
+		memcpy( buffer, RAM, size );
+		for( i = 0; i < size; i++ )
+		{
+			RAM[ i ] = buffer[ BITSWAP24( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
+				a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0 ) ];
+		}
+		free( buffer );
+}
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
 
-	MDRV_SOUND_ADD(OKIM6295, 16000000/4)
-	MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
-MACHINE_DRIVER_END
 
 ROM_START( vandyke )
 	ROM_REGION( 0x40000, REGION_CPU1, 0 )		/* 68000 code */
@@ -4817,350 +6271,652 @@
 	ROM_LOAD16_BYTE( "1-u33.bin",  0x00001, 0x20000, CRC(07473154) SHA1(e67f637e74dfe5f1be558f963c0b3225254afe33) )
 	ROM_LOAD16_BYTE( "2-u35.bin",  0x00000, 0x20000, CRC(04acd8c1) SHA1(3ef329e8d25565c7f7166f12137f4df5a057022f) )
 
-	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80? CPU */
-	ROM_LOAD( "3-u146.bin",      0x00000, 0x10000, CRC(7bf5fafa) SHA1(d17feca628775860d6c7019a9725bd40fbc5b7d7) )
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80? CPU */
+	ROM_LOAD( "3-u146.bin",      0x00000, 0x10000, CRC(7bf5fafa) SHA1(d17feca628775860d6c7019a9725bd40fbc5b7d7) )
+
+	ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )
+	ROM_LOAD( "12-u39.bin",    0x000000, 0x10000, CRC(413b5438) SHA1(af366ce998ebe0d25255cc0cb1cd81689d3696ec) )	/* 8x8 tiles */
+
+	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )
+	ROM_LOAD( "5-u97.bin", 0x000000, 0x40000, CRC(536699e6) SHA1(13ec233f5e4f2a65ac7bc55511e988508269acd5) )
+	ROM_LOAD( "4-u96.bin", 0x040000, 0x40000, CRC(28af2640) SHA1(08fa57de66cf58fe2256455538261c2d05d27e1e) )
+
+	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE ) /* 16x16 sprite tiles */
+	ROM_LOAD16_BYTE( "8-u54b.bin",  0x000000, 0x20000, CRC(03eede77) SHA1(2476a488bb0d39790b2cc7f261ddb973378022ff) )
+	ROM_LOAD16_BYTE( "10-u86b.bin", 0x000001, 0x20000, CRC(9eab216f) SHA1(616f3ee2d06aa7151af634773a5e8633bff9588e) )
+	ROM_LOAD16_BYTE( "9-u53b.bin",  0x040000, 0x20000, CRC(dfcfa040) SHA1(f1561defe9746afdb1a5327d0a4435a6f3e87a77) )
+	ROM_LOAD16_BYTE( "11-u85b.bin", 0x040001, 0x20000, CRC(fe747dd5) SHA1(6ba57a45f4d77e2574de95d4a2f0718c601e7214) )
+
+	ROM_REGION( 0xa0000, REGION_SOUND1, 0 )	/* OKIM6295 samples */
+	ROM_LOAD( "6-u131.bin",  0x00000, 0x20000, CRC(79a4ae75) SHA1(f7609d0ca18b4af8c5f37daa1795a7a6c6d768ae) )
+	ROM_CONTINUE(            0x40000, 0x20000 )	/* banked */
+	ROM_LOAD( "7-u132.bin",  0x60000, 0x40000, CRC(21db875e) SHA1(e1d96155b6d8825f7c449f276d02f9769258345d) )	/* banked */
+
+	ROM_REGION( 0xa0000, REGION_SOUND2, ROMREGION_ERASE00 )	/* OKIM6295 samples */
+	/* empty */
+
+	ROM_REGION( 0x0420, REGION_PROMS, 0 )
+	ROM_LOAD( "u200.bpr",    0x0000, 0x0020, CRC(1823600b) SHA1(7011156ebcb815b176856bd67898ce655ea1b5ab) )	/* unknown */
+	ROM_LOAD( "u7.bpr",      0x0020, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) )	/* unknown */
+	ROM_LOAD( "u10.bpr",     0x0120, 0x0200, CRC(8e9b569a) SHA1(1d8d633fbeb72d5e55ad4b282df02e9ca5e240eb) )	/* unknown */
+	ROM_LOAD( "u120.bpr",    0x0320, 0x0100, CRC(576c5984) SHA1(6e9b7f30de0d91cb766a62abc5888ec9af085a27) )	/* unknown */
+ROM_END
+
+
+
+/***************************************************************************
+
+                                    Stagger I
+(AFEGA 1998)
+
+Parts:
+
+1 MC68HC000P10
+1 Z80
+2 Lattice ispLSI 1032E
+
+***************************************************************************/
+
+ROM_START( stagger1 )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x020000, CRC(8555929b) SHA1(b405d81c2a45191111b1a4458ac6b5c0a129b8f1) )
+	ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x020000, CRC(5b0b63ac) SHA1(239f793b6845a88d1630da790a2762da730a450d) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
+
+	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD16_BYTE( "7.bin", 0x00000, 0x80000, CRC(048f7683) SHA1(7235b7dcfbb72abf44e60b114e3f504f16d29ebf) )
+	ROM_LOAD16_BYTE( "6.bin", 0x00001, 0x80000, CRC(051d4a77) SHA1(664182748e72b3e44202caa20f337d02e946ca62) )
+
+	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x4 */
+	ROM_LOAD( "4.bin", 0x00000, 0x80000, CRC(46463d36) SHA1(4265bc4d24ff64e39d9273965701c740d7e3fee0) )
+
+	ROM_REGION( 0x00100, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
+	// Unused
+
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
+ROM_END
+
+
+/***************************************************************************
+
+                            Red Hawk (c)1997 Afega
+
+
+
+    6116         ym2151     MSM6295   5    4MHz
+    1
+    Z80        pLSI1032    4
+                                      76C88
+       6116   76C256                  76C88
+       6116   76C256
+    2  76C256 76C256
+    3  76C256 76C256
+
+    68000-10        6116
+                    6116
+   SW1                             6
+   SW21                pLSI1032    7
+    12MHz
+
+***************************************************************************/
+
+ROM_START( redhawk )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "2", 0x000000, 0x020000, CRC(3ef5f326) SHA1(e89c7c24a05886a14995d7c399958dc00ad35d63) )
+	ROM_LOAD16_BYTE( "3", 0x000001, 0x020000, CRC(9b3a10ef) SHA1(d03480329b23474e5a9e42a75b09d2140eed4443) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
+
+	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD16_BYTE( "6", 0x000001, 0x080000, CRC(61560164) SHA1(d727ab2d037dab40745dec9c4389744534fdf07d) )
+	ROM_LOAD16_BYTE( "7", 0x000000, 0x080000, CRC(66a8976d) SHA1(dd9b89cf29eb5557845599d55ef3a15f53c070a4) )
+
+	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "4", 0x000000, 0x080000, CRC(d6427b8a) SHA1(556de1b5ce29d1c3c54bb315dcaa4dd0848ca462) )
+
+	ROM_REGION( 0x00100, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
+	// Unused
+
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
+ROM_END
+
+static DRIVER_INIT( redhawk )
+{
+	decryptcode( 23, 22, 21, 20, 19, 18, 16, 15, 14, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
+}
+
+ROM_START( redhawkb )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "rhb-1.bin", 0x000000, 0x020000, CRC(e733ea07) SHA1(b1ffeda633d5e701f0e97c79930a54d7b89a85c5) )
+	ROM_LOAD16_BYTE( "rhb-2.bin", 0x000001, 0x020000, CRC(f9fa5684) SHA1(057ea3eebbaa1a208a72beef21b9368df7032ce1) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
+
+	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD( "rhb-3.bin", 0x000000, 0x080000, CRC(0318d68b) SHA1(c773de7b6f9c706e62349dc73af4339d1a3f9af6) )
+	ROM_LOAD( "rhb-4.bin", 0x080000, 0x080000, CRC(ba21c1ef) SHA1(66b0dee67acb5b3a21c7dba057be4093a92e10a9) )
+
+	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "rhb-5.bin", 0x000000, 0x080000, CRC(d0eaf6f2) SHA1(6e946e13b06df897a63e885c9842816ec908a709) )
+
+	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
+
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
+ROM_END
+
+
+/***************************************************************************
+
+                            Sen Jin - Guardian Storm
+
+(C) Afega 1998
+
+CPU: 68HC000FN10 (68000, 68 pin PLCC)
+SND: Z84C000FEC (Z80, 44 pin PQFP), AD-65 (OKI M6295),
+     BS901 (YM2151, 24 pin DIP), BS901 (YM3012, 16 pin DIP)
+OSC: 12.000MHz (near 68000), 4.000MHz (Near Z84000)
+RAM: LH52B256 x 8, 6116 x 7
+DIPS: 2 x 8 position
+
+Other Chips: AFEGA AFI-GFSK (68 pin PLCC, located next to 68000)
+             AFEGA AFI-GFLK (208 pin PQFP)
+
+ROMS:
+GST-01.U92   27C512, \
+GST-02.U95   27C2000  > Sound Related, all located near Z80
+GST-03.U4    27C512  /
+
+GST-04.112   27C2000 \
+GST-05.107   27C2000  /Main Program
+
+GST-06.C13   read as 27C160  label = AF1-SP (Sprites?)
+GST-07.C08   read as 27C160  label = AF1=B2 (Backgrounds?)
+GST-08.C03   read as 27C160  label = AF1=B1 (Backgrounds?)
+
+***************************************************************************/
 
-	ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )
-	ROM_LOAD( "12-u39.bin",    0x000000, 0x10000, CRC(413b5438) SHA1(af366ce998ebe0d25255cc0cb1cd81689d3696ec) )	/* 8x8 tiles */
+ROM_START( grdnstrm )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "gst-04.112", 0x000000, 0x040000, CRC(922c931a) SHA1(1d1511033c8c424535a73f5c5bf58560a8b1842e) )
+	ROM_LOAD16_BYTE( "gst-05.107", 0x000001, 0x040000, CRC(d22ca2dc) SHA1(fa21c8ec804570d64f4b167b7f65fd5811435e46) )
 
-	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )
-	ROM_LOAD( "5-u97.bin", 0x000000, 0x40000, CRC(536699e6) SHA1(13ec233f5e4f2a65ac7bc55511e988508269acd5) )
-	ROM_LOAD( "4-u96.bin", 0x040000, 0x40000, CRC(28af2640) SHA1(08fa57de66cf58fe2256455538261c2d05d27e1e) )
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "gst-01.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
 
-	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE ) /* 16x16 sprite tiles */
-	ROM_LOAD16_BYTE( "8-u54b.bin",  0x000000, 0x20000, CRC(03eede77) SHA1(2476a488bb0d39790b2cc7f261ddb973378022ff) )
-	ROM_LOAD16_BYTE( "10-u86b.bin", 0x000001, 0x20000, CRC(9eab216f) SHA1(616f3ee2d06aa7151af634773a5e8633bff9588e) )
-	ROM_LOAD16_BYTE( "9-u53b.bin",  0x040000, 0x20000, CRC(dfcfa040) SHA1(f1561defe9746afdb1a5327d0a4435a6f3e87a77) )
-	ROM_LOAD16_BYTE( "11-u85b.bin", 0x040001, 0x20000, CRC(fe747dd5) SHA1(6ba57a45f4d77e2574de95d4a2f0718c601e7214) )
+	ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD( "gst-06.c13", 0x000000, 0x200000, CRC(7d4d4985) SHA1(15c6c1aecd3f12050c1db2376f929f1a26a1d1cf) )
 
-	ROM_REGION( 0xa0000, REGION_SOUND1, 0 )	/* OKIM6295 samples */
-	ROM_LOAD( "6-u131.bin",  0x00000, 0x20000, CRC(79a4ae75) SHA1(f7609d0ca18b4af8c5f37daa1795a7a6c6d768ae) )
-	ROM_CONTINUE(            0x40000, 0x20000 )	/* banked */
-	ROM_LOAD( "7-u132.bin",  0x60000, 0x40000, CRC(21db875e) SHA1(e1d96155b6d8825f7c449f276d02f9769258345d) )	/* banked */
+	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "gst-07.c08", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) )
+	ROM_LOAD( "gst-08.c03", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) )
 
-	ROM_REGION( 0xa0000, REGION_SOUND2, ROMREGION_ERASE00 )	/* OKIM6295 samples */
-	/* empty */
+	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
+	ROM_LOAD( "gst-03.u4",  0x00000, 0x10000, CRC(a1347297) SHA1(583f4da991eeedeb523cf4fa3b6900d40e342063) )
 
-	ROM_REGION( 0x0420, REGION_PROMS, 0 )
-	ROM_LOAD( "u200.bpr",    0x0000, 0x0020, CRC(1823600b) SHA1(7011156ebcb815b176856bd67898ce655ea1b5ab) )	/* unknown */
-	ROM_LOAD( "u7.bpr",      0x0020, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) )	/* unknown */
-	ROM_LOAD( "u10.bpr",     0x0120, 0x0200, CRC(8e9b569a) SHA1(1d8d633fbeb72d5e55ad4b282df02e9ca5e240eb) )	/* unknown */
-	ROM_LOAD( "u120.bpr",    0x0320, 0x0100, CRC(576c5984) SHA1(6e9b7f30de0d91cb766a62abc5888ec9af085a27) )	/* unknown */
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "gst-02.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
 ROM_END
 
+static DRIVER_INIT( grdnstrm )
+{
+	decryptcode( 23, 22, 21, 20, 19, 18, 16, 17, 14, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
+}
 
+/* Pop's Pop's */
 
-static UINT8 decode_byte(UINT8 src, const UINT8 *bitp)
-{
-	UINT8 ret, i;
+/*
 
-	ret = 0;
-	for (i=0; i<8; i++)
-		ret |= (((src >> bitp[i]) & 1) << (7-i));
+Pop's Pop's by Afega (1999)
 
-	return ret;
-}
+The pcb might be missing an eprom in a socket
+  --- i just think it uses a generic PCB but no sprites in this case,.
 
-static UINT32 bjtwin_address_map_bg0(UINT32 addr)
-{
-   return ((addr&0x00004)>> 2) | ((addr&0x00800)>> 10) | ((addr&0x40000)>>16);
-}
+1x 68k
+1x z80
+1x Ad65 (oki 6295)
+1x OSC 12mhz (near 68k)
+1x OSC 4mhz (near z80)
+1x ym2151
+1x Afega AF1-CFLK custom chip Smt
+1x Afega AF1-CF5K custom chip socketed
+2x dipswitch banks
 
+*/
 
-static UINT16 decode_word(UINT16 src, const UINT8 *bitp)
-{
-	UINT16 ret, i;
+ROM_START( popspops )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "afega4.u112", 0x000000, 0x040000, CRC(db191762) SHA1(901fdc20374473127d694513d4291e29e65eafe8) )
+	ROM_LOAD16_BYTE( "afega5.u107", 0x000001, 0x040000, CRC(17e0c48b) SHA1(833c61c4b3ee293b0bcddfa86dfa9c1014375115) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "afega1.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
+
+	ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	/* no sprite roms? */
+
+	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "afega6.uc8", 0x000000, 0x200000, CRC(6d506c97) SHA1(4909c0b530f9526c8bf76e502c914ef10a50d1fc) )
+	ROM_LOAD( "afega7.uc3", 0x200000, 0x200000, CRC(02d7f9de) SHA1(10102ffbf37a57afa300b01cb5067b7e672f4999) )
 
-	ret=0;
-	for (i=0; i<16; i++)
-		ret |= (((src >> bitp[i]) & 1) << (15-i));
+	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
+	ROM_LOAD( "afega3.u4",  0x00000, 0x10000, CRC(f39dd5d2) SHA1(80d05d57a621b0063f63ce05be9314f718b3c111) )
 
-	return ret;
-}
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "afega2.u95", 0x00000, 0x40000, CRC(ecd8eeac) SHA1(849beba8f04cc322bb8435fa4c26551a6d0dec64) )
+ROM_END
 
+/*
+Mang-chi by Afega
 
-static UINT32 bjtwin_address_map_sprites(UINT32 addr)
-{
-   return ((addr&0x00010)>> 4) | ((addr&0x20000)>>16) | ((addr&0x100000)>>18);
-}
+1x osc 4mhz
+1x osc 12mhz
+1x tmp68hc0000p-10
+1x z80c006
+1x AD65 (MSM6295)
+1x CY5001 (YM2151 rebadged)
+2x dipswitch
+1x fpga
+1x smd ASIC not marked
 
+Dumped by Corrado Tomaselli
+*/
 
-static void decode_gfx(void)
-{
-	/* GFX are scrambled.  We decode them here.  (BIG Thanks to Antiriad for descrambling info) */
-	UINT8 *rom;
-	int A;
+ROM_START( mangchi )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "afega9.u112", 0x00000, 0x40000, CRC(0b1517a5) SHA1(50e307641759bb2a35aff56ef9598364740803a0) )
+	ROM_LOAD16_BYTE( "afega10.u107", 0x00001, 0x40000, CRC(b1d0f33d) SHA1(68b5be3f7911f7299566c5bf5801e90099433613) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "sound.u92", 0x00000, 0x10000, CRC(bec4f9aa) SHA1(18fb2ee06892983c117a62b70cd72a98f60a08b6) )
+
+	ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD16_BYTE( "afega6.uc11", 0x000000, 0x040000, CRC(979efc30) SHA1(227fe1e20137253aac04585d2bbf67091d032e56) )
+	ROM_LOAD16_BYTE( "afega7.uc14", 0x000001, 0x040000, CRC(c5cbcc38) SHA1(86070a9598e80f90ec7892d623e1a975ccc68178) )
+
+	ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "afega5.uc6",  0x000000, 0x80000, CRC(c73261e0) SHA1(0bb66aa315aaecb26169812cf47a6504a74f0db5) )
+	ROM_LOAD( "afega4.uc1",  0x080000, 0x80000, CRC(73940917) SHA1(070305c81de959c9d00b6cf1cc20bbafa204976a) )
 
-	static const UINT8 decode_data_bg[8][8] =
-	{
-		{0x3,0x0,0x7,0x2,0x5,0x1,0x4,0x6},
-		{0x1,0x2,0x6,0x5,0x4,0x0,0x3,0x7},
-		{0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0},
-		{0x7,0x6,0x5,0x0,0x1,0x4,0x3,0x2},
-		{0x2,0x0,0x1,0x4,0x3,0x5,0x7,0x6},
-		{0x5,0x3,0x7,0x0,0x4,0x6,0x2,0x1},
-		{0x2,0x7,0x0,0x6,0x5,0x3,0x1,0x4},
-		{0x3,0x4,0x7,0x6,0x2,0x0,0x5,0x1},
-	};
+	ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
 
-	static const UINT8 decode_data_sprite[8][16] =
-	{
-		{0x9,0x3,0x4,0x5,0x7,0x1,0xb,0x8,0x0,0xd,0x2,0xc,0xe,0x6,0xf,0xa},
-		{0x1,0x3,0xc,0x4,0x0,0xf,0xb,0xa,0x8,0x5,0xe,0x6,0xd,0x2,0x7,0x9},
-		{0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0},
-		{0xf,0xe,0xc,0x6,0xa,0xb,0x7,0x8,0x9,0x2,0x3,0x4,0x5,0xd,0x1,0x0},
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "afega2.u95", 0x00000, 0x40000, CRC(78c8c1f9) SHA1(eee0d03164a0ac0ddc5186ab56090320e9d33aa7) )
+ROM_END
 
-		{0x1,0x6,0x2,0x5,0xf,0x7,0xb,0x9,0xa,0x3,0xd,0xe,0xc,0x4,0x0,0x8}, /* Haze 20/07/00 */
-		{0x7,0x5,0xd,0xe,0xb,0xa,0x0,0x1,0x9,0x6,0xc,0x2,0x3,0x4,0x8,0xf}, /* Haze 20/07/00 */
-		{0x0,0x5,0x6,0x3,0x9,0xb,0xa,0x7,0x1,0xd,0x2,0xe,0x4,0xc,0x8,0xf}, /* Antiriad, Corrected by Haze 20/07/00 */
-		{0x9,0xc,0x4,0x2,0xf,0x0,0xb,0x8,0xa,0xd,0x3,0x6,0x5,0xe,0x1,0x7}, /* Antiriad, Corrected by Haze 20/07/00 */
-	};
+/***************************************************************************
 
+                            Bubble 2000 (c)1998 Tuning
 
-	/* background */
-	rom = memory_region(REGION_GFX2);
-	for (A = 0;A < memory_region_length(REGION_GFX2);A++)
-	{
-		rom[A] = decode_byte( rom[A], decode_data_bg[bjtwin_address_map_bg0(A)]);
-	}
+Bubble 2000
+Tuning, 1998
 
-	/* sprites */
-	rom = memory_region(REGION_GFX3);
-	for (A = 0;A < memory_region_length(REGION_GFX3);A += 2)
-	{
-		UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_sprite[bjtwin_address_map_sprites(A)]);
-		rom[A+1] = tmp >> 8;
-		rom[A] = tmp & 0xff;
-	}
-}
+CPU   : TMP68HC000P-10 (68000)
+SOUND : Z840006 (Z80, 44 pin QFP), YM2151, OKI M6295
+OSC   : 4.000MHZ, 12.000MHz
+DIPSW : 8 position (x2)
+RAM   : 6116 (x5, gfx related?) 6116 (x1, sound program ram), 6116 (x1, near rom3)
+        64256 (x4, gfx related?), 62256 (x2, main program ram), 6264 (x2, gfx related?)
+PALs/PROMs: None
+Custom: Unknown 208 pin QFP labelled LTC2 (Graphics generator)
+        Unknown 68 pin PLCC labelled LTC1 (?, near rom 2 and rom 3)
+ROMs  :
+
+Filename    Type        Possible Use
+----------------------------------------------
+rom01.92    27C512      Sound Program
+rom02.95    27C020      Oki Samples
+rom03.4     27C512      ? (located near rom 1 and 2 and near LTC1)
+rom04.1     27C040   \
+rom05.3     27C040    |
+rom06.6     27C040    |
+rom07.9     27C040    | Gfx
+rom08.11    27C040    |
+rom09.14    27C040    |
+rom12.2     27C040    |
+rom13.7     27C040   /
+
+rom10.112   27C040   \  Main Program
+rom11.107   27C040   /
+
+
+
+
+***************************************************************************/
+
+ROM_START( bubl2000 )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "rom10.112", 0x00000, 0x20000, CRC(87f960d7) SHA1(d22fe1740217ac20963bd9003245850598ccecf2) )
+	ROM_LOAD16_BYTE( "rom11.107", 0x00001, 0x20000, CRC(b386041a) SHA1(cac36e22a39b5be0c5cd54dce5c912ff811edb28) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "rom01.92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) /* same as the other games on this driver */
+
+	ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD16_BYTE( "rom08.11", 0x000000, 0x040000, CRC(519dfd82) SHA1(116b06f6e7b283a5417338f716bbaab6cfadb41d) )
+	ROM_LOAD16_BYTE( "rom09.14", 0x000001, 0x040000, CRC(04fcb5c6) SHA1(7594fa6bf98fc01b8848473a222a621c7c9ff00d) )
+
+	ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "rom06.6",  0x000000, 0x080000, CRC(ac1aabf5) SHA1(abce6ba381b189ab3ec703a8ef74bccbe10876e0) )
+	ROM_LOAD( "rom07.9",  0x080000, 0x080000, CRC(69aff769) SHA1(89b98c1023710861e622c8a186b6ec48f5109d42) )
+	ROM_LOAD( "rom13.7",  0x100000, 0x080000, CRC(3a5b7226) SHA1(1127740c5bc2f830d73a77c8831e1b0db6606375) )
+	ROM_LOAD( "rom04.1",  0x180000, 0x080000, CRC(46acd054) SHA1(1bd7a1b6b2ce6a3daa8c92843c546beb377af8fb) )
+	ROM_LOAD( "rom05.3",  0x200000, 0x080000, CRC(37deb6a1) SHA1(3a8a3d961800bb15fd389429b92fa1e5b5f416df) )
+	ROM_LOAD( "rom12.2",  0x280000, 0x080000, CRC(1fdc59dd) SHA1(d38e21c878241b4315a36e0590397211ca63f2c4) )
 
-static void decode_tdragonb(void)
-{
-	/* Descrambling Info Again Taken from Raine, Huge Thanks to Antiriad and the Raine Team for
-       going Open Source, best of luck in future development. */
+	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
+	ROM_LOAD( "rom03.4",  0x00000, 0x10000, CRC(f4c15588) SHA1(a21ae71c0a8c7c1df63f9905fd86303bc2d3991c) )
 
-	UINT8 *rom;
-	int A;
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "rom02.95", 0x00000, 0x40000, CRC(859a86e5) SHA1(7b51964227411a40aac54b9cd9ff64f091bdf2b0) )
+ROM_END
 
-	/* The Main 68k Program of the Bootleg is Bitswapped */
-	static const UINT8 decode_data_tdragonb[1][16] =
-	{
-		{0xe,0xc,0xa,0x8,0x7,0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x6,0x4,0x2,0x0},
-	};
 
-	/* Graphic Roms Could Also Do With Rearranging to make things simpler */
-	static const UINT8 decode_data_tdragonbgfx[1][8] =
-	{
-		{0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
-	};
+/*
 
-	rom = memory_region(REGION_CPU1);
-	for (A = 0;A < memory_region_length(REGION_CPU1);A += 2)
-	{
-#ifdef LSB_FIRST
-		UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_tdragonb[0]);
-		rom[A+1] = tmp >> 8;
-		rom[A] = tmp & 0xff;
-#else
-		UINT16 tmp = decode_word( rom[A]*256 + rom[A+1], decode_data_tdragonb[0]);
-		rom[A] = tmp >> 8;
-		rom[A+1] = tmp & 0xff;
-#endif
-	}
+Hot Bubble
+Afega, 1998
 
-	rom = memory_region(REGION_GFX2);
-	for (A = 0;A < memory_region_length(REGION_GFX2);A++)
-	{
-		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
-	}
+PCB Layout
+----------
 
-	rom = memory_region(REGION_GFX3);
-	for (A = 0;A < memory_region_length(REGION_GFX3);A++)
-	{
-		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
-	}
-}
+Bottom Board
 
-static void decode_ssmissin(void)
-{
-	/* Like Thunder Dragon Bootleg without the Program Rom Swapping */
-	UINT8 *rom;
-	int A;
+|------------------------------------------|
+| BS902  BS901   Z80                  4MHz |
+|                                          |
+|        6116    6295                      |
+|                                   62256  |
+|      6116                         62256  |
+|      6116                                |
+|J           6116           |------------| |
+|A           6116           |   68000    | |
+|M                          |------------| |
+|M  DSW2   6264                            |
+|A         6264                            |
+|                                          |
+|         |-------|                        |
+|         |       |                        |
+|         |       |                        |
+| DSW1    |       |     62256   62256      |
+|         |-------|                        |
+|              6116     62256   62256      |
+|12MHz         6116                        |
+|------------------------------------------|
+Notes:
+      68000 - running at 12.000MHz
+      Z80   - running at 4.000MHz
+      62256 - 32K x8 SRAM
+      6264  - 8K x8 SRAM
+      6116  - 2K x8 SRAM
+      BS901 - YM2151, running at 4.000MHz
+      BS902 - YM3012
+      6295  - OKI MSM6295 running at 1.000MHz [4/4], sample rate = 1000000 / 132
+      *     - Unknown QFP208
+      VSync - 56.2Hz (measured on 68000 IPL1)
+
+Top Board
+
+|---------------------------|
+|                           |
+|   S1     S2        T1     |
+|                           |
+|   CR5    CR7       C1     |
+|                           |
+|   CR6   +CR8       C2     |
+|                           |
+|          BR1       BR3    |
+|                           |
+|         +BR2      +BR4    |
+|                           |
+|  CR1     CR3     |------| |
+|                  |  *   | |
+|  CR2    +CR4     |      | |
+|                  |------| |
+|---------------------------|
+Notes:
+      * - Unknown PLCC68 IC
+      + - Not populated
 
-	/* Graphic Roms Could Also Do With Rearranging to make things simpler */
-	static const UINT8 decode_data_tdragonbgfx[1][8] =
-	{
-		{0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
-	};
+*/
 
-	rom = memory_region(REGION_GFX2);
-	for (A = 0;A < memory_region_length(REGION_GFX2);A++)
-	{
-		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
-	}
+ROM_START( hotbubl )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "c1.uc1",  0x00001, 0x40000, CRC(7bb240e9) SHA1(99048fa275182c3da3bfb0dedd790f4b5858bd92) )
+	ROM_LOAD16_BYTE( "c2.uc9",  0x00000, 0x40000, CRC(7917b95d) SHA1(0344bae9c373c5943e7693720e5e531bc2e0d7ee) )
+
+	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "s1.uc14", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) /* same as the other games on this driver */
+
+	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD16_BYTE( "br1.uc3",  0x000000, 0x080000, CRC(6fc18de4) SHA1(57b4823fc41637780f64eadd1ddf61db531a2599) )
+	ROM_LOAD16_BYTE( "br3.uc10", 0x000001, 0x080000, CRC(bb677240) SHA1(d7a26bcd33d491cee441edda6d092a1d08308b0e) )
+
+	ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "cr6.uc16",  0x100000, 0x080000, CRC(99d6523c) SHA1(0b628585d749e175d5a4dc600af1ba9cb936bfeb) )
+	ROM_LOAD( "cr7.uc19",  0x080000, 0x080000, CRC(a89d9ce4) SHA1(5965b2b4b67bc91bc0e7474e593c7e1953b75adc) )
+	ROM_LOAD( "cr5.uc15",  0x000000, 0x080000, CRC(65bd5159) SHA1(627ccc0ab131e643c3c52ee9bb41c7a85153c35e) )
+
+	ROM_LOAD( "cr2.uc7",  0x280000, 0x080000, CRC(27ad6fc8) SHA1(00b1a5c5e1a245590b300b9baf71585d41813e3e) )
+	ROM_LOAD( "cr3.uc12", 0x200000, 0x080000, CRC(c841a4f6) SHA1(9b0ee5623c87a0cfc63d3741a65d399bd6593f18) )
+	ROM_LOAD( "cr1.uc6",  0x180000, 0x080000, CRC(fc9101d2) SHA1(1d5b8484264b6d73fe032946096a469226cce901) )
 
-	rom = memory_region(REGION_GFX3);
-	for (A = 0;A < memory_region_length(REGION_GFX3);A++)
-	{
-		rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
-	}
-}
+	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
+	ROM_LOAD( "t1.uc2",  0x00000, 0x10000, CRC(ce683a93) SHA1(aeee2671051f1badf2255375cd7c5fa847d1746c) )
 
+	ROM_REGION( 0x40000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "s2.uc18", 0x00000, 0x40000, CRC(401c980f) SHA1(e47710c47cfeecce3ccf87f845b219a9c9f21ee3) )
+ROM_END
 
-static DRIVER_INIT( nmk )
+static DRIVER_INIT( bubl2000 )
 {
-	decode_gfx();
+	decryptcode( 23, 22, 21, 20, 19, 18, 13, 14, 15, 16, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
 }
 
-static DRIVER_INIT( hachamf )
-{
-	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+/*
 
-	//rom[0x0006/2] = 0x7dc2;   /* replace reset vector with the "real" one */
+Fire Hawk - ESD
+---------------
 
-	// kludge the sound communication to let commands go through.
-	rom[0x048a/2] = 0x4e71;
-	rom[0x04aa/2] = 0x4e71;
-}
+- To enter test mode, hold on button 1 at boot up
 
-static DRIVER_INIT( tdragonb )
-{
-	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
 
-	decode_tdragonb();
+PCB Layout
+----------
 
-	/* The Following Patch is taken from Raine, Otherwise the game has no Sprites in Attract Mode or After Level 1
-       which is rather odd considering its a bootleg.. */
-	rom[0x00308/2] = 0x4e71; /* Sprite Problem */
-}
+ESD-PROT-002
+|------------------------------------------------|
+|      FHAWK_S1.U40   FHAWK_S2.U36               |
+|      6116     6295  FHAWK_S3.U41               |
+|               6295                 FHAWK_G1.UC6|
+|    PAL   Z80                       FHAWK_G2.UC5|
+|    4MHz                             |--------| |
+|                                     | ACTEL  | |
+|J   6116             62256           |A54SX16A| |
+|A   6116             62256           |        | |
+|M                                    |(QFP208)| |
+|M                                    |--------| |
+|A     DSW1              FHAWK_G3.UC2            |
+|      DSW2                           |--------| |
+|      DSW3                           | ACTEL  | |
+|                     6116            |A54SX16A| |
+|                     6116            |        | |
+|      62256                          |(QFP208)| |
+| FHAWK_P1.U59                        |--------| |
+| FHAWK_P2.U60  PAL                  62256  62256|
+|                                                |
+|12MHz 62256   68000                 62256  62256|
+|------------------------------------------------|
+Notes:
+      68000 clock: 12.000MHz
+        Z80 clock: 4.000MHz
+      6295 clocks: 1.000MHz (both), sample rate = 1000000 / 132 (both)
+            VSync: 56Hz
 
-static DRIVER_INIT( tdragon )
-{
-	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+*/
 
-	//rom[0x94b0/2] = 0; /* Patch out JMP to shared memory (protection) */
-	//rom[0x94b2/2] = 0x92f4;
+ROM_START( firehawk )
+	ROM_REGION( 0x100000, REGION_CPU1, 0 )	/* 68000 Code */
+	ROM_LOAD16_BYTE( "fhawk_p1.u59", 0x00001, 0x80000, CRC(d6d71a50) SHA1(e947720a0600d049b7ea9486442e1ba5582536c2) )
+	ROM_LOAD16_BYTE( "fhawk_p2.u60", 0x00000, 0x80000, CRC(9f35d245) SHA1(5a22146f16bff7db924550970ed2a3048bc3edab) )
 
-	// kludge the sound communication to let commands go through.
-	rom[0x048a/2] = 0x4e71;
-	rom[0x04aa/2] = 0x4e71;
-}
+	ROM_REGION( 0x20000, REGION_CPU2, 0 )	/* Z80 Code */
+	ROM_LOAD( "fhawk_s1.u40", 0x00000, 0x20000, CRC(c6609c39) SHA1(fe9b5f6c3ab42c48cb493fecb1181901efabdb58) )
 
-static DRIVER_INIT( ssmissin )
-{
-	decode_ssmissin();
-}
+	ROM_REGION( 0x200000, REGION_GFX1,ROMREGION_DISPOSE ) /* Sprites, 16x16x4 */
+	ROM_LOAD( "fhawk_g3.uc2", 0x00000, 0x200000,  CRC(cae72ff4) SHA1(7dca7164015228ea039deffd234778d0133971ab) )
 
+	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layer 0, 16x16x8 */
+	ROM_LOAD( "fhawk_g1.uc6", 0x000000, 0x200000, CRC(2ab0b06b) SHA1(25362f6a517f188c62bac28b1a7b7b49622b1518) )
+	ROM_LOAD( "fhawk_g2.uc5", 0x200000, 0x200000, CRC(d11bfa20) SHA1(15142004ab49f7f1e666098211dff0835c61df8d) )
 
-int is_blkheart;
+	ROM_REGION( 0x00100, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
+	// Unused
 
-// see raine's games/nmk.c
+	ROM_REGION( 0x040000, REGION_SOUND1, 0 ) /* Samples */
+	ROM_LOAD( "fhawk_s2.u36", 0x00000, 0x40000, CRC(d16aaaad) SHA1(96ca173ca433164ed0ae51b41b42343bd3cfb5fe) )
 
-static WRITE16_HANDLER ( test_2a_w )
-{
-	data = data >> 8;
+	ROM_REGION( 0x040000, REGION_SOUND2, 0 ) /* Samples */
+	ROM_LOAD( "fhawk_s3.u41", 0x00000, 0x40000, CRC(3fdcfac2) SHA1(c331f2ea6fd682cfb00f73f9a5b995408eaab5cf) )
+ROM_END
 
-	ram[0x2a/2] = (data << 8) | data;
+/*
 
-	if (data == 1 || data == 2) {
-		ram[0x68/2] = 11;
-		ram[0x6a/2] = 0;
-	}
-}
+CPU
+1x unknown custom chip
+1x FPGA
+1x oscillator 4.000MHz
+1x oscillator 12.000MHz
+2x AD-65
+
+ROMs
+1x TMS27C512 (1)
+1x MX27C4000 (3)
+2x TMS27C010A (2,4)
+2x TMS27C020 (5,6)
+3x MX29F1610ML (uc1,uc2,uc3)
+
+Note
+1x JAMMA connector
+1x trimmer (volume)
+2x8 dip switches
 
-static WRITE16_HANDLER ( test_2a_mustang_w )
-{
-	data = data >> 8;
+*/
 
-	ram[0x2a/2] = (data << 8) | data;
+ROM_START( spec2k )
+	ROM_REGION( 0x80000, REGION_CPU1, 0 )	/* 68000 Code */
+	ROM_LOAD16_BYTE( "yonatech5.u124", 0x00000, 0x40000, CRC(72ab5c05) SHA1(182a811982b89b8cda0677547ef0625c274f5c6b) )
+	ROM_LOAD16_BYTE( "yonatech6.u120", 0x00001, 0x40000, CRC(7e44bd9c) SHA1(da59685be14a09ec037743fcec34fb293f7d588d) )
 
-	if (data == 1 || data == 2) {
-		ram[0x2e/2] = 10;
-		ram[0x2c/2] = 0;
-	}
+	ROM_REGION( 0x20000, REGION_CPU2, 0 )	/* Z80 Code */
+	ROM_LOAD( "yonatech1.u103", 0x00000, 0x10000, CRC(ef5acda7) SHA1(e55b36a1598ecbbbad984997d61599dfa3958f60) )
 
-}
+	ROM_REGION( 0x200000, REGION_GFX1,ROMREGION_DISPOSE ) /* Sprites, 16x16x4 */
+	ROM_LOAD( "u154.bin", 0x00000, 0x200000, CRC(f77b764e) SHA1(37e249bd4d7174c5232261880ce8debf42723716) )
 
-static DRIVER_INIT( blkheart )
-{
-	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE ) /* Layer 0, 16x16x8 */
+	ROM_LOAD( "u153.bin", 0x000000, 0x200000, CRC(a00bbf8f) SHA1(622f52ef50d52cdd5e6b250d68439caae5c13404) )
+	ROM_LOAD( "u152.bin", 0x200000, 0x200000, CRC(f6423fab) SHA1(253e0791eb58efa1df42e9c74d397e6e65c8c252) )
 
-	is_blkheart = 1; // sprite enable is different?
+	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE | ROMREGION_ERASEFF )	/* Layer 1, 8x8x4 */
+	ROM_LOAD( "yonatech4.u3", 0x00000, 0x20000, CRC(5626b08e) SHA1(63207ed6b4fc8684690bf3fe1991a4f3babd73e8) )
 
-   // see raine's games/nmk.c
-	rom[0x872/2] = 0x4e71;
-   	rom[0x874/2] = 0x4e71;
-   	rom[0x876/2] = 0x4e71;
-   	rom[0x8d6/2] = 0x0300;
-   	rom[0xe1c/2] = 0x0300;
-   	rom[0x23dc/2] = 0x0300;
-   	rom[0x3dea/2] = 0x0300;
+	ROM_REGION( 0x020000, REGION_SOUND1, 0 ) /* Samples */
+	ROM_LOAD( "yonatech2.u101", 0x00000, 0x20000, CRC(4160f172) SHA1(0478a5a4bbba115e6cfb5501aa55aa2836c963bf) )
 
-	memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf902a, 0xf902b, 0, 0, test_2a_w );
-}
+	ROM_REGION( 0x080000, REGION_SOUND2, 0 ) /* Samples */
+	ROM_LOAD( "yonatech3.u106", 0x00000, 0x80000, CRC(6644c404) SHA1(b7ad3f9f08971432d024ef8be3fa3140f0bbae67) )
+ROM_END
 
-static DRIVER_INIT( mustang )
+static DRIVER_INIT( spec2k )
 {
-	UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
+	decryptcode( 23, 22, 21, 20,
+		         19, 18, 17, 13,
+	             14, 15, 16, 12,
+		         11, 10, 9,  8,
+		         7,  6,  5,  4,
+	             3,  2,  1,  0 );
+}
 
-	is_blkheart = 1; // sprite enable is different?
+/*
+    1995, Afega
 
-   // see raine's games/nmk.c
-	rom[0x85c/2] = 0x4e71;
-	rom[0x85e/2] = 0x4e71;
-	rom[0x860/2] = 0x4e71;
-	rom[0x8c0/2] = 0x0300;
-	rom[0xc00/2] = 0x0300;
-	rom[0x30b2/2] = 0x0300;
+    1x TMP68000P-10 (main)
+    1x GOLDSTAR Z8400A (sound)
+    1x AD-65 (equivalent to OKI6295)
+    1x LATTICE pLSI 1032 60LJ A428A48
+    1x oscillator 8.000MHz
+    1x oscillator 12.000MHz
+
+    1x 27256 (SU6)
+    1x 27C010 (SU12)
+    1x 27C020 (SU13)
+    2x 27c4001 (UB11, UB13)
+    3x 27C010 (UJ11, UJ12, UJ13)
+    1x 27C4001 (UI20)
 
-	memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf902a, 0xf902b, 0, 0, test_2a_mustang_w );
-}
+    1x JAMMA edge connector
+    1x trimmer (volume)
+*/
 
-static DRIVER_INIT( bjtwin )
-{
-	driver_init_nmk(machine);
+ROM_START( twinactn )
+	ROM_REGION( 0x40000, REGION_CPU1, 0 )		/* 68000 Code */
+	ROM_LOAD16_BYTE( "afega.uj13", 0x00000, 0x20000, CRC(9187701d) SHA1(1da8d1e3969f60c7b0521cd22c723cb51619df9d) )
+	ROM_LOAD16_BYTE( "afega.uj12", 0x00001, 0x20000, CRC(fe8cff9c) SHA1(a1a04deff9e2cb54c69601898cf4e5133c2bc437) )
+
+	ROM_REGION( 0x8000, REGION_CPU2, 0 )		/* Z80 Code */
+	ROM_LOAD( "afega.su6", 0x0000, 0x8000, CRC(3a52dc88) SHA1(87941987d34d93df6df9ff33ccfbd1f5d4a39c51) )	// 1111xxxxxxxxxxx = 0x00
+
+	ROM_REGION( 0x100000, REGION_GFX3, ROMREGION_DISPOSE )	/* Sprites, 16x16x4 */
+	ROM_LOAD16_BYTE( "afega.ub11", 0x00000, 0x80000, CRC(287f20d8) SHA1(11faa36b97593c0b5cee70343750ae1ecd2f5b71) )
+	ROM_LOAD16_BYTE( "afega.ub13", 0x00001, 0x80000, CRC(f525f819) SHA1(78ffcb709a3a900d3851392630a11ab58fc0bc75) )
+
+	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )	/* Layer 0, 16x16x8 */
+	ROM_LOAD( "afega.ui20", 0x00000, 0x80000, CRC(237c8f92) SHA1(bb3131b450bd78d03b789626a465fb9e7a4604a7) )
+
+	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )	/* Layer 1, 8x8x4 */
+	ROM_LOAD( "afega.uj11", 0x00000, 0x20000, CRC(3f439e92) SHA1(27e5b1b0aa3b13fa35e3f83793037314b2942aa2) )
+
+	ROM_REGION( 0x100000, REGION_SOUND1, 0 )	/* Samples */
+	ROM_LOAD( "afega.su12", 0x000000, 0x20000, CRC(91d665f3) SHA1(10b5b07ed28ea78b6d3493afc03e003a8468c007) )
+	ROM_RELOAD(             0x040000, 0x20000 )
+	ROM_RELOAD(             0x080000, 0x20000 )
+	ROM_RELOAD(             0x0c0000, 0x20000 )
+	ROM_RELOAD(             0x020000, 0x20000 )
+	ROM_RELOAD(             0x060000, 0x20000 )
+	ROM_LOAD( "afega.su13", 0x0a0000, 0x20000, CRC(30e1c306) SHA1(c859f11fd329793b11e96264e91c79a557b488a4) )
+	ROM_CONTINUE(           0x0e0000, 0x20000 )
+ROM_END
 
-	/* Patch rom to enable test mode */
 
-/*  008F54: 33F9 0008 0000 000F FFFC move.w  $80000.l, $ffffc.l
- *  008F5E: 3639 0008 0002           move.w  $80002.l, D3
- *  008F64: 3003                     move.w  D3, D0             \
- *  008F66: 3203                     move.w  D3, D1             |   This code remaps
- *  008F68: 0041 BFBF                ori.w   #-$4041, D1        |   buttons 2 and 3 to
- *  008F6C: E441                     asr.w   #2, D1             |   button 1, so
- *  008F6E: 0040 DFDF                ori.w   #-$2021, D0        |   you can't enter
- *  008F72: E240                     asr.w   #1, D0             |   service mode
- *  008F74: C640                     and.w   D0, D3             |
- *  008F76: C641                     and.w   D1, D3             /
- *  008F78: 33C3 000F FFFE           move.w  D3, $ffffe.l
- *  008F7E: 207C 000F 9000           movea.l #$f9000, A0
- */
 
-//  data 16_t *rom = (UINT16 *)memory_region(REGION_CPU1);
-//  rom[0x09172/2] = 0x6006;    /* patch checksum error */
-//  rom[0x08f74/2] = 0x4e71);
-}
+/***************************************************************************
+
+
+                                Game Drivers
 
-/* NO NMK004, it has a PIC instead */
-static READ16_HANDLER( vandykeb_r ) { return 0x0000; };
-static DRIVER_INIT (vandykeb)
-{
-	memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x08000e, 0x08000f, 0, 0, vandykeb_r );
-	memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x08001e, 0x08001f, 0, 0, MWA16_NOP );
-}
 
-GAME( 1989, tharrier, 0,       tharrier, tharrier, 0, 		 ROT270, "UPL (American Sammy license)",    "Task Force Harrier", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
-GAME( 1989, tharierj, tharrier,tharrier, tharrier, 0, 		 ROT270, "UPL",                             "Task Force Harrier (Japan)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
-GAME( 1990, mustang,  0,       mustang,  mustang,  mustang,  ROT0,   "UPL",							    "US AAF Mustang (Japan)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND) // Playable but there are Still Protection Problems
-GAME( 1990, mustangs, mustang, mustang,  mustang,  mustang,  ROT0,   "UPL (Seoul Trading license)",	    "US AAF Mustang (Seoul Trading)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) // Playable but there are Still Protection Problems
+***************************************************************************/
+
+
+GAME( 1989, tharrier, 0,       tharrier, tharrier, 0, 		 ROT270, "UPL (American Sammy license)",    "Task Force Harrier", 0  )
+GAME( 1989, tharierj, tharrier,tharrier, tharrier, 0, 		 ROT270, "UPL",                             "Task Force Harrier (Japan)", 0 )
+GAME( 1990, mustang,  0,       mustang,  mustang,  0,        ROT0,   "UPL",							    "US AAF Mustang (Japan)", GAME_IMPERFECT_SOUND)
+GAME( 1990, mustangs, mustang, mustang,  mustang,  0,        ROT0,   "UPL (Seoul Trading license)",	    "US AAF Mustang (Seoul Trading)", GAME_IMPERFECT_SOUND )
 GAME( 1990, bioship,  0,       bioship,  bioship,  0,        ROT0,   "UPL (American Sammy license)",	"Bio-ship Paladin", GAME_IMPERFECT_SOUND )
 GAME( 1990, sbsgomo,  bioship, bioship,  bioship,  0,        ROT0,   "UPL",                             "Space Battle Ship Gomorrah", GAME_IMPERFECT_SOUND )
 GAME( 1990, vandyke,  0,       vandyke,  vandyke,  0,        ROT270, "UPL",                             "Vandyke (Japan)",  GAME_IMPERFECT_SOUND )
 GAME( 1990, vandyjal, vandyke, vandyke,  vandyke,  0,        ROT270, "UPL (Jaleco license)",            "Vandyke (Jaleco, Set 1)",  GAME_IMPERFECT_SOUND )
 GAME( 1990, vandyja2, vandyke, vandyke,  vandyke,  0,        ROT270, "UPL (Jaleco license)",            "Vandyke (Jaleco, Set 2)",  GAME_IMPERFECT_SOUND )
 GAME( 1990, vandykeb, vandyke, vandykeb, vandyke,  vandykeb, ROT270, "[UPL] (bootleg)",                 "Vandyke (bootleg with PIC16c57)",  GAME_NOT_WORKING )
-GAME( 1991, blkheart, 0,       macross,  blkheart, blkheart, ROT0,   "UPL",                             "Black Heart", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND  ) // Playable but there are Still Protection Problems
-GAME( 1991, blkhearj, blkheart,macross,  blkheart, blkheart, ROT0,   "UPL",                             "Black Heart (Japan)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) // Playable but there are Still Protection Problems
+GAME( 1991, blkheart, 0,       macross,  blkheart, 0,        ROT0,   "UPL",                             "Black Heart", GAME_IMPERFECT_SOUND  )
+GAME( 1991, blkhearj, blkheart,macross,  blkheart, 0,        ROT0,   "UPL",                             "Black Heart (Japan)", GAME_IMPERFECT_SOUND )
 GAME( 1991, acrobatm, 0,       acrobatm, acrobatm, 0,        ROT270, "UPL (Taito license)",             "Acrobat Mission", GAME_IMPERFECT_SOUND )
 GAME( 1992, strahl,   0,       strahl,   strahl,   0,        ROT0,   "UPL",                             "Koutetsu Yousai Strahl (Japan set 1)", GAME_IMPERFECT_SOUND )
 GAME( 1992, strahla,  strahl,  strahl,   strahl,   0,        ROT0,   "UPL",                             "Koutetsu Yousai Strahl (Japan set 2)", GAME_IMPERFECT_SOUND )
@@ -5183,7 +6939,7 @@
 /* Non NMK boards */
 
 // these use the seibu sound system (sound / music stolen from Raiden) rather than the bootleggers copying the nmk004
-GAME( 1990, mustangb, mustang, mustangb, mustang,  mustang,  ROT0,   "bootleg",                         "US AAF Mustang (bootleg)", GAME_UNEMULATED_PROTECTION ) // Playable but there are Still Protection Problems
+GAME( 1990, mustangb, mustang, mustangb, mustang,  0,        ROT0,   "bootleg",                         "US AAF Mustang (bootleg)", GAME_UNEMULATED_PROTECTION ) // Playable but there are Still Protection Problems
 GAME( 1991, tdragonb, tdragon, tdragonb, tdragonb, tdragonb, ROT270, "NMK / Tecmo",	                    "Thunder Dragon (Bootleg)", 0 )
 
 // these are from Comad, based on the Thunder Dragon code?
@@ -5191,5 +6947,19 @@
 GAME( 1996, airattck, 0,       ssmissin, airattck, ssmissin, ROT270, "Comad",                           "Air Attack (set 1)", GAME_NO_COCKTAIL )
 GAME( 1996, airattca, airattck,ssmissin, airattck, ssmissin, ROT270, "Comad",                           "Air Attack (set 2)", GAME_NO_COCKTAIL )
 
-// bee-oh board?
+// afega & clones
+GAME( 1995, twinactn, 0,        twinactn, twinactn, 0,        ROT0,               "Afega",    "Twin Action",                      0 )
+GAME( 1997, redhawk,  stagger1, stagger1, stagger1, redhawk,  ROT270,             "Afega",    "Red Hawk (US)",                    0 )
+GAME( 1997, redhawkb, stagger1, redhawkb, redhawkb, 0,        ROT0,               "bootleg",  "Red Hawk (bootleg)",               0 )
+GAME( 1998, stagger1, 0,        stagger1, stagger1, 0,        ROT270,             "Afega",    "Stagger I (Japan)",                0 )
+GAME( 1998, grdnstrm, 0,        grdnstrm, grdnstrm, grdnstrm, ROT270,             "Afega",    "Sen Jin - Guardian Storm (Korea)", 0 )
+GAME( 1998, bubl2000, 0,        bubl2000, bubl2000, bubl2000, ROT0,               "Tuning",   "Bubble 2000",                      0 ) // on a tuning board (bootleg?)
+GAME( 1998, hotbubl,  bubl2000, bubl2000, bubl2000, bubl2000, ROT0,               "Pandora",  "Hot Bubble" ,                      0 ) // on an afega board ..
+GAME( 1999, popspops, 0,        popspops, popspops, grdnstrm, ROT0,               "Afega",    "Pop's Pop's",                      0 )
+GAME( 2000, mangchi,  0,        bubl2000, mangchi,  bubl2000, ROT0,               "Afega",    "Mang-Chi",                         0 )
+GAME( 2000, spec2k,   0,        firehawk, spec2k,   spec2k,   ORIENTATION_FLIP_Y, "Yonatech", "Spectrum 2000 (Euro)",             0 )
+GAME( 2001, firehawk, 0,        firehawk, firehawk, 0,        ORIENTATION_FLIP_Y, "ESD",      "Fire Hawk",                        0 )
+
+// bee-oh board - different display / interrupt timing to others?
 GAME( 1991, manybloc, 0,       manybloc, manybloc, 0,        ROT270, "Bee-Oh",                          "Many Block", GAME_NO_COCKTAIL | GAME_IMPERFECT_SOUND )
+
diff -Nru src-old/mame/drivers/omegaf.c src/mame/drivers/omegaf.c
--- src-old/mame/drivers/omegaf.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/drivers/omegaf.c	2007-12-23 19:43:45.000000000 -0800
@@ -628,12 +628,12 @@
 static MACHINE_DRIVER_START( omegaf )
 
 	/* basic machine hardware */
-	MDRV_CPU_ADD_TAG("main", Z80, 12000000/2)		/* 12000000/2 ??? */
+	MDRV_CPU_ADD_TAG("main", Z80, 12000000/2)		/* 12000000/2 (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(omegaf_readmem,omegaf_writemem)	/* very sensitive to these settings */
 	MDRV_CPU_VBLANK_INT(omegaf_interrupt,1)
 
 	MDRV_CPU_ADD(Z80, 5000000)
-	/* audio CPU */		/* 5 mhz crystal ??? */
+	/* audio CPU */		/* 5 mhz crystal (verified on pcb) */
 	MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
 	MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
 	MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
@@ -656,10 +656,10 @@
 	/* sound hardware */
 	MDRV_SPEAKER_STANDARD_MONO("mono")
 
-	MDRV_SOUND_ADD(YM2203, 12000000/8)
+	MDRV_SOUND_ADD(YM2203, 12000000/8) /* (verified on pcb) */
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
 
-	MDRV_SOUND_ADD(YM2203, 12000000/8)
+	MDRV_SOUND_ADD(YM2203, 12000000/8) /* (verified on pcb) */
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
 MACHINE_DRIVER_END
 
diff -Nru src-old/mame/drivers/rungun.c src/mame/drivers/rungun.c
--- src-old/mame/drivers/rungun.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/rungun.c	2007-12-23 19:41:16.000000000 -0800
@@ -46,11 +46,11 @@
 VIDEO_START( rng );
 VIDEO_UPDATE( rng );
 static MACHINE_RESET( rng );
-READ16_HANDLER( ttl_ram_r );
-WRITE16_HANDLER( ttl_ram_w );
+READ16_HANDLER( rng_ttl_ram_r );
+WRITE16_HANDLER( rng_ttl_ram_w );
 WRITE16_HANDLER( rng_936_videoram_w );
 
-UINT16 *rng_936_videoram;
+extern UINT16 *rng_936_videoram;
 
 static UINT16 *rng_sysreg;
 static int init_eeprom_count;
@@ -223,7 +223,7 @@
 	AM_RANGE(0x601000, 0x601fff) AM_READ(MRA16_RAM)		// communication? second monitor buffer?
 	AM_RANGE(0x6c0000, 0x6cffff) AM_READ(MRA16_RAM)		// PSAC2 render RAM
 	AM_RANGE(0x700000, 0x7007ff) AM_READ(MRA16_RAM)		// PSAC2 line effect
-	AM_RANGE(0x740000, 0x741fff) AM_READ(ttl_ram_r)		// text plane RAM
+	AM_RANGE(0x740000, 0x741fff) AM_READ(rng_ttl_ram_r)		// text plane RAM
 #if RNG_DEBUG
 	AM_RANGE(0x5c0010, 0x5c001f) AM_READ(K053247_reg_word_r)
 	AM_RANGE(0x640000, 0x640007) AM_READ(K053246_reg_word_r)
@@ -247,7 +247,7 @@
 	AM_RANGE(0x680000, 0x68001f) AM_WRITE(MWA16_RAM) AM_BASE(&K053936_0_ctrl)				// '936 registers
 	AM_RANGE(0x6c0000, 0x6cffff) AM_WRITE(rng_936_videoram_w) AM_BASE(&rng_936_videoram)	// PSAC2 ('936) RAM (34v + 35v)
 	AM_RANGE(0x700000, 0x7007ff) AM_WRITE(MWA16_RAM) AM_BASE(&K053936_0_linectrl)			// "Line RAM"
-	AM_RANGE(0x740000, 0x741fff) AM_WRITE(ttl_ram_w)		// text plane RAM
+	AM_RANGE(0x740000, 0x741fff) AM_WRITE(rng_ttl_ram_w)		// text plane RAM
 	AM_RANGE(0x7c0000, 0x7c0001) AM_WRITE(MWA16_NOP)		// watchdog
 ADDRESS_MAP_END
 
diff -Nru src-old/mame/drivers/starwars.c src/mame/drivers/starwars.c
--- src-old/mame/drivers/starwars.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/starwars.c	2007-12-23 19:41:16.000000000 -0800
@@ -196,7 +196,7 @@
  *
  *************************************/
 
-static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )\
+static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 	AM_RANGE(0x0000, 0x07ff) AM_WRITE(starwars_sout_w)
 	AM_RANGE(0x0800, 0x0fff) AM_READ(starwars_sin_r)		/* SIN Read */
 	AM_RANGE(0x1000, 0x107f) AM_RAM							/* 6532 ram */
diff -Nru src-old/mame/drivers/stv.c src/mame/drivers/stv.c
--- src-old/mame/drivers/stv.c	2007-12-18 00:09:03.000000000 -0800
+++ src/mame/drivers/stv.c	2007-12-23 19:41:16.000000000 -0800
@@ -3771,7 +3771,7 @@
 by Sega titles,and this is a Sunsoft game)It's likely to be a left-over...
 */
 
-DRIVER_INIT( sanjeon )
+static DRIVER_INIT( sanjeon )
 {
 	UINT8 *src    = memory_region       ( REGION_USER1 );
 	int x;
diff -Nru src-old/mame/drivers/tx1.c src/mame/drivers/tx1.c
--- src-old/mame/drivers/tx1.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/drivers/tx1.c	2007-12-23 20:03:00.000000000 -0800
@@ -1,334 +1,187 @@
-/*====================================================================*/
-/*               TX-1/Buggy Boy  (Tatsumi) Hardware                   */
-/*                     Philip J Bennett 2005                          */
-/*====================================================================*/
+/***************************************************************************
 
-/*
-Notes:
-======
-TX-1
-====
-* ROM dumps incomplete.
-* Arithmetic unit/interface not implemented.
-* Several sound related things are guessed (I don't have the relevent schematic sheet or an actual PCB to verify).
-
-Buggy Boy
-=========
-* Buggy Boy/Speed Buggy and the copyrights are changed via wire jumper on the sound PCB.
-* Fiddle with dipswitch 'Do Not Change 2' to skip errors if necessary.
-* The 3-monitor version of Buggy Boy is not fully dumped (will be taken care of).
-
-* Arithmetic unit/interface not fully implemented/understood.
-* Road hardware emulation is lacking.
-* Object drawing is not fully understood (scale parameters and end of line/sprite flags especially).
-* Discrete sound emulation is not implemented.
-* Character layer scrolling is not implemented.
-* Layer mixing is incorrect.
-
-* Buggy Boy controls don't work correctly.
-* At some point the slave CPU writes F0 to EVERY 15th memory location. Hmmm. (see PC=fc630)
-* Without ROM patches, the game hangs on bootup (sometimes giving error 22): Z80->8086 communication timeout.
-  The Z80<->Main CPU comms needs work (although they work fine during the game).
-
-Useful memory locations:
-* Score = 0x544
-* Timer = 0x54A
-
-Buggy Boy Error Codes             TX-1 Error Codes
-=====================             ================
-
-1. Main CPU RAM                   1. Main microprocessor RAM
-2. Video (character) RAM          2. Video RAM
-3. Road/common RAM                3. Common RAM
-4. Sound RAM                      4. Sound RAM
-5. Main CPU ROM                   5. Main microprocessor ROM
-6. Sound ROM                      6. Sound ROM
-8. Auxillary ROM                  10. Interface ROM (time-out error)
-12. Arithmetic unit               11. Common RAM (access for arithmetic CPU)
-22. Main 8086-Z80 timeout         12. Common RAM (access for arithmetic CPU)
-                                  13. Arithmetic RAM
-                                  14. Common RAM (access for arithmetic CPU)
-                                  15. Object RAM
-                                  16. Arithmetic ROM
-                                  17. Data ROM (Checksum)
-                                  18. Arithmetic unit
-*/
+    Tatsumi TX-1/Buggy Boy hardware
+
+    driver by Phil Bennett
+
+    Games supported:
+        * TX-1 (1983) [2 sets]
+        * Buggy Boy (1985)
+        * Buggy Boy Junior (1986)
+
+    Notes:
+        * 'buggyboy' and 'tx1' are preliminary
+        * 'buggyboy' set is using ROMs from 'buggybjr' for testing purposes
+        until the original set can be dumped.
+
+****************************************************************************
+
+    Buggy Boy Error Codes          TX-1 Error Codes
+    =====================          ================
+
+    1  Main CPU RAM                1  Main microprocessor RAM
+    2  Video (character) RAM       2  Video RAM
+    3  Road/common RAM             3  Common RAM
+    4  Sound RAM                   4  Sound RAM
+    5  Main CPU ROM                5  Main microprocessor ROM
+    6  Sound ROM                   6  Sound ROM
+    8  Auxillary ROM               10 Interface ROM (time-out error)
+    12 Arithmetic unit             11 Common RAM (access for arithmetic CPU)
+    22 Main 8086-Z80 timeout       12 Common RAM (access for arithmetic CPU)
+                                   13 Arithmetic RAM
+                                   14 Common RAM (access for arithmetic CPU)
+                                   15 Object RAM
+                                   16 Arithmetic ROM
+                                   17 Data ROM (checksum)
+                                   18 Arithmetic unit
+
+***************************************************************************/
 
 #include "driver.h"
-#include "machine/8255ppi.h"
 #include "sound/ay8910.h"
+#include "sound/custom.h"
 #include "cpu/i86/i86.h"
 #include "rendlay.h"
+#include "tx1.h"
 
-#define PRINT_CRT 0
-#define ROM_PATCHES 1
+/*************************************
+ *
+ *  Globals
+ *
+ *************************************/
+UINT16	*tx1_math_ram;
+static UINT8 *z80_ram;
+static UINT8  tx1_ppi_latch_a;
+static UINT8  tx1_ppi_latch_b;
+static UINT32 ts;
 
-static int TS, z80_int = 0;
 
-UINT16 *tx1_vram;
-static UINT16 *tx1_object_ram;
-
-UINT16 *buggyboy_vram;	/* Tile RAM (three monitor)   */
-UINT16 *buggyb1_vram;	/* Tile RAM (single monitor)  */
-static UINT8 *z80_ram;	/* Main 8086/Z80 shared RAM   */
-UINT16 *bb_objram;
-UINT16 *bb_sky;		/* Sky register */
-static UINT16 *bb_rcram;
-
-static size_t tx1_objectram_size;
-size_t bb_objectram_size;
-static size_t bb_rcram_size;
-
-tilemap *tx1_tilemap;
-tilemap *buggyboy_tilemap;
-tilemap *buggyb1_tilemap;
-
-/* machine/tx1.c */
-void MMI_74S516(int ins, UINT16 *data);
-READ16_HANDLER( BB_AU_R );
-WRITE16_HANDLER( BB_AU_W );
-
-/* video/tx1.c */
-WRITE16_HANDLER( tx1_vram_w );
-VIDEO_START( tx1 );
-VIDEO_UPDATE( tx1 );
-
-PALETTE_INIT( buggyboy );
-WRITE16_HANDLER( buggyboy_vram_w );
-WRITE16_HANDLER( buggyb1_vram_w );
-VIDEO_START( buggyboy );
-VIDEO_UPDATE( buggyboy );
-VIDEO_START( buggyb1 );
-VIDEO_UPDATE( buggyb1 );
-
-
-static INTERRUPT_GEN( main_irq )
+/* Main CPU and Z80 synchronisation */
+static WRITE16_HANDLER( z80_busreq_w )
 {
-	cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0x80/4);
+	cpunum_set_input_line(2, INPUT_LINE_HALT, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
 }
 
-/* Periodic Z80 interrupt */
-static INTERRUPT_GEN( z80_irq )
+static WRITE16_HANDLER( resume_math_w )
 {
-        if(!z80_int){
-	   cpunum_set_input_line(2, 0, HOLD_LINE);
-	   z80_int = 1;
-	}
+	cpunum_set_input_line(1, INPUT_LINE_TEST, ASSERT_LINE);
 }
 
-
-/* HD46505S-2 CRT Controller */
-/* Buggy Boy: The main 8086 at F003C expects non-zero value or else jump to 4000:0000 and execute crap */
-static READ16_HANDLER(crt_read)
+static WRITE16_HANDLER( halt_math_w )
 {
-       return 1;
+	cpunum_set_input_line(1, INPUT_LINE_TEST, CLEAR_LINE);
 }
 
-/* Remove this eventually */
-static WRITE16_HANDLER(crt_write)
+/* Z80 can trigger an interrupt itself */
+static WRITE8_HANDLER( z80_intreq_w )
 {
-#if PRINT_CRT
-	if (ACCESSING_LSB)
-	{
-		data &= 0xff;
-       if(offset==0)
-       {
-        switch (data)
-        {
-        	case 0:mame_printf_debug("Horizontal Total");
-        	       break;
-        	case 1:mame_printf_debug("Horizontal displayed");
-               	       break;
-        	case 2:mame_printf_debug("Horizontal sync position");
-        	       break;
-        	case 3:mame_printf_debug("Horizontal sync width");
-        	       break;
-        	case 4:mame_printf_debug("Vertical total");
-        	       break;
-        	case 5:mame_printf_debug("Vertical total adj");
-        	       break;
-        	case 6:mame_printf_debug("Vertical displayed");
-        	       break;
-        	case 7:mame_printf_debug("Vertical sync position");
-        	       break;
-        	case 8:mame_printf_debug("Interlace mode");
-        	       break;
-        	case 9:mame_printf_debug("Max. scan line address");
-        	       break;
-        	case 0xa:mame_printf_debug("Cursror start");
-        	       break;
-        	case 0xb:mame_printf_debug("Cursor end");
-        	       break;
-        	case 0xc:mame_printf_debug("Start address (h)");
-        	       break;
-        	case 0xd:mame_printf_debug("Start address (l)");
-        	       break;
-        	case 0xe:mame_printf_debug("Cursor (h)");
-        	       break;
-        	case 0xf:mame_printf_debug("Cursor (l)");
-        	       break;
-        	case 0x10:mame_printf_debug("Light pen (h))");
-        	       break;
-        	case 0x11:mame_printf_debug("Light pen (l)");
-        	       break;
-        }
-       }
-        if(offset==1) mame_printf_debug("=         0x%x, %d\n",data,data);
-    }
-#endif
+	cpunum_set_input_line(2, 0, HOLD_LINE);
 }
 
-
-/* Main CPU and Z80 synchronisation*/
-static WRITE16_HANDLER(z80_busreq)
+/* Periodic Z80 interrupt */
+static INTERRUPT_GEN( z80_irq )
 {
-	if (ACCESSING_LSB)
-	{
-		if (data & 0xff)
-			cpunum_set_input_line(2, INPUT_LINE_HALT, CLEAR_LINE);
-		else
-			cpunum_set_input_line(2, INPUT_LINE_HALT, ASSERT_LINE);
-	}
+	cpunum_set_input_line(2, 0, HOLD_LINE);
 }
 
-
-/* Called by main 8086 to wake up slave */
-static WRITE16_HANDLER(resume_slave)
+static READ16_HANDLER( z80_shared_r )
 {
-	cpunum_set_input_line(1, INPUT_LINE_TEST, ASSERT_LINE);
-}
+	UINT16	result = 0xffff;
 
-static READ16_HANDLER(halt_slave_r)
-{
-	cpunum_set_input_line(1, INPUT_LINE_TEST, CLEAR_LINE);
-	return 0;
-}
+	cpuintrf_push_context(2);
+	result = program_read_byte(offset);
+	cpuintrf_pop_context();
 
-/* Called by slave 8086 to halt on WAIT instruction */
-static void halt_slave(void)
-{
-	cpunum_set_input_line(1, INPUT_LINE_TEST, CLEAR_LINE);
+	return result;
 }
 
-
-static WRITE8_HANDLER(z80_intreq_w)
+static WRITE16_HANDLER( z80_shared_w )
 {
-       z80_int=0;
+	cpuintrf_push_context(2);
+	program_write_byte(offset, data & 0xff);
+	cpuintrf_pop_context();
 }
 
-static READ8_HANDLER(z80_intreq_r)
-{
-       z80_int=0;
-       return 0;
-}
 
+/*************************************
+ *
+ *  Port definitions
+ *
+ *************************************/
 
-/* Handlers for main CPU<->Z80 RAM */
-static READ16_HANDLER(z80_shared_r)
-{
-	return z80_ram[offset];
-}
+static INPUT_PORTS_START( tx1 )
+PORT_START_TAG("DSW")
+	PORT_DIPNAME( 0x0003, 0x0003, "Game Cost" )
+	PORT_DIPSETTING(      0x0000, "1 Coin Unit for 1 Credit" )
+	PORT_DIPSETTING(      0x0001, "2 Coin Units for 1 Credit" )
+	PORT_DIPSETTING(      0x0002, "3 Coin Units for 1 Credit" )
+	PORT_DIPSETTING(      0x0003, "4 Coin Units for 1 Credit" )
 
-static WRITE16_HANDLER(z80_shared_w)
-{
-	if (ACCESSING_LSB)
-		z80_ram[offset] = data;
-}
+	PORT_DIPNAME( 0x0004, 0x0004, "Left Coin Mechanism" )
+	PORT_DIPSETTING(      0x0000, "1 Coin for 1 Coin Unit" )
+	PORT_DIPSETTING(      0x0004, "1 Coin for 2 Coin Units" )
 
-static INPUT_PORTS_START( tx1 )
-	PORT_START_TAG("DSW1")
-	PORT_DIPNAME( 0x0700, 0x0300,  DEF_STR( Difficulty ) )
-	PORT_DIPSETTING(      0x0000, "A" )
+	PORT_DIPNAME( 0x0018, 0x0000, "Right Coin Mechanism" )
+	PORT_DIPSETTING(      0x0000, "1 Coin Units 1 Credit" )
+	PORT_DIPSETTING(      0x0008, "1 Coin Units 4 Credit" )
+	PORT_DIPSETTING(      0x0010, "1 Coin Units 5 Credit" )
+	PORT_DIPSETTING(      0x0018, "1 Coin Unit 6 Credit" )
+
+	PORT_DIPNAME( 0x0700, 0x0300, DEF_STR( Difficulty ) )
+	PORT_DIPSETTING(      0x0000, "A (Easiest)" )
 	PORT_DIPSETTING(      0x0100, "B" )
 	PORT_DIPSETTING(      0x0200, "C" )
 	PORT_DIPSETTING(      0x0300, "D" )
 	PORT_DIPSETTING(      0x0400, "E" )
 	PORT_DIPSETTING(      0x0500, "F" )
 	PORT_DIPSETTING(      0x0600, "G" )
-	PORT_DIPSETTING(      0x0700, "H" )
+	PORT_DIPSETTING(      0x0700, "H (Hardest)" )
 
 	PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Game_Time ) )
-	PORT_DIPSETTING(      0x0000, "A" )
+	PORT_DIPSETTING(      0x0000, "A (Longest)" )
 	PORT_DIPSETTING(      0x0800, "B" )
 	PORT_DIPSETTING(      0x1000, "C" )
-	PORT_DIPSETTING(      0x1800, "D" )
+	PORT_DIPSETTING(      0x1800, "D (Shortest)" )
 
 	PORT_DIPNAME( 0xe000, 0xe000, "Bonus Adder" )
-	PORT_DIPSETTING(    0x0000, "No Bonus" )
-	PORT_DIPSETTING(    0x2000, "2 Coin Units for 1 Credit" )
-	PORT_DIPSETTING(    0x4000, "3 Coin Units for 1 Credit" )
-	PORT_DIPSETTING(    0x6000, "4 Coin Units for 1 Credit" )
-	PORT_DIPSETTING(    0x8000, "5 Coin Units for 1 Credit" )
-	PORT_DIPSETTING(    0xa000, "4 Coin Units for 2 Credit" )
-	PORT_DIPSETTING(    0xc000, DEF_STR( Free_Play ) )
-	PORT_DIPSETTING(    0xe000, "No Bonus" )
+	PORT_DIPSETTING(      0x0000, "No Bonus" )
+	PORT_DIPSETTING(      0x2000, "2 Coin Units for 1 Credit" )
+	PORT_DIPSETTING(      0x4000, "3 Coin Units for 1 Credit" )
+	PORT_DIPSETTING(      0x6000, "4 Coin Units for 1 Credit" )
+	PORT_DIPSETTING(      0x8000, "5 Coin Units for 1 Credit" )
+	PORT_DIPSETTING(      0xa000, "4 Coin Units for 2 Credit" )
+	PORT_DIPSETTING(      0xc000, DEF_STR( Free_Play ) )
+	PORT_DIPSETTING(      0xe000, "No Bonus" )
+
+PORT_START_TAG("AN_STEERING")
+	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25)
 
-	/* These don't correspond to the Atari manual :( */
-	PORT_DIPNAME( 0x0003, 0x0003, "Game Cost" )
-	PORT_DIPSETTING(      0x0000, "1 Coin Unit for 1 Credit" )
-	PORT_DIPSETTING(      0x0001, "2 Coin Units for 1 Credit" )
-	PORT_DIPSETTING(      0x0002, "3 Coin Units for 1 Credit" )
-	PORT_DIPSETTING(      0x0003, "4 Coin Units for 1 Credit" )
+PORT_START_TAG("AN_ACCELERATOR")
+	PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
 
-	PORT_DIPNAME( 0x0004, 0x0004, "Left Coin Mechanism" )
-	PORT_DIPSETTING(    0x0000, "1 Coin for 1 Coin Unit" )
-	PORT_DIPSETTING(    0x0004, "1 Coin for 2 Coin Units" )
-
-	PORT_DIPNAME( 0x0018, 0x0000, "Right Coin Mechanism" )
-	PORT_DIPSETTING(    0x0000, "1 Coin Units 1 Credit" )
-	PORT_DIPSETTING(    0x0008, "1 Coin Units 4 Credit" )
-	PORT_DIPSETTING(    0x0010, "1 Coin Units 5 Credit" )
-	PORT_DIPSETTING(    0x0018, "1 Coin Unit 6 Credit" )
-
-	PORT_START_TAG("ANALOG_A")
-	PORT_BIT( 0x000f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
-	PORT_BIT( 0xf0, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) /* Brake */
-	PORT_START_TAG("ANALOG_B")
-	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Steering */
-	/* Wire jumper setting on sound PCB */
-	PORT_DIPNAME( 0xf0, 0x80,  DEF_STR( Unknown ) )
-	PORT_DIPSETTING(      0x10, "1" )
-	PORT_DIPSETTING(      0x20, "2" )
-	PORT_DIPSETTING(      0x40, "3" )
-	PORT_DIPSETTING(      0x80, "4" )
+PORT_START_TAG("AN_BRAKE")
+	PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
 
-	PORT_START_TAG("INPUTS")
+PORT_START_TAG("PPI_PORTC")
 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
-	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_TOGGLE
+	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE
+
+PORT_START_TAG("PPI_PORTD")
+	/* Wire jumper setting on sound PCB */
+	PORT_DIPNAME( 0xf0, 0x80,  DEF_STR( Unknown ) )
+	PORT_DIPSETTING(    0x10, "1" )
+	PORT_DIPSETTING(    0x20, "2" )
+	PORT_DIPSETTING(    0x40, "3" )
+	PORT_DIPSETTING(    0x80, "4" )
 INPUT_PORTS_END
 
 
 static INPUT_PORTS_START( buggyboy )
-	PORT_START_TAG("DSW1")
-	PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coin_A ) )
-	PORT_DIPSETTING(    0x4000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(    0x2000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(    0xc000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(    0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(    0x8000, DEF_STR( 1C_5C ) )
-	PORT_DIPSETTING(    0xa000, DEF_STR( 1C_6C ) )
-	PORT_DIPSETTING(    0xe000, "Free-Play" )
-
-	PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Coin_B ) )
-	PORT_DIPSETTING(    0x0800, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(    0x1000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(    0x1800, DEF_STR( 1C_5C ) )
-
-	PORT_DIPNAME( 0x0700, 0x0700,  "Do not change 1" )
-	PORT_DIPSETTING(      0x0000, "0" )
-	PORT_DIPSETTING(      0x0100, "1" )
-	PORT_DIPSETTING(      0x0200, "2" )
-	PORT_DIPSETTING(      0x0300, "3" )
-	PORT_DIPSETTING(      0x0400, "4" )
-	PORT_DIPSETTING(      0x0500, "5" )
-	PORT_DIPSETTING(      0x0600, "6" )
-	PORT_DIPSETTING(      0x0700, "7" )
-
-	PORT_DIPNAME( 0x0003, 0x0003,  "Do not change 2" )       /* Dipswitch 0 is unconnected */
+PORT_START_TAG("DSW")
+	/* Dipswitch 0 is unconnected */
+	PORT_DIPNAME( 0x0003, 0x0003, "Do not change 2" )
 	PORT_DIPSETTING(      0x0000, "0" )
 	PORT_DIPSETTING(      0x0001, "1" )
 	PORT_DIPSETTING(      0x0002, "2" )
@@ -343,66 +196,34 @@
 	PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
 
 	PORT_DIPNAME( 0x0030, 0x0030, "Time Rank" )
-	PORT_DIPSETTING(      0x0000, "A" )
+	PORT_DIPSETTING(      0x0000, "A (Short)" )
 	PORT_DIPSETTING(      0x0010, "B" )
 	PORT_DIPSETTING(      0x0020, "C" )
-	PORT_DIPSETTING(      0x0030, "D" )
+	PORT_DIPSETTING(      0x0030, "D (Long)" )
 
 	PORT_DIPNAME( 0x00c0, 0x0040, "Game Rank" )
-	PORT_DIPSETTING(      0x0000, "A")
+	PORT_DIPSETTING(      0x0000, "A (Easy)")
 	PORT_DIPSETTING(      0x0040, "B" )
 	PORT_DIPSETTING(      0x0080, "C" )
-	PORT_DIPSETTING(      0x00c0, "D" )
+	PORT_DIPSETTING(      0x00c0, "D (Difficult)" )
 
-	PORT_START_TAG("YM2149_IC19_A")
-	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
-	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
-	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
-	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_TOGGLE /* Gear shift */
-	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
-
-
-	/* Read by 8255 I think */
-	PORT_START_TAG("YM2149_IC19_B")
-	PORT_DIPNAME( 0xff, 0x80,  "Sound PCB Jumper:" )
-	PORT_DIPSETTING(      0x00, "0" )
-	PORT_DIPSETTING(      0x01, "1" )
-	PORT_DIPSETTING(      0x02, "2" )
-	PORT_DIPSETTING(      0x04, "3" )
-	PORT_DIPSETTING(      0x08, "4" )
-	PORT_DIPSETTING(      0x10, "5" )
-	PORT_DIPSETTING(      0x20, "Speed Buggy/Data East" )
-	PORT_DIPSETTING(      0x40, "Buggy Boy/Taito" )
-	PORT_DIPSETTING(      0x80, "Buggy Boy/Tatsumi" )
-
-	/* Fix me */
-	PORT_START_TAG("ANALOG_A")
-	PORT_BIT( 0x0f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
-	PORT_BIT( 0xf0, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Steering */
-	PORT_START_TAG("ANALOG_B")
-	PORT_BIT( 0xf0, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) /* Brake */
-
-INPUT_PORTS_END
-
-static INPUT_PORTS_START( buggyb1 )
-	PORT_START_TAG("DSW1")
 	PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coin_A ) )
-	PORT_DIPSETTING(    0x4000, DEF_STR( 3C_1C ) )
-	PORT_DIPSETTING(    0x2000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(    0x0000, DEF_STR( 1C_1C ) )
-	PORT_DIPSETTING(    0xc000, DEF_STR( 2C_3C ) )
-	PORT_DIPSETTING(    0x6000, DEF_STR( 1C_2C ) )
-	PORT_DIPSETTING(    0x8000, DEF_STR( 1C_5C ) )
-	PORT_DIPSETTING(    0xa000, DEF_STR( 1C_6C ) )
-	PORT_DIPSETTING(    0xe000, "Free-Play" )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 1C_5C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_6C ) )
+	PORT_DIPSETTING(      0xe000, "Free-Play" )
 
 	PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Coin_B ) )
-	PORT_DIPSETTING(    0x0000, DEF_STR( 2C_1C ) )
-	PORT_DIPSETTING(    0x1000, DEF_STR( 1C_4C ) )
-	PORT_DIPSETTING(    0x0800, DEF_STR( 1C_5C ) )
-	PORT_DIPSETTING(    0x1800, DEF_STR( 1C_6C ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( 1C_5C ) )
 
-	PORT_DIPNAME( 0x0700, 0x0700,  "Do not change 1" )
+	PORT_DIPNAME( 0x0700, 0x0700, "Do not change 1" )
 	PORT_DIPSETTING(      0x0000, "0" )
 	PORT_DIPSETTING(      0x0100, "1" )
 	PORT_DIPSETTING(      0x0200, "2" )
@@ -412,7 +233,39 @@
 	PORT_DIPSETTING(      0x0600, "6" )
 	PORT_DIPSETTING(      0x0700, "7" )
 
-	PORT_DIPNAME( 0x0003, 0x0003,  "Do not change 2" )       /* Dipswitch 0 is unconnected */
+PORT_START_TAG("PPI_PORTA")
+	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
+	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
+	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
+	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE
+	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
+
+PORT_START_TAG("PPI_PORTC")
+	PORT_DIPNAME( 0xff, 0x80, "Sound PCB Jumper:" )
+	PORT_DIPSETTING(    0x00, "0" )
+	PORT_DIPSETTING(    0x01, "1" )
+	PORT_DIPSETTING(    0x02, "2" )
+	PORT_DIPSETTING(    0x04, "3" )
+	PORT_DIPSETTING(    0x08, "4" )
+	PORT_DIPSETTING(    0x10, "5" )
+	PORT_DIPSETTING(    0x20, "Speed Buggy/Data East" )
+	PORT_DIPSETTING(    0x40, "Buggy Boy/Taito" )
+	PORT_DIPSETTING(    0x80, "Buggy Boy/Tatsumi" )
+
+PORT_START_TAG("AN_STEERING")
+	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25)
+
+PORT_START_TAG("AN_ACCELERATOR")
+	PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
+
+PORT_START_TAG("AN_BRAKE")
+	PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( buggybjr )
+PORT_START_TAG("DSW")
+	/* Dipswitch 0 is unconnected */
+	PORT_DIPNAME( 0x0003, 0x0003, "Do not change 2" )
 	PORT_DIPSETTING(      0x0000, "0" )
 	PORT_DIPSETTING(      0x0001, "1" )
 	PORT_DIPSETTING(      0x0002, "2" )
@@ -427,90 +280,156 @@
 	PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
 
 	PORT_DIPNAME( 0x0030, 0x0030, "Time Rank" )
-	PORT_DIPSETTING(      0x0000, "A" )
+	PORT_DIPSETTING(      0x0000, "A (Short)" )
 	PORT_DIPSETTING(      0x0010, "B" )
 	PORT_DIPSETTING(      0x0020, "C" )
-	PORT_DIPSETTING(      0x0030, "D" )
+	PORT_DIPSETTING(      0x0030, "D (Long)" )
 
 	PORT_DIPNAME( 0x00c0, 0x0040, "Game Rank" )
-	PORT_DIPSETTING(      0x0000, "A")
+	PORT_DIPSETTING(      0x0000, "A (Easy)")
 	PORT_DIPSETTING(      0x0040, "B" )
 	PORT_DIPSETTING(      0x0080, "C" )
-	PORT_DIPSETTING(      0x00c0, "D" )
+	PORT_DIPSETTING(      0x00c0, "D (Difficult)" )
+
+	PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coin_A ) )
+	PORT_DIPSETTING(      0x4000, DEF_STR( 3C_1C ) )
+	PORT_DIPSETTING(      0x2000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
+	PORT_DIPSETTING(      0xc000, DEF_STR( 2C_3C ) )
+	PORT_DIPSETTING(      0x6000, DEF_STR( 1C_2C ) )
+	PORT_DIPSETTING(      0x8000, DEF_STR( 1C_5C ) )
+	PORT_DIPSETTING(      0xa000, DEF_STR( 1C_6C ) )
+	PORT_DIPSETTING(      0xe000, "Free-Play" )
 
-	PORT_START_TAG("YM2149_IC19_A")
+	PORT_DIPNAME( 0x1800, 0x0800, DEF_STR( Coin_B ) )
+	PORT_DIPSETTING(      0x0000, DEF_STR( 2C_1C ) )
+	PORT_DIPSETTING(      0x1000, DEF_STR( 1C_4C ) )
+	PORT_DIPSETTING(      0x0800, DEF_STR( 1C_5C ) )
+	PORT_DIPSETTING(      0x1800, DEF_STR( 1C_6C ) )
+
+	PORT_DIPNAME( 0x0700, 0x0700, "Do not change 1" )
+	PORT_DIPSETTING(      0x0000, "0" )
+	PORT_DIPSETTING(      0x0100, "1" )
+	PORT_DIPSETTING(      0x0200, "2" )
+	PORT_DIPSETTING(      0x0300, "3" )
+	PORT_DIPSETTING(      0x0400, "4" )
+	PORT_DIPSETTING(      0x0500, "5" )
+	PORT_DIPSETTING(      0x0600, "6" )
+	PORT_DIPSETTING(      0x0700, "7" )
+
+PORT_START_TAG("YM2149_IC19_A")
 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
-	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_TOGGLE  /* Gear shift */
+	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE
 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) PORT_TOGGLE
 
-	/* Wire jumper setting on sound PCB */
-	PORT_START_TAG("YM2149_IC19_B")
-	PORT_DIPNAME( 0xff, 0x80,  "Sound PCB Jumper:" )
-	PORT_DIPSETTING(      0x00, "0" )
-	PORT_DIPSETTING(      0x01, "1" )
-	PORT_DIPSETTING(      0x02, "2" )
-	PORT_DIPSETTING(      0x04, "3" )
-	PORT_DIPSETTING(      0x08, "4" )
-	PORT_DIPSETTING(      0x10, "5" )
-	PORT_DIPSETTING(      0x20, "Speed Buggy/Data East" )
-	PORT_DIPSETTING(      0x40, "Buggy Boy/Taito" )
-	PORT_DIPSETTING(      0x80, "Buggy Boy/Tatsumi" )
-
-	PORT_START_TAG("ANALOG_A")
-	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)  /* Steering */
-	PORT_BIT( 0xf0, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) /* Accelerator */
-	PORT_START_TAG("ANALOG_B")
-	PORT_BIT( 0xf0, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)  /* Brake */
+/* Wire jumper setting on sound PCB */
+PORT_START_TAG("YM2149_IC19_B")
+	PORT_DIPNAME( 0xff, 0x80, "Sound PCB Jumper:" )
+	PORT_DIPSETTING(    0x00, "0" )
+	PORT_DIPSETTING(    0x01, "1" )
+	PORT_DIPSETTING(    0x02, "2" )
+	PORT_DIPSETTING(    0x04, "3" )
+	PORT_DIPSETTING(    0x08, "4" )
+	PORT_DIPSETTING(    0x10, "5" )
+	PORT_DIPSETTING(    0x20, "Speed Buggy/Data East" )
+	PORT_DIPSETTING(    0x40, "Buggy Boy/Taito" )
+	PORT_DIPSETTING(    0x80, "Buggy Boy/Tatsumi" )
+
+PORT_START_TAG("AN_STEERING")
+	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25)
+
+PORT_START_TAG("AN_ACCELERATOR")
+	PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
+
+PORT_START_TAG("AN_BRAKE")
+	PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00, 0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
 INPUT_PORTS_END
 
+static READ16_HANDLER( dipswitches_r )
+{
+	return (readinputport(0) & 0xfffe) | ts;
+}
+
+/*
+    (TODO) TS: Connected in place of dipswitch A bit 0
+    Accessed on startup as some sort of acknowledgement
+*/
+static WRITE8_HANDLER( ts_w )
+{
+//  TS = 1;
+	z80_ram[offset] = data;
+}
+
+static READ8_HANDLER( ts_r )
+{
+//  TS = 1;
+	return z80_ram[offset];
+}
 
-/********************/
-/* TX-1 Memory Maps */
-/********************/
-static ADDRESS_MAP_START( tx1_master, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x00000, 0x00fff) AM_MIRROR(0x1000) AM_RAM              /* RAM */
-	AM_RANGE(0x02000, 0x02fff) AM_MIRROR(0x1000) AM_RAM              /* RAM */
-	AM_RANGE(0x04000, 0x04fff) AM_MIRROR(0x1000) AM_RAM              /* Backup RAM */
-	AM_RANGE(0x06000, 0x06009) AM_READWRITE(crt_read, crt_write)
-	AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA16_RAM,tx1_vram_w) AM_BASE(&tx1_vram)
-	AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1)                    /* Road/common RAM */
-	AM_RANGE(0x0b000, 0x0b001) AM_READWRITE (input_port_0_word_r, z80_busreq)
-	AM_RANGE(0x0c000, 0x0c001) AM_RAM                                 /* /SCOLST */
-	AM_RANGE(0x0d000, 0x0d001) AM_RAM                                 /* /SLINCS */
-	AM_RANGE(0x0e000, 0x0e001) AM_RAM                                 /* /SLOCK  */
-	AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA16_NOP, resume_slave)          /* Watchdog and slave resume */
-	AM_RANGE(0x10000, 0x13fff) AM_ROM                                         /* Z80 ROM */
-	AM_RANGE(0x16000, 0x16fff) AM_READWRITE (z80_shared_r, z80_shared_w)
+/*************************************
+ *
+ *  TX-1 Memory Maps
+ *
+ *************************************/
+
+static ADDRESS_MAP_START( tx1_main, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x00000, 0x00fff) AM_MIRROR(0x1000) AM_RAM
+	AM_RANGE(0x02000, 0x02fff) AM_MIRROR(0x1000) AM_RAM
+	AM_RANGE(0x04000, 0x04fff) AM_MIRROR(0x1000) AM_RAM	AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
+	AM_RANGE(0x06000, 0x06fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w)
+	AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA16_RAM, tx1_vram_w) AM_BASE(&tx1_vram)
+	AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&tx1_rcram)
+	AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w)
+	AM_RANGE(0x0c000, 0x0c001) AM_WRITE(tx1_scolst_w)
+	AM_RANGE(0x0d000, 0x0d003) AM_WRITE(tx1_slincs_w)
+	AM_RANGE(0x0e000, 0x0e001) AM_WRITE(tx1_slock_w)
+	AM_RANGE(0x0f000, 0x0f001) AM_READWRITE(watchdog_reset16_r, resume_math_w)
+	AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(z80_shared_r, z80_shared_w)
 	AM_RANGE(0xf0000, 0xfffff) AM_ROM
 ADDRESS_MAP_END
 
-/* Lot of unknown writes - I haven't investigated further */
-static ADDRESS_MAP_START( tx1_slave, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x00000, 0x007ff) AM_MIRROR(0x800) AM_RAM               /* Arithmetic RAM (IC169, IC158) A10 is grounded */
-	AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)   /* Common RAM (IC195, IC210) */
-	AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&tx1_object_ram) AM_SIZE(&tx1_objectram_size)   /* Object RAM (IC43, IC68) A10-A8 are grounded*/
-	AM_RANGE(0x02400, 0x027ff) AM_RAM               /* /BANKCS */
-	AM_RANGE(0x02800, 0x02bff) AM_READWRITE(halt_slave_r, MWA16_NOP)  /* /DRAK */
-	AM_RANGE(0x02C00, 0x02fff) AM_RAM               /* /FLGCS */
-	AM_RANGE(0x03000, 0x03fff) AM_RAM               /* SN74S516 arithmetic unit */
-	AM_RANGE(0x04000, 0x07fff) AM_ROM               /* ROM mirror? */
-	AM_RANGE(0x08000, 0x0bfff) AM_ROM               /* ROM mirror? */
-	AM_RANGE(0x0c000, 0x0ffff) AM_ROM               /* ROM mirror? */
+static ADDRESS_MAP_START( tx1_math, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x00000, 0x007ff) AM_RAM AM_BASE(&tx1_math_ram)
+	AM_RANGE(0x00800, 0x00fff) AM_READWRITE(tx1_spcs_ram_r, tx1_spcs_ram_w)
+	AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)
+	AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&tx1_objram) AM_SIZE(&tx1_objram_size)
+	AM_RANGE(0x02400, 0x027ff) AM_WRITE(tx1_bankcs_w)
+	AM_RANGE(0x02800, 0x02bff) AM_WRITE(halt_math_w)
+	AM_RANGE(0x02C00, 0x02fff) AM_WRITE(tx1_flgcs_w)
+	AM_RANGE(0x03000, 0x03fff) AM_READWRITE(tx1_math_r, tx1_math_w)
+	AM_RANGE(0x05000, 0x07fff) AM_READ(tx1_spcs_rom_r)
+	AM_RANGE(0x08000, 0x0bfff) AM_ROM
+	AM_RANGE(0x0c000, 0x0ffff) AM_ROM
 	AM_RANGE(0xfc000, 0xfffff) AM_ROM
 ADDRESS_MAP_END
 
 
-/* Sound */
+static WRITE8_HANDLER( tx1_ppi_latch_w )
+{
+	tx1_ppi_latch_a = ((readinputportbytag("AN_BRAKE") & 0xf) << 4) | (readinputportbytag("AN_ACCELERATOR") & 0xf);
+	tx1_ppi_latch_b = readinputportbytag("AN_STEERING");
+}
+
+static READ8_HANDLER( tx1_ppi_porta_r )
+{
+	return tx1_ppi_latch_a;
+}
+
+static READ8_HANDLER( tx1_ppi_portb_r )
+{
+	return readinputportbytag("PPI_PORTD") | tx1_ppi_latch_b;
+}
+
 static ADDRESS_MAP_START( tx1_sound_prg, ADDRESS_SPACE_PROGRAM, 8 )
 	AM_RANGE(0x0000, 0x1fff) AM_ROM
-	AM_RANGE(0x3000, 0x37ff) AM_RAM AM_MIRROR(0x800) AM_BASE (&z80_ram)
-	AM_RANGE(0x4000, 0x4000) AM_READ (z80_intreq_r)                                  /* Unconfirmed */
+	AM_RANGE(0x3000, 0x37ff) AM_RAM AM_MIRROR(0x800) AM_BASE(&z80_ram)
+	AM_RANGE(0x4000, 0x4000) AM_WRITE(z80_intreq_w)
 	AM_RANGE(0x5000, 0x5003) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)
-	AM_RANGE(0x6000, 0x6003) AM_RAM                                  /* 8253A PIT */
-	AM_RANGE(0x7000, 0x70DF) AM_RAM                                  /* Propigate input signals into 8255 */
-	AM_RANGE(0xb00b, 0xb00b) AM_RAM                                  /* Read once - TS?*/
+	AM_RANGE(0x6000, 0x6003) AM_READWRITE(pit8253_r, pit8253_w)
+	AM_RANGE(0x7000, 0x7fff) AM_WRITE(tx1_ppi_latch_w)
+	AM_RANGE(0xb000, 0xbfff) AM_READWRITE(ts_r, ts_w)
 ADDRESS_MAP_END
 
 
@@ -521,182 +440,120 @@
 ADDRESS_MAP_END
 
 
-/*************************/
-/* Buggy Boy Memory Maps */
-/*************************/
-
-static READ16_HANDLER(input_port_0A_r)
-{
-	return (readinputport(0) & 0xfffe) | TS;
-}
-
-static ADDRESS_MAP_START( buggyb1_master, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x00000, 0x03fff) AM_RAM                             /* 1kB RAM - battery backed */
-	AM_RANGE(0x04000, 0x04fff) AM_READWRITE(crt_read, crt_write)  /* HD46505S-2 or equivalent CRT controller */
-	AM_RANGE(0x08000, 0x08fff) AM_READWRITE(MRA16_RAM,buggyb1_vram_w) AM_BASE(&buggyb1_vram)         /* Character mapped RAM */
-	AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&bb_rcram) AM_SIZE(&bb_rcram_size)     /* Road/common RAM - 1800-18ff & 1c00-1cff are read by road H/W */
-	AM_RANGE(0x0b000, 0x0b001) AM_READWRITE (input_port_0A_r, z80_busreq)     /* Dipswitches and Z80 busreq */
-	AM_RANGE(0x0c000, 0x0c001) AM_RAM                                         /* /SCOLW  */
-	AM_RANGE(0x0d000, 0x0d003) AM_RAM                                         /* /SLINCS */
-	AM_RANGE(0x0e000, 0x0e001) AM_RAM AM_BASE(&bb_sky)                        /* /SKYCS  */
-	AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA16_NOP, resume_slave)          /* Watchdog and slave resume */
-	AM_RANGE(0x10000, 0x17fff) AM_ROM                                         /* Z80 ROM */
-	AM_RANGE(0x18000, 0x18fff) AM_READWRITE (z80_shared_r, z80_shared_w)
+/*************************************
+ *
+ *  Buggy Boy Memory Maps
+ *
+ *************************************/
+
+static ADDRESS_MAP_START( buggyboy_main, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
+	AM_RANGE(0x04000, 0x04fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w)
+	AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA16_RAM, buggyboy_vram_w) AM_BASE(&buggyboy_vram)
+	AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&buggyboy_rcram) AM_SIZE(&buggyboy_rcram_size)
+	AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w)
+	AM_RANGE(0x0c000, 0x0c001) AM_WRITE(buggyboy_scolst_w)
+	AM_RANGE(0x0d000, 0x0d003) AM_WRITE(buggyboy_slincs_w)
+	AM_RANGE(0x0e000, 0x0e001) AM_WRITE(buggyboy_sky_w)
+	AM_RANGE(0x0f000, 0x0f003) AM_READWRITE(watchdog_reset16_r, resume_math_w)
+	AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(z80_shared_r, z80_shared_w)
 	AM_RANGE(0x20000, 0x2ffff) AM_ROM
 	AM_RANGE(0xf0000, 0xfffff) AM_ROM
 ADDRESS_MAP_END
 
-
-static ADDRESS_MAP_START( buggyboy_master, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x00000, 0x03fff) AM_RAM                             /* 1kB RAM - battery backed */
-	AM_RANGE(0x04000, 0x04fff) AM_READWRITE(crt_read, crt_write)  /* HD46505S-2 or equivalent CRT controller */
-	AM_RANGE(0x08000, 0x09fff) AM_READWRITE(MRA16_RAM,buggyboy_vram_w) AM_BASE(&buggyboy_vram)           /* Character mapped RAM */
-	AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&bb_rcram) AM_SIZE(&bb_rcram_size)            /* Road/common RAM */
-	AM_RANGE(0x0b000, 0x0b001) AM_READWRITE (input_port_0A_r, z80_busreq)     /* Dipswitches and Z80 busreq */
-	AM_RANGE(0x0c000, 0x0c001) AM_RAM                                         /* /SCOLW  */
-	AM_RANGE(0x0d000, 0x0d003) AM_RAM                                         /* /SLINCS */
-	AM_RANGE(0x0e000, 0x0e001) AM_RAM AM_BASE(&bb_sky)                        /* /SKYCS  */
-	AM_RANGE(0x0f000, 0x0f003) AM_READWRITE (MRA16_NOP, resume_slave)          /* Watchdog and slave resume */
-	AM_RANGE(0x10000, 0x17fff) AM_ROM                                         /* Z80 ROM */
-	AM_RANGE(0x18000, 0x18fff) AM_READWRITE (z80_shared_r, z80_shared_w)
+static ADDRESS_MAP_START( buggybjr_main, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x00000, 0x03fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
+	AM_RANGE(0x04000, 0x04fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w)
+	AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(&buggybjr_vram)
+	AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE(1) AM_BASE(&buggyboy_rcram) AM_SIZE(&buggyboy_rcram_size)
+	AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w)
+	AM_RANGE(0x0c000, 0x0c001) AM_WRITE(buggyboy_scolst_w)
+	AM_RANGE(0x0d000, 0x0d003) AM_WRITE(buggyboy_slincs_w)
+	AM_RANGE(0x0e000, 0x0e001) AM_WRITE(buggyboy_sky_w)
+	AM_RANGE(0x0f000, 0x0f003) AM_READWRITE(watchdog_reset16_r, resume_math_w)
+	AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(z80_shared_r, z80_shared_w)
 	AM_RANGE(0x20000, 0x2ffff) AM_ROM
 	AM_RANGE(0xf0000, 0xfffff) AM_ROM
 ADDRESS_MAP_END
 
+static ADDRESS_MAP_START( buggyboy_math, ADDRESS_SPACE_PROGRAM, 16 )
+	AM_RANGE(0x00000, 0x007ff) AM_RAM AM_BASE(&tx1_math_ram)
+	AM_RANGE(0x00800, 0x00fff) AM_READWRITE(buggyboy_spcs_ram_r, buggyboy_spcs_ram_w)
+	AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)
+	AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&buggyboy_objram) AM_SIZE(&buggyboy_objram_size)
+	AM_RANGE(0x02400, 0x024ff) AM_WRITE(buggyboy_gas_w)
+	AM_RANGE(0x03000, 0x03fff) AM_READWRITE(buggyboy_math_r, buggyboy_math_w)
+	AM_RANGE(0x04000, 0x04fff) AM_ROM
+	AM_RANGE(0x05000, 0x07fff) AM_READ(buggyboy_spcs_rom_r)
+	AM_RANGE(0x08000, 0x0bfff) AM_ROM
+	AM_RANGE(0x0c000, 0x0ffff) AM_ROM
+	AM_RANGE(0xfc000, 0xfffff) AM_ROM
+ADDRESS_MAP_END
 
-/*
-2400-24FF appear to be road control (R/W)
-
-From the single monitor schematics:
-
--GAS = 24XX:
--BASET0 = 2400-F, 2410-F
--BASET1 = 2420-F, 2430-F
--BSET   = 2440-F, 2450-F
--HASET  = 2460-F, 2470-F
--HSET   = 2480-F, 2490-F
--WASET  = 24A0-F, 24B0-F
--FLAGS  = 24E0-F, 24F0-F
-*/
-
-static READ16_HANDLER(GAS_r)
-{
-       if(offset >= 0xe0/2)  halt_slave();
-       return 0;
-}
 
-static WRITE16_HANDLER(GAS_w)
+/* TODO */
+static READ8_HANDLER( bb_analog_r )
 {
-       if(offset >= 0xe0/2)  halt_slave();
+	if ( offset == 1 )
+	{
+		return ((readinputportbytag("AN_ACCELERATOR") & 0xf) << 4) | readinputportbytag("AN_STEERING");
+	}
+	else
+	{
+		return (readinputportbytag("AN_BRAKE") & 0xf) << 4;
+	}
 }
 
-
-/*
-From single monitor PCB TC-041:
-
-TZ0310 IC87 (PAL12L6)
-============================
-/SPCS  =  !A15.!A14.!A13.A12 + A14.!A13.!A12 + !A14.A12.A9 + !A14.A13./A12 + !A14.!A11 + A15
-/PRCS (Program ROM)  =  !A15.!A14.A13.A12 + !A15.!A14.!A13.A12 + !A15.!A14.!A12
-/ARCRCS (Road/Common RAM)  =  A15.!A14.A13.A12 + !A15.!A14.!A12 + A14 + A15
-/INSALD =  /AT3RD.!AT3WDRART + !AT3WDRART.A15 + !AT3WDRART.!A13 + !AT3WDRART.A14 + !AT3WDRART.!A12 + !A7
-/CNTST  =  /AT3RD.!AT3WDRART + !AT3WDRART.A15 + !AT3WDRART.!A13 + !AT3WDRART.A14 + !AT3WDRART.!A12 + !A8
-LS245 IC24/55 /G (Program ROM and RAM data bus)  =  !A15.!A14.A13.!A11 + !A15.!A14.A13.A12 + !A15.!A14.!A13.A12 + /ADEN
-
-
-TZ0311 IC88 (PAL10L8) (protection fuse was set, yet it read)
-============================
-
-/ARTCS (Arithmetic unit and interface)  =  !(A12.A13.!A14.!A15)
-/GAS (Road registers)  =  !(Q.ADT/#R + Q.!Q.ADT/#R.!ADT/#R)            <-- ???
-/EXPCS (Expansion RAM)  =  !(A11.!A12.A13.!A14.!A15)
-/PRMHCS (Program RAM high-byte) = !(!A12.!A13.!A14.!A15.!/ADHE)
-/PRMLCS (Program RAM low-byte) = !(!A0.!A12.!A13.!A14.!A15)
-/OCRCS (Object RAM)  =  !(!A10.!A11.!A12.A13.!A14.!A15)
-/MLPCS (Arithmetic Unit Instruction = A1-A3)  =  !(!A10.!A11.A12.A13.!A14.!A15)
-/DPRCS (Function Data ROM)  =  !(A10.A11.A12.A13.!A14.!A15)
-*/
-
-/* Memory map and ROM contents are the same for both versions */
-static ADDRESS_MAP_START( buggyboy_slave, ADDRESS_SPACE_PROGRAM, 16 )
-	AM_RANGE(0x00000, 0x00fff) AM_RAM                           /* 4kB RAM */
-	AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE(1)               /* Road/Common RAM */
-	AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(&bb_objram) AM_SIZE(&bb_objectram_size)    /* RAM A10-A8 are grounded */
-	AM_RANGE(0x02400, 0x024ff) AM_READWRITE (GAS_r, GAS_w)      /* Road control registers */
-	AM_RANGE(0x03000, 0x03fff) AM_READWRITE (BB_AU_R, BB_AU_W)  /* SN74S516 arithmetic unit */
-	AM_RANGE(0x04000, 0x07fff) AM_ROM                           /* ROM mirror */
-	AM_RANGE(0x08000, 0x0bfff) AM_ROM                           /* ROM mirror */
-	AM_RANGE(0x0c000, 0x0ffff) AM_ROM                           /* ROM mirror */
-	AM_RANGE(0xfc000, 0xfffff) AM_ROM                           /* ROM */
-ADDRESS_MAP_END
-
-
-/* Connected in place of dipswitch A bit 0 */
-/* Accessed on startup as some sort of acknowledgement */
-static WRITE8_HANDLER(_TS_)
+static READ8_HANDLER( bbjr_analog_r )
 {
-//       TS = 1;
+	if ( offset == 0 )
+	{
+		return ((readinputportbytag("AN_ACCELERATOR") & 0xf) << 4) | readinputportbytag("AN_STEERING");
+	}
+	else
+	{
+		return (readinputportbytag("AN_BRAKE") & 0xf) << 4;
+	}
 }
 
-/* Buggy Boy Sound PCB TC033A. */
+/* Buggy Boy Sound PCB TC033A */
 static ADDRESS_MAP_START( buggyboy_sound_prg, ADDRESS_SPACE_PROGRAM, 8 )
 	AM_RANGE(0x0000, 0x3fff) AM_ROM
-	AM_RANGE(0x4000, 0x47ff) AM_RAM  AM_BASE(&z80_ram)                /* 2kB RAM - shared with Main CPU */
-	AM_RANGE(0x6000, 0x6000) AM_READ(input_port_4_r)                  /* Steering and accelerator */
-	AM_RANGE(0x6001, 0x6001) AM_READ(input_port_5_r)                  /* Brake (NOT USED) */
-	AM_RANGE(0x6800, 0x6803) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)   /* Digital inputs (coins etc.) - check me */
-	AM_RANGE(0x7000, 0x7003) AM_RAM                                   /* 8253 Programmable Interval Timer (Engine Sound) */
-	AM_RANGE(0xc024, 0xc024) AM_WRITE(_TS_)                           /* /TS? */
-	AM_RANGE(0x7800, 0x7800) AM_WRITE(z80_intreq_w)                     /* /INTREQ? */
+	AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&z80_ram)
+	AM_RANGE(0x6000, 0x6001) AM_READ(bb_analog_r)
+	AM_RANGE(0x6800, 0x6803) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)
+	AM_RANGE(0x7000, 0x7003) AM_RAM
+	AM_RANGE(0x7800, 0x7800) AM_WRITE(z80_intreq_w)
+	AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(ts_r, ts_w)
 ADDRESS_MAP_END
 
-/* Buggy Boy (single monitor) Sound PCB TC-043 (no 8255). */
-static ADDRESS_MAP_START( buggyb1_sound_prg, ADDRESS_SPACE_PROGRAM, 8 )
+/* Buggy Boy Jr Sound PCB TC043 */
+static ADDRESS_MAP_START( buggybjr_sound_prg, ADDRESS_SPACE_PROGRAM, 8 )
 	AM_RANGE(0x0000, 0x3fff) AM_ROM
-	AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&z80_ram)                     /* 2kB RAM - shared with Main 8086 */
-	AM_RANGE(0x5000, 0x5003) AM_RAM                                       /* 8253 Programmable Interval Timer (Engine Sound) */
-	AM_RANGE(0x6000, 0x6000) AM_READ(input_port_4_r)                      /* Steering and accelerator */
-	AM_RANGE(0x6001, 0x6001) AM_READ(input_port_5_r)                      /* Brake (NOT USED) */
-	AM_RANGE(0xc024, 0xc024) AM_WRITE(_TS_)                               /* /TS? */
-	AM_RANGE(0x7000, 0x7001) AM_WRITE(z80_intreq_w)                       /* /INTREQ */
+	AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&z80_ram)
+	AM_RANGE(0x5000, 0x5003) AM_READWRITE(pit8253_r, pit8253_w)
+	AM_RANGE(0x6000, 0x6001) AM_READ(bbjr_analog_r)
+	AM_RANGE(0x7000, 0x7000) AM_WRITE(z80_intreq_w)
+	AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(ts_r, ts_w)
 ADDRESS_MAP_END
 
-
-/* Common to both versions*/
+/* Common */
 static ADDRESS_MAP_START( buggyboy_sound_io, ADDRESS_SPACE_IO, 8 )
 	ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
 	AM_RANGE(0x40, 0x40) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
 	AM_RANGE(0x41, 0x41) AM_WRITE(AY8910_control_port_0_w)
-
 	AM_RANGE(0x80, 0x80) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
 	AM_RANGE(0x81, 0x81) AM_WRITE(AY8910_control_port_1_w)
 ADDRESS_MAP_END
 
 
-/* Common to TX-1 and Buggy Boy */
-static const gfx_layout char_layout =
-{
-	8,8,
-	2048,
-	2,
-	{ 0, 8*8*2048 },
-	{ 0,1,2,3,4,5,6,7 },
-	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
-	8*8
-};
-
-static const gfx_layout bb_object_layout =
-{
-	8,8,
-	4096,
-	2,
-	{ 0,  8*8*4096 },
-	{ 0,1,2,3,4,5,6,7 },
-	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
-	8*8
-};
+/*************************************
+ *
+ *  Graphics definitions
+ *
+ *************************************/
 
-static const gfx_layout tx1_object_layout =
+static const gfx_layout char_layout =
 {
 	8,8,
 	2048,
@@ -707,293 +564,187 @@
 	8*8
 };
 
-static GFXDECODE_START( bb )
+static GFXDECODE_START( buggyboy )
 	GFXDECODE_ENTRY( REGION_GFX1, 0, char_layout, 0, 256 )
-	GFXDECODE_ENTRY( REGION_GFX2, 0, bb_object_layout, 256, 2048  )
-	GFXDECODE_ENTRY( REGION_GFX3, 0, bb_object_layout, 256, 2048  )
-	GFXDECODE_ENTRY( REGION_GFX4, 0, bb_object_layout, 256, 2048  )
 GFXDECODE_END
 
 static GFXDECODE_START( tx1 )
 	GFXDECODE_ENTRY( REGION_GFX1, 0, char_layout, 0, 16 )
-	GFXDECODE_ENTRY( REGION_GFX2, 0, tx1_object_layout, 0, 16 )
-	GFXDECODE_ENTRY( REGION_GFX3, 0, tx1_object_layout, 0, 16 )
 GFXDECODE_END
 
 
-/****************************/
-/*    TX-1 Sound Hardware   */
-/****************************/
+/*************************************
+ *
+ *  Sound Hardware
+ *
+ *************************************/
 
-static const struct AY8910interface tx1_ay8910_interface =
+static struct AY8910interface tx1_ay8910_interface =
 {
-	0,                        /* Probably hooked up to discrete sound filters */
+	/* TODO */
+	0,
+	0,
+	0,
 	0,
-        0,
-        0,
 };
 
-/****************************/
-/* Buggy Boy Sound Hardware */
-/****************************/
-
-/*
-According to the single monitor schematics:
-
-                YM-2149 IC 24
-                =============
-
-       Port A                     Port B
-       ======                     ======
 
-0: Engine sound control       0: Coin Counter 1
-1: Engine sound control       1: Coin Counter 2
-2: Engine sound control       2: Coin Counter 3 (Unused)
-3: Engine sound control       3: Engine sound 4066B
-4: Engine sound control       4: Noise EN1
-5: Engine sound control       5: Noise EN2
-6: Engine sound control       6: Enable YM IC24 on rear right speaker
-7: Engine Noise control       7: Enable YM IC19 on rear left speaker
-
-                YM-2149 IC 19
-                =============
-
-       Port A                     Port B
-       ======                     ======
-
-0: Engine sound control       0: Coin Counter 1
-1: Engine sound control       1: Coin Counter 2
-2: Engine sound control       2: Coin Counter 3 (Unused)
-3: Engine sound control       3: Engine sound 4066B
-4: Engine sound control       4: Noise EN1
-5: Engine sound control       5: Noise EN2
-6: Engine sound control       6: Enable YM IC24 on rear right speaker
-7: Engine Noise control       7: Enable YM IC19 on rear left speaker
-*/
-
-
-static WRITE8_HANDLER(BB_YM2149_1_A_w)
-{
-
-}
-
-static WRITE8_HANDLER(BB_YM2149_1_B_w)
-{
-    coin_counter_w(0,data & 0x01);
-    coin_counter_w(1,data & 0x02);
-}
-
-
-/* YM2149 IC19 - front left */
-static const struct AY8910interface buggyboy_ay8910_interface_1 =
+/* YM2149 IC19 */
+static struct AY8910interface buggyboy_ym2149_interface_1 =
 {
+	input_port_1_r,
 	input_port_2_r,
-	input_port_3_r,
 	0,
 	0,
 };
 
-
-/* YM2149 IC24 - front right */
-static const struct AY8910interface buggyboy_ay8910_interface_2 =
+/* YM2149 IC24 */
+static struct AY8910interface buggyboy_ym2149_interface_2 =
 {
 	0,
 	0,
-	BB_YM2149_1_A_w,
-	BB_YM2149_1_B_w,
+	bb_ym1_a_w,
+	bb_ym1_b_w,
 };
 
-static WRITE8_HANDLER(TX1_COIN_COUNTER)
+static WRITE8_HANDLER( tx1_coin_cnt )
 {
-       coin_counter_w(0,data & 0x80);
-       coin_counter_w(1,data & 0x40);
+	coin_counter_w(0, data & 0x80);
+	coin_counter_w(1, data & 0x40);
 }
-static const ppi8255_interface tx1_ppi8255_intf =
+
+ppi8255_interface tx1_ppi8255_intf =
 {
 	1,
-	{ input_port_2_r },         /* Accelerator and brake */
-	{ input_port_3_r },         /* Steering and sound wire jumpers */
-	{ input_port_4_r },         /* Coin and shift inputs */
-	{ NULL },
-	{ NULL },
-	{ TX1_COIN_COUNTER },
+	{ tx1_ppi_porta_r },         /* Accelerator and brake */
+	{ tx1_ppi_portb_r },         /* Steering and sound wire jumpers */
+	{ input_port_4_r },
+	{ 0 },
+	{ 0 },
+	{ tx1_coin_cnt },
 };
 
+static struct CustomSound_interface tx1_custom_interface =
+{
+	tx1_sh_start,
+	NULL,
+	tx1_sh_reset
+};
 
-/* Buggy Boy (3-monitor) uses a 8255 instead of the YM2149 ports for inputs */
-static const ppi8255_interface buggyboy_ppi8255_intf =
+/* Buggy Boy uses an 8255 PPI instead of YM2149 ports for inputs! */
+ppi8255_interface buggyboy_ppi8255_intf =
 {
 	1,
+	{ input_port_1_r },
+	{ 0 },
 	{ input_port_2_r },
-	{ NULL },
-	{ input_port_3_r },
-	{ NULL },
-	{ NULL },
-	{ NULL },
+	{ 0 },
+	{ 0 },
+	{ 0 },
 };
 
-static MACHINE_RESET( buggyb1 )
+static struct CustomSound_interface bb_custom_interface =
 {
-       UINT8 *rom = (UINT8 *)memory_region(REGION_CPU1);
-
-/*
-    The main CPU /TEST line is connected to the /BUSAK output of the Z80.
-
-    TODO: Improve communications.
-*/
-#if ROM_PATCHES
-       rom[0xf00d0]=0x3b;     /* Patch out cmp Al,05 - z80 comms */
-       rom[0xf00d1]=0xc0;
-#endif
-}
-
-
-static MACHINE_RESET( buggyboy )
-{
-       UINT8 *rom = (UINT8 *)memory_region(REGION_CPU1);
-
-       ppi8255_init(&buggyboy_ppi8255_intf);
-
-#ifdef ROM_PATCHES
-       rom[0xf00d0]=0x3b;     /* Patch out cmp Al,05 - z80 comms */
-       rom[0xf00d1]=0xc0;
-#endif
-}
-
-static MACHINE_RESET( tx1 )
-{
-	UINT8 *rom = (UINT8 *)memory_region(REGION_CPU1);
-	UINT8 *rom_b = (UINT8 *)memory_region(REGION_CPU2);
-
-	ppi8255_init(&tx1_ppi8255_intf);
+	buggyboy_sh_start,
+	NULL,
+	buggyboy_sh_reset
+};
 
-	rom = rom;
-	rom_b = rom_b;
-
-       /* For tx1a: Needed to skip the startup tests */
-#if 0
-	rom_b[0xfcf38]=0x3B;	/* Patch out AU check */
-	rom_b[0xfcf39]=0xc0;
-	rom_b[0xfcf3a]=0x90;
-	rom_b[0xfcf3b]=0x90;
-	rom_b[0xfcf3c]=0x90;
-
-	rom_b[0xfce68]=0x3b;
-	rom_b[0xfce69]=0xc0;
-	rom_b[0xfce6a]=0x90;
-
-	rom_b[0xfcf43]=0x3B;	/* Patch out AU check */
-	rom_b[0xfcf44]=0xc0;
-	rom_b[0xfcf45]=0x90;
-	rom_b[0xfcf46]=0x90;
-	rom_b[0xfcf47]=0x90;
-
-	rom[0xf3c38]=0x3b;	/* Main ROM Checksum */
-	rom[0xf3c39]=0xc0;
-	rom[0xf0251]=0x3b;	/* Patch out cmp Al,?? */
-	rom[0xf0252]=0xc0;
-	rom[0xf0265]=0x3b;	/* Patch out cmp Al,?? */
-	rom[0xf0266]=0xc0;
-	rom[0xf0271]=0x90;	/* NOP */
-	rom[0xf0280]=0x3b;	/* Patch out cmp Al,??  */
-	rom[0xf0281]=0xc0;
-#endif
-}
+/*************************************
+ *
+ *  Machine driver
+ *
+ *************************************/
 
 static MACHINE_DRIVER_START( tx1 )
-	MDRV_CPU_ADD(I8086,5000000 )
-	MDRV_CPU_PROGRAM_MAP(tx1_master,0)
-	MDRV_CPU_PERIODIC_INT(main_irq, 46 )        /* To do: measure HD46505 CUDISP output rate */
-	//MDRV_WATCHDOG_TIME_INIT(ATTOTIME_IN_SEC(5))  /* To do: measure watchdog time interval */
-
-	MDRV_CPU_ADD(I8086,5000000 )
-	MDRV_CPU_PROGRAM_MAP(tx1_slave,0)
-
-	MDRV_CPU_ADD(Z80,3750000 )                  /* Guess */
-	MDRV_CPU_PROGRAM_MAP(tx1_sound_prg,0)
-	MDRV_CPU_IO_MAP(tx1_sound_io,0)
-	MDRV_CPU_PERIODIC_INT(irq0_line_hold, 915.52734375/2 )         /* Guess */
+	MDRV_CPU_ADD(I8086, 5000000)
+	MDRV_CPU_PROGRAM_MAP(tx1_main, 0)
+//  MDRV_WATCHDOG_TIME_INIT(5)
+
+	MDRV_CPU_ADD(I8086,5000000)
+	MDRV_CPU_PROGRAM_MAP(tx1_math, 0)
+
+	MDRV_CPU_ADD(Z80, TX1_PIXEL_CLOCK / 2)
+	MDRV_CPU_PROGRAM_MAP(tx1_sound_prg, 0)
+	MDRV_CPU_IO_MAP(tx1_sound_io, 0)
+	MDRV_CPU_PERIODIC_INT(irq0_line_hold, TX1_PIXEL_CLOCK / 4 / 2048 / 2)
 
 	MDRV_MACHINE_RESET(tx1)
-	MDRV_INTERLEAVE(100)
+	MDRV_MACHINE_START(tx1)
+	MDRV_NVRAM_HANDLER(generic_0fill)
 
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_GFXDECODE(tx1)
-	MDRV_PALETTE_LENGTH(32768)
+	MDRV_PALETTE_LENGTH(256)
+	MDRV_COLORTABLE_LENGTH(256+(256*4)+(2048*4))
+	MDRV_PALETTE_INIT(tx1)
+	MDRV_VIDEO_EOF(tx1)
+
 	MDRV_DEFAULT_LAYOUT(layout_triphsxs)
 
 	MDRV_SCREEN_ADD("left", 0x000)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
 	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
+	MDRV_SCREEN_RAW_PARAMS(TX1_PIXEL_CLOCK, TX1_HTOTAL, TX1_HBEND, TX1_HBSTART, TX1_VTOTAL, TX1_VBEND, TX1_VBSTART)
 
-	MDRV_SCREEN_ADD("middle", 0x000)
+	MDRV_SCREEN_ADD("center", 0x000)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
+	MDRV_SCREEN_RAW_PARAMS(TX1_PIXEL_CLOCK, TX1_HTOTAL, TX1_HBEND, TX1_HBSTART, TX1_VTOTAL, TX1_VBEND, TX1_VBSTART)
 
 	MDRV_SCREEN_ADD("right", 0x000)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
+	MDRV_SCREEN_RAW_PARAMS(TX1_PIXEL_CLOCK, TX1_HTOTAL, TX1_HBEND, TX1_HBSTART, TX1_VTOTAL, TX1_VBEND, TX1_VBSTART)
 
 	MDRV_VIDEO_START(tx1)
 	MDRV_VIDEO_UPDATE(tx1)
 
-	MDRV_SPEAKER_STANDARD_MONO("Mono")                           /* Mono for the time being */
+	MDRV_SPEAKER_STANDARD_STEREO("Front Left", "Front Right")
+//  MDRV_SPEAKER_STANDARD_STEREO("Rear Left", "Rear Right")
 
-	MDRV_SOUND_ADD(AY8910, 1875000)                              /* Guess */
+	MDRV_SOUND_ADD(AY8910, TX1_PIXEL_CLOCK / 8)
 	MDRV_SOUND_CONFIG(tx1_ay8910_interface)
-	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Mono", 0.5)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Left", 0.5)
+	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Right", 0.5)
+
+	MDRV_SOUND_ADD(CUSTOM, 0)
+	MDRV_SOUND_CONFIG(tx1_custom_interface)
+	MDRV_SOUND_ROUTE(0, "Front Left", 0.2)
+	MDRV_SOUND_ROUTE(1, "Front Right", 0.2)
 MACHINE_DRIVER_END
 
+
 static MACHINE_DRIVER_START( buggyboy )
-	MDRV_CPU_ADD(I8086,5000000 )
-	MDRV_CPU_PROGRAM_MAP(buggyboy_master,0)
-	MDRV_CPU_PERIODIC_INT(main_irq, 46 )    /* To do: measure HD46505 CUDISP output rate */
-	//MDRV_WATCHDOG_TIME_INIT(ATTOTIME_IN_SEC(5))  /* To do: measure watchdog time interval */
-
-	MDRV_CPU_ADD(I8086,5000000 )
-	MDRV_CPU_PROGRAM_MAP(buggyboy_slave,0)
-
-	MDRV_CPU_ADD(Z80,3750000 ) /* audio CPU */
-	MDRV_CPU_PROGRAM_MAP(buggyboy_sound_prg,0)
-	MDRV_CPU_PERIODIC_INT(z80_irq, 915.52734375/2 )  /* To do: verify against real PCB */
-	MDRV_CPU_IO_MAP(buggyboy_sound_io,0)
+	MDRV_CPU_ADD(BUGGYBOY_CPU_TYPE, 5000000)
+	MDRV_CPU_PROGRAM_MAP(buggyboy_main, 0)
+//  MDRV_WATCHDOG_TIME_INIT(5)
+
+	MDRV_CPU_ADD(BUGGYBOY_CPU_TYPE, 5000000)
+	MDRV_CPU_PROGRAM_MAP(buggyboy_math, 0)
+
+	MDRV_CPU_ADD(Z80, BUGGYBOY_ZCLK / 2)
+	MDRV_CPU_PROGRAM_MAP(buggyboy_sound_prg, 0)
+	MDRV_CPU_PERIODIC_INT(z80_irq, BUGGYBOY_ZCLK / 2 / 4 / 2048)
+	MDRV_CPU_IO_MAP(buggyboy_sound_io, 0)
 
 	MDRV_MACHINE_RESET(buggyboy)
-	MDRV_INTERLEAVE(100)
+	MDRV_MACHINE_START(buggyboy)
+	MDRV_NVRAM_HANDLER(generic_0fill)
 
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
-	MDRV_GFXDECODE(bb)
+	MDRV_GFXDECODE(buggyboy)
 	MDRV_DEFAULT_LAYOUT(layout_triphsxs)
 
 	MDRV_SCREEN_ADD("left", 0x000)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
+	MDRV_SCREEN_RAW_PARAMS(BB_PIXEL_CLOCK, BB_HTOTAL, BB_HBEND, BB_HBSTART, BB_VTOTAL, BB_VBEND, BB_VBSTART)
 
-	MDRV_SCREEN_ADD("middle", 0x000)
+	MDRV_SCREEN_ADD("center", 0x000)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
+	MDRV_SCREEN_RAW_PARAMS(BB_PIXEL_CLOCK, BB_HTOTAL, BB_HBEND, BB_HBSTART, BB_VTOTAL, BB_VBEND, BB_VBSTART)
 
 	MDRV_SCREEN_ADD("right", 0x000)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_SCREEN_SIZE(256, 256)
-	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
+	MDRV_SCREEN_RAW_PARAMS(BB_PIXEL_CLOCK, BB_HTOTAL, BB_HBEND, BB_HBSTART, BB_VTOTAL, BB_VBEND, BB_VBSTART)
 
 	MDRV_PALETTE_LENGTH(256)
 	MDRV_COLORTABLE_LENGTH(256+(256*4)+(2048*4))
@@ -1001,73 +752,88 @@
 	MDRV_VIDEO_START(buggyboy)
 	MDRV_VIDEO_UPDATE(buggyboy)
 
-	/* Sound hardware */
 	MDRV_SPEAKER_STANDARD_STEREO("Front Left", "Front Right")
-     /* MDRV_SPEAKER_STANDARD_STEREO("Rear Left", "Rear Right") */
+//  MDRV_SPEAKER_STANDARD_STEREO("Rear Left", "Rear Right")
 
-	MDRV_SOUND_ADD(AY8910, 1875000)
-	MDRV_SOUND_CONFIG(buggyboy_ay8910_interface_1)
+	MDRV_SOUND_ADD(YM2149, BUGGYBOY_ZCLK / 4)
+	MDRV_SOUND_CONFIG(buggyboy_ym2149_interface_1)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Left", 0.15)
 
-	MDRV_SOUND_ADD(AY8910, 1875000)
-	MDRV_SOUND_CONFIG(buggyboy_ay8910_interface_2)
+	MDRV_SOUND_ADD(YM2149, BUGGYBOY_ZCLK / 4)
+	MDRV_SOUND_CONFIG(buggyboy_ym2149_interface_2)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Right", 0.15)
-MACHINE_DRIVER_END
 
+	MDRV_SOUND_ADD(CUSTOM, 0)
+	MDRV_SOUND_CONFIG(bb_custom_interface)
+	MDRV_SOUND_ROUTE(0, "Front Left", 0.2)
+	MDRV_SOUND_ROUTE(1, "Front Right", 0.2)
+MACHINE_DRIVER_END
 
-/* Need to verify clocks on real PCB */
-static MACHINE_DRIVER_START( buggyb1 )
-	MDRV_CPU_ADD(I8086,5000000 )
-	MDRV_CPU_PROGRAM_MAP(buggyb1_master,0)
-	MDRV_CPU_PERIODIC_INT(main_irq, 46 )    /* To do: measure HD46505 CUDISP output rate */
-	//MDRV_WATCHDOG_TIME_INIT(ATTOTIME_IN_SEC(5))  /* To do: measure watchdog time interval */
-
-	MDRV_CPU_ADD(I8086,5000000 )
-	MDRV_CPU_PROGRAM_MAP(buggyboy_slave,0)
-
-	MDRV_CPU_ADD(Z80,3750000 ) /* audio CPU */
-	MDRV_CPU_PROGRAM_MAP(buggyb1_sound_prg,0)
-	MDRV_CPU_PERIODIC_INT(z80_irq, 915.52734375/2 )  /* To do: verify against real PCB*/
-	MDRV_CPU_IO_MAP(buggyboy_sound_io,0)
 
-	/* Confirm this stuff */
-	MDRV_SCREEN_REFRESH_RATE(60)
-	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
-	MDRV_MACHINE_RESET( buggyb1 )
-	MDRV_INTERLEAVE(100)                                    /* ? */
+static MACHINE_DRIVER_START( buggybjr )
+	MDRV_CPU_ADD(BUGGYBOY_CPU_TYPE, 5000000)
+	MDRV_CPU_PROGRAM_MAP(buggybjr_main, 0)
+//  MDRV_WATCHDOG_TIME_INIT(5)
+
+	MDRV_CPU_ADD(BUGGYBOY_CPU_TYPE, 5000000)
+	MDRV_CPU_PROGRAM_MAP(buggyboy_math, 0)
+
+	MDRV_CPU_ADD(Z80, BUGGYBOY_ZCLK / 2)
+	MDRV_CPU_PROGRAM_MAP(buggybjr_sound_prg, 0)
+	MDRV_CPU_IO_MAP(buggyboy_sound_io, 0)
+	MDRV_CPU_PERIODIC_INT(z80_irq, BUGGYBOY_ZCLK / 2 / 4 / 2048)
+
+	MDRV_MACHINE_RESET(buggybjr)
+	MDRV_MACHINE_START(buggybjr)
+	MDRV_NVRAM_HANDLER(generic_0fill)
 
 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
 	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
+
+#if 0
+	MDRV_SCREEN_RAW_PARAMS(BB_PIXEL_CLOCK, BB_HTOTAL, BB_HBEND, BB_HBSTART, BB_VTOTAL, BB_VBEND, BB_VBSTART)
+#else
+	MDRV_SCREEN_REFRESH_RATE(54.10)
+	MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(3072))
 	MDRV_SCREEN_SIZE(256, 256)
 	MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 239)
-	MDRV_GFXDECODE(bb)
-
+#endif
+	MDRV_GFXDECODE(buggyboy)
 	MDRV_PALETTE_LENGTH(256)
-	MDRV_COLORTABLE_LENGTH(256+(256*4)+(2048*4))     /* 256 for chars, 2048 for objects */
+	MDRV_COLORTABLE_LENGTH(256)
 	MDRV_PALETTE_INIT(buggyboy)
-	MDRV_VIDEO_START(buggyb1)
-	MDRV_VIDEO_UPDATE(buggyb1)
+	MDRV_VIDEO_START(buggybjr)
+	MDRV_VIDEO_UPDATE(buggybjr)
+	MDRV_VIDEO_EOF(buggyboy)
 
-	/* Sound hardware */
 	MDRV_SPEAKER_STANDARD_STEREO("Front Left", "Front Right")
-     /* MDRV_SPEAKER_STANDARD_STEREO("Rear Left", "Rear Right") */
+//  MDRV_SPEAKER_STANDARD_STEREO("Rear Left", "Rear Right")
 
-	MDRV_SOUND_ADD(AY8910, 1875000)
-	MDRV_SOUND_CONFIG(buggyboy_ay8910_interface_1)
+	MDRV_SOUND_ADD(YM2149, BUGGYBOY_ZCLK / 4)
+	MDRV_SOUND_CONFIG(buggyboy_ym2149_interface_1)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Left", 0.15)
 
-	MDRV_SOUND_ADD(AY8910, 1875000)
-	MDRV_SOUND_CONFIG(buggyboy_ay8910_interface_2)
+	MDRV_SOUND_ADD(YM2149, BUGGYBOY_ZCLK / 4)
+	MDRV_SOUND_CONFIG(buggyboy_ym2149_interface_2)
 	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Right", 0.15)
+
+	MDRV_SOUND_ADD(CUSTOM, 0)
+	MDRV_SOUND_CONFIG(bb_custom_interface)
+	MDRV_SOUND_ROUTE(0, "Front Left", 0.2)
+	MDRV_SOUND_ROUTE(1, "Front Right", 0.2)
 MACHINE_DRIVER_END
 
+/*************************************
+ *
+ *  ROM definition(s)
+ *
+ *************************************/
 
 ROM_START( tx1 )
 	ROM_REGION( 0x100000, REGION_CPU1, 0 )
-	ROM_LOAD16_BYTE( "8411-136027-157.11", 0x10000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) )   /* Z80 ROM - checksummed by main CPU */
-
 	ROM_LOAD16_BYTE( "tx1_1c.ic22", 0xf0000, 0x4000, CRC(eedcee83) SHA1(7fa0590b142fb13c6562126a9bdd5a1e032880c7) )
 	ROM_LOAD16_BYTE( "tx1_2c.ic29", 0xf0001, 0x4000, CRC(294bf5bf) SHA1(02b425caba8a187c58211bab27988205eb044558) )
+
 	ROM_LOAD16_BYTE( "tx1_4c.ic54", 0xf8001, 0x4000, CRC(15bb8ef2) SHA1(83968f010ec555fcd0548a80562fb23a892b5afb) )
 	ROM_LOAD16_BYTE( "tx1_3c.ic45", 0xf8000, 0x4000, CRC(21a8aa55) SHA1(21bc4adefb22a95fcd7a4e305bf0b05e2cb34129) )
 
@@ -1080,72 +846,93 @@
 	ROM_RELOAD(                  0x4001, 0x2000 )
 	ROM_RELOAD(                  0x8001, 0x2000 )
 	ROM_RELOAD(                  0xc001, 0x2000 )
+
 	/* Sound */
 	ROM_REGION( 0x10000, REGION_CPU3, 0 )
 	ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) )
 
 	/* 8x8 characters */
 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
-	ROM_LOAD( "tx1_20a.ic174", 0x0000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) )
-	ROM_LOAD( "tx1_21a.ic204", 0x4000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) )
+	ROM_LOAD( "tx1_21a.ic204", 0x0000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) )
+	ROM_LOAD( "tx1_20a.ic174", 0x4000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) )
 
 	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX2, ROMREGION_DISPOSE )
+	ROM_REGION( 0x40000, REGION_GFX2, 0 )
 	ROM_LOAD( "tx1_16b.ic203", 0x0000, 0x4000, CRC(1141c965) SHA1(4b90c1428bcbd72d0449c064856a5596269b3fc6) )
 	ROM_LOAD( "tx1_18b.ic258", 0x4000, 0x4000, NO_DUMP )
 
 	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE )
+	ROM_REGION( 0x40000, REGION_GFX3, 0 )
 	ROM_LOAD( "tx1_15b.ic173", 0x0000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) )
 	ROM_LOAD( "tx1_17b.ic232", 0x4000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) )
 
 	/* Road LUTs */
-	ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )
+	ROM_REGION( 0x40000, REGION_GFX4, 0 )
 	ROM_LOAD( "tx1_5a.ic56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) )
 	ROM_LOAD( "tx1_6a.ic66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) )
 	ROM_LOAD( "tx1_7a.ic76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) )
 
 	/* Arithmetic Unit Function Data ROMs */
-	ROM_REGION( 0x10000, REGION_USER1, 0 )
+	ROM_REGION( 0x10000, REGION_USER1, ROMREGION_LE )
 	ROM_LOAD16_BYTE( "tx1_10b.ic184", 0x0000, 0x4000, CRC(acf754e8) SHA1(06779e18636f0799efdaa09396e9ccd59f426257) )
 	ROM_LOAD16_BYTE( "tx1_11b.ic185", 0x0001, 0x4000, CRC(f89d3e20) SHA1(4b4cf679b7e3d63cded9989d2b667941f718ff57) )
+	ROM_LOAD16_BYTE( "xb02b.ic223", 0x8000, 0x200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
+	ROM_LOAD16_BYTE( "xb01b.ic213", 0x8001, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
 
+	/* Object chunk sequence LUT */
 	ROM_REGION( 0x50000, REGION_USER2, 0 )
-	ROM_LOAD( "tx1_14b.ic106", 0x0000, 0x4000, CRC(68c63d6e) SHA1(110e02b99c44d31041be588bd14642e26890ecbd) ) /* Object chunk sequence LUT */
-	ROM_LOAD( "tx1_13b.ic73", 0x4000, 0x4000, CRC(b0c581b2) SHA1(20926bc15e7c97045b219b828acfcdd99b8712a6) ) /* Object chunk sequence LUT */
+	ROM_LOAD( "tx1_14b.ic106", 0x0000, 0x4000, CRC(68c63d6e) SHA1(110e02b99c44d31041be588bd14642e26890ecbd) )
+	ROM_LOAD( "tx1_13b.ic73", 0x4000, 0x4000, CRC(b0c581b2) SHA1(20926bc15e7c97045b219b828acfcdd99b8712a6) )
 
+	/* Object LUT */
+	/* Object palette LUT */
 	ROM_REGION( 0x50000, REGION_USER3, 0 )
-	ROM_LOAD( "tx1_12b.ic48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) ) /* Object LUT */
-	ROM_LOAD( "tx1_19b.ic281", 0x2000, 0x4000, NO_DUMP ) /* Object palette LUT */
+	ROM_LOAD( "tx1_12b.ic48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) )
+	ROM_LOAD( "tx1_19b.ic281", 0x2000, 0x4000, NO_DUMP )
 
 	ROM_REGION( 0x10000, REGION_PROMS, 0 )
-	ROM_LOAD( "xb01b.ic213",0x0000, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
-	ROM_LOAD( "xb02b.ic223",0x0200, 0x200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
-	ROM_LOAD( "xb03a.ic25", 0x0300, 0x100, CRC(616a7a85) SHA1(b7c1060ecb128154092441212de64dc304aa3fcd) )
-	ROM_LOAD( "xb04a.ic276",0x0500, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
-	ROM_LOAD( "xb04a.ic277",0x0700, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
-	ROM_LOAD( "xb05a.ic36", 0x0800, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
-	ROM_LOAD( "xb05a.ic57", 0x0900, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
-	ROM_LOAD( "xb05a.ic8",  0x0a00, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
-	ROM_LOAD( "xb06a.ic37", 0x0b00, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
-	ROM_LOAD( "xb06a.ic58", 0x0c00, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
-	ROM_LOAD( "xb06a.ic9",  0x0d00, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
-	ROM_LOAD( "xb07a.ic10", 0x0e00, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
-	ROM_LOAD( "xb07a.ic38", 0x0f00, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
-	ROM_LOAD( "xb07a.ic59", 0x1000, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
-	ROM_LOAD( "xb08.ic116", 0x1100, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
-	ROM_LOAD( "xb08.ic148", 0x1200, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
-	ROM_LOAD( "xb08.ic85",  0x1300, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
-	ROM_LOAD( "xb09.ic33",  0x1500, 0x200, CRC(fafb6917) SHA1(30eb182c7623026dce7dba9e249bc8a9eb7a7f3e) )
-	ROM_LOAD( "xb10.ic40",  0x1700, 0x200, CRC(93deb894) SHA1(5ae9a21298c836fe649a52f3df2b4067f9012b91) )
-	ROM_LOAD( "xb11.ic49",  0x1900, 0x200, CRC(aa5ed232) SHA1(f33e7bc2dd33ac6d75fb06b93c4dd58e5d10010d) )
-	ROM_LOAD( "xb12.ic50",  0x1b00, 0x200, CRC(6b424cea) SHA1(83127326c20116b0a4be1126e163f9c6755e19dc) )
+	/* RGB palette (left) */
+	ROM_LOAD( "xb05a.ic57", 0x0000, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
+	ROM_LOAD( "xb06a.ic58", 0x0100, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
+	ROM_LOAD( "xb07a.ic59", 0x0200, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
+
+	/* RGB palette (center) */
+	ROM_LOAD( "xb05a.ic36", 0x0300, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
+	ROM_LOAD( "xb06a.ic37", 0x0400, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
+	ROM_LOAD( "xb07a.ic38", 0x0500, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
+
+	/* RGB palette (right) */
+	ROM_LOAD( "xb05a.ic8",  0x0600, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
+	ROM_LOAD( "xb06a.ic9",  0x0700, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
+	ROM_LOAD( "xb07a.ic10", 0x0800, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
+
+	/* Character colour tables (L, C, R) */
+	ROM_LOAD( "xb08.ic85",  0x0900, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
+	ROM_LOAD( "xb08.ic116", 0x0a00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
+	ROM_LOAD( "xb08.ic148", 0x0b00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
+
+	/* Object colour table */
+	ROM_LOAD( "xb04a.ic276",0x0c00, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
+	ROM_LOAD( "xb04a.ic277",0x0e00, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
+
+	/* Object tile lookup */
+	ROM_LOAD( "xb03a.ic25", 0x1000, 0x100, CRC(616a7a85) SHA1(b7c1060ecb128154092441212de64dc304aa3fcd) )
+
+	/* Road graphics */
+	ROM_LOAD( "xb09.ic33",  0x1100, 0x200, CRC(fafb6917) SHA1(30eb182c7623026dce7dba9e249bc8a9eb7a7f3e) )
+	ROM_LOAD( "xb10.ic40",  0x1300, 0x200, CRC(93deb894) SHA1(5ae9a21298c836fe649a52f3df2b4067f9012b91) )
+	ROM_LOAD( "xb11.ic49",  0x1500, 0x200, CRC(aa5ed232) SHA1(f33e7bc2dd33ac6d75fb06b93c4dd58e5d10010d) )
+
+	/* Road related */
+	ROM_LOAD( "xb12.ic50",  0x1700, 0x200, CRC(6b424cea) SHA1(83127326c20116b0a4be1126e163f9c6755e19dc) )
+
+	/* Arithmetic unit instructions */
+	ROM_LOAD16_BYTE( "xb02b.ic223", 0x1800, 0x200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
+	ROM_LOAD16_BYTE( "xb01b.ic213", 0x1801, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
 ROM_END
 
 ROM_START( tx1a )
 	ROM_REGION( 0x100000, REGION_CPU1, 0 )
-	ROM_LOAD16_BYTE( "8411-136027-157.11", 0x10000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) )   /* Z80 ROM - checksummed by main CPU */
-
 	ROM_LOAD16_BYTE( "8412-136027-244.22", 0xf0000, 0x4000, CRC(2e9cefa2) SHA1(4ca04eae446e8df08ab793488a79217ed1a27875) )
 	ROM_LOAD16_BYTE( "8412-136027-245.29", 0xf0001, 0x4000, CRC(ade7895c) SHA1(1c33a574cae46fddb4cadb85f5de17f02ae7a596) )
 	ROM_LOAD16_BYTE( "8412-136027-250.54", 0xf8001, 0x4000, CRC(c8c9368f) SHA1(0972d54d506216eb2b204cf22ccdff9210fb7b10) )
@@ -1167,48 +954,78 @@
 
 	/* 8x8 characters */
 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
-	ROM_LOAD( "8411-136027-155.174", 0x0000, 0x4000, CRC(e59a6b72) SHA1(c10efa77ab421ac60b97227a8d547f50f8415670) )
-	ROM_LOAD( "8411-136027-156.204", 0x4000, 0x4000, CRC(60f3c616) SHA1(59c4361891e4274e27e6279c919e8fd6803af7cf) )
+	ROM_LOAD( "8411-136027-156.204", 0x0000, 0x4000, CRC(60f3c616) SHA1(59c4361891e4274e27e6279c919e8fd6803af7cf) )
+	ROM_LOAD( "8411-136027-155.174", 0x4000, 0x4000, CRC(e59a6b72) SHA1(c10efa77ab421ac60b97227a8d547f50f8415670) )
 
 	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX2, ROMREGION_DISPOSE )
+	ROM_REGION( 0x40000, REGION_GFX2, 0 )
 	ROM_LOAD( "8411-136027-114.203", 0x0000, 0x4000, CRC(fc91328b) SHA1(e57fd2056b65d37cf2e1f0af56616c6555df3006) )
 	ROM_LOAD( "8411-136027-116.258", 0x4000, 0x4000, CRC(5745f671) SHA1(6e471633cd6de9926b3361a84430c088e1f6a097) )
-
-	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE )
-	ROM_LOAD( "8411-136027-115.173", 0x0000, 0x4000, CRC(720e5873) SHA1(151d9063c35b26f5876cf94bdf0c2665ec701bbd) )
-	ROM_LOAD( "8411-136027-117.232", 0x4000, 0x4000, CRC(3c68d0bc) SHA1(2dbaf2a268b90214fd61c016ac945d4371057826) )
+	ROM_LOAD( "8411-136027-115.173", 0x8000, 0x4000, CRC(720e5873) SHA1(151d9063c35b26f5876cf94bdf0c2665ec701bbd) )
+	ROM_LOAD( "8411-136027-117.232", 0xc000, 0x4000, CRC(3c68d0bc) SHA1(2dbaf2a268b90214fd61c016ac945d4371057826) )
 
 	/* Road LUTs */
-	ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )
+	ROM_REGION( 0x40000, REGION_GFX3, 0 )
 	ROM_LOAD( "8411-136027-146.56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) )
 	ROM_LOAD( "8411-136027-147.66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) )
 	ROM_LOAD( "8411-136027-148.76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) )
 
 	/* Arithmetic Unit Function Data ROMs */
-	ROM_REGION( 0x10000, REGION_USER1, 0 )
+	ROM_REGION( 0x10000, REGION_USER1, ROMREGION_LE )
 	ROM_LOAD16_BYTE( "8411-136027-153.184", 0x0000, 0x4000, CRC(acf754e8) SHA1(06779e18636f0799efdaa09396e9ccd59f426257) )
 	ROM_LOAD16_BYTE( "8411-136027-154.185", 0x0001, 0x4000, CRC(f89d3e20) SHA1(4b4cf679b7e3d63cded9989d2b667941f718ff57) )
+	ROM_LOAD16_BYTE( "xb02b.ic223", 0x8000, 0x200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
+	ROM_LOAD16_BYTE( "xb01b.ic213", 0x8001, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
 
 	ROM_REGION( 0x50000, REGION_USER2, 0 )
 	ROM_LOAD( "8411-136027-119.106", 0x0000, 0x4000, CRC(88eec0fb) SHA1(81d7a69dc1a4b3b81d7f28d97a3f80697cdcc6eb) ) /* Object chunk sequence LUT */
-	ROM_LOAD( "8411-136027-120.73", 0x4000, 0x4000, CRC(407cbe65) SHA1(e1c11b65f3c6abde6d55afeaffdb39cdd6d66377) ) /* Object chunk sequence LUT */
+	ROM_LOAD( "8411-136027-120.73",  0x4000, 0x4000, CRC(407cbe65) SHA1(e1c11b65f3c6abde6d55afeaffdb39cdd6d66377) ) /* Object chunk sequence LUT */
 
 	ROM_REGION( 0x50000, REGION_USER3, 0 )
 	ROM_LOAD( "8411-136027-113.48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) ) /* Object LUT */
 	ROM_LOAD( "8411-136027-118.281", 0x2000, 0x4000, CRC(de418dc7) SHA1(1233e2f7499ec5a73a40ee336d3fe26c06187784) ) /* Object palette LUT */
 
-	/* PROMs not dumped. May well be the same as the Tazmi set. */
+	/* Atari PROMs are not dumped but should be the same as the Tatsumi set. */
+	ROM_REGION( 0x10000, REGION_PROMS, 0 )
+	/* RGB palette (left) */
+	ROM_LOAD( "xb05a.ic57", 0x0000, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
+	ROM_LOAD( "xb06a.ic58", 0x0100, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
+	ROM_LOAD( "xb07a.ic59", 0x0200, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
+
+	/* RGB palette (center) */
+	ROM_LOAD( "xb05a.ic36", 0x0300, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
+	ROM_LOAD( "xb06a.ic37", 0x0400, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
+	ROM_LOAD( "xb07a.ic38", 0x0500, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
+
+	/* RGB palette (right) */
+	ROM_LOAD( "xb05a.ic8",  0x0600, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
+	ROM_LOAD( "xb06a.ic9",  0x0700, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
+	ROM_LOAD( "xb07a.ic10", 0x0800, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
+
+	/* Character colour tables (L, C, R) */
+	ROM_LOAD( "xb08.ic85",  0x0900, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
+	ROM_LOAD( "xb08.ic116", 0x0a00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
+	ROM_LOAD( "xb08.ic148", 0x0b00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
+
+	/* Object colour table */
+	ROM_LOAD( "xb04a.ic276",0x0c00, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
+	ROM_LOAD( "xb04a.ic277",0x0e00, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
+
+	/* Object tile lookup */
+	ROM_LOAD( "xb03a.ic25", 0x1000, 0x100, CRC(616a7a85) SHA1(b7c1060ecb128154092441212de64dc304aa3fcd) )
+
+	/* Road graphics */
+	ROM_LOAD( "xb09.ic33",  0x1100, 0x200, CRC(fafb6917) SHA1(30eb182c7623026dce7dba9e249bc8a9eb7a7f3e) )
+	ROM_LOAD( "xb10.ic40",  0x1300, 0x200, CRC(93deb894) SHA1(5ae9a21298c836fe649a52f3df2b4067f9012b91) )
+	ROM_LOAD( "xb11.ic49",  0x1500, 0x200, CRC(aa5ed232) SHA1(f33e7bc2dd33ac6d75fb06b93c4dd58e5d10010d) )
+
+	/* Road related */
+	ROM_LOAD( "xb12.ic50",  0x1700, 0x200, CRC(6b424cea) SHA1(83127326c20116b0a4be1126e163f9c6755e19dc) )
 ROM_END
 
 /* The single monitor is the parent set at the moment, as the 3-monitor dump is incomplete */
-
-/* Single Monitor Version */
-ROM_START( buggyb1 )
+ROM_START( buggybjr )
 	ROM_REGION( 0x100000, REGION_CPU1, 0 )
-	ROM_LOAD16_BYTE( "bug35s.21", 0x10000, 0x4000, CRC(65d9af57) SHA1(17b09404942d17e7254550c43b56ae96a8c55680) ) /* Z80 ROM - checksummed by main CPU */
-
 	ROM_LOAD16_BYTE( "bug1a.214", 0x20000, 0x8000, CRC(92797c25) SHA1(8f7434abbd7f557d3202abb01b1e4899c82c67a5) )
 	ROM_LOAD16_BYTE( "bug4a.175", 0x20001, 0x8000, CRC(40ce3930) SHA1(4bf62ebeea1549a13a21a32cb860717f064b186a) )
 
@@ -1230,78 +1047,66 @@
 	ROM_LOAD( "bug35s.21", 0x00000, 0x4000, CRC(65d9af57) SHA1(17b09404942d17e7254550c43b56ae96a8c55680) )
 
 	/* 8x8 characters */
-	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
+	ROM_REGION( 0x8000, REGION_GFX1, 0 )
 	ROM_LOAD( "bug34s.46", 0x00000, 0x4000, CRC(8ea8fec4) SHA1(75e67c9a59a86fcdedf2a70fafd303baa552aa18) )
 	ROM_LOAD( "bug33s.47", 0x04000, 0x4000, CRC(459c2b03) SHA1(ff62a86195042a349fbe799c638cf590fe9572bb) )
 
 	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX2, ROMREGION_DISPOSE )
-	ROM_LOAD( "bug26s.147", 0x0000, 0x8000, CRC(14033710) SHA1(e05afeb557ce14055fa8b4f6d8805307feaa1660) )
-	ROM_LOAD( "bug19s.144", 0x8000, 0x8000, CRC(838e0697) SHA1(0e9aff2c4065d79350ddb55edff57a899c33ef1c) )
-
-	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE )
-	ROM_LOAD( "bug28s.146", 0x0000, 0x8000, CRC(8b47d227) SHA1(a3e57594ad0085e8b1bd327c580eb36237f3e3d2) )
-	ROM_LOAD( "bug21s.143", 0x8000, 0x8000, CRC(876a5666) SHA1(db485cdf35f63c080c919ee86374f63e577092c3) )
-
-	/* 8x8 object chunks */
-	ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )
-	ROM_LOAD( "bug30s.145", 0x0000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) )
-	ROM_LOAD( "bug23s.142", 0x8000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) )
+	ROM_REGION( 0x40000, REGION_GFX2, 0 )
+	ROM_LOAD( "bug26s.147", 0x00000, 0x8000, CRC(14033710) SHA1(e05afeb557ce14055fa8b4f6d8805307feaa1660) )
+	ROM_LOAD( "bug19s.144", 0x08000, 0x8000, CRC(838e0697) SHA1(0e9aff2c4065d79350ddb55edff57a899c33ef1c) )
+	ROM_LOAD( "bug28s.146", 0x10000, 0x8000, CRC(8b47d227) SHA1(a3e57594ad0085e8b1bd327c580eb36237f3e3d2) )
+	ROM_LOAD( "bug21s.143", 0x18000, 0x8000, CRC(876a5666) SHA1(db485cdf35f63c080c919ee86374f63e577092c3) )
+	ROM_LOAD( "bug30s.145", 0x20000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) )
+	ROM_LOAD( "bug23s.142", 0x28000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) )
 
 	/* Road */
-	ROM_REGION( 0x40000, REGION_GFX6, 0)
-	ROM_LOAD( "bb3s", 0x000, 0x200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) )
-	ROM_LOAD( "bb4s", 0x200, 0x200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) )
-	ROM_LOAD( "bb5s", 0x400, 0x200, CRC(65925c9e) SHA1(d1ff1cb9f83c09e52a96632945e4edfedc335fd4) )
-	ROM_LOAD( "bug11s.225", 0x1000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) ) /* Road Lookup */
+	ROM_REGION( 0x40000, REGION_GFX6, 0 )
+	ROM_LOAD( "bug11s.225", 0x0000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) )
+	ROM_LOAD( "bb3s", 0x4000, 0x200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) )
+	ROM_LOAD( "bb4s", 0x4200, 0x200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) )
+	ROM_LOAD( "bb5s", 0x4400, 0x200, CRC(65925c9e) SHA1(d1ff1cb9f83c09e52a96632945e4edfedc335fd4) )
+	ROM_LOAD( "bb6.224", 0x4600, 0x200, CRC(ad43e02a) SHA1(c50a398020508f52ddf8d45881f211d17d096fa1) )
 
 	/* Arithmetic Unit Function Data ROMs */
-	ROM_REGION( 0x10000, REGION_USER1, 0 )
-	ROM_LOAD( "bug9.138",  0x0800, 0x800, CRC(7d84135b) SHA1(3c669c4e796e83672aceeb6de1aeea28f9f2fef0) )
-	ROM_CONTINUE(          0x1800, 0x800 )
-	ROM_CONTINUE(          0x2800, 0x800 )
-	ROM_CONTINUE(          0x3800, 0x800 )
-	ROM_CONTINUE(          0x4800, 0x800 )
-	ROM_CONTINUE(          0x5800, 0x800 )
-	ROM_CONTINUE(          0x6800, 0x800 )
-	ROM_CONTINUE(          0x7800, 0x800 )
-
-	ROM_LOAD( "bug10.95",  0x0000, 0x800, CRC(b518dd6f) SHA1(7cefa2f9438306c81dc83cd260928c835eb9b712) )
-	ROM_CONTINUE(          0x1000, 0x800 )
-	ROM_CONTINUE(          0x2000, 0x800 )
-	ROM_CONTINUE(          0x3000, 0x800 )
-	ROM_CONTINUE(          0x4000, 0x800 )
-	ROM_CONTINUE(          0x5000, 0x800 )
-	ROM_CONTINUE(          0x6000, 0x800 )
-	ROM_CONTINUE(          0x7000, 0x800 )
+	ROM_REGION( 0x10000, REGION_USER1, ROMREGION_LE )
+	ROM_LOAD16_BYTE( "bug9.138", 0x0000, 0x4000, CRC(7d84135b) SHA1(3c669c4e796e83672aceeb6de1aeea28f9f2fef0) )
+	ROM_LOAD16_BYTE( "bug10.95", 0x0001, 0x4000, CRC(b518dd6f) SHA1(7cefa2f9438306c81dc83cd260928c835eb9b712) )
+	ROM_LOAD16_BYTE( "bb1.163",  0x8000, 0x0200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) )
+	ROM_LOAD16_BYTE( "bb2.162",  0x8001, 0x0200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) )
 
+	/* Object chunk sequence LUT */
 	ROM_REGION( 0x100000, REGION_USER2, 0 )
-	ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) ) /* Object chunk sequence LUT */
-	ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) ) /* Object chunk sequence LUT */
+	ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) )
+	ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
 
+	/* Object LUT and palette LUT*/
 	ROM_REGION( 0x10000, REGION_USER3, 0 )
-	ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )   /* Object LUT */
-	ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) ) /* Object palette LUT */
+	ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
+	ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
 
 	ROM_REGION( 0x10000, REGION_PROMS, 0 )
-	ROM_LOAD( "bb10.41", 0x000, 0x100, CRC(f2368398) SHA1(53f28dba11bb494d033bb279abf138975c84b20d) )  /* RED */
-	ROM_LOAD( "bb11.40", 0x100, 0x100, CRC(bf77f624) SHA1(b042d293d2094dbabb32d628fd9addd832f084ef) )  /* GREEN */
-	ROM_LOAD( "bb12.39", 0x200, 0x100, CRC(10a2e8d1) SHA1(51a8c51ecbbb7bd04ae46fb5598d2c8de8097581) )  /* BLUE */
+	/* RGBI */
+	ROM_LOAD( "bb10.41", 0x000, 0x100, CRC(f2368398) SHA1(53f28dba11bb494d033bb279abf138975c84b20d) )
+	ROM_LOAD( "bb11.40", 0x100, 0x100, CRC(bf77f624) SHA1(b042d293d2094dbabb32d628fd9addd832f084ef) )
+	ROM_LOAD( "bb12.39", 0x200, 0x100, CRC(10a2e8d1) SHA1(51a8c51ecbbb7bd04ae46fb5598d2c8de8097581) )
 	ROM_LOAD( "bb13.42", 0x300, 0x100, CRC(40d10dfa) SHA1(e40b4c424827937fec6df1a27b19b8dc09d3274a) )
-	ROM_LOAD( "bb14.19", 0x400, 0x100, CRC(0b821e0b) SHA1(b9401b9364fb99e15f562df91dcfdec1b989af2d) )  /* Character colour LUT */
 
-	ROM_LOAD( "bb9.190", 0x500, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )  /* Object colour LUT (odd) */
-	ROM_LOAD( "bb9.162", 0xd00, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )  /* Object colour LUT (even)*/
-	ROM_LOAD( "bb7.188", 0x1500, 0x100, CRC(b57b609f) SHA1(2dea375437c62cb4c64b21d5e6ddc09397b6ab35) )  /* Road colour LUT */
-
-	ROM_LOAD( "bb8.31",  0x1600, 0x100, CRC(2330ff4f) SHA1(e86eb63ce47572bcbbf325f9bb749d10d96bf2e7) )  /* Object tile LUT */
-	ROM_LOAD( "bb1.163", 0x1700, 0x200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) )  /* Arithmetic instruction PROM */
-	ROM_LOAD( "bb2.162", 0x1900, 0x200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) )  /* Arithmetic instruction PROM */
-	ROM_LOAD( "bb6.224", 0x1b00, 0x200, CRC(ad43e02a) SHA1(c50a398020508f52ddf8d45881f211d17d096fa1) )  /* Road video timing? */
+	/* Character colour LUT */
+	ROM_LOAD( "bb14.19", 0x400, 0x100, CRC(0b821e0b) SHA1(b9401b9364fb99e15f562df91dcfdec1b989af2d) )
+
+	/* Object colour LUTs (odd and even pixels) */
+	ROM_LOAD( "bb9.190", 0x500, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )
+	ROM_LOAD( "bb9.162", 0xd00, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )
+
+	/* Object tile LUT */
+	ROM_LOAD( "bb8.31", 0x1600, 0x100, CRC(2330ff4f) SHA1(e86eb63ce47572bcbbf325f9bb749d10d96bf2e7) )
+
+	/* Road */
+	ROM_LOAD( "bb7.188", 0x1500, 0x100, CRC(b57b609f) SHA1(2dea375437c62cb4c64b21d5e6ddc09397b6ab35) )
 ROM_END
 
-/* 3 Monitor Version */
+
 ROM_START( buggyboy )
 	ROM_REGION( 0x100000, REGION_CPU1, 0 )
 	ROM_LOAD16_BYTE( "bug1a.230", 0x20000, 0x8000, CRC(92797c25) SHA1(8f7434abbd7f557d3202abb01b1e4899c82c67a5) )
@@ -1313,8 +1118,6 @@
 	ROM_LOAD16_BYTE( "bug3b.232", 0xf8000, 0x4000, CRC(43cce3f0) SHA1(17de3728d809d386f6a7a330c8c8701975d4ebed) )
 	ROM_LOAD16_BYTE( "bug6b.175", 0xf8001, 0x4000, CRC(8f000dfa) SHA1(5fd78a03a00f547bbb431839f78a8d10a4ba8e3e) )
 
-	ROM_LOAD16_BYTE( "bug35.11",  0x10000, 0x4000, CRC(7aa16e9e) SHA1(ea54e56270f70351a62a78fa32027bb41ef9861e) ) /* Z80 ROM - tested by main CPU */
-
 	ROM_REGION( 0x100000, REGION_CPU2, 0 )
 	ROM_LOAD16_BYTE( "bug8a.061", 0x4000, 0x2000, CRC(512291cd) SHA1(60f87133c86b88b982ba4680f96d0ac55970cb8d) )
 	ROM_RELOAD(                  0x8000,  0x2000 )
@@ -1326,87 +1129,70 @@
 	ROM_RELOAD(                  0xc001,  0x2000 )
 	ROM_RELOAD(                  0xfc001, 0x2000 )
 
-	ROM_REGION( 0x10000, REGION_CPU3, 0 )  /* Sound */
+	ROM_REGION( 0x10000, REGION_CPU3, 0 )
 	ROM_LOAD( "bug35.11", 0x00000, 0x4000,  CRC(7aa16e9e) SHA1(ea54e56270f70351a62a78fa32027bb41ef9861e) )
 
-	/* 8x8 Characters */
 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
 	ROM_LOAD( "bug34s.46", 0x00000, 0x4000, CRC(8ea8fec4) SHA1(75e67c9a59a86fcdedf2a70fafd303baa552aa18) )
 	ROM_LOAD( "bug33s.47", 0x04000, 0x4000, CRC(459c2b03) SHA1(ff62a86195042a349fbe799c638cf590fe9572bb) )
 
-	/* 8x8 object chunks */
 	ROM_REGION( 0x40000, REGION_GFX2, ROMREGION_DISPOSE )
 	ROM_LOAD( "bug26s.147", 0x0000, 0x8000, CRC(14033710) SHA1(e05afeb557ce14055fa8b4f6d8805307feaa1660) )
 	ROM_LOAD( "bug19s.144", 0x8000, 0x8000, CRC(838e0697) SHA1(0e9aff2c4065d79350ddb55edff57a899c33ef1c) )
 
-	/* 8x8 object chunks */
 	ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE )
 	ROM_LOAD( "bug28s.146", 0x0000, 0x8000, CRC(8b47d227) SHA1(a3e57594ad0085e8b1bd327c580eb36237f3e3d2) )
 	ROM_LOAD( "bug21s.143", 0x8000, 0x8000, CRC(876a5666) SHA1(db485cdf35f63c080c919ee86374f63e577092c3) )
 
-	/* 8x8 object chunks */
 	ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )
 	ROM_LOAD( "bug30s.145", 0x0000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) )
 	ROM_LOAD( "bug23s.142", 0x8000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) )
 
-	/* Object Lookups */
 	ROM_REGION( 0x40000, REGION_GFX5, ROMREGION_DISPOSE )
 	ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) )
 	ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
 	ROM_LOAD( "bug18s.141", 0x10000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
 
-	/* Road */
 	ROM_REGION( 0x40000, REGION_GFX6, 0)
 	ROM_LOAD( "bb3s", 0x000, 0x200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) )
 	ROM_LOAD( "bb4s", 0x200, 0x200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) )
 	ROM_LOAD( "bb5s", 0x400, 0x200, CRC(65925c9e) SHA1(d1ff1cb9f83c09e52a96632945e4edfedc335fd4) )
-	ROM_LOAD( "bug11s.225", 0x1000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) ) /* Road Lookup */
+	ROM_LOAD( "bug11s.225", 0x1000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) )
 
-	/* Arithmetic Unit Function Data ROMs */
-	ROM_REGION( 0x10000, REGION_USER1, 0 )
-	ROM_LOAD( "bug9.138",  0x0800, 0x800, CRC(7d84135b) SHA1(3c669c4e796e83672aceeb6de1aeea28f9f2fef0) )
-	ROM_CONTINUE(          0x1800, 0x800 )
-	ROM_CONTINUE(          0x2800, 0x800 )
-	ROM_CONTINUE(          0x3800, 0x800 )
-	ROM_CONTINUE(          0x4800, 0x800 )
-	ROM_CONTINUE(          0x5800, 0x800 )
-	ROM_CONTINUE(          0x6800, 0x800 )
-	ROM_CONTINUE(          0x7800, 0x800 )
-
-	ROM_LOAD( "bug10.95",  0x0000, 0x800, CRC(b518dd6f) SHA1(7cefa2f9438306c81dc83cd260928c835eb9b712) )
-	ROM_CONTINUE(          0x1000, 0x800 )
-	ROM_CONTINUE(          0x2000, 0x800 )
-	ROM_CONTINUE(          0x3000, 0x800 )
-	ROM_CONTINUE(          0x4000, 0x800 )
-	ROM_CONTINUE(          0x5000, 0x800 )
-	ROM_CONTINUE(          0x6000, 0x800 )
-	ROM_CONTINUE(          0x7000, 0x800 )
+	ROM_REGION( 0x10000, REGION_USER1, ROMREGION_LE )
+	ROM_LOAD16_BYTE( "bug9.138", 0x0000, 0x4000, CRC(7d84135b) SHA1(3c669c4e796e83672aceeb6de1aeea28f9f2fef0) )
+	ROM_LOAD16_BYTE( "bug10.95", 0x0001, 0x4000, CRC(b518dd6f) SHA1(7cefa2f9438306c81dc83cd260928c835eb9b712) )
+	ROM_LOAD16_BYTE( "bb1.163",  0x8000, 0x0200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) )
+	ROM_LOAD16_BYTE( "bb2.162",  0x8001, 0x0200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) )
 
 	ROM_REGION( 0x100000, REGION_USER2, 0 )
-	ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) ) /* Object chunk sequence LUT */
-	ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) ) /* Object chunk sequence LUT */
+	ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) )
+	ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
 
 	ROM_REGION( 0x10000, REGION_USER3, 0 )
-	ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )   /* Object LUT */
-	ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) ) /* Object palette LUT */
+	ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
+	ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
 
 	ROM_REGION( 0x10000, REGION_PROMS, 0 )
-	ROM_LOAD( "bb10.41", 0x000, 0x100, CRC(f2368398) SHA1(53f28dba11bb494d033bb279abf138975c84b20d) )  /* RED */
-	ROM_LOAD( "bb11.40", 0x100, 0x100, CRC(bf77f624) SHA1(b042d293d2094dbabb32d628fd9addd832f084ef) )  /* GREEN */
-	ROM_LOAD( "bb12.39", 0x200, 0x100, CRC(10a2e8d1) SHA1(51a8c51ecbbb7bd04ae46fb5598d2c8de8097581) )  /* BLUE */
+	ROM_LOAD( "bb10.41", 0x000, 0x100, CRC(f2368398) SHA1(53f28dba11bb494d033bb279abf138975c84b20d) )
+	ROM_LOAD( "bb11.40", 0x100, 0x100, CRC(bf77f624) SHA1(b042d293d2094dbabb32d628fd9addd832f084ef) )
+	ROM_LOAD( "bb12.39", 0x200, 0x100, CRC(10a2e8d1) SHA1(51a8c51ecbbb7bd04ae46fb5598d2c8de8097581) )
 	ROM_LOAD( "bb13.42", 0x300, 0x100, CRC(40d10dfa) SHA1(e40b4c424827937fec6df1a27b19b8dc09d3274a) )
-	ROM_LOAD( "bb14.19", 0x400, 0x100, CRC(0b821e0b) SHA1(b9401b9364fb99e15f562df91dcfdec1b989af2d) )  /* Character colour LUT */
+	ROM_LOAD( "bb14.19", 0x400, 0x100, CRC(0b821e0b) SHA1(b9401b9364fb99e15f562df91dcfdec1b989af2d) )
 
-	ROM_LOAD( "bb9.190", 0x500, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )  /* Object colour LUT (odd) */
-	ROM_LOAD( "bb9.162", 0xd00, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )  /* Object colour LUT (even)*/
-	ROM_LOAD( "bb7.188", 0x1500,0x100, CRC(b57b609f) SHA1(2dea375437c62cb4c64b21d5e6ddc09397b6ab35) )  /* Road colour LUT */
-
-	ROM_LOAD( "bb8.31", 0x1600, 0x100, CRC(2330ff4f) SHA1(e86eb63ce47572bcbbf325f9bb749d10d96bf2e7) )  /* Object tile LUT */
-	ROM_LOAD( "bb1.163", 0x1700, 0x200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) )  /* Arithmetic instruction PROM */
-	ROM_LOAD( "bb2.162", 0x1900, 0x200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) )  /* Arithmetic instruction PROM */
+	ROM_LOAD( "bb9.190", 0x500, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )
+	ROM_LOAD( "bb9.162", 0xd00, 0x800, CRC(6fc807d1) SHA1(3442cbb21bbedf6291a3fe1747d479445f613d26) )
+	ROM_LOAD( "bb7.188", 0x1500,0x100, CRC(b57b609f) SHA1(2dea375437c62cb4c64b21d5e6ddc09397b6ab35) )
+	ROM_LOAD( "bb8.31", 0x1600, 0x100, CRC(2330ff4f) SHA1(e86eb63ce47572bcbbf325f9bb749d10d96bf2e7) )
 ROM_END
 
-GAME( 1983, tx1,      0,       tx1,      tx1,      0, ROT0, "Tazmi",   "TX-1",                             GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
-GAME( 1983, tx1a,     0,       tx1,      tx1,      0, ROT0, "Tazmi",   "TX-1 (Atari/Namco/Taito License)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
-GAME( 1985, buggyboy, buggyb1, buggyboy, buggyboy, 0, ROT0, "Tatsumi", "Buggy Boy",                        GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
-GAME( 1986, buggyb1,  0,       buggyb1,  buggyb1,  0, ROT0, "Tatsumi", "Buggy Boy (Single Monitor)",       GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
+/*************************************
+ *
+ *  Game driver(s)
+ *
+ *************************************/
+
+GAME( 1983, tx1,      0,        tx1,      tx1,      0, ROT0, "Tatsumi", "TX-1",                                   GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
+GAME( 1983, tx1a,     tx1,      tx1,      tx1,      0, ROT0, "Tatsumi", "TX-1 (Atari/Namco/Taito license)",       GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
+GAME( 1985, buggyboy, buggybjr, buggyboy, buggyboy, 0, ROT0, "Tatsumi", "Buggy Boy/Speed Buggy (Cockpit)",        GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
+GAME( 1986, buggybjr, 0,        buggybjr, buggybjr, 0, ROT0, "Tatsumi", "Buggy Boy Junior/Speed Buggy (Upright)", 0 )
diff -Nru src-old/mame/drivers/zac2650.c src/mame/drivers/zac2650.c
--- src-old/mame/drivers/zac2650.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/drivers/zac2650.c	2007-12-23 19:41:16.000000000 -0800
@@ -13,7 +13,7 @@
 
 #include "tinv2650.lh"
 
-extern UINT8 *s2636ram;
+extern UINT8 *zac_s2636ram;
 
 extern WRITE8_HANDLER( tinvader_videoram_w );
 extern WRITE8_HANDLER( zac_s2636_w );
@@ -45,7 +45,7 @@
     AM_RANGE(0x1d00, 0x1dff) AM_WRITE(MWA8_RAM)
     AM_RANGE(0x1e80, 0x1e80) AM_WRITE(tinvader_sound_w)
 	AM_RANGE(0x1e86, 0x1e86) AM_WRITE(MWA8_NOP)				/* Dodgem Only */
-    AM_RANGE(0x1f00, 0x1fff) AM_WRITE(zac_s2636_w) AM_BASE(&s2636ram)
+	AM_RANGE(0x1f00, 0x1fff) AM_WRITE(zac_s2636_w) AM_BASE(&zac_s2636ram)
 ADDRESS_MAP_END
 
 static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
diff -Nru src-old/mame/includes/dynax.h src/mame/includes/dynax.h
--- src-old/mame/includes/dynax.h	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/includes/dynax.h	2007-12-23 19:41:16.000000000 -0800
@@ -76,32 +76,18 @@
 //----------- defined in drivers/ddenlovr.c -----------
 
 WRITE8_HANDLER( ddenlovr_bgcolor_w );
-WRITE8_HANDLER( ddenlovr_bgcolor2_w );
-WRITE16_HANDLER( ddenlovr16_bgcolor_w );
 
 WRITE8_HANDLER( ddenlovr_priority_w );
-WRITE8_HANDLER( ddenlovr_priority2_w );
-WRITE16_HANDLER( ddenlovr16_priority_w );
 
 WRITE8_HANDLER( ddenlovr_layer_enable_w );
-WRITE8_HANDLER( ddenlovr_layer_enable2_w );
-WRITE16_HANDLER( ddenlovr16_layer_enable_w );
 
 WRITE8_HANDLER( ddenlovr_palette_base_w );
-WRITE8_HANDLER( ddenlovr_palette_base2_w );
-WRITE16_HANDLER( ddenlovr16_palette_base_w );
 
 WRITE8_HANDLER( ddenlovr_palette_mask_w );
-WRITE8_HANDLER( ddenlovr_palette_mask2_w );
-WRITE16_HANDLER( ddenlovr16_palette_mask_w );
 
 WRITE8_HANDLER( ddenlovr_transparency_pen_w );
-WRITE8_HANDLER( ddenlovr_transparency_pen2_w );
-WRITE16_HANDLER( ddenlovr16_transparency_pen_w );
 
 WRITE8_HANDLER( ddenlovr_transparency_mask_w );
-WRITE8_HANDLER( ddenlovr_transparency_mask2_w );
-WRITE16_HANDLER( ddenlovr16_transparency_mask_w );
 
 extern UINT8 *ddenlovr_pixmap[8];
 
diff -Nru src-old/mame/includes/midzeus.h src/mame/includes/midzeus.h
--- src-old/mame/includes/midzeus.h	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/includes/midzeus.h	2007-12-21 08:12:20.000000000 -0800
@@ -17,6 +17,9 @@
 READ32_HANDLER( zeus_r );
 WRITE32_HANDLER( zeus_w );
 
+VIDEO_START( midzeus2 );
+VIDEO_UPDATE( midzeus2 );
+
 READ32_HANDLER( zeus2_r );
 WRITE32_HANDLER( zeus2_w );
 
diff -Nru src-old/mame/includes/segas24.h src/mame/includes/segas24.h
--- src-old/mame/includes/segas24.h	2007-12-17 08:37:57.000000000 -0800
+++ src/mame/includes/segas24.h	2007-12-23 19:41:16.000000000 -0800
@@ -1,4 +1,4 @@
-/*----------- defined in machine/system24.c -----------*/
+/*----------- defined in machine/segas24.c -----------*/
 
 /* system24temp_ functions / variables are from shared rewrite files,
    once the rest of the rewrite is complete they can be removed, I
diff -Nru src-old/mame/includes/st0016.h src/mame/includes/st0016.h
--- src-old/mame/includes/st0016.h	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/includes/st0016.h	2007-12-23 19:41:16.000000000 -0800
@@ -18,11 +18,6 @@
 #define ST0016_CHAR_BANK_MASK (ST0016_MAX_CHAR_BANK-1)
 #define ST0016_PAL_BANK_MASK  (ST0016_MAX_PAL_BANK-1)
 
-/*----------- defined in drivers/macs.c -----------*/
-
-extern UINT8 macs_mux_data;
-
-
 /*----------- defined in video/st0016.c -----------*/
 
 extern UINT8 *st0016_charram,*st0016_spriteram,*st0016_paletteram;
diff -Nru src-old/mame/includes/tx1.h src/mame/includes/tx1.h
--- src-old/mame/includes/tx1.h	1969-12-31 16:00:00.000000000 -0800
+++ src/mame/includes/tx1.h	2007-12-20 15:58:28.000000000 -0800
@@ -0,0 +1,106 @@
+/*************************************************************************
+
+    TX-1/Buggy Boy hardware
+
+*************************************************************************/
+#include "machine/8255ppi.h"
+#include "sound/custom.h"
+
+#define TX1_PIXEL_CLOCK		6000000
+#define TX1_HBSTART			256
+#define TX1_HBEND			0
+#define TX1_HTOTAL			384
+#define TX1_VBSTART			240
+#define TX1_VBEND			0
+#define TX1_VTOTAL			264
+
+#define BB_PIXEL_CLOCK		6000000
+#define BB_HBSTART			256
+#define BB_HBEND			0
+#define BB_HTOTAL			384
+#define BB_VBSTART			240
+#define BB_VBEND			0
+#define BB_VTOTAL			288
+
+/* Buggy Boy PCBs could use 8086s or V30s */
+#define BUGGYBOY_CPU_TYPE	I8086
+#define BUGGYBOY_ZCLK		7500000
+
+
+/*----------- defined in drivers/tx1.c -----------*/
+extern UINT16 *tx1_math_ram;
+extern ppi8255_interface tx1_ppi8255_intf;
+extern ppi8255_interface buggyboy_ppi8255_intf;
+
+/*----------- defined in machine/tx1.c -----------*/
+READ16_HANDLER( tx1_spcs_rom_r );
+READ16_HANDLER( tx1_spcs_ram_r );
+WRITE16_HANDLER( tx1_spcs_ram_w );
+READ16_HANDLER( tx1_math_r );
+WRITE16_HANDLER( tx1_math_w );
+MACHINE_START( tx1 );
+MACHINE_RESET( tx1 );
+
+
+READ16_HANDLER( buggyboy_spcs_rom_r );
+READ16_HANDLER( buggyboy_spcs_ram_r );
+WRITE16_HANDLER( buggyboy_spcs_ram_w );
+READ16_HANDLER( buggyboy_math_r );
+WRITE16_HANDLER( buggyboy_math_w );
+MACHINE_RESET( buggybjr );
+MACHINE_RESET( buggyboy );
+MACHINE_START( buggybjr );
+MACHINE_START( buggyboy );
+
+/*----------- defined in audio/tx1.c -----------*/
+READ8_HANDLER( pit8253_r );
+WRITE8_HANDLER( pit8253_w );
+
+WRITE8_HANDLER( bb_ym1_a_w );
+WRITE8_HANDLER( bb_ym1_b_w );
+void *buggyboy_sh_start(int clock, const struct CustomSound_interface *config);
+void buggyboy_sh_reset(void *token);
+
+void *tx1_sh_start(int clock, const struct CustomSound_interface *config);
+void tx1_sh_reset(void *token);
+
+
+/*----------- defined in video/tx1.c -----------*/
+READ16_HANDLER( tx1_crtc_r );
+WRITE16_HANDLER( tx1_crtc_w );
+
+extern UINT16 *tx1_vram;
+extern UINT16 *tx1_objram;
+extern UINT16 *tx1_rcram;
+extern size_t tx1_objram_size;
+PALETTE_INIT( tx1 );
+WRITE16_HANDLER( tx1_vram_w );
+VIDEO_START( tx1 );
+VIDEO_UPDATE( tx1 );
+VIDEO_EOF( tx1 );
+WRITE16_HANDLER( tx1_slincs_w );
+WRITE16_HANDLER( tx1_slock_w );
+WRITE16_HANDLER( tx1_scolst_w );
+WRITE16_HANDLER( tx1_bankcs_w );
+WRITE16_HANDLER( tx1_flgcs_w );
+
+extern UINT16 *buggyboy_objram;
+extern UINT16 *buggyboy_rcram;
+extern UINT16 *buggyboy_vram;
+extern size_t buggyboy_objram_size;
+extern size_t buggyboy_rcram_size;
+PALETTE_INIT( buggyboy );
+WRITE16_HANDLER( buggyboy_vram_w );
+VIDEO_START( buggyboy );
+VIDEO_UPDATE( buggyboy );
+VIDEO_EOF( buggyboy );
+
+extern UINT16 *buggybjr_vram;
+PALETTE_INIT( buggybjr );
+WRITE16_HANDLER( buggybjr_vram_w );
+VIDEO_START( buggybjr );
+VIDEO_UPDATE( buggybjr );
+WRITE16_HANDLER( buggyboy_slincs_w );
+WRITE16_HANDLER( buggyboy_scolst_w );
+WRITE16_HANDLER( buggyboy_gas_w );
+WRITE16_HANDLER( buggyboy_sky_w );
diff -Nru src-old/mame/machine/cubocd32.c src/mame/machine/cubocd32.c
--- src-old/mame/machine/cubocd32.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/machine/cubocd32.c	2007-12-23 19:41:16.000000000 -0800
@@ -4,6 +4,8 @@
 #include "coreutil.h"
 #include "sound/cdda.h"
 #include "machine/i2cmem.h"
+#include "includes/cubocd32.h"
+
 
 
 /*********************************************************************************
diff -Nru src-old/mame/machine/model1.c src/mame/machine/model1.c
--- src-old/mame/machine/model1.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/machine/model1.c	2007-12-23 19:41:16.000000000 -0800
@@ -1155,10 +1155,6 @@
 	next_fn();
 }
 
-void tgp_tick(void)
-{
-}
-
 static void catmull_rom(void)
 {
 	float a = fifoin_pop_f();
diff -Nru src-old/mame/machine/tatsumi.c src/mame/machine/tatsumi.c
--- src-old/mame/machine/tatsumi.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/machine/tatsumi.c	2007-12-23 19:41:16.000000000 -0800
@@ -3,7 +3,7 @@
 #include "sound/2151intf.h"
 #include "sound/okim6295.h"
 
-/*static*/ UINT16 tatsumi_control_word=0;
+UINT16 tatsumi_control_word=0;
 static UINT16 tatsumi_last_control=0;
 static UINT16 tatsumi_last_irq=0;
 static UINT8 apache3_adc;
diff -Nru src-old/mame/machine/tx1.c src/mame/machine/tx1.c
--- src-old/mame/machine/tx1.c	2007-12-18 00:09:03.000000000 -0800
+++ src/mame/machine/tx1.c	2007-12-23 20:03:00.000000000 -0800
@@ -1,679 +1,1453 @@
-/*===================================================================*/
-/*               TX-1/Buggy Boy (Tatsumi) Hardware                   */
-/*         SN74S516 Arithmetic Unit and Interface Emulation          */
-/*                       VERY PRELIMINARY!                           */
-/*===================================================================*/
+/***************************************************************************
 
-#include "driver.h"
-
-static INT16 AU_DATA;
-static INT16 *const AU_PTR = &AU_DATA;
-static UINT16 inst_index;
+    Tatsumi TX-1/Buggy Boy machine hardware
 
-/* Internal registers and so forth */
-static struct Regs
-{
-      INT16 X;    /* Multiplicand and divisor */
-      INT16 X1;   /* Previous X */
-      INT16 Y;    /* Multiplier */
-
-      INT16 Operand2;
+***************************************************************************/
+#include "driver.h"
+#include "debugger.h"
+#include "machine/8255ppi.h"
+#include "tx1.h"
 
-      union       /* 32-bit accumulator */
-      {
-         #ifdef LSB_FIRST
-         struct { UINT16 W; INT16 Z;} ZW_16;
-         #else
-         struct { INT16 Z; UINT16 W;} ZW_16;
-         #endif
-         INT32 ZW_32;
-      } acc;
+/*
+    6845 cursor output is connected to the main CPU interrupt pin.
+    The CRTC is programmed to provide a rudimentary VBLANK interrupt.
 
-     INT16 ins_seq;  /* Instruciton sequence */
-} AU_Regs;
+    TODO: Calc TX-1 values...
+*/
+#define CURSOR_YPOS 239
+#define CURSOR_XPOS 168
 
 
-/* Main portion of the arithmetic unit emulation. Accessed by AU_R and AU_W */
-/* Only a few instructions implemented currently */
+/*
+    Globals
+*/
+static UINT16 *prom;
 
-static void MMI_74S516(int ins, UINT16 *data)
+static struct
 {
+	UINT16	cpulatch;
+	UINT16	promaddr;
+	UINT16	inslatch;
+	UINT32	mux;
+	UINT16	ppshift;
+	UINT32	i0ff;
+
+	UINT16	retval;
+
+	UINT16  muxlatch;	// TX-1
+
+	int dbgaddr;
+	int dbgpc;
+} math;
 
-   if ((ins!=7) && ((AU_Regs.ins_seq & 0xf)==7))   /* If last instruction was a reading operation, clear sequence. */
-      AU_Regs.ins_seq = 0;
-
-   /* Take INS and append to instruction */
-   AU_Regs.ins_seq <<=4;
-   AU_Regs.ins_seq = AU_Regs.ins_seq | (ins & 0xf);
-
-      switch ( AU_Regs.ins_seq )
-      {
-        /* X1 . Y */
-         case 0x0: AU_Regs.Y = *data;
-                  AU_Regs.ins_seq = 0;
-                  break;
-
-        /* -X1 . Y */
-         case 0x1: AU_Regs.Y = *data;
-                AU_Regs.ins_seq = 0;
-                break;
-
-        /* X1 . Y + Kz.Kw */
-         case 0x2: AU_Regs.Y = *data;
-                AU_Regs.ins_seq = 0;
-                break;
-
-        /* -X1 . Y + Kz.Kw */
-         case 0x3: AU_Regs.Y = *data;
-                AU_Regs.ins_seq = 0;
-                break;
-
-        /* Partial: Load X */
-         case 0x5:  AU_Regs.X = *data;
-                   break;
-         case 0x6:  AU_Regs.X = *data;
-                   break;
-
-
-        /* X * Y (Fractional) */
-         case 0x50: AU_Regs.Y = *data;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-        /* X * Y (Integer) */                                           // Ok
-         case 0x60: AU_Regs.Y = *data;
-                   AU_Regs.acc.ZW_32 = ((INT16)AU_Regs.X * (INT16)AU_Regs.Y);
-                   AU_Regs.X1 = AU_Regs.X;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-        /* -X * Y (Fractional) */
-         case 0x51: AU_Regs.Y = *data;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-        /* -X * Y (Integer) */                                               // Ok
-         case 0x61: AU_Regs.Y = *data;
-                   AU_Regs.acc.ZW_32 = (-(INT16)AU_Regs.X * (INT16)AU_Regs.Y);
-                   AU_Regs.X1 = AU_Regs.X;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-
-        /* X * Y + Kz.Kw (Fractional) */
-         case 0x52: AU_Regs.Y = *data;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-        /* X * Y + Kz.Kw (Integer) */                                       // Ok
-         case 0x62: AU_Regs.Y = *data;
-                   AU_Regs.acc.ZW_32 += ((INT16)AU_Regs.X * (INT16)AU_Regs.Y);
-                   AU_Regs.X1 = AU_Regs.X;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-
-        /* -X * Y + Kz.Kw (Fractional) */
-         case 0x53: AU_Regs.Y = *data;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-        /* -X * Y + Kz.Kw (Integer) */                                       // Ok
-         case 0x63: AU_Regs.Y = *data;
-                   AU_Regs.acc.ZW_32 += (-(INT16)AU_Regs.X * (INT16)AU_Regs.Y);
-                   AU_Regs.X1 = AU_Regs.X;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-
-
-        /* Kw / X (Fractional) Nothing Loaded */
-         case 0x54: AU_Regs.ins_seq = 0;
-                   break;
-
-        /* Kw / X (Integer) Nothing Loaded */
-         case 0x64: AU_Regs.acc.ZW_32 /= (INT16)AU_Regs.X;
-                   AU_Regs.X1 = AU_Regs.X;
-                   AU_Regs.ins_seq = 0;
-                   break;
-
-        /* Kz / X (Fractional) Nothing Loaded */
-         case 0x55: AU_Regs.ins_seq = 0;
-                   break;
-
-
-        /* Kz / X (Integer) Nothing Loaded */
-         case 0x65: AU_Regs.acc.ZW_32=AU_Regs.ins_seq;
-                   AU_Regs.ins_seq=0;
-                   break;
-
-
-        /* This can either load Z,Nothing or 0? */
-         case 0x56: AU_Regs.Operand2 = *data;
-                   break;
-
-
-         case 0x560: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x561: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x562: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x563: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x564: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x565: AU_Regs.ins_seq = 0;
-                    break;
-
-        // Not complete instruction
-         case 0x566:
-                    AU_Regs.ins_seq = 0;
-                    break;
-
-
-         case 0x660: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x661: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x662: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x663: AU_Regs.ins_seq = 0;
-                    break;
-
-        /* Z,W /X */
-        // result in Z, remainder in W
-         case 0x664: AU_Regs.acc.ZW_16.W = *data;
-                    AU_Regs.acc.ZW_16.Z = AU_Regs.Operand2;
-                    AU_Regs.acc.ZW_16.Z = (INT16)((INT32)AU_Regs.acc.ZW_32 / (INT16)AU_Regs.X);     // wrong :(
-                    AU_Regs.acc.ZW_16.W = (INT16)((INT32)AU_Regs.acc.ZW_32 % (INT16)AU_Regs.X);      //correct!
-                    AU_Regs.X1 = AU_Regs.X;
-                    AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x665: AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5660:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5661:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5662:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5663:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5664:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5665:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5666:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x5667:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6660:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6661:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6662:AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6663:AU_Regs.ins_seq = 0;
-                    break;
-
-         /* W/X */
-         case 0x6664:AU_Regs.acc.ZW_32 = (INT16)AU_Regs.acc.ZW_16.W / (INT16)AU_Regs.X;
-                    AU_Regs.X1 = AU_Regs.X;
-                    AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6665:
-                    AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6666:
-                    AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x6667:
-                    AU_Regs.ins_seq = 0;
-                    break;
-
-         case 0x66: AU_Regs.Operand2 = *data;
-                   break;
-
-         case 0x4: AU_Regs.ins_seq = 0;
-                   break;
-
-       /* Reading Operations */
-
-         case 0x7:    *data = AU_Regs.acc.ZW_16.Z;
-                      break;
-
-         case 0x77:   *data = AU_Regs.acc.ZW_16.W;
-                      break;
-
-         case 0x777:  *data = AU_Regs.acc.ZW_16.Z;
-                      break;
-
-         case 0x7777: *data = AU_Regs.acc.ZW_16.W;
-                      break;
-
-         default:     break;
-      }
+/*
+    Helper functions
+*/
+#define INC_PROM_ADDR		( math.promaddr = (math.promaddr + 1) & 0x1ff )
+#define ROR16(val, shift)	( ((UINT16)val >> shift) | ((UINT16)val << (16 - shift)) )
+#define ROL16(val, shift)	( ((UINT16)val << shift) | ((UINT16)val >> (16 - shift)) )
+#define SWAP16(val)			( (((UINT16)val << 8) & 0xff00) | ((UINT16)val >> 8) )
 
+INLINE UINT8 reverse_nibble(UINT8 nibble)
+{
+	return	(nibble & 1) << 3 |
+			(nibble & 2) << 1 |
+			(nibble & 4) >> 1 |
+			(nibble & 8) >> 3;
 }
 
 
 
-/******************************************************/
-/*                                                    */
-/*     MMI SN74S516T Arithmetic Unit and Interface    */
-/*                                                    */
-/******************************************************/
-
 /*
-The arithmetic unit is used extensively to calculate both object and road attributes in both games.
-It can take instructions directly from slave address bus A1-A3 or from a pair of PROMS (BB1.163 and BB2.162).
-Two 16KB function data ROMs are accessible by the chip and the slave CPU (via a hardware index and pointer).
-
-The interface between the arithmetic unit and the slave CPU is different between Buggy Boy and TX-1.
-
-In the case of an Buggy Boy PCB:
-Without AU: No objects visible, road is unchanging in direction.
-Without instruction PROMS: Hand/Go is displayed correctly as well as the end of race animation sequence (buggy spins and goes up in smoke).
-
-Therfore, once enough simple instructions are implemented, it should be possible do display some objects correctly.
-
-/MLPCS  =  !A10.!A11.A12.A13.!A14.!A15
-/DPRCS  =  A10.A11.A12.A13.!A14.!A15
-/INSALD =  /AT3RD.!AT3WDRART + !AT3WDRART.A15 + !AT3WDRART.!A13 + !AT3WDRART.A14 + !AT3WDRART.!A12 + !A8
-/CNTST  =  /AT3RD.!AT3WDRART + !AT3WDRART.A15 + !AT3WDRART.!A13 + !AT3WDRART.A14 + !AT3WDRART.!A12 + !A7
-/SPCS  =  !A15.!A14.!A13.A12 + A14.!A13.!A12 + !A14.A12.A9 + !A14.A13.!A12 + !A14.!A11 + A15
-
-3000-31ff = Direct instruction input (AAB1-AAB3 connect to I0-2 of AU).
-
-3c00-3cff
-3d00-3dff
-3e00-3eff
-3f00-3fff = DATA ROM output enable.
-
-/SPCS  = 0800-0fff
-         3800-39ff
-         3c00-3dff
-         5000-7fff
-
-
-When CPU A8=1, the counters are loaded with an address (e.g. [3754] and [3120]).
-
-The counters are enabled on:
-
-* A7=1 (e.g. [3680] and [3A80]).
-* Read access to locations asserting /SPCS (e.g. [7a72] - those ROM mirror accesses have some significance afterall!)
-* BB2.162 bit 7 = 0 (/CUDEN).
-
-Writes to [36XX] and [37XX] load a value into the AU ROM address shift-registers .
-Reads from [36XX] (and [37xx] presumably) returns this value.
-Writes to [3A00] loads a shift value/direction.
-
-The AU ROM address shifting is governed by DSEL0-1 (BB2.162):
-
-00 = Invalid
-01 = >> 4
-10 = << 4
-11 = Shift direction and magnitude specified by 4-bit data value written to [3A00]:
-    A13-11 =  000 ->  << by A10-7
-    A13-11 != 000 ->  >> by A13-11 (LSB=0)
-
-    The shift magnitude is specified by the number of number of 0s between the LSB (inclusive) and the '1'. Shifting is circular.
-
-Examples:
-
-13 [3754] <- 2DB5
-   [3A00] <- 0100
-   [3600] == B6D4 ? // 0x2DB5 << 2 == 0xB6D4
-
-14 [3600] <- 2DB5
-   [3A00] <- 0200
-   [3600] == 5B6A ? // 0x2DB5 << 1 == 0x5B6A
-
-15 [3600] <- 2DB5
-   [3A00] <- 0400
-   [3600] == 2DB5   // No shift.
+    TODO: Check interrupt timing from CRT config. Probably different between games.
+*/
+static TIMER_CALLBACK( interrupt_callback )
+{
+	cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xff);
+	timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback);
+}
 
-16 [3600] <- 2DB5
-   [3A00] <- 0800
-   [3600] == 96DA ? // 0x2DB5 >> 1 == 0x96DA
+/*
+    SN74S516 16x16 Multiplier/Divider
+*/
+static struct
+{
+	INT16	X;
+	INT16	Y;
 
-17 [3600] <- 2DB5
-   [3A00] <- 1000
-   [3600] =  4B6D ? // 0x2DB5 >> 2 == 0x4B6D
+	union
+	{
+	#ifdef LSB_FIRST
+		struct { UINT16 W; INT16 Z; };
+	#else
+		struct { INT16 Z; UINT16 W; };
+	#endif
+		INT32 ZW32;
+	} ZW;
+
+	int		code;
+	int		state;
+	int		ZWfl;
+} SN74S516;
 
-18 [3600] <- 2DB5
-   [3A00] <- 2000
-   [3600] =  A5B6 ? // 0x2DB5 >> 3 == 0xA5B6
+/*
+    State transition table
 
-19 [3600] <- 1568
-   [3A00] <- 2000
-   [3E00] =  1BF2 ? // 0x1568 >> 3 == 0x02AD -> AU_ROM[0x02AD] == 0x1BF2
+    A little different to the real thing in that
+    there are no states between final input and
+    multiplication/division.
+*/
+static const UINT8 state_table[16][8] =
+{
+	{  4,  4,  4,  4,  5,  1,  1,  0 },
+	{  4,  4,  4,  4,  5,  5,  3,  0 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{  4,  4,  4,  4,  5,  5, 11,  0 },
+	{  8,  8,  8,  8,  8,  8,  8,  8 },
+	{ 10, 10, 10, 10, 10, 10, 10, 10 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{  4,  4,  4,  4,  5,  0,  1,  0 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{  4,  4,  4,  4,  4,  5,  1,  0 },
+	{  4,  4,  4,  4,  5,  5,  1,  0 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+	{ -1, -1, -1, -1, -1, -1, -1, -1 },
+};
 
+static void sn_multiply(void)
+{
+	switch (SN74S516.code)
+	{
+		case 0:
+		{
+			SN74S516.ZW.ZW32 = SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 2:
+		{
+			SN74S516.ZW.ZW32 += SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 3:
+		{
+			SN74S516.ZW.ZW32 += -SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 0x60:
+		{
+			SN74S516.ZW.ZW32 = SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 0x61:
+		{
+			SN74S516.ZW.ZW32 = -SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 0x62:
+		{
+			SN74S516.ZW.ZW32 += SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 0x63:
+		{
+			SN74S516.ZW.ZW32 += -SN74S516.X * SN74S516.Y;
+			break;
+		}
+		case 0x660:
+		{
+			SN74S516.ZW.ZW32 = (SN74S516.X * SN74S516.Y) + (SN74S516.ZW.ZW32 & 0xffff0000);
+			break;
+		}
+		case 0x661:
+		{
+			SN74S516.ZW.ZW32 = (-SN74S516.X * SN74S516.Y) + (SN74S516.ZW.ZW32 & 0xffff0000);
+			break;
+		}
+		case 0x662:
+		{
+			SN74S516.ZW.ZW32 = (-SN74S516.X * SN74S516.Y) + (SN74S516.ZW.ZW32 & 0xffff0000);
+			break;
+		}
+		case 0x6660:
+		{
+			SN74S516.ZW.ZW32 += (SN74S516.X * SN74S516.Y);
+			break;
+		}
+		default:
+		{
+			mame_printf_debug("sn74s516 ??? multiply: %x\n", SN74S516.code);
+		}
+	}
 
-The 14-bit AU ROM address is formed from:
+	/* Seems a good enough place to clear it. */
+	SN74S516.ZWfl = 0;
+}
 
-A13-11 =  TFAD13-11 (BB2.162 D4-2)
-A10-8  =  If RADCHG = 1: AU PROM address bits 7-5
-      If RADCHG = 0: Bits 10-8 of shift registers
-A7-0   =  Bits 7-0 of shift registers.
+static void sn_divide(void)
+{
+	INT32 Z = 0;
+	INT32 W = 0;
 
-The current implementation of accessing the AU ROM is wrong (it's based on software behaviour rather than the actual hardware )
+	if ( SN74S516.X == 0 )
+		fatalerror("SN74S516 tried to divide by zero (PC=%x)\n", activecpu_get_pc());
 
-Here's the full list of AU tests performed during test mode:
+	switch ( SN74S516.code )
+	{
+		case 4:
+		{
+			Z = SN74S516.ZW.ZW32 / SN74S516.X;
+			W = SN74S516.ZW.ZW32 % SN74S516.X;
+			break;
+		}
+		case 0x664:
+		{
+			Z = SN74S516.ZW.ZW32 / SN74S516.X;
+			W = SN74S516.ZW.ZW32 % SN74S516.X;
+			break;
+		}
+		case 0x6664:
+		{
+			Z = SN74S516.ZW.W / SN74S516.X;
+			W = SN74S516.ZW.W % SN74S516.X;
+			break;
+		}
+		default:
+		{
+			mame_printf_debug("SN74S516 unhandled divide type: %x\n", SN74S516.code);
+		}
+	}
+
+	/* Divide overflow Only happens during chip test anyway */
+	if ( Z > 0xffff )
+		Z |= 0xff00;
+
+	SN74S516.ZW.Z = Z;
+	SN74S516.ZW.W = W;
+	SN74S516.ZWfl = 0;
+}
 
-ST
-   [300C] <- AA55
-   [3000] <- 55AA
-04 [300E] =  E355 ?
-04 [300E] =  5572 ?
+void sn74s516_update(const int ins)
+{
+	SN74S516.state = state_table[SN74S516.state][ins];
 
-   [300C] <- AA55
-   [3002] <- 55AA
-05 [300E] =  1CAA ?
-05 [300E] =  AA8E ?
+	if ( SN74S516.state == 4 )
+	{
+		sn_multiply();
+		SN74S516.state = 8;
+	}
+	else if ( SN74S516.state == 5 )
+	{
+		sn_divide();
+		SN74S516.state = 10;
+	}
+}
 
-   [300C] <- 5A5A
-   [3004] <- A5A5
-06 [300E] =  FCC6 ?
-06 [300E] =  E890 ?
+static void kick_sn74s516(UINT16 *data, const int ins)
+{
 
-   [300C] <- AA55
-   [3006] <- 55AA
-07 [300E] =  1971 ?
-07 [300E] =  931E ?
+#define LOAD_X		(SN74S516.X = *data)
+#define LOAD_Y		(SN74S516.Y = *data)
+#define LOAD_Z		(SN74S516.ZW.Z = *data)
+#define LOAD_W		(SN74S516.ZW.W = *data)
+#define READ_ZW		*data = SN74S516.ZWfl ? SN74S516.ZW.W : SN74S516.ZW.Z; \
+					SN74S516.ZWfl ^= 1;
+
+#define UPDATE_SEQUENCE (SN74S516.code = (SN74S516.code << 4) | ins)
+#define CLEAR_SEQUENCE	(SN74S516.code = 0)
+
+	/*
+        Remember to change the Z/W flag.
+    */
+	switch (SN74S516.state)
+	{
+		case 0:
+		{
+			CLEAR_SEQUENCE;
+			UPDATE_SEQUENCE;
+
+			if (ins < 4)
+			{
+				LOAD_Y;
+				sn74s516_update(ins);
+			}
+			else if (ins == 4)
+			{
+				sn74s516_update(ins);
+			}
+			else if (ins < 7)
+			{
+				LOAD_X;
+				sn74s516_update(ins);
+			}
+			else if (ins == 7)
+			{
+				READ_ZW;
+				break;
+			}
+
+			break;
+		}
+		case 8:
+		case 10:
+		{
+			CLEAR_SEQUENCE;
+			UPDATE_SEQUENCE;
+
+			if (ins < 4)
+			{
+				LOAD_Y;
+				sn74s516_update(ins);
+			}
+			else if (ins == 4)
+			{
+				sn74s516_update(ins);
+			}
+			else if (ins == 5)
+			{
+				// Rounding
+				// Operation
+				sn74s516_update(ins);
+			}
+			else if (ins == 6)
+			{
+				LOAD_X;
+				sn74s516_update(ins);
+			}
+			else if (ins == 7)
+			{
+				READ_ZW;
+				sn74s516_update(ins);
+			}
+			break;
+		}
+		case 1:
+		{
+			// TODO: 6666 represents an incomplete state - clear it.
+			if (SN74S516.code == 0x6666)
+			{
+				CLEAR_SEQUENCE;
+				mame_printf_debug("Code 6666: PROMADDR:%x PC:%x\n", math.promaddr, activecpu_get_pc());
+			}
+
+			UPDATE_SEQUENCE;
+			if (ins < 4)
+			{
+				LOAD_Y;
+				sn74s516_update(ins);
+			}
+			else if (ins < 6)
+			{
+				sn74s516_update(ins);
+			}
+			else if (ins == 6)
+			{
+				LOAD_Z;
+				sn74s516_update(ins);
+			}
+			else if (ins == 7)
+			{
+				// Pointless operation.
+				sn74s516_update(ins);
+			}
+
+			break;
+		}
+		case 3:
+		{
+			UPDATE_SEQUENCE;
+			if (ins < 4)
+			{
+				LOAD_Y;
+				sn74s516_update(ins);
+			}
+			else if (ins == 4)
+			{
+				LOAD_W;
+				sn74s516_update(ins);
+			}
+			else if (ins == 5)
+			{
+				sn74s516_update(ins);
+			}
+			else if (ins == 6)
+			{
+				LOAD_W;
+				sn74s516_update(ins);
+			}
+			else if (ins == 7)
+			{
+				READ_ZW;
+				sn74s516_update(ins);
+			}
+			break;
+		}
+		case 11:
+		{
+			UPDATE_SEQUENCE;
+			if (ins < 4)
+			{
+				LOAD_Y;
+				sn74s516_update(ins);
+			}
+			else if (ins < 6)
+			{
+				sn74s516_update(ins);
+			}
+			else if (ins == 6)
+			{
+				// CHECK: Incomplete state
+				sn74s516_update(ins);
+			}
+			else if (ins == 7)
+			{
+				/* 6667 = Load X, Load Z, Load W, Clear Z */
+				SN74S516.ZW.Z = 0;
+				sn74s516_update(ins);
+			}
+			break;
+		}
+		default:
+		{
+			mame_printf_debug("Unknown SN74S516 state. %x\n", SN74S516.code);
+		}
+	}
 
-   [300C] <- 1000
-   [300C] <- 5678
-   [3008] <- 8765
-08 [300E] =  ff88 ?
-08 [300E] =  0765 ?
+	math.dbgaddr = math.promaddr;
+	math.dbgpc = activecpu_get_previouspc();
+}
 
-   [300C] <- 0200
-   [300C] <- FFFF
-   [300C] <- 55AA
-   [3008] <- FFFF
-09 [300E] =  002a ?
-09 [300E] =  01aa ?
 
-   [3752] <- AA55
-10 [3600] =  AA55 ?
+/***************************************************************************
 
-   [3600] <- 55AA
-10 [3680] =  55AA ?
+  TX-1
 
-11 [3680] =  A55A ?
-12 [3600] =  55AA ?
+  Preliminary
 
-   [3754] <- 2DB5
-   [3A00] <- 0100
-13 [3600] =  B6D4 ?
+***************************************************************************/
 
-   [3600] <- 2DB5
-   [3A00] <- 0200
-14 [3600] =  5B6A ?
+/* Same mapping as Buggy Boy actually */
+#define TX1_INSLD		0x100
+#define TX1_CNTST		0x80
+#define TX1_RADCHG		0x20
+#define TX1_DSEL		0x03
 
-15 [3600] <- 2DB5
-   [3A00] <- 0400
-   [3600] =  2DB5 ?
+#define TX1_SEL_MULEN	0x00
+#define TX1_SEL_PPSEN	0x01
+#define TX1_SEL_PSSEN	0x02
+#define TX1_SEL_LMSEL	0x03
+#define TX1_SEL_DSELOE	0x04
+#define TX1_SEL_INSCL	0x06
+#define TX1_SEL_ILDEN	0x07
 
-16 [3600] <- 2DB5
-   [3A00] <- 0800
-   [3600] =  96DA ?
+#define TX1_SET_INS0_BIT	do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff; } while(0)
 
-17 [3600] <- 2DB5
-   [3A00] <- 1000
-   [3600] =  4B6D ?
+INLINE UINT16 get_tx1_datarom_addr(void)
+{
+	UINT16 addr;
 
-18 [3600] <- 2DB5
-   [3A00] <- 2000
-   [3600] =  A5B6 ?
+	addr = ((math.inslatch & 0x1c00) << 1) | (math.ppshift & 0xff);
 
-19 [3600] <- 1568
-   [3A00] <- 2000
-   [3E00] =  1BF2 ?
+	if ( (math.inslatch >> 8) & TX1_RADCHG )
+	{
+		addr |= (math.ppshift & 0x0700);
+	}
+	else
+	{
+		addr |= (math.promaddr << 3) & 0x0700;
+	}
 
-1A [7A68] =  0000 ?
+	return addr & 0x3fff;
+}
 
-1B [3680] <- AA55
-   [7A6A] =  55AA ?
+static void tx1_update_state(void)
+{
+#define LHIEN(a)	!(a & 0x80)
+#define LLOEN(a)	!(a & 0x40)
+#define GO_EN(a)	!(a & 0x4000)
+
+	for (;;)
+	{
+		int go = 0;
+
+		if ( !GO_EN(math.inslatch) && GO_EN(prom[math.promaddr]) )
+		{
+			go = 1;
+		}
+		/*
+            Example:
+            120 /GO /LHIEN
+            121 /GO        /LLOEN
+            Both 120 and 121 are used.
+        */
+		else if ( (GO_EN(math.inslatch) && GO_EN(prom[math.promaddr])) && (LHIEN(math.inslatch) && LLOEN(prom[math.promaddr])) )
+		{
+			go = 1;
+		}
+
+		/* Now update the latch */
+		math.inslatch = prom[math.promaddr] & 0x7fff;
+		math.mux = (math.inslatch >> 3) & 7;
+
+		if ( math.mux == TX1_SEL_INSCL )
+		{
+		   math.i0ff = 0;
+		}
+		else if ( math.mux == TX1_SEL_PPSEN )
+		{
+			// NOTE: Doesn't do anything without SPCS.
+		}
+
+		/* TODO */
+		if ( go )
+		{
+			int ins = math.inslatch & 7;
+
+			TX1_SET_INS0_BIT;
+
+			if ( math.mux == TX1_SEL_DSELOE )
+			{
+				UINT16 data;
+				int dsel = (math.inslatch >> 8) & TX1_DSEL;
+
+//              int tfad = (math.inslatch & 0x1c00);
+//              int ps = math.ppshift & 0x78;
+
+
+				if ( (dsel & 1) == 0 )
+					dsel |= 1;
+				else
+				{
+					dsel &= ~1;
+				}
+
+				if ( dsel == 0 )
+					data = math.muxlatch;
+				else if ( dsel == 1 )
+				{
+					UINT16 *romdata = (UINT16*)memory_region(REGION_USER1);
+					UINT16 addr = get_tx1_datarom_addr();
+					data = romdata[addr];
+				}
+				else if ( dsel == 2 )
+					data = ROL16(math.muxlatch, 4);
+				else if ( dsel == 3 )
+					data = ROL16(SWAP16(math.muxlatch), 3);
+
+				kick_sn74s516(&data, ins);
+			}
+			/*
+                TODO: Changed ppshift to muxlatch for TX-1
+                Changed masks.
+            */
+			else if ( LHIEN(math.inslatch) || LLOEN(math.inslatch) )
+			{
+				UINT16 data;
+
+				kick_sn74s516(&data, ins);
+
+				if ( LHIEN(math.inslatch) && LLOEN(math.inslatch) )
+				{
+					math.muxlatch = data;
+				}
+				else if ( math.mux == TX1_SEL_LMSEL )
+				{
+					if ( LLOEN(math.inslatch) )
+					{
+						math.muxlatch &= 0x001f;
+						math.muxlatch |= data & 0xffe0;
+					}
+					else if ( LHIEN(math.inslatch) )
+					{
+						math.muxlatch &= 0xffe0;
+						math.muxlatch |= data & 0x001f;
+					}
+				}
+				else
+				{
+					if ( LLOEN(math.inslatch) )
+					{
+						math.muxlatch &= 0x0fff;
+						math.muxlatch |= data & 0xf000;
+					}
+					else if ( LHIEN(math.inslatch) )
+					{
+						math.muxlatch &= 0xf000;
+						math.muxlatch |= data & 0x0fff;
+					}
+				}
+			}
+			else
+			{
+				if ( math.mux == TX1_SEL_PPSEN )
+				{
+					kick_sn74s516(&math.ppshift, ins);
+				}
+				else
+				{
+					/* Bus pullups give 0xffff */
+					UINT16 data = 0xffff;
+					kick_sn74s516(&data, ins);
+				}
+			}
+		}
+
+		/* Is there another instruction in the sequence? */
+		if ( prom[math.promaddr] & 0x8000 )
+			break;
+		else
+			INC_PROM_ADDR;
+	}
+}
 
-1C [3200] <- AA55
-   [300E] =  E355 ?
+READ16_HANDLER( tx1_math_r )
+{
+	offset = offset << 1;
 
-1D [3754] <- AA55
-   [7A6A] =  55AA ?
+	/* /MLPCS */
+	if ( offset < 0x400 )
+	{
+		int ins;
+
+		if ( offset & 0x200 )
+		{
+			ins = math.inslatch & 7;
+			TX1_SET_INS0_BIT;
+		}
+		else
+		{
+			ins = (offset >> 1) & 7;
+		}
+
+		/* TODO What do we return? */
+		kick_sn74s516(&math.retval, ins);
+	}
+	/* /PPSEN */
+	else if ( offset < 0x800 )
+	{
+		// Unused - just pullups?
+		math.retval = 0xffff;
+	}
+	/* /MUXCS */
+	else if ( (offset & 0xc00) == 0xc00 )
+	{
+
+		/*  TODO
+            SEL0 = 1 (DSEL = 0 or ???????)
+            DSEL1 = 0
+        */
+		int dsel = (math.inslatch >> 8) & TX1_DSEL;
+//      int tfad = (math.inslatch & 0x1c00);
+//      int ps = math.ppshift & 0x78;
+
+		/*
+            Actual MUX selects
+            00 Straight from DLATCH
+            01 Straight from ROM
+            10 << 4
+            11 Halves swapped, << 3
+
+            If DSEL = x0,  MUX = x1
+
+            00 -> 01
+
+            10 -> 11
+
+            10 = 11
+            00 = 01
+        */
+
+		// TEST!
+		if ( (dsel & 1) == 0 )
+			dsel |= 1;
+		else
+		{
+			dsel &= ~1;
+		}
+
+		if ( dsel == 0 )
+			math.retval = math.muxlatch;
+		else if ( dsel == 1 )
+		{
+			/*
+                TODO make this constant somewhere
+                e.g. math.retval =  math.romptr[ get_tx1_datarom_addr() ];
+            */
+			UINT16 *romdata = (UINT16*)memory_region(REGION_USER1);
+			UINT16 addr = get_tx1_datarom_addr();
+			math.retval = romdata[addr];
+		}
+		else if ( dsel == 2 )
+			math.retval = ROL16(math.muxlatch, 4);
+		else if ( dsel == 3 )
+			math.retval = ROL16(SWAP16(math.muxlatch), 3);
+
+		/* TODO for TX-1: This is /SPCS region? */
+		if ( offset < 0xe00 )
+		{
+			// Load the PP with retval??????
+			if ( math.mux == TX1_SEL_PPSEN )
+			{
+				math.ppshift = math.retval & 0x3fff;
+			}
+			else if ( math.mux == TX1_SEL_PSSEN )
+			{
+				// ????????
+				math.ppshift = math.retval;
+			}
+
+			if ( math.mux != TX1_SEL_ILDEN )
+			{
+				INC_PROM_ADDR;
+				tx1_update_state();
+
+				// MUST RETURN HERE?
+				return math.retval;
+			}
+		}
+	}
+	else
+	{
+		if ( math.mux == TX1_SEL_PPSEN )
+			math.retval = math.ppshift;
+		else
+			/* Nothing is mapped - read from pull up resistors! */
+			math.retval = 0xffff;
+	}
+
+	if ( offset & TX1_INSLD )
+	{
+	    math.promaddr = (offset << 2) & 0x1ff;
+		tx1_update_state();
+	}
+	else if ( offset & TX1_CNTST )
+	{
+	    INC_PROM_ADDR;
+		tx1_update_state();
+	}
 
-1E [3680] <- AA55
-   [7A6A] =  55AA ?
+	return math.retval;
+}
 
-1F [7A6C] =  AA55 ?
+WRITE16_HANDLER( tx1_math_w )
+{
+	math.cpulatch = data;
+	offset <<= 1;
 
-20 [300E] =  1CAA ?
+//  printf("W %x: %x\n", 0x3000 + offset, data);
 
-21 [300C] <- 55AA
-   [3200] <- AA55
-   [300E] =  E355 ?
+	/* /MLPCS */
+	if ( offset < 0x400 )
+	{
+		int ins;
+
+		if ( offset & 0x200 )
+		{
+			ins = math.inslatch & 7;
+			TX1_SET_INS0_BIT;
+		}
+		else
+		{
+			ins = (offset >> 1) & 7;
+		}
+
+		kick_sn74s516(&math.cpulatch, ins);
+	}
+	/* /PPSEN */
+	else if ( (offset & 0xc00) == 0x400 )
+	{
+		/* Input is 14 bits */
+		math.ppshift = math.cpulatch & 0x3fff;
+	}
+	/* /PSSEN */
+	else if ( (offset & 0xc00) == 0x800 )
+	{
+		//if ( ((math.inslatch >> 8) & TX1_DSEL) == 3 )
+		{
+			int shift;
+			UINT16 val = math.ppshift;
+
+			if ( math.cpulatch & 0x3800 )
+			{
+				shift = (math.cpulatch >> 11) & 0x7;
+
+				while (shift)
+				{
+					val >>= 1;
+					shift >>= 1;
+				}
+			}
+			else
+			{
+				shift = (math.cpulatch >> 7) & 0xf;
+				shift = reverse_nibble(shift);
+				shift >>= 1;
+
+				while (shift)
+				{
+					val <<= 1;
+					shift >>= 1;
+				}
+			}
+			math.ppshift = val & 0x7ff;
+		}
+	}
+	/* /MUXCS */
+	else if ( (offset & 0xc00) == 0xc00 )
+	{
+		/* TODO */
+		math.muxlatch = math.cpulatch;
+	}
+
+	if ( offset & TX1_INSLD )
+	{
+	    math.promaddr = (offset << 2) & 0x1ff;
+		tx1_update_state();
+	}
+	else if ( offset & TX1_CNTST )
+	{
+	    INC_PROM_ADDR;
+		tx1_update_state();
+	}
+}
 
-22 [3E00] =  14D5 ?
-23 [308C] <- 55AA
-   [7A70] =  15AA ?
+READ16_HANDLER( tx1_spcs_rom_r )
+{
+	math.cpulatch = *(UINT16*)((UINT8*)memory_region(REGION_CPU2) + 0xfc000 + 0x1000 + offset*2);
 
-24 [7A6E] =  2000 ?
-25 [3600] =  42B5 ?
-26 [3E80] =  1CC2 ?
-27 [308E] =  099F ?
-28 [3680] =  4099 ?
-29 [3680] =  2D40 ?
-2A [3C00] =  5Cf4 ?
-2B [3600] =  5Cf4 ?
-2C [300C] <- 55AA
-   [3A80] =  FFFF ?
-2D [300E] =  FFFF ?
-2E [300E] =  AA56 ?
-   [3600] <- 0000
-2F [4000] =  00BC ?
-30 [3600] =  0000 ?
+	if ( math.mux == TX1_SEL_ILDEN )
+	{
+		math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0;
+	}
+	else if ( math.mux == TX1_SEL_MULEN )
+	{
+		int ins = math.inslatch & 7;
+
+		TX1_SET_INS0_BIT;
+		kick_sn74s516(&math.cpulatch, ins);
+	}
+	else if ( math.mux == TX1_SEL_PPSEN )
+	{
+		math.ppshift = math.cpulatch;
+	}
+	else if ( math.mux == TX1_SEL_PSSEN )
+	{
+			//if ( ((math.inslatch >> 8) & TX1_DSEL) == 3 )
+		{
+			int shift;
+			UINT16 val = math.ppshift;
+
+			if ( math.cpulatch & 0x3800 )
+			{
+				shift = (math.cpulatch >> 11) & 0x7;
+
+				while (shift)
+				{
+					val >>= 1;
+					shift >>= 1;
+				}
+			}
+			else
+			{
+				shift = (math.cpulatch >> 7) & 0xf;
+				shift = reverse_nibble(shift);
+				shift >>= 1;
+
+				while (shift)
+				{
+					val <<= 1;
+					shift >>= 1;
+				}
+			}
+			math.ppshift = val & 0x7ff;
+		}
+	}
+
+	if ( math.mux != TX1_SEL_ILDEN )
+	{
+	    INC_PROM_ADDR;
+		tx1_update_state();
+	}
 
-   [310C] <- 0078
-   [308C] <- 3F70
-40 [3680] =  0087 ?
+	return math.cpulatch;
 
-   [3600] <- 0020
-41 [3680] =  0100 ?
+}
 
-   [3680] <- 533f
-42 [300e] =  0058 ?
+READ16_HANDLER( tx1_spcs_ram_r )
+{
+	math.cpulatch = tx1_math_ram[offset];
 
-   [315c] <- 0020
-43 [7a72] =  0087 ?
+	offset <<= 1;
 
-44 [3700] =  0080 ?
+	if ( math.mux == TX1_SEL_ILDEN )
+	{
+		math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0;
+	}
+	else if ( math.mux == TX1_SEL_MULEN )
+	{
+		int ins = math.inslatch & 7;
+
+		TX1_SET_INS0_BIT;
+		kick_sn74s516(&math.cpulatch, ins);
+	}
+	else if ( math.mux == TX1_SEL_PPSEN )
+	{
+		math.ppshift = math.retval & 0x3fff;
+	}
+	else if ( math.mux == TX1_SEL_PSSEN )
+	{
+		int shift;
+		UINT16 val = math.ppshift;
+
+		if ( math.cpulatch & 0x3800 )
+		{
+			shift = (math.cpulatch >> 11) & 0x7;
+
+			while (shift)
+			{
+				val >>= 1;
+				shift >>= 1;
+			}
+		}
+		else
+		{
+			shift = (math.cpulatch >> 7) & 0xf;
+			shift = reverse_nibble(shift);
+			shift >>= 1;
+
+			while (shift)
+			{
+				val <<= 1;
+				shift >>= 1;
+			}
+		}
+		math.ppshift = val & 0x7ff;
+	}
+
+	if ( math.mux != TX1_SEL_ILDEN )
+	{
+	    INC_PROM_ADDR;
+		tx1_update_state();
+	}
 
-   [300c] <- 00cc
-   [3000] <- 0074
-45 [308e] =  0000 ?
+	return math.cpulatch;
+}
 
-46 [7a74] =  0078 ?
-   [308c] <- 0000
-47 [300e] =  00c5 ?
+/* Should never occur */
+WRITE16_HANDLER( tx1_spcs_ram_w )
+{
+	mame_printf_debug("Write to /SPCS RAM?");
+	COMBINE_DATA(&tx1_math_ram[offset]);
+}
 
-   [300c] <- 0074
-   [3000] <- 008c
-48 [311e] =  0000 ?
 
-   [300c] <- 0224
-   [308c] <- 0000
-49 [300e] =  001c ?
+/***************************************************************************
 
-   [3724] <- 000c
-   [3000] <- 0078
-4a [300e] =  007c
+  Buggy Boy
 
-   [3728] <- 0023
-4b [3e80] =  0055 ?
-4c [3e00] =  0045 ?
+***************************************************************************/
+#define BB_INSLD		0x100
+#define BB_CNTST		0x80
+#define BB_RADCHG		0x20
+#define BB_DSEL			0x03
+
+#define BB_MUX_MULEN	0x00
+#define BB_MUX_PPSEN	0x01
+#define BB_MUX_PSSEN	0x02
+#define BB_MUX_LMSEL	0x03
+#define BB_MUX_DPROE	0x04
+#define BB_MUX_PPOE		0x05
+#define BB_MUX_INSCL	0x06
+#define BB_MUX_ILDEN	0x07
 
-   [3600] <- fca2
-   [313c] <- 0118
-   [308c] <- ff42
-4d [300e] =  007e ?
+#define BB_SET_INS0_BIT	do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff;} while(0)
 
-   [312c] <- 0040
-   [308c] <- 00f8
-4e [300e] =  0080 ?
+INLINE UINT16 get_bb_datarom_addr(void)
+{
+	UINT16 addr;
 
-   [300c] <- 0261
-   [3130] <- 2000
-4f [3680] =  004c ?
+	addr = ((math.inslatch & 0x1c00) << 1) | (math.ppshift & 0xff);
 
-   [300c] <- 000f
-   [3008] <- e440
-50 [300e] =  0111 ?
+	if ( (math.inslatch >> 8) & BB_RADCHG )
+	{
+		addr |= (math.ppshift & 0x0700);
+	}
+	else
+	{
+		addr |= (math.promaddr << 3) & 0x0700;
+	}
 
-51 [7a7a] =  41fd ?
-   [3740] <- 010e
+	return addr & 0x3fff;
+}
 
-52 [7a76] =  4000 ?
-53 [7a78] =  03a9 ?
+static void buggyboy_update_state(void)
+{
+#define LHIEN(a)	!(a & 0x80)
+#define LLOEN(a)	!(a & 0x40)
+#define GO_EN(a)	!(a & 0x4000)
+
+	for (;;)
+	{
+		int go = 0;
+
+		if ( !GO_EN(math.inslatch) && GO_EN(prom[math.promaddr]) )
+			go = 1;
+		else if ( (GO_EN(math.inslatch) && GO_EN(prom[math.promaddr])) && (LHIEN(math.inslatch) && LLOEN(prom[math.promaddr])) )
+			go = 1;
+
+		/* Now update the latch */
+		math.inslatch = prom[math.promaddr] & 0x7fff;
+		math.mux = (math.inslatch >> 3) & 7;
+
+		if ( math.mux == BB_MUX_INSCL )
+		   math.i0ff = 0;
+		else if ( math.mux == BB_MUX_PPSEN )
+		{
+			// TODO: Needed?
+			//mame_printf_debug("/PPSEN with INS: %x\n", math.promaddr);
+			//math.ppshift = lastval;//math.cpulatch;
+		}
+
+		/* TODO */
+		if (go)
+		{
+			int ins = math.inslatch & 7;
+
+			BB_SET_INS0_BIT;
+
+			if ( math.mux == BB_MUX_DPROE )
+			{
+				UINT16 *romdata = (UINT16*)memory_region(REGION_USER1);
+				UINT16 addr = get_bb_datarom_addr();
+				kick_sn74s516(&romdata[addr], ins);
+			}
+			else if ( math.mux == BB_MUX_PPOE )
+			{
+				kick_sn74s516(&math.ppshift, ins);
+			}
+			/* This is quite tricky. */
+			/* It can either be a read operation or */
+			/* What if /LHIEN and /LLOEN? */
+			else if ( LHIEN(math.inslatch) || LLOEN(math.inslatch) )
+			{
+				UINT16 data;
+
+				kick_sn74s516(&data, ins);
+
+				if ( LHIEN(math.inslatch) && LLOEN(math.inslatch) )
+				{
+					math.ppshift = data;
+				}
+				else if ( math.mux == BB_MUX_LMSEL )
+				{
+					if ( LLOEN(math.inslatch) )
+					{
+						math.ppshift &= 0x000f;
+						math.ppshift |= data & 0xfff0;
+					}
+					else if ( LHIEN(math.inslatch) )
+					{
+						math.ppshift &= 0xfff0;
+						math.ppshift |= data & 0x000f;
+					}
+				}
+				else
+				{
+					if ( LLOEN(math.inslatch) )
+					{
+						math.ppshift &= 0x0fff;
+						math.ppshift |= data & 0xf000;
+					}
+					else if ( LHIEN(math.inslatch) )
+					{
+						math.ppshift &= 0xf000;
+						math.ppshift |= data & 0x0fff;
+					}
+				}
+			}
+			else
+			{
+				if ( math.mux == BB_MUX_PPSEN )
+				{
+					kick_sn74s516(&math.ppshift, ins);
+				}
+				else
+				{
+					/* Bus pullups give 0xffff */
+					UINT16 data = 0xffff;
+					kick_sn74s516(&data, ins);
+				}
+			}
+		}
+
+		/* Handle rotation */
+		if ( ((math.inslatch >> 8) & BB_DSEL) == 1 )
+		{
+			math.ppshift = ROR16(math.ppshift, 4);
+		}
+		else if ( ((math.inslatch >> 8) & BB_DSEL) == 2 )
+		{
+			math.ppshift = ROL16(math.ppshift, 4);
+		}
+
+		/* Is there another instruction in the sequence? */
+		if ( prom[math.promaddr] & 0x8000 )
+			break;
+		else
+			INC_PROM_ADDR;
+	}
+}
 
-   [3280] <- 0800
-54 [3e00] =  ff52 ?
+READ16_HANDLER( buggyboy_math_r )
+{
+	offset = offset << 1;
 
-   [3680] <- 001e
-55 [3680] =  ffcd ?
+	/* /MLPCS */
+	if ( offset < 0x400 )
+	{
+		int ins;
+
+		if ( offset & 0x200 )
+		{
+			ins = math.inslatch & 7;
+			BB_SET_INS0_BIT;
+		}
+		else
+		{
+			ins = (offset >> 1) & 7;
+		}
+
+		/* TODO What do we return? */
+		kick_sn74s516(&math.retval, ins);
+
+		/* TODO */
+		//if (math.mux == BB_MUX_PPSEN)
+		//  math.ppshift = math.retval;
+	}
+	/* /PPSEN */
+	else if ( offset < 0x800 )
+	{
+		math.retval = math.ppshift;
+	}
+	/* /DPROE */
+	else if ( (offset & 0xc00) == 0xc00 )
+	{
+		UINT16 *romdata = (UINT16*)memory_region(REGION_USER1);
+		UINT16 addr = get_bb_datarom_addr();
+
+		math.retval = romdata[addr];
+
+		/* This is necessary */
+		if ( math.mux == BB_MUX_PPSEN )
+			math.ppshift = romdata[addr];
+
+		/* This is /SPCS region? Necessary anyway */
+		if ( offset < 0xe00 )
+		{
+			if ( math.mux != BB_MUX_ILDEN )
+			{
+				INC_PROM_ADDR;
+				buggyboy_update_state();
+			}
+		}
+	}
+	else
+	{
+		if ( math.mux == BB_MUX_PPSEN )
+			math.retval = math.ppshift;
+		else
+			/* Nothing is mapped - read from pull up resistors! */
+			math.retval = 0xffff;
+	}
+
+	if ( offset & BB_INSLD )
+	{
+	    math.promaddr = (offset << 2) & 0x1ff;
+		buggyboy_update_state();
+	}
+	else if ( offset & BB_CNTST )
+	{
+	    INC_PROM_ADDR;
+		buggyboy_update_state();
+	}
 
-56 [3600] =  fff0 ?
+	return math.retval;
+}
 
-   [314c] <- 0091
-   [3680] <- 0300
+WRITE16_HANDLER( buggyboy_math_w )
+{
+	math.cpulatch = data;
 
-57 [3680] =  015e ?
+	offset <<= 1;
 
-   [3680] <- 00d5
-   [3704] <- 0002
-58 [3600] =  0015 ?
+	/* /MLPCS */
+	if ( offset < 0x400 )
+	{
+		int ins;
+
+		if ( offset & 0x200 )
+		{
+			ins = math.inslatch & 7;
+			BB_SET_INS0_BIT;
+		}
+		else
+		{
+			ins = (offset >> 1) & 7;
+		}
+
+		kick_sn74s516(&math.cpulatch, ins);
+	}
+	/* /PPSEN */
+	else if ( (offset & 0xc00) == 0x400 )
+	{
+		math.ppshift = math.cpulatch;
+	}
+	/* /PSSEN */
+	else if ( (offset & 0xc00) == 0x800 )
+	{
+		if ( ((math.inslatch >> 8) & BB_DSEL) == 3 )
+		{
+			int shift;
+			UINT16 val = math.ppshift;
+
+			if ( math.cpulatch & 0x3800 )
+			{
+				shift = (math.cpulatch >> 11) & 0x7;
+
+				while (shift)
+				{
+					val = ROR16(val, 1);
+					shift >>= 1;
+				}
+			}
+			else
+			{
+				shift = (math.cpulatch >> 7) & 0xf;
+				shift = reverse_nibble(shift);
+				shift >>= 1;
+
+				while (shift)
+				{
+					val = ROL16(val, 1);
+					shift >>= 1;
+				}
+			}
+			math.ppshift = val;
+		}
+		else
+		{
+			mame_printf_debug("BB_DSEL was not 3 for P->S load!\n");
+			DEBUGGER_BREAK;
+		}
+	}
+	else
+	{
+		mame_printf_debug("Buggy Boy unknown math state!\n");
+		DEBUGGER_BREAK;
+	}
+
+	if ( offset & BB_INSLD )
+	{
+	    math.promaddr = (offset << 2) & 0x1ff;
+		buggyboy_update_state();
+	}
+	else if ( offset & BB_CNTST )
+	{
+	    INC_PROM_ADDR;
+		buggyboy_update_state();
+	}
+}
 
-   [3600] <- 0086
-   [317c] <- 0013
-59 [300e] =  09f2 ?
+/*
+    This is for ROM range 0x5000-0x7fff
+*/
+READ16_HANDLER( buggyboy_spcs_rom_r )
+{
+	math.cpulatch = *(UINT16*)((UINT8*)memory_region(REGION_CPU2) + 0xfc000 + 0x1000 + offset*2);
 
-   [300c] <- 0010
-   [3120] <- 011c
-5a [300e] =  11c0 ?
+	if ( math.mux == BB_MUX_ILDEN )
+	{
+		math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0;
+	}
+	else if ( math.mux == BB_MUX_MULEN )
+	{
+		int ins = math.inslatch & 7;
+
+		BB_SET_INS0_BIT;
+		kick_sn74s516(&math.cpulatch, ins);
+	}
+	else if ( math.mux == BB_MUX_PPSEN )
+	{
+		math.ppshift = math.cpulatch;
+	}
+	else if ( math.mux == BB_MUX_PSSEN )
+	{
+		if ( ((math.inslatch >> 8) & BB_DSEL) == 3 )
+		{
+			int shift;
+			UINT16 val = math.ppshift;
+
+			if ( math.cpulatch & 0x3800 )
+			{
+				shift = (math.cpulatch >> 11) & 0x7;
+
+				while (shift)
+				{
+					val = ROR16(val, 1);
+					shift >>= 1;
+				}
+			}
+			else
+			{
+				shift = (math.cpulatch >> 7) & 0xf;
+				shift = reverse_nibble(shift);
+				shift >>= 1;
+
+				while (shift)
+				{
+					val = ROL16(val, 1);
+					shift >>= 1;
+				}
+			}
+			math.ppshift = val;
+		}
+	}
+
+	if ( math.mux != BB_MUX_ILDEN )
+	{
+	    INC_PROM_ADDR;
+		buggyboy_update_state();
+	}
 
-*/
+	return math.cpulatch;
+}
 
-READ16_HANDLER(BB_AU_R)
+WRITE16_HANDLER( buggyboy_spcs_ram_w )
 {
-UINT8 *AU_instr = (UINT8 *)memory_region(REGION_USER1);
-//UINT8 *AU_PROM1 = (UINT8 *)memory_region(REGION_PROMS) + 0x1700;
-//UINT8 *AU_PROM2 = (UINT8 *)memory_region(REGION_PROMS) + 0x1900;
-
-INT16 value = 0;
+	COMBINE_DATA(&tx1_math_ram[offset]);
+}
 
-      switch (offset)
-      {
-        case 0x0:
-        case 0x1:
-        case 0x2:
-        case 0x3:
-        case 0x4:
-        case 0x5:
-        case 0x6:
-        case 0x7:    MMI_74S516(offset, (UINT16*)AU_PTR);   /* Typically Instruction 7 - read result(s) */
-                     value = *AU_PTR;
-                     break;
+READ16_HANDLER( buggyboy_spcs_ram_r )
+{
+	math.cpulatch = tx1_math_ram[offset];
 
-        case 0x0e00/2: value = AU_instr[inst_index] | (AU_instr[inst_index] << 8);
-                     break;
+	offset <<= 1;
 
-        case 0x0680/2:
-                     break;                       /* Use to change upper ROM address portion? */
+	if ( math.mux == BB_MUX_ILDEN )
+	{
+		math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0;
+	}
+	else if ( math.mux == BB_MUX_MULEN )
+	{
+		int ins = math.inslatch & 7;
+
+		BB_SET_INS0_BIT;
+		kick_sn74s516(&math.cpulatch, ins);
+	}
+	else if ( math.mux == BB_MUX_PPSEN )
+	{
+		math.ppshift = math.cpulatch;
+	}
+	else if ( math.mux == BB_MUX_PSSEN )
+	{
+		if ( ((math.inslatch >> 8) & BB_DSEL) == 3 )
+		{
+			int shift;
+			UINT16 val = math.ppshift;
+
+			if ( math.cpulatch & 0x3800 )
+			{
+				shift = (math.cpulatch >> 11) & 0x7;
+
+				while (shift)
+				{
+					val = ROR16(val, 1);
+					shift >>= 1;
+				}
+			}
+			else
+			{
+				shift = (math.cpulatch >> 7) & 0xf;
+				shift = reverse_nibble(shift);
+				shift >>= 1;
+
+				while (shift)
+				{
+					val = ROL16(val, 1);
+					shift >>= 1;
+				}
+			}
+			math.ppshift = val;
+		}
+	}
+
+	if ( math.mux != BB_MUX_ILDEN )
+	{
+	    INC_PROM_ADDR;
+		buggyboy_update_state();
+	}
 
-        case 0x0726/2:
-                     break;
+	return math.cpulatch;
+}
 
-        default:     value = 0;
-                     break;
-      }
 
-    return value;
 
+/*************************************
+ *
+ *  Machine Reset
+ *
+ *************************************/
+MACHINE_RESET( buggybjr )
+{
+	/* TODO */
+	memset(&math, 0, sizeof(math));
 }
 
-WRITE16_HANDLER(BB_AU_W)
+MACHINE_RESET( buggyboy )
 {
-//UINT8 *AU_PROM1 = (UINT8 *)memory_region(REGION_PROMS) + 0x1700;
-//UINT8 *AU_PROM2 = (UINT8 *)memory_region(REGION_PROMS) + 0x1900;
-
-      switch (offset)
-      {
-
-        case 0x0:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR); /* Load values */
-                     break;
+	memset(&math, 0, sizeof(math));
+}
 
-        case 0x1:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
+MACHINE_RESET( tx1 )
+{
+	memset(&math, 0, sizeof(math));
+}
 
-        case 0x2:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
 
-        case 0x3:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
+/*************************************
+ *
+ *  Machine Reset
+ *
+ *************************************/
+MACHINE_START( tx1 )
+{
+	ppi8255_init(&tx1_ppi8255_intf);
 
-        case 0x4:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
+	/* Initialise for each game */
+	prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1);
 
-        case 0x5:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
+	/* /CUDISP CRTC interrupt */
+	timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback);
+}
 
-        case 0x6:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
+MACHINE_START( buggyboy )
+{
+	ppi8255_init(&buggyboy_ppi8255_intf);
 
-        case 0x7:    COMBINE_DATA(AU_PTR);
-                     MMI_74S516(offset, (UINT16*)AU_PTR);
-                     break;
+	/* Initialise for each game */
+	prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1);
 
-       /* Accessing FN ROMs */
-        case 0x0600/2:
-        			COMBINE_DATA(&inst_index);
-                     break;
+	/* /CUDISP CRTC interrupt */
+	timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback);
+}
 
+MACHINE_START( buggybjr )
+{
+	/* Initialise for each game */
+	prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1);
 
-        case 0x0680/2: break;                       /* Increment instruction PROM address */
-        case 0x0726/2: break;
-      }
+	/* /CUDISP CRTC interrupt */
+	timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback);
 }
-
diff -Nru src-old/mame/mame.mak src/mame/mame.mak
--- src-old/mame/mame.mak	2007-12-18 00:09:03.000000000 -0800
+++ src/mame/mame.mak	2007-12-21 08:12:20.000000000 -0800
@@ -931,7 +931,7 @@
 	$(DRIVERS)/midwunit.o $(MACHINE)/midwunit.o \
 	$(DRIVERS)/midxunit.o \
 	$(DRIVERS)/midyunit.o $(MACHINE)/midyunit.o $(VIDEO)/midyunit.o \
-	$(DRIVERS)/midzeus.o $(VIDEO)/midzeus.o \
+	$(DRIVERS)/midzeus.o $(VIDEO)/midzeus.o $(VIDEO)/midzeus2.o \
 	$(DRIVERS)/omegrace.o \
 	$(DRIVERS)/seattle.o \
 	$(DRIVERS)/tmaster.o \
@@ -1343,7 +1343,7 @@
 $(MAMEOBJ)/tatsumi.a: \
 	$(DRIVERS)/lockon.o \
 	$(DRIVERS)/tatsumi.o $(MACHINE)/tatsumi.o $(VIDEO)/tatsumi.o \
-	$(DRIVERS)/tx1.o $(MACHINE)/tx1.o $(VIDEO)/tx1.o \
+	$(DRIVERS)/tx1.o $(MACHINE)/tx1.o $(AUDIO)/tx1.o $(VIDEO)/tx1.o \
 
 $(MAMEOBJ)/tch.a: \
 	$(DRIVERS)/kickgoal.o $(VIDEO)/kickgoal.o \
@@ -1488,7 +1488,6 @@
 	$(DRIVERS)/4enraya.o $(VIDEO)/4enraya.o \
 	$(DRIVERS)/acefruit.o \
 	$(DRIVERS)/adp.o \
-	$(DRIVERS)/afega.o $(VIDEO)/afega.o \
 	$(DRIVERS)/ambush.o $(VIDEO)/ambush.o \
 	$(DRIVERS)/ampoker.o $(VIDEO)/ampoker.o \
 	$(DRIVERS)/amspdwy.o $(VIDEO)/amspdwy.o \
diff -Nru src-old/mame/mamedriv.c src/mame/mamedriv.c
--- src-old/mame/mamedriv.c	2007-12-18 00:24:58.000000000 -0800
+++ src/mame/mamedriv.c	2007-12-23 09:18:21.000000000 -0800
@@ -3064,6 +3064,7 @@
 	DRIVER( wcbwl161 )	/* (c) 1995 Incredible Technologies */
 	DRIVER( wcbwl140 )	/* (c) 1995 Incredible Technologies */
 	DRIVER( wcbwl15 )	/* (c) 1995 Incredible Technologies */
+	DRIVER( wcbwl13 )	/* (c) 1995 Incredible Technologies */
 	DRIVER( wcbwl12 )	/* (c) 1995 Incredible Technologies */
 	DRIVER( sftm )		/* (c) 1995 Capcom/Incredible Technologies */
 	DRIVER( sftm110 )	/* (c) 1995 Capcom/Incredible Technologies */
@@ -7500,7 +7501,7 @@
 	DRIVER( tx1 )		/* (c) 1983 Tatsumi */
 	DRIVER( tx1a )		/* (c) 1983 Tatsumi */
 	DRIVER( buggyboy )	/* (c) 1985 Tatsumi */
-	DRIVER( buggyb1 )	/* (c) 1985 Tatsumi */
+	DRIVER( buggybjr )	/* (c) 1986 Tatsumi */
 	DRIVER( sprcros2 )	/* (c) 1986 GM Shoji */
 	DRIVER( sprcrs2a )	/* (c) 1986 GM Shoji */
 	DRIVER( gcpinbal )	/* (c) 1994 Excellent System */
diff -Nru src-old/mame/video/afega.c src/mame/video/afega.c
--- src-old/mame/video/afega.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/afega.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,381 +0,0 @@
-/***************************************************************************
-
-                              -= Afega Games =-
-
-                    driver by   Luca Elia (l.elia@tin.it)
-
-
-Note:   if MAME_DEBUG is defined, pressing Z with:
-
-        Q / W           Shows Layer 0 / 1
-        A               Shows Sprites
-
-        Keys can be used together!
-
-    [ 2 Layers ]
-                                [ Layer 0 ]     [ Layer 1 ]
-
-        Tile Size:              16 x 16 x 4/8   8 x 8 x 4
-        Layer Size (pixels):    1024 x 1024     256 x 256
-        Layer Size (tiles):     64 x 64         32 x 32
-        Scrolling:              Yes             No
-
-        The layout is a bit weird. 16 consecutive tile codes define a
-        vertical column. 16 columns form a page (256 x 256).
-        Layer 0 is made of 4 x 4 pages. Layer 1 of just 1 page.
-
-    [ 256 Sprites ]
-
-        Sprites are made of 16 x 16 x 4 tiles. Size can vary from 1 to 16
-        tiles both horizontally and vertically.
-        Is there zooming ?
-
-    [ Priorities ]
-
-        The game only uses this scheme:
-
-        Back -> Front:  Layer 0, Sprites, Layer 1
-
-***************************************************************************/
-
-#include "driver.h"
-#ifdef MAME_DEBUG
-#include "ui.h"
-#endif
-
-/* Variables needed by drivers: */
-
-UINT16 *afega_vram_0, *afega_scroll_0;
-UINT16 *afega_vram_1, *afega_scroll_1;
-
-
-/***************************************************************************
-
-
-                        Palette - RRRRGGGGBBBB????
-
-
-***************************************************************************/
-
-WRITE16_HANDLER( afega_palette_w )
-{
-	int r,g,b;
-	data = COMBINE_DATA(&paletteram16[offset]);
-	b = ((data & 0x00F0) >> 3 ) + ((data & 0x0002) >> 1);
-	g = ((data & 0x0F00) >> 7 ) + ((data & 0x0004) >> 2);
-	r = ((data & 0xF000) >> 11) + ((data & 0x0008) >> 3);
-	palette_set_color_rgb( Machine, offset, pal5bit(r) , pal5bit(g) , pal5bit(b) );
-}
-
-/* This game uses 8 bit tiles, so it ignores the color codes and just
-   uses the same 256 colors for every tile */
-PALETTE_INIT( grdnstrm )
-{
-	int color, pen;
-	for( color = 0; color < 16; color++ )
-		for( pen = 0; pen < 256; pen++ )
-			colortable[color * 256 + pen + 256*3] = 256*0 + pen;
-}
-
-
-/***************************************************************************
-
-                                Tilemaps
-
-    Offset:     Bits:                   Value:
-
-        2.w     fedc ---- ---- ----     Color
-                ---- ba98 7654 3210     Code
-
-***************************************************************************/
-
-#define TILES_PER_PAGE_X	(0x10)
-#define TILES_PER_PAGE_Y	(0x10)
-#define PAGES_PER_TMAP_X	(0x4)
-#define PAGES_PER_TMAP_Y	(0x4)
-#define FIREHAWK_PAGES_PER_TMAP_X	(0x1)
-#define FIREHAWK_PAGES_PER_TMAP_Y	(0x1)
-#define TWINACTN_TILES_PER_PAGE_X	(0x100)
-#define TWINACTN_TILES_PER_PAGE_Y	(0x10)
-#define TWINACTN_PAGES_PER_TMAP_X	(0x1)
-#define TWINACTN_PAGES_PER_TMAP_Y	(0x1)
-
-
-static TILEMAP_MAPPER( afega_tilemap_scan_pages )
-{
-	return	(row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * PAGES_PER_TMAP_X +
-			(row % TILES_PER_PAGE_Y) +
-
-			(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
-			(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
-}
-
-static TILEMAP_MAPPER( twinactn_tilemap_scan_pages )
-{
-	return	(row / TWINACTN_TILES_PER_PAGE_Y) * TWINACTN_TILES_PER_PAGE_X * TWINACTN_TILES_PER_PAGE_Y * TWINACTN_PAGES_PER_TMAP_X +
-			(row % TWINACTN_TILES_PER_PAGE_Y) +
-
-			(col / TWINACTN_TILES_PER_PAGE_X) * TWINACTN_TILES_PER_PAGE_X * TWINACTN_TILES_PER_PAGE_Y +
-			(col % TWINACTN_TILES_PER_PAGE_X) * TWINACTN_TILES_PER_PAGE_Y;
-}
-
-static TILEMAP_MAPPER( firehawk_tilemap_scan_pages )
-{
-	return	(row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * FIREHAWK_PAGES_PER_TMAP_X +
-			(row % TILES_PER_PAGE_Y) +
-
-			(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
-			(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
-}
-
-static tilemap *tilemap_0, *tilemap_1;
-
-static TILE_GET_INFO( get_tile_info_0 )
-{
-	UINT16 code = afega_vram_0[tile_index];
-	SET_TILE_INFO(
-			1,
-			code,
-			(code & 0xf000) >> 12,
-			0);
-}
-static TILE_GET_INFO( get_tile_info_1 )
-{
-	UINT16 code = afega_vram_1[tile_index];
-	SET_TILE_INFO(
-			2,
-			code,
-			(code & 0xf000) >> 12,
-			0);
-}
-
-WRITE16_HANDLER( afega_vram_0_w )
-{
-	COMBINE_DATA(&afega_vram_0[offset]);
-	tilemap_mark_tile_dirty(tilemap_0,offset);
-}
-WRITE16_HANDLER( afega_vram_1_w )
-{
-	COMBINE_DATA(&afega_vram_1[offset]);
-	tilemap_mark_tile_dirty(tilemap_1,offset);
-}
-
-
-/***************************************************************************
-
-
-                            Video Hardware Init
-
-
-***************************************************************************/
-
-VIDEO_START( afega )
-{
-	tilemap_0 = tilemap_create(	get_tile_info_0, afega_tilemap_scan_pages,
-								TILEMAP_TYPE_PEN,
-								16,16,
-								TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
-
-	tilemap_1 = tilemap_create(	get_tile_info_1, tilemap_scan_cols,
-								TILEMAP_TYPE_PEN,
-								8,8,
-								32,32);
-
-	tilemap_set_transparent_pen(tilemap_1,0xf);
-}
-
-VIDEO_START( twinactn )
-{
-	tilemap_0 = tilemap_create(	get_tile_info_0, twinactn_tilemap_scan_pages,
-								TILEMAP_TYPE_PEN,
-								16,16,
-								TWINACTN_TILES_PER_PAGE_X*TWINACTN_PAGES_PER_TMAP_X,TWINACTN_TILES_PER_PAGE_Y*TWINACTN_PAGES_PER_TMAP_Y);
-
-	tilemap_1 = tilemap_create(	get_tile_info_1, tilemap_scan_cols,
-								TILEMAP_TYPE_PEN,
-								8,8,
-								32,32);
-
-	tilemap_set_transparent_pen(tilemap_1,0xf);
-}
-
-VIDEO_START( firehawk )
-{
-	tilemap_0 = tilemap_create(	get_tile_info_0, firehawk_tilemap_scan_pages,
-								TILEMAP_TYPE_PEN,
-								16,16,
-								TILES_PER_PAGE_X*FIREHAWK_PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*FIREHAWK_PAGES_PER_TMAP_Y);
-
-	tilemap_1 = tilemap_create(	get_tile_info_1, tilemap_scan_cols,
-								TILEMAP_TYPE_PEN,
-								8,8,
-								32,32);
-
-	tilemap_set_transparent_pen(tilemap_1,0xf);
-}
-
-
-/***************************************************************************
-
-                                Sprites Drawing
-
-    Offset:     Bits:                   Value:
-
-        0.w     fedc ba-- ---- ----
-                ---- --9- ---- ----     Flip Y?
-                ---- ---8 7654 3---
-                ---- --------- -21-     Priority?
-                ---- ---- ---- ---0     1 = Draw This Sprite
-
-        2.w     fedc ba98 ---- ----
-                ---- ---- 7654 ----     Number Of Tiles Along Y - 1
-                ---- ---- ---- 3210     Number Of Tiles Along X - 1
-
-        4.w
-
-        6.w                             Code
-
-        8.w     fedc ba98 ---- ----
-                ---- ---- 7654 3210     X (Signed)
-
-        A.w
-
-        C.w     fedc ba98 ---- ----
-                ---- ---- 7654 3210     Y (Signed)
-
-        E.w     fedc ba98 7654 ----
-                ---- ---- ---- 3210     Color
-
-
-***************************************************************************/
-
-static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect, UINT16 attr_mask)
-{
-	int offs;
-
-	int max_x		=	machine->screen[0].width;
-	int max_y		=	machine->screen[0].height;
-
-	for ( offs = 0; offs < spriteram_size/2; offs += 16/2 )
-	{
-		int attr, dim, code, sx, sy, color, flipx, flipy;
-
-		int x, xnum, xstart, xend, xinc;
-		int y, ynum, ystart, yend, yinc;
-
-		attr	=		spriteram16[offs + 0x0/2];
-		if (!(attr & attr_mask))	continue;
-		dim		=		spriteram16[offs + 0x2/2];
-		code	=		spriteram16[offs + 0x6/2];
-		sx		=		spriteram16[offs + 0x8/2];
-		sy		=		spriteram16[offs + 0xc/2];
-		color	=		spriteram16[offs + 0xe/2];
-
-		flipx	=		attr & 0x000;	// ?
-		flipy	=		attr & 0x000;	// ?
-
-		xnum		=		((dim >> 0) & 0xf) + 1;
-		ynum		=		((dim >> 4) & 0xf) + 1;
-
-		sx = (sx & 0xff) - (sx & 0x100);
-		sy = (sy & 0xff) - (sy & 0x100);
-
-		if (flip_screen_x)	{	flipx = !flipx;		sx = max_x - sx - xnum * 16;	}
-		if (flip_screen_y)	{	flipy = !flipy;		sy = max_y - sy - ynum * 16;	}
-
-		if (flipx)	{ xstart = xnum-1;  xend = -1;    xinc = -1; }
-		else		{ xstart = 0;       xend = xnum;  xinc = +1; }
-
-		if (flipy)	{ ystart = ynum-1;  yend = -1;    yinc = -1; }
-		else		{ ystart = 0;       yend = ynum;  yinc = +1; }
-
-		for (y = ystart; y != yend; y += yinc)
-		{
-			for (x = xstart; x != xend; x += xinc)
-			{
-				drawgfx( bitmap,machine->gfx[0],
-								code++,
-								color,
-								flipx, flipy,
-								sx + x * 16, sy + y * 16,
-								cliprect,TRANSPARENCY_PEN,15 );
-			}
-		}
-
-#ifdef MAME_DEBUG
-#if 1
-if (input_code_pressed(KEYCODE_X))
-{	/* Display some info on each sprite */
-	char buf[10];
-	sprintf(buf, "%X",(spriteram16[offs + 0x0/2]&6)/2);
-	ui_draw_text(buf, sy, sx);
-}
-#endif
-#endif
-	}
-}
-
-
-
-/***************************************************************************
-
-
-                                Screen Drawing
-
-
-***************************************************************************/
-
-static void video_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
-	int dsw_flipscreen,			// 1 = Horizontal and vertical screen flip are hardwired to 2 dip switches
-	int xoffset, int yoffset,	// tilemap_0 offsets
-	int attr_mask				// "sprite active" mask
-	)
-{
-	int layers_ctrl = -1;
-
-	if (dsw_flipscreen)
-	{
-
-		flip_screen_x_set(~readinputport(2) & 0x0100);
-		flip_screen_y_set(~readinputport(2) & 0x0200);
-	}
-
-	tilemap_set_scrollx(tilemap_0, 0, afega_scroll_0[1] + xoffset);
-	tilemap_set_scrolly(tilemap_0, 0, afega_scroll_0[0] + yoffset);
-
-	tilemap_set_scrollx(tilemap_1, 0, afega_scroll_1[1]);
-	tilemap_set_scrolly(tilemap_1, 0, afega_scroll_1[0]);
-
-#ifdef MAME_DEBUG
-if ( input_code_pressed(KEYCODE_Z) )
-{	int msk = 0;
-	if (input_code_pressed(KEYCODE_Q))	msk |= 1;
-	if (input_code_pressed(KEYCODE_W))	msk |= 2;
-	if (input_code_pressed(KEYCODE_A))	msk |= 4;
-	if (msk != 0) layers_ctrl &= msk;	}
-#endif
-
-	if (layers_ctrl & 1)	tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
-	else					fillbitmap(bitmap,get_black_pen(machine),cliprect);
-
-	if (layers_ctrl & 4) 	draw_sprites(machine,bitmap,cliprect, attr_mask);
-
-	if (layers_ctrl & 2)	tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
-}
-
-VIDEO_UPDATE( afega )		{	video_update(machine,bitmap,cliprect, 1, -0x100,+0x000, 0x0001);	return 0; }
-VIDEO_UPDATE( bubl2000 )	{	video_update(machine,bitmap,cliprect, 0, -0x100,+0x000, 0x0001);	return 0; }	// no flipscreen support, I really would confirmation from the schematics
-VIDEO_UPDATE( redhawkb )	{	video_update(machine,bitmap,cliprect, 0, +0x000,+0x100, 0x0001);	return 0; }
-VIDEO_UPDATE( twinactn )	{	video_update(machine,bitmap,cliprect, 0, +0x000,+0x000, 0x0100);	return 0; }
-
-VIDEO_UPDATE( firehawk )
-{
-	tilemap_set_scrolly(tilemap_0, 0, afega_scroll_1[1] + 0x100);
-	tilemap_set_scrollx(tilemap_0, 0, afega_scroll_1[0]);
-
-	tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
-	draw_sprites(machine,bitmap,cliprect,1);
-
-	tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
-	return 0;
-}
diff -Nru src-old/mame/video/fitfight.c src/mame/video/fitfight.c
--- src-old/mame/video/fitfight.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/fitfight.c	2007-12-23 19:41:16.000000000 -0800
@@ -3,7 +3,9 @@
 #include "driver.h"
 
 extern UINT16 *fitfight_spriteram;
-extern UINT16 *fof_100000, *fof_600000, *fof_700000, *fof_800000, *fof_900000, *fof_a00000;
+extern UINT16 *fof_700000;
+extern UINT16 *fof_900000;
+extern UINT16 *fof_a00000;
 
 extern UINT16 *fof_bak_tileram;
 static tilemap *fof_bak_tilemap;
diff -Nru src-old/mame/video/konamiic.c src/mame/video/konamiic.c
--- src-old/mame/video/konamiic.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/video/konamiic.c	2007-12-23 19:41:16.000000000 -0800
@@ -1214,8 +1214,8 @@
 /*                                                                         */
 /***************************************************************************/
 
-/*static*/ UINT8 K007121_ctrlram[MAX_K007121][8];
-/*static*/ int K007121_flipscreen[MAX_K007121];
+UINT8 K007121_ctrlram[MAX_K007121][8];
+static int K007121_flipscreen[MAX_K007121];
 
 
 void K007121_ctrl_w(int chip,int offset,int data)
diff -Nru src-old/mame/video/lethal.c src/mame/video/lethal.c
--- src-old/mame/video/lethal.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/lethal.c	2007-12-23 19:41:16.000000000 -0800
@@ -89,7 +89,7 @@
 	layer_colorbase[3] = 0xc0;
 }
 
-WRITE8_HANDLER(le_palette_control)
+WRITE8_HANDLER(lethalen_palette_control)
 {
 	switch (offset)
 	{
diff -Nru src-old/mame/video/midzeus.c src/mame/video/midzeus.c
--- src-old/mame/video/midzeus.c	2007-12-18 00:09:03.000000000 -0800
+++ src/mame/video/midzeus.c	2007-12-23 20:03:00.000000000 -0800
@@ -34,8 +34,8 @@
 typedef struct _poly_extra_data poly_extra_data;
 struct _poly_extra_data
 {
-	const UINT64 *	palbase;
-	const UINT64 *	texbase;
+	const void *	palbase;
+	const void *	texbase;
 	UINT16			solidcolor;
 	INT16			zoffset;
 	UINT16			transcolor;
@@ -60,23 +60,15 @@
 static UINT32 zeus_fifo[20];
 static UINT8 zeus_fifo_words;
 static INT16 zeus_matrix[3][3];
-static INT16 zeus_matrix2[3][3];
-static UINT8 zeus_usematrix2;
 static INT32 zeus_point[3];
-static UINT64 *zeus_renderbase;
-static UINT64 *zeus_palbase;
+static INT16 zeus_light[3];
+static void *zeus_renderbase;
+static void *zeus_palbase;
 static int zeus_enable_logging;
 static UINT32 zeus_objdata;
 static rectangle zeus_cliprect;
 
-static UINT64 *waveram[2];
-
-static UINT8 single_step;
-static poly_extra_data single_step_extra;
-static UINT32 single_step_val1;
-static UINT32 single_step_val2;
-static INT32 single_step_dx, single_step_dy;
-static UINT8 single_step_advance;
+static void *waveram[2];
 
 
 
@@ -109,106 +101,126 @@
 
 /*************************************
  *
- *  Inlines
+ *  Macros
  *
  *************************************/
 
-INLINE UINT64 *waveram_ptr_from_block_addr(UINT8 bank, UINT32 addr)
-{
-	return &waveram[bank][(addr % WAVERAM_WIDTH) + ((addr >> 12) % WAVERAM_HEIGHT) * WAVERAM_WIDTH];
-}
+#define WAVERAM_BLOCK(bank, blocknum)			((void *)((UINT8 *)waveram[bank] + 8 * (blocknum)))
 
+#define WAVERAM_PTR8(base, bytenum)				((UINT8 *)(base) + BYTE4_XOR_LE(bytenum))
+#define WAVERAM_READ8(base, bytenum)			(*WAVERAM_PTR8(base, bytenum))
+#define WAVERAM_WRITE8(base, bytenum, data)		do { *WAVERAM_PTR8(base, bytenum) = (data); } while (0)
+
+#define WAVERAM_PTR16(base, wordnum)			((UINT16 *)(base) + BYTE_XOR_LE(wordnum))
+#define WAVERAM_READ16(base, wordnum)			(*WAVERAM_PTR16(base, wordnum))
+#define WAVERAM_WRITE16(base, wordnum, data)	do { *WAVERAM_PTR16(base, wordnum) = (data); } while (0)
+
+#define WAVERAM_PTR32(base, dwordnum)			((UINT32 *)(base) + (dwordnum))
+#define WAVERAM_READ32(base, dwordnum)			(*WAVERAM_PTR32(base, dwordnum))
+#define WAVERAM_WRITE32(base, dwordnum, data)	do { *WAVERAM_PTR32(base, dwordnum) = (data); } while (0)
+
+#define PIXYX_TO_WORDNUM(y, x)					(((y) << 10) | (((x) & 0x1fe) << 1) | ((x) & 1))
+#define DEPTHYX_TO_WORDNUM(y, x)				(PIXYX_TO_WORDNUM(y, x) | 2)
+
+#define WAVERAM_PTRPIX(base, y, x)				WAVERAM_PTR16(base, PIXYX_TO_WORDNUM(y, x))
+#define WAVERAM_READPIX(base, y, x)				(*WAVERAM_PTRPIX(base, y, x))
+#define WAVERAM_WRITEPIX(base, y, x, color)		do { *WAVERAM_PTRPIX(base, y, x) = (color);  } while (0)
+
+#define WAVERAM_PTRDEPTH(base, y, x)			WAVERAM_PTR16(base, DEPTHYX_TO_WORDNUM(y, x))
+#define WAVERAM_READDEPTH(base, y, x)			(*WAVERAM_PTRDEPTH(base, y, x))
+#define WAVERAM_WRITEDEPTH(base, y, x, color)	do { *WAVERAM_PTRDEPTH(base, y, x) = (color);  } while (0)
 
-INLINE UINT64 *waveram_ptr_from_expanded_addr(UINT8 bank, UINT32 addr)
-{
-	return &waveram[bank][(addr % WAVERAM_WIDTH) + ((addr >> 16) % WAVERAM_HEIGHT) * WAVERAM_WIDTH];
-}
 
 
-INLINE UINT64 *waveram_ptr_from_texture_addr(UINT8 bank, UINT32 addr, int width)
+/*************************************
+ *
+ *  Inlines for block addressing
+ *
+ *************************************/
+
+INLINE void *waveram_ptr_from_block_addr(UINT8 bank, UINT32 addr)
 {
-	return &waveram[bank][((addr & ~1) * width) / 8];
+	UINT32 blocknum = (addr % WAVERAM_WIDTH) + ((addr >> 12) % WAVERAM_HEIGHT) * WAVERAM_WIDTH;
+	return WAVERAM_BLOCK(bank, blocknum);
 }
 
+INLINE void *waveram_ptr_from_expanded_addr(UINT8 bank, UINT32 addr)
+{
+	UINT32 blocknum = (addr % WAVERAM_WIDTH) + ((addr >> 16) % WAVERAM_HEIGHT) * WAVERAM_WIDTH;
+	return WAVERAM_BLOCK(bank, blocknum);
+}
 
-INLINE UINT16 *waveram_pixel_ptr(UINT64 *base, int y, int x, UINT16 **depthptr)
+INLINE void *waveram_ptr_from_texture_addr(UINT8 bank, UINT32 addr, int width)
 {
-	UINT16 *baseptr = (UINT16 *)base + y * 512*2 + (x & ~1) * 2;
-	if (depthptr != NULL)
-		*depthptr = baseptr + BYTE4_XOR_LE((x & 1) + 2);
-	return baseptr + BYTE4_XOR_LE(x & 1);
+	UINT32 blocknum = ((addr & ~1) * width) / 8;
+	return WAVERAM_BLOCK(bank, blocknum);
 }
 
 
+
+/*************************************
+ *
+ *  Inlines for rendering
+ *
+ *************************************/
+
 INLINE void waveram_plot(int y, int x, UINT16 color)
 {
-	if (x >= 0 && x < 400 && y >= 0 && y < 256)
-	{
-		UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, y, x, NULL);
-		*ptr = color;
-	}
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+		WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
 }
 
-
 INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth)
 {
-	if (x >= 0 && x < 400 && y >= 0 && y < 256)
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
 	{
-		UINT16 *depthptr;
-		UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, y, x, &depthptr);
-		*ptr = color;
-		*depthptr = depth;
+		WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
+		WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth);
 	}
 }
 
-
 INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth)
 {
-	if (x >= 0 && x < 400 && y >= 0 && y < 256)
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
 	{
-		UINT16 *depthptr;
-		UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, y, x, &depthptr);
+		UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
 		if (depth <= *depthptr)
 		{
-			*ptr = color;
+			WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
 			*depthptr = depth;
 		}
 	}
 }
 
-
 INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT16 color, UINT16 depth)
 {
-	if (x >= 0 && x < 400 && y >= 0 && y < 256)
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
 	{
-		UINT16 *depthptr;
-		UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, y, x, &depthptr);
+		UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
 		if (depth <= *depthptr)
-			*ptr = color;
+			WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
 	}
 }
 
 
-INLINE UINT8 get_texel_8bit(const UINT64 *base, int y, int x, int width)
-{
-	const UINT8 *base8 = (const UINT8 *)base;
-	base8 += BYTE8_XOR_LE((y / 2) * (width * 2) + (x / 4) * 8 + (y & 1) * 4 + (x & 3));
-	return *base8;
-}
 
+/*************************************
+ *
+ *  Inlines for texel accesses
+ *
+ *************************************/
 
-INLINE UINT8 get_texel_4bit(const UINT64 *base, int y, int x, int width)
+INLINE UINT8 get_texel_8bit(const void *base, int y, int x, int width)
 {
-	const UINT8 *base8 = (const UINT8 *)base;
-	base8 += BYTE8_XOR_LE((y / 2) * (width * 2) + (x / 8) * 8 + (y & 1) * 4 + ((x / 2) & 3));
-	return (*base8 >> (4 * (x & 1))) & 0x0f;
+	UINT32 byteoffs = (y / 2) * (width * 2) + ((x / 4) << 3) + ((y & 1) << 2) + (x & 3);
+	return WAVERAM_READ8(base, byteoffs);
 }
 
 
-INLINE UINT16 get_palette_entry(const UINT64 *palbase, UINT8 texel)
+INLINE UINT8 get_texel_4bit(const void *base, int y, int x, int width)
 {
-	const UINT16 *base16 = (const UINT16 *)palbase;
-	return base16[BYTE4_XOR_LE(texel)];
+	UINT32 byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3);
+	return (WAVERAM_READ8(base, byteoffs) >> (4 * (x & 1))) & 0x0f;
 }
 
 
@@ -224,17 +236,17 @@
 	int i;
 
 	/* allocate memory for "wave" RAM */
-	waveram[0] = auto_malloc(WAVERAM_WIDTH * WAVERAM_HEIGHT * sizeof(*waveram[0]));
-	waveram[1] = auto_malloc(WAVERAM_WIDTH * WAVERAM_HEIGHT * sizeof(*waveram[1]));
-	state_save_register_global_pointer(waveram[0], WAVERAM_WIDTH * WAVERAM_HEIGHT);
-	state_save_register_global_pointer(waveram[1], WAVERAM_WIDTH * WAVERAM_HEIGHT);
+	waveram[0] = auto_malloc(WAVERAM_WIDTH * WAVERAM_HEIGHT * 8);
+	waveram[1] = auto_malloc(WAVERAM_WIDTH * WAVERAM_HEIGHT * 8);
+	state_save_register_global_pointer(((UINT32 *)waveram[0]), WAVERAM_WIDTH * WAVERAM_HEIGHT * 8/4);
+	state_save_register_global_pointer(((UINT32 *)waveram[1]), WAVERAM_WIDTH * WAVERAM_HEIGHT * 8/4);
 
 	/* initialize a 5-5-5 palette */
 	for (i = 0; i < 32768; i++)
 		palette_set_color_rgb(machine, i, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0));
 
 	/* initialize polygon engine */
-	poly = poly_alloc(1000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
+	poly = poly_alloc(10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
 
 	/* we need to cleanup on exit */
 	add_exit_callback(machine, exit_handler);
@@ -275,45 +287,18 @@
 {
 	int x, y;
 
+	poly_wait(poly, "VIDEO_UPDATE");
+
 	/* normal update case */
 	if (!input_code_pressed(KEYCODE_W))
 	{
-		UINT64 *base = waveram_ptr_from_expanded_addr(1, zeusbase[0xcc]);
+		const void *base = waveram_ptr_from_expanded_addr(1, zeusbase[0xcc]);
 		int xoffs = machine->screen[screen].visarea.min_x;
 		for (y = cliprect->min_y; y <= cliprect->max_y; y++)
 		{
 			UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels;
 			for (x = cliprect->min_x; x <= cliprect->max_x; x++)
-				dest[x] = *waveram_pixel_ptr(base, y, x - xoffs, NULL);
-		}
-
-		if (single_step)
-		{
-			int texwshift = ((single_step_val2 >> 6) + single_step_dx) & 7;
-			int texwidth = 512 >> texwshift;
-			int texdepth = (single_step_val2 & 0x20) ? 8 : 4;
-			const UINT64 *texbase = waveram_ptr_from_texture_addr(0, single_step_val1, texwidth);
-			int x, y;
-
-			for (y = 0; y < 256; y++)
-			{
-				UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels + 400;
-				for (x = 0; x < 256; x++)
-				{
-					if (x < texwidth)
-						dest[x] = get_palette_entry(single_step_extra.palbase, (texdepth == 8) ? get_texel_8bit(texbase, y, x, texwidth) : get_texel_4bit(texbase, y, x, texwidth));
-					else
-						dest[x] = 0;
-				}
-			}
-
-			popmessage("val1=%08X  val2=%08X\nwidth=%d  depth=%d", single_step_val1, single_step_val2, texwidth, texdepth);
-
-			if (input_code_pressed(KEYCODE_UP)) { single_step_dy--; while (input_code_pressed(KEYCODE_UP)) ; }
-			if (input_code_pressed(KEYCODE_DOWN)) { single_step_dy++; while (input_code_pressed(KEYCODE_DOWN)) ; }
-			if (input_code_pressed(KEYCODE_LEFT)) { single_step_dx--; while (input_code_pressed(KEYCODE_LEFT)) ; }
-			if (input_code_pressed(KEYCODE_RIGHT)) { single_step_dx++; while (input_code_pressed(KEYCODE_RIGHT)) ; }
-			if (input_code_pressed(KEYCODE_LSHIFT)) { single_step_advance = TRUE; while (input_code_pressed(KEYCODE_LSHIFT)) ; }
+				dest[x] = WAVERAM_READPIX(base, y, x - xoffs);
 		}
 	}
 
@@ -322,7 +307,7 @@
 	{
 		static int yoffs = 0;
 		static int width = 256;
-		const UINT64 *base;
+		const void *base;
 
 		if (input_code_pressed(KEYCODE_DOWN)) yoffs += input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
 		if (input_code_pressed(KEYCODE_UP)) yoffs -= input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
@@ -362,16 +347,6 @@
 
 	switch (offset & ~1)
 	{
-		case 0x00:
-			// crusnexo wants bit 0x20 to be non-zero
-			result = 0x20;
-			break;
-
-		case 0x51:
-			// crusnexo expects a reflection of the data at 0x08 here (b425)
-			result = zeusbase[0x08];
-			break;
-
 		case 0xf0:
 			result = video_screen_get_hpos(0);
 			logit = 0;
@@ -452,19 +427,6 @@
 }
 
 
-READ32_HANDLER( zeus2_r )
-{
-	logerror("%06X:zeus_r(%02X)\n", activecpu_get_pc(), offset * 2);
-	return zeus_r(offset * 2, 0);
-}
-
-
-WRITE32_HANDLER( zeus2_w )
-{
-	logerror("%06X:zeus_w(%02X) = %08X\n", activecpu_get_pc(), offset * 2, data);
-}
-
-
 
 /*************************************
  *
@@ -687,15 +649,15 @@
 				if ((offset == 0xb0 && (zeusbase[0xb6] & 0x02000000) == 0) ||
 					(offset == 0xb2 && (zeusbase[0xb6] & 0x02000000) != 0))
 				{
-					UINT16 *dest = (UINT16 *)waveram_ptr_from_expanded_addr(zeusbase[0xb6] >> 31, zeusbase[0xb4]);
+					void *dest = waveram_ptr_from_expanded_addr(zeusbase[0xb6] >> 31, zeusbase[0xb4]);
 					if (zeusbase[0xb6] & 0x00100000)
-						dest[BYTE4_XOR_LE(0)] = zeusbase[0xb0];
+						WAVERAM_WRITE16(dest, 0, zeusbase[0xb0]);
 					if (zeusbase[0xb6] & 0x00200000)
-						dest[BYTE4_XOR_LE(1)] = zeusbase[0xb0] >> 16;
+						WAVERAM_WRITE16(dest, 1, zeusbase[0xb0] >> 16);
 					if (zeusbase[0xb6] & 0x00400000)
-						dest[BYTE4_XOR_LE(2)] = zeusbase[0xb2];
+						WAVERAM_WRITE16(dest, 2, zeusbase[0xb2]);
 					if (zeusbase[0xb6] & 0x00800000)
-						dest[BYTE4_XOR_LE(3)] = zeusbase[0xb2] >> 16;
+						WAVERAM_WRITE16(dest, 3, zeusbase[0xb2] >> 16);
 					if (zeusbase[0xb6] & 0x00020000)
 						zeusbase[0xb4]++;
 				}
@@ -705,9 +667,10 @@
 		case 0xb4:
 			if (zeusbase[0xb6] & 0x00010000)
 			{
-				const UINT64 *src = waveram_ptr_from_expanded_addr(zeusbase[0xb6] >> 31, zeusbase[0xb4]);
-				zeusbase[0xb0] = *src;
-				zeusbase[0xb2] = *src >> 32;
+				const UINT32 *src = waveram_ptr_from_expanded_addr(zeusbase[0xb6] >> 31, zeusbase[0xb4]);
+				poly_wait(poly, "vram_read");
+				zeusbase[0xb0] = WAVERAM_READ32(src, 0);
+				zeusbase[0xb2] = WAVERAM_READ32(src, 1);
 			}
 			break;
 
@@ -724,7 +687,7 @@
 				rectangle visarea;
 
 				visarea.min_x = zeusbase[0xc6] & 0xffff;
-				visarea.max_x = htotal - 1;
+				visarea.max_x = htotal - 3;
 				visarea.min_y = 0;
 				visarea.max_y = zeusbase[0xc8] & 0xffff;
 				if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal)
@@ -739,11 +702,7 @@
 
 		case 0xcc:
 			video_screen_update_partial(0, video_screen_get_vpos(0));
-
 			log_fifo = input_code_pressed(KEYCODE_L);
-//          single_step = input_code_pressed(KEYCODE_S);
-			if (single_step)
-				popmessage("Single Step");
 			break;
 
 		case 0xe0:
@@ -810,96 +769,82 @@
 
 		/* 0x1C: write matrix and translation vector */
 		case 0x1c:
+
+			/* single matrix form */
 			if ((data[0] & 0xffff) != 0x7fff)
 			{
+				/* requires 8 words total */
 				if (numwords < 8)
 					return FALSE;
 				if (log_fifo)
 				{
 					log_fifo_command(data, numwords, "");
 					logerror("\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tvector %8.2f %8.2f %8.5f\n",
-						data[2] & 0xffff,
-						data[2] >> 16,
-						data[0] & 0xffff,
-						data[3] & 0xffff,
-						data[3] >> 16,
-						data[1] >> 16,
-						data[4] & 0xffff,
-						data[4] >> 16,
-						data[1] & 0xffff,
+						data[2] & 0xffff,	data[2] >> 16,		data[0] & 0xffff,
+						data[3] & 0xffff,	data[3] >> 16,		data[1] >> 16,
+						data[4] & 0xffff,	data[4] >> 16,		data[1] & 0xffff,
 						(float)(INT32)data[5] * (1.0f / 65536.0f),
 						(float)(INT32)data[6] * (1.0f / 65536.0f),
 						(float)(INT32)data[7] * (1.0f / (65536.0f * 512.0f)));
 				}
 
-				zeus_matrix[0][0] = data[2];
-				zeus_matrix[0][1] = data[2] >> 16;
-				zeus_matrix[0][2] = data[0];
-				zeus_matrix[1][0] = data[3];
-				zeus_matrix[1][1] = data[3] >> 16;
-				zeus_matrix[1][2] = data[1] >> 16;
-				zeus_matrix[2][0] = data[4];
-				zeus_matrix[2][1] = data[4] >> 16;
-				zeus_matrix[2][2] = data[1];
-
-				zeus_usematrix2 = FALSE;
+				/* extract the matrix from the raw data */
+				zeus_matrix[0][0] = data[2];	zeus_matrix[0][1] = data[2] >> 16;	zeus_matrix[0][2] = data[0];
+				zeus_matrix[1][0] = data[3];	zeus_matrix[1][1] = data[3] >> 16;	zeus_matrix[1][2] = data[1] >> 16;
+				zeus_matrix[2][0] = data[4];	zeus_matrix[2][1] = data[4] >> 16;	zeus_matrix[2][2] = data[1];
 
+				/* extract the translation point from the raw data */
 				zeus_point[0] = data[5];
 				zeus_point[1] = data[6];
 				zeus_point[2] = data[7];
 			}
+
+			/* double matrix form */
 			else
 			{
+				INT16 matrix1[3][3];
+				INT16 matrix2[3][3];
+
+				/* requires 13 words total */
 				if (numwords < 13)
 					return FALSE;
 				if (log_fifo)
 				{
 					log_fifo_command(data, numwords, "");
 					logerror("\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tvector %8.2f %8.2f %8.5f\n",
-						data[3] & 0xffff,
-						data[3] >> 16,
-						data[7] & 0xffff,
-						data[5] & 0xffff,
-						data[6] & 0xffff,
-						data[2] >> 16,
-						data[1] & 0xffff,
-						data[1] >> 16,
-						data[2] & 0xffff,
-						data[4] & 0xffff,
-						data[4] >> 16,
-						data[5] >> 16,
-						data[8] & 0xffff,
-						data[8] >> 16,
-						data[6] >> 16,
-						data[9] & 0xffff,
-						data[9] >> 16,
-						data[7] >> 16,
+						data[4] & 0xffff,	data[4] >> 16,		data[5] >> 16,
+						data[8] & 0xffff,	data[8] >> 16,		data[6] >> 16,
+						data[9] & 0xffff,	data[9] >> 16,		data[7] >> 16,
+						data[1] & 0xffff,	data[2] & 0xffff,	data[3] & 0xffff,
+						data[1] >> 16,		data[2] >> 16,		data[3] >> 16,
+						data[5] & 0xffff,	data[6] & 0xffff,	data[7] & 0xffff,
 						(float)(INT32)data[10] * (1.0f / 65536.0f),
 						(float)(INT32)data[11] * (1.0f / 65536.0f),
 						(float)(INT32)data[12] * (1.0f / (65536.0f * 512.0f)));
 				}
 
-				zeus_matrix[0][0] = data[3];
-				zeus_matrix[0][1] = data[3] >> 16;
-				zeus_matrix[0][2] = data[7];
-				zeus_matrix[1][0] = data[5];
-				zeus_matrix[1][1] = data[6];
-				zeus_matrix[1][2] = data[2] >> 16;
-				zeus_matrix[2][0] = data[1];
-				zeus_matrix[2][1] = data[1] >> 16;
-				zeus_matrix[2][2] = data[2];
-
-				zeus_matrix2[0][0] = data[4];
-				zeus_matrix2[0][1] = data[4] >> 16;
-				zeus_matrix2[0][2] = data[5] >> 16;
-				zeus_matrix2[1][0] = data[8];
-				zeus_matrix2[1][1] = data[8] >> 16;
-				zeus_matrix2[1][2] = data[6] >> 16;
-				zeus_matrix2[2][0] = data[9];
-				zeus_matrix2[2][1] = data[9] >> 16;
-				zeus_matrix2[2][2] = data[7] >> 16;
-				zeus_usematrix2 = TRUE;
+				/* extract the first matrix from the raw data */
+				matrix1[0][0] = data[4];		matrix1[0][1] = data[4] >> 16;	matrix1[0][2] = data[5] >> 16;
+				matrix1[1][0] = data[8];		matrix1[1][1] = data[8] >> 16;	matrix1[1][2] = data[6] >> 16;
+				matrix1[2][0] = data[9];		matrix1[2][1] = data[9] >> 16;	matrix1[2][2] = data[7] >> 16;
+
+				/* extract the second matrix from the raw data */
+				matrix2[0][0] = data[1];		matrix2[0][1] = data[2];		matrix2[0][2] = data[3];
+				matrix2[1][0] = data[1] >> 16;	matrix2[1][1] = data[2] >> 16;	matrix2[1][2] = data[3] >> 16;
+				matrix2[2][0] = data[5];		matrix2[2][1] = data[6];		matrix2[2][2] = data[7];
+
+				/* multiply them together to get the final matrix */
+				zeus_matrix[0][0] = ((INT64)(matrix1[0][0] * matrix2[0][0]) + (INT64)(matrix1[0][1] * matrix2[1][0]) + (INT64)(matrix1[0][2] * matrix2[2][0])) >> 16;
+				zeus_matrix[0][1] = ((INT64)(matrix1[0][0] * matrix2[0][1]) + (INT64)(matrix1[0][1] * matrix2[1][1]) + (INT64)(matrix1[0][2] * matrix2[2][1])) >> 16;
+				zeus_matrix[0][2] = ((INT64)(matrix1[0][0] * matrix2[0][2]) + (INT64)(matrix1[0][1] * matrix2[1][2]) + (INT64)(matrix1[0][2] * matrix2[2][2])) >> 16;
+				zeus_matrix[1][0] = ((INT64)(matrix1[1][0] * matrix2[0][0]) + (INT64)(matrix1[1][1] * matrix2[1][0]) + (INT64)(matrix1[1][2] * matrix2[2][0])) >> 16;
+				zeus_matrix[1][1] = ((INT64)(matrix1[1][0] * matrix2[0][1]) + (INT64)(matrix1[1][1] * matrix2[1][1]) + (INT64)(matrix1[1][2] * matrix2[2][1])) >> 16;
+				zeus_matrix[1][2] = ((INT64)(matrix1[1][0] * matrix2[0][2]) + (INT64)(matrix1[1][1] * matrix2[1][2]) + (INT64)(matrix1[1][2] * matrix2[2][2])) >> 16;
+				zeus_matrix[2][0] = ((INT64)(matrix1[2][0] * matrix2[0][0]) + (INT64)(matrix1[2][1] * matrix2[1][0]) + (INT64)(matrix1[2][2] * matrix2[2][0])) >> 16;
+				zeus_matrix[2][1] = ((INT64)(matrix1[2][0] * matrix2[0][1]) + (INT64)(matrix1[2][1] * matrix2[1][1]) + (INT64)(matrix1[2][2] * matrix2[2][1])) >> 16;
+				zeus_matrix[2][2] = ((INT64)(matrix1[2][0] * matrix2[0][2]) + (INT64)(matrix1[2][1] * matrix2[1][2]) + (INT64)(matrix1[2][2] * matrix2[2][2])) >> 16;
 
+				/* extract the translation point from the raw data */
 				zeus_point[0] = data[10];
 				zeus_point[1] = data[11];
 				zeus_point[2] = data[12];
@@ -907,7 +852,7 @@
 			break;
 
 		/* 0x23: some additional X,Y,Z coordinates */
-		/* 0x2e: save for invasn */
+		/* 0x2e: same for invasn */
 		case 0x23:
 		case 0x2e:
 			if (numwords < 2)
@@ -916,6 +861,11 @@
 			{
 				log_fifo_command(data, numwords, "");
 				logerror(" -- additional xyz = %d,%d,%d\n", (INT16)data[0], (INT16)(data[1] >> 16), (INT16)data[1]);
+
+				/* guessing this might be a light source? */
+				zeus_light[0] = (INT16)data[0];
+				zeus_light[1] = (INT16)(data[1] >> 16);
+				zeus_light[2] = (INT16)data[1];
 			}
 			break;
 
@@ -983,21 +933,22 @@
 
 	while (zeus_objdata != 0 && !model_done)
 	{
-		const UINT64 *data = waveram_ptr_from_block_addr(0, zeus_objdata);
-		int count = (zeus_objdata >> 24) + 1;
+		const void *base = waveram_ptr_from_block_addr(0, zeus_objdata);
+		int count = zeus_objdata >> 24;
+		int curoffs;
 
 		/* reset the objdata address */
 		zeus_objdata = 0;
 
 		/* loop until we run out of data */
-		while (count--)
+		for (curoffs = 0; curoffs <= count; curoffs++)
 		{
 			int countneeded;
 			UINT8 cmd;
 
 			/* accumulate 2 words of data */
-			databuffer[databufcount++] = *data;
-			databuffer[databufcount++] = *data++ >> 32;
+			databuffer[databufcount++] = WAVERAM_READ32(base, curoffs * 2 + 0);
+			databuffer[databufcount++] = WAVERAM_READ32(base, curoffs * 2 + 1);
 
 			/* if this is enough, process the command */
 			cmd = databuffer[0] >> 24;
@@ -1076,31 +1027,62 @@
 	poly_vertex clipvert[8];
 	poly_vertex vert[4];
 	float uscale, vscale;
+	float maxy, maxx;
 	int val1, val2, texwshift;
 	int numverts;
 	int i;
+	INT16 normal[3];
+	INT32 rotnormal[3];
+
+/* look for interesting data patterns  */
+if (
+	(databuffer[1] & 0xffffffff) != 0x200c0000 && /* mk4 sometimes */
+	(databuffer[1] & 0xfffe0000) != 0x21000000 && /* most of mk4 */
+	(databuffer[1] & 0xffffffff) != 0x008c0000 && /* invasn */
+	(databuffer[1] & 0xfffeffff) != 0x028c0000 && /* invasn */
+	(databuffer[1] & 0xfffe0000) != 0x21800000 && /* invasn */
+	(databuffer[1] & 0xfffe0000) != 0x23800000 && /* invasn */
+	1)
+	printf("zeus_draw_quad: databuffer[1] = %08X\n", databuffer[1]);
+
+
+	/* do a simple backface cull; not sure if the hardware does it, but I see no other
+       reason for a polygon normal here */
+
+	/* extract the polygon normal */
+	normal[0] = (INT8)(databuffer[0] >> 0);
+	normal[1] = (INT8)(databuffer[0] >> 8);
+	normal[2] = (INT8)(databuffer[0] >> 16);
 
-/*
-int testbit = 0;
+	/* rotate the normal into camera view; we only need the Z coordinate */
+	rotnormal[2] = normal[0] * zeus_matrix[2][0] + normal[1] * zeus_matrix[2][1] + normal[2] * zeus_matrix[2][2];
 
-if (input_code_pressed(KEYCODE_Z)) testbit = 0x01;
-if (input_code_pressed(KEYCODE_X)) testbit = 0x02;
-if (input_code_pressed(KEYCODE_C)) testbit = 0x04;
-if (input_code_pressed(KEYCODE_V)) testbit = 0x08;
-if (input_code_pressed(KEYCODE_B)) testbit = 0x10;
-if (input_code_pressed(KEYCODE_N)) testbit = 0x20;
-if (input_code_pressed(KEYCODE_M)) testbit = 0x40;
-if (input_code_pressed(KEYCODE_COMMA)) testbit = 0x80;
-if (input_code_pressed(KEYCODE_STOP)) testbit = 0x100;
-*/
-	/* doesn't seem to matter if it is 0x21 or 0x23 */
-//  if ((databuffer[1] >> 24) == 0x21 || (databuffer[1] >> 24) == 0x23)
-		texdata = (texdata & 0xffff0000) | ((texdata + databuffer[1]) & 0xffff);
+	/* if we're pointing away from the camera, toss */
+	if (rotnormal[2] > 0)
+	{
+		if (logit)
+			logerror("quad (culled %08X)\n", rotnormal[2]);
+//      if (input_code_pressed(KEYCODE_COMMA))
+//          return;
+	}
+
+	if (logit)
+		logerror("quad\n");
+
+	texdata = (texdata & 0xffff0000) | ((texdata + databuffer[1]) & 0xffff);
 
 	val1 = ((texdata >> 10) & 0x3f0000) | (texdata & 0xffff);
 	val2 = (texdata >> 16) & 0x3ff;
 	texwshift = (val2 >> 6) & 7;
 
+//if (input_code_pressed(KEYCODE_Z) && (val2 & 0x01)) return;
+//if (input_code_pressed(KEYCODE_X) && (val2 & 0x02)) return;
+//if (input_code_pressed(KEYCODE_C) && (val2 & 0x04)) return;
+//if (input_code_pressed(KEYCODE_V) && (val2 & 0x08)) return;
+//if (input_code_pressed(KEYCODE_B) && (val2 & 0x10)) return;
+//if (input_code_pressed(KEYCODE_N) && (val2 & 0x20)) return;
+//if (input_code_pressed(KEYCODE_M) && (val2 & 0x200)) return;
+
 	uscale = (8 >> ((zeusbase[0x04] >> 4) & 3)) * 0.125f * 256.0f;
 	vscale = (8 >> ((zeusbase[0x04] >> 6) & 3)) * 0.125f * 256.0f;
 
@@ -1117,62 +1099,70 @@
 	{
 		UINT32 ixy = databuffer[2 + i*2];
 		UINT32 iuvz = databuffer[3 + i*2];
-		INT64 x = (INT16)ixy << 14;
-		INT64 y = (INT16)(ixy >> 16) << 14;
-		INT64 z = (INT16)iuvz << 14;
+		UINT32 inormal = databuffer[10 + i];
+		INT32 xo = (INT16)ixy;
+		INT32 yo = (INT16)(ixy >> 16);
+		INT32 zo = (INT16)iuvz;
+		INT32 xn = (INT32)(inormal <<  2) >> 20;
+		INT32 yn = (INT32)(inormal << 12) >> 20;
+		INT32 zn = (INT32)(inormal << 22) >> 20;
 		UINT8 u = iuvz >> 16;
 		UINT8 v = iuvz >> 24;
-		INT32 xo, yo, zo;
-/*
-        if (zeus_usematrix2)
-        {
-            xo = x >> 14;
-            yo = y >> 14;
-            zo = z >> 14;
-            x = (INT64)(xo * zeus_matrix2[0][0]) + (INT64)(yo * zeus_matrix2[0][1]) + (INT64)(zo * zeus_matrix2[0][2]);
-            y = (INT64)(xo * zeus_matrix2[1][0]) + (INT64)(yo * zeus_matrix2[1][1]) + (INT64)(zo * zeus_matrix2[1][2]);
-            z = (INT64)(xo * zeus_matrix2[2][0]) + (INT64)(yo * zeus_matrix2[2][1]) + (INT64)(zo * zeus_matrix2[2][2]);
-        }
-        */
-		xo = x >> 14;
-		yo = y >> 14;
-		zo = z >> 14;
-		x = (INT64)(xo * zeus_matrix[0][0]) + (INT64)(yo * zeus_matrix[0][1]) + (INT64)(zo * zeus_matrix[0][2]);
-		y = (INT64)(xo * zeus_matrix[1][0]) + (INT64)(yo * zeus_matrix[1][1]) + (INT64)(zo * zeus_matrix[1][2]);
-		z = (INT64)(xo * zeus_matrix[2][0]) + (INT64)(yo * zeus_matrix[2][1]) + (INT64)(zo * zeus_matrix[2][2]);
-
-		x += zeus_point[0];
-		y += zeus_point[1];
-		z += zeus_point[2];
+		INT32 dotnormal;
+		INT64 x, y, z;
+
+		x = (INT64)(xo * zeus_matrix[0][0]) + (INT64)(yo * zeus_matrix[0][1]) + (INT64)(zo * zeus_matrix[0][2]) + zeus_point[0];
+		y = (INT64)(xo * zeus_matrix[1][0]) + (INT64)(yo * zeus_matrix[1][1]) + (INT64)(zo * zeus_matrix[1][2]) + zeus_point[1];
+		z = (INT64)(xo * zeus_matrix[2][0]) + (INT64)(yo * zeus_matrix[2][1]) + (INT64)(zo * zeus_matrix[2][2]) + zeus_point[2];
+
+		rotnormal[0] = ((INT64)(xn * zeus_matrix[0][0]) + (INT64)(yn * zeus_matrix[0][1]) + (INT64)(zn * zeus_matrix[0][2])) >> 14;
+		rotnormal[1] = ((INT64)(xn * zeus_matrix[1][0]) + (INT64)(yn * zeus_matrix[1][1]) + (INT64)(zn * zeus_matrix[1][2])) >> 14;
+		rotnormal[2] = ((INT64)(xn * zeus_matrix[2][0]) + (INT64)(yn * zeus_matrix[2][1]) + (INT64)(zn * zeus_matrix[2][2])) >> 14;
+
+		dotnormal = rotnormal[0] * ((x >> 16) + zeus_light[0]) + rotnormal[1] * ((y >> 16) + zeus_light[1]) + rotnormal[2] * ((z >> 16) + zeus_light[2]);
 
 		vert[i].x = x;
 		vert[i].y = y;
 		vert[i].p[0] = z;
 		vert[i].p[1] = u * uscale;
 		vert[i].p[2] = v * vscale;
+		vert[i].p[3] = dotnormal;
 
 		if (logit)
 		{
-			if (i == 0) logerror("quad\n");
-			logerror("\t\t(%f,%f,%f) (%02X,%02X) (%03X,%03X,%03X)\n",
+			logerror("\t\t(%f,%f,%f) (%02X,%02X) (%03X,%03X,%03X) dot=%08X\n",
 					vert[i].x * (1.0f / 65536.0f), vert[i].y * (1.0f / 65536.0f), vert[i].p[0] * (1.0f / 65536.0f),
-					(int)vert[i].p[1], (int)vert[i].p[2],
-					(databuffer[10 + i] >> 20) & 0x3ff, (databuffer[10 + i] >> 10) & 0x3ff, (databuffer[10 + i] >> 0) & 0x3ff);
+					(int)(vert[i].p[1] / 256.0f), (int)(vert[i].p[2] / 256.0f),
+					(databuffer[10 + i] >> 20) & 0x3ff, (databuffer[10 + i] >> 10) & 0x3ff, (databuffer[10 + i] >> 0) & 0x3ff,
+					dotnormal);
 		}
 	}
 
-	numverts = poly_zclip_if_less(4, &vert[0], &clipvert[0], 3, 512.0f);
+	numverts = poly_zclip_if_less(4, &vert[0], &clipvert[0], 4, 512.0f);
 	if (numverts < 3)
 		return;
 
+	maxx = maxy = -1000.0f;
 	for (i = 0; i < numverts; i++)
 	{
 		float ooz = 512.0f / clipvert[i].p[0];
 
 		clipvert[i].x *= ooz;
 		clipvert[i].y *= ooz;
-		clipvert[i].x += 200.0f;
-		clipvert[i].y += 128.0f;
+		clipvert[i].x += 200.5f;
+		clipvert[i].y += 128.5f;
+
+		maxx = MAX(maxx, clipvert[i].x);
+		maxy = MAX(maxy, clipvert[i].y);
+		if (logit)
+			logerror("\t\t\tTranslated=(%f,%f)\n", clipvert[i].x, clipvert[i].y);
+	}
+	for (i = 0; i < numverts; i++)
+	{
+		if (clipvert[i].x == maxx)
+			clipvert[i].x += 0.0005f;
+		if (clipvert[i].y == maxy)
+			clipvert[i].y += 0.0005f;
 	}
 
 	extra = poly_get_extra_data(poly);
@@ -1184,20 +1174,7 @@
 	extra->texbase = waveram_ptr_from_texture_addr(0, val1, extra->texwidth);
 	extra->palbase = zeus_palbase;
 
-	if (single_step)
-	{
-		single_step_extra = *extra;
-		single_step_val1 = val1;
-		single_step_val2 = val2;
-		single_step_dx = single_step_dy = 0;
-		single_step_advance = FALSE;
-	}
-
-	poly_render_quad_fan(poly, NULL, &zeus_cliprect, callback, 3, numverts, &clipvert[0]);
-	poly_wait(poly, "Normal");
-
-	if (single_step)
-		while (!single_step_advance) video_frame_update(TRUE);
+	poly_render_quad_fan(poly, NULL, &zeus_cliprect, callback, 4, numverts, &clipvert[0]);
 }
 
 
@@ -1214,19 +1191,20 @@
 	INT32 curz = extent->param[0].start;
 	INT32 curu = extent->param[1].start;
 	INT32 curv = extent->param[2].start;
+	INT32 curi = extent->param[3].start;
 	INT32 dzdx = extent->param[0].dpdx;
 	INT32 dudx = extent->param[1].dpdx;
 	INT32 dvdx = extent->param[2].dpdx;
-	const UINT64 *texbase = extra->texbase;
-	const UINT64 *palbase = extra->palbase;
+	INT32 didx = extent->param[3].dpdx;
+	const void *texbase = extra->texbase;
+	const void *palbase = extra->palbase;
 	UINT16 transcolor = extra->transcolor;
 	int texwidth = extra->texwidth;
 	int x;
 
 	for (x = extent->startx; x < extent->stopx; x++)
 	{
-		UINT16 *depthptr;
-		UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, scanline, x, &depthptr);
+		UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, scanline, x);
 		INT32 depth = (curz >> 16) + extra->zoffset;
 		if (depth > 0x7fff) depth = 0x7fff;
 		if (depth >= 0 && depth <= *depthptr)
@@ -1241,17 +1219,17 @@
 			UINT8 texel3 = get_texel_4bit(texbase, v1, u1, texwidth);
 			if (texel0 != transcolor)
 			{
-				rgb_t color0 = get_palette_entry(palbase, texel0);
-				rgb_t color1 = get_palette_entry(palbase, texel1);
-				rgb_t color2 = get_palette_entry(palbase, texel2);
-				rgb_t color3 = get_palette_entry(palbase, texel3);
+				rgb_t color0 = WAVERAM_READ16(palbase, texel0);
+				rgb_t color1 = WAVERAM_READ16(palbase, texel1);
+				rgb_t color2 = WAVERAM_READ16(palbase, texel2);
+				rgb_t color3 = WAVERAM_READ16(palbase, texel3);
 				rgb_t filtered;
 				color0 = ((color0 & 0x7fe0) << 6) | (color0 & 0x1f);
 				color1 = ((color1 & 0x7fe0) << 6) | (color1 & 0x1f);
 				color2 = ((color2 & 0x7fe0) << 6) | (color2 & 0x1f);
 				color3 = ((color3 & 0x7fe0) << 6) | (color3 & 0x1f);
 				filtered = rgb_bilinear_filter(color0, color1, color2, color3, curu, curv);
-				*ptr = ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f);
+				WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f));
 				*depthptr = depth;
 			}
 		}
@@ -1259,6 +1237,7 @@
 		curz += dzdx;
 		curu += dudx;
 		curv += dvdx;
+		curi += didx;
 	}
 }
 
@@ -1269,19 +1248,20 @@
 	INT32 curz = extent->param[0].start;
 	INT32 curu = extent->param[1].start;
 	INT32 curv = extent->param[2].start;
+	INT32 curi = extent->param[3].start;
 	INT32 dzdx = extent->param[0].dpdx;
 	INT32 dudx = extent->param[1].dpdx;
 	INT32 dvdx = extent->param[2].dpdx;
-	const UINT64 *texbase = extra->texbase;
-	const UINT64 *palbase = extra->palbase;
+	INT32 didx = extent->param[3].dpdx;
+	const void *texbase = extra->texbase;
+	const void *palbase = extra->palbase;
 	UINT16 transcolor = extra->transcolor;
 	int texwidth = extra->texwidth;
 	int x;
 
 	for (x = extent->startx; x < extent->stopx; x++)
 	{
-		UINT16 *depthptr;
-		UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, scanline, x, &depthptr);
+		UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, scanline, x);
 		INT32 depth = (curz >> 16) + extra->zoffset;
 		if (depth > 0x7fff) depth = 0x7fff;
 		if (depth >= 0 && depth <= *depthptr)
@@ -1296,17 +1276,17 @@
 			UINT8 texel3 = get_texel_8bit(texbase, v1, u1, texwidth);
 			if (texel0 != transcolor)
 			{
-				rgb_t color0 = get_palette_entry(palbase, texel0);
-				rgb_t color1 = get_palette_entry(palbase, texel1);
-				rgb_t color2 = get_palette_entry(palbase, texel2);
-				rgb_t color3 = get_palette_entry(palbase, texel3);
+				rgb_t color0 = WAVERAM_READ16(palbase, texel0);
+				rgb_t color1 = WAVERAM_READ16(palbase, texel1);
+				rgb_t color2 = WAVERAM_READ16(palbase, texel2);
+				rgb_t color3 = WAVERAM_READ16(palbase, texel3);
 				rgb_t filtered;
 				color0 = ((color0 & 0x7fe0) << 6) | (color0 & 0x1f);
 				color1 = ((color1 & 0x7fe0) << 6) | (color1 & 0x1f);
 				color2 = ((color2 & 0x7fe0) << 6) | (color2 & 0x1f);
 				color3 = ((color3 & 0x7fe0) << 6) | (color3 & 0x1f);
 				filtered = rgb_bilinear_filter(color0, color1, color2, color3, curu, curv);
-				*ptr = ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f);
+				WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f));
 				*depthptr = depth;
 			}
 		}
@@ -1314,6 +1294,7 @@
 		curz += dzdx;
 		curu += dudx;
 		curv += dvdx;
+		curi += didx;
 	}
 }
 
@@ -1329,7 +1310,7 @@
 		{
 			if (extra->alpha <= 0x80)
 			{
-				UINT16 *ptr = waveram_pixel_ptr(zeus_renderbase, scanline, x, NULL);
+				UINT16 *ptr = WAVERAM_PTRPIX(zeus_renderbase, scanline, x);
 				UINT16 pix = *ptr;
 
 				*ptr = ((((pix & 0x7c00) * extra->alpha) >> 7) & 0x7c00) |
@@ -1350,7 +1331,9 @@
 	const poly_extra_data *extra = extradata;
 	UINT16 color = extra->solidcolor;
 	INT32 curz = (INT32)(extent->param[0].start);
+	INT32 curv = extent->param[2].start;
 	INT32 dzdx = (INT32)(extent->param[0].dpdx);
+	INT32 dvdx = extent->param[2].dpdx;
 	int x;
 
 	for (x = extent->startx; x < extent->stopx; x++)
@@ -1358,8 +1341,13 @@
 		INT32 depth = (curz >> 16) + extra->zoffset;
 		if (depth > 0x7fff) depth = 0x7fff;
 		if (depth >= 0)
+		{
+//          UINT32 finalcolor = (((color & 0x7c00) * curv) & 0x7c000000) | (((color & 0x03e0) * curv) & 0x03e00000) | (((color & 0x001f) * curv) & 0x001f0000);
+//          waveram_plot_check_depth(scanline, x, finalcolor >> 16, depth);
 			waveram_plot_check_depth(scanline, x, color, depth);
+		}
 		curz += dzdx;
+		curv += dvdx;
 	}
 }
 
@@ -1399,17 +1387,17 @@
 	static struct
 	{
 		UINT32 lab;
-		UINT64 checksum;
+		UINT32 checksum;
 	} recent_entries[100];
 
 	UINT32 numoctets = (length_and_base >> 24) + 1;
-	const UINT64 *ptr = waveram_ptr_from_block_addr(0, length_and_base);
+	const UINT32 *ptr = waveram_ptr_from_block_addr(0, length_and_base);
 	UINT64 checksum = length_and_base;
 	int foundit = FALSE;
 	int i;
 
 	for (i = 0; i < numoctets; i++)
-		checksum += ptr[i];
+		checksum += ptr[i*2] + ptr[i*2+1];
 
 	for (i = 0; i < ARRAY_LENGTH(recent_entries); i++)
 		if (recent_entries[i].lab == length_and_base && recent_entries[i].checksum == checksum)
@@ -1430,5 +1418,5 @@
 		return;
 
 	for (i = 0; i < numoctets; i++)
-		logerror("\t%02X: %08X %08X\n", i, (UINT32)ptr[i], (UINT32)(ptr[i] >> 32));
+		logerror("\t%02X: %08X %08X\n", i, ptr[i*2], ptr[i*2+1]);
 }
diff -Nru src-old/mame/video/midzeus2.c src/mame/video/midzeus2.c
--- src-old/mame/video/midzeus2.c	1969-12-31 16:00:00.000000000 -0800
+++ src/mame/video/midzeus2.c	2007-12-23 20:03:00.000000000 -0800
@@ -0,0 +1,657 @@
+/*************************************************************************
+
+    Driver for Midway Zeus games
+
+**************************************************************************/
+
+#include "driver.h"
+#include "eminline.h"
+#include "includes/midzeus.h"
+#include "video/poly.h"
+#include "video/rgbutil.h"
+
+
+
+/*************************************
+ *
+ *  Constants
+ *
+ *************************************/
+
+#define DUMP_WAVE_RAM	0
+
+#define WAVERAM_WIDTH	1024
+#define WAVERAM_HEIGHT	2048
+
+
+
+/*************************************
+ *
+ *  Type definitions
+ *
+ *************************************/
+
+typedef struct _poly_extra_data poly_extra_data;
+struct _poly_extra_data
+{
+	const void *	palbase;
+	const void *	texbase;
+	UINT16			solidcolor;
+	INT16			zoffset;
+	UINT16			transcolor;
+	UINT16			texwidth;
+	UINT16			color;
+	UINT32			alpha;
+};
+
+
+
+/*************************************
+ *
+ *  Global variables
+ *
+ *************************************/
+
+extern UINT32 *zeusbase;
+
+static poly_manager *poly;
+static UINT8 log_fifo;
+
+static UINT32 zeus_fifo[20];
+static UINT8 zeus_fifo_words;
+static void *zeus_renderbase;
+static rectangle zeus_cliprect;
+
+static void *waveram[2];
+
+static UINT32 max_waveram[2][2];
+
+
+/*************************************
+ *
+ *  Function prototypes
+ *
+ *************************************/
+
+static void exit_handler(running_machine *machine);
+
+static void zeus_register32_w(offs_t offset, UINT32 data, int logit);
+static void zeus_register_update(offs_t offset, UINT32 oldval, int logit);
+static int zeus_fifo_process(const UINT32 *data, int numwords);
+
+static void log_fifo_command(const UINT32 *data, int numwords, const char *suffix);
+
+
+
+/*************************************
+ *
+ *  Macros
+ *
+ *************************************/
+
+#define WAVERAM_BLOCK(bank, blocknum)			((void *)((UINT8 *)waveram[bank] + 16 * (blocknum)))
+
+#define WAVERAM_PTR8(base, bytenum)				((UINT8 *)(base) + BYTE4_XOR_LE(bytenum))
+#define WAVERAM_READ8(base, bytenum)			(*WAVERAM_PTR8(base, bytenum))
+#define WAVERAM_WRITE8(base, bytenum, data)		do { *WAVERAM_PTR8(base, bytenum) = (data); } while (0)
+
+#define WAVERAM_PTR16(base, wordnum)			((UINT16 *)(base) + BYTE_XOR_LE(wordnum))
+#define WAVERAM_READ16(base, wordnum)			(*WAVERAM_PTR16(base, wordnum))
+#define WAVERAM_WRITE16(base, wordnum, data)	do { *WAVERAM_PTR16(base, wordnum) = (data); } while (0)
+
+#define WAVERAM_PTR32(base, dwordnum)			((UINT32 *)(base) + (dwordnum))
+#define WAVERAM_READ32(base, dwordnum)			(*WAVERAM_PTR32(base, dwordnum))
+#define WAVERAM_WRITE32(base, dwordnum, data)	do { *WAVERAM_PTR32(base, dwordnum) = (data); } while (0)
+
+#define PIXYX_TO_DWORDNUM(y, x)					((((y) & 0x1fe) << 11) | (((y) & 1) << 10) | (((x) & 0x1fe) << 1) | ((x) & 1))
+#define DEPTHYX_TO_DWORDNUM(y, x)				(PIXYX_TO_DWORDNUM(y, x) | 2)
+
+#define WAVERAM_PTRPIX(base, y, x)				WAVERAM_PTR32(base, PIXYX_TO_DWORDNUM(y, x))
+#define WAVERAM_READPIX(base, y, x)				(*WAVERAM_PTRPIX(base, y, x))
+#define WAVERAM_WRITEPIX(base, y, x, color)		do { *WAVERAM_PTRPIX(base, y, x) = (color);  } while (0)
+
+#define WAVERAM_PTRDEPTH(base, y, x)			WAVERAM_PTR16(base, DEPTHYX_TO_DWORDNUM(y, x & ~1) * 2 + (x & 1))
+#define WAVERAM_READDEPTH(base, y, x)			(*WAVERAM_PTRDEPTH(base, y, x))
+#define WAVERAM_WRITEDEPTH(base, y, x, color)	do { *WAVERAM_PTRDEPTH(base, y, x) = (color);  } while (0)
+
+
+
+/*************************************
+ *
+ *  Inlines for block addressing
+ *
+ *************************************/
+
+INLINE void *waveram_ptr_from_block_addr(UINT8 bank, UINT32 addr)
+{
+	UINT32 blocknum = (addr % WAVERAM_WIDTH) + ((addr >> 12) % WAVERAM_HEIGHT) * WAVERAM_WIDTH;
+	return WAVERAM_BLOCK(bank, blocknum);
+}
+
+INLINE void *waveram_ptr_from_expanded_addr(UINT8 bank, UINT32 addr)
+{
+	UINT32 blocknum = (addr % WAVERAM_WIDTH) + ((addr >> 16) % WAVERAM_HEIGHT) * WAVERAM_WIDTH;
+	return WAVERAM_BLOCK(bank, blocknum);
+}
+
+INLINE void *waveram_ptr_from_texture_addr(UINT8 bank, UINT32 addr, int width)
+{
+	UINT32 blocknum = ((addr & ~1) * width) / 8;
+	return WAVERAM_BLOCK(bank, blocknum);
+}
+
+
+
+/*************************************
+ *
+ *  Inlines for rendering
+ *
+ *************************************/
+
+INLINE void waveram_plot(int y, int x, UINT32 color)
+{
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+		WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
+}
+
+INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth)
+{
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+	{
+		WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
+		WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth);
+	}
+}
+
+INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth)
+{
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+	{
+		UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
+		if (depth <= *depthptr)
+		{
+			WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
+			*depthptr = depth;
+		}
+	}
+}
+
+INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT32 color, UINT16 depth)
+{
+	if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+	{
+		UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
+		if (depth <= *depthptr)
+			WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
+	}
+}
+
+
+
+/*************************************
+ *
+ *  Inlines for texel accesses
+ *
+ *************************************/
+
+INLINE UINT8 get_texel_8bit(const void *base, int y, int x, int width)
+{
+	UINT32 byteoffs = (y / 2) * (width * 2) + ((x / 4) << 3) + ((y & 1) << 2) + (x & 3);
+	return WAVERAM_READ8(base, byteoffs);
+}
+
+
+INLINE UINT8 get_texel_4bit(const void *base, int y, int x, int width)
+{
+	UINT32 byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3);
+	return (WAVERAM_READ8(base, byteoffs) >> (4 * (x & 1))) & 0x0f;
+}
+
+
+
+/*************************************
+ *
+ *  Video startup
+ *
+ *************************************/
+
+VIDEO_START( midzeus2 )
+{
+	/* allocate memory for "wave" RAM */
+	waveram[0] = auto_malloc(WAVERAM_WIDTH * WAVERAM_HEIGHT * 16);
+	waveram[1] = auto_malloc(WAVERAM_WIDTH * WAVERAM_HEIGHT * 16);
+	state_save_register_global_pointer(((UINT32 *)waveram[0]), WAVERAM_WIDTH * WAVERAM_HEIGHT * 16/4);
+	state_save_register_global_pointer(((UINT32 *)waveram[1]), WAVERAM_WIDTH * WAVERAM_HEIGHT * 16/4);
+
+	/* initialize polygon engine */
+	poly = poly_alloc(10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
+
+	/* we need to cleanup on exit */
+	add_exit_callback(machine, exit_handler);
+
+	zeus_renderbase = waveram[1];
+}
+
+
+static void exit_handler(running_machine *machine)
+{
+#if DUMP_WAVE_RAM
+	FILE *f = fopen("waveram.dmp", "w");
+	int bank;
+	int i;
+
+	for (bank = 0; bank < 2; bank++)
+		for (i = 0; i < WAVERAM_WIDTH * WAVERAM_HEIGHT; i++)
+		{
+			if (i % 4 == 0) fprintf(f, "%03X%03X: ", i / WAVERAM_WIDTH, i % WAVERAM_WIDTH);
+			fprintf(f, " %08X %08X ", (UINT32)(waveram[bank][i] >> 32), (UINT32)waveram[bank][i]);
+			if (i % 4 == 3) fprintf(f, "\n");
+		}
+	fclose(f);
+#endif
+
+	poly_free(poly);
+
+printf("max[0] = %X, %X\n", max_waveram[0][0], max_waveram[0][1]);
+printf("max[1] = %X, %X\n", max_waveram[1][0], max_waveram[1][1]);
+}
+
+
+
+/*************************************
+ *
+ *  Video update
+ *
+ *************************************/
+
+VIDEO_UPDATE( midzeus2 )
+{
+	int x, y;
+
+	poly_wait(poly, "VIDEO_UPDATE");
+
+	/* normal update case */
+	if (!input_code_pressed(KEYCODE_W))
+	{
+		const void *base = waveram_ptr_from_expanded_addr(1, 0);//zeusbase[0xcc]);
+		int xoffs = machine->screen[screen].visarea.min_x;
+		for (y = cliprect->min_y; y <= cliprect->max_y; y++)
+		{
+			UINT32 *dest = (UINT32 *)bitmap->base + y * bitmap->rowpixels;
+			for (x = cliprect->min_x; x <= cliprect->max_x; x++)
+				dest[x] = WAVERAM_READPIX(base, y, x - xoffs);
+		}
+	}
+
+	/* waveram drawing case */
+	else
+	{
+		static int yoffs = 0;
+		static int width = 256;
+		const UINT64 *base;
+
+		if (input_code_pressed(KEYCODE_DOWN)) yoffs += input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
+		if (input_code_pressed(KEYCODE_UP)) yoffs -= input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1;
+		if (input_code_pressed(KEYCODE_LEFT) && width > 4) { width >>= 1; while (input_code_pressed(KEYCODE_LEFT)) ; }
+		if (input_code_pressed(KEYCODE_RIGHT) && width < 512) { width <<= 1; while (input_code_pressed(KEYCODE_RIGHT)) ; }
+
+		if (yoffs < 0) yoffs = 0;
+		base = waveram_ptr_from_block_addr(0, yoffs << 12);
+
+		for (y = cliprect->min_y; y <= cliprect->max_y; y++)
+		{
+			UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels;
+			for (x = cliprect->min_x; x <= cliprect->max_x; x++)
+			{
+				UINT8 tex = get_texel_8bit(base, y, x, width);
+				dest[x] = (tex << 8) | tex;
+			}
+		}
+		popmessage("offs = %06X", yoffs << 12);
+	}
+
+	return 0;
+}
+
+
+
+/*************************************
+ *
+ *  Core read handler
+ *
+ *************************************/
+
+READ32_HANDLER( zeus2_r )
+{
+	int logit = (offset != 0x00 && offset != 0x01 && offset != 0x54 && offset != 0x48 && offset != 0x49 && offset != 0x58 && offset != 0x59 && offset != 0x5a);
+	UINT32 result = zeusbase[offset];
+
+	if (logit)
+		logerror("%06X:zeus2_r(%02X)\n", activecpu_get_pc(), offset);
+
+	switch (offset)
+	{
+		case 0x00:
+			result = 0x20;
+			break;
+
+		case 0x01:
+			/* bit  $000C0070 are tested in a loop until 0 */
+			/* bits $00080000 is tested in a loop until 0 */
+			/* bit  $00000004 is tested for toggling; probably VBLANK */
+			result = 0x00;
+			if (video_screen_get_vblank(0))
+				result |= 0x04;
+			break;
+
+		case 0x07:
+			/* this is needed to pass the self-test in thegrid */
+			result = 0x10451998;
+			break;
+
+		case 0x54:
+			/* lower 16 bits are masked when read -- is that the hpos? */
+			result = video_screen_get_vpos(0) << 16;
+			break;
+	}
+
+	return result;
+}
+
+
+
+/*************************************
+ *
+ *  Core write handler
+ *
+ *************************************/
+
+WRITE32_HANDLER( zeus2_w )
+{
+	int logit = (offset != 0x40 && offset != 0x41 && offset != 0x48 && offset != 0x49 && offset != 0x4e &&
+				 offset != 0x50 && offset != 0x51 && offset != 0x57 && offset != 0x58 && offset != 0x59 && offset != 0x5a && offset != 0x5e);
+	if (logit)
+		logerror("%06X:zeus2_w", activecpu_get_pc());
+	zeus_register32_w(offset, data, logit);
+}
+
+
+
+/*************************************
+ *
+ *  Handle register writes
+ *
+ *************************************/
+
+static void zeus_register32_w(offs_t offset, UINT32 data, int logit)
+{
+	UINT32 oldval = zeusbase[offset];
+
+	/* writes to register $CC need to force a partial update */
+//  if ((offset & ~1) == 0xcc)
+//      video_screen_update_partial(0, video_screen_get_vpos(0));
+
+	/* always write to low word? */
+	zeusbase[offset] = data;
+
+	/* log appropriately */
+	if (logit)
+		logerror("(%02X) = %08X\n", offset, data);
+
+	/* handle the update */
+	zeus_register_update(offset, oldval, logit);
+}
+
+
+
+/*************************************
+ *
+ *  Update state after a register write
+ *
+ *************************************/
+
+static void zeus_register_update(offs_t offset, UINT32 oldval, int logit)
+{
+	/* handle the writes; only trigger on low accesses */
+	switch (offset)
+	{
+		case 0x08:
+			zeus_fifo[zeus_fifo_words++] = zeusbase[0x08];
+			if (zeus_fifo_process(zeus_fifo, zeus_fifo_words))
+				zeus_fifo_words = 0;
+			break;
+
+		case 0x20:
+			/* toggles between two values based on the page:
+
+                Page #      zeusbase[0x20]      zeusbase[0x38]
+                ------      --------------      --------------
+                   0          $04000190           $00000000
+                   1          $04000000           $01900000
+            */
+			break;
+
+		case 0x33:
+		case 0x34:
+		case 0x35:
+		case 0x36:
+		case 0x37:
+			video_screen_update_partial(0, video_screen_get_vpos(0));
+			{
+				int vtotal = zeusbase[0x37] & 0xffff;
+				int htotal = zeusbase[0x34] >> 16;
+				rectangle visarea;
+
+				visarea.min_x = zeusbase[0x33] >> 16;
+				visarea.max_x = (zeusbase[0x34] & 0xffff) - 1;
+				visarea.min_y = 0;
+				visarea.max_y = zeusbase[0x35] & 0xffff;
+				if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal)
+				{
+					video_screen_configure(0, htotal, vtotal, &visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal)));
+					zeus_cliprect = visarea;
+					zeus_cliprect.max_x -= zeus_cliprect.min_x;
+					zeus_cliprect.min_x = 0;
+				}
+			}
+			break;
+
+		case 0x38:
+			{
+				UINT32 temp = zeusbase[0x38];
+				zeusbase[0x38] = oldval;
+				video_screen_update_partial(0, video_screen_get_vpos(0));
+				zeusbase[0x38] = temp;
+			}
+			break;
+
+		case 0x41:
+			/* this is the address, except in read mode, where it latches values */
+			if (zeusbase[0x4e] & 0x10)
+			{
+				const void *src = waveram_ptr_from_expanded_addr(0, oldval);
+				zeusbase[0x41] = oldval;
+				zeusbase[0x48] = WAVERAM_READ32(src, 0);
+				zeusbase[0x49] = WAVERAM_READ32(src, 1);
+
+				if (zeusbase[0x4e] & 0x40)
+				{
+					zeusbase[0x41]++;
+					zeusbase[0x41] += (zeusbase[0x41] & 0x400) << 6;
+					zeusbase[0x41] &= ~0xfc00;
+				}
+			}
+			break;
+
+		case 0x48:
+		case 0x49:
+			/* if we're in write mode, process it */
+			if (zeusbase[0x40] == 0x00890000)
+			{
+				/*
+                    zeusbase[0x4e]:
+                        bit 0-1: which register triggers write through
+                        bit 3:   enable write through via these registers
+                        bit 4:   seems to be set during reads, when 0x41 is used for latching
+                        bit 6:   enable autoincrement on write through
+                */
+				if ((zeusbase[0x4e] & 0x08) && (offset & 3) == (zeusbase[0x4e] & 3))
+				{
+					void *dest = waveram_ptr_from_expanded_addr(0, zeusbase[0x41]);
+					WAVERAM_WRITE32(dest, 0, zeusbase[0x48]);
+					WAVERAM_WRITE32(dest, 1, zeusbase[0x49]);
+			max_waveram[0][0] = MAX(max_waveram[0][0], zeusbase[0x41] & 0xffff);
+			max_waveram[0][1] = MAX(max_waveram[0][1], zeusbase[0x41] >> 16);
+
+					if (zeusbase[0x4e] & 0x40)
+					{
+						zeusbase[0x41]++;
+						zeusbase[0x41] += (zeusbase[0x41] & 0x400) << 6;
+						zeusbase[0x41] &= ~0xfc00;
+					}
+				}
+			}
+
+			/* make sure we log anything else */
+			else if (logit)
+				logerror("\t[40]=%08X [4E]=%08X\n", zeusbase[0x40], zeusbase[0x4e]);
+			break;
+
+		case 0x51:
+
+			/* in this mode, crusnexo expects the reads to immediately latch */
+			if (zeusbase[0x50] == 0x00a20000)
+				oldval = zeusbase[0x51];
+
+			/* this is the address, except in read mode, where it latches values */
+			if ((zeusbase[0x5e] & 0x10) || (zeusbase[0x50] == 0x00a20000))
+			{
+				const void *src = waveram_ptr_from_expanded_addr(1, oldval);
+				zeusbase[0x51] = oldval;
+				zeusbase[0x58] = WAVERAM_READ32(src, 0);
+				zeusbase[0x59] = WAVERAM_READ32(src, 1);
+				zeusbase[0x5a] = WAVERAM_READ32(src, 2);
+
+				if (zeusbase[0x5e] & 0x40)
+				{
+					zeusbase[0x51]++;
+					zeusbase[0x51] += (zeusbase[0x51] & 0x200) << 7;
+					zeusbase[0x51] &= ~0xfe00;
+				}
+			}
+			break;
+
+		case 0x57:
+			/* thegrid uses this to write either left or right halves of pixels */
+			if (zeusbase[0x50] == 0x00e90000)
+			{
+				void *dest = waveram_ptr_from_expanded_addr(1, zeusbase[0x51]);
+				if (zeusbase[0x57] & 1)
+					WAVERAM_WRITE32(dest, 0, zeusbase[0x58]);
+				if (zeusbase[0x57] & 4)
+					WAVERAM_WRITE32(dest, 1, zeusbase[0x59]);
+			max_waveram[1][0] = MAX(max_waveram[1][0], zeusbase[0x51] & 0xffff);
+			max_waveram[1][1] = MAX(max_waveram[1][1], zeusbase[0x51] >> 16);
+			}
+
+			/* make sure we log anything else */
+			else if (logit)
+				logerror("\t[50]=%08X [5E]=%08X\n", zeusbase[0x50], zeusbase[0x5e]);
+			break;
+
+		case 0x58:
+		case 0x59:
+		case 0x5a:
+			/* if we're in write mode, process it */
+			if (zeusbase[0x50] == 0x00890000)
+			{
+				/*
+                    zeusbase[0x5e]:
+                        bit 0-1: which register triggers write through
+                        bit 3:   enable write through via these registers
+                        bit 4:   seems to be set during reads, when 0x51 is used for latching
+                        bit 5:   unknown, currently used to specify ordering, but this is suspect
+                        bit 6:   enable autoincrement on write through
+                */
+				if ((zeusbase[0x5e] & 0x08) && (offset & 3) == (zeusbase[0x5e] & 3))
+				{
+					void *dest = waveram_ptr_from_expanded_addr(1, zeusbase[0x51]);
+					WAVERAM_WRITE32(dest, 0, zeusbase[0x58]);
+					if (zeusbase[0x5e] & 0x20)
+						WAVERAM_WRITE32(dest, 1, zeusbase[0x5a]);
+					else
+					{
+						WAVERAM_WRITE32(dest, 1, zeusbase[0x59]);
+						WAVERAM_WRITE32(dest, 2, zeusbase[0x5a]);
+					}
+			max_waveram[1][0] = MAX(max_waveram[1][0], zeusbase[0x51] & 0xffff);
+			max_waveram[1][1] = MAX(max_waveram[1][1], zeusbase[0x51] >> 16);
+
+					if (zeusbase[0x5e] & 0x40)
+					{
+						zeusbase[0x51]++;
+						zeusbase[0x51] += (zeusbase[0x51] & 0x200) << 7;
+						zeusbase[0x51] &= ~0xfe00;
+					}
+				}
+			}
+
+			/* make sure we log anything else */
+			else if (logit)
+				logerror("\t[50]=%08X [5E]=%08X\n", zeusbase[0x50], zeusbase[0x5e]);
+			break;
+	}
+}
+
+
+
+/*************************************
+ *
+ *  Process the FIFO
+ *
+ *************************************/
+
+static int zeus_fifo_process(const UINT32 *data, int numwords)
+{
+	/* handle logging */
+	switch (data[0] >> 24)
+	{
+		/* 0x05: write 32-bit value to low registers */
+		/* in model data, this is 0x19 */
+		case 0x05:
+			if (numwords < 2)
+				return FALSE;
+			if (log_fifo)
+				log_fifo_command(data, numwords, " -- reg32");
+			zeus_register32_w((data[0] >> 16) & 0x7f, data[1], log_fifo);
+			break;
+
+		default:
+			if (data[0] != 0x2c0)
+			{
+				printf("Unknown command %08X\n", data[0]);
+				if (log_fifo)
+					log_fifo_command(data, numwords, "\n");
+			}
+			break;
+	}
+	return TRUE;
+}
+
+
+
+/*************************************
+ *
+ *  Debugging tools
+ *
+ *************************************/
+
+static void log_fifo_command(const UINT32 *data, int numwords, const char *suffix)
+{
+	int wordnum;
+
+	logerror("Zeus cmd %02X :", data[0] >> 24);
+	for (wordnum = 0; wordnum < numwords; wordnum++)
+		logerror(" %08X", data[wordnum]);
+	logerror("%s", suffix);
+}
diff -Nru src-old/mame/video/nmk16.c src/mame/video/nmk16.c
--- src-old/mame/video/nmk16.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/nmk16.c	2007-12-23 20:03:00.000000000 -0800
@@ -1,3 +1,12 @@
+/* notes...
+
+ drawing sprites in a single pass with pdrawgfx breaks Thunder Dragon 2,
+  which seems to expect the sprite priority values to affect sprite-sprite
+  priority.  Thunder Dragon 2 also breaks if you support sprite flipping,
+  the collectable point score / power up names appear flipped..
+
+*/
+
 #include "driver.h"
 
 UINT16 *nmk_bgvideoram,*nmk_fgvideoram,*nmk_txvideoram;
@@ -15,6 +24,7 @@
 
 static tilemap *bg_tilemap,*fg_tilemap,*tx_tilemap;
 static mame_bitmap *background_bitmap;
+extern UINT16* nmk16_mainram;
 
 /***************************************************************************
 
@@ -92,8 +102,8 @@
 {
 	bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
 	tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,32,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 	background_bitmap = auto_bitmap_alloc(8192,512,machine->screen[0].format);
 
 	tilemap_set_transparent_pen(bg_tilemap,15);
@@ -101,8 +111,8 @@
 	bioship_background_bank=0;
 	redraw_bitmap = 1;
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift =  0;	/* 256x224 screen, no shift */
 }
@@ -112,14 +122,14 @@
 	bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
 	fg_tilemap = tilemap_create(strahl_get_fg_tile_info, bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
 	tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,32,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 
 	tilemap_set_transparent_pen(fg_tilemap,15);
 	tilemap_set_transparent_pen(tx_tilemap,15);
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift =  0;	/* 256x224 screen, no shift */
 	background_bitmap = NULL;
@@ -129,13 +139,13 @@
 {
 	bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
 	tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,32,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 
 	tilemap_set_transparent_pen(tx_tilemap,15);
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift =  0;	/* 256x224 screen, no shift */
 	background_bitmap = NULL;
@@ -145,14 +155,14 @@
 {
 	bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
 	tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 
 	tilemap_set_transparent_pen(tx_tilemap,15);
 	tilemap_set_scroll_rows(bg_tilemap,512);
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift = 64;	/* 384x224 screen, leftmost 64 pixels have to be retrieved */
 						/* from the other side of the tilemap (!) */
@@ -163,13 +173,13 @@
 {
 	bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,1024,128);
 	tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 
 	tilemap_set_transparent_pen(tx_tilemap,15);
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift = 64;	/* 384x224 screen, leftmost 64 pixels have to be retrieved */
 						/* from the other side of the tilemap (!) */
@@ -180,13 +190,13 @@
 {
 	bg_tilemap = tilemap_create(macross_get_bg_tile_info,bg_scan_td2,TILEMAP_TYPE_PEN,16,16,1024,32);
 	tx_tilemap = tilemap_create(macross_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 
 	tilemap_set_transparent_pen(tx_tilemap,15);
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift = 64;	/* 384x224 screen, leftmost 64 pixels have to be retrieved */
 						/* from the other side of the tilemap (!) */
@@ -196,11 +206,11 @@
 VIDEO_START( bjtwin )
 {
 	bg_tilemap = tilemap_create(bjtwin_get_bg_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,32);
-	spriteram_old = auto_malloc(spriteram_size);
-	spriteram_old2 = auto_malloc(spriteram_size);
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
 
-	memset(spriteram_old,0,spriteram_size);
-	memset(spriteram_old2,0,spriteram_size);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
 
 	videoshift = 64;	/* 384x224 screen, leftmost 64 pixels have to be retrieved */
 						/* from the other side of the tilemap (!) */
@@ -410,7 +420,7 @@
 
 ***************************************************************************/
 
-extern int is_blkheart;
+
 
 // manybloc uses extra flip bits on the sprites, but these break other games
 
@@ -418,9 +428,9 @@
 {
 	int offs;
 
-	for (offs = 0;offs < spriteram_size/2;offs += 8)
+	for (offs = 0;offs < 0x1000/2;offs += 8)
 	{
-		if ((spriteram_old2[offs] & 0x0001) || (spriteram_old2[offs] && is_blkheart))
+		if ((spriteram_old2[offs] & 0x0001))
 		{
 			int sx = (spriteram_old2[offs+4] & 0x1ff) + videoshift;
 			int sy = (spriteram_old2[offs+6] & 0x1ff);
@@ -465,83 +475,23 @@
 	}
 }
 
-/* sprites have flipping and are not delayed 2 frames */
-static void manybloc_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
+static void nmk16_draw_sprites_flipsupported(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
 {
 	int offs;
 
-	for (offs = 0;offs < spriteram_size/2;offs += 8)
+	for (offs = 0;offs < 0x1000/2;offs += 8)
 	{
-		if ((spriteram16[offs] & 0x0001) || (spriteram16[offs] && is_blkheart))
+		if (spriteram_old2[offs] & 0x0001)
 		{
-			int sx = (spriteram16[offs+4] & 0x1ff) + videoshift;
-			int sy = (spriteram16[offs+6] & 0x1ff);
-			int code = spriteram16[offs+3];
-			int color = spriteram16[offs+7];
-			int w = (spriteram16[offs+1] & 0x0f);
-			int h = ((spriteram16[offs+1] & 0xf0) >> 4);
-			int pri = (spriteram16[offs] & 0xc0) >> 6;
-			/* these would break some of the nmk games ... */
-			int flipy= ((spriteram16[offs+1] & 0x0200) >> 9);
-			int flipx = ((spriteram16[offs+1] & 0x0100) >> 8);
-
-			int xx,yy,x;
-			int delta = 16;
-
-			if(pri != priority)
-				continue;
-
-			flipx ^= flip_screen;
-			flipy ^= flip_screen;
-
-			if (flip_screen)
-			{
-				sx = 368 - sx;
-				sy = 240 - sy;
-				delta = -16;
-			}
-
-			yy = h;
-			do
-			{
-				x = sx;
-				xx = w;
-				do
-				{
-					drawgfx(bitmap,machine->gfx[2],
-							code,
-							color,
-							flipx, flipy,
-							((x + 16) & 0x1ff) - 16,sy & 0x1ff,
-							cliprect,TRANSPARENCY_PEN,15);
-
-					code++;
-					x += delta;
-				} while (--xx >= 0);
-
-				sy += delta;
-			} while (--yy >= 0);
-		}
-	}
-}
-
-static void tharrier_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
-{
-	int offs;
-
-	for (offs = 0;offs < spriteram_size/2;offs += 8)
-	{
-		if ((spriteram16[offs] & 0x0001) || (spriteram16[offs] && is_blkheart))
-		{
-			int sx = (spriteram16[offs+4] & 0x1ff) + videoshift;
-			int sy = (spriteram16[offs+6] & 0x1ff);
-			int code = spriteram16[offs+3];
-			int color = spriteram16[offs+7];
-			int w = (spriteram16[offs+1] & 0x0f);
-			int h = ((spriteram16[offs+1] & 0xf0) >> 4);
-			int pri = (spriteram16[offs] & 0xc0) >> 6;
-			int flipy= ((spriteram16[offs+1] & 0x0200) >> 9);
-			int flipx = ((spriteram16[offs+1] & 0x0100) >> 8);
+			int sx = (spriteram_old2[offs+4] & 0x1ff) + videoshift;
+			int sy = (spriteram_old2[offs+6] & 0x1ff);
+			int code = spriteram_old2[offs+3];
+			int color = spriteram_old2[offs+7];
+			int w = (spriteram_old2[offs+1] & 0x0f);
+			int h = ((spriteram_old2[offs+1] & 0xf0) >> 4);
+			int pri = (spriteram_old2[offs] & 0xc0) >> 6;
+			int flipy= ((spriteram_old2[offs+1] & 0x0200) >> 9);
+			int flipx = ((spriteram_old2[offs+1] & 0x0100) >> 8);
 
 			int xx,yy,x;
 			int delta = 16;
@@ -588,22 +538,22 @@
 	}
 }
 
+
 VIDEO_UPDATE( macross )
 {
 	tilemap_set_scrollx(tx_tilemap,0,-videoshift);
 
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
+
 	nmk16_draw_sprites(machine, bitmap,cliprect,3);
 	nmk16_draw_sprites(machine, bitmap,cliprect,2);
 	nmk16_draw_sprites(machine, bitmap,cliprect,1);
 	nmk16_draw_sprites(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
 
-extern UINT16 *nmk16_mcu_shared_ram;
-extern UINT16 *nmk16_mcu_work_ram;
-
 /*coin setting MCU simulation*/
 static void mcu_run(UINT8 dsw_setting)
 {
@@ -627,7 +577,7 @@
 	old_value = readinputport(0);
 
 	if(dsw_a == 0 || dsw_b == 0)
-		nmk16_mcu_work_ram[0x000/2]|=0x4000; //free_play
+		nmk16_mainram[0x9000/2]|=0x4000; //free_play
 
 	if(read_coin != old_value)
 	{
@@ -635,15 +585,15 @@
 		{
 			switch(dsw_a & 7)
 			{
-				case 1: nmk16_mcu_shared_ram[0xf00/2]+=4; break;
-				case 2: nmk16_mcu_shared_ram[0xf00/2]+=3; break;
-				case 3: nmk16_mcu_shared_ram[0xf00/2]+=2; break;
+				case 1: nmk16_mainram[0xef00/2]+=4; break;
+				case 2: nmk16_mainram[0xef00/2]+=3; break;
+				case 3: nmk16_mainram[0xef00/2]+=2; break;
 				case 4:
 				coina++;
 				if(coina >= 4)
 				{
 					coina = 0;
-					nmk16_mcu_shared_ram[0xf00/2]++;
+					nmk16_mainram[0xef00/2]++;
 				}
 				break;
 				case 5:
@@ -651,7 +601,7 @@
 				if(coina >= 3)
 				{
 					coina = 0;
-					nmk16_mcu_shared_ram[0xf00/2]++;
+					nmk16_mainram[0xef00/2]++;
 				}
 				break;
 				case 6:
@@ -659,10 +609,10 @@
 				if(coina >= 2)
 				{
 					coina = 0;
-					nmk16_mcu_shared_ram[0xf00/2]++;
+					nmk16_mainram[0xef00/2]++;
 				}
 				break;
-				case 7: nmk16_mcu_shared_ram[0xf00/2]++; break;
+				case 7: nmk16_mainram[0xef00/2]++; break;
 			}
 		}
 
@@ -670,15 +620,15 @@
 		{
 			switch(dsw_b & 7)
 			{
-				case 1: nmk16_mcu_shared_ram[0xf00/2]+=4; break;
-				case 2: nmk16_mcu_shared_ram[0xf00/2]+=3; break;
-				case 3: nmk16_mcu_shared_ram[0xf00/2]+=2; break;
+				case 1: nmk16_mainram[0xef00/2]+=4; break;
+				case 2: nmk16_mainram[0xef00/2]+=3; break;
+				case 3: nmk16_mainram[0xef00/2]+=2; break;
 				case 4:
 				coinb++;
 				if(coinb >= 4)
 				{
 					coinb = 0;
-					nmk16_mcu_shared_ram[0xf00/2]++;
+					nmk16_mainram[0xef00/2]++;
 				}
 				break;
 				case 5:
@@ -686,7 +636,7 @@
 				if(coinb >= 3)
 				{
 					coinb = 0;
-					nmk16_mcu_shared_ram[0xf00/2]++;
+					nmk16_mainram[0xef00/2]++;
 				}
 				break;
 				case 6:
@@ -694,37 +644,37 @@
 				if(coinb >= 2)
 				{
 					coinb = 0;
-					nmk16_mcu_shared_ram[0xf00/2]++;
+					nmk16_mainram[0xef00/2]++;
 				}
 				break;
-				case 7: nmk16_mcu_shared_ram[0xf00/2]++; break;
+				case 7: nmk16_mainram[0xef00/2]++; break;
 			}
 		}
 
 		if(!(readinputport(0) & 0x04))//SERVICE_COIN
-			nmk16_mcu_shared_ram[0xf00/2]++;
+			nmk16_mainram[0xef00/2]++;
 
-		if(nmk16_mcu_shared_ram[0xf00/2] >= 1 && (nmk16_mcu_work_ram[0x000/2] & 0x8000))/*enable start button*/
+		if(nmk16_mainram[0xef00/2] >= 1 && (nmk16_mainram[0x9000/2] & 0x8000))/*enable start button*/
 		{
 			/*Start a 1-player game,but don't decrement if the player 1 is already playing*/
 			if((!(readinputport(0) & 0x08)) /*START1*/
-			&& (!(nmk16_mcu_work_ram[0x000/2] & 0x0200)) /*PLAYER-1 playing*/
+			&& (!(nmk16_mainram[0x9000/2] & 0x0200)) /*PLAYER-1 playing*/
 			)
-				nmk16_mcu_shared_ram[0xf00/2]--;
+				nmk16_mainram[0xef00/2]--;
 
 			/*Start a 2-players game,but don't decrement if the player 2 is already playing*/
 			if((!(readinputport(0) & 0x10))
-			&& (!(nmk16_mcu_work_ram[0x000/2] & 0x0100))
+			&& (!(nmk16_mainram[0x9000/2] & 0x0100))
 			)
 			{
-				if(!(nmk16_mcu_work_ram[0x000/2] & 0x0200) && nmk16_mcu_shared_ram[0xf00/2] >= 2)
-					nmk16_mcu_shared_ram[0xf00/2]-=2;
+				if(!(nmk16_mainram[0x9000/2] & 0x0200) && nmk16_mainram[0xef00/2] >= 2)
+					nmk16_mainram[0xef00/2]-=2;
 				else
-					nmk16_mcu_shared_ram[0xf00/2]--;
+					nmk16_mainram[0xef00/2]--;
 			}
 		}
 
-		if(nmk16_mcu_shared_ram[0xf00/2] > 99) nmk16_mcu_shared_ram[0xf00/2] = 99;
+		if(nmk16_mainram[0xef00/2] > 99) nmk16_mainram[0xef00/2] = 99;
 	}
 }
 
@@ -735,10 +685,12 @@
 	tilemap_set_scrollx(tx_tilemap,0,-videoshift);
 
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
+
 	nmk16_draw_sprites(machine, bitmap,cliprect,3);
 	nmk16_draw_sprites(machine, bitmap,cliprect,2);
 	nmk16_draw_sprites(machine, bitmap,cliprect,1);
 	nmk16_draw_sprites(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
@@ -750,10 +702,12 @@
 	tilemap_set_scrollx(tx_tilemap,0,-videoshift);
 
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
+
 	nmk16_draw_sprites(machine, bitmap,cliprect,3);
 	nmk16_draw_sprites(machine, bitmap,cliprect,2);
 	nmk16_draw_sprites(machine, bitmap,cliprect,1);
 	nmk16_draw_sprites(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
@@ -763,23 +717,30 @@
 	tilemap_set_scrollx(tx_tilemap,0,-videoshift);
 
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
-	manybloc_draw_sprites(machine, bitmap,cliprect,3);
-	manybloc_draw_sprites(machine, bitmap,cliprect,2);
-	manybloc_draw_sprites(machine, bitmap,cliprect,1);
-	manybloc_draw_sprites(machine, bitmap,cliprect,0);
+
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
 
 VIDEO_UPDATE( tharrier )
 {
+	/* I think the protection device probably copies this to the regs... */
+	UINT16 tharrier_scroll = nmk16_mainram[0x9f00/2];
+
 	tilemap_set_scrollx(tx_tilemap,0,-videoshift);
 	tilemap_set_scrollx(bg_tilemap,0,tharrier_scroll);
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
-	tharrier_draw_sprites(machine, bitmap,cliprect,3);
-	tharrier_draw_sprites(machine, bitmap,cliprect,2);
-	tharrier_draw_sprites(machine, bitmap,cliprect,1);
-	tharrier_draw_sprites(machine, bitmap,cliprect,0);
+
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
@@ -842,10 +803,12 @@
 
 	copyscrollbitmap(bitmap,background_bitmap,1,&scrollx,1,&scrolly,cliprect,TRANSPARENCY_NONE,0);
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
+
 	nmk16_draw_sprites(machine, bitmap,cliprect,3);
 	nmk16_draw_sprites(machine, bitmap,cliprect,2);
 	nmk16_draw_sprites(machine, bitmap,cliprect,1);
 	nmk16_draw_sprites(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
@@ -856,10 +819,12 @@
 
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
 	tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
+
 	nmk16_draw_sprites(machine, bitmap,cliprect,3);
 	nmk16_draw_sprites(machine, bitmap,cliprect,2);
 	nmk16_draw_sprites(machine, bitmap,cliprect,1);
 	nmk16_draw_sprites(machine, bitmap,cliprect,0);
+
 	tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
 	return 0;
 }
@@ -869,16 +834,251 @@
 	tilemap_set_scrollx(bg_tilemap,0,-videoshift);
 
 	tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
+
 	nmk16_draw_sprites(machine, bitmap,cliprect,3);
 	nmk16_draw_sprites(machine, bitmap,cliprect,2);
 	nmk16_draw_sprites(machine, bitmap,cliprect,1);
 	nmk16_draw_sprites(machine, bitmap,cliprect,0);
+
 	return 0;
 }
 
 VIDEO_EOF( nmk )
 {
-	/* looks like sprites are *two* frames ahead */
-	memcpy(spriteram_old2,spriteram_old,spriteram_size);
-	memcpy(spriteram_old,spriteram16,spriteram_size);
+	/* sprites are DMA'd from Main RAM to a private buffer automatically
+       (or at least this is how I interpret the datasheet) */
+
+	/* -- I actually see little evidence to support this, sprite lag
+          in some games should be checked on real boards */
+
+//  memcpy(spriteram_old2,spriteram_old,0x1000);
+	memcpy(spriteram_old2,nmk16_mainram+0x8000/2,0x1000);
+}
+
+
+
+/* Variables needed by drivers: */
+
+UINT16 *afega_vram_0, *afega_scroll_0;
+UINT16 *afega_vram_1, *afega_scroll_1;
+
+
+/***************************************************************************
+
+
+                        Palette - RRRRGGGGBBBB????
+
+
+***************************************************************************/
+
+WRITE16_HANDLER( afega_palette_w )
+{
+	int r,g,b;
+	data = COMBINE_DATA(&paletteram16[offset]);
+	b = ((data & 0x00F0) >> 3 ) + ((data & 0x0002) >> 1);
+	g = ((data & 0x0F00) >> 7 ) + ((data & 0x0004) >> 2);
+	r = ((data & 0xF000) >> 11) + ((data & 0x0008) >> 3);
+	palette_set_color_rgb( Machine, offset, pal5bit(r) , pal5bit(g) , pal5bit(b) );
+}
+
+/* This game uses 8 bit tiles, so it ignores the color codes and just
+   uses the same 256 colors for every tile */
+PALETTE_INIT( grdnstrm )
+{
+	int color, pen;
+	for( color = 0; color < 16; color++ )
+		for( pen = 0; pen < 256; pen++ )
+			colortable[color * 256 + pen + 256*3] = 256*0 + pen;
 }
+
+
+/***************************************************************************
+
+                                Tilemaps
+
+    Offset:     Bits:                   Value:
+
+        2.w     fedc ---- ---- ----     Color
+                ---- ba98 7654 3210     Code
+
+***************************************************************************/
+
+#define TILES_PER_PAGE_X	(0x10)
+#define TILES_PER_PAGE_Y	(0x10)
+#define PAGES_PER_TMAP_X	(0x4)
+#define PAGES_PER_TMAP_Y	(0x4)
+#define FIREHAWK_PAGES_PER_TMAP_X	(0x1)
+#define FIREHAWK_PAGES_PER_TMAP_Y	(0x1)
+#define TWINACTN_TILES_PER_PAGE_X	(0x100)
+#define TWINACTN_TILES_PER_PAGE_Y	(0x10)
+#define TWINACTN_PAGES_PER_TMAP_X	(0x1)
+#define TWINACTN_PAGES_PER_TMAP_Y	(0x1)
+
+
+static TILEMAP_MAPPER( afega_tilemap_scan_pages )
+{
+	return	(row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * PAGES_PER_TMAP_X +
+			(row % TILES_PER_PAGE_Y) +
+
+			(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
+			(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
+}
+
+static TILEMAP_MAPPER( firehawk_tilemap_scan_pages )
+{
+	return	(row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * FIREHAWK_PAGES_PER_TMAP_X +
+			(row % TILES_PER_PAGE_Y) +
+
+			(col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
+			(col % TILES_PER_PAGE_X) * TILES_PER_PAGE_Y;
+}
+
+static tilemap *tilemap_0, *tilemap_1;
+
+static TILE_GET_INFO( get_tile_info_0 )
+{
+	UINT16 code = afega_vram_0[tile_index];
+	SET_TILE_INFO(
+			0,
+			code,
+			(code & 0xf000) >> 12,
+			0);
+}
+static TILE_GET_INFO( get_tile_info_1 )
+{
+	UINT16 code = afega_vram_1[tile_index];
+	SET_TILE_INFO(
+			1,
+			code,
+			(code & 0xf000) >> 12,
+			0);
+}
+
+WRITE16_HANDLER( afega_vram_0_w )
+{
+	COMBINE_DATA(&afega_vram_0[offset]);
+	tilemap_mark_tile_dirty(tilemap_0,offset);
+}
+WRITE16_HANDLER( afega_vram_1_w )
+{
+	COMBINE_DATA(&afega_vram_1[offset]);
+	tilemap_mark_tile_dirty(tilemap_1,offset);
+}
+
+
+/***************************************************************************
+
+
+                            Video Hardware Init
+
+
+***************************************************************************/
+
+VIDEO_START( afega )
+{
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
+
+
+	tilemap_0 = tilemap_create(	get_tile_info_0, afega_tilemap_scan_pages,
+								TILEMAP_TYPE_PEN,
+								16,16,
+								TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
+
+	tilemap_1 = tilemap_create(	get_tile_info_1, tilemap_scan_cols,
+								TILEMAP_TYPE_PEN,
+								8,8,
+								32,32);
+
+	tilemap_set_transparent_pen(tilemap_1,0xf);
+}
+
+
+
+VIDEO_START( firehawk )
+{
+	spriteram_old = auto_malloc(0x1000);
+	spriteram_old2 = auto_malloc(0x1000);
+	memset(spriteram_old,0,0x1000);
+	memset(spriteram_old2,0,0x1000);
+
+
+	tilemap_0 = tilemap_create(	get_tile_info_0, firehawk_tilemap_scan_pages,
+								TILEMAP_TYPE_PEN,
+								16,16,
+								TILES_PER_PAGE_X*FIREHAWK_PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*FIREHAWK_PAGES_PER_TMAP_Y);
+
+	tilemap_1 = tilemap_create(	get_tile_info_1, tilemap_scan_cols,
+								TILEMAP_TYPE_PEN,
+								8,8,
+								32,32);
+
+	tilemap_set_transparent_pen(tilemap_1,0xf);
+}
+
+
+/***************************************************************************
+
+
+                                Screen Drawing
+
+
+***************************************************************************/
+
+static void video_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
+	int dsw_flipscreen,			// 1 = Horizontal and vertical screen flip are hardwired to 2 dip switches
+	int xoffset, int yoffset,	// tilemap_0 offsets
+	int attr_mask				// "sprite active" mask
+	)
+{
+
+
+
+	if (dsw_flipscreen)
+	{
+
+		flip_screen_x_set(~readinputport(2) & 0x0100);
+		flip_screen_y_set(~readinputport(2) & 0x0200);
+	}
+
+	tilemap_set_scrollx(tilemap_0, 0, afega_scroll_0[1] + xoffset);
+	tilemap_set_scrolly(tilemap_0, 0, afega_scroll_0[0] + yoffset);
+
+	tilemap_set_scrollx(tilemap_1, 0, afega_scroll_1[1]);
+	tilemap_set_scrolly(tilemap_1, 0, afega_scroll_1[0]);
+
+
+	tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
+
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
+
+	tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
+}
+
+VIDEO_UPDATE( afega )		{	video_update(machine,bitmap,cliprect, 1, -0x100,+0x000, 0x0001);	return 0; }
+VIDEO_UPDATE( bubl2000 )	{	video_update(machine,bitmap,cliprect, 0, -0x100,+0x000, 0x0001);	return 0; }	// no flipscreen support, I really would confirmation from the schematics
+VIDEO_UPDATE( redhawkb )	{	video_update(machine,bitmap,cliprect, 0, +0x000,+0x100, 0x0001);	return 0; }
+
+VIDEO_UPDATE( firehawk )
+{
+
+
+	tilemap_set_scrolly(tilemap_0, 0, afega_scroll_1[1] + 0x100);
+	tilemap_set_scrollx(tilemap_0, 0, afega_scroll_1[0]);
+
+	tilemap_draw(bitmap,cliprect,tilemap_0,0,0);
+
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,3);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,2);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,1);
+	nmk16_draw_sprites_flipsupported(machine, bitmap,cliprect,0);
+
+	tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
+	return 0;
+}
+
diff -Nru src-old/mame/video/rungun.c src/mame/video/rungun.c
--- src-old/mame/video/rungun.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/rungun.c	2007-12-23 19:41:16.000000000 -0800
@@ -15,7 +15,7 @@
 static UINT16 ttl_vram[0x1000];
 
 static int sprite_colorbase;
-extern UINT16 *rng_936_videoram;
+UINT16 *rng_936_videoram;
 
 /* TTL text plane stuff */
 
@@ -37,12 +37,12 @@
 	*color = sprite_colorbase | (*color & 0x001f);
 }
 
-READ16_HANDLER( ttl_ram_r )
+READ16_HANDLER( rng_ttl_ram_r )
 {
 	return(ttl_vram[offset]);
 }
 
-WRITE16_HANDLER( ttl_ram_w )
+WRITE16_HANDLER( rng_ttl_ram_w )
 {
 	COMBINE_DATA(&ttl_vram[offset]);
 }
diff -Nru src-old/mame/video/tx1.c src/mame/video/tx1.c
--- src-old/mame/video/tx1.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/tx1.c	2007-12-23 20:03:00.000000000 -0800
@@ -1,65 +1,593 @@
-/*====================================================================*/
-/*               TX-1/Buggy Boy  (Tatsumi) Hardware                   */
-/*                      Philip J Bennett 2005                         */
-/*                                                                    */
-/*                         Video Emulation                            */
-/*====================================================================*/
+/***************************************************************************
+
+    Tatsumi TX-1/Buggy Boy video hardware
 
+****************************************************************************/
 #include "driver.h"
+#include "profiler.h"
+#include "render.h"
+#include "cpu/i86/i86.h"
+#include "tx1.h"
+
+#define PRINT_CRTC_DATA 1
 
-extern UINT16 *buggyb1_vram;
-extern UINT16 *buggyboy_vram;
-extern UINT16 *bb_objram;
-extern UINT16 *bb_sky;
+/*
+    HD46505S-2 CRT Controller
+*/
+READ16_HANDLER( tx1_crtc_r )
+{
+	return 0xffff;
+}
 
-extern tilemap *buggyb1_tilemap;
-extern tilemap *buggyboy_tilemap;
-extern size_t bb_objectram_size;
+WRITE16_HANDLER( tx1_crtc_w )
+{
+#if PRINT_CRTC_DATA
+	data &= 0xff;
+	if (offset == 0)
+	{
+		switch (data)
+		{
+			case 0x00: mame_printf_debug("Horizontal Total         "); break;
+			case 0x01: mame_printf_debug("Horizontal displayed     "); break;
+			case 0x02: mame_printf_debug("Horizontal sync position "); break;
+			case 0x03: mame_printf_debug("Horizontal sync width    "); break;
+			case 0x04: mame_printf_debug("Vertical total           "); break;
+			case 0x05: mame_printf_debug("Vertical total adjust    "); break;
+			case 0x06: mame_printf_debug("Vertical displayed       "); break;
+        	case 0x07: mame_printf_debug("Vertical sync position   "); break;
+        	case 0x08: mame_printf_debug("Interlace mode           "); break;
+        	case 0x09: mame_printf_debug("Max. scan line address   "); break;
+        	case 0x0a: mame_printf_debug("Cursror start            "); break;
+        	case 0x0b: mame_printf_debug("Cursor end               "); break;
+        	case 0x0c: mame_printf_debug("Start address (h)        "); break;
+        	case 0x0d: mame_printf_debug("Start address (l)        "); break;
+        	case 0x0e: mame_printf_debug("Cursor (h)               "); break;
+        	case 0x0f: mame_printf_debug("Cursor (l)               "); break;
+        	case 0x10: mame_printf_debug("Light pen (h))           "); break;
+        	case 0x11: mame_printf_debug("Light pen (l)            "); break;
+		}
+	}
+	else if (offset == 1)
+	{
+		mame_printf_debug("0x%.2x, (%d)\n",data, data);
+	}
+#endif
+}
 
 
-extern UINT16 *tx1_vram;
-extern UINT16 *tx1_object_ram;
+/***************************************************************************
 
-extern tilemap *tx1_tilemap;
-extern size_t tx1_objectram_size;
+  TX-1
 
-/*********/
-/* TX-1 */
-/********/
+***************************************************************************/
+static struct
+{
+	UINT16	scol;		/* Road colours */
+	UINT32  slock;		/* Scroll lock */
+	UINT8	flags;		/* Road flags */
+
+	UINT32	ba_val;		/* Accumulator */
+	UINT32	ba_inc;
+
+	UINT16	h_val;		/* Accumulator */
+	UINT16	h_inc;
+
+	UINT8	slin_val;	/* Accumulator */
+	UINT8	slin_inc;
+} tx1_vregs;
+
+/* Offsets into the palette PROMs */
+#define TX1_COLORS_CHAR	0x00
+#define TX1_COLORS_OBJ	0x80
+#define TX1_COLORS_ROAD	0xC0
+
+UINT16 *tx1_vram;
+UINT16 *tx1_objram;
+UINT16 *tx1_rcram;
+size_t tx1_objram_size;
+
+static tilemap *tx1_tilemap;
+static mame_bitmap *tx1_bitmap;
+static render_texture *tx1_texture;
 
 WRITE16_HANDLER( tx1_vram_w )
 {
 	COMBINE_DATA(&tx1_vram[offset]);
-	tilemap_mark_tile_dirty(tx1_tilemap,offset);
+	tilemap_mark_tile_dirty(tx1_tilemap, offset);
 }
 
 static TILE_GET_INFO( get_tx1_tile_info )
 {
-	int tileno = (tx1_vram[tile_index]&0x03ff) | ((tx1_vram[tile_index] & 0x8000) >> 5);
+	int tilenum, color;
+
+	color = (tx1_vram[tile_index] >> 10) & 0x3f;
+	tilenum = (tx1_vram[tile_index]&0x03ff) | ((tx1_vram[tile_index] & 0x8000) >> 5);
+
+	SET_TILE_INFO(0, tilenum, color, 0);
+}
+
+/***************************************************************************
+
+  Palette initialisation
+
+  TODO: Add some notes
+
+  bit 3 -- 220 ohm resistor  -- RED/GREEN/BLUE
+        -- 470 ohm resistor  -- RED/GREEN/BLUE
+        -- 1.0kohm resistor  -- RED/GREEN/BLUE
+  bit 0 -- 2.2kohm resistor  -- RED/GREEN/BLUE
+
+***************************************************************************/
+PALETTE_INIT( tx1 )
+{
+	int i;
+
+	for (i = 0; i < 256; ++i)
+	{
+		int bit0, bit1, bit2, bit3;
+		int r, g, b;
+
+		bit0 = BIT(color_prom[i], 0);
+		bit1 = BIT(color_prom[i], 1);
+		bit2 = BIT(color_prom[i], 2);
+		bit3 = BIT(color_prom[i], 3);
+		r = 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+
+		bit0 = BIT(color_prom[i + 0x100], 0);
+		bit1 = BIT(color_prom[i + 0x100], 1);
+		bit2 = BIT(color_prom[i + 0x100], 2);
+		bit3 = BIT(color_prom[i + 0x100], 3);
+		g = 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+
+		bit0 = BIT(color_prom[i + 0x200], 0);
+		bit1 = BIT(color_prom[i + 0x200], 1);
+		bit2 = BIT(color_prom[i + 0x200], 2);
+		bit3 = BIT(color_prom[i + 0x200], 3);
+		b = 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+
+		palette_set_color(machine, i, MAKE_RGB(r, g, b));
+	}
+
+	/* TODO */
+	for (i = 0; i < 256; ++i)
+	{
+		colortable[i] = (color_prom[i + 0x900] & 0xf) + 0x00;
+	}
+}
+
+WRITE16_HANDLER( tx1_bankcs_w )
+{
+	// AAB2 = /BASET0
+	// AAB3 = /BASET
+	// AAB4 = /BSET
+	// AAB5 = /HASET
+	// AAB6 = /HSET
+
+	offset <<= 1;
+
+	if ( offset & 0x04 )
+	{
+		tx1_vregs.ba_inc &= ~0x0000ffff;
+		tx1_vregs.ba_inc |= data;
+
+		if ( !(offset & 2)  )
+			tx1_vregs.ba_val &= ~0x000ffff;
+	}
+	if ( offset & 0x08 )
+	{
+		data &= 0xff;
+		tx1_vregs.ba_inc &= ~0xffff0000;
+		tx1_vregs.ba_inc |= data << 16;
+
+		if ( !(offset & 2)  )
+			tx1_vregs.ba_val &= ~0xffff0000;
+	}
+	if ( offset & 0x10 )
+	{
+		/* Ignore data */
+		if ( offset & 2 )
+		{
+			tx1_vregs.ba_val = (tx1_vregs.ba_inc + tx1_vregs.ba_val) & 0x00ffffff;
+		}
+	}
+	if ( offset & 0x20 )
+	{
+		tx1_vregs.h_inc = data;
+
+		if ( !(offset & 2) )
+			tx1_vregs.h_val = 0;
+	}
+	if ( !(offset & 0x40) )
+	{
+		/* Ignore data? */
+		if ( offset & 2 )
+			tx1_vregs.h_val += tx1_vregs.h_inc;
+	}
+}
+
+WRITE16_HANDLER( tx1_slincs_w )
+{
+	if ( offset == 1 )
+		tx1_vregs.slin_inc = data;
+	else
+		tx1_vregs.slin_inc = tx1_vregs.slin_val = 0;
+}
+
+WRITE16_HANDLER( tx1_slock_w )
+{
+	tx1_vregs.slock = data & 1;
+}
+
+WRITE16_HANDLER( tx1_scolst_w )
+{
+	tx1_vregs.scol = data & 0x0707;
+}
+
+WRITE16_HANDLER( tx1_flgcs_w )
+{
+	tx1_vregs.flags = data & 0xff;
+}
+
+
+/* Preliminary */
+static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
+{
+#define FRAC	16
 
-	SET_TILE_INFO(0,tileno,0,0);
+	UINT32 offs;
+
+	/* The many lookup table ROMs */
+	const UINT8 *const ic48  = (UINT8*)memory_region(REGION_USER3);
+	const UINT8 *const ic281 = (UINT8*)memory_region(REGION_USER3) + 0x2000;
+	const UINT8 *const ic25  = (UINT8*)memory_region(REGION_PROMS) + 0x1000;
+
+	const UINT8 *const ic106 = (UINT8*)memory_region(REGION_USER2);
+	const UINT8 *const ic73  = (UINT8*)memory_region(REGION_USER2) + 0x4000;
+
+	const UINT8 *const ic190 = (UINT8*)memory_region(REGION_PROMS) + 0xc00;
+	const UINT8 *const ic162 = (UINT8*)memory_region(REGION_PROMS) + 0xe00;
+
+	const UINT8 *const pixdata_rgn = (UINT8*)memory_region(REGION_GFX2);
+
+	for (offs = 0x0; offs <= tx1_objram_size; offs += 8)
+	{
+		UINT32	x;
+		UINT32	y;
+		UINT32	gxflip;
+
+		UINT32	x_scale;
+		UINT32	x_step;
+		UINT16	y_scale;
+		UINT16	y_step;
+
+		UINT8	pctmp0_7;
+		UINT8	code;
+
+		/* Check for end of object list */
+		if ( (tx1_objram[offs] & 0xff00) == 0xff00 )
+			break;
+
+		/* X scale */
+		x_scale = tx1_objram[offs + 2] & 0xff;
+
+		/* TODO: Confirm against hardware? */
+		if ( x_scale == 0 )
+			continue;
+
+		/* 16-bit y-scale accumulator */
+		y_scale = tx1_objram[offs + 1];
+		y_step  = tx1_objram[offs + 3];
+
+		/* Object number */
+		code = tx1_objram[offs] & 0xff;
+
+		/* Attributes */
+		pctmp0_7 = tx1_objram[offs + 2] >> 8;
+
+		/* Global x-flip */
+		gxflip = (pctmp0_7 & 0x80) >> 7;
+
+		/* Add 1 to account for line buffering */
+		y = (tx1_objram[offs] >> 8) + 1;
+
+		for (; y <= cliprect->max_y; ++y)
+		{
+			UINT32	rom_addr2	= 0;
+			UINT8	ic106_data	= 0;
+			UINT8	ic73_data;
+
+			/* Are we drawing on this line? */
+
+			/* TODO: See big lampposts. */
+			if ( y_scale & 0x8000 )
+				break;
+
+			{
+				UINT32	psa0_11;
+				UINT32	ic48_addr;
+				UINT32	ic48_data;
+				UINT32	rom_addr;
+				UINT32	x_acc;
+				UINT32	newtile = 1;
+				UINT32	dataend = 0;
+				UINT8	data1 = 0;
+				UINT8	data2 = 0;
+				UINT32	xflip = 0;
+				UINT32	opcd0_7 = 0;
+				UINT32	lasttile = 0;
+
+				/* Use the object code to lookup the tile sequence data in ROM */
+				ic48_addr = code << 4;
+				ic48_addr |= ((y_scale >> 11) & 0xf);
+				ic48_data = ic48[ic48_addr];
+
+				/* Reached the bottom of the object? (/PASS2E) */
+				if ( ic48_data == 0xff )
+					break;
+
+				/* Combine ROM and PROM data */
+				psa0_11 = ((ic25[code] << 8) | ic48_data) & 0xfff;
+
+				/* psa8_11 */
+				rom_addr = (psa0_11 & ~0xff) << 2;
+
+				/* Prepare the x-scaling */
+				x_step = (128 << FRAC) / x_scale;
+				x_acc = (psa0_11 & 0xff) << (FRAC + 5);
+
+				/* TODO */
+				//x = tx1_objram[offs + 4] & 0x7ff;
+				x = tx1_objram[offs + 4];
+
+				for (;;)
+				{
+					#define MASK	0x3ff
+
+					if (newtile)
+					{
+						UINT32 low_addr = ((x_acc >> (FRAC + 3)) & MASK);
+
+						if (gxflip)
+						{
+							UINT32 xor_mask;
+
+							if ( BIT(psa0_11, 11) && BIT(psa0_11, 10) )
+								xor_mask = 0xf;
+							else if ( BIT(psa0_11, 9) )
+								xor_mask = 0x7;
+							else
+								xor_mask = 0x3;
+
+							rom_addr2 = rom_addr + (xor_mask ^ low_addr);
+						}
+						else
+							rom_addr2 = rom_addr + low_addr;
+
+						ic106_data = ic106[rom_addr2 & 0x3fff];
+
+						if ( (ic106_data & 0x40) && dataend )
+							lasttile = 1;
+
+						dataend |= ic106_data & 0x40;
+					}
+
+					{
+						if ( newtile )
+						{
+							UINT32	psbb0_12;
+							UINT32	pscb0_14;
+							UINT32	pscb11;
+							UINT8	*romptr;
+							UINT32	ic281_addr;
+							UINT32  grom_addr;
+							UINT32	lut_data;
+
+							/* Retrieve data for an 8x8 tile */
+							ic73_data = ic73[rom_addr2];
+
+							// This is the data from the LUT pair
+							lut_data = (ic106_data << 8) | ic73_data;
+							psbb0_12 = lut_data & 0x1fff;
+
+							// 0000 1100 0011 1111
+							pscb0_14 = (psbb0_12 & 0xc3f);
+
+
+							/* Bits 9_6 are from PCTMP11-8 or PSBB9-6 */
+
+							/* 0000 0011 1100 0000 */
+							if ( BIT(psbb0_12, 12) )
+								pscb0_14 |= psbb0_12 & 0x3c0;
+							else
+								pscb0_14 |= (pctmp0_7 & 0xf) << 6;
+
+							// This is the important one!
+							if ( BIT(lut_data, 13) ) // PSBB13
+								pscb0_14 |= BIT(psbb0_12, 10) << 12;
+							else
+								pscb0_14 |= ((pctmp0_7 & 0x70) << 8);
+
+
+
+							// 1 = Bit 12 is Bit 10 duplicated.
+							// Schematics indicate otherwise...
+							#if 1
+							pscb0_14 &= ~(1 << 12);
+							pscb0_14 |= BIT(psbb0_12, 10) << 12;
+							#endif
+
+							pscb11 = BIT(pscb0_14, 11);
+
+							/* TODO: Remove this - it's constant. */
+							romptr = (UINT8*)(pixdata_rgn + pscb11 * (0x4000 * 2));
+
+							grom_addr = ((pscb0_14 << 3) | ((y_scale >> 8) & 7)) & 0x3fff;
+
+							/* Get raw 8x8 2bpp pixel row data */
+							data1 = *(grom_addr + romptr);
+							data2 = *(grom_addr + romptr + 0x4000);
+
+							/* Determine flip state (global XOR local) */
+							xflip = gxflip ^ !BIT(lut_data, 15);
+
+							/* WRONG */
+							ic281_addr = pscb0_14 & 0x3ff; // Bits 9_0
+							ic281_addr |= ((pscb0_14 & 0x7000) >> 2);	//Bits 14 13 12
+							ic281_addr |= pscb11 << 13; // Bit 11
+
+							opcd0_7 = ic281[ic281_addr];
+						}
+
+						/* Draw a pixel? */
+						if ( x <= cliprect->max_x )
+						{
+							UINT8	pix;
+							UINT8	bit;
+
+							bit	= (x_acc >> FRAC) & 7;
+
+							if ( xflip )
+								bit ^= 7;
+
+							pix = (((data1 >> bit) & 1) << 1) | ((data2 >> bit) & 1);
+
+							/* Draw pixel, if not transparent */
+							if ( !(!(opcd0_7 & 0x80) && !pix) )
+							{
+								UINT8 color;
+								UINT32 prom_addr;
+
+								prom_addr = ((opcd0_7 << 2) | pix) & 0x1ff;
+
+								/* Inverted on schematic */
+								if (x & 1)
+									color = ~ic190[prom_addr] & 0x3f;
+								else
+									color = ~ic162[prom_addr] & 0x3f;
+
+								*BITMAP_ADDR16(bitmap, y, x) = Machine->pens[TX1_COLORS_OBJ + color];
+							}
+						}
+					}
+					newtile = 0;
+
+					/* Check if we've stepped into a new 8x8 tile */
+					/* TODO */
+					if ( (((x_acc + x_step) >> (FRAC + 3)) & MASK) != ((x_acc >> (FRAC + 3)) & MASK) )
+					{
+						newtile = 1;
+
+						if ( lasttile )
+							break;
+					}
+
+					// TODO!
+  					//x = (x + 1) & 0x7ff;
+					x = (x + 1);
+					x_acc += x_step;
+				}
+			}// if (yscale)
+			y_scale += y_step;
+		} /* for (y) */
+	}/* for (offs) */
 }
 
+
 VIDEO_START( tx1 )
 {
-	tx1_tilemap = tilemap_create(get_tx1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,128,64);
-	tilemap_set_transparent_pen(tx1_tilemap,0xff);
+	tx1_tilemap = tilemap_create(get_tx1_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 128, 64);
+	tilemap_set_transparent_pen(tx1_tilemap, 0xff);
+
+	/* Allocate a large bitmap that covers the three screens */
+	tx1_bitmap = auto_bitmap_alloc(768, 256, BITMAP_FORMAT_INDEXED16);
+	tx1_texture = render_texture_alloc(NULL, NULL);
 }
 
+VIDEO_EOF( tx1 )
+{
+	/* /VSYNC: Update TZ113 */
+	tx1_vregs.slin_val += tx1_vregs.slin_inc;
+}
+
+
+/* Experimental :) */
 VIDEO_UPDATE( tx1 )
 {
-	/* the video hardware seems to use one large tilemap, scroll it to the right position for each screen */
-	int xscrollamount = screen*256;
-	tilemap_set_scrollx(tx1_tilemap,0,xscrollamount);
+	int y;
+
+	if ( screen == 0 )
+	{
+		rectangle rect = { 0, 768 - 1, 0, 240 - 1 };
+
+//      tilemap_set_scrollx(tx1_tilemap, 0, scroll);
+		tilemap_draw(tx1_bitmap, &rect, tx1_tilemap, 0, 0);
+//      tx1_draw_road(tx1_bitmap, &rect);
+		tx1_draw_objects(tx1_bitmap, &rect);
+	}
 
+	for (y = 0; y < 240; ++y)
+		memcpy(BITMAP_ADDR16(bitmap, y, 0), BITMAP_ADDR16(tx1_bitmap, y, screen * 256), sizeof(UINT16) * 256);
 
-	tilemap_draw(bitmap,cliprect,tx1_tilemap,0,0);
 	return 0;
 }
 
-/*************/
-/* Buggy Boy */
-/*************/
+
+/***************************************************************************
+
+  Buggy Boy
+
+***************************************************************************/
+
+/* Road register bits */
+#define BB_RDFLAG_WAVE1		7
+#define BB_RDFLAG_WAVE0		6
+#define BB_RDFLAG_TNLMD1	5
+#define BB_RDFLAG_TNLMD0	4
+#define BB_RDFLAG_TNLF		3
+#define BB_RDFLAG_LINF		2
+#define BB_RDFLAG_RVA7		1
+#define BB_RDFLAG_WANGL		0
+
+/* Video registers */
+static struct
+{
+	UINT32	ba_val;
+	UINT32	ba_inc;
+
+	UINT32	bank_mode;
+
+	UINT16	h_val;
+	UINT16	h_inc;
+	UINT16	h_init;
+
+	UINT8	wa8;
+	UINT8	wa4;
+
+	UINT8	slin;
+	UINT8	slin_inc;
+
+	UINT16	wave_lfsr;
+	UINT16	scol;
+	UINT8	sky;
+	UINT16	gas;
+	UINT8	flags;
+	UINT8	shift;
+} vregs;
+
+
+UINT16 *buggyboy_objram;
+UINT16 *buggyboy_rcram;
+UINT16 *buggyboy_vram;
+UINT16 *buggybjr_vram;
+size_t buggyboy_objram_size;
+size_t buggyboy_rcram_size;
+
+tilemap *buggybjr_tilemap;
+tilemap *buggyboy_tilemap;
+
+UINT8 *chr_bmp;
+UINT8 *obj_bmp;
+UINT8 *rod_bmp;
 
 /***************************************************************************
 
@@ -83,324 +611,1154 @@
 ***************************************************************************/
 PALETTE_INIT( buggyboy )
 {
-        int i;
+	int i;
 
-	for (i = 0; i < 256;i++)
+	for (i = 0; i < 256; ++i)
 	{
-		int bit0,bit1,bit2,bit3,bit4,r,g,b;
-
-		bit0 = color_prom[i] & 1;
-		bit1 = (color_prom[i] >> 1) & 1;
-		bit2 = (color_prom[i] >> 2) & 1;
-		bit3 = (color_prom[i] >> 3) & 1;
-		bit4 = (color_prom[i+0x300] >> 2) & 1;
-                r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+		int bit0, bit1, bit2, bit3, bit4;
+		int r, g, b;
 
-		bit0 = color_prom[i+0x100] & 1;
-		bit1 = (color_prom[i+0x100] >> 1) & 1;
-		bit2 = (color_prom[i+0x100] >> 2) & 1;
-		bit3 = (color_prom[i+0x100] >> 3) & 1;
-		bit4 = (color_prom[i+0x300] >> 1) & 1;
-                g = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+		bit0 = BIT(color_prom[i], 0);
+		bit1 = BIT(color_prom[i], 1);
+		bit2 = BIT(color_prom[i], 2);
+		bit3 = BIT(color_prom[i], 3);
+		bit4 = BIT(color_prom[i + 0x300], 2);
+		r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+
+		bit0 = BIT(color_prom[i + 0x100], 0);
+		bit1 = BIT(color_prom[i + 0x100], 1);
+		bit2 = BIT(color_prom[i + 0x100], 2);
+		bit3 = BIT(color_prom[i + 0x100], 3);
+		bit4 = BIT(color_prom[i + 0x300], 1);
+		g = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+
+		bit0 = BIT(color_prom[i + 0x200], 0);
+		bit1 = BIT(color_prom[i + 0x200], 1);
+		bit2 = BIT(color_prom[i + 0x200], 2);
+		bit3 = BIT(color_prom[i + 0x200], 3);
+		bit4 = BIT(color_prom[i + 0x300], 0);
+		b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
 
-		bit0 = color_prom[i+0x200] & 1;
-		bit1 = (color_prom[i+0x200] >> 1) & 1;
-		bit2 = (color_prom[i+0x200] >> 2) & 1;
-		bit3 = (color_prom[i+0x200] >> 3) & 1;
-		bit4 = (color_prom[i+0x300]) & 1;
-                b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+		palette_set_color(machine, i, MAKE_RGB(r,g,b));
+	}
 
-		palette_set_color(machine,i,MAKE_RGB(r,g,b));
+	/* Characters use colours 192-255 */
+	for (i = 0; i < 256; ++i)
+	{
+		colortable[i] = 192 + color_prom[i + 0x400] + ((i & 0xc0) >> 2);
 	}
+}
 
+WRITE16_HANDLER( buggyboy_vram_w )
+{
+	COMBINE_DATA(&buggyboy_vram[offset]);
+	tilemap_mark_tile_dirty(buggyboy_tilemap, offset);
+}
 
-       /** Set up the colour lookups **/
+WRITE16_HANDLER( buggybjr_vram_w )
+{
+	COMBINE_DATA(&buggybjr_vram[offset]);
+}
 
-       /* Objects use colours 0-63 */
-       /* There are 2048 palette, however, this is expanded to 8192 */
+static TILE_GET_INFO( get_buggyboy_tile_info )
+{
+	int color, tilenum;
 
-	for (i = 0; i < 2048; i++)
-		colortable[256+i] = ((0xf-color_prom[i + 0x500]) & 0xf) + 48;
+	color = (buggyboy_vram[tile_index] >> 10) & 0x3f;
+	tilenum = (buggyboy_vram[tile_index]&0x03ff) | ((buggyboy_vram[tile_index] & 0x8000) >> 5);
 
-	for (i = 0; i < 2048; i++)
-	        colortable[256+2048+i] = ((0xf-color_prom[i + 0x500]) & 0xf) + 32;
+	SET_TILE_INFO(0, tilenum, color, 0);
+}
 
-	for (i = 0; i < 2048; i++)
-        	colortable[256+2048+2048+i] = ((0xf-color_prom[i + 0x500]) & 0xf) + 16;
+/***************************************************************************
 
-         /* Only this is used? */
-	for (i = 0; i < 2048; i++)
-		colortable[256+2048+2048+2048+i] = ((0xf-color_prom[i + 0x500]) & 0xf);
+  Buggy Boy Road Hardware
 
-	/* Road uses 64-127 */
-	/* Colour PROM only constitutes bits 0-3 - so expand 4-6*/
-       	for (i = 0; i < 256; i++)
-		colortable[256+8192+i] = (color_prom[i + 0x1500] & 0xf) + 64;
+  A mega-hack of TX-1 but without the second road.
 
-       	for (i = 0; i < 256; i++)
-		colortable[256+8192+256+i] = (color_prom[i + 0x1500] & 0xf) + 64 + 16;
+  There are two lists in road/common RAM (double buffered) starting at 0x800
+  and 0xa00:
 
-       	for (i = 0; i < 256; i++)
-		colortable[256+8192+256*2+i] = (color_prom[i + 0x1500] & 0xf) + 64 + 32;
+  0x1800 - 0x18ff:    Road line horizontal position word (128 entries).
+  0x19e0 - 0x19ef:    Vertical positions (starting line, water, tunnels etc)
+  0x19f0 - 0x19ff:    Horizontal positions (walls and tunnels)
+
+  Three TZ1113 accumulators are used to vary:
+  * Road camber (update per pixel)
+  * Road vertical scale/position (update per scanline)
+  * Road 'speed' (update per frame)
+
+  Road flags register (0x24E0):
+  7 : Water sparkle control 1
+  6 : Water sparkle control 0 ('WAVE0,1')
+  5 : Tunnel mode 1
+  4 : Tunnel mode 0 ('TNLMD0,1')
+  3 : Tunnel flag ('TNLF')
+  2 : Starting Line flag ('LINF')
+  1 : Road list select
+  0 : Wall angle enable ('WANGL')
+
+  Road PAL equations:
+
+  http://philwip.mameworld.info/buggyboy/PAL14H4.149.htm
+  http://philwip.mameworld.info/buggyboy/PAL14L4.151.htm
+  http://philwip.mameworld.info/buggyboy/PAL16H2.3.htm
+  http://philwip.mameworld.info/buggyboy/PAL16L8.4.htm
+  http://philwip.mameworld.info/buggyboy/PAL16L8.150.htm
 
-       	for (i = 0; i < 256; i++)
-		colortable[256+8192+256*3+i] = (color_prom[i + 0x1500] & 0xf) + 64 + 48;
+***************************************************************************/
+static void buggybjr_draw_road(UINT8 *bitmap)
+{
+#define X_ADJUST 384
+#define LOAD_HPOS_COUNTER( NUM )												\
+	ram_val = buggyboy_rcram[(rva_offs + 0x1f8 + (2*NUM)) >> 1];				\
+	rcrs10 = ram_val & 0xfc00 ? 0x0400 : 0x0000;								\
+	hp = vregs.wa8 + ((BIT(ram_val, 15) << 11) | rcrs10 | (ram_val & 0x03ff));	\
+	hp##NUM = hp & 0xff;														\
+	hp >>= 8;																	\
+	hps##NUM##0 = (BIT(hp, 0) || BIT(hp, 2)) && !BIT(hp, 3);					\
+	hps##NUM##1 = (BIT(hp, 1) || BIT(hp, 2)) && !BIT(hp, 3);					\
+	hps##NUM##2 = BIT(hp, 2);													\
+
+/* Check carry out calc */
+#define UPDATE_HPOS( NUM )				\
+	if (hp##NUM##_en)					\
+	{									\
+		if ((hp##NUM & 0xff) == 0xff)	\
+			hp##NUM##_cy = 1;			\
+		else							\
+			hp##NUM = hp##NUM + 1;		\
+	}									\
+
+	INT32 x;
+	UINT32 y;
+	UINT16 rva_offs;
+	UINT32 tnlmd0;
+	UINT32 tnlmd1;
+	UINT32 linf;
+	UINT32 tnlf;
+	UINT32 wangl;
+	UINT32 tcmd;
+	UINT32 wave0;
+	UINT32 wave1;
+	UINT32 rva20_6;
+
+	/* ROM/PROM lookup tables */
+	const UINT8 *rcols = (UINT8*)(memory_region(REGION_PROMS) + 0x1500);
+	const UINT8 *rom   = memory_region(REGION_GFX6);
+	const UINT8 *prom0 = rom + 0x4000;
+	const UINT8 *prom1 = rom + 0x4200;
+	const UINT8 *prom2 = rom + 0x4400;
+	const UINT8 *vprom = rom + 0x4600;
+
+	/* Extract constant values */
+	tcmd	 = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6);
+	tnlmd0   = BIT(vregs.flags, BB_RDFLAG_TNLMD0);
+	tnlmd1   = BIT(vregs.flags, BB_RDFLAG_TNLMD1);
+	linf     = BIT(vregs.flags, BB_RDFLAG_LINF);
+	tnlf     = BIT(vregs.flags, BB_RDFLAG_TNLF);
+	wangl    = BIT(vregs.flags, BB_RDFLAG_WANGL);
+	wave0    = BIT(vregs.flags, BB_RDFLAG_WAVE0);
+	wave1    = BIT(vregs.flags, BB_RDFLAG_WAVE1);
+	rva_offs = BIT(vregs.flags, BB_RDFLAG_RVA7) ? 0x800 : 0xc00;
 
-        /* Sky uses colours 128-191 directly - no lookup */
+	profiler_mark(PROFILER_USER1);
 
-        /* Characters use colours 192-255 */
-       	for (i = 0; i < 256; i++)
-		colortable[i] = (color_prom[i + 0x400] & 0xf) + 192;
+	for (y = 0; y < 240; ++y)
+	{
+		UINT8	rva0_6;
+		UINT8	ram_addr;
+		UINT16	rcrdb0_15;
+		UINT16	rcrs10;
+		UINT16	ls161_156_a;
+		UINT16	ls161;
+		UINT8	sld;
+		UINT32	rva8;
+		UINT32	rm0, rm1;
+		UINT32	rcmd;
+		UINT32	bnkcs = 1;
+
+		UINT32	x_offs;
+
+		/* Vertical positions shift register */
+		UINT32	ram_val;
+		UINT32	hp;
+		UINT32	vp1, vp2, vp3, vp4, vp5, vp6, vp7;
+
+		/* PAL outputs */
+		UINT32	ic4_o12;
+		UINT32	ic4_o13;
+		UINT32	ic149_o15;
+		UINT32	ic151_o14;
+
+		/* Horizontal positions */
+		UINT32	hp0, hp1, hp2, hp3;
+		UINT8	hps00, hps01, hps02;
+		UINT8	hps10, hps11, hps12;
+		UINT8	hps20, hps21, hps22;
+		UINT8	hps30, hps31, hps32;
+
+		/* Road pixel data planes */
+		UINT8	rc0 = 0, rc1 = 0, rc2 = 0, rc3 = 0;
+
+		/* Horizontal position counter carry out */
+		UINT8	hp0_cy = 0, hp1_cy = 0, hp2_cy = 0, hp3_cy = 0;
+
+		UINT8	*bmpaddr = bitmap + (y * 256);
+
+		UINT32	bank_cnt;
+		UINT8	roadpix;
+
+		rva8 = (vregs.h_val & 0x8000) || !(vregs.shift & 0x80);
+
+		/* Get RVA0_6 from TZ113 accumulator chain @ 122/123 */
+		rva0_6 = (vregs.h_val >> 7) & 0x7f;
+
+		/* For /WAVE bit logic later */
+		rva20_6 = ((rva0_6 >> 3) & 0xe) | ((rva0_6 & 2) >> 1);
+
+		/* RVA is inverted! */
+		ram_addr = (~rva0_6 & 0x7f) << 1;
+
+		/* Get the road RAM data for this line */
+		rcrdb0_15 = buggyboy_rcram[(rva_offs + ram_addr) >> 1];
+
+		/* If 15-10 == 000000, then 0 */
+		rcrs10 = rcrdb0_15 & 0xfc00 ? 0x0400 : 0x0000;
+
+		/* If 15-10 == 111111, then 1 */
+		ls161_156_a = (rcrdb0_15 & 0xfc00) == 0xfc00 ? 0x800 : 0x0000;
+
+		/* LS161 15-bit counter chain - loaded with RAM data (bar bits 10-13) */
+		ls161 =  ((rcrdb0_15 & 0x8000) >> 1) | ls161_156_a | rcrs10 | (rcrdb0_15 & 0x03ff);
+
+		/* SLD */
+		sld = (vprom[rva0_6] + vregs.slin) & 0x38;
+
+		/* Determine the x-offset */
+		x_offs = ls161 & 7;
+		ls161 &= ~7;
+
+		/* Fill vertical position shift register with bits for this line */
+		/* TODO; cheated slightly to shift stuff up one pixel*/
+		vp1 = buggyboy_rcram[(rva_offs + 0x1e2) >> 1] >= y ? 0 : 1;
+		vp2 = buggyboy_rcram[(rva_offs + 0x1e4) >> 1] >= y ? 0 : 1;
+		vp3 = buggyboy_rcram[(rva_offs + 0x1e6) >> 1] >= y ? 0 : 1;
+		vp4 = buggyboy_rcram[(rva_offs + 0x1e8) >> 1] >= y ? 0 : 1;
+		vp5 = buggyboy_rcram[(rva_offs + 0x1ea) >> 1] >= y ? 0 : 1;
+		vp6 = buggyboy_rcram[(rva_offs + 0x1ec) >> 1] >= y ? 0 : 1;
+		vp7 = buggyboy_rcram[(rva_offs + 0x1ee) >> 1] >= y ? 0 : 1;
+
+		/* Stuff */
+		rm0 = vp7 ? BIT(vregs.scol, 4) : BIT(vregs.scol, 12);
+		rm1 = vp7 ? BIT(vregs.scol, 5) : BIT(vregs.scol, 13);
+
+		/* Wall/tunnel control */
+		rcmd = (vp7 ? vregs.scol : vregs.scol >> 8) & 0xf;
+
+		/* Load 'em up */
+		LOAD_HPOS_COUNTER(0);
+		LOAD_HPOS_COUNTER(1);
+		LOAD_HPOS_COUNTER(2);
+		LOAD_HPOS_COUNTER(3);
+
+		/* Some PAL equations that we can evaluate outside of the x-loop */
+		ic4_o12 = (!vp1 && !vp2 && !vp6) || (!vp1 && !vp2 && vp7) || (vp4 && !vp6) || (vp4 && vp7);
+		ic4_o13 = (!vp1 && !vp2 && !vp5) || (!vp1 && !vp2 && vp7) || (vp3 && !vp5) || (vp3 && vp7);
+		ic149_o15 = (!vp5 && !vp6) || vp7 || !linf;
+		ic151_o14 = !BIT(sld, 3) || tnlmd0 || tnlmd1 || ic149_o15;
 
-}
+		/* Load the bank counter with accumulator bits 14-5 */
+		bank_cnt = (vregs.ba_val >> 5) & 0x3ff;
 
+		bnkcs = 1;
 
-WRITE16_HANDLER( buggyb1_vram_w )
-{
-	COMBINE_DATA(&buggyb1_vram[offset]);
-	tilemap_mark_tile_dirty(buggyb1_tilemap,offset);
-}
+		for (x = -x_offs; x < 256; ++x)
+		{
+			UINT16	ls283_159;
+			UINT32	ls283_159_co;
+			UINT16	rha;
+			UINT32	rom_flip;
+			UINT32	rom_en;
+			UINT32	pix;
+			UINT32	hp0_en, hp1_en, hp2_en, hp3_en;
+			UINT32	_rorevcs = 0;
+
+			/* The many PALs */
+
+			UINT32	ic149_o16;
+
+			UINT32	ic4_o18;
+			UINT32	ic3_o15;
+			UINT32	ic150_o12 = 0;
+			UINT32	ic150_o16;
+			UINT32	ic150_o17;
+			UINT32	ic150_o18;
+			UINT32	ic150_o19;
+			UINT32	ic151_o15;
+			UINT32	ic151_o16;
+			UINT32	ic151_o17;
+
+			UINT32	rcsd0_3 = 0;
+
+			UINT32	sld5 = BIT(sld, 5);
+			UINT32	sld4 = BIT(sld, 4);
+			UINT32	mux;
+
+			UINT32	cprom_addr;
+
+			UINT8	px0, px1, px2, px3;
+
+			/* Counter Q10-7 are added to 384 */
+			ls283_159_co = (ls283_159 = (ls161 & 0x780) + X_ADJUST) & 0x800;
+			rom_flip = ls283_159 & 0x200 ? 0 : 1;
+			rom_en = !(ls283_159 & 0x400) && !(ls283_159_co ^ (ls161 & 0x800));
+
+			/* Strip pixel number */
+			pix = (ls161 & 7) ^ 7;
+
+			/* Horizotnal position counter enables - also used as PAL inputs */
+			hp0_en = !(hp0_cy || hps02);
+			hp1_en = !(hp1_cy || hps12);
+			hp2_en = !(hp2_cy || hps22);
+			hp3_en = !(hp3_cy || hps32);
 
-WRITE16_HANDLER( buggyboy_vram_w )
-{
-	COMBINE_DATA(&buggyboy_vram[offset]);
-	tilemap_mark_tile_dirty(buggyboy_tilemap,offset);
-}
+			_rorevcs = !( (rom_en && rom_flip) || (!rom_en && (ls161 & 0x4000)) );
 
+			/* Load in a new road gfx strip */
+			if ( (ls161 & 7) == 0 )
+			{
+				UINT8 d0 = 0;
+				UINT8 d1 = 0;
 
-static TILE_GET_INFO( get_buggyb1_tile_info )
-{
-	int color, tileno;
+				/* TODO: ROM data is 0xff if not enabled. */
+				if (rom_en)
+				{
+					UINT8  rom_data;
+					UINT16 prom_addr;
+
+					/* 6 bit road horizontal address */
+					rha = (ls283_159 & 0x180) | (ls161 & 0x78);
+
+					if (rom_flip)
+						rha ^= 0x1f8;
+
+					/* Get road chunk first */
+					rom_data = rom[(1 << 13) | (rha << 4) | rva0_6];
+					prom_addr = (rom_flip ? 0x80 : 0) | (rom_data & 0x7f);
+
+					rc0 = prom0[prom_addr];
+					rc1 = prom1[prom_addr];
+					rc2 = prom2[prom_addr];
+
+					/* Now get the dirt chunk */
+					rom_data = rom[(rha << 4) | rva0_6];
+					prom_addr = 0x100 | rom_data;
+
+					d0 = prom0[prom_addr];
+					d1 = prom1[prom_addr];
+				}
+				else
+				{
+					/*
+                        TODO: When ROM is not enabled, data = 0xff
+                        But does anybody care?
+                    */
+					rc0 = rc1 = rc2 = rc3 = 0;
+				}
+
+				/* The data is mixed by two TZ0314 PALs */
+				if (BIT(sld, 4))
+				{
+					if (BIT(sld, 5))
+						d1 = ~d1;
+
+					rc3 = d0 & d1;
+
+					if (rom_flip)
+						rc3 = BITSWAP8(rc3, 0, 1, 2, 3, 4, 5, 6, 7);
+				}
+				else
+					rc3 = 0;
+			}
 
-	color = ((buggyb1_vram[tile_index] >>10) & 0x3f);
-	tileno = (buggyb1_vram[tile_index]&0x03ff) | ((buggyb1_vram[tile_index] & 0x8000) >> 5);
+			/* NEW!!!! Road camber */
+			if (vregs.bank_mode == 0)
+			{
+				if ( BIT(vregs.ba_val, 23) )
+					bnkcs = 1;
+				else if (vregs.ba_val & 0x007f8000)
+					bnkcs = 0;
+				else
+					bnkcs = bank_cnt < 0x300;
+			}
+			else
+			{
+				if ( BIT(vregs.ba_val, 23) )
+					bnkcs = 0;
+				else if (vregs.ba_val & 0x007f8000)
+					bnkcs = 1;
+				else
+					bnkcs = bank_cnt >= 0x300;
+			}
 
-	SET_TILE_INFO(0,tileno,color,0);
-}
+			px0 = BIT(rc0, pix);
+			px1 = BIT(rc1, pix);
+			px2 = BIT(rc2, pix);
+			px3 = BIT(rc3, pix);
+
+			/*
+                Uh oh...
+            */
+			if (vp2)
+				ic4_o18 = (hps00 && hps01 && hp3_en && !hps30)		||
+						  (!hp0_en && hps01 && hp3_en && !hps30)	||
+						  (hps00 && hps01 && !hps31)				||
+						  (!hp0_en && hps01 && !hps31)				||
+						  vp7;
+			else
+				ic4_o18 = !vp1;
 
-static TILE_GET_INFO( get_buggyboy_tile_info )
-{
-	int color, tileno;
 
-	color = ((buggyboy_vram[tile_index] >>10) & 0x3f);
-	tileno = (buggyboy_vram[tile_index]&0x03ff) | ((buggyboy_vram[tile_index] & 0x8000) >> 5);
+			if (tnlf)
+				ic3_o15 = (vp4 && !vp6 && !hp2_en && hps21)		||
+						  (vp4 && !vp6 && hps20 && hps21)		||
+						  (vp1 && !vp4 && !tnlmd1 && !tnlmd0)	||
+						  (vp1 && !vp3 && !tnlmd1 && !tnlmd0)	||
+						  (hp1_en && !hps10 && vp3 && !vp5)		||
+						  (!hps11 && vp3 && !vp5);
+			else
+				ic3_o15 = !ic4_o18;
 
-	SET_TILE_INFO(0,tileno,color,0);
-}
+			ic151_o17 = (_rorevcs && !tnlmd1 && tnlmd0)		||
+						(!_rorevcs && tnlmd1 && !tnlmd0)	||
+						(_rorevcs && ic4_o12)				||
+						(!_rorevcs && ic4_o13);
+
+			if (!ic3_o15)
+				ic151_o15 = (px0 && (bnkcs && wangl))	||
+							(px1 && (bnkcs && wangl))	||
+							ic151_o17					||
+							px2							||
+							!tnlf;
+			else
+				ic151_o15 =	!tnlf;
 
+			ic151_o16 = (px1 && !px0 && tnlmd1 && !tnlmd0)	||
+						(px2 && tnlmd1 && tnlmd0)			||
+						ic149_o15;
 
-/*
+			mux = BIT(tcmd, 3) ? ic149_o15 : ic151_o16;
+
+			ic150_o19 = (px2 && !rva8)	||
+						!bnkcs			||
+						!mux			||
+						!ic151_o15;
+
+			/* Don't calculate the pixel colour if not visible */
+			if (ic150_o19)
+			{
+				ic149_o16 = (_rorevcs && !px2 && ic151_o15)									||
+							(tnlf && vp5 && !vp7 && px2 && !tnlmd0 && !tnlmd1 && ic151_o15)	||
+							(tnlf && vp6 && !vp7 && px2 && !tnlmd0 && !tnlmd1 && ic151_o15)	||
+							(tnlf && !ic4_o18);
+
+				ic150_o16 = (px2 && mux && rm1)			||
+							(mux && rva8 && ic151_o15)	||
+							(!px0 && mux)				||
+							!ic151_o15;
+
+				{
+					UINT32 a = mux && ic151_o15;
+
+					ic150_o17 = (a && !rm0 && px0)	||
+								(a && !px1)			||
+								(rva8 && a);
+
+					ic150_o18 = (a && !px2) ||
+								(rva8 && a);
+				}
+
+				if (ic151_o14)
+					ic150_o12 = rva8 || !mux || !ic151_o15				||
+								(px2 && px1 && px0 && rm1 && !rm0)		||
+								(!px2 && px1 && px0 && !sld4 && rm0)	||
+								(px2 && px0 && !sld5 && !rm1 && !rm0)	||
+								(px2 && !px1 && px0 && !sld5 && !rm1)	||
+								(px2 && px1 && px0 && !sld5 && !sld4)	||
+								(px2 && px1 && px0 && !sld4 && rm1)		||
+								(!px2 && !px3 && !rm0)					||
+								(!px1 && !px3 && rm1)					||
+								(!px2 && !px1 && !px3)					||
+								(!px0 && !px3);
+				else
+					ic150_o12 = 0;
+
+				if (vp6 || ic151_o16)
+				{
+					UINT32 ic150_i5 = BIT(tcmd, 3) ? ic149_o15 : ic151_o16;
+
+					if ( !(ic151_o15 && ic150_i5) )
+						cprom_addr = (tcmd & 0x7) | (ic151_o16 ? 0x08 : 0);
+					else
+						cprom_addr = rcmd;
+
+					/* Inverted! */
+					cprom_addr = ((~cprom_addr) & 0xf) << 4;
+				}
+				else
+					cprom_addr = 0xf0;
 
- Applies to both versions of Buggy Boy
+				cprom_addr |= (ic149_o16 ? 0x8 : 0) |
+							  (ic150_o18 ? 0x4 : 0) |
+							  (ic150_o17 ? 0x2 : 0) |
+							  (ic150_o16 ? 0x1 : 0);
+
+				/* Lower four bits of colour output come from PROM BB7 @ 188 */
+				rcsd0_3 = rcols[cprom_addr] & 0xf;
+
+				{
+					UINT32 lfsr = vregs.wave_lfsr;
+					UINT32 wave =
+								(wave0 ^ BIT(lfsr, 0))	&&
+								(wave1 ^ BIT(lfsr, 3))	&&
+								BIT(lfsr, 5)			&&
+								!BIT(lfsr, 15)			&&
+								BIT(lfsr, 11)			&&
+								BIT(lfsr, 13)			&&
+								(rva20_6 < ((lfsr >> 8) & 0xf));
 
- Each object entry occupies 16 bytes:
+					roadpix = 0x40 | (wave ? 0 : 0x20) | (ic150_o12 ? 0x10 : 0) | rcsd0_3;
+				}
+			}
+			else
+				roadpix = 0;
 
- Byte 0: Sprite code
- Byte 1: Y-Position (bit 15 has some significance)
 
- Byte 2: Scale
- Byte 3: Scale
+			/* Horizontal position counters */
+			if (x >= 0)
+			{
+				*bmpaddr++ = roadpix;
 
- Byte 4: Scale     0=Tiny  0x7f=Normal   0xff=Huge   ?
- Byte 5: Bit 7 = X-Flip, Bit 4 = chunk bank, Bit 5-6 = palette select, Bit 0-1 = palette related (PC_TMP)
+				UPDATE_HPOS(0);
+				UPDATE_HPOS(1);
+				UPDATE_HPOS(2);
+				UPDATE_HPOS(3);
 
- Byte 6: Scale
- Byte 7: Scale
+				/* Update the LFSR */
+				vregs.wave_lfsr = (vregs.wave_lfsr << 1) | (BIT(vregs.wave_lfsr, 6) ^ !BIT(vregs.wave_lfsr, 15));
 
- Byte 8: X position bits 0-7
- Byte 9: X position bits 8-9
+				/* Increment the bank counter */
+				bank_cnt = (bank_cnt + 1) & 0x7ff;
+			}
 
- Remaining bytes are unusued.
+			/* X pos */
+			ls161 = (ls161 + 1) & 0x7fff;
+		}
 
-*/
+		/* WANGL active? Update the 8-bit counter */
+		if ( wangl )
+		{
+			if ( BIT(vregs.flags, BB_RDFLAG_TNLMD0) )
+				vregs.wa8 -= 1;
+			else
+				vregs.wa8 += 1;
+		}
+
+		/* No carry out - just increment */
+		if ( vregs.wa4 != 0xf )
+			vregs.wa4 += 1;
+		else
+		{
+			/* Carry out; increment again on /TMG2S rise */
+			if ( wangl )
+			{
+				if ( BIT(vregs.flags, BB_RDFLAG_TNLMD0) )
+					vregs.wa8 -= 1;
+				else
+					vregs.wa8 += 1;
+			}
+			vregs.wa4 = 1;
+		}
+
+		/* Update accumulator */
+		vregs.h_val += vregs.h_inc;
+
+		/* Seems correct */
+		{
+			UINT8 sf = vregs.shift;
+
+			if ((vregs.shift & 0x80) == 0)
+			{
+				vregs.shift <<= 1;
+
+				if ((sf & 0x08) == 0)
+					vregs.shift |= BIT(vregs.h_val, 15);
+			}
+
+			if ((sf & 0x08) && !(vregs.shift & 0x08))
+				vregs.h_inc = vregs.gas;
+		}
+
+		/* Finally, increment the banking accumulator */
+		vregs.ba_val = (vregs.ba_val + vregs.ba_inc) & 0x00ffffff;
+		}
+
+	profiler_mark(PROFILER_END);
+}
 
-/* Rewrite once scale parameters etc. are discovered */
-static void draw_objects(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int xdrawoffset)
+
+/***************************************************************************
+
+    Buggy Boy Object Drawing
+
+    X-scaling isn't quite right but you wouldn't notice...
+
+    -------- xxxxxxxx       Object number
+    xxxxxxxx --------       Y position
+
+    xxxxxxxx xxxxxxxx       Y scale value
+
+    -------- xxxxxxxx       X scale
+                             00 = Invisible?
+                             80 = 1:1
+                             FF = Double size
+    xxxxxxxx --------       Attributes
+
+    xxxxxxxx xxxxxxxx       Y scale delta
+
+    ------xx xxxxxxxx       X position
+
+**************************************************************************/
+static void buggyboy_draw_objs(UINT8 *bitmap)
 {
-	int offs;
+#define FRAC	16
 
-	UINT8 PROM_lookup;
-	UINT16 ROM_lookup;
+	UINT32 offs;
 
-	UINT8 *rom_lut  = (UINT8 *)memory_region(REGION_USER3);             /* Object index ROM */
-	UINT8 *prom_lut = (UINT8 *)memory_region(REGION_PROMS)+0x1600;      /* Object index PROM */
+	/* The many lookup table ROMs */
+	const UINT8 *const bug13  = (UINT8*)memory_region(REGION_USER3);
+	const UINT8 *const bug18s = (UINT8*)memory_region(REGION_USER3) + 0x2000;
+	const UINT8 *const bb8    = (UINT8*)memory_region(REGION_PROMS) + 0x1600;
 
-	UINT8 *ROM_LUTA = (UINT8 *)memory_region(REGION_USER2);             /* Object LUT (lower byte) */
-	UINT8 *ROM_LUTB = (UINT8 *)memory_region(REGION_USER2)+0x8000;      /* Object LUT (lower byte) */
-	UINT8 *ROM_CLUT = (UINT8 *)memory_region(REGION_USER3)+0x2000;      /* Object palette LUT */
+	const UINT8 *const bug16s = (UINT8*)memory_region(REGION_USER2);
+	const UINT8 *const bug17s = (UINT8*)memory_region(REGION_USER2) + 0x8000;
 
-	for (offs = 0x0; offs <= (bb_objectram_size)/2; offs += 8)
-	{
-		int inc,last;
-		int bit_12, PSA0_12, PSA, object_flip_x;
-		int index_y,index_x,index=0;
+	const UINT8 *const bb9o = (UINT8*)memory_region(REGION_PROMS) + 0x500;
+	const UINT8 *const bb9e = (UINT8*)memory_region(REGION_PROMS) + 0xd00;
+
+	const UINT8 *const pixdata_rgn = (UINT8*)memory_region(REGION_GFX2);
 
+	profiler_mark(PROFILER_USER1);
 
-		if((bb_objram[offs+0] >> 8) == 0xff)   /* End of object list marker? */
-			return;
+	for (offs = 0; offs <= buggyboy_objram_size; offs += 8)
+	{
+		UINT32	x;
+		UINT32	y;
+		UINT32	gxflip;
+
+		UINT32	x_scale;
+		UINT32	x_step;
+		UINT16	y_scale;
+		UINT16	y_step;
+
+		UINT8	pctmp0_7;
+		UINT8	code;
+
+		/* Check for end of object list */
+		if ( (buggyboy_objram[offs] & 0xff00) == 0xff00 )
+			break;
 
-		/* The object code is fed into ROM and PROM to generate a lookup into a pair of ROMs */
-		PROM_lookup = bb_objram[offs] & 0xff;
-		ROM_lookup = ((bb_objram[offs] & 0xff) << 4)  | ((bb_objram[offs+1]>>11) & 0xf);
+		/* X scale */
+		x_scale = buggyboy_objram[offs + 2] & 0xff;
 
-		if(rom_lut[ROM_lookup] == 0xff) /* Do not draw object  */
+		/* TODO: Confirm against hardware? */
+		if ( x_scale == 0 )
 			continue;
 
+		/* 16-bit y-scale accumulator */
+		y_scale = buggyboy_objram[offs + 1];
+		y_step  = buggyboy_objram[offs + 3];
+
+		/* Object number */
+		code = buggyboy_objram[offs] & 0xff;
+
+		/* Attributes */
+		pctmp0_7 = buggyboy_objram[offs + 2] >> 8;
 
-		/* Calculate 13-bit index into object lookup ROMs that holds 8x8 chunk sequence */
-		bit_12 = (((bb_objram[offs]>>7)&0x1) | ((bb_objram[offs]>>6)&0x1)) <<12;
-		PSA0_12 = ( ( (prom_lut[PROM_lookup]&0xf)<<8) | rom_lut[ROM_lookup] | bit_12) & 0x1fff;
+		/* Global x-flip */
+		gxflip = (pctmp0_7 & 0x80) >> 7;
 
-		PSA = (PSA0_12 << 2);
+		/* Add 1 to account for line buffering */
+		y = (buggyboy_objram[offs] >> 8) + 1;
 
-		object_flip_x = (bb_objram[offs+2]>>15)&0x1;
+		if (code == 0xa8)
+			code = 0xa8;
 
-		for (index_y=0; index_y<16; index_y++)
+		for (; y < 240; ++y)
 		{
-			if (object_flip_x)
-			{
-				index_x=16;
-				inc=-1;
-				last=0;
-			}
-			else
-			{
-				index_x=0;
-				inc=1;
-				last=16;
-			}
+			UINT32	rom_addr2	= 0;
+			UINT8	bug17s_data	= 0;
+			UINT8	bug16s_data;
+
+			/* Are we drawing on this line? */
+
+			// TODO: See big lampposts.
+			if ( y_scale & 0x8000 )
+				break;
 
-			while(index_x!=last)
 			{
-				/* Bit 14 of chunk_number = data_end, related to end of line */
-				int chunk_number = (ROM_LUTB[PSA+index]<<8) | ROM_LUTA[PSA+index];    // PSBB0-15
+				UINT32	psa0_12;
+				UINT32	bug13_addr;
+				UINT32	bug13_data;
+				UINT32	rom_addr;
+				UINT32	x_acc;
+				UINT32	newtile = 1;
+				UINT32	dataend = 0;
+				UINT8	data1 = 0;
+				UINT8	data2 = 0;
+				UINT32	xflip = 0;
+				UINT32	opcd10_11;
+				UINT32	opcd8_9;
+				UINT32	opcd0_11 = 0;
+				UINT32	lasttile = 0;
+
+				/* Use the object code to lookup the tile sequence data */
+				bug13_addr = code << 4;
+				bug13_addr |= ((y_scale >> 11) & 0xf);
+				bug13_data = bug13[bug13_addr];
+
+				/* Reached the bottom of the object */
+				if (bug13_data == 0xff)
+					break;
+
+				psa0_12  = (((code & 0x80) << 5) | ((code & 0x40) << 6)) & 0x1000;
+				psa0_12 |= ((bb8[code] << 8) | bug13_data) & 0x1fff;
+
+				/* Static part of the BUG17S/BUG16S ROM address */
+				rom_addr = (psa0_12 & ~0xff) << 2;
+
+				/* Prepare the x-scaling */
+				x_step = (128 << FRAC) / x_scale;
+				x_acc = (psa0_12 & 0xff) << (FRAC + 5);
+
+				/* TODO Add note */
+				x = buggyboy_objram[offs + 4] & 0x3ff;
+
+				for (;;)
+				{
+					#define MASK	0x3ff
+
+					/* Get data and attributes for an 8x8 tile */
+					if (newtile)
+					{
+						UINT32	pscb0_11;
+						UINT32	psbb0_15;
+						UINT32	psbb6_7;
+						UINT32	rombank;
+						UINT8	*romptr;
+						UINT32	bug18s_data;
+						UINT32	low_addr = ((x_acc >> (FRAC + 3)) & MASK);
+
+						/*
+                            Objects are grouped by width (either 16, 8 or 4 tiles) in
+                            the LUT ROMs. The ROM address lines therefore indicate
+                            width and are used to determine the correct scan order
+                            when x-flip is set.
+                        */
+						if (gxflip)
+						{
+							UINT32	xor_mask;
+
+							if	( BIT(psa0_12, 11) || !BIT(psa0_12, 12) )
+								xor_mask = 0xf;
+							else if	( !BIT(psa0_12, 9) )
+								xor_mask = 0x7;
+							else
+								xor_mask = 0x3;
+
+							rom_addr2 = rom_addr + (low_addr ^ xor_mask);
+						}
+						else
+							rom_addr2 = rom_addr + low_addr;
+
+						bug17s_data = bug17s[rom_addr2 & 0x7fff];
+
+						if ((bug17s_data & 0x40) && dataend)
+							lasttile = 1;
+
+						dataend |= (bug17s_data & 0x40);
+
+						/* Retrieve data for an 8x8 tile */
+						bug16s_data = bug16s[rom_addr2];
+						psbb0_15 = (bug17s_data << 8) | bug16s_data;
+						psbb6_7 = (BIT(psbb0_15, 12) ? psbb0_15 : (pctmp0_7 << 6)) & 0xc0;
+
+						/* Form the tile ROM address */
+						pscb0_11 = ((((psbb0_15 & ~0xc0) | psbb6_7) << 3) | ((y_scale >> 8) & 7)) & 0x7fff;
+
+						/* Choose from one of three banks */
+						rombank = ((BIT(pctmp0_7, 4) << 1) | BIT(psbb0_15, 13)) & 3;
+
+						/* TODO: Remember to put all the data into one GFX region */
+						romptr = (UINT8*)(pixdata_rgn + rombank * (0x8000 * 2));
+
+						/* Get raw 8x8 pixel row data */
+						data1 = *(pscb0_11 + romptr);
+						data2 = *(pscb0_11 + romptr + 0x8000);
+
+						/* Determine flip state (global XOR local) */
+						xflip = gxflip ^ !BIT(psbb0_15, 15);
+
+						bug18s_data = bug18s[ (BIT(pctmp0_7, 4)  << 13)	|
+											  (BIT(psbb0_15, 13) << 12)	|
+											  (psbb0_15 & ~0xf0c0)		|
+											  psbb6_7 ];
+
+						/* Get the colour data. Note that bits 11 and 10 are inverted */
+						opcd10_11 = ((pctmp0_7 << 8) & 0xc00) ^ 0xc00;
+						opcd8_9 = ((pctmp0_7 & 0x60) << 3);
+						opcd0_11 = (opcd10_11 | opcd8_9 | bug18s_data) & 0xfff;
+
+						newtile = 0;
+					}
+
+					/* Draw a pixel? */
+					if (x < 256)
+					{
+						UINT8	pix;
+						UINT8	bit;
+
+						bit	= (x_acc >> FRAC) & 7;
+
+						if (xflip)
+							bit ^= 7;
+
+						pix = (((data1 >> bit) & 1) << 1) | ((data2 >> bit) & 1);
+
+						/* Write the pixel if not transparent */
+						if ( !(!(opcd0_11 & 0x80) && !pix) )
+						{
+							UINT8 color;
+							UINT32 bb9_addr;
+
+							bb9_addr = ((opcd0_11 << 1) & 0x600) | ((opcd0_11 & 0x7f) << 2) | pix;
+							color = ((opcd0_11 >> 6) & 0x30);
+
+							/* Inverted on schematic */
+							if (x & 1)
+								color = ~(color | bb9o[bb9_addr]) & 0x3f;
+							else
+								color = ~(color | bb9e[bb9_addr]) & 0x3f;
+
+							*(bitmap + 256*y + x) = 0x40 | color;
+						}
+					}
+
+					/* Check if we've stepped into a new 8x8 tile */
+					if ( (((x_acc + x_step) >> (FRAC + 3)) & MASK) != ((x_acc >> (FRAC + 3)) & MASK) )
+					{
+						if (lasttile)
+							break;
+
+						newtile = 1;
+					}
+
+  					x = (x + 1) & 0x3ff;
+					x_acc += x_step;
+				}
+			}// if (yscale)
+			y_scale += y_step;
+		} /* for (y) */
+	}/* for (offs) */
+
+	profiler_mark(PROFILER_END);
+}
 
-				int sx = (bb_objram[offs+4])+(index_x*8);
-				int sy = (bb_objram[offs+0] >> 8)+(index_y*7);
 
-				/* Calculate the 14-bit CLUT ROM address */
-				int bit13 = (bb_objram[offs+2] & 0x1000) << 1;
-				int bit12 = (chunk_number & 0x2000) >> 1;
+/*
+    2400-24FF is road control (R/W)
 
-				/* Tile Number bit 12 -> 1 = Bits 6-7 of BUG16s or bits 8-9 of PC_TMP */
-				int bits6_and_7 = (chunk_number & 0x1000 ? chunk_number : bb_objram[offs+2] >> 2) & 0xc0;
-				int CLUT_ROM_ADDR = (chunk_number & 0xf3f) + bits6_and_7 + bit12 + bit13;
+    /GAS = 24XX:
+    /BASET0 = 2400-F, 2410-F
+    /BASET1 = 2420-F, 2430-F
+    /BSET   = 2440-F, 2450-F
+    /HASET  = 2460-F, 2470-F
+    /HSET   = 2480-F, 2490-F
+    /WASET  = 24A0-F, 24B0-F
+    /FLAGS  = 24E0-F, 24F0-F
+*/
+WRITE16_HANDLER( buggyboy_gas_w )
+{
+	offset <<= 1;
 
-				/* Now form the 12 bit OPCD */
-				int bits10_and_11 = 0xc00 - (bb_objram[offs+2] & 0xc00);
-				int OPCS = (bb_objram[offs+2] & 0x6000) >> 5;                     // bits 8 and 9
-				int OPCD = (ROM_CLUT[CLUT_ROM_ADDR] + OPCS + bits10_and_11) & 0xfff;
+	switch (offset & 0xe0)
+	{
+		case 0x00:
+		{
+			vregs.ba_inc &= ~0x0000ffff;
+			vregs.ba_inc |= data;
 
-				int tmp = (OPCD&0x7f);      // bits 0-6
-				int tmp2= (OPCD&0x300)>>1;  // bits 9,8  (bit 7 is not there)
-				int tmp3 = bits10_and_11 >> 1;
+			if ( !(offset & 2)  )
+				vregs.ba_val &= ~0x0000ffff;
 
-				int color = (tmp + tmp2 + tmp3);
-				int trans;
+			break;
+		}
+		case 0x20:
+		{
+			data &= 0xff;
+			vregs.ba_inc &= ~0xffff0000;
+			vregs.ba_inc |= data << 16;
 
-				/* 8x8 chunk ROM bank (0-2) */
-				int bank = (((bb_objram[offs+2]>>11)&0x2) | ((chunk_number>>13)&0x1))+1;
-				int zoomx = 0xffff; //object_ram[offs+6]<<8;
-				int zoomy = 0xffff; //object_ram[offs+4]<<8;
-				int flipx = ((chunk_number>>15) & 0x1) ^ object_flip_x;
-				int flipy = 0;
+			vregs.bank_mode = data & 1;
 
-				const gfx_element *gfx = machine->gfx[bank];
+			if ( !(offset & 2)  )
+				vregs.ba_val &= ~0xffff0000;
 
-				if(!(OPCD & 0x80))  /* Seems to work! */
-					trans = TRANSPARENCY_PEN;
-				else
-					trans = TRANSPARENCY_NONE;
+			break;
+		}
+		case 0x40:
+		{
+			/* Ignore data? */
+			if ( offset & 2 )
+			{
+				vregs.ba_val = (vregs.ba_inc + vregs.ba_val) & 0x00ffffff;
+			}
+
+			break;
+		}
+		case 0x60:
+		{
+			vregs.h_inc = data;
+			vregs.shift = 0;
+
+			if ( !(offset & 2)  )
+				vregs.h_val = 0;
+
+			break;
+		}
+		case 0x80:
+		{
+			/* Ignore data? */
+			if ( offset & 2 )
+				vregs.h_val += vregs.h_inc;
+			break;
+		}
+		case 0xa0:
+		{
+			vregs.wa8 = data >> 8;
+			vregs.wa4 = 0;
+			break;
+		}
+		case 0xe0:
+		{
+			cpunum_set_input_line(1, INPUT_LINE_TEST, CLEAR_LINE);
+			vregs.flags = data;
+			break;
+		}
+	}
+
+	/* Value is latched by LS373 76/77 */
+	vregs.gas = data;
+}
 
-				index_x+=inc;
-				index++;
 
-				drawgfxzoom(bitmap, gfx,
-					chunk_number,
-					color,
-					flipx,flipy,
-					sx-xdrawoffset,sy,
-					cliprect,trans,0,
-					zoomx,zoomy);
-                }
-           }
-    }
+WRITE16_HANDLER( buggyboy_sky_w )
+{
+	vregs.sky = data;
 }
 
+WRITE16_HANDLER( buggyboy_slincs_w )
+{
+	if ( offset == 1 )
+		vregs.slin_inc = data;
+	else
+		vregs.slin_inc = vregs.slin = 0;
+}
 
-VIDEO_START( buggyb1 )
+WRITE16_HANDLER( buggyboy_scolst_w )
 {
-	buggyb1_tilemap = tilemap_create(get_buggyb1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,64);
-        tilemap_set_transparent_pen(buggyb1_tilemap, 0);
+	vregs.scol = data;
 }
 
 
+
 VIDEO_START( buggyboy )
 {
-	buggyboy_tilemap = tilemap_create(get_buggyboy_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,128,64);
-        tilemap_set_transparent_pen(buggyboy_tilemap, 0);
+	buggyboy_tilemap = tilemap_create(get_buggyboy_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 128, 64);
+	tilemap_set_transparent_pen(buggyboy_tilemap, 0);
 }
 
 
 
-/* Gradient sky - 'scrolls' up and down */
-static void draw_sky(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
+VIDEO_UPDATE( buggyboy )
 {
-	int x,y,colour;
-	for (y = cliprect->min_y; y <= cliprect->max_y; y++)
-	{
-		for (x = cliprect->min_x; x <= cliprect->max_x; x++)
-		{
-	        colour = (((*bb_sky & 0x7f) + y)>>2)&0x3f;
-			*BITMAP_ADDR16(bitmap, y, x) = machine->pens[0x80 + colour];
-		}
-	}
+	/* The video hardware seems to use one large tilemap, scroll it to the right position for each screen */
+	int xscrollamount = screen * 256;
+	tilemap_set_scrollx(buggyboy_tilemap, 0, xscrollamount);
+
+	tilemap_draw(bitmap, cliprect, buggyboy_tilemap, TILEMAP_DRAW_OPAQUE, 0);
+	return 0;
 }
 
 
-/*
-The current layer mixing implementation is incorrect.
+VIDEO_EOF( buggyboy )
+{
+	/* /VSYNC: Update TZ113 @ 219 */
+	vregs.slin += vregs.slin_inc;
+
+	/* /VSYNC: Clear wave LFSR */
+	vregs.wave_lfsr = 0;
+}
 
-On the actual PCB, the GAME OVER sign chains should be behind the text but the
-objects are often in front of the characters.
 
-See schematic page 11 for mixing logic.
+VIDEO_START( buggybjr )
+{
+	/* Allocate some bitmaps */
+	chr_bmp = auto_malloc(sizeof(UINT8) * 256 * 240);
+	obj_bmp = auto_malloc(sizeof(UINT8) * 256 * 240);
+	rod_bmp = auto_malloc(sizeof(UINT8) * 256 * 240);
+}
 
+/*
+    Draw the tilemap with scrolling
 */
+static void buggyboy_draw_char(UINT8 *bitmap)
+{
+	INT32 x, y;
+	UINT32 scroll_x, scroll_y;
+	UINT8 *gfx1, *gfx2;
 
+	profiler_mark(PROFILER_USER3);
 
-VIDEO_UPDATE( buggyb1 )
-{
-	if(*bb_sky & 0x80)
-	{
-		draw_sky(machine, bitmap, cliprect);
-		tilemap_draw(bitmap,cliprect,buggyb1_tilemap,0,0);
-		draw_objects(machine, bitmap,cliprect,0);
-	}
-	else
+	/* 2bpp characters */
+	gfx1 = memory_region(REGION_GFX1);
+	gfx2 = memory_region(REGION_GFX1) + 0x4000;
+
+	/* X/Y scroll values are the last word in char RAM */
+	scroll_y = (buggybjr_vram[0x7ff] >> 10) & 0x3f;
+	scroll_x = buggybjr_vram[0x7ff] & 0x1ff;
+
+	for (y = 0; y < 240; ++y)
 	{
-		tilemap_draw(bitmap,cliprect,buggyb1_tilemap,TILEMAP_DRAW_OPAQUE,0);
-		draw_objects(machine, bitmap,cliprect,0);
+		UINT32 d0 = 0, d1 = 0;
+		UINT32 colour = 0;
+		UINT32 y_offs;
+		UINT32 x_offs;
+		UINT32 y_gran;
+
+		/* There's no y-scrolling between scanlines 0 and 1 */
+		if (y < 64)
+			y_offs = y;
+		else
+		{
+			y_offs = (y + (scroll_y | 0xc0) + 1) & 0xff;
+
+			/* Clamp */
+			if (y_offs < 64)
+				y_offs |= 0xc0;
+		}
+
+		if ( (y_offs >= 64) && (y_offs < 128) )
+			x_offs = scroll_x;
+		else
+			x_offs = 0;
+
+
+		y_gran = y_offs & 7;
+
+		if (x_offs & 7)
+		{
+			UINT32 tilenum;
+			UINT16 ram_val = buggybjr_vram[((y_offs << 3) & 0x7c0) + ((x_offs >> 3) & 0x3f)];
+
+			tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5);
+			colour = (ram_val & 0xfc00) >> 8;
+			d0 = *(gfx2 + (tilenum << 3) + y_gran);
+			d1 = *(gfx1 + (tilenum << 3) + y_gran);
+		}
+
+		for (x = 0; x < 256; ++x)
+		{
+			UINT32 x_gran = x_offs & 7;
+
+			if (!x_gran)
+			{
+				UINT32 tilenum;
+				UINT16 ram_val = buggybjr_vram[((y_offs << 3) & 0x7c0) + ((x_offs >> 3) & 0x3f)];
+
+				tilenum = (ram_val & 0x03ff) | ((ram_val & 0x8000) >> 5);
+				colour = (ram_val & 0xfc00) >> 8;
+				d0 = *(gfx2 + (tilenum << 3) + y_gran);
+				d1 = *(gfx1 + (tilenum << 3) + y_gran);
+			}
+
+			*bitmap++ = colour |
+						(((d1 >> (7 ^ x_gran)) & 1) << 1) |
+						((d0 >> (7 ^ x_gran)) & 1);
+
+			x_offs = (x_offs + 1) & 0x1ff;
+		}
+
 	}
-	return 0;
+
+	profiler_mark(PROFILER_END);
 }
 
-VIDEO_UPDATE( buggyboy )
+VIDEO_UPDATE( buggybjr )
 {
-	/* the video hardware seems to use one large tilemap, scroll it to the right position for each screen */
-	int xscrollamount = screen*256;
-	tilemap_set_scrollx(buggyboy_tilemap,0,xscrollamount);
-
-	if(*bb_sky & 0x80)
-	{
-		draw_sky(machine, bitmap, cliprect);
-		tilemap_draw(bitmap,cliprect,buggyboy_tilemap,0,0);
-		draw_objects(machine, bitmap,cliprect,xscrollamount);
-	}
-	else
+	int x, y;
+	UINT8 *chr_pal = (memory_region(REGION_PROMS) + 0x400);
+
+	memset(obj_bmp, 0, 256*240);
+
+	buggyboy_draw_char(chr_bmp);
+	buggybjr_draw_road(rod_bmp);
+	buggyboy_draw_objs(obj_bmp);
+
+	for (y = 0; y < 240; ++y)
 	{
-		tilemap_draw(bitmap,cliprect,buggyboy_tilemap,TILEMAP_DRAW_OPAQUE,0);
-		draw_objects(machine, bitmap,cliprect,xscrollamount);
+		UINT16 *bmp_addr = BITMAP_ADDR16(bitmap, y, 0);
+
+		UINT8 *chr_addr = chr_bmp + (y * 256);
+		UINT8 *rod_addr = rod_bmp + (y * 256);
+		UINT8 *obj_addr = obj_bmp + (y * 256);
+
+		UINT32 sky_en = BIT(vregs.sky, 7);
+		UINT32 sky_val = (((vregs.sky & 0x7f) + y) >> 2) & 0x3f;
+
+		for (x = 0; x < 256; ++x)
+		{
+			UINT32 out_val;
+
+			UINT32 char_val = *chr_addr++;
+			UINT32 char_6_7 = (char_val & 0xc0) >> 2;
+
+			UINT32 obj_val = *obj_addr++;
+			UINT32 obj6	= BIT(obj_val, 6);
+
+			UINT32 rod_val = *rod_addr++;
+			UINT32 rod6	= BIT(rod_val, 6);
+
+			UINT32 chr = !(BIT(char_val, 7) && (char_val & 3) );
+
+			UINT32 sel =
+			(
+				( BIT(obj_val, 6) && chr) ||
+				( sky_en && !(char_val & 3) && (!obj6 && !rod6) )
+			) ? 0 : 1;
+
+			sel |= (!(obj6 || rod6) || !chr) ? 2 : 0;
+
+			/* Select the layer */
+			if		(sel == 0)	out_val = obj_val & 0x3f;
+			else if (sel == 1)	out_val = rod_val & 0x3f;
+			else if (sel == 2)	out_val = sky_val;
+			else				out_val = char_6_7 + chr_pal[char_val];
+
+			*bmp_addr++ = (sel << 6) + out_val;
+		}
 	}
+
 	return 0;
 }
diff -Nru src-old/mame/video/vrender0.c src/mame/video/vrender0.c
--- src-old/mame/video/vrender0.c	2007-12-17 08:41:39.000000000 -0800
+++ src/mame/video/vrender0.c	2007-12-23 19:41:16.000000000 -0800
@@ -365,7 +365,7 @@
 #define Packet(i) program_read_word_32le(PacketPtr+2*i)
 
 //Returns TRUE if the operation was a flip (sync or async)
-int ProcessPacket(UINT32 PacketPtr,UINT16 *Dest,UINT8 *TEXTURE)
+int vrender0_ProcessPacket(UINT32 PacketPtr,UINT16 *Dest,UINT8 *TEXTURE)
 {
 	UINT32 Dx=Packet(1)&0x3ff;
 	UINT32 Dy=Packet(2)&0x1ff;
diff -Nru src-old/mame/video/vrender0.h src/mame/video/vrender0.h
--- src-old/mame/video/vrender0.h	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/vrender0.h	2007-12-23 19:41:16.000000000 -0800
@@ -1,2 +1,2 @@
 
-extern int ProcessPacket(UINT32 PacketPtr,UINT16 *Dest,UINT8 *TEXTURE);
+extern int vrender0_ProcessPacket(UINT32 PacketPtr,UINT16 *Dest,UINT8 *TEXTURE);
diff -Nru src-old/mame/video/zac2650.c src/mame/video/zac2650.c
--- src-old/mame/video/zac2650.c	2007-12-17 07:19:59.000000000 -0800
+++ src/mame/video/zac2650.c	2007-12-23 19:41:16.000000000 -0800
@@ -6,7 +6,7 @@
 
 #include "driver.h"
 
-UINT8 *s2636ram;
+UINT8 *zac_s2636ram;
 static mame_bitmap *spritebitmap;
 
 static UINT8 dirtychar[256>>3];
@@ -30,16 +30,16 @@
 
 WRITE8_HANDLER( zac_s2636_w )
 {
-	if (s2636ram[offset] != data)
+	if (zac_s2636ram[offset] != data)
     {
-		s2636ram[offset] = data;
+		zac_s2636ram[offset] = data;
         dirtychar[offset>>3] = 1;
     }
 }
 
 READ8_HANDLER( zac_s2636_r )
 {
-	if(offset!=0xCB) return s2636ram[offset];
+	if(offset!=0xCB) return zac_s2636ram[offset];
     else return CollisionSprite;
 }
 
@@ -57,10 +57,10 @@
 	int Checksum=0;
 	int x,y;
 
-    if((s2636ram[first * 0x10 + 10] < 0xf0) && (s2636ram[second * 0x10 + 10] < 0xf0))
+    if((zac_s2636ram[first * 0x10 + 10] < 0xf0) && (zac_s2636ram[second * 0x10 + 10] < 0xf0))
     {
-    	int fx     = (s2636ram[first * 0x10 + 10] * 4)-22;
-        int fy     = (s2636ram[first * 0x10 + 12] * 3)+3;
+    	int fx     = (zac_s2636ram[first * 0x10 + 10] * 4)-22;
+        int fy     = (zac_s2636ram[first * 0x10 + 12] * 3)+3;
 		int expand = (first==1) ? 2 : 1;
 
         /* Draw first sprite */
@@ -96,7 +96,7 @@
 			    second * 2,
 			    1,
 			    0,0,
-			    (s2636ram[second * 0x10 + 10] * 4)-22,(s2636ram[second * 0x10 + 12] * 3) + 3,
+			    (zac_s2636ram[second * 0x10 + 10] * 4)-22,(zac_s2636ram[second * 0x10 + 12] * 3) + 3,
 			    0, TRANSPARENCY_PEN, 0);
 
         /* Remove fingerprint */
@@ -168,21 +168,21 @@
 
     for(offs=0;offs<0x50;offs+=0x10)
     {
-    	if((s2636ram[offs+10]<0xF0) && (offs!=0x30))
+    	if((zac_s2636ram[offs+10]<0xF0) && (offs!=0x30))
 		{
             int spriteno = (offs / 8);
-			int expand   = ((s2636ram[0xc0] & (spriteno*2))!=0) ? 2 : 1;
-            int bx       = (s2636ram[offs+10] * 4) - 22;
-            int by       = (s2636ram[offs+12] * 3) + 3;
+			int expand   = ((zac_s2636ram[0xc0] & (spriteno*2))!=0) ? 2 : 1;
+            int bx       = (zac_s2636ram[offs+10] * 4) - 22;
+            int by       = (zac_s2636ram[offs+12] * 3) + 3;
             int x,y;
 
             if(dirtychar[spriteno])
             {
             	/* 16x8 version */
-	   			decodechar(machine->gfx[1],spriteno,s2636ram,machine->drv->gfxdecodeinfo[1].gfxlayout);
+	   			decodechar(machine->gfx[1],spriteno,zac_s2636ram,machine->drv->gfxdecodeinfo[1].gfxlayout);
 
                 /* 16x16 version */
-   				decodechar(machine->gfx[2],spriteno,s2636ram,machine->drv->gfxdecodeinfo[2].gfxlayout);
+   				decodechar(machine->gfx[2],spriteno,zac_s2636ram,machine->drv->gfxdecodeinfo[2].gfxlayout);
 
                 dirtychar[spriteno] = 0;
             }
diff -Nru src-old/osd/windows/debugwin.c src/osd/windows/debugwin.c
--- src-old/osd/windows/debugwin.c	2007-12-17 07:19:59.000000000 -0800
+++ src/osd/windows/debugwin.c	2007-12-23 20:03:00.000000000 -0800
@@ -26,6 +26,7 @@
 #include "debugwin.h"
 #include "window.h"
 #include "video.h"
+#include "input.h"
 #include "config.h"
 #include "strconv.h"
 #include "winutf8.h"
@@ -266,6 +267,9 @@
 	waiting_for_debugger = TRUE;
 	smart_show_all(TRUE);
 
+	// run input polling to ensure that our status is in sync
+	wininput_poll();
+
 	// get and process messages
 	GetMessage(&message, NULL, 0, 0);
 	last_debugger_update = GetTickCount();
diff -Nru src-old/osd/windows/input.c src/osd/windows/input.c
--- src-old/osd/windows/input.c	2007-12-18 00:09:03.000000000 -0800
+++ src/osd/windows/input.c	2007-12-21 09:46:00.000000000 -0800
@@ -533,22 +533,22 @@
 
 void wininput_poll(void)
 {
-	int hasfocus = winwindow_has_focus();
+	int hasfocus = winwindow_has_focus() && input_enabled;
 
 	// ignore if not enabled
-	if (!input_enabled)
-		return;
-
-	// remember when this happened
-	last_poll = GetTickCount();
+	if (input_enabled)
+	{
+		// remember when this happened
+		last_poll = GetTickCount();
 
-	// periodically process events, in case they're not coming through
-	// this also will make sure the mouse state is up-to-date
-	winwindow_process_events_periodic();
-
-	// track if mouse/lightgun is enabled, for mouse hiding purposes
-	mouse_enabled = input_device_class_enabled(DEVICE_CLASS_MOUSE);
-	lightgun_enabled = input_device_class_enabled(DEVICE_CLASS_LIGHTGUN);
+		// periodically process events, in case they're not coming through
+		// this also will make sure the mouse state is up-to-date
+		winwindow_process_events_periodic();
+
+		// track if mouse/lightgun is enabled, for mouse hiding purposes
+		mouse_enabled = input_device_class_enabled(DEVICE_CLASS_MOUSE);
+		lightgun_enabled = input_device_class_enabled(DEVICE_CLASS_LIGHTGUN);
+	}
 
 	// poll all of the devices
 	if (hasfocus)
diff -Nru src-old/tools/chdman.c src/tools/chdman.c
--- src-old/tools/chdman.c	2007-12-18 00:09:03.000000000 -0800
+++ src/tools/chdman.c	2007-12-23 19:41:16.000000000 -0800
@@ -111,7 +111,7 @@
     print_big_int - 64-bit int printing with commas
 -------------------------------------------------*/
 
-void print_big_int(UINT64 intvalue, char *output)
+static void print_big_int(UINT64 intvalue, char *output)
 {
 	int chunk;
 
@@ -132,7 +132,7 @@
     big_int_string - return a string for a big int
 -------------------------------------------------*/
 
-char *big_int_string(UINT64 intvalue)
+static char *big_int_string(UINT64 intvalue)
 {
 	static char buffer[256];
 	buffer[0] = 0;
diff -Nru src-old/tools/makemeta.c src/tools/makemeta.c
--- src-old/tools/makemeta.c	2007-12-17 07:19:59.000000000 -0800
+++ src/tools/makemeta.c	2007-12-23 19:41:16.000000000 -0800
@@ -334,7 +334,7 @@
     of pattern_data structs
 -------------------------------------------------*/
 
-pattern_data *parse_pattern(char *arg, int *countptr)
+static pattern_data *parse_pattern(char *arg, int *countptr)
 {
 	pattern_data *head = NULL;
 	pattern_data **tailptr = &head;
diff -Nru src-old/tools/romcmp.c src/tools/romcmp.c
--- src-old/tools/romcmp.c	2007-12-18 00:09:03.000000000 -0800
+++ src/tools/romcmp.c	2007-12-23 19:41:16.000000000 -0800
@@ -27,12 +27,6 @@
 #endif
 
 
-/* for unzip.c */
-void CLIB_DECL logerror(const char *text,...)
-{
-}
-
-
 
 /* compare modes when one file is twice as long as the other */
 /* A = All file */
@@ -51,7 +45,7 @@
 		MODE_E, MODE_O,
 		MODE_E12, MODE_O12, MODE_E22, MODE_O22,
 		TOTAL_MODES };
-const char *const modenames[] =
+static const char *const modenames[] =
 {
 	"          ",
 	"[bits 0-3]",
@@ -113,8 +107,8 @@
 };
 typedef struct _fileinfo fileinfo;
 
-fileinfo files[2][MAX_FILES];
-float matchscore[MAX_FILES][MAX_FILES][TOTAL_MODES][TOTAL_MODES];
+static fileinfo files[2][MAX_FILES];
+static float matchscore[MAX_FILES][MAX_FILES][TOTAL_MODES][TOTAL_MODES];
 
 
 static void checkintegrity(const fileinfo *file,int side)
diff -Nru src-old/version.c src/version.c
--- src-old/version.c	2007-12-18 00:09:03.000000000 -0800
+++ src/version.c	2007-12-23 20:03:00.000000000 -0800
@@ -9,4 +9,4 @@
 
 ***************************************************************************/
 
-const char build_version[] = "0.122 ("__DATE__")";
+const char build_version[] = "0.122u1 ("__DATE__")";
