/***************************************************************************

New Super Pac-Man memory map (preliminary)

CPU #1:
0000-03ff video RAM
0400-07ff color RAM
0800-0f7f RAM
0f80-0fff sprite data 1 (sprite number & color)
1000-177f RAM
1780-17ff sprite data 2 (x, y position)
1800-1f7f RAM
1f80-1fff sprite data 3 (high bit of y, flip flags, double-size flags)
2000      watchdog timer?
4040-43ff RAM shared with CPU #2
4800-480f custom I/O chip #1
4810-481f custom I/O chip #2
5002-5003 IRQ enable
5008-5009 sound enable
500a-500b CPU #2 enable
8000      watchdog timer
c000-ffff ROM

CPU #2:
0000-0040 sound registers
0040-03ff RAM shared with CPU #1
f000-ffff ROM

Interrupts:
CPU #1 IRQ generated by VBLANK
CPU #2 uses no interrupts

***************************************************************************/

#include "driver.h"
#include "vidhrdw/generic.h"

extern unsigned char *mappy_soundregs;
void mappy_sound_enable_w(int offset,int data);
void mappy_sound_w(int offset,int data);
void mappy_sh_update(void);

extern unsigned char *superpac_sharedram;
extern unsigned char *superpac_customio_1,*superpac_customio_2;
int superpac_customio_r(int offset);
int superpac_sharedram_r(int offset);
int superpac_sharedram_r2(int offset);
void superpac_sharedram_w(int offset,int data);
void superpac_customio_w_1(int offset,int data);
void superpac_customio_w_2(int offset,int data);
int superpac_customio_r_1(int offset);
int superpac_customio_r_2(int offset);
void superpac_interrupt_enable_1_w(int offset,int data);
void superpac_cpu_enable_w(int offset,int data);
int superpac_interrupt_1(void);

int pacnpal_sharedram_r2(int offset);
void pacnpal_sharedram_w2(int offset,int data);
int pacnpal_interrupt_2(void);
void pacnpal_interrupt_enable_2_w(int offset,int data);

int superpac_vh_start(void);
void superpac_vh_screenrefresh(struct osd_bitmap *bitmap);
void superpac_init_machine(void);
void superpac_vh_convert_color_prom(unsigned char *palette, unsigned char *colortable,const unsigned char *color_prom);


/* CPU 1 read addresses */
static struct MemoryReadAddress readmem_cpu1[] =
{
	{ 0x0000, 0x1fff, MRA_RAM },                                       /* general RAM */
	{ 0x4040, 0x43ff, superpac_sharedram_r, &superpac_sharedram },     /* shared RAM */
	{ 0x4800, 0x480f, superpac_customio_r_1, &superpac_customio_1 },   /* custom I/O chip #1 interface */
	{ 0x4810, 0x481f, superpac_customio_r_2, &superpac_customio_2 },   /* custom I/O chip #2 interface */
	{ 0xa000, 0xffff, MRA_ROM },                        /* SPC-2.1C at 0xc000, SPC-1.1B at 0xe000 */
	{ -1 }                                              /* end of table */
};


/* CPU 1 write addresses */
static struct MemoryWriteAddress writemem_cpu1[] =
{
	{ 0x0000, 0x03ff, videoram_w, &videoram, &videoram_size },          /* video RAM */
	{ 0x0400, 0x07ff, colorram_w, &colorram },          /* color RAM */
	{ 0x0800, 0x0f7f, MWA_RAM },                        /* RAM */
	{ 0x0f80, 0x0fff, MWA_RAM, &spriteram, &spriteram_size },            /* sprite RAM, area 1 */
	{ 0x1000, 0x177f, MWA_RAM },                        /* RAM */
	{ 0x1780, 0x17ff, MWA_RAM, &spriteram_2 },          /* sprite RAM, area 2 */
	{ 0x1800, 0x1f7f, MWA_RAM },                        /* RAM */
	{ 0x1f80, 0x1fff, MWA_RAM, &spriteram_3 },          /* sprite RAM, area 3 */
	{ 0x2000, 0x2000, MWA_NOP },                        /* watchdog timer */
	{ 0x4040, 0x43ff, MWA_RAM },                        /* shared RAM */
	{ 0x4800, 0x480f, superpac_customio_w_1 },          /* custom I/O chip #1 interface */
	{ 0x4810, 0x481f, superpac_customio_w_2 },          /* custom I/O chip #2 interface */
	{ 0x5002, 0x5003, superpac_interrupt_enable_1_w },  /* interrupt enable */
	{ 0x5008, 0x5009, mappy_sound_enable_w },           /* sound enable */
	{ 0x500a, 0x500b, superpac_cpu_enable_w },          /* interrupt enable */
	{ 0x8000, 0x8000, MWA_NOP },                        /* watchdog timer */
	{ 0xa000, 0xffff, MWA_ROM },                        /* SPC-2.1C at 0xc000, SPC-1.1B at 0xe000 */
	{ -1 }                                              /* end of table */
};


