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

📄 locomotn.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
			32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
	64*8	/* every sprite takes 64 consecutive bytes */
};

static struct GfxLayout radardotlayout =
{
	/* there is no gfx ROM for this one, it is generated by the hardware */
	2,2,	/* 2*2 square */
	1,	/* just one */
	1,	/* 1 bit per pixel */
	{ 0 },
	{ 0x15f*8, 0x15f*8 },	/* I "know" that this bit of the */
	{ 4, 4 },	/* graphics ROMs is 1 */
	0	/* no use */
};

static struct GfxDecodeInfo gfxdecodeinfo[] =
{
	{ 1, 0x0000, &charlayout,        0, 64 },
	{ 1, 0x0000, &spritelayout,      0, 64 },
	{ 1, 0x0000, &radardotlayout, 64*4,  4 },
	{ -1 } /* end of array */
};



static unsigned char wrong_color_prom[] =
{
	/* 8b.cpu - palette */
	0x00,0x07,0xA0,0x97,0x67,0x3F,0x7D,0x38,0xF0,0xA8,0xC0,0x18,0x5E,0xA8,0x1B,0xFF,
	0x00,0xFF,0xB7,0x00,0x00,0xFF,0xB7,0x00,0x00,0xFF,0xB7,0x00,0x00,0xFF,0xB7,0x00,
	/* 9d.cpu - lookup table */
	0x00,0x09,0x05,0x0C,0x00,0x01,0x08,0x06,0x00,0x06,0x0F,0x01,0x00,0x01,0x02,0x03,
	0x00,0x04,0x05,0x07,0x00,0x07,0x08,0x09,0x00,0x0A,0x0B,0x0C,0x00,0x08,0x05,0x0F,
	0x00,0x08,0x0F,0x01,0x00,0x05,0x04,0x0E,0x00,0x01,0x07,0x08,0x00,0x0B,0x0C,0x0D,
	0x00,0x01,0x01,0x01,0x00,0x02,0x02,0x02,0x00,0x03,0x03,0x03,0x00,0x04,0x04,0x04,
	0x00,0x05,0x05,0x05,0x00,0x06,0x06,0x06,0x00,0x07,0x07,0x07,0x00,0x08,0x08,0x08,
	0x00,0x09,0x09,0x09,0x00,0x0A,0x0A,0x0A,0x00,0x0B,0x0B,0x0B,0x00,0x0C,0x0C,0x0C,
	0x00,0x0D,0x0D,0x0D,0x00,0x0E,0x0E,0x0E,0x00,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,
	0x00,0x02,0x05,0x0C,0x00,0x09,0x05,0x0C,0x00,0x0B,0x05,0x0C,0x00,0x0E,0x05,0x0C,
	0x00,0x09,0x05,0x0C,0x00,0x01,0x08,0x06,0x00,0x06,0x0F,0x01,0x00,0x01,0x02,0x03,
	0x00,0x04,0x05,0x07,0x00,0x07,0x08,0x09,0x00,0x0A,0x0B,0x0C,0x00,0x08,0x05,0x0F,
	0x00,0x08,0x00,0x01,0x00,0x05,0x04,0x0E,0x00,0x01,0x07,0x08,0x00,0x0B,0x0C,0x0D,
	0x00,0x01,0x01,0x01,0x00,0x02,0x02,0x02,0x00,0x03,0x03,0x03,0x00,0x04,0x04,0x04,
	0x00,0x05,0x05,0x05,0x00,0x06,0x06,0x06,0x00,0x07,0x07,0x07,0x00,0x08,0x08,0x08,
	0x00,0x09,0x09,0x09,0x00,0x0A,0x0A,0x0A,0x00,0x0B,0x0B,0x0B,0x00,0x0C,0x0C,0x0C,
	0x00,0x0D,0x0D,0x0D,0x00,0x0E,0x0E,0x0E,0x00,0x0F,0x0F,0x0F,0x00,0x03,0x06,0x0D,
	0x00,0x04,0x05,0x0C,0x00,0x03,0x05,0x0C,0x00,0x0B,0x08,0x09,0x00,0x09,0x04,0x0D,
};



static struct AY8910interface ay8910_interface =
{
	2,	/* 2 chips */
	1789750,	/* 1.78975 MHz ? (same as other Konami games) */
	{ 0x20ff, 0x20ff },
	{ soundlatch_r },
	{ locomotn_portB_r },
	{ 0 },
	{ 0 }
};



#define MACHINE_DRIVER(GAMENAME)   \
																	\
