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

📄 bzone.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN2)
	PORT_BIT ( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED)
	PORT_BITX(    0x10, 0x10, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
	PORT_DIPSETTING(    0x10, "Off" )
	PORT_DIPSETTING(    0x00, "On" )
	PORT_BITX( 0x20, IP_ACTIVE_LOW, IPT_SERVICE, "Diagnostic Step", OSD_KEY_F1, IP_JOY_NONE, 0 )
	/* bit 6 is the VG HALT bit. We set it to "low" */
	/* per default (busy vector processor). */
 	/* handled by bzone_IN0_r() */
	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
	/* bit 7 is tied to a 3khz clock */
 	/* handled by bzone_IN0_r() */
	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )

	PORT_START	/* DSW0 */
	/* See the table above if you are really interested */
	PORT_DIPNAME (0xff, 0xfd, "Coinage", IP_KEY_NONE )
	PORT_DIPSETTING (   0xfd, "Normal" )

	PORT_START	/* DSW1 */
	PORT_DIPNAME (0x03, 0x03, "Language", IP_KEY_NONE )
	PORT_DIPSETTING (   0x00, "German" )
	PORT_DIPSETTING (   0x01, "French" )
	PORT_DIPSETTING (   0x02, "Spanish" )
	PORT_DIPSETTING (   0x03, "English" )
	PORT_DIPNAME (0x0c, 0x04, "Bonus Plane", IP_KEY_NONE )
	PORT_DIPSETTING (   0x00, "None" )
	PORT_DIPSETTING (   0x04, "6K 20K 50K" )
	PORT_DIPSETTING (   0x08, "4K 15K 40K" )
	PORT_DIPSETTING (   0x0c, "2K 10K 30K" )
	PORT_DIPNAME (0x30, 0x20, "Lives", IP_KEY_NONE )
	PORT_DIPSETTING (   0x00, "5" )
	PORT_DIPSETTING (   0x10, "4" )
	PORT_DIPSETTING (   0x20, "3" )
	PORT_DIPSETTING (   0x30, "2" )
	PORT_DIPNAME (0x40, 0x40, "One Play Minimum", IP_KEY_NONE )
	PORT_DIPSETTING (   0x00, "On" )
	PORT_DIPSETTING (   0x40, "Off" )
	PORT_DIPNAME (0x80, 0x80, "Self Adjust Diff", IP_KEY_NONE )
	PORT_DIPSETTING (   0x00, "On" )
	PORT_DIPSETTING (   0x80, "Off" )

	/* IN3 - the real machine reads either the X or Y axis from this port */
	/* Instead, we use the two fake 5 & 6 ports and bank-switch the proper */
	/* value based on the lsb of the byte written to the sound port */
	PORT_START
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_4WAY )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_4WAY )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_4WAY )

	PORT_START	/* IN4 - misc controls */
	PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )

	/* These 2 are fake - they are bank-switched from reads to IN3 */
	/* Red Baron doesn't seem to use the full 0-255 range. */
	PORT_START	/* IN5 */
	PORT_ANALOG ( 0xff, 0x80, IPT_AD_STICK_X, 20, 0, 64, 192 )

	PORT_START	/* IN6 */
	PORT_ANALOG ( 0xff, 0x80, IPT_AD_STICK_Y, 18, 0, 64, 192 )
INPUT_PORTS_END


static unsigned char bzone_color_prom[]    = { VEC_PAL_BZONE     };
static unsigned char redbaron_color_prom[] = { VEC_PAL_MONO_AQUA };


static int bzone_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[0x0300],"\x05\x00\x00",3) == 0 &&
			memcmp(&RAM[0x0339],"\x22\x28\x38",3) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x0300],6*10);
			osd_fclose(f);
		}

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



static void bzone_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[0x0300],6*10);
		osd_fclose(f);
	}
}



static struct POKEYinterface bzone_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 */
	{ bzone_IN3_r },
};

static struct Samplesinterface bzone_samples_interface =
{
	2	/* 2 channels */
};


static struct MachineDriver bzone_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			1500000,	/* 1.5 Mhz */
			0,
			bzone_readmem,bzone_writemem,0,0,
			bzone_interrupt,6 /* 4.1ms */
		}
	},
	40, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
	1,
	0,

	/* video hardware */
	320, 240, { 0, 580, 0, 400 },
	0,
	256, 256,
	avg_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	avg_start_bzone,
	avg_stop,
	avg_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_POKEY,
			&bzone_pokey_interface
		},
		{
			SOUND_SAMPLES,
			&bzone_samples_interface
		}
	}

};


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

  Game driver(s)

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

static const char *bzone_sample_names[] =
{
	"*bzone",
	"fire.sam",
	"fire2.sam",
	"engine1.sam",
	"engine2.sam",
	"explode1.sam",
	"explode2.sam",
    0	/* end of array */
};

