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

📄 firetrap.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
INPUT_PORTS_END



static struct GfxLayout charlayout =
{
	8,8,	/* 8*8 characters */
	512,	/* 512 characters */
	2,	/* 2 bits per pixel */
	{ 0, 4 },	/* the two bitplanes for 4 pixels are packed into one byte */
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	{ 3, 2, 1, 0, 0x1000*8+3, 0x1000*8+2, 0x1000*8+1, 0x1000*8+0 },
	8*8	/* every char takes 8 consecutive bytes */
};
static struct GfxLayout tilelayout =
{
	16,16,	/* 16*16 characters */
	256,	/* 256 characters */
	4,	/* 4 bits per pixel */
	{ 0, 4, 0x8000*8+0, 0x8000*8+4 },	/* the two bitplanes for 4 pixels are packed into one byte */
	{ 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 },
	{ 3, 2, 1, 0, 0x2000*8+3, 0x2000*8+2, 0x2000*8+1, 0x2000*8+0,
			16*8+3, 16*8+2, 16*8+1, 16*8+0, 16*8+0x2000*8+3, 16*8+0x2000*8+2, 16*8+0x2000*8+1, 16*8+0x2000*8+0 },
	32*8	/* every char takes 32 consecutive bytes */
};
static struct GfxLayout spritelayout =
{
	16,16,	/* 16*16 sprites */
	1024,	/* 1024 sprites */
	4,	/* 4 bits per pixel */
	{ 0, 1024*16*16, 2*1024*16*16, 3*1024*16*16 },	/* the bitplanes are separated */
	{ 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 },
	{ 7, 6, 5, 4, 3, 2, 1, 0,
			16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0 },
	32*8	/* every sprite takes 32 consecutive bytes */
};

static struct GfxDecodeInfo gfxdecodeinfo[] =
{
	{ 1, 0x00000, &charlayout,	        0, 16 },
	{ 1, 0x02000, &tilelayout,	     16*4,  4 },
	{ 1, 0x06000, &tilelayout,	     16*4,  4 },
	{ 1, 0x12000, &tilelayout,	     16*4,  4 },
	{ 1, 0x16000, &tilelayout,	     16*4,  4 },
	{ 1, 0x22000, &tilelayout,	16*4+4*16,  4 },
	{ 1, 0x26000, &tilelayout,	16*4+4*16,  4 },
	{ 1, 0x32000, &tilelayout,	16*4+4*16,  4 },
	{ 1, 0x36000, &tilelayout,	16*4+4*16,  4 },
	{ 1, 0x42000, &spritelayout, 16*4+4*16+4*16,  4 },
	{ -1 } /* end of array */
};



static struct YM3526interface ym3526_interface =
{
	1,			/* 1 chip (no more supported) */
	3600000,	/* 3.600000 MHz ? (partially supported) */
	{ 255 }		/* (not supported) */
};

static struct MSM5205interface msm5205_interface =
{
	1,		/* 1 chip */
	8000,	/* 8000Hz playback ? */
	firetrap_adpcm_int,		/* interrupt function */
	{ 255 }
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			6000000,	/* 6 Mhz */
			0,
			readmem,writemem,0,0,
			nmi_interrupt,1
		},
		{
			CPU_M6502 | CPU_AUDIO_CPU,
			3072000/2,	/* 1.536 Mhz? */
			3,	/* memory region #3 */
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,0
							/* IRQs are caused by the ADPCM chip */
							/* NMIs are caused by the main CPU */
		},
	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, 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, 0*8, 32*8-1 },
	gfxdecodeinfo,
	256+1,16*4+4*16+4*16+4*16,
	firetrap_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	firetrap_vh_start,
	firetrap_vh_stop,
	firetrap_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_YM3526,
			&ym3526_interface
		},
		{
			SOUND_MSM5205,
			&msm5205_interface
		}
	}
};



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

  Game driver(s)

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

