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

📄 cclimber.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	PORT_DIPSETTING(    0x10, "Upright" )
	PORT_DIPSETTING(    0x00, "Cocktail" )
	PORT_DIPNAME( 0x20, 0x00, "High Score Names", IP_KEY_NONE )
	PORT_DIPSETTING(    0x20, "3 Letters" )
	PORT_DIPSETTING(    0x00, "10 Letters" )
	PORT_DIPNAME( 0xc0, 0x00, "Difficulty", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Easy" )
	PORT_DIPSETTING(    0x40, "Medium" )
	PORT_DIPSETTING(    0x80, "Hard" )
	PORT_DIPSETTING(    0xc0, "Hardest" )

	PORT_START      /* coin */
	PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE, "Coin A", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2)
	PORT_BITX(0x02, IP_ACTIVE_HIGH, IPT_COIN2 | IPF_IMPULSE, "Coin B", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 2)
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )     /* probably unused */
INPUT_PORTS_END



static struct GfxLayout swimmer_charlayout =
{
	8,8,    /* 8*8 characters */
	512,    /* 512 characters */
	3,      /* 3 bits per pixel */
	{ 0, 512*8*8, 512*2*8*8 },      /* the bitplanes are separated */
	{ 0, 1, 2, 3, 4, 5, 6, 7 },	     /* characters are upside down */
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	8*8     /* every char takes 8 consecutive bytes */
};

static struct GfxLayout swimmer_spritelayout =
{
	16,16,  /* 16*16 sprites */
	128,    /* 128 sprites */
	3,	      /* 3 bits per pixel */
	{ 0, 128*16*16, 128*2*16*16 },  /* the bitplanes are separated */
	{ 0, 1, 2, 3, 4, 5, 6, 7,       /* pretty straightforward layout */
			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,
			16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
	32*8    /* every sprite takes 32 consecutive bytes */
};

static struct GfxDecodeInfo swimmer_gfxdecodeinfo[] =
{
	{ 1, 0x0000, &swimmer_charlayout,      0, 64 }, /* characters */
	{ 1, 0x0000, &swimmer_spritelayout,    0, 32 }, /* sprite set #1 */
	{ 1, 0x3000, &swimmer_charlayout,   64*8, 4 },  /* big sprite set */
	{ -1 } /* end of array */
};



static struct AY8910interface swimmer_ay8910_interface =
{
	2,      /* 2 chips */
	4000000/2,	/* 2 MHz */
	{ 255, 255 },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 }
};



static struct MachineDriver swimmer_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			3072000,	/* 3.072 MHz */
			0,
			swimmer_readmem,swimmer_writemem,0,0,
			nmi_interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			4000000/2,	/* 2 MHz */
			3,      /* memory region #2 */
			sound_readmem,sound_writemem,0,sound_writeport,
			0,0,
			nmi_interrupt,4000000/16384 /* IRQs are triggered by the main CPU */
		}
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
	1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
	0,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
	swimmer_gfxdecodeinfo,
	96,64*8+4*8,	/* TODO: use palette shrinking */
	swimmer_vh_convert_color_prom,

	VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
	0,
	cclimber_vh_start,
	cclimber_vh_stop,
	swimmer_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_AY8910,
			&swimmer_ay8910_interface
		}
	}
};



ROM_START( swimmer_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "sw1",          0x0000, 0x1000, 0xf12481e7 )
	ROM_LOAD( "sw2",          0x1000, 0x1000, 0xa0b6fdd2 )
	ROM_LOAD( "sw3",          0x2000, 0x1000, 0xec93d7de )
	ROM_LOAD( "sw4",          0x3000, 0x1000, 0x0107927d )
	ROM_LOAD( "sw5",          0x4000, 0x1000, 0xebd8a92c )
	ROM_LOAD( "sw6",          0x5000, 0x1000, 0xf8539821 )
	ROM_LOAD( "sw7",          0x6000, 0x1000, 0x37efb64e )
	ROM_LOAD( "sw8",          0x7000, 0x1000, 0x33d6001e )

	ROM_REGION_DISPOSE(0x6000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "sw15",         0x0000, 0x1000, 0x4f3608cb )  /* chars */
	ROM_LOAD( "sw14",         0x1000, 0x1000, 0x7181c8b4 )
	ROM_LOAD( "sw13",         0x2000, 0x1000, 0x2eb1af5c )
	ROM_LOAD( "sw23",         0x3000, 0x0800, 0x9ca67e24 )  /* bigsprite data */
	/* 3800-3fff empty (Guzzler has larger ROMs) */
	ROM_LOAD( "sw22",         0x4000, 0x0800, 0x02c10992 )
	/* 4800-4fff empty (Guzzler has larger ROMs) */
	ROM_LOAD( "sw21",         0x5000, 0x0800, 0x7f4993c1 )
	/* 5800-5fff empty (Guzzler has larger ROMs) */

	ROM_REGION(0x220)        /* color proms */
	ROM_LOAD( "8220.clr",     0x0000, 0x100, 0x72c487ed )
	ROM_LOAD( "8212.clr",     0x0100, 0x100, 0x39037799 )
	ROM_LOAD( "8221.clr",     0x0200, 0x020, 0x3b2deb3a )

	ROM_REGION(0x10000)     /* 64k for sound board */
	ROM_LOAD( "sw12",         0x0000, 0x1000, 0x2eee9bcb )
