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

📄 tmnt.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 3 页
字号:
		{
			SOUND_SAMPLES,
			&samples_interface
		}
	}
};

static struct MachineDriver punkshot_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M68000,
			12000000,	/* CPU is 68000/12, but this doesn't necessarily mean it's */
						/* running at 12MHz. TMNT uses 8MHz */
			0,
			punkshot_readmem,punkshot_writemem,0,0,
			punkshot_interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			3579545,	/* 3.579545 MHz */
			3,
			punkshot_s_readmem,punkshot_s_writemem,0,0,
			nmi_interrupt,1	/* IRQs are triggered by the main CPU */
							/* I don't know who generates NMIs, probably a sound chip */
							/* because the code requires them to get out from HALT (the. */
							/* NMI handler is just RETN) */
		}
	},
	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 */
	0,

	/* video hardware */
	64*8, 32*8, { 13*8, (64-13)*8-1, 2*8, 30*8-1 },	/* not sure about the horizontal visible area */
	punkshot_gfxdecodeinfo,
	128*16,128*16,
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
	0,
	punkshot_vh_start,
	punkshot_vh_stop,
	punkshot_vh_screenrefresh,

	/* sound hardware */
	SOUND_SUPPORTS_STEREO,0,0,0,
	{
		{
			SOUND_YM2151,
			&ym2151_interface
		}
	}
};

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

  High score save/load

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

static int tmnt_hiload(void)
{
	void *f;

	/* check if the hi score table has already been initialized */


if ((READ_WORD(&(cpu_bankbase[1][0x03500])) == 0x0312) && (READ_WORD(&(cpu_bankbase[1][0x03502])) == 0x0257) && (READ_WORD(&(cpu_bankbase[1][0x03512])) == 0x0101) && (READ_WORD(&(cpu_bankbase[1][0x035C8])) == 0x4849) && (READ_WORD(&(cpu_bankbase[1][0x035CA])) == 0x4400) && (READ_WORD(&(cpu_bankbase[1][0x035EC])) == 0x4D49))

{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread_msbfirst(f,&(cpu_bankbase[1][0x03500]),0x14);
			osd_fread_msbfirst(f,&(cpu_bankbase[1][0x035C8]),0x27);
			osd_fclose(f);
		}
		return 1;
	}
	else return 0;
}

static void tmnt_hisave(void)
{
	void *f;

	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
	{
		osd_fwrite_msbfirst(f,&(cpu_bankbase[1][0x03500]),0x14);
		osd_fwrite_msbfirst(f,&(cpu_bankbase[1][0x035C8]),0x27);


		osd_fclose(f);
	}
}

static int punkshot_hiload(void)
{
	void *f;

	/* check if the hi score table has already been initialized */


if ((READ_WORD(&(cpu_bankbase[1][0x00708])) == 0x0007) && (READ_WORD(&(cpu_bankbase[1][0x0070A])) == 0x2020) && (READ_WORD(&(cpu_bankbase[1][0x0072C])) == 0x464C))

{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread_msbfirst(f,&(cpu_bankbase[1][0x00708]),0x28);
			osd_fclose(f);
		}
		return 1;
	}
	else return 0;
}

static void punkshot_hisave(void)
{
	void *f;

	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
	{
		osd_fwrite_msbfirst(f,&(cpu_bankbase[1][0x00708]),0x28);
		osd_fclose(f);
	}
}

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

  Game driver(s)

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

