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

📄 rallyx.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	PORT_DIPSETTING(    0x40, "2 Coins/1 Credit" )
	PORT_DIPSETTING(    0xc0, "1 Coin/1 Credit" )
	PORT_DIPSETTING(    0x80, "1 Coin/2 Credits" )
	PORT_DIPSETTING(    0x00, "Free Play" )
INPUT_PORTS_END



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 */
	{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },	/* bits are packed in groups of four */
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	16*8	/* every char takes 16 bytes */
};
static struct GfxLayout spritelayout =
{
	16,16,	/* 16*16 sprites */
	64,	/* 64 sprites */
	2,	/* 2 bits per pixel */
	{ 0, 4 },	/* the two bitplanes for 4 pixels are packed into one byte */
	{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,	/* bits are packed in groups of four */
			 24*8+0, 24*8+1, 24*8+2, 24*8+3, 0, 1, 2, 3 },
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
			32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
	64*8	/* every sprite takes 64 bytes */
};
static struct GfxLayout radardotlayout =
{
	/* there is no gfx ROM for this one, it is generated by the hardware */
	2,2,	/* 2*2 square */
	1,	/* just one */
	1,	/* 1 bit per pixel */
	{ 0 },
	{ 0, 0 },	/* I "know" that this bit of the */
	{ 0, 0 },	/* graphics ROMs is 1 */
	0	/* no use */
};



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



static struct namco_interface namco_interface =
{
	3072000/32,	/* sample rate */
	3,			/* number of voices */
	32,			/* gain adjustment */
	255,		/* playback volume */
	3			/* memory region */
};

static struct Samplesinterface samples_interface =
{
	1	/* 1 channel */
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			3072000,	/* 3.072 Mhz ? */
			0,
			readmem,writemem,0,writeport,
			interrupt,1
		}
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* single CPU, no need for interleaving */
	0,

	/* video hardware */
	36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
	gfxdecodeinfo,
	32,64*4+4*2,
	rallyx_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	rallyx_vh_start,
	rallyx_vh_stop,
	rallyx_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_NAMCO,
			&namco_interface
		},
		{
			SOUND_SAMPLES,
			&samples_interface
		}
	}
};



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

  Game driver(s)

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

ROM_START( rallyx_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "1b",           0x0000, 0x1000, 0x5882700d )
	ROM_LOAD( "1e",           0x1000, 0x1000, 0x786585ec )
	ROM_LOAD( "1h",           0x2000, 0x1000, 0x110d7dcd )
	ROM_LOAD( "1k",           0x3000, 0x1000, 0x473ab447 )

	ROM_REGION_DISPOSE(0x1000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "8e",           0x0000, 0x1000, 0x277c1de5 )

	ROM_REGION(0x0120)	/* color proms */
	ROM_LOAD( "m3-7603.11n",  0x0000, 0x0020, 0xc7865434 )
	ROM_LOAD( "im5623.8p",    0x0020, 0x0100, 0x834d4fda )

	ROM_REGION(0x0100)	/* sound prom */
	ROM_LOAD( "im5623.3p",    0x0000, 0x0100, 0x4bad7017 )
ROM_END

ROM_START( nrallyx_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "nrallyx.1b",   0x0000, 0x1000, 0x9404c8d6 )
	ROM_LOAD( "nrallyx.1e",   0x1000, 0x1000, 0xac01bf3f )
	ROM_LOAD( "nrallyx.1h",   0x2000, 0x1000, 0xaeba29b5 )
	ROM_LOAD( "nrallyx.1k",   0x3000, 0x1000, 0x78f17da7 )

	ROM_REGION_DISPOSE(0x1000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "nrallyx.8e",   0x0000, 0x1000, 0xca7a174a )

	ROM_REGION(0x0120)	/* color proms */
	ROM_LOAD( "nrallyx.pr1",  0x0000, 0x0020, 0xa0a49017 )
	ROM_LOAD( "nrallyx.pr2",  0x0020, 0x0100, 0xb2b7ca15 )

	ROM_REGION(0x0100)	/* sound prom */
	ROM_LOAD( "nrallyx.spr",  0x0000, 0x0100, 0xb75c4e87 )
ROM_END



static const char *rallyx_sample_names[] =
{
	"*rallyx",
	"BANG.SAM",
	0	/* end of array */
};



static int hiload(void)     /* V.V */
{
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


	/* check if the hi score table has already been initialized */
	if (memcmp(&RAM[0x8060],"\x00\x00\x00\x30\x40\x40\x40\x02",8) == 0)
	{
		void *f;

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

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

}


static void hisave(void)    /* V.V */
{
	void *f;
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


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



struct GameDriver rallyx_driver =
{
	__FILE__,
	0,
	"rallyx",
	"Rally X",
	"1980",
	"[Namco] (Midway license)",
	"Nicola Salmoria (MAME driver)\nMirko Buffoni (bang sound)\nMarco Cassili\nGary Walton (color info)\nSimon Walls (color info)",
	0,
	&machine_driver,
	rallyx_init,

	rallyx_rom,
	0, 0,
	rallyx_sample_names,
	0,	/* sound_prom */

	rallyx_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver nrallyx_driver =
{
	__FILE__,
	0,
	"nrallyx",
	"New Rally X",
	"1981",
	"Namco",
	"Nicola Salmoria (MAME driver)\nMirko Buffoni (bang sound)\nMarco Cassili",
	0,
	&machine_driver,
	rallyx_init,

	nrallyx_rom,
	0, 0,
	rallyx_sample_names,
	0,	/* sound_prom */

	nrallyx_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

⌨️ 快捷键说明

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