ROM_END

ROM_START( swimmera_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "swa1",         0x0000, 0x1000, 0x42c2b6c5 )
	ROM_LOAD( "swa2",         0x1000, 0x1000, 0x49bac195 )
	ROM_LOAD( "swa3",         0x2000, 0x1000, 0xa6d8cb01 )
	ROM_LOAD( "swa4",         0x3000, 0x1000, 0x7be75182 )
	ROM_LOAD( "swa5",         0x4000, 0x1000, 0x78f79573 )
	ROM_LOAD( "swa6",         0x5000, 0x1000, 0xfda9b311 )
	ROM_LOAD( "swa7",         0x6000, 0x1000, 0x7090e5ee )
	ROM_LOAD( "swa8",         0x7000, 0x1000, 0xab86efa9 )

	ROM_REGION_DISPOSE(0x6000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "sw15",         0x0000, 0x1000, 0x4f3608cb )  /* chars */
	ROM_LOAD( "sw14",         0x1000, 0x1000, 0x7181c8b4 )
	ROM_LOAD( "sw13",         0x2000, 0x1000, 0x2eb1af5c )
	ROM_LOAD( "sw23",         0x3000, 0x0800, 0x9ca67e24 )  /* bigsprite data */
	/* 3800-3fff empty (Guzzler has larger ROMs) */
	ROM_LOAD( "sw22",         0x4000, 0x0800, 0x02c10992 )
	/* 4800-4fff empty (Guzzler has larger ROMs) */
	ROM_LOAD( "sw21",         0x5000, 0x0800, 0x7f4993c1 )
	/* 5800-5fff empty (Guzzler has larger ROMs) */

	ROM_REGION(0x220)        /* color proms */
	ROM_LOAD( "8220.clr",     0x0000, 0x100, 0x72c487ed )
	ROM_LOAD( "8212.clr",     0x0100, 0x100, 0x39037799 )
	ROM_LOAD( "8221.clr",     0x0200, 0x020, 0x3b2deb3a )

	ROM_REGION(0x10000)     /* 64k for sound board */
	ROM_LOAD( "sw12",         0x0000, 0x1000, 0x2eee9bcb )
ROM_END

ROM_START( guzzler_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "guzz-01.bin",  0x0000, 0x2000, 0x58aaa1e9 )
	ROM_LOAD( "guzz-02.bin",  0x2000, 0x2000, 0xf80ceb17 )
	ROM_LOAD( "guzz-03.bin",  0x4000, 0x2000, 0xe63c65a2 )
	ROM_LOAD( "guzz-04.bin",  0x6000, 0x2000, 0x45be42f5 )
	ROM_LOAD( "guzz-16.bin",  0xe000, 0x2000, 0x61ee00b7 )

	ROM_REGION_DISPOSE(0x6000)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "guzz-13.bin",  0x0000, 0x1000, 0xafc464e2 )   /* chars */
	ROM_LOAD( "guzz-14.bin",  0x1000, 0x1000, 0xacbdfe1f )
	ROM_LOAD( "guzz-15.bin",  0x2000, 0x1000, 0x66978c05 )
	ROM_LOAD( "guzz-11.bin",  0x3000, 0x1000, 0xec2e9d86 )   /* big sprite */
	ROM_LOAD( "guzz-10.bin",  0x4000, 0x1000, 0xbd3f0bf7 )
	ROM_LOAD( "guzz-09.bin",  0x5000, 0x1000, 0x18927579 )

	ROM_REGION(0x220)       /* color proms */
	ROM_LOAD( "guzzler.003",  0x0000, 0x100, 0xf86930c1 )
	ROM_LOAD( "guzzler.002",  0x0100, 0x100, 0xb566ea9e )
	ROM_LOAD( "guzzler.001",  0x0200, 0x020, 0x69089495 )

	ROM_REGION(0x10000)     /* 64k for sound board */
	ROM_LOAD( "guzz-12.bin",  0x0000, 0x1000, 0xf3754d9e )
ROM_END



static int swimmer_hiload(void)
{
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


	/* check if the hi score table has already been initialized */
	/* Look for "TEK" in the 1st and 5th positions */
	if (memcmp(&RAM[0x84e6],"\x54\x45\x48",3) == 0 &&
			memcmp(&RAM[0x850a],"\x54\x45\x48",3) == 0)
	{
		void *f;


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

			RAM[0x8577] = RAM[0x84e0];
			RAM[0x8578] = RAM[0x84e1];
			RAM[0x8579] = RAM[0x84e2];
			RAM[0x857a] = RAM[0x84e3];
			RAM[0x857b] = RAM[0x84e4];
			RAM[0x857c] = RAM[0x84e5];
		}

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

static void swimmer_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[0x84e0],9*5);
		osd_fclose(f);
		RAM[0x84e6] = 0;
	}
}


static int guzzler_hiload(void)
{
	unsigned char *RAM=Machine->memory_region[Machine->drv->cpu[0].memory_region];
	static int firsttime;


	/* check if the hi score table has already been initialized */
	/* the high score table is intialized to all 0, so first of all */
	/* we dirty it, then we wait for it to be cleared again */
	if (firsttime == 0)
	{
		memset(&RAM[0x8584],0xff,16*5);
		firsttime = 1;
	}
	/* check if the hi score table has already been initialized */
	if (memcmp(&RAM[0x8584],"\x00\x03\x00",3) == 0 &&
			memcmp(&RAM[0x85c4],"\x00\x03\x00",3) == 0)
	{
		void *f;
		if ((f =osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x8584],16*5);
			RAM[0x8007]=RAM[0x8584];
			RAM[0x8008]=RAM[0x8585];
			RAM[0x8009]=RAM[0x8586];
			RAM[0x800A]=RAM[0x8587];
			RAM[0x800B]=RAM[0x8588];
			RAM[0x800C]=RAM[0x8589];
			osd_fclose(f);
		}
		firsttime = 0;
		return 1;
	}
	else return 0;  /* we can't load the hi scores yet */
}



static void guzzler_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[0x8584],16*5);
		osd_fclose(f);
	}
}



struct GameDriver swimmer_driver =
{
	__FILE__,
	0,
	"swimmer",
	"Swimmer (set 1)",
	"1982",
	"Tehkan",
	"Brad Oliver",
	GAME_IMPERFECT_COLORS,
	&swimmer_machine_driver,
	0,

	swimmer_rom,
	0, 0,
	0,
	0,      /* sound_prom */

	swimmer_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	swimmer_hiload, swimmer_hisave
};

struct GameDriver swimmera_driver =
{
	__FILE__,
	&swimmer_driver,
	"swimmera",
	"Swimmer (set 2)",
	"1982",
	"Tehkan",
	"Brad Oliver",
	GAME_IMPERFECT_COLORS,
	&swimmer_machine_driver,
	0,

	swimmera_rom,
	0, 0,
	0,
	0,      /* sound_prom */

	swimmer_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	swimmer_hiload, swimmer_hisave
};

struct GameDriver guzzler_driver =
{
	__FILE__,
	0,
	"guzzler",
	"Guzzler",
	"1983",
	"Tehkan",
	"Mirko Buffoni (MAME driver)\nGerald Vanderick (color info)\nAUC-L (SM) Valerio Verrando\n(high score save)",
	0,
	&swimmer_machine_driver,
	0,

	guzzler_rom,
	0, 0,
	0,
	0,      /* sound_prom */

	guzzler_input_ports,

	PROM_MEMORY_REGION(2),0,0,
	ORIENTATION_ROTATE_90,

	guzzler_hiload, guzzler_hisave
};

⌨️ 快捷键说明

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