ROM_START( firetrap_rom )
	ROM_REGION(0x20000)	/* 64k for code + 64k for banked ROMs */
	ROM_LOAD( "di02.bin",     0x00000, 0x8000, 0x3d1e4bf7 )
	ROM_LOAD( "di01.bin",     0x10000, 0x8000, 0x9bbae38b )
	ROM_LOAD( "di00.bin",     0x18000, 0x8000, 0xd0dad7de )

	ROM_REGION_DISPOSE(0x62000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "di03.bin",     0x00000, 0x2000, 0x46721930 )	/* characters */
	ROM_LOAD( "di06.bin",     0x02000, 0x8000, 0x441d9154 )	/* tiles */
	ROM_LOAD( "di07.bin",     0x0a000, 0x8000, 0xef0a7e23 )
	ROM_LOAD( "di04.bin",     0x12000, 0x8000, 0x8e6e7eec )
	ROM_LOAD( "di05.bin",     0x1a000, 0x8000, 0xec080082 )
	ROM_LOAD( "di09.bin",     0x22000, 0x8000, 0xd11e28e8 )
	ROM_LOAD( "di11.bin",     0x2a000, 0x8000, 0x6424d5c3 )
	ROM_LOAD( "di08.bin",     0x32000, 0x8000, 0xc32a21d8 )
	ROM_LOAD( "di10.bin",     0x3a000, 0x8000, 0x9b89300a )
	ROM_LOAD( "di16.bin",     0x42000, 0x8000, 0x0de055d7 )	/* sprites */
	ROM_LOAD( "di13.bin",     0x4a000, 0x8000, 0x869219da )
	ROM_LOAD( "di14.bin",     0x52000, 0x8000, 0x6b65812e )
	ROM_LOAD( "di15.bin",     0x5a000, 0x8000, 0x3e27f77d )

	ROM_REGION(0x200)	/* color proms */
	ROM_LOAD( "firetrap.3b",  0x0000, 0x100, 0x8bb45337 ) /* palette red and green component */
	ROM_LOAD( "firetrap.4b",  0x0100, 0x100, 0xd5abfc64 ) /* palette blue component */

	ROM_REGION(0x18000)	/* 64k for the sound CPU + 32k for banked ROMs */
	ROM_LOAD( "di17.bin",     0x08000, 0x8000, 0x8605f6b9 )
	ROM_LOAD( "di18.bin",     0x10000, 0x8000, 0x49508c93 )

	/* there's also a protected 8751 microcontroller with ROM onboard */
ROM_END

ROM_START( firetpbl_rom )
	ROM_REGION(0x28000)	/* 64k for code + 96k for banked ROMs */
	ROM_LOAD( "ft0d.bin",     0x00000, 0x8000, 0x793ef849 )
	ROM_LOAD( "ft0c.bin",     0x10000, 0x8000, 0x5c8a0562 )
	ROM_LOAD( "ft0b.bin",     0x18000, 0x8000, 0xf2412fe8 )
	ROM_LOAD( "ft0a.bin",     0x08000, 0x8000, 0x613313ee )	/* unprotection code */

	ROM_REGION_DISPOSE(0x62000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "ft0e.bin",     0x00000, 0x2000, 0xa584fc16 )	/* characters */
	ROM_LOAD( "di06.bin",     0x02000, 0x8000, 0x441d9154 )	/* tiles */
	ROM_LOAD( "di07.bin",     0x0a000, 0x8000, 0xef0a7e23 )
	ROM_LOAD( "di04.bin",     0x12000, 0x8000, 0x8e6e7eec )
	ROM_LOAD( "di05.bin",     0x1a000, 0x8000, 0xec080082 )
	ROM_LOAD( "di09.bin",     0x22000, 0x8000, 0xd11e28e8 )
	ROM_LOAD( "di11.bin",     0x2a000, 0x8000, 0x6424d5c3 )
	ROM_LOAD( "di08.bin",     0x32000, 0x8000, 0xc32a21d8 )
	ROM_LOAD( "di10.bin",     0x3a000, 0x8000, 0x9b89300a )
	ROM_LOAD( "di16.bin",     0x42000, 0x8000, 0x0de055d7 )	/* sprites */
	ROM_LOAD( "di13.bin",     0x4a000, 0x8000, 0x869219da )
	ROM_LOAD( "di14.bin",     0x52000, 0x8000, 0x6b65812e )
	ROM_LOAD( "di15.bin",     0x5a000, 0x8000, 0x3e27f77d )

	ROM_REGION(0x200)	/* color proms */
	ROM_LOAD( "firetrap.3b",  0x0000, 0x100, 0x8bb45337 ) /* palette red and green component */
	ROM_LOAD( "firetrap.4b",  0x0100, 0x100, 0xd5abfc64 ) /* palette blue component */

	ROM_REGION(0x18000)	/* 64k for the sound CPU + 32k for banked ROMs */
	ROM_LOAD( "di17.bin",     0x08000, 0x8000, 0x8605f6b9 )
	ROM_LOAD( "di18.bin",     0x10000, 0x8000, 0x49508c93 )
ROM_END


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


	if (memcmp(&RAM[0xca47],"\x02\x14\x00",3) == 0)
	{
		void *f;


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

		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[Machine->drv->cpu[0].memory_region];


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



struct GameDriver firetrap_driver =
{
	__FILE__,
	0,
	"firetrap",
	"Fire Trap",
	"1986",
	"Data East USA",
	"Nicola Salmoria (MAME driver)\nTim Lindquist (color and hardware info)",
	GAME_NOT_WORKING,
	&machine_driver,
	0,

	firetrap_rom,
	0, 0,
	0,
	0,

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver firetpbl_driver =
{
	__FILE__,
	&firetrap_driver,
	"firetpbl",
	"Fire Trap (Japan bootleg)",
	"1986",
	"bootleg",
	"Nicola Salmoria (MAME driver)\nTim Lindquist (color and hardware info)",
	0,
	&machine_driver,
	0,

	firetpbl_rom,
	0, 0,
	0,
	0,

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

⌨️ 快捷键说明

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