ROM_START( tmnt_rom )
	ROM_REGION(0x60000)	/* 2*128k and 2*64k for 68000 code */
	ROM_LOAD_EVEN( "963-r23",      0x00000, 0x20000, 0xa7f61195 )
	ROM_LOAD_ODD ( "963-r24",      0x00000, 0x20000, 0x661e056a )
	ROM_LOAD_EVEN( "963-r21",      0x40000, 0x10000, 0xde047bb6 )
	ROM_LOAD_ODD ( "963-r22",      0x40000, 0x10000, 0xd86a0888 )

	ROM_REGION_DISPOSE(0x1000)
	/* empty memory region - not used by the game, but needed because the main */
	/* core currently always frees region #1 after initialization. */

	ROM_REGION(0x300000)	/* graphics (addressable by the main CPU) */
	ROM_LOAD( "963-a28",      0x000000, 0x80000, 0xdb4769a8 )        /* 8x8 tiles */
	ROM_LOAD( "963-a29",      0x080000, 0x80000, 0x8069cd2e )        /* 8x8 tiles */
	ROM_LOAD( "963-a17",      0x100000, 0x80000, 0xb5239a44 )        /* sprites */
	ROM_LOAD( "963-a18",      0x180000, 0x80000, 0xdd51adef )        /* sprites */
	ROM_LOAD( "963-a15",      0x200000, 0x80000, 0x1f324eed )        /* sprites */
	ROM_LOAD( "963-a16",      0x280000, 0x80000, 0xd4bd9984 )        /* sprites */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "963-e20",      0x00000, 0x08000, 0x1692a6d6 )

	ROM_REGION(0x80000)	/* 512k for the title music sample */
	ROM_LOAD( "963-a25",      0x00000, 0x80000, 0xfca078c7 )

	ROM_REGION(0x40000)	/* 128k+128k for the samples */
	ROM_LOAD( "963-a26",      0x00000, 0x20000, 0xe2ac3063 ) /* samples for 007232 */
	ROM_LOAD( "963-a27",      0x20000, 0x20000, 0x2dfd674b ) /* samples for UPD7759C */
ROM_END

ROM_START( tmntj_rom )
	ROM_REGION(0x60000)	/* 2*128k and 2*64k for 68000 code */
	ROM_LOAD_EVEN( "963-x23",      0x00000, 0x20000, 0xa9549004 )
	ROM_LOAD_ODD ( "963-x24",      0x00000, 0x20000, 0xe5cc9067 )
	ROM_LOAD_EVEN( "963-x21",      0x40000, 0x10000, 0x5789cf92 )
	ROM_LOAD_ODD ( "963-x22",      0x40000, 0x10000, 0x0a74e277 )

	ROM_REGION_DISPOSE(0x1000)
	/* empty memory region - not used by the game, but needed because the main */
	/* core currently always frees region #1 after initialization. */

	ROM_REGION(0x300000)	/* graphics (addressable by the main CPU) */
	ROM_LOAD( "963-a28",      0x000000, 0x80000, 0xdb4769a8 )        /* 8x8 tiles */
	ROM_LOAD( "963-a29",      0x080000, 0x80000, 0x8069cd2e )        /* 8x8 tiles */
	ROM_LOAD( "963-a17",      0x100000, 0x80000, 0xb5239a44 )        /* sprites */
	ROM_LOAD( "963-a18",      0x180000, 0x80000, 0xdd51adef )        /* sprites */
	ROM_LOAD( "963-a15",      0x200000, 0x80000, 0x1f324eed )        /* sprites */
	ROM_LOAD( "963-a16",      0x280000, 0x80000, 0xd4bd9984 )        /* sprites */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "963-e20",      0x00000, 0x08000, 0x1692a6d6 )

	ROM_REGION(0x80000)	/* 512k for the title music sample */
	ROM_LOAD( "963-a25",      0x00000, 0x80000, 0xfca078c7 )

	ROM_REGION(0x40000)	/* 128k+128k for the samples */
	ROM_LOAD( "963-a26",      0x00000, 0x20000, 0xe2ac3063 ) /* samples for 007232 */
	ROM_LOAD( "963-a27",      0x20000, 0x20000, 0x2dfd674b ) /* samples for UPD7759C */
ROM_END