/* CPU 2 read addresses */
static struct MemoryReadAddress superpac_readmem_cpu2[] =
{
	{ 0xf000, 0xffff, MRA_ROM },                        /* ROM code */
	{ 0x0040, 0x03ff, superpac_sharedram_r2 },          /* shared RAM with the main CPU */
	{ -1 }                                              /* end of table */
};


/* CPU 2 write addresses */
static struct MemoryWriteAddress superpac_writemem_cpu2[] =
{
	{ 0x0040, 0x03ff, superpac_sharedram_w },           /* shared RAM with the main CPU */
	{ 0x0000, 0x003f, mappy_sound_w, &mappy_soundregs },/* sound control registers */
	{ 0xf000, 0xffff, MWA_ROM },                        /* ROM code */
	{ -1 }                                              /* end of table */
};


/* CPU 2 read addresses */
static struct MemoryReadAddress pacnpal_readmem_cpu2[] =
{
	{ 0xf000, 0xffff, MRA_ROM },                        /* ROM code */
	{ 0x0040, 0x03ff, pacnpal_sharedram_r2 },           /* shared RAM with the main CPU */
	{ -1 }                                              /* end of table */
};


/* CPU 2 write addresses */
static struct MemoryWriteAddress pacnpal_writemem_cpu2[] =
{
	{ 0x0040, 0x03ff, pacnpal_sharedram_w2 },           /* shared RAM with the main CPU */
	{ 0x0000, 0x003f, mappy_sound_w, &mappy_soundregs },/* sound control registers */
	{ 0x2000, 0x2001, pacnpal_interrupt_enable_2_w },   /* interrupt enable */
	{ 0x2006, 0x2007, mappy_sound_enable_w },           /* sound enable */
	{ 0xf000, 0xffff, MWA_ROM },                        /* ROM code */
	{ -1 }                                              /* end of table */
};