static struct MachineDriver GAMENAME##_machine_driver =             \
{                                                                   \
	/* basic machine hardware */                                    \
	{                                                               \
		{                                                           \
			CPU_Z80,                                                \
			3072000,	/* 3.072 Mhz ? */                           \
			0,                                                      \
			readmem,GAMENAME##_writemem,0,0,                        \
			nmi_interrupt,1                                         \
		},                                                          \
		{                                                           \
			CPU_Z80 | CPU_AUDIO_CPU,                                \
			14318180/4,	/* ???? same as other Konami games */       \
			3,	/* memory region #3 */                              \
			sound_readmem,sound_writemem,0,0,                       \
			ignore_interrupt,1	/* interrupts 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 */                                            \
	36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },                       \
	gfxdecodeinfo,                                                  \
	32,64*4+4*2,                                                    \
	rallyx_vh_convert_color_prom,                                   \
                                                                    \
	VIDEO_TYPE_RASTER,                                              \
	0,                                                              \
	rallyx_vh_start,                                                \
	rallyx_vh_stop,                                                 \
	GAMENAME##_vh_screenrefresh,                                    \
                                                                    \
	/* sound hardware */                                            \
	0,0,0,0,                                                        \
	{                                                               \
		{                                                           \
			SOUND_AY8910,                                           \
			&ay8910_interface                                       \
		}                                                           \
	}                                                               \
};

#define locomotn_writemem writemem
#define commsega_writemem writemem
#define jungler_vh_screenrefresh rallyx_vh_screenrefresh
MACHINE_DRIVER(locomotn)
MACHINE_DRIVER(jungler)
MACHINE_DRIVER(commsega)


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

  Game driver(s)

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

ROM_START( jungler_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "jungr1",       0x0000, 0x1000, 0x5bd6ad15 )
	ROM_LOAD( "jungr2",       0x1000, 0x1000, 0xdc99f1e3 )
	ROM_LOAD( "jungr3",       0x2000, 0x1000, 0x3dcc03da )
	ROM_LOAD( "jungr4",       0x3000, 0x1000, 0xf92e9940 )

	ROM_REGION_DISPOSE(0x2000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "5k",           0x0000, 0x0800, 0x924262bf )
	ROM_LOAD( "5m",           0x0800, 0x0800, 0x131a08ac )
	/* 1000-1fff empty for my convenience */

	ROM_REGION(0x0260)	/* color PROMs */
	ROM_LOAD( "18s030.8b",    0x0000, 0x0020, 0x55a7e6d1 ) /* palette */
	ROM_LOAD( "tbp24s10.9d",  0x0020, 0x0100, 0xd223f7b8 ) /* loookup table */
	ROM_LOAD( "18s030.7a",    0x0120, 0x0020, 0x8f574815 ) /* ?? */
	ROM_LOAD( "6331-1.10a",   0x0140, 0x0020, 0xb8861096 ) /* ?? */
	ROM_LOAD( "82s129.10g",   0x0160, 0x0100, 0x2ef89356 ) /* ?? */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "1b",           0x0000, 0x1000, 0xf86999c3 )
ROM_END

ROM_START( locomotn_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "1a.cpu",       0x0000, 0x1000, 0xb43e689a )
	ROM_LOAD( "2a.cpu",       0x1000, 0x1000, 0x529c823d )
	ROM_LOAD( "3.cpu",        0x2000, 0x1000, 0xc9dbfbd1 )
	ROM_LOAD( "4.cpu",        0x3000, 0x1000, 0xcaf6431c )
	ROM_LOAD( "5.cpu",        0x4000, 0x1000, 0x64cf8dd6 )

	ROM_REGION_DISPOSE(0x2000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "c1.cpu",       0x0000, 0x1000, 0x5732eda9 )
	ROM_LOAD( "c2.cpu",       0x1000, 0x1000, 0xc3035300 )

	ROM_REGION(0x0120)	/* color proms */
	ROM_LOAD( "8b.cpu",       0x0000, 0x0020, 0x75b05da0 ) /* palette */
	ROM_LOAD( "9d.cpu",       0x0020, 0x0100, 0xaa6cf063 ) /* loookup table */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "s1.snd",       0x0000, 0x1000, 0xa1105714 )
ROM_END

