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

📄 arkanoi2.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	PORT_DIPSETTING(    0x01, "Table")
	PORT_DIPSETTING(    0x00, "Upright")
	PORT_DIPNAME( 0x02, 0x02, "Monitor", IP_KEY_NONE )
	PORT_DIPSETTING(    0x02, "Normal")
	PORT_DIPSETTING(    0x00, "Invert")
	PORT_DIPNAME( 0x04, 0x04, "Test", IP_KEY_NONE )
	PORT_DIPSETTING(    0x04, "Normal Game")
	PORT_DIPSETTING(    0x00, "Test Mode")
	PORT_DIPNAME( 0x08, 0x08, "Attract Sound", IP_KEY_NONE )
	PORT_DIPSETTING(    0x08, "On")
	PORT_DIPSETTING(    0x00, "Off")
	PORT_DIPNAME( 0x30, 0x30, "Coin 1", IP_KEY_NONE )
	PORT_DIPSETTING(    0x30, "1 Coin/1 Play")
	PORT_DIPSETTING(    0x20, "1 Coin/2 Play")
	PORT_DIPSETTING(    0x10, "2 Coin/1 Play")
	PORT_DIPSETTING(    0x00, "2 Coin/3 Play")
	PORT_DIPNAME( 0xc0, 0xc0, "Coin 2", IP_KEY_NONE )
	PORT_DIPSETTING(    0xc0, "1 Coin/1 Play")
	PORT_DIPSETTING(    0x80, "1 Coin/2 Play")
	PORT_DIPSETTING(    0x40, "2 Coin/1 Play")
	PORT_DIPSETTING(    0x00, "2 Coin/3 Play")

	PORT_START	/* DSW2 - IN3 */
	PORT_DIPNAME( 0x03, 0x03, "Difficulty", IP_KEY_NONE )
	PORT_DIPSETTING(    0x02, "Easy")
	PORT_DIPSETTING(    0x03, "Normal")
	PORT_DIPSETTING(    0x01, "Hard")
	PORT_DIPSETTING(    0x00, "Very Hard")
	PORT_DIPNAME( 0x0c, 0x0c, "Bonus", IP_KEY_NONE )
	PORT_DIPSETTING(    0x0c, "100K/200K")
	PORT_DIPSETTING(    0x08, "100K Only")
	PORT_DIPSETTING(    0x04, "50K Only")
	PORT_DIPSETTING(    0x00, "50K/150K")
	PORT_DIPNAME( 0x30, 0x30, "Number of VAUS", IP_KEY_NONE )
	PORT_DIPSETTING(    0x30, "3")
	PORT_DIPSETTING(    0x20, "2")
	PORT_DIPSETTING(    0x10, "4")
	PORT_DIPSETTING(    0x00, "5")
	PORT_DIPNAME( 0x80, 0x80, "Continue", IP_KEY_NONE )
	PORT_DIPSETTING(    0x80, "Off")
	PORT_DIPSETTING(    0x00, "On")

	PORT_START      /* IN4 */
	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_COIN2 | IPF_IMPULSE, "Coin[2]", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2)
	PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_SERVICE, "Service?", OSD_KEY_F2, IP_JOY_DEFAULT, 0)
	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_COIN1 | IPF_IMPULSE, "Coin[1]", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2)
INPUT_PORTS_END



/*
**
** 				Gfx data
**
*/

/* displacement in bits to the lower part of sprites: */
#define lo 8*8*2

/* layout of sprites */
static struct GfxLayout spritelayout =
{
	16,16,						/* dimx, dimy */
	0x20000/(16*16/8),				/* # of elements */
	4,							/* bits per pixel */
	{0, 0x20000*8, 0x40000*8, 0x60000*8},	/* bitplanes displacements IN BITS */
	{0, 1, 2, 3, 4, 5, 6, 7,			/* x displacements IN BITS */
	 8*8+0,8*8+1,8*8+2,8*8+3,8*8+4,8*8+5,8*8+6,8*8+7},
	{0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,	/* y displacements IN BITS */
	 lo+0*8, lo+1*8, lo+2*8, lo+3*8, lo+4*8, lo+5*8, lo+6*8, lo+7*8},
	16*16     						/* displacement to next IN BITS */
};



static struct GfxDecodeInfo gfxdecodeinfo[] =
{
/* Mem region, start, layout*, start color, color sets */
	{ 1, 0, &spritelayout, 0, 32 },
	{ -1 } /* end of array */
};



static struct YM2203interface ym2203_interface =
{
	1,					/* chips */
	1500000,				/* ?? Mhz */
	{ YM2203_VOL(30,30) },	/* gain,volume */
	{ input_port_2_r 	},		/* DSW1 connected to port A */
	{ input_port_3_r	},		/* DSW2 connected to port B */
	{ 0 },
	{ 0 }
};