/* input from the outside world */
INPUT_PORTS_START( superpac_input_ports )
	PORT_START	/* DSW0 */
	PORT_DIPNAME( 0x0f, 0x00, "Difficulty", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Rank 0-Normal" )
	PORT_DIPSETTING(    0x01, "Rank 1-Easy" )
	PORT_DIPSETTING(    0x02, "Rank 2" )
	PORT_DIPSETTING(    0x03, "Rank 3" )
	PORT_DIPSETTING(    0x04, "Rank 4" )
	PORT_DIPSETTING(    0x05, "Rank 5" )
	PORT_DIPSETTING(    0x06, "Rank 6" )
	PORT_DIPSETTING(    0x07, "Rank 7" )
	PORT_DIPSETTING(    0x08, "Rank 8-Default" )
	PORT_DIPSETTING(    0x09, "Rank 9" )
	PORT_DIPSETTING(    0x0a, "Rank A" )
	PORT_DIPSETTING(    0x0b, "Rank B-Hard" )
	PORT_DIPSETTING(    0x0c, "Rank C-Easy Auto" )
	PORT_DIPSETTING(    0x0d, "Rank D-Auto" )
	PORT_DIPSETTING(    0x0e, "Rank E-Auto" )
	PORT_DIPSETTING(    0x0f, "Rank F-Hard Auto" )
	PORT_DIPNAME( 0x30, 0x00, "Right Coin", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "1 Coin/1 Credit" )
	PORT_DIPSETTING(    0x10, "1 Coin/2 Credits" )
	PORT_DIPSETTING(    0x20, "2 Coins/1 Credit" )
	PORT_DIPSETTING(    0x30, "2 Coins/3 Credits" )
	PORT_DIPNAME( 0x40, 0x00, "Demo Sound", IP_KEY_NONE )
	PORT_DIPSETTING(    0x40, "Off" )
	PORT_DIPSETTING(    0x00, "On" )
	PORT_DIPNAME( 0x80, 0x00, "Freeze", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Off" )
	PORT_DIPSETTING(    0x80, "On" )

	PORT_START	/* DSW1 */
	PORT_DIPNAME( 0x07, 0x00, "Left Coin", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "1 Coin/1 Credit" )
	PORT_DIPSETTING(    0x01, "1 Coin/2 Credits" )
	PORT_DIPSETTING(    0x02, "1 Coin/3 Credits" )
	PORT_DIPSETTING(    0x03, "1 Coin/6 Credits" )
	PORT_DIPSETTING(    0x04, "1 Coin/7 Credits" )
	PORT_DIPSETTING(    0x05, "2 Coins/1 Credit" )
	PORT_DIPSETTING(    0x06, "2 Coins/3 Credits" )
	PORT_DIPSETTING(    0x07, "3 Coins/1 Credits" )
	/* TODO: bonus scores are different for 5 lives */
	PORT_DIPNAME( 0x38, 0x00, "Bonus Life", IP_KEY_NONE )
	PORT_DIPSETTING(    0x38, "None" )
	PORT_DIPSETTING(    0x30, "30k" )
	PORT_DIPSETTING(    0x08, "30k 80k" )
	PORT_DIPSETTING(    0x00, "30k 100k" )
	PORT_DIPSETTING(    0x20, "30k 120k" )
	PORT_DIPSETTING(    0x10, "30k 80k 80k" )
	PORT_DIPSETTING(    0x18, "30k 100k 100k" )
	PORT_DIPSETTING(    0x28, "30k 120k 120k" )
	PORT_DIPNAME( 0xc0, 0x00, "Lives", IP_KEY_NONE )
	PORT_DIPSETTING(    0x40, "1" )
	PORT_DIPSETTING(    0x80, "2" )
	PORT_DIPSETTING(    0x00, "3" )
	PORT_DIPSETTING(    0xc0, "5" )

	PORT_START	/* FAKE */
	/* The player inputs are not memory mapped, they are handled by an I/O chip. */
	/* These fake input ports are read by mappy_customio_data_r() */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_4WAY )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_4WAY )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_4WAY )
	PORT_BITX(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
	PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS, 0 )
	PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START	/* FAKE */
	PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
	PORT_BITX(0x02, IP_ACTIVE_HIGH, IPT_COIN2 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
	PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BITX(0x10, IP_ACTIVE_HIGH, IPT_START1 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
	PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_START2 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
	PORT_DIPNAME( 0x40, 0x00, "Orientation", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Upright" )
	PORT_DIPSETTING(    0x40, "Cocktail" )
	PORT_BITX(    0x80, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
	PORT_DIPSETTING(    0x00, "Off" )
	PORT_DIPSETTING(    0x80, "On" )
INPUT_PORTS_END


INPUT_PORTS_START( pacnpal_input_ports )
	PORT_START	/* DSW0 */
	PORT_DIPNAME( 0x03, 0x00, "Right Coin", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "1 Coin/1 Credit" )
	PORT_DIPSETTING(    0x01, "1 Coin/2 Credits" )
	PORT_DIPSETTING(    0x02, "2 Coins/1 Credit" )
	PORT_DIPSETTING(    0x03, "2 Coins/3 Credits" )
	PORT_DIPNAME( 0x0c, 0x00, "Rank", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "A" )
	PORT_DIPSETTING(    0x04, "B" )
	PORT_DIPSETTING(    0x08, "C" )
	PORT_DIPSETTING(    0x0c, "D" )
	PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START	/* DSW1 */
	PORT_DIPNAME( 0x07, 0x00, "Coins", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "1 Coin/1 Credit" )
	PORT_DIPSETTING(    0x01, "1 Coin/2 Credits" )
	PORT_DIPSETTING(    0x02, "1 Coin/3 Credits" )
	PORT_DIPSETTING(    0x03, "1 Coin/6 Credits" )
	PORT_DIPSETTING(    0x04, "1 Coin/7 Credits" )
	PORT_DIPSETTING(    0x05, "2 Coins/1 Credit" )
	PORT_DIPSETTING(    0x06, "2 Coins/3 Credits" )
	PORT_DIPSETTING(    0x07, "3 Coins/1 Credits" )
	/* TODO: bonus scores are different for 5 lives */
	PORT_DIPNAME( 0x38, 0x18, "Bonus Life", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "None" )
	PORT_DIPSETTING(    0x38, "30k" )
	PORT_DIPSETTING(    0x18, "20k 70k" )
	PORT_DIPSETTING(    0x20, "30k 70k" )
	PORT_DIPSETTING(    0x28, "30k 80k" )
	PORT_DIPSETTING(    0x30, "30k 100k" )
	PORT_DIPSETTING(    0x08, "20k 70k 70k" )
	PORT_DIPSETTING(    0x10, "30k 80k 80k" )
	PORT_DIPNAME( 0xc0, 0x80, "Lives", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "1" )
	PORT_DIPSETTING(    0x40, "2" )
	PORT_DIPSETTING(    0x80, "3" )
	PORT_DIPSETTING(    0xc0, "5" )

	PORT_START	/* FAKE */
	/* The player inputs are not memory mapped, they are handled by an I/O chip. */
	/* These fake input ports are read by mappy_customio_data_r() */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_4WAY )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_4WAY )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_4WAY )
	PORT_BITX(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2 )
	PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS, 0 )
	PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START	/* FAKE */
	PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2 )
	PORT_BITX(0x02, IP_ACTIVE_HIGH, IPT_COIN2 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2 )
	PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BITX(0x10, IP_ACTIVE_HIGH, IPT_START1 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2 )
	PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_START2 | IPF_IMPULSE,
			IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2 )
	PORT_DIPNAME( 0x40, 0x00, "Orientation", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Upright" )
	PORT_DIPSETTING(    0x40, "Cocktail" )
	PORT_BITX(    0x80, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
	PORT_DIPSETTING(    0x00, "Off" )
	PORT_DIPSETTING(    0x80, "On" )
INPUT_PORTS_END


/* SUPERPAC -- ROM SPV-1.3C (4K) */
static struct GfxLayout charlayout =
{
	8,8,                                           /* 8*8 characters */
	256,                                           /* 256 characters */
	2,                                             /* 2 bits per pixel */
	{ 0, 4 },                                      /* the two bitplanes for 4 pixels are packed into one byte */
	{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },    /* characters are rotated 90 degrees */
	{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },    /* bits are packed in groups of four */
	16*8                                           /* every char takes 16 bytes */
};


/* SUPERPAC -- ROM SPV-2.3F (8K) */
static struct GfxLayout spritelayout =
{
	16,16,                                         /* 16*16 sprites */
	128,                                           /* 128 sprites */
	2,                                             /* 2 bits per pixel */
	{ 0, 4 },                                      /* the two bitplanes for 4 pixels are packed into one byte */
	{ 39 * 8, 38 * 8, 37 * 8, 36 * 8, 35 * 8, 34 * 8, 33 * 8, 32 * 8,
			7 * 8, 6 * 8, 5 * 8, 4 * 8, 3 * 8, 2 * 8, 1 * 8, 0 * 8 },
	{ 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3,
			16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
	64*8                                           /* every sprite takes 64 bytes */
};


static struct GfxDecodeInfo gfxdecodeinfo[] =
{
	{ 1, 0x0000, &charlayout,      0, 64 },
	{ 1, 0x1000, &spritelayout, 64*4, 64 },
	{ -1 } /* end of array */
};


static unsigned char superpac_color_prom[] =
{
	/* 4C - palette */
	0xf6,0xc9,0x3f,0x07,0xef,0xf8,0x2f,0xaf,0x3c,0x5d,0x38,0xe7,0x29,0x66,0x54,0x00,
	0x00,0xd8,0x66,0x29,0xe7,0x38,0x5d,0xd5,0xaf,0x2f,0xb8,0xef,0x07,0x3f,0xf6,0x00,
	/* 4E - chars */
	0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x03,0x01,0x00,0x00,0x0b,0x03,0x0e,
	0x00,0x0b,0x01,0x0e,0x00,0x06,0x01,0x0b,0x00,0x0b,0x01,0x08,0x00,0x04,0x01,0x07,
	0x00,0x04,0x01,0x05,0x00,0x02,0x06,0x04,0x00,0x02,0x06,0x03,0x00,0x01,0x01,0x01,
	0x00,0x03,0x01,0x0d,0x00,0x02,0x06,0x0d,0x00,0x0d,0x09,0x01,0x00,0x09,0x07,0x0a,
	0x00,0x01,0x06,0x09,0x00,0x02,0x09,0x0a,0x00,0x03,0x0b,0x0a,0x00,0x01,0x07,0x03,
	0x00,0x04,0x0b,0x0a,0x00,0x0a,0x01,0x0c,0x00,0x01,0x04,0x03,0x00,0x06,0x09,0x01,
	0x00,0x02,0x06,0x01,0x00,0x0a,0x01,0x0c,0x00,0x03,0x02,0x0e,0x00,0x01,0x0b,0x03,
	0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	/* 3L - sprites */
	0x0f,0x0f,0x0f,0x0f,0x0f,0x02,0x02,0x02,0x0f,0x00,0x00,0x00,0x0f,0x00,0x04,0x05,
	0x0f,0x03,0x00,0x01,0x0f,0x04,0x00,0x01,0x0f,0x05,0x00,0x01,0x0f,0x06,0x00,0x01,
	0x0f,0x01,0x04,0x00,0x00,0x00,0x00,0x00,0x0f,0x0f,0x00,0x01,0x0f,0x07,0x00,0x00,
	0x0f,0x0f,0x0f,0x0f,0x0f,0x08,0x0f,0x0f,0x0f,0x08,0x08,0x0f,0x0f,0x08,0x08,0x08,
	0x0f,0x03,0x00,0x0d,0x0f,0x02,0x06,0x0d,0x0f,0x0d,0x0e,0x00,0x0f,0x09,0x07,0x0a,
	0x0f,0x00,0x06,0x09,0x0f,0x02,0x09,0x0a,0x0f,0x03,0x0b,0x08,0x0f,0x00,0x07,0x03,
	0x0f,0x04,0x0b,0x0a,0x0f,0x0a,0x0c,0x00,0x0f,0x00,0x04,0x03,0x0f,0x06,0x09,0x00,
	0x0f,0x02,0x00,0x06,0x0f,0x0a,0x00,0x0c,0x0f,0x03,0x02,0x01,0x0f,0x00,0x0b,0x03,
	0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,
	0x0f,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0f,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0f,0x02,0x0f,0x0f,0x0f,0x02,0x02,0x0f,0x0f,0x02,0x02,0x02,0x0f,0x02,0x02,0x0f,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0f,0x00,0x04,0x00,0x0f,0x00,0x05,0x00,0x0f,0x00,0x06,0x00,0x0f,0x00,0x08,0x00
};


static unsigned char pacnpal_color_prom[] =
{
	/* 4C - palette */
	0xf6,0xc0,0x3f,0x3c,0x8f,0x07,0xe7,0xf0,0x2f,0x28,0xc9,0xed,0x5d,0xa4,0xf6,0x00,
	0x00,0xf6,0x5d,0xc9,0xe0,0xf0,0xba,0x38,0x3c,0x3f,0x27,0xb7,0xef,0x8f,0x07,0x00,
	/* 4E - chars */
	0x00,0x06,0x05,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0e,0x00,
	0x00,0x07,0x0e,0x02,0x00,0x01,0x0e,0x0d,0x00,0x06,0x0e,0x02,0x00,0x00,0x00,0x00,
	0x00,0x03,0x00,0x04,0x05,0x03,0x00,0x04,0x00,0x0b,0x00,0x09,0x0c,0x0b,0x00,0x09,
	0x00,0x02,0x00,0x03,0x00,0x0b,0x00,0x0d,0x00,0x0d,0x00,0x0e,0x00,0x09,0x00,0x0c,
	0x00,0x00,0x0e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,
	0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,
	0x00,0x00,0x08,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0b,0x00,
	0x00,0x00,0x0c,0x00,0x00,0x00,0x0d,0x00,0x0f,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	/* 3L - sprites */
	0x0f,0x0f,0x0f,0x0f,0x0f,0x02,0x0f,0x0f,0x0f,0x03,0x0e,0x04,0x0f,0x05,0x00,0x01,
	0x0f,0x06,0x00,0x01,0x0f,0x07,0x00,0x01,0x0f,0x08,0x00,0x01,0x0f,0x01,0x07,0x0e,
	0x0f,0x0d,0x00,0x0b,0x0f,0x04,0x00,0x0d,0x00,0x00,0x00,0x00,0x0f,0x0d,0x00,0x02,
	0x0f,0x00,0x00,0x00,0x0f,0x07,0x07,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0f,0x05,0x02,0x0d,0x0f,0x05,0x0b,0x0e,0x0f,0x02,0x08,0x0e,0x0f,0x0e,0x05,0x08,
	0x00,0x00,0x00,0x00,0x0f,0x0e,0x05,0x05,0x0f,0x05,0x00,0x01,0x00,0x00,0x00,0x00,
	0x0f,0x05,0x0e,0x0c,0x0f,0x05,0x0e,0x03,0x0f,0x08,0x03,0x09,0x0f,0x03,0x0e,0x09,
	0x0f,0x02,0x0e,0x09,0x0f,0x08,0x0c,0x03,0x0f,0x07,0x0d,0x0e,0x00,0x00,0x00,0x00,
	0x0f,0x0e,0x05,0x0d,0x0f,0x0b,0x05,0x0c,0x0f,0x0b,0x05,0x09,0x0f,0x0b,0x08,0x03,
	0x0f,0x0b,0x09,0x03,0x0f,0x0b,0x02,0x03,0x0f,0x0b,0x08,0x03,0x0f,0x0b,0x0d,0x0d,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0f,0x07,0x0b,0x0e,0x0f,0x0e,0x0d,0x0b,0x0f,0x0e,0x0b,0x07,0x0f,0x02,0x0f,0x0e,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x00,0x0f,0x0f,0x0f,0x00,0x00,
	0x0f,0x00,0x0f,0x0f,0x0f,0x00,0x00,0x0f,0x0f,0x0f,0x0f,0x00,0x0f,0x00,0x00,0x00
};


/* waveforms for the audio hardware */
static unsigned char superpac_samples[8*32] =
{
	0xf8,0x18,0x28,0x38,0x48,0x58,0x58,0x68,0x68,0x68,0x58,0x58,0x48,0x38,0x28,0x18,
	0xf8,0xd8,0xc8,0xb8,0xa8,0x98,0x98,0x88,0x88,0x88,0x98,0x98,0xa8,0xb8,0xc8,0xd8,

	0x88,0x98,0xa8,0xb8,0xc8,0xd8,0xe8,0xf8,0x08,0x18,0x28,0x38,0x48,0x58,0x68,0x78,
	0x78,0x68,0x58,0x48,0x38,0x28,0x18,0x08,0xf8,0xe8,0xd8,0xc8,0xb8,0xa8,0x98,0x88,

	0xf8,0x08,0xe8,0x18,0xd8,0x28,0xc8,0x38,0xb8,0x48,0xa8,0x58,0x98,0x68,0x88,0x78,
	0x88,0x78,0x98,0x68,0xa8,0x58,0xb8,0x48,0xc8,0x38,0xd8,0x28,0xe8,0x18,0xf8,0x08,

	0xf8,0x28,0x48,0x58,0x68,0x58,0x48,0x28,0xf8,0xc8,0xa8,0x98,0x88,0x98,0xa8,0xc8,
	0xf8,0x38,0x58,0x68,0x58,0x38,0xf8,0xb8,0x98,0x88,0x98,0xb8,0xf8,0x68,0xf8,0x88,

	0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,
	0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,

	0x68,0x48,0xf8,0x28,0x48,0xf8,0xd8,0x48,0x68,0x58,0x08,0x28,0x38,0xe8,0xa8,0xf8,
	0x48,0x08,0xb8,0xc8,0xe8,0x98,0x88,0xb8,0x18,0xf8,0xa8,0xc8,0xf8,0xa8,0x88,0xf8,

	0xf8,0x48,0x68,0x68,0x58,0x38,0x18,0x28,0x38,0x38,0x28,0x18,0xe8,0xc8,0xb8,0xd8,
	0xf8,0x18,0x38,0x28,0x08,0xd8,0xc8,0xb8,0xb8,0xc8,0xd8,0xb8,0x98,0x88,0x88,0xa8,

	0x48,0x68,0x68,0x68,0x68,0x48,0x38,0x18,0xf8,0xe8,0xd8,0xd8,0xd8,0xe8,0x08,0x28,
	0x38,0x38,0x18,0xe8,0xc8,0xa8,0xa8,0xa8,0xb8,0xd8,0xc8,0xb8,0xa8,0x98,0xb8,0xf8
};

static unsigned char pacnpal_samples[8*32] =
{
	0xf8,0x58,0x68,0x78,0x48,0x58,0x58,0x68,0x68,0x68,0x58,0x58,0x48,0x78,0x68,0x58,
	0xf8,0xd8,0xc8,0xf8,0xe8,0xd8,0xd8,0xc8,0xc8,0xc8,0xd8,0xd8,0xe8,0xf8,0xc8,0xd8,

	0x48,0x68,0x68,0x68,0x68,0x58,0x58,0x68,0x68,0x58,0x68,0x58,0x48,0xe8,0xe8,0xf8,
	0x48,0x48,0xe8,0xd8,0xc8,0xd8,0xc8,0xc8,0xd8,0xd8,0xc8,0xc8,0xc8,0xc8,0xe8,0xf8,

	0x48,0x68,0x68,0x68,0x68,0x58,0x78,0x48,0x68,0x68,0x48,0x68,0x48,0x68,0xe8,0xd8,
	0x48,0x48,0xe8,0xc8,0xe8,0xd8,0xc8,0xc8,0xf8,0xd8,0xc8,0xc8,0xc8,0xc8,0xe8,0xd8,

	0xf8,0x68,0x48,0x58,0x68,0x58,0x48,0x68,0xf8,0xc8,0xe8,0xd8,0xc8,0xd8,0xe8,0xc8,
	0xf8,0x78,0x58,0x68,0x58,0x78,0xf8,0xf8,0xd8,0xc8,0xd8,0xf8,0xf8,0x68,0xf8,0xc8,

	0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,
	0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,

	0x68,0x48,0xf8,0x68,0x48,0xf8,0xd8,0x48,0x68,0x58,0x48,0x68,0x78,0xe8,0xe8,0xf8,
	0x48,0x48,0xf8,0xc8,0xe8,0xd8,0xc8,0xf8,0x58,0xf8,0xe8,0xc8,0xf8,0xe8,0xc8,0xf8,

	0x68,0x68,0x68,0x68,0x68,0x68,0x48,0x58,0x48,0x68,0xf8,0x48,0xd8,0xf8,0xd8,0xd8,
	0x48,0x78,0x68,0x68,0x48,0xc8,0xe8,0xd8,0xd8,0xc8,0xd8,0xf8,0xd8,0xc8,0xd8,0xf8,

	0x48,0x68,0x68,0x68,0x68,0x48,0x78,0x58,0xf8,0xe8,0xd8,0xd8,0xd8,0xe8,0x48,0x68,
	0x78,0x78,0x58,0xe8,0xc8,0xe8,0xe8,0xe8,0xf8,0xd8,0xc8,0xb8,0xa8,0x98,0xb8,0xf8
};


static struct MachineDriver superpac_machine_driver =
{
	/* basic machine hardware  */
	{
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			0,                   /* memory region */
			readmem_cpu1,        /* MemoryReadAddress */
			writemem_cpu1,       /* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			interrupt,           /* interrupt routine */
			1                    /* interrupts per frame */
		},
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			2,                   /* memory region */
			superpac_readmem_cpu2,/* MemoryReadAddress */
			superpac_writemem_cpu2,/* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			ignore_interrupt,		/* interrupt routine */
			1                    /* interrupts per frame */
		}
	},
	60,                        /* frames per second */
	100,	/* 100 CPU slices per frame - an high value to ensure proper */
			/* synchronization of the CPUs */
	superpac_init_machine,     /* init machine routine */

	/* video hardware */
	28*8, 36*8,                /* screen_width, screen_height */
	{ 0*8, 28*8-1, 0*8, 36*8-1 },/* struct rectangle visible_area */
	gfxdecodeinfo,             /* GfxDecodeInfo * */
	32,                        /* total colors */
	4*(64+64),                 /* color table length */
	superpac_vh_convert_color_prom, /* convert color prom routine */

	VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
	0,                         /* vh_init routine */
	generic_vh_start,          /* vh_start routine */
	generic_vh_stop,           /* vh_stop routine */
	superpac_vh_screenrefresh, /* vh_update routine */

	/* sound hardware */
	superpac_samples,          /* pointer to samples */
	0,                         /* sh_init routine */
	0,                         /* sh_start routine */
	0,                         /* sh_stop routine */
	mappy_sh_update            /* sh_update routine */
};

static struct MachineDriver pacnpal_machine_driver =
{
	/* basic machine hardware  */
	{
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			0,                   /* memory region */
			readmem_cpu1,        /* MemoryReadAddress */
			writemem_cpu1,       /* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			interrupt,           /* interrupt routine */
			1                    /* interrupts per frame */
		},
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			2,                   /* memory region */
			pacnpal_readmem_cpu2,/* MemoryReadAddress */
			pacnpal_writemem_cpu2,/* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			pacnpal_interrupt_2, /* interrupt routine */
			1                    /* interrupts per frame */
		}
	},
	60,                        /* frames per second */
	1,	/* TODO: an higher setting causes the game to run too fast. Understand why. */
	superpac_init_machine,     /* init machine routine */

	/* video hardware */
	28*8, 36*8,                /* screen_width, screen_height */
	{ 0*8, 28*8-1, 0*8, 36*8-1 },/* struct rectangle visible_area */
	gfxdecodeinfo,             /* GfxDecodeInfo * */
	32,                        /* total colors */
	4*(64+64),                 /* color table length */
	superpac_vh_convert_color_prom, /* convert color prom routine */

	VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
	0,                         /* vh_init routine */
	generic_vh_start,          /* vh_start routine */
	generic_vh_stop,           /* vh_stop routine */
	superpac_vh_screenrefresh, /* vh_update routine */

	/* sound hardware */
	pacnpal_samples,            /* pointer to samples */
	0,                         /* sh_init routine */
	0,                         /* sh_start routine */
	0,                         /* sh_stop routine */
	mappy_sh_update            /* sh_update routine */
};