ROM_START( junglers_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "5c",           0x0000, 0x1000, 0xedd71b28 )
	ROM_LOAD( "5a",           0x1000, 0x1000, 0x61ea4d46 )
	ROM_LOAD( "4d",           0x2000, 0x1000, 0x557c7925 )
	ROM_LOAD( "4c",           0x3000, 0x1000, 0x51aac9a5 )

	ROM_REGION_DISPOSE(0x2000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "5k",           0x0000, 0x0800, 0x924262bf )
	ROM_LOAD( "5m",           0x0800, 0x0800, 0x131a08ac )
	/* 1000-1fff empty for my convenience */

	ROM_REGION(0x0260)	/* color PROMs */
	ROM_LOAD( "18s030.8b",    0x0000, 0x0020, 0x55a7e6d1 ) /* palette */
	ROM_LOAD( "tbp24s10.9d",  0x0020, 0x0100, 0xd223f7b8 ) /* loookup table */
	ROM_LOAD( "18s030.7a",    0x0120, 0x0020, 0x8f574815 ) /* ?? */
	ROM_LOAD( "6331-1.10a",   0x0140, 0x0020, 0xb8861096 ) /* ?? */
	ROM_LOAD( "82s129.10g",   0x0160, 0x0100, 0x2ef89356 ) /* ?? */

	ROM_REGION(0x10000)	/* 64k for the audio CPU */
	ROM_LOAD( "1b",           0x0000, 0x1000, 0xf86999c3 )
ROM_END

ROM_START( commsega_rom )
	ROM_REGION(0x10000) /* 64k for code */
	ROM_LOAD( "csega1",       0x0000, 0x1000, 0x92de3405 )
	ROM_LOAD( "csega2",       0x1000, 0x1000, 0xf14e2f9a )
	ROM_LOAD( "csega3",       0x2000, 0x1000, 0x941dbf48 )
	ROM_LOAD( "csega4",       0x3000, 0x1000, 0xe0ac69b4 )
	ROM_LOAD( "csega5",       0x4000, 0x1000, 0xbc56ebd0 )

	ROM_REGION_DISPOSE(0x2000) /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "csega7",       0x0000, 0x1000, 0xe8e374f9 )
	ROM_LOAD( "csega6",       0x1000, 0x1000, 0xcf07fd5e )

	ROM_REGION(0x0120)	/* color proms */

	ROM_REGION(0x10000) /* 64k for the audio CPU */
	ROM_LOAD( "csega8",       0x0000, 0x1000, 0x588b4210 )
ROM_END



static int locomotn_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[0x9f00],"\x00\x00\x01",3) == 0 &&
	    memcmp(&RAM[0x99c6],"\x00\x00\x01",3) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x9f00],12*10);
			RAM[0x99c6] = RAM[0x9f00];
			RAM[0x99c7] = RAM[0x9f01];
			RAM[0x99c8] = RAM[0x9f02];
			osd_fclose(f);
		}

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



static void locomotn_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[0x9f00],12*10);
		osd_fclose(f);
	}
}

static int jungler_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[0x991c],"\x00\x00\x02",3) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x9940],16*10);
			RAM[0x991c] = RAM[0x9940];
			RAM[0x991d] = RAM[0x9941];
			RAM[0x991e] = RAM[0x9942];
			osd_fclose(f);
		}

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

static void jungler_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[0x9940],16*10);
		osd_fclose(f);
	}
}

static int commsega_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[0x9c60],"\x1d\x1c",2) == 0)
	{
		void *f;


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

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

static void commsega_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[0x9c6d],6);
		osd_fclose(f);
	}
}



struct GameDriver jungler_driver =
{
	__FILE__,
	0,
	"jungler",
	"Jungler (Konami)",
	"1981",
	"Konami",
	"Nicola Salmoria",
	0,
	&jungler_machine_driver,
	jungler_init,

	jungler_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	jungler_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_90,

	jungler_hiload, jungler_hisave
};

struct GameDriver junglers_driver =
{
	__FILE__,
	&jungler_driver,
	"junglers",
	"Jungler (Stern)",
	"1981",
	"Stern",
	"Nicola Salmoria",
	0,
	&jungler_machine_driver,
	jungler_init,

	junglers_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	jungler_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_90,

	jungler_hiload, jungler_hisave
};

struct GameDriver locomotn_driver =
{
	__FILE__,
	0,
	"locomotn",
	"Loco-Motion",
	"1982",
	"Konami (Centuri license)",
	"Nicola Salmoria\nKevin Klopp (color info)",
	0,
	&locomotn_machine_driver,
	0,

	locomotn_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	locomotn_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_90,

	locomotn_hiload, locomotn_hisave
};

struct GameDriver commsega_driver =
{
	__FILE__,
	0,
	"commsega",
	"Commando (Sega)",
	"1983",
	"Sega",
	"Nicola Salmoria\nBrad Oliver",
	GAME_WRONG_COLORS,
	&commsega_machine_driver,
	0,

	commsega_rom,
	0, 0,
	0,
	0, /* sound_prom */

	commsega_input_ports,

	wrong_color_prom, 0, 0,	/* wrong */
	ORIENTATION_ROTATE_90,

	commsega_hiload, commsega_hisave
};

⌨️ 快捷键说明

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