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

📄 mappy.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 3 页
字号:
ROM_START( digdug2_rom )
	ROM_REGION(0x10000)     /* 64k for code for the first CPU  */
	ROM_LOAD( "ddug2-3.bin",  0x8000, 0x4000, 0xbe7ec80b )
	ROM_LOAD( "ddug2-1.bin",  0xc000, 0x4000, 0x5c77c0d4 )

	ROM_REGION_DISPOSE(0x9000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "ddug2-3b.bin", 0x0000, 0x1000, 0xafcb4509 )
	ROM_LOAD( "ddug2-3m.bin", 0x1000, 0x4000, 0xdf1f4ad8 )
	ROM_LOAD( "ddug2-3n.bin", 0x5000, 0x4000, 0xccadb3ea )

	ROM_REGION(0x0220)      /* color proms */
	ROM_LOAD( "ddclr-5b.bin", 0x0000, 0x0020, 0x9b169db5 ) /* palette */
	ROM_LOAD( "ddclr-4c.bin", 0x0020, 0x0100, 0x55a88695 ) /* characters */
	ROM_LOAD( "ddclr-5k.bin", 0x0120, 0x0100, 0x1525a4d1 ) /* sprites */

	ROM_REGION(0x10000)     /* 64k for the second CPU */
	ROM_LOAD( "ddug2-4.bin",  0xe000, 0x2000, 0x737443b1 )

	ROM_REGION(0x0100)      /* sound prom */
	ROM_LOAD( "ddsnd.bin",    0x0000, 0x0100, 0xe0074ee2 )
ROM_END

ROM_START( motos_rom )
	ROM_REGION(0x10000)     /* 64k for code for the first CPU  */
	ROM_LOAD( "mts_1d.bin",   0x8000, 0x4000, 0x1104abb2 )
	ROM_LOAD( "mts_1b.bin",   0xc000, 0x4000, 0xb5c1c299 )

	ROM_REGION_DISPOSE(0x9000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "mts_3b.bin",   0x0000, 0x1000, 0x5d4a2a22 )
	ROM_LOAD( "mts_3m.bin",   0x1000, 0x4000, 0x2f0e396e )
	ROM_LOAD( "mts_3n.bin",   0x5000, 0x4000, 0xcf8a3b86 )

	ROM_REGION(0x0220)      /* color proms */
	ROM_LOAD( "motos.pr1",    0x0000, 0x0020, 0x71972383 ) /* palette */
	ROM_LOAD( "motos.pr2",    0x0020, 0x0100, 0x730ba7fb ) /* characters */
	ROM_LOAD( "motos.pr3",    0x0120, 0x0100, 0x7721275d ) /* sprites */

	ROM_REGION(0x10000)     /* 64k for the second CPU */
	ROM_LOAD( "mts_1k.bin",   0xe000, 0x2000, 0x55e45d21 )

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

ROM_START( todruaga_rom )
	ROM_REGION(0x10000)     /* 64k for code for the first CPU  */
	ROM_LOAD( "druaga3.bin",  0x8000, 0x4000, 0x7ab4f5b2 )
	ROM_LOAD( "druaga1.bin",  0xc000, 0x4000, 0x8c20ef10 )

	ROM_REGION_DISPOSE(0x5000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "druaga3b.bin", 0x0000, 0x1000, 0xd32b249f )
	ROM_LOAD( "druaga3m.bin", 0x1000, 0x2000, 0xe827e787 )
	ROM_LOAD( "druaga3n.bin", 0x3000, 0x2000, 0x962bd060 )

	ROM_REGION(0x0520)      /* color proms */
	ROM_LOAD( "todruaga.pr1", 0x0000, 0x0020, 0x122cc395 ) /* palette */
	ROM_LOAD( "todruaga.pr2", 0x0020, 0x0100, 0x8c661d6a ) /* characters */
	ROM_LOAD( "todruaga.pr3", 0x0120, 0x0100, 0x5bcec186 ) /* sprites */
	ROM_LOAD( "todruaga.pr4", 0x0220, 0x0100, 0xf029e5f5 ) /* sprites */
	ROM_LOAD( "todruaga.pr5", 0x0320, 0x0100, 0xecdc206c ) /* sprites */
	ROM_LOAD( "todruaga.pr6", 0x0420, 0x0100, 0x57b5ad6d ) /* sprites */

	ROM_REGION(0x10000)     /* 64k for the second CPU */
	ROM_LOAD( "druaga4.bin",  0xe000, 0x2000, 0xae9d06d9 )

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



/* load the high score table */
static int mappy_hiload(void)
{
	int writing = 0;
	void *f;
	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[0x1465],"BEH",3) == 0 &&          /* check for high score initials */
	    memcmp(&RAM[0x1385],"\0\x20\0",3) == 0 &&     /* check for main high score value */
	    memcmp(&RAM[0x7ed],"\0\0\0",3) == 0)          /* see if main high score was written to screen */
	{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x1460],40);
			osd_fclose(f);

			/* also copy over the high score */
			RAM[0x1385] = RAM[0x1460];
			RAM[0x1386] = RAM[0x1461];
			RAM[0x1387] = RAM[0x1462];
		}

		/* this is a little gross, but necessary to get the high score on-screen */
		if (!writing) writing = (RAM[0x1385] >> 4);
		mappy_videoram_w (0x7f3, writing ? (RAM[0x1385] >> 4) : ' ');
		if (!writing) writing = (RAM[0x1385] & 0x0f);
		mappy_videoram_w (0x7f2, writing ? (RAM[0x1385] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x1386] >> 4);
		mappy_videoram_w (0x7f1, writing ? (RAM[0x1386] >> 4) : ' ');
		if (!writing) writing = (RAM[0x1386] & 0x0f);
		mappy_videoram_w (0x7f0, writing ? (RAM[0x1386] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x1387] >> 4);
		mappy_videoram_w (0x7ef, writing ? (RAM[0x1387] >> 4) : ' ');
		if (!writing) writing = (RAM[0x1387] & 0x0f);
		mappy_videoram_w (0x7ee, writing ? (RAM[0x1387] & 0x0f) : ' ');
		mappy_videoram_w (0x7ed, 0);

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