ROM_START( superpac_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "SPC-2.1C", 0xc000, 0x2000, 0x8da57a9b )
	ROM_LOAD( "SPC-1.1B", 0xe000, 0x2000, 0xcb391cdf )

	ROM_REGION(0x3000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "SPV-1.3C", 0x0000, 0x1000, 0xac21e9f9 )
	ROM_LOAD( "SPV-2.3F", 0x1000, 0x2000, 0x19a3fd43 )

	ROM_REGION(0x10000)	/* 64k for the second CPU */
	ROM_LOAD( "SPC-3.1K", 0xf000, 0x1000, 0x6d32e9fa )
ROM_END



ROM_START( pacnpal_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "pap13b.cpu", 0xa000, 0x2000, 0x3c456471 )
	ROM_LOAD( "pap12b.cpu", 0xc000, 0x2000, 0x773e919c )
	ROM_LOAD( "pap11b.cpu", 0xe000, 0x2000, 0x30f54a3d )

	ROM_REGION(0x3000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "pap16.cpu", 0x0000, 0x1000, 0x9565c97b )
	ROM_LOAD( "pap15.vid", 0x1000, 0x2000, 0x5a90f48c )

	ROM_REGION(0x10000)	/* 64k for the second CPU */
	ROM_LOAD( "pap14.cpu", 0xf000, 0x1000, 0xcda756c1 )