ROM_START( tmht2p_rom )
	ROM_REGION(0x60000)	/* 2*128k and 2*64k for 68000 code */
	ROM_LOAD_EVEN( "963-u23",      0x00000, 0x20000, 0x58bec748 )
	ROM_LOAD_ODD ( "963-u24",      0x00000, 0x20000, 0xdce87c8d )
	ROM_LOAD_EVEN( "963-u21",      0x40000, 0x10000, 0xabce5ead )
	ROM_LOAD_ODD ( "963-u22",      0x40000, 0x10000, 0x4ecc8d6b )

	ROM_REGION_DISPOSE(0x1000)
	/* empty memory region - not used by the game, but needed because the main */
	/* core currently always frees region #1 after initialization. */

	ROM_REGION(0x300000)	/* graphics (addressable by the main CPU) */
	ROM_LOAD( "963-a28",      0x000000, 0x80000, 0xdb4769a8 )        /* 8x8 tiles */
	ROM_LOAD( "963-a29",      0x080000, 0x80000, 0x8069cd2e )        /* 8x8 tiles */
	ROM_LOAD( "963-a17",      0x100000, 0x80000, 0xb5239a44 )        /* sprites */
	ROM_LOAD( "963-a18",      0x180000, 0x80000, 0xdd51adef )        /* sprites */
	ROM_LOAD( "963-a15",      0x200000, 0x80000, 0x1f324eed )        /* sprites */
	ROM_LOAD( "963-a16",      0x280000, 0x80000, 0xd4bd9984 )        /* sprites */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "963-e20",      0x00000, 0x08000, 0x1692a6d6 )

	ROM_REGION(0x80000)	/* 512k for the title music sample */
	ROM_LOAD( "963-a25",      0x00000, 0x80000, 0xfca078c7 )

	ROM_REGION(0x40000)	/* 128k+128k for the samples */
	ROM_LOAD( "963-a26",      0x00000, 0x20000, 0xe2ac3063 ) /* samples for 007232 */
	ROM_LOAD( "963-a27",      0x20000, 0x20000, 0x2dfd674b ) /* samples for UPD7759C */
ROM_END

ROM_START( tmnt2pj_rom )
	ROM_REGION(0x60000)	/* 2*128k and 2*64k for 68000 code */
	ROM_LOAD_EVEN( "963-123",      0x00000, 0x20000, 0x6a3527c9 )
	ROM_LOAD_ODD ( "963-124",      0x00000, 0x20000, 0x2c4bfa15 )
	ROM_LOAD_EVEN( "963-121",      0x40000, 0x10000, 0x4181b733 )
	ROM_LOAD_ODD ( "963-122",      0x40000, 0x10000, 0xc64eb5ff )

	ROM_REGION_DISPOSE(0x1000)
	/* empty memory region - not used by the game, but needed because the main */
	/* core currently always frees region #1 after initialization. */

	ROM_REGION(0x300000)	/* graphics (addressable by the main CPU) */
	ROM_LOAD( "963-a28",      0x000000, 0x80000, 0xdb4769a8 )        /* 8x8 tiles */
	ROM_LOAD( "963-a29",      0x080000, 0x80000, 0x8069cd2e )        /* 8x8 tiles */
	ROM_LOAD( "963-a17",      0x100000, 0x80000, 0xb5239a44 )        /* sprites */
	ROM_LOAD( "963-a18",      0x180000, 0x80000, 0xdd51adef )        /* sprites */
	ROM_LOAD( "963-a15",      0x200000, 0x80000, 0x1f324eed )        /* sprites */
	ROM_LOAD( "963-a16",      0x280000, 0x80000, 0xd4bd9984 )        /* sprites */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "963-e20",      0x00000, 0x08000, 0x1692a6d6 )

	ROM_REGION(0x80000)	/* 512k for the title music sample */
	ROM_LOAD( "963-a25",      0x00000, 0x80000, 0xfca078c7 )

	ROM_REGION(0x40000)	/* 128k+128k for the samples */
	ROM_LOAD( "963-a26",      0x00000, 0x20000, 0xe2ac3063 ) /* samples for 007232 */
	ROM_LOAD( "963-a27",      0x20000, 0x20000, 0x2dfd674b ) /* samples for UPD7759C */
ROM_END

