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

📄 trackfld.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			readmem,writemem,0,0,
			interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			14318180/4,	/* Z80 Clock is derived from a 14.31818 Mhz crystal */
			3,	/* memory region #3 */
			hyprolyb_sound_readmem,hyprolyb_sound_writemem,0,0,
			ignore_interrupt,0	/* interrupts are triggered by the main CPU */
		}
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* 1 CPU slice per frame - interleaving is forced when a sound command is written */
	trackfld_init_machine,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
	gfxdecodeinfo,
	32,16*16+16*16,
	trackfld_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	trackfld_vh_start,
	trackfld_vh_stop,
	trackfld_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_DAC,
			&konami_dac_interface
		},
		{
			SOUND_SN76496,
			&konami_sn76496_interface
		},
		{
			SOUND_ADPCM,
			&hyprolyb_adpcm_interface
		}
	}
};



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

  Game driver(s)

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

ROM_START( trackfld_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "a01_e01.bin",  0x6000, 0x2000, 0x2882f6d4 )
	ROM_LOAD( "a02_e02.bin",  0x8000, 0x2000, 0x1743b5ee )
	ROM_LOAD( "a03_k03.bin",  0xA000, 0x2000, 0x6c0d1ee9 )
	ROM_LOAD( "a04_e04.bin",  0xC000, 0x2000, 0x21d6c448 )
	ROM_LOAD( "a05_e05.bin",  0xE000, 0x2000, 0xf08c7b7e )

	ROM_REGION_DISPOSE(0xe000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "h16_e12.bin",  0x0000, 0x2000, 0x50075768 )
	ROM_LOAD( "h15_e11.bin",  0x2000, 0x2000, 0xdda9e29f )
	ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
	ROM_LOAD( "c11_d06.bin",  0x6000, 0x2000, 0x82e2185a )
	ROM_LOAD( "c12_d07.bin",  0x8000, 0x2000, 0x800ff1f1 )
	ROM_LOAD( "c13_d08.bin",  0xa000, 0x2000, 0xd9faf183 )
	ROM_LOAD( "c14_d09.bin",  0xc000, 0x2000, 0x5886c802 )

	ROM_REGION(0x0220)    /* color/lookup proms */
	ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
	ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
	ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )

	ROM_REGION(0x10000)	/*  64k for speech rom    */
	ROM_LOAD( "c9_d15.bin",   0x0000, 0x2000, 0xf546a56b )
ROM_END

ROM_START( trackflc_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "f01.1a",       0x6000, 0x2000, 0x4e32b360 )
	ROM_LOAD( "f02.2a",       0x8000, 0x2000, 0x4e7ebf07 )
	ROM_LOAD( "l03.3a",       0xA000, 0x2000, 0xfef4c0ea )
	ROM_LOAD( "f04.4a",       0xC000, 0x2000, 0x73940f2d )
	ROM_LOAD( "f05.5a",       0xE000, 0x2000, 0x363fd761 )

	ROM_REGION_DISPOSE(0xe000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "h16_e12.bin",  0x0000, 0x2000, 0x50075768 )
	ROM_LOAD( "h15_e11.bin",  0x2000, 0x2000, 0xdda9e29f )
	ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
	ROM_LOAD( "c11_d06.bin",  0x6000, 0x2000, 0x82e2185a )
	ROM_LOAD( "c12_d07.bin",  0x8000, 0x2000, 0x800ff1f1 )
	ROM_LOAD( "c13_d08.bin",  0xa000, 0x2000, 0xd9faf183 )
	ROM_LOAD( "c14_d09.bin",  0xc000, 0x2000, 0x5886c802 )

	ROM_REGION(0x0220)    /* color/lookup proms */
	ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
	ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
	ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )

	ROM_REGION(0x10000)	/*  64k for speech rom    */
	ROM_LOAD( "c9_d15.bin",   0x0000, 0x2000, 0xf546a56b )
ROM_END

ROM_START( hyprolym_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "hyprolym.a01", 0x6000, 0x2000, 0x82257fb7 )
	ROM_LOAD( "hyprolym.a02", 0x8000, 0x2000, 0x15b83099 )
	ROM_LOAD( "hyprolym.a03", 0xA000, 0x2000, 0xe54cc960 )
	ROM_LOAD( "hyprolym.a04", 0xC000, 0x2000, 0xd099b1e8 )
	ROM_LOAD( "hyprolym.a05", 0xE000, 0x2000, 0x974ff815 )

	ROM_REGION_DISPOSE(0xe000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "hyprolym.h16", 0x0000, 0x2000, 0x768bb63d )
	ROM_LOAD( "hyprolym.h15", 0x2000, 0x2000, 0x3af0e2a8 )
	ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
	ROM_LOAD( "c11_d06.bin",  0x6000, 0x2000, 0x82e2185a )
	ROM_LOAD( "c12_d07.bin",  0x8000, 0x2000, 0x800ff1f1 )
	ROM_LOAD( "c13_d08.bin",  0xa000, 0x2000, 0xd9faf183 )
	ROM_LOAD( "c14_d09.bin",  0xc000, 0x2000, 0x5886c802 )

	ROM_REGION(0x0220)    /* color/lookup proms */
	ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
	ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
	ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
	ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )

	ROM_REGION(0x10000)	/*  64k for speech rom    */
	ROM_LOAD( "c9_d15.bin",   0x0000, 0x2000, 0xf546a56b )
ROM_END