ROM_END


/* load the high score table */
static int superpac_hiload(void)
{
   int writing = 0;
   void *f;

   /* get RAM pointer (this game is multiCPU, we can't assume the global */
   /* RAM pointer is pointing to the right place) */
   unsigned char *RAM = Machine->memory_region[0];

   /* check if the hi score table has already been initialized */
   if (memcmp(&RAM[0x113c],"N@N",3) == 0 &&        /* check for high score initials */
       RAM[0x1087] == 0 && RAM[0x1089] == 0 && RAM[0x1088] != 0 && /* check for main high score value */
   	 memcmp(&RAM[0x3ee],"000",3) == 0)           /* see if main high score was written to screen */
   {
      if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
      {
         osd_fread(f,&RAM[0x1138],40);
         osd_fclose(f);

         /* also copy over the high score */
         RAM[0x1087] = RAM[0x1138];
         RAM[0x1088] = RAM[0x1139];
         RAM[0x1089] = RAM[0x113a];
      }

      /* this is a little gross, but necessary to get the high score on-screen */
      if (!writing) writing = (RAM[0x1087] >> 4);
      videoram_w (0x3f4, writing ? (RAM[0x1087] >> 4) + '0' : ' ');
      if (!writing) writing = (RAM[0x1087] & 0x0f);
      videoram_w (0x3f3, writing ? (RAM[0x1087] & 0x0f) + '0' : ' ');
      if (!writing) writing = (RAM[0x1088] >> 4);
      videoram_w (0x3f2, writing ? (RAM[0x1088] >> 4) + '0' : ' ');
      if (!writing) writing = (RAM[0x1088] & 0x0f);
      videoram_w (0x3f1, writing ? (RAM[0x1088] & 0x0f) + '0' : ' ');
      if (!writing) writing = (RAM[0x1089] >> 4);
      videoram_w (0x3f0, writing ? (RAM[0x1089] >> 4) + '0' : ' ');
      if (!writing) writing = (RAM[0x1089] & 0x0f);
      videoram_w (0x3ef, writing ? (RAM[0x1089] & 0x0f) + '0' : ' ');
      videoram_w (0x3ee, 0 + '0');

      return 1;
   }
   else return 0; /* we can't load the hi scores yet */
}