ROM_START( punkshot_rom )
	ROM_REGION(0x40000)	/* 4*64k for 68000 code */
	ROM_LOAD_EVEN( "907m02.i7",    0x00000, 0x20000, 0x59e14575 )
	ROM_LOAD_ODD ( "907m03.i10",   0x00000, 0x20000, 0xadb14b1e )

	ROM_REGION_DISPOSE(0x1000)
	/* empty memory region - not used by the game, but needed because the main */
	/* core currently always frees region #1 after initialization. */

	ROM_REGION(0x280000)	/* graphics (addressable by the main CPU) */
	ROM_LOAD( "907d06.e23",   0x000000, 0x40000, 0xf5cc38f4 )
	ROM_LOAD( "907d05.e22",   0x040000, 0x40000, 0xe25774c1 )
	ROM_LOAD( "907d08l.k7",   0x080000, 0x80000, 0x05f3d196 )
	ROM_LOAD( "907d08h.k7",   0x100000, 0x80000, 0xeaf18c22 )
	ROM_LOAD( "907d07l.k2",   0x180000, 0x80000, 0xfeeb345a )
	ROM_LOAD( "907d07h.k2",   0x200000, 0x80000, 0x0bff4383 )

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "907f01.e8",    0x0000, 0x8000, 0xf040c484 )

	ROM_REGION(0x80000)	/* ADPCM samples */
	ROM_LOAD( "907d04.d3",    0x0000, 0x80000, 0x090feb5e )
ROM_END



struct GameDriver tmnt_driver =
{
	__FILE__,
	0,
	"tmnt",
	"TMNT (4 Players USA)",
	"1989",
	"Konami",
	"Nicola Salmoria (MAME driver)\nAlex Pasadyn (MAME driver)\nJeff Slutter (hardware info)\nHowie Cohen (hardware info)\nDan Boris (hardware info)",
	0,
	&tmnt_machine_driver,
	0,

	tmnt_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	tmnt_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	tmnt_hiload, tmnt_hisave
};

struct GameDriver tmntj_driver =
{
	__FILE__,
	&tmnt_driver,
	"tmntj",
	"TMNT (4 Players Japanese)",
	"1989",
	"Konami",
	"Nicola Salmoria (MAME driver)\nAlex Pasadyn (MAME driver)\nJeff Slutter (hardware info)\nHowie Cohen (hardware info)\nDan Boris (hardware info)",
	0,
	&tmnt_machine_driver,
	0,

	tmntj_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	tmnt_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	tmnt_hiload, tmnt_hisave
};

struct GameDriver tmht2p_driver =
{
	__FILE__,
	&tmnt_driver,
	"tmht2p",
	"TMHT (2 Players UK)",
	"1989",
	"Konami",
	"Nicola Salmoria (MAME driver)\nAlex Pasadyn (MAME driver)\nJeff Slutter (hardware info)\nHowie Cohen (hardware info)\nDan Boris (hardware info)\nAlex Simmons (2 player version)",
	0,
	&tmnt_machine_driver,
	0,

	tmht2p_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	tmnt2p_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	tmnt_hiload, tmnt_hisave
};

struct GameDriver tmnt2pj_driver =
{
	__FILE__,
	&tmnt_driver,
	"tmnt2pj",
	"TMNT (2 Players Japanese)",
	"1990",
	"Konami",
	"Nicola Salmoria (MAME driver)\nAlex Pasadyn (MAME driver)\nJeff Slutter (hardware info)\nHowie Cohen (hardware info)\nDan Boris (hardware info)\nAlex Simmons (2 player version)",
	0,
	&tmnt_machine_driver,
	0,

	tmnt2pj_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	tmnt2p_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	tmnt_hiload, tmnt_hisave
};

struct GameDriver punkshot_driver =
{
	__FILE__,
	0,
	"punkshot",
	"Punk Shot",
	"1990",
	"Konami",
	"Nicola Salmoria (MAME driver)\nAlex Pasadyn (MAME driver)\nJeff Slutter (hardware info)\nHowie Cohen (hardware info)\nDan Boris (hardware info)",
	0,
	&punkshot_machine_driver,
	0,

	punkshot_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	punkshot_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	punkshot_hiload, punkshot_hisave
};

⌨️ 快捷键说明

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