ROM_START( hyprolyb_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "a1.1",         0x6000, 0x2000, 0x9aee2d5a )
	ROM_LOAD( "hyprolym.a02", 0x8000, 0x2000, 0x15b83099 )
	ROM_LOAD( "a3.3",         0xA000, 0x2000, 0x2d6fc308 )
	ROM_LOAD( "hyprolym.a04", 0xC000, 0x2000, 0xd099b1e8 )
	ROM_LOAD( "hyprolym.a05", 0xE000, 0x2000, 0x974ff815 )

	ROM_REGION_DISPOSE(0xe000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "hyprolym.h16", 0x0000, 0x2000, 0x768bb63d )
	ROM_LOAD( "hyprolym.h15", 0x2000, 0x2000, 0x3af0e2a8 )
	ROM_LOAD( "h14_e10.bin",  0x4000, 0x2000, 0xc2166a5c )
	ROM_LOAD( "c11_d06.bin",  0x6000, 0x2000, 0x82e2185a )
	ROM_LOAD( "c12_d07.bin",  0x8000, 0x2000, 0x800ff1f1 )
	ROM_LOAD( "c13_d08.bin",  0xa000, 0x2000, 0xd9faf183 )
	ROM_LOAD( "c14_d09.bin",  0xc000, 0x2000, 0x5886c802 )

	ROM_REGION(0x0220)    /* color/lookup proms */
	ROM_LOAD( "tfprom.1",     0x0000, 0x0020, 0xd55f30b5 ) /* palette */
	ROM_LOAD( "tfprom.3",     0x0020, 0x0100, 0xd2ba4d32 ) /* sprite lookup table */
	ROM_LOAD( "tfprom.2",     0x0120, 0x0100, 0x053e5861 ) /* char lookup table */

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
	ROM_LOAD( "c2_d13.bin",   0x0000, 0x2000, 0x95bf79b6 )

	ROM_REGION(0x10000)	/*  64k for the 6802 which plays ADPCM samples */
	/* this bootleg uses a 6802 to "emulate" the VLM5030 speech chip */
	/* I didn't bother to emulate the 6802, I just play the samples. */
	ROM_LOAD( "2764.1",       0x8000, 0x2000, 0xa4cddeb8 )
	ROM_LOAD( "2764.2",       0xa000, 0x2000, 0xe9919365 )
	ROM_LOAD( "2764.3",       0xc000, 0x2000, 0xc3ec42e1 )
	ROM_LOAD( "2764.4",       0xe000, 0x2000, 0x76998389 )
ROM_END



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


	for (A = 0x6000;A < 0x10000;A++)
	{
		ROM[A] = KonamiDecode(RAM[A],A);
	}
}



/*
 Track'n'Field has 1k of battery backed RAM which can be erased by setting a dipswitch
 All we need to do is load it in. If the Dipswitch is set it will be erased
*/
static int we_flipped_the_switch;

static int hiload(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,0)) != 0)
	{
		osd_fread(f,&RAM[0x2C00],0x3000-0x2c00);
		osd_fclose(f);

		we_flipped_the_switch = 0;
	}
	else
	{
		struct InputPort *in;


		/* find the dip switch which resets the high score table, and set it on */
		in = Machine->input_ports;

		while (in->type != IPT_END)
		{
			if (in->name != NULL && in->name != IP_NAME_DEFAULT &&
					strcmp(in->name,"World Records") == 0)
			{
				if (in->default_value == in->mask)
				{
					in->default_value = 0;
					we_flipped_the_switch = 1;
				}
				break;
			}

			in++;
		}
	}

	return 1;
}

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[0x2C00],0x400);
		osd_fclose(f);
	}

	if (we_flipped_the_switch)
	{
		struct InputPort *in;


		/* find the dip switch which resets the high score table, and set it */
		/* back to off. */
		in = Machine->input_ports;

		while (in->type != IPT_END)
		{
			if (in->name != NULL && in->name != IP_NAME_DEFAULT &&
					strcmp(in->name,"World Records") == 0)
			{
				if (in->default_value == 0)
					in->default_value = in->mask;
				break;
			}

			in++;
		}

		we_flipped_the_switch = 0;
	}
}



struct GameDriver trackfld_driver =
{
	__FILE__,
	0,
	"trackfld",
	"Track & Field",
	"1983",
	"Konami",
	"Chris Hardy (MAME driver)\nTim Lindquist (color info)\nTatsuyuki Satoh(speech sound)",
	0,
	&machine_driver,
	0,

	trackfld_rom,
	0, trackfld_decode,
	trackfld_sample_names,

	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver trackflc_driver =
{
	__FILE__,
	&trackfld_driver,
	"trackflc",
	"Track & Field (Centuri)",
	"1983",
	"Konami (Centuri license)",
	"Chris Hardy (MAME driver)\nTim Lindquist (color info)\nTatsuyuki Satoh(speech sound)",
	0,
	&machine_driver,
	0,

	trackflc_rom,
	0, trackfld_decode,
	trackfld_sample_names,

	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver hyprolym_driver =
{
	__FILE__,
	&trackfld_driver,
	"hyprolym",
	"Hyper Olympic",
	"1983",
	"Konami",
	"Chris Hardy (MAME driver)\nTim Lindquist (color info)\nTatsuyuki Satoh(speech sound)",
	0,
	&machine_driver,
	0,

	hyprolym_rom,
	0, trackfld_decode,
	trackfld_sample_names,
	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver hyprolyb_driver =
{
	__FILE__,
	&trackfld_driver,
	"hyprolyb",
	"Hyper Olympic (bootleg)",
	"1983",
	"bootleg",
	"Chris Hardy (MAME driver)\nTim Lindquist (color info)\nTatsuyuki Satoh(speech sound)",
	0,
	&hyprolyb_machine_driver,
	0,

	hyprolyb_rom,
	0, trackfld_decode,
	trackfld_sample_names,
	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

⌨️ 快捷键说明

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