⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpatrol.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	PORT_DIPSETTING(    0x03, "1 Coin/6 Credits" )
	PORT_DIPSETTING(    0x02, "1 Coin/7 Credits" )
	PORT_DIPSETTING(    0x01, "1 Coin/8 Credits" )
	PORT_DIPSETTING(    0x00, "Free Play" )
 	PORT_DIPNAME( 0x30, 0x30, "Coin A  Mode 2", IP_KEY_NONE )   /* mapped on coin mode 2 */
	PORT_DIPSETTING(    0x10, "3 Coins/1 Credit" )
	PORT_DIPSETTING(    0x20, "2 Coins/1 Credit" )
	PORT_DIPSETTING(    0x30, "1 Coin/1 Credit" )
	PORT_DIPSETTING(    0x00, "Free Play" )
	PORT_DIPNAME( 0xc0, 0xc0, "Coin B  Mode 2", IP_KEY_NONE )
	PORT_DIPSETTING(    0xc0, "1 Coin/2 Credits" )
	PORT_DIPSETTING(    0x80, "1 Coin/3 Credits" )
	PORT_DIPSETTING(    0x40, "1 Coin/5 Credits" )
	PORT_DIPSETTING(    0x00, "1 Coin/6 Credits" )
INPUT_PORTS_END



static struct GfxLayout charlayout =
{
	8,8,    /* 8*8 characters */
	512,    /* 512 characters */
	2,      /* 2 bits per pixel */
	{ 0, 512*8*8 }, /* the two bitplanes are separated */
	{ 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     /* every char takes 8 consecutive bytes */
};
static struct GfxLayout spritelayout =
{
	16,16,  /* 16*16 sprites */
	128,    /* 128 sprites */
	2,      /* 2 bits per pixel */
	{ 0, 128*16*16 },       /* the two bitplanes are separated */
	{ 0, 1, 2, 3, 4, 5, 6, 7,
			16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
	32*8    /* every sprite takes 32 consecutive bytes */
};
static struct GfxLayout bgcharlayout =
{
	32,32,  /* 32*32 characters (actually, it is just 1 big 256x64 image) */
	8,      /* 8 characters */
	2,      /* 2 bits per pixel */
	{ 4, 0 },       /* the two bitplanes for 4 pixels are packed into one byte */
	{ 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, 2*8+0, 2*8+1, 2*8+2, 2*8+3, 3*8+0, 3*8+1, 3*8+2, 3*8+3,
			4*8+0, 4*8+1, 4*8+2, 4*8+3, 5*8+0, 5*8+1, 5*8+2, 5*8+3, 6*8+0, 6*8+1, 6*8+2, 6*8+3, 7*8+0, 7*8+1, 7*8+2, 7*8+3 },
	{ 0*512, 1*512, 2*512, 3*512, 4*512, 5*512, 6*512, 7*512, 8*512, 9*512, 10*512, 11*512, 12*512, 13*512, 14*512, 15*512,
			16*512, 17*512, 18*512, 19*512, 20*512, 21*512, 22*512, 23*512, 24*512, 25*512, 26*512, 27*512, 28*512, 29*512, 30*512, 31*512 },
	8*8
};



static struct GfxDecodeInfo gfxdecodeinfo[] =
{
	{ 1, 0x0000, &charlayout,               0, 64 },
	{ 1, 0x2000, &spritelayout,          64*4, 16 },
	{ 1, 0x4000, &bgcharlayout, 64*4+16*4+0*4,  1 },	/* top half */
	{ 1, 0x4800, &bgcharlayout, 64*4+16*4+0*4,  1 },	/* bottom half */
	{ 1, 0x5000, &bgcharlayout, 64*4+16*4+1*4,  1 },	/* top half */
	{ 1, 0x5800, &bgcharlayout, 64*4+16*4+1*4,  1 },	/* bottom half */
	{ 1, 0x6000, &bgcharlayout, 64*4+16*4+2*4,  1 },	/* top half */
	{ 1, 0x6800, &bgcharlayout, 64*4+16*4+2*4,  1 },	/* bottom half */
	{ -1 } /* end of array */
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			3072000,        /* 3.072 Mhz ? */
			0,
			readmem,writemem,0,writeport,
			interrupt,1
		},
		{
			CPU_M6803 | CPU_AUDIO_CPU,
			1000000,        /* 1.0 Mhz ? */
			3,
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,0	/* interrupts are generated by the ADPCM hardware */
		}
	},
	57, 1790,	/* accurate frequency, measured on a real board, is 56.75Hz. */
				/* the Lode Runner manual (similar but different hardware) */
				/* talks about 55Hz and 1790ms vblank duration. */
	1,	/* 1 CPU slice per frame - interleaving is forced when a sound command is written */
	0,

