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

📄 hyperspt.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	"08.sam","09.sam","0a.sam","0b.sam","0c.sam","0d.sam","0e.sam","0f.sam",
	"10.sam","11.sam","12.sam","13.sam","14.sam","15.sam","16.sam","17.sam",
	"18.sam","19.sam","1a.sam","1b.sam","1c.sam","1d.sam","1e.sam","1f.sam",
	"20.sam","21.sam","22.sam","23.sam","24.sam","25.sam","26.sam","27.sam",
	"28.sam","29.sam","2a.sam","2b.sam","2c.sam","2d.sam","2e.sam","2f.sam",
	"30.sam","31.sam","32.sam","33.sam","34.sam","35.sam","36.sam","37.sam",
	"38.sam","39.sam","3a.sam","3b.sam","3c.sam","3d.sam","3e.sam","3f.sam",
	"40.sam","41.sam","42.sam","43.sam","44.sam","45.sam","46.sam","47.sam",
	"48.sam","49.sam",
	0
};

static struct MachineDriver hyperspt_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6809,
			2048000,        /* 1.400 Mhz ??? */
			0,
			hyperspt_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 */
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,1	/* 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 */
	hyperspt_init_machine,

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

	VIDEO_TYPE_RASTER,
	0,
	hyperspt_vh_start,
	hyperspt_vh_stop,
	hyperspt_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_DAC,
			&konami_dac_interface
		},
		{
			SOUND_SN76496,
			&konami_sn76496_interface
		},
		{
			SOUND_VLM5030,
			&konami_vlm5030_interface
		}
	}
};

static struct MachineDriver roadf_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6809,
			2048000,        /* 1.400 Mhz ??? */
			0,
			roadf_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 */
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,1	/* 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 */
	hyperspt_init_machine,

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

	VIDEO_TYPE_RASTER,
	0,
	hyperspt_vh_start,
	hyperspt_vh_stop,
	roadf_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_DAC,
			&konami_dac_interface
		},
		{
			SOUND_SN76496,
			&konami_sn76496_interface
		},
		{
			SOUND_VLM5030,
			&konami_vlm5030_interface
		}
	}
};


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

  Game driver(s)

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

ROM_START( hyperspt_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "c01",          0x4000, 0x2000, 0x0c720eeb )
	ROM_LOAD( "c02",          0x6000, 0x2000, 0x560258e0 )
	ROM_LOAD( "c03",          0x8000, 0x2000, 0x9b01c7e6 )
	ROM_LOAD( "c04",          0xA000, 0x2000, 0x10d7e9a2 )
	ROM_LOAD( "c05",          0xC000, 0x2000, 0xb105a8cd )
	ROM_LOAD( "c06",          0xE000, 0x2000, 0x1a34a849 )

	ROM_REGION_DISPOSE(0x18000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "c26",          0x00000, 0x2000, 0xa6897eac )
	ROM_LOAD( "c24",          0x02000, 0x2000, 0x5fb230c0 )
	ROM_LOAD( "c22",          0x04000, 0x2000, 0xed9271a0 )
	ROM_LOAD( "c20",          0x06000, 0x2000, 0x183f4324 )
	ROM_LOAD( "c14",          0x08000, 0x2000, 0xc72d63be )
	ROM_LOAD( "c13",          0x0a000, 0x2000, 0x76565608 )
	ROM_LOAD( "c12",          0x0c000, 0x2000, 0x74d2cc69 )
	ROM_LOAD( "c11",          0x0e000, 0x2000, 0x66cbcb4d )
	ROM_LOAD( "c18",          0x10000, 0x2000, 0xed25e669 )
	ROM_LOAD( "c17",          0x12000, 0x2000, 0xb145b39f )
	ROM_LOAD( "c16",          0x14000, 0x2000, 0xd7ff9f2b )
	ROM_LOAD( "c15",          0x16000, 0x2000, 0xf3d454e6 )

	ROM_REGION(0x220)	/* color/lookup proms */
	ROM_LOAD( "c03_c27.bin",  0x0000, 0x0020, 0xbc8a5956 )
	ROM_LOAD( "j12_c28.bin",  0x0020, 0x0100, 0x2c891d59 )
	ROM_LOAD( "a09_c29.bin",  0x0120, 0x0100, 0x811a3f3f )

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "c10",          0x0000, 0x2000, 0x3dc1a6ff )
	ROM_LOAD( "c09",          0x2000, 0x2000, 0x9b525c3e )

	ROM_REGION(0x10000)	/*  64k for speech rom    */
	ROM_LOAD( "c08",          0x0000, 0x2000, 0xe8f8ea78 )
ROM_END