/* save the high score table */
static void superpac_hisave(void)
{
   void *f;

   /* get RAM pointer (this game is multiCPU, we can't assume the global */
   /* RAM pointer is pointing to the right place) */
   unsigned char *RAM = Machine->memory_region[0];

   if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
   {
      osd_fwrite(f,&RAM[0x1138],40);
      osd_fclose(f);
   }
}


/* load the high score table */
static int pacnpal_hiload(void)
{
   int writing = 0;
   void *f;

   /* get RAM pointer (this game is multiCPU, we can't assume the global */
   /* RAM pointer is pointing to the right place) */
   unsigned char *RAM = Machine->memory_region[0];

   /* check if the hi score table has already been initialized */
   if (memcmp(&RAM[0x1051],"\x1a\x25\x1a",3) == 0 &&        /* check for high score initials */
       RAM[0x116d] == 0 && RAM[0x116f] == 0 && RAM[0x116e] != 0 && /* check for main high score value */
   	 memcmp(&RAM[0x3ed],"\x0\x0\x0",3) == 0)           /* see if main high score was written to screen */
   {
      if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
      {
         osd_fread(f,&RAM[0x104c],40);
         osd_fclose(f);

         /* also copy over the high score */
         RAM[0x116d] = RAM[0x104d];
         RAM[0x116e] = RAM[0x104e];
         RAM[0x116f] = RAM[0x104f];
      }

      /* this is a little gross, but necessary to get the high score on-screen */
      if (!writing) writing = (RAM[0x116d] >> 4);
      videoram_w (0x3f3, writing ? (RAM[0x116d] >> 4) : 0x24);
      if (!writing) writing = (RAM[0x116d] & 0x0f);
      videoram_w (0x3f2, writing ? (RAM[0x116d] & 0x0f) : 0x24);
      if (!writing) writing = (RAM[0x116e] >> 4);
      videoram_w (0x3f1, writing ? (RAM[0x116e] >> 4) : 0x24);
      if (!writing) writing = (RAM[0x116e] & 0x0f);
      videoram_w (0x3f0, writing ? (RAM[0x116e] & 0x0f) : 0x24);
      if (!writing) writing = (RAM[0x116f] >> 4);
      videoram_w (0x3ef, writing ? (RAM[0x116f] >> 4) : 0x24);
      if (!writing) writing = (RAM[0x116f] & 0x0f);
      videoram_w (0x3ee, writing ? (RAM[0x116f] & 0x0f) : 0x24);
      videoram_w (0x3ed, 0);

      return 1;
   }
   else return 0; /* we can't load the hi scores yet */
}