/* save the high score table */
static void mappy_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[0x1460],40);
		osd_fclose(f);
	}
}


/* load the high score table */
static int digdug2_hiload(void)
{
	int writing = 0;
	void *f;
	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[0x11b6]," KAZU ",6) == 0 &&         /* check for high score initials */
	    memcmp(&RAM[0x100b],"\x00\x20\x00",3) == 0 &&   /* check for main high score value */
	    memcmp(&RAM[0x7ed],"\x30\0\0",3) == 0)          /* see if main high score was written to screen */
	{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x11b0],80);
			osd_fclose(f);

			/* also copy over the high score */
			RAM[0x100b] = (RAM[0x11b0] << 4) | RAM[0x11b1];
			RAM[0x100c] = (RAM[0x11b2] << 4) | RAM[0x11b3];
			RAM[0x100d] = (RAM[0x11b4] << 4) | RAM[0x11b5];
		}

		/* this is a little gross, but necessary to get the high score on-screen */
		if (!writing) writing = (RAM[0x11b0] & 0x0f);
		mappy_videoram_w (0x7f3, writing ? (RAM[0x11b0] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x11b1] & 0x0f);
		mappy_videoram_w (0x7f2, writing ? (RAM[0x11b1] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x11b2] & 0x0f);
		mappy_videoram_w (0x7f1, writing ? (RAM[0x11b2] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x11b3] & 0x0f);
		mappy_videoram_w (0x7f0, writing ? (RAM[0x11b3] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x11b4] & 0x0f);
		mappy_videoram_w (0x7ef, writing ? (RAM[0x11b4] & 0x0f) : ' ');
		if (!writing) writing = (RAM[0x11b5] & 0x0f);
		mappy_videoram_w (0x7ee, writing ? (RAM[0x11b5] & 0x0f) : ' ');
		mappy_videoram_w (0x7ed, 0x30);

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


/* save the high score table */
static void digdug2_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[0x11b0],80);
		osd_fclose(f);
	}
}


/* load the high score table */
static int motos_hiload(void)  /* preliminary, does not copy top high score */
{
	void *f;
	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[0x2412],"\x4d\x4f\x52",3) == 0)
	{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x2400],0xA0);
			osd_fclose(f);
		}

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


/* save the high score table */
static void motos_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[0x2400],0xA0);
		osd_fclose(f);
	}
}

static int todruaga_hiload(void)
{
	void *f;
	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[0x1031],"END",3) == 0)
	{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x102A],50);
			osd_fclose(f);
		}

		RAM[0x100b] = RAM[0x102A];
		RAM[0x100c] = RAM[0x102B];
		RAM[0x100d] = RAM[0x102C];

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


/* save the high score table */
static void todruaga_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[0x102A],50);
		osd_fclose(f);
	}
}


/* the core game driver */
struct GameDriver mappy_driver =
{
	__FILE__,
	0,
	"mappy",
	"Mappy (US)",
	"1983",
	"Namco",
	"Aaron Giles\nMirko Buffoni\nJROK",
	0,
	&mappy_machine_driver,
	0,

	mappy_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	mappy_input_ports,

	PROM_MEMORY_REGION(2),0,0,
	ORIENTATION_DEFAULT,

	mappy_hiload, mappy_hisave
};

struct GameDriver mappyjp_driver =
{
	__FILE__,
	&mappy_driver,
	"mappyjp",
	"Mappy (Japan)",
	"1983",
	"Namco",
	"Aaron Giles\nMirko Buffoni\nJROK",
	0,
	&mappy_machine_driver,
	0,

	mappyjp_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	mappy_input_ports,

	PROM_MEMORY_REGION(2),0,0,
	ORIENTATION_DEFAULT,

	mappy_hiload, mappy_hisave
};

struct GameDriver digdug2_driver =
{
	__FILE__,
	0,
	"digdug2",
	"Dig Dug 2",
	"1985",
	"Namco",
	"Aaron Giles\nMirko Buffoni\nJROK",
	0,
	&digdug2_machine_driver,
	0,

	digdug2_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	digdug2_input_ports,

	PROM_MEMORY_REGION(2),0,0,
	ORIENTATION_DEFAULT,

	digdug2_hiload, digdug2_hisave
};

struct GameDriver motos_driver =
{
	__FILE__,
	0,
	"motos",
	"Motos",
	"1985",
	"Namco",
	"Aaron Giles\nMirko Buffoni\nJROK\nValerio Verrando",
	0,
	&motos_machine_driver,
	0,

	motos_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	motos_input_ports,

	PROM_MEMORY_REGION(2),0,0,
	ORIENTATION_DEFAULT,

	motos_hiload, motos_hisave
};

struct GameDriver todruaga_driver =
{
	__FILE__,
	0,
	"todruaga",
	"Tower of Druaga",
	"1984",
	"Namco",
	"Aaron Giles\nMirko Buffoni\nJROK\nValerio Verrando",
	0,
	&todruaga_machine_driver,
	0,

	todruaga_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	todruaga_input_ports,

	PROM_MEMORY_REGION(2),0,0,
	ORIENTATION_DEFAULT,

	todruaga_hiload, todruaga_hisave
};

⌨️ 快捷键说明

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