static struct MachineDriver arkanoi2_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,			/* main cpu */
			4000000,			/* ?? Hz (only crystal is 12MHz) */
			0,				/* memory region */
			readmem,writemem,0,0,
			interrupt,1			/* interrupts rtn, # per frame */
		},

		{
			CPU_Z80,					/* sound cpu */
			6000000,					/* ?? Hz */
			2,						/* memory region */
			sound_readmem,sound_writemem,0,0,
			interrupt,1					/* interrupts rtn, # per frame */
		},
	},
	60,DEFAULT_60HZ_VBLANK_DURATION,		/* video frequency (Hz), duration */
	100,							/* cpu slices */
	tnzs_init_machine,					/* called at startup */

	/* video hardware */
	16*16, 14*16,			/* screen dimx, dimy (pixels) */
	{ 0, 16*16-1, 0, 14*16-1 },	/* visible rectangle (pixels) */
	gfxdecodeinfo,
	512, 512,
	arkanoi2_vh_convert_color_prom,		/* convert color p-roms */
	VIDEO_TYPE_RASTER,
	0,
	tnzs_vh_start,
	tnzs_vh_stop,
	arkanoi2_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_YM2203,
			&ym2203_interface
		}
	}

};



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

  Game driver(s)

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


ROM_START( arkanoi2_rom )
	ROM_REGION(0x10000)				/* Region 0 - main cpu */
	ROM_LOAD( "a2-05.rom", 0x00000, 0x10000, 0x136edf9d )

	ROM_REGION_DISPOSE(0x20000*4)	/* Region 1 - temporary for gfx roms */
	ROM_LOAD( "a2-m04.rom", 0x00000, 0x20000, 0x548117c6 )	/* btp 0 */
	ROM_LOAD( "a2-m03.rom", 0x20000, 0x20000, 0x49a21c5e )	/* btp 1 */
	ROM_LOAD( "a2-m02.bin", 0x40000, 0x20000, 0x056a985f )	/* btp 2 */
	ROM_LOAD( "a2-m01.rom", 0x60000, 0x20000, 0x70cc559d )	/* btp 3 */

	ROM_REGION(0x10000)				/* Region 2 - sound cpu */
	ROM_LOAD( "a2-13.rom", 0x00000, 0x10000, 0xe8035ef1 )

	ROM_REGION(0x400)				/* Region 3 - color proms */
	ROM_LOAD( "b08-08.bin", 0x00000, 0x200, 0xa4f7ebd9 )	/* hi bytes */
	ROM_LOAD( "b08-07.bin", 0x00200, 0x200, 0xea34d9f7 )	/* lo bytes */
ROM_END

ROM_START( ark2us_rom )
	ROM_REGION(0x10000)				/* Region 0 - main cpu */
	ROM_LOAD( "b08-11.bin", 0x00000, 0x10000, 0x99555231 )

	ROM_REGION_DISPOSE(0x20000*4)	/* Region 1 - temporary for gfx roms */
	ROM_LOAD( "a2-m04.bin", 0x00000, 0x20000, 0x9754f703 )	/* btp 0 */
	ROM_LOAD( "a2-m03.bin", 0x20000, 0x20000, 0x274a795f )	/* btp 1 */
	ROM_LOAD( "a2-m02.bin", 0x40000, 0x20000, 0x056a985f )	/* btp 2 */
	ROM_LOAD( "a2-m01.bin", 0x60000, 0x20000, 0x2ccc86b4 )	/* btp 3 */

	ROM_REGION(0x10000)				/* Region 2 - sound cpu */
	ROM_LOAD( "b08-12.bin", 0x00000, 0x10000, 0xdc84e27d )

	ROM_REGION(0x400)				/* Region 3 - color proms */
	ROM_LOAD( "b08-08.bin", 0x00000, 0x200, 0xa4f7ebd9 )	/* hi bytes */
	ROM_LOAD( "b08-07.bin", 0x00200, 0x200, 0xea34d9f7 )	/* lo bytes */
ROM_END


static int arkanoi2_hiload(void)
{
	unsigned char *RAM = Machine->memory_region[0];

		void *f;

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


	/* check if the hi score table has already been initialized */
	if (memcmp(&RAM[0xeca5], "\x54\x4b\x4e\xff", 4) == 0 && memcmp(&RAM[0xec81], "\x01\x00\x00\x05", 4) == 0 )
	{

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

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

static void arkanoi2_hisave(void)
{
    unsigned char *RAM = Machine->memory_region[0];
    void *f;

	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
	{
		osd_fwrite(f, &RAM[0xec81], 8*5);
		osd_fclose(f);
		RAM[0xeca5] = 0;
	}
}


struct GameDriver arkanoi2_driver =
{
	__FILE__,
	0,
	"arkanoi2",
	"Arkanoid 2 - Revenge of DOH",
	"1987",
	"Taito",
	"Luca Elia\nMirko Buffoni",
	0,
	&arkanoi2_machine_driver,
	0,

	arkanoi2_rom,
	0, 0,
	0,
	0,

	input_ports,

	PROM_MEMORY_REGION(3), 0, 0,
	ORIENTATION_ROTATE_270,

	arkanoi2_hiload, arkanoi2_hisave
};


struct GameDriver ark2us_driver =
{
	__FILE__,
	&arkanoi2_driver,
	"ark2us",
	"Arkanoid 2 - Revenge of DOH (Romstar)",
	"1987",
	"Taito (Romstar license)",
	"Luca Elia\nMirko Buffoni",
	0,
	&arkanoi2_machine_driver,
	0,

	ark2us_rom,
	0, 0,
	0,
	0,

	input_ports,

	PROM_MEMORY_REGION(3), 0, 0,
	ORIENTATION_ROTATE_270,

	arkanoi2_hiload, arkanoi2_hisave
};

⌨️ 快捷键说明

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