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

📄 asteroid.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x001c],2*10+3*11);
			osd_fclose(f);
		}

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

static int asteroid_hiload(void)
{
	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[0x001d],"\x00\x00",2) == 0 &&
			memcmp(&RAM[0x0050],"\x00\x00",2) == 0 &&
			memcmp(&RAM[0x0000],"\x10",1) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x001d],2*10+3*11);
			osd_fclose(f);
		}

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



static void asteroid1_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[0x001c],2*10+3*11);
		osd_fclose(f);
	}
}

static void asteroid_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[0x001d],2*10+3*11);
		osd_fclose(f);
	}
}


/* Asteroids Deluxe now uses the earom routines
 * However, we keep the highscore location, just in case
 *		osd_fwrite(f,&RAM[0x0023],3*10+3*11);
 */

static struct Samplesinterface asteroid_samples_interface =
{
	7	/* 7 channels */
};

static struct MachineDriver asteroid_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			1500000,	/* 1.5 Mhz */
			0,
			asteroid_readmem,asteroid_writemem,0,0,
			asteroid_interrupt,4	/* 250 Hz */
		}
	},
	60, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
	1,
	asteroid_init_machine,

	/* video hardware */
	320, 240, { 0, 1040, 70, 950 },
	0,
	256, 256,
	avg_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	dvg_start,
	dvg_stop,
	dvg_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_SAMPLES,
			&asteroid_samples_interface
		}
	}
};



static struct POKEYinterface pokey_interface =
{
	1,	/* 1 chip */
	1500000,	/* 1.5 MHz??? */
	100,
	POKEY_DEFAULT_GAIN,
	NO_CLIP,
	/* The 8 pot handlers */
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 },
	/* The allpot handler */
	{ input_port_3_r }
};

static struct Samplesinterface astdelux_samples_interface =
{
	3	/* 3 channels */
};


static struct MachineDriver astdelux_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			1500000,	/* 1.5 Mhz */
			0,
			astdelux_readmem,astdelux_writemem,0,0,
			asteroid_interrupt,4	/* 250 Hz */
		}
	},
	60, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
	1,
	0,

	/* video hardware */
	320, 240, { 0, 1040, 70, 950 },
	0,
	256, 256,
	avg_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	dvg_start,
	dvg_stop,
	dvg_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_POKEY,
			&pokey_interface
		},
		{
			SOUND_SAMPLES,
			&astdelux_samples_interface
		}
	}
};


static struct CustomSound_interface llander_custom_interface =
{
	llander_sh_start,
	llander_sh_stop,
	llander_sh_update
};


static struct MachineDriver llander_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			1500000,			/* 1.5 Mhz */
			0,
			llander_readmem, llander_writemem,0,0,
			llander_interrupt,6	/* 250 Hz */
		}
	},
	40, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
	1,
	0,

	/* video hardware */
	320, 240, { 0, 1050, 0, 900 },
	0,
	256, 256,
	llander_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	llander_start,
	llander_stop,
	llander_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_CUSTOM,
			&llander_custom_interface
		}
	}
};

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

  Game driver(s)

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

static const char *asteroid_sample_names[] =
{
	"*asteroid",
	"explode1.sam",
	"explode2.sam",
	"explode3.sam",
	"thrust.sam",
	"thumphi.sam",
	"thumplo.sam",
	"fire.sam",
	"lsaucer.sam",
	"ssaucer.sam",
	"sfire.sam",
	"life.sam",
    0	/* end of array */
};

ROM_START( asteroi1_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "035145.01",    0x6800, 0x0800, 0xe9bfda64 )
	ROM_LOAD( "035144.01",    0x7000, 0x0800, 0xe53c28a9 )
	ROM_LOAD( "035143.01",    0x7800, 0x0800, 0x7d4e3d05 )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Vector ROM */
	ROM_LOAD( "035127.01",    0x5000, 0x0800, 0x99699366 )
ROM_END

ROM_START( asteroid_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "035145.02",    0x6800, 0x0800, 0x0cc75459 )
	ROM_LOAD( "035144.02",    0x7000, 0x0800, 0x096ed35c )
	ROM_LOAD( "035143.02",    0x7800, 0x0800, 0x312caa02 )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Vector ROM */
	ROM_LOAD( "035127.02",    0x5000, 0x0800, 0x8b71fd9e )
ROM_END



struct GameDriver asteroid_driver =
{
	__FILE__,
	0,
	"asteroid",
	"Asteroids (rev 2)",
	"1979",
	"Atari",
	"Brad Oliver (Mame Driver)\n"VECTOR_TEAM,
	0,
	&asteroid_machine_driver,
	0,

	asteroid_rom,
	0, 0,
	asteroid_sample_names,
	0,	/* sound_prom */

	asteroid_input_ports,

	asteroid_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	asteroid_hiload, asteroid_hisave
};

struct GameDriver asteroi1_driver =
{
	__FILE__,
	&asteroid_driver,
	"asteroi1",
	"Asteroids (rev 1)",
	"1979",
	"Atari",
	"Brad Oliver (Mame Driver)\n"VECTOR_TEAM,
	0,
	&asteroid_machine_driver,
	0,

	asteroi1_rom,
	0, 0,
	asteroid_sample_names,
	0,	/* sound_prom */

	asteroid_input_ports,