	/* video hardware */
	32*8, 32*8, { 1*8, 31*8-1, 1*8, 32*8-1 },
	gfxdecodeinfo,
	128+32+32,64*4+16*4+3*4,
	mpatrol_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	mpatrol_vh_start,
	mpatrol_vh_stop,
	mpatrol_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_AY8910,
			&irem_ay8910_interface
		},
		{
			SOUND_MSM5205,
			&irem_msm5205_interface
		}
	}
};



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

  Game driver(s)

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

ROM_START( mpatrol_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "mp-a.3m",      0x0000, 0x1000, 0x5873a860 )
	ROM_LOAD( "mp-a.3l",      0x1000, 0x1000, 0xf4b85974 )
	ROM_LOAD( "mp-a.3k",      0x2000, 0x1000, 0x2e1a598c )
	ROM_LOAD( "mp-a.3j",      0x3000, 0x1000, 0xdd05b587 )

	ROM_REGION_DISPOSE(0x7000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "mp-e.3e",      0x0000, 0x1000, 0xe3ee7f75 )       /* chars */
	ROM_LOAD( "mp-e.3f",      0x1000, 0x1000, 0xcca6d023 )
	ROM_LOAD( "mp-b.3m",      0x2000, 0x1000, 0x707ace5e )       /* sprites */
	ROM_LOAD( "mp-b.3n",      0x3000, 0x1000, 0x9b72133a )
	ROM_LOAD( "mp-e.3l",      0x4000, 0x1000, 0xc46a7f72 )       /* background graphics */
	ROM_LOAD( "mp-e.3k",      0x5000, 0x1000, 0xc7aa1fb0 )
	ROM_LOAD( "mp-e.3h",      0x6000, 0x1000, 0xa0919392 )

	ROM_REGION(0x0240)     /* color proms */
	ROM_LOAD( "2a",           0x0000, 0x0100, 0x0f193a50 ) /* character palette */
	ROM_LOAD( "1m",           0x0100, 0x0020, 0x6a57eff2 ) /* background palette */
	ROM_LOAD( "1c1j",         0x0120, 0x0020, 0x26979b13 ) /* sprite palette */
	ROM_LOAD( "2hx",          0x0140, 0x0100, 0x7ae4cd97 ) /* sprite lookup table */

	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "mp-snd.1a",    0xf000, 0x1000, 0x561d3108 )
ROM_END

ROM_START( mpatrolw_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "mpw-a.3m",     0x0000, 0x1000, 0xbaa1a1d4 )
	ROM_LOAD( "mpw-a.3l",     0x1000, 0x1000, 0x52459e51 )
	ROM_LOAD( "mpw-a.3k",     0x2000, 0x1000, 0x9b249fe5 )
	ROM_LOAD( "mpw-a.3j",     0x3000, 0x1000, 0xfee76972 )

	ROM_REGION_DISPOSE(0x7000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "mpw-e.3e",     0x0000, 0x1000, 0xf56e01fe )       /* chars */
	ROM_LOAD( "mpw-e.3f",     0x1000, 0x1000, 0xcaaba2d9 )
	ROM_LOAD( "mp-b.3m",      0x2000, 0x1000, 0x707ace5e )       /* sprites */
	ROM_LOAD( "mp-b.3n",      0x3000, 0x1000, 0x9b72133a )
	ROM_LOAD( "mp-e.3l",      0x4000, 0x1000, 0xc46a7f72 )       /* background graphics */
	ROM_LOAD( "mp-e.3k",      0x5000, 0x1000, 0xc7aa1fb0 )
	ROM_LOAD( "mp-e.3h",      0x6000, 0x1000, 0xa0919392 )

	ROM_REGION(0x0240)     /* color proms */
	ROM_LOAD( "2a",           0x0000, 0x0100, 0x0f193a50 ) /* character palette */
	ROM_LOAD( "1m",           0x0100, 0x0020, 0x6a57eff2 ) /* background palette */
	ROM_LOAD( "1c1j",         0x0120, 0x0020, 0x26979b13 ) /* sprite palette */
	ROM_LOAD( "2hx",          0x0140, 0x0100, 0x7ae4cd97 ) /* sprite lookup table */

	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "mp-snd.1a",    0xf000, 0x1000, 0x561d3108 )