ROM_START( bzone_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "036414.01",    0x5000, 0x0800, 0xefbc3fa0 )
	ROM_LOAD( "036413.01",    0x5800, 0x0800, 0x5d9d9111 )
	ROM_LOAD( "036412.01",    0x6000, 0x0800, 0xab55cbd2 )
	ROM_LOAD( "036411.01",    0x6800, 0x0800, 0xad281297 )
	ROM_LOAD( "036410.01",    0x7000, 0x0800, 0x0b7bfaa4 )
	ROM_LOAD( "036409.01",    0x7800, 0x0800, 0x1e14e919 )
	ROM_RELOAD(            0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Mathbox ROMs */
	ROM_LOAD( "036422.01",    0x3000, 0x0800, 0x7414177b )
	ROM_LOAD( "036421.01",    0x3800, 0x0800, 0x8ea8f939 )
ROM_END

ROM_START( bzone2_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "036414a.01",   0x5000, 0x0800, 0x13de36d5 )
	ROM_LOAD( "036413.01",    0x5800, 0x0800, 0x5d9d9111 )
	ROM_LOAD( "036412.01",    0x6000, 0x0800, 0xab55cbd2 )
	ROM_LOAD( "036411.01",    0x6800, 0x0800, 0xad281297 )
	ROM_LOAD( "036410.01",    0x7000, 0x0800, 0x0b7bfaa4 )
	ROM_LOAD( "036409.01",    0x7800, 0x0800, 0x1e14e919 )
	ROM_RELOAD(             0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Mathbox ROMs */
	ROM_LOAD( "036422.01",    0x3000, 0x0800, 0x7414177b )
	ROM_LOAD( "036421.01",    0x3800, 0x0800, 0x8ea8f939 )
ROM_END



struct GameDriver bzone_driver =
{
	__FILE__,
	0,
	"bzone",
	"Battle Zone",
	"1980",
	"Atari",
	"Brad Oliver (MAME driver)\n"VECTOR_TEAM"Mauro Minenna (one-stick mode)",
	0,
	&bzone_machine_driver,
	0,

	bzone_rom,
	0, 0,
	bzone_sample_names,
	0,	/* sound_prom */

	bzone_input_ports,

	bzone_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	bzone_hiload, bzone_hisave
};

struct GameDriver bzone2_driver =
{
	__FILE__,
	&bzone_driver,
	"bzone2",
	"Battle Zone (alternate version)",
	"1980",
	"Atari",
	"Brad Oliver (MAME driver)\n"VECTOR_TEAM"Mauro Minenna (one-stick mode)",
	0,
	&bzone_machine_driver,
	0,

	bzone2_rom,
	0, 0,
	bzone_sample_names,
	0,	/* sound_prom */

	bzone_input_ports,

	bzone_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	bzone_hiload, bzone_hisave
};


static struct POKEYinterface redbaron_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 */
	{ redbaron_joy_r },
};


static struct Samplesinterface redbaron_samples_interface =
{
	2	/* 2 channels */
};

static struct MachineDriver redbaron_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			1500000,	/* 1.5 Mhz */
			0,
			redbaron_readmem,redbaron_writemem,0,0,
			bzone_interrupt,4 /* 5.4ms */
		}
	},
	45, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
	1,
	0,

	/* video hardware */
	320, 240, { 0, 520, 0, 400 },
	0,
	256, 256,
	avg_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	avg_start_redbaron,
	avg_stop,
	avg_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_POKEY,
			&redbaron_pokey_interface
		},
		{
			SOUND_SAMPLES,
			&redbaron_samples_interface
		}
	}
};



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

  Game driver(s)

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

static const char *redbaron_sample_names[] =
{
	"fire.sam",
	"spin.sam",
	"explode1.sam",
    0	/* end of array */
};

ROM_START( redbaron_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "037587.01",    0x4800, 0x0800, 0x60f23983 )
	ROM_CONTINUE(           0x5800, 0x0800 )
	ROM_LOAD( "037000.01e",   0x5000, 0x0800, 0x69bed808 )
	ROM_LOAD( "036998.01e",   0x6000, 0x0800, 0xd1104dd7 )
	ROM_LOAD( "036997.01e",   0x6800, 0x0800, 0x7434acb4 )
	ROM_LOAD( "036996.01e",   0x7000, 0x0800, 0xc0e7589e )
	ROM_LOAD( "036995.01e",   0x7800, 0x0800, 0xad81d1da )
	ROM_RELOAD(             0xf800, 0x0800 )	/* for reset/interrupt vectors */
	/* Mathbox ROMs */
	ROM_LOAD( "037006.01e",   0x3000, 0x0800, 0x9fcffea0 )
	ROM_LOAD( "037007.01e",   0x3800, 0x0800, 0x60250ede )
ROM_END

struct GameDriver redbaron_driver =
{
	__FILE__,
	0,
	"redbaron",
	"Red Baron",
	"1980",
	"Atari",
	"Brad Oliver (MAME driver)\n"VECTOR_TEAM"Baloo (stick support)",
	0,
	&redbaron_machine_driver,
	0,

	redbaron_rom,
	0, 0,
	redbaron_sample_names,
	0,	/* sound_prom */

	redbaron_input_ports,

	redbaron_color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	atari_vg_earom_load, atari_vg_earom_save
};

⌨️ 快捷键说明

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