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

📄 mhavoc.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	PORT_DIPSETTING( 0x01, "FreePlay" )
	PORT_DIPSETTING( 0x00, "1 Coin/2 Credits" )
	PORT_DIPNAME( 0x0c, 0x0c, "Right Coin Mechanism", IP_KEY_NONE )
	PORT_DIPSETTING( 0x0c, "x1" )
	PORT_DIPSETTING( 0x08, "x4" )
	PORT_DIPSETTING( 0x04, "x5" )
	PORT_DIPSETTING( 0x00, "x6" )
	PORT_DIPNAME( 0x10, 0x10, "Left Coin Mechanism", IP_KEY_NONE )
	PORT_DIPSETTING( 0x10, "x1" )
	PORT_DIPSETTING( 0x00, "x2" )
	PORT_DIPNAME( 0xe0, 0xe0, "Bonus Coins", IP_KEY_NONE )
	PORT_DIPSETTING( 0xe0, "None" )
	PORT_DIPSETTING( 0xa0, "1 each 4" )
	PORT_DIPSETTING( 0x80, "2 each 4" )
	PORT_DIPSETTING( 0x60, "1 each 5" )
	PORT_DIPSETTING( 0x40, "1 each 3" )

	PORT_START	/* IN5 - dummy for player_1 = 1 on alpha */
	PORT_BITX(	0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0)
	PORT_DIPSETTING(      0x00, "On" )
	PORT_DIPSETTING(      0x80, "Off" )
	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )	/* Cabinet */
	PORT_BIT ( 0x3f, IP_ACTIVE_HIGH, IPT_UNUSED )

INPUT_PORTS_END

static unsigned char color_prom[] = { VEC_PAL_COLOR };



static struct POKEYinterface pokey_interface =
{
	4,	/* 4 chips */
	1250000,	/* 1.25 MHz??? */
	25,
	POKEY_DEFAULT_GAIN,
	NO_CLIP,
	/* The 8 pot handlers */
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	{ 0, 0, 0, 0 },
	/* The allpot handler */
	{ input_port_3_r, 0, 0, 0 },
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			2500000,	/* 2.5 Mhz */
			0,
			readmem,writemem,0,0,
			interrupt,8 /* 2.4576 ms period */
		},
		{
			CPU_M6502,
			1250000,	/* 1.25 Mhz */
			2,		/* CPU #2 */
			gamma_readmem,gamma_writemem,0,0,
			0, 0, /* no vblank interrupt */
			interrupt, 305 /* 3.2768 ms period */
		}
	},
	50, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
			/* fps should be 30, but MH draws "empty" frames */
	1,		/* 1 CPU slice. see machine.c */
	mhavoc_init_machine,

	/* video hardware */
	320, 240, { 0, 300, 0, 260 },
	0,
	256,256,
	avg_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	avg_start_mhavoc,
	avg_stop,
	avg_screenrefresh,

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


/*
 * Notes:
 * the R3 roms are supported as "mhavoc", the R2 roms (with a bug in gameplay)
 * are supported as "mhavoc2".
 * We'll probably add support for
 *   "Return to Vax" - Jess Askey's souped up version (errors on self test)
 */

ROM_START( mhavoc_rom )
	/* Alpha Processor ROMs */
	ROM_REGION(0x21000)	/* 152KB for ROMs */
	/* Vector Generator ROM */
	ROM_LOAD( "136025.210",   0x5000, 0x2000, 0xc67284ca )

	/* Program ROM */
	ROM_LOAD( "136025.216",   0x8000, 0x4000, 0x522a9cc0 )
	ROM_LOAD( "136025.217",   0xc000, 0x4000, 0xea3d6877 )

	/* Paged Program ROM */
	ROM_LOAD( "136025.215",   0x10000, 0x4000, 0xa4d380ca )   /* page 0+1 */
	ROM_LOAD( "136025.318",   0x14000, 0x4000, 0xba935067 )	/* page 2+3 */

	/* Paged Vector Generator ROM */
	ROM_LOAD( "136025.106",   0x18000, 0x4000, 0x2ca83c76 )	/* page 0+1 */
	ROM_LOAD( "136025.107",   0x1c000, 0x4000, 0x5f81c5f3 )	/* page 2+3 */

	ROM_REGION_DISPOSE(0x100)	/* Dummy area to be disposed by engine */

	/* Gamma Processor ROM */
	ROM_REGION(0x10000)	/* 16k for code */
	ROM_LOAD( "136025.108",   0x8000, 0x4000, 0x93faf210 )
	ROM_RELOAD(             0xc000, 0x4000 ) /* reset+interrupt vectors */
ROM_END