ROM_END

ROM_START( mranger_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "mp-a.3m",      0x0000, 0x1000, 0x5873a860 )
	ROM_LOAD( "mr-a.3l",      0x1000, 0x1000, 0x217dd431 )
	ROM_LOAD( "mr-a.3k",      0x2000, 0x1000, 0x9f0af7b2 )
	ROM_LOAD( "mr-a.3j",      0x3000, 0x1000, 0x7fe8e2cd )

	ROM_REGION_DISPOSE(0x7000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "mp-e.3e",      0x0000, 0x1000, 0xe3ee7f75 )       /* chars */
	ROM_LOAD( "mp-e.3f",      0x1000, 0x1000, 0xcca6d023 )
	ROM_LOAD( "mp-b.3m",      0x2000, 0x1000, 0x707ace5e )       /* sprites */
	ROM_LOAD( "mp-b.3n",      0x3000, 0x1000, 0x9b72133a )
	ROM_LOAD( "mp-e.3l",      0x4000, 0x1000, 0xc46a7f72 )       /* background graphics */
	ROM_LOAD( "mp-e.3k",      0x5000, 0x1000, 0xc7aa1fb0 )
	ROM_LOAD( "mp-e.3h",      0x6000, 0x1000, 0xa0919392 )

	ROM_REGION(0x0240)     /* color proms */
	ROM_LOAD( "2a",           0x0000, 0x0100, 0x0f193a50 ) /* character palette */
	ROM_LOAD( "1m",           0x0100, 0x0020, 0x6a57eff2 ) /* background palette */
	ROM_LOAD( "1c1j",         0x0120, 0x0020, 0x26979b13 ) /* sprite palette */
	ROM_LOAD( "2hx",          0x0140, 0x0100, 0x7ae4cd97 ) /* sprite lookup table */

	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "mp-snd.1a",    0xf000, 0x1000, 0x561d3108 )
ROM_END



static int hiload(void)
{
	static int loop = 0;


	unsigned char *RAM = Machine->memory_region[0];

	/* check if the hi score table has already been initialized */
	/* the high score table is intialized to all 0, so first of all */
	/* we dirty it, then we wait for it to be cleared again */
	if (loop == 0)
	{
		memset(&RAM[0x0e008],0xff,44);
		loop = 1;
	}

	if (RAM[0x0e008] == 0 && RAM[0x0e04b] == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x0e008],44);
			osd_fclose(f);
		}

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

static void hisave(void)
{
	void *f;

	unsigned char *RAM = Machine->memory_region[0];

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



struct GameDriver mpatrol_driver =
{
	__FILE__,
	0,
	"mpatrol",
	"Moon Patrol",
	"1982",
	"Irem",
	"Nicola Salmoria\nChris Hardy\nValerio Verrando\nTim Lindquist (color info)\nAaron Giles (sound)\nMarco Cassili",
	0,
	&machine_driver,
	0,

	mpatrol_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	mpatrol_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver mpatrolw_driver =
{
	__FILE__,
	&mpatrol_driver,
	"mpatrolw",
	"Moon Patrol (Williams)",
	"1982",
	"Irem (Williams license)",
	"Nicola Salmoria\nChris Hardy\nValerio Verrando\nTim Lindquist (color info)\nAaron Giles (sound)\nMarco Cassili",
	0,
	&machine_driver,
	0,

	mpatrolw_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	mpatrolw_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver mranger_driver =
{
	__FILE__,
	&mpatrol_driver,
	"mranger",
	"Moon Ranger",
	"1982",
	"bootleg",
	"Nicola Salmoria (MAME driver)\nChris Hardy (hardware info)\nTim Lindquist (color info)\nAaron Giles (sound)\nMarco Cassili",
	0,
	&machine_driver,
	0,

	mranger_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	mpatrol_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -