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

📄 superpac.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			readmem_cpu1,        /* MemoryReadAddress */
			writemem_cpu1,       /* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			interrupt,           /* interrupt routine */
			1                    /* interrupts per frame */
		},
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			3,                   /* memory region */
			superpac_readmem_cpu2,/* MemoryReadAddress */
			superpac_writemem_cpu2,/* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			ignore_interrupt,    /* interrupt routine */
			1                    /* interrupts per frame */
		}
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	100,	/* 100 CPU slices per frame - an high value to ensure proper */
			/* synchronization of the CPUs */
	superpac_init_machine,     /* init machine routine */

	/* video hardware */
	28*8, 36*8,                /* screen_width, screen_height */
	{ 0*8, 28*8-1, 0*8, 36*8-1 },/* struct rectangle visible_area */
	gfxdecodeinfo,             /* GfxDecodeInfo * */
	32,                        /* total colors */
	4*(64+64),                 /* color table length */
	superpac_vh_convert_color_prom, /* convert color prom routine */

	VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
	0,                         /* vh_init routine */
	generic_vh_start,          /* vh_start routine */
	generic_vh_stop,           /* vh_stop routine */
	superpac_vh_screenrefresh, /* vh_update routine */

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_NAMCO,
			&namco_interface
		}
	}
};

static struct MachineDriver pacnpal_machine_driver =
{
	/* basic machine hardware  */
	{
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			0,                   /* memory region */
			readmem_cpu1,        /* MemoryReadAddress */
			writemem_cpu1,       /* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			interrupt,           /* interrupt routine */
			1                    /* interrupts per frame */
		},
		{
			CPU_M6809,
			1100000,             /* 1.1 Mhz */
			3,                   /* memory region */
			pacnpal_readmem_cpu2,/* MemoryReadAddress */
			pacnpal_writemem_cpu2,/* MemoryWriteAddress */
			0,                   /* IOReadPort */
			0,                   /* IOWritePort */
			pacnpal_interrupt_2, /* interrupt routine */
			1                    /* interrupts per frame */
		}
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	100,	/* 100 CPU slices per frame - an high value to ensure proper */
			/* synchronization of the CPUs */
	superpac_init_machine,     /* init machine routine */

	/* video hardware */
	28*8, 36*8,                /* screen_width, screen_height */
	{ 0*8, 28*8-1, 0*8, 36*8-1 },/* struct rectangle visible_area */
	gfxdecodeinfo,             /* GfxDecodeInfo * */
	32,                        /* total colors */
	4*(64+64),                 /* color table length */
	superpac_vh_convert_color_prom, /* convert color prom routine */

	VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
	0,                         /* vh_init routine */
	generic_vh_start,          /* vh_start routine */
	generic_vh_stop,           /* vh_stop routine */
	superpac_vh_screenrefresh, /* vh_update routine */

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_NAMCO,
			&namco_interface
		}
	}
};




ROM_START( superpac_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "spc-2.1c",     0xc000, 0x2000, 0x1a38c30e )
	ROM_LOAD( "spc-1.1b",     0xe000, 0x2000, 0x730e95a9 )

	ROM_REGION_DISPOSE(0x3000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "spv-1.3c",     0x0000, 0x1000, 0x78337e74 )
	ROM_LOAD( "spv-2.3f",     0x1000, 0x2000, 0x670a42f2 )

	ROM_REGION(0x0220)	/* color proms */
	ROM_LOAD( "superpac.4c",  0x0000, 0x0020, 0x9ce22c46 ) /* palette */
	ROM_LOAD( "superpac.4e",  0x0020, 0x0100, 0x1253c5c1 ) /* chars */
	ROM_LOAD( "superpac.3l",  0x0120, 0x0100, 0xd4d7026f ) /* sprites */

	ROM_REGION(0x10000)	/* 64k for the second CPU */
	ROM_LOAD( "spc-3.1k",     0xf000, 0x1000, 0x04445ddb )

	ROM_REGION(0x0100)	/* sound prom */
	ROM_LOAD( "superpac.3m",  0x0000, 0x0100, 0xad43688f )
ROM_END

ROM_START( superpcn_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "sp1.2",        0xc000, 0x2000, 0x4bb33d9c )
	ROM_LOAD( "sp1.1",        0xe000, 0x2000, 0x846fbb4a )

	ROM_REGION_DISPOSE(0x3000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "sp1.6",        0x0000, 0x1000, 0x91c5935c )
	ROM_LOAD( "spv-2.3f",     0x1000, 0x2000, 0x670a42f2 )

	ROM_REGION(0x0220)	/* color proms */
	ROM_LOAD( "superpac.4c",  0x0000, 0x0020, 0x9ce22c46 ) /* palette */
	ROM_LOAD( "superpac.4e",  0x0020, 0x0100, 0x1253c5c1 ) /* chars */
	ROM_LOAD( "superpac.3l",  0x0120, 0x0100, 0xd4d7026f ) /* sprites */

	ROM_REGION(0x10000)	/* 64k for the second CPU */
	ROM_LOAD( "spc-3.1k",     0xf000, 0x1000, 0x04445ddb )

	ROM_REGION(0x0100)	/* sound prom */
	ROM_LOAD( "superpac.3m",  0x0000, 0x0100, 0xad43688f )
ROM_END

ROM_START( pacnpal_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "pap13b.cpu",   0xa000, 0x2000, 0xed64a565 )
	ROM_LOAD( "pap12b.cpu",   0xc000, 0x2000, 0x15308bcf )
	ROM_LOAD( "pap11b.cpu",   0xe000, 0x2000, 0x3cac401c )

	ROM_REGION_DISPOSE(0x3000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "pap16.cpu",    0x0000, 0x1000, 0xa36b96cb )
	ROM_LOAD( "pap15.vid",    0x1000, 0x2000, 0xfb6f56e3 )

	ROM_REGION(0x0220)	/* color proms */
	ROM_LOAD( "papi6.vid",    0x0000, 0x0020, 0x52634b41 ) /* palette */
	ROM_LOAD( "papi5.vid",    0x0020, 0x0100, 0xac46203c ) /* chars */
	ROM_LOAD( "papi4.vid",    0x0120, 0x0100, 0x686bde84 ) /* sprites */

	ROM_REGION(0x10000)	/* 64k for the second CPU */
	ROM_LOAD( "pap14.cpu",    0xf000, 0x1000, 0x330e20de )

	ROM_REGION(0x0100)	/* sound prom */
	ROM_LOAD( "papi3.cpu",    0x0000, 0x0100, 0x83c31a98 )
ROM_END


/* load the high score table */
static int superpac_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[0x113c],"N@N",3) == 0 &&        /* check for high score initials */
	    RAM[0x1087] == 0 && RAM[0x1089] == 0 && RAM[0x1088] != 0 && /* check for main high score value */
	    memcmp(&RAM[0x3ee],"000",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[0x1138],40);
			osd_fclose(f);

			/* also copy over the high score */
			RAM[0x1087] = RAM[0x1138];
			RAM[0x1088] = RAM[0x1139];
			RAM[0x1089] = RAM[0x113a];
		}

		/* this is a little gross, but necessary to get the high score on-screen */
		if (!writing) writing = (RAM[0x1087] >> 4);
		videoram_w (0x3f4, writing ? (RAM[0x1087] >> 4) + '0' : ' ');
		if (!writing) writing = (RAM[0x1087] & 0x0f);
		videoram_w (0x3f3, writing ? (RAM[0x1087] & 0x0f) + '0' : ' ');
		if (!writing) writing = (RAM[0x1088] >> 4);
		videoram_w (0x3f2, writing ? (RAM[0x1088] >> 4) + '0' : ' ');
		if (!writing) writing = (RAM[0x1088] & 0x0f);
		videoram_w (0x3f1, writing ? (RAM[0x1088] & 0x0f) + '0' : ' ');
		if (!writing) writing = (RAM[0x1089] >> 4);
		videoram_w (0x3f0, writing ? (RAM[0x1089] >> 4) + '0' : ' ');
		if (!writing) writing = (RAM[0x1089] & 0x0f);
		videoram_w (0x3ef, writing ? (RAM[0x1089] & 0x0f) + '0' : ' ');
		videoram_w (0x3ee, 0 + '0');

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


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