ROM_START( roadf_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "g05_g01.bin",  0x4000, 0x2000, 0xe2492a06 )
	ROM_LOAD( "g07_f02.bin",  0x6000, 0x2000, 0x0bf75165 )
	ROM_LOAD( "g09_g03.bin",  0x8000, 0x2000, 0xdde401f8 )
	ROM_LOAD( "g11_f04.bin",  0xA000, 0x2000, 0xb1283c77 )
	ROM_LOAD( "g13_f05.bin",  0xC000, 0x2000, 0x0ad4d796 )
	ROM_LOAD( "g15_f06.bin",  0xE000, 0x2000, 0xfa42e0ed )

	ROM_REGION_DISPOSE(0x14000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "a14_e26.bin",  0x00000, 0x4000, 0xf5c738e2 )
	ROM_LOAD( "a12_d24.bin",  0x04000, 0x2000, 0x2d82c930 )
	ROM_LOAD( "c14_e22.bin",  0x06000, 0x4000, 0xfbcfbeb9 )
	ROM_LOAD( "c12_d20.bin",  0x0a000, 0x2000, 0x5e0cf994 )
	ROM_LOAD( "j19_e14.bin",  0x0c000, 0x4000, 0x16d2bcff )
	ROM_LOAD( "g19_e18.bin",  0x10000, 0x4000, 0x490685ff )

	ROM_REGION(0x220)	/* color/lookup proms */
	ROM_LOAD( "c03_c27.bin",  0x0000, 0x0020, 0x45d5e352 )
	ROM_LOAD( "j12_c28.bin",  0x0020, 0x0100, 0x2955e01f )
	ROM_LOAD( "a09_c29.bin",  0x0120, 0x0100, 0x5b3b5f2a )

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

ROM_START( roadf2_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "5g",           0x4000, 0x2000, 0xd8070d30 )
	ROM_LOAD( "6g",           0x6000, 0x2000, 0x8b661672 )
	ROM_LOAD( "8g",           0x8000, 0x2000, 0x714929e8 )
	ROM_LOAD( "11g",          0xA000, 0x2000, 0x0f2c6b94 )
	ROM_LOAD( "g13_f05.bin",  0xC000, 0x2000, 0x0ad4d796 )
	ROM_LOAD( "g15_f06.bin",  0xE000, 0x2000, 0xfa42e0ed )

	ROM_REGION_DISPOSE(0x14000)    /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "a14_e26.bin",  0x00000, 0x4000, 0xf5c738e2 )
	ROM_LOAD( "a12_d24.bin",  0x04000, 0x2000, 0x2d82c930 )
	ROM_LOAD( "c14_e22.bin",  0x06000, 0x4000, 0xfbcfbeb9 )
	ROM_LOAD( "c12_d20.bin",  0x0a000, 0x2000, 0x5e0cf994 )
	ROM_LOAD( "j19_e14.bin",  0x0c000, 0x4000, 0x16d2bcff )
	ROM_LOAD( "g19_e18.bin",  0x10000, 0x4000, 0x490685ff )

	ROM_REGION(0x220)	/* color/lookup proms */
	ROM_LOAD( "c03_c27.bin",  0x0000, 0x0020, 0x45d5e352 )
	ROM_LOAD( "j12_c28.bin",  0x0020, 0x0100, 0x2955e01f )
	ROM_LOAD( "a09_c29.bin",  0x0120, 0x0100, 0x5b3b5f2a )

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



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


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



/*
 HyperSports has 2k 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[0x3800],0x4000-0x3800);
		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[0x3800],0x800);
		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 hyperspt_driver =
{
	__FILE__,
	0,
	"hyperspt",
	"HyperSports",
	"1984",
	"Konami (Centuri license)",
	"Chris Hardy (MAME driver)\nPaul Swan (color info)\nTatsuyuki Satoh(speech sound)",
	0,
	&hyperspt_machine_driver,
	0,

	hyperspt_rom,
	0, hyperspt_decode,
	hyperspt_sample_names,
	0,	/* sound_prom */

	hyperspt_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver roadf_driver =
{
	__FILE__,
	0,
	"roadf",
	"Road Fighter (set 1)",
	"1984",
	"Konami",
	"Chris Hardy (Hyper Sports driver)\nNicola Salmoria\nPaul Swan (color info)",
	0,
	&roadf_machine_driver,
	0,

	roadf_rom,
	0, hyperspt_decode,
	0,
	0,	/* sound_prom */

	roadf_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_90,

	0, 0
};

struct GameDriver roadf2_driver =
{
	__FILE__,
	&roadf_driver,
	"roadf2",
	"Road Fighter (set 2)",
	"1984",
	"Konami",
	"Chris Hardy (Hyper Sports driver)\nNicola Salmoria\nPaul Swan (color info)",
	0,
	&roadf_machine_driver,
	0,

	roadf2_rom,
	0, hyperspt_decode,
	0,
	0,	/* sound_prom */

	roadf_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_90,

	0, 0
};

⌨️ 快捷键说明

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