ROM_START( mhavoc2_rom )
	/* Alpha Processor ROMs */
	ROM_REGION(0x21000)
	/* Vector Generator ROM */
	ROM_LOAD( "136025.110",   0x05000, 0x2000, 0x16eef583 )

	/* Program ROM */
	ROM_LOAD( "136025.103",   0x08000, 0x4000, 0xbf192284 )
	ROM_LOAD( "136025.104",   0x0c000, 0x4000, 0x833c5d4e )

	/* Paged Program ROM - switched to 2000-3fff */
	ROM_LOAD( "136025.101",   0x10000, 0x4000, 0x2b3b591f ) /* page 0+1 */
	ROM_LOAD( "136025.109",   0x14000, 0x4000, 0x4d766827 ) /* page 2+3 */

	/* Paged Vector Generator ROM */
	ROM_LOAD( "136025.106",   0x18000, 0x4000, 0x2ca83c76 ) /* page 0+1 */
	ROM_LOAD( "136025.107",   0x1c000, 0x4000, 0x5f81c5f3 ) /* page 2+3 */

	/* the last 0x1000 is used for the 2 RAM pages */
	ROM_REGION_DISPOSE(0x100)	/* Dummy area to be disposed by engine */

	/* Gamma Processor ROM */
	ROM_REGION(0x10000)	/* 16k for code */
	ROM_LOAD( "136025.108",   0x8000, 0x4000, 0x93faf210 )
	ROM_RELOAD(             0xc000, 0x4000 )/* reset+interrupt vectors */
ROM_END

ROM_START( mhavoc_rv_rom )
	/* Alpha Processor ROMs */
	ROM_REGION(0x21000)	/* 152KB for ROMs */
	/* Vector Generator ROM */
	ROM_LOAD( "136025.210",   0x5000, 0x2000, 0xc67284ca )

	/* Program ROM */
	ROM_LOAD( "136025.916",   0x8000, 0x4000, 0x1255bd7f )
	ROM_LOAD( "136025.917",   0xc000, 0x4000, 0x21889079 )

	/* Paged Program ROM */
	ROM_LOAD( "136025.915",   0x10000, 0x4000, 0x4c7235dc )   /* page 0+1 */
	ROM_LOAD( "136025.918",   0x14000, 0x4000, 0x84735445 )	/* page 2+3 */

	/* Paged Vector Generator ROM */
	ROM_LOAD( "136025.106",   0x18000, 0x4000, 0x2ca83c76 )	/* page 0+1 */
	ROM_LOAD( "136025.907",   0x1c000, 0x4000, 0x4deea2c9 )	/* page 2+3 */

	ROM_REGION_DISPOSE(0x100)	/* Dummy area to be disposed by engine */

	/* Gamma Processor ROM */
	ROM_REGION(0x10000)	/* 16k for code */
	ROM_LOAD( "136025.908",   0x8000, 0x4000, 0xc52ec664 )
	ROM_RELOAD(             0xc000, 0x4000 ) /* reset+interrupt vectors */
ROM_END

static int hiload(void)
{
	void *f;
	/* get RAM pointer (this game is multiCPU) */
	unsigned char *RAM = Machine->memory_region[2];

	/* no reason to check hiscore table. It's an NV_RAM! */
	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
	{
	        osd_fread(f,&RAM[0x6000],0x200);
	        osd_fclose(f);
	}
	return 1;
}

void hisave(void)
{
	void *f;
	/* get RAM pointer (this game is multiCPU) */
	unsigned char *RAM = Machine->memory_region[2];

	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
	{
	        osd_fwrite(f,&RAM[0x6000],0x200);
	        osd_fclose(f);
	}
}


#define CREDITS \
	"Mike Appolo (MAME driver)\n" \
	"Brad Oliver (MAME driver)\n" \
	"Neil Bradley (MAME driver)\n" \
	"Bernd Wiebelt (MAME driver)\n" \
	"Frank Palazzolo (technical info)\n" \
	"Jess Askey (technical info)\n" \
	"Owen Rubin (technical info)\n" \
	VECTOR_TEAM

struct GameDriver mhavoc_driver =
{
	__FILE__,
	0,
	"mhavoc",
	"Major Havoc (rev 3)",
	"1983",
	"Atari",
	CREDITS,
	0,
	&machine_driver,
	0,

	mhavoc_rom,
	0, 0,
	0,
	0,

	input_ports,

	color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	hiload,hisave
};

struct GameDriver mhavoc2_driver =
{
	__FILE__,
	&mhavoc_driver,
	"mhavoc2",
	"Major Havoc (rev 2)",
	"1983",
	"Atari",
	CREDITS,
	0,
	&machine_driver,
	0,

	mhavoc2_rom,
	0, 0,
	0,
	0,

	input_ports,

	color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	hiload,hisave
};

struct GameDriver mhavocrv_driver =
{
	__FILE__,
	&mhavoc_driver,
	"mhavocrv",
	"Major Havoc (Return to Vax)",
	"1983",
	"hack",
	CREDITS,
	0,
	&machine_driver,
	0,

	mhavoc_rv_rom,
	0, 0,
	0,
	0,

	input_ports,

	color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	hiload,hisave
};

⌨️ 快捷键说明

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