/* load the high score table */
static int pacnpal_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[0x1051],"\x1a\x25\x1a",3) == 0 &&        /* check for high score initials */
	   RAM[0x116d] == 0 && RAM[0x116f] == 0 && RAM[0x116e] != 0 && /* check for main high score value */
	   memcmp(&RAM[0x3ed],"\x0\x0\x0",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[0x104c],40);
			osd_fclose(f);

			/* also copy over the high score */
			RAM[0x116d] = RAM[0x104d];
			RAM[0x116e] = RAM[0x104e];
			RAM[0x116f] = RAM[0x104f];
		}

		/* this is a little gross, but necessary to get the high score on-screen */
		if (!writing) writing = (RAM[0x116d] >> 4);
		videoram_w (0x3f3, writing ? (RAM[0x116d] >> 4) : 0x24);
		if (!writing) writing = (RAM[0x116d] & 0x0f);
		videoram_w (0x3f2, writing ? (RAM[0x116d] & 0x0f) : 0x24);
		if (!writing) writing = (RAM[0x116e] >> 4);
		videoram_w (0x3f1, writing ? (RAM[0x116e] >> 4) : 0x24);
		if (!writing) writing = (RAM[0x116e] & 0x0f);
		videoram_w (0x3f0, writing ? (RAM[0x116e] & 0x0f) : 0x24);
		if (!writing) writing = (RAM[0x116f] >> 4);
		videoram_w (0x3ef, writing ? (RAM[0x116f] >> 4) : 0x24);
		if (!writing) writing = (RAM[0x116f] & 0x0f);
		videoram_w (0x3ee, writing ? (RAM[0x116f] & 0x0f) : 0x24);
		videoram_w (0x3ed, 0);

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


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


struct GameDriver superpac_driver =
{
	__FILE__,
	0,
	"superpac",
	"Super Pac-Man (Midway)",
	"1982",
	"[Namco] (Bally Midway license)",
	"Aaron Giles (MAME driver)\nKevin Brisley (hardware info)\nLawnmower Man (hardware info)",
	0,
	&superpac_machine_driver, /* MachineDriver */
	0,

	superpac_rom,             /* RomModule */
	0, 0,                     /* ROM decrypt routines */
	0,                        /* samplenames */
	0,                        /* sound_prom */

	superpac_input_ports,

	PROM_MEMORY_REGION(2),	  /* color prom */
	0,                        /* palette */
	0,                        /* color table */
	ORIENTATION_DEFAULT,

	superpac_hiload, superpac_hisave /* hi score save/load */
};

struct GameDriver superpcn_driver =
{
	__FILE__,
	&superpac_driver,
	"superpcn",
	"Super Pac-Man (Namco)",
	"1982",
	"Namco",
	"Aaron Giles (MAME driver)\nKevin Brisley (Replay emulator)\nLawnmower Man (hardware info)",
	0,
	&superpac_machine_driver, /* MachineDriver */
	0,

	superpcn_rom,             /* RomModule */
	0, 0,                     /* ROM decrypt routines */
	0,                        /* samplenames */
	0,                        /* sound_prom */

	superpac_input_ports,

	PROM_MEMORY_REGION(2),    /* color prom */
	0,                        /* palette */
	0,                        /* color table */
	ORIENTATION_DEFAULT,

	superpac_hiload, superpac_hisave /* hi score save/load */
};

struct GameDriver pacnpal_driver =
{
	__FILE__,
	0,
	"pacnpal",
	"Pac & Pal",
	"1983",
	"Namco",
	"Aaron Giles\nKevin Brisley\nLawnmower Man",
	0,
	&pacnpal_machine_driver,  /* MachineDriver */
	0,

	pacnpal_rom,              /* RomModule */
	0, 0,                     /* ROM decrypt routines */
	0,                        /* samplenames */
	0,                        /* sound_prom */

	pacnpal_input_ports,

	PROM_MEMORY_REGION(2),    /* color prom */
	0,                        /* palette */
	0,                        /* color table */
	ORIENTATION_DEFAULT,

	pacnpal_hiload, pacnpal_hisave /* hi score save/load */
};

⌨️ 快捷键说明

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