	asteroid_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	asteroid1_hiload, asteroid1_hisave
};

ROM_START( astdelux_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "036430.02",    0x6000, 0x0800, 0xa4d7a525 )
	ROM_LOAD( "036431.02",    0x6800, 0x0800, 0xd4004aae )
	ROM_LOAD( "036432.02",    0x7000, 0x0800, 0x6d720c41 )
	ROM_LOAD( "036433.03",    0x7800, 0x0800, 0x0dcc0be6 )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Vector ROM */
	ROM_LOAD( "036800.02",    0x4800, 0x0800, 0xbb8cabe1 )
	ROM_LOAD( "036799.01",    0x5000, 0x0800, 0x7d511572 )
ROM_END

/* 036433.02 with the checksum below is _broken_! */
/* Anyone have a correct romset? */
ROM_START( astdelu1_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "036430.01",    0x6000, 0x0800, 0x0 )
	ROM_LOAD( "036431.01",    0x6800, 0x0800, 0x0 )
	ROM_LOAD( "036432.01",    0x7000, 0x0800, 0x0 )
	ROM_LOAD( "036433.02",    0x7800, 0x0800, 0x0 )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Vector ROM */
	ROM_LOAD( "036800.01",    0x4800, 0x0800, 0x0 )
	ROM_LOAD( "036799.01",    0x5000, 0x0800, 0x0 )
ROM_END



static const char *astdelux_sample_names[] =
{
	"explode1.sam",
	"explode2.sam",
	"explode3.sam",
	"thrust.sam",
	0
};

struct GameDriver astdelux_driver =
{
	__FILE__,
	0,
	"astdelux",
	"Asteroids Deluxe (rev 2)",
	"1980",
	"Atari",
	"Brad Oliver (Mame Driver)\n"VECTOR_TEAM"Peter Hirschberg (backdrop)\nMathis Rosenhauer (backdrop support)",
	0,
	&astdelux_machine_driver,
	0,

	astdelux_rom,
	0, 0,
	astdelux_sample_names,
	0,	/* sound_prom */

	astdelux_input_ports,

	astdelux_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	atari_vg_earom_load, atari_vg_earom_save
};

/* the REV 1 romset floating around is broken */
struct GameDriver astdelu1_driver =
{
	__FILE__,
	&astdelux_driver,
	"astdelu1",
	"Asteroids Deluxe (rev 1)",
	"1980",
	"Atari",
	"Brad Oliver (Mame Driver)\n"VECTOR_TEAM,
	0,
	&astdelux_machine_driver,
	0,

	astdelu1_rom,
	0, 0,
	asteroid_sample_names,
	0,	/* sound_prom */

	astdelux_input_ports,

	astdelux_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	atari_vg_earom_load, atari_vg_earom_save
};

ROM_START( llander_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "034572.02",    0x6000, 0x0800, 0xb8763eea )
	ROM_LOAD( "034571.02",    0x6800, 0x0800, 0x77da4b2f )
	ROM_LOAD( "034570.02",    0x7000, 0x0800, 0x2724e591 )
	ROM_LOAD( "034569.02",    0x7800, 0x0800, 0x72837a4e )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Vector ROM */
	ROM_LOAD( "034599.01",    0x4800, 0x0800, 0x355a9371 )
	ROM_LOAD( "034598.01",    0x5000, 0x0800, 0x9c4ffa68 )
	/* This _should_ be the rom for international versions. */
	/* Unfortunately, is it not currently available. We use */
	/* a fake one. */
	ROM_LOAD( "034597.01",    0x5800, 0x0800, 0x3f55d17f )
ROM_END

ROM_START( llander1_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "034572.01",    0x6000, 0x0800, 0x2aff3140 )
	ROM_LOAD( "034571.01",    0x6800, 0x0800, 0x493e24b7 )
	ROM_LOAD( "034570.01",    0x7000, 0x0800, 0x2724e591 )
	ROM_LOAD( "034569.01",    0x7800, 0x0800, 0xb11a7d01 )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Vector ROM */
	ROM_LOAD( "034599.01",    0x4800, 0x0800, 0x355a9371 )
	ROM_LOAD( "034598.01",    0x5000, 0x0800, 0x9c4ffa68 )
	/* This _should_ be the rom for international versions. */
	/* Unfortunately, is it not currently available. We use */
	/* a fake one. */
	ROM_LOAD( "034597.01",    0x5800, 0x0800, 0x3f55d17f )
ROM_END

struct GameDriver llander_driver =
{
	__FILE__,
	0,
	"llander",
	"Lunar Lander (rev 2)",
	"1979",
	"Atari",
	"Brad Oliver (Mame Driver)\nKeith Wilkins (Sound)\n"VECTOR_TEAM,
	0,
	&llander_machine_driver,
	0,

	llander_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	llander_input_ports,

	asteroid_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	0, 0
};

struct GameDriver llander1_driver =
{
	__FILE__,
	&llander_driver,
	"llander1",
	"Lunar Lander (rev 1)",
	"1979",
	"Atari",
	"Brad Oliver (Mame Driver)\nKeith Wilkins (Sound)\n"VECTOR_TEAM,
	0,
	&llander_machine_driver,
	0,

	llander1_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	llander1_input_ports,

	asteroid_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	0, 0
};

⌨️ 快捷键说明

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