/* save the high score table */
static void pacnpal_hisave(void)
{
   void *f;

   /* get RAM pointer (this game is multiCPU, we can't assume the global */
   /* RAM pointer is pointing to the right place) */
   unsigned char *RAM = Machine->memory_region[0];

   if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
   {
      osd_fwrite(f,&RAM[0x104c],40);
      osd_fclose(f);
   }
}


struct GameDriver superpac_driver =
{
	"Super Pac-Man",
	"superpac",
	"Aaron Giles\nKevin Brisley\nLawnmower Man",
	&superpac_machine_driver, /* MachineDriver * */

	superpac_rom,             /* RomModule * */
	0, 0,                     /* ROM decrypt routines */
	0,                        /* samplenames */

	0/*TBR*/,superpac_input_ports,0/*TBR*/,0/*TBR*/,0/*TBR*/,

	superpac_color_prom,		  /* color prom */
	0,                        /* palette */
	0,                        /* color table */
	ORIENTATION_DEFAULT,

	superpac_hiload, superpac_hisave /* hi score save/load */
};

struct GameDriver pacnpal_driver =
{
	"Pac & Pal",
	"pacnpal",
	"Aaron Giles\nKevin Brisley\nLawnmower Man",
	&pacnpal_machine_driver,  /* MachineDriver * */

	pacnpal_rom,              /* RomModule * */
	0, 0,                     /* ROM decrypt routines */
	0,                        /* samplenames */

	0/*TBR*/,pacnpal_input_ports,0/*TBR*/,0/*TBR*/,0/*TBR*/,

	pacnpal_color_prom,       /* color prom */
	0,                        /* palette */
	0,                        /* color table */
	ORIENTATION_DEFAULT,

	pacnpal_hiload, pacnpal_hisave /* hi score save/load */
};


