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

📄 ladybug.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	{ 23*16, 22*16, 21*16, 20*16, 19*16, 18*16, 17*16, 16*16,
			7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 },
	64*8	/* every sprite takes 64 consecutive bytes */
};
static struct GfxLayout spritelayout2 =
{
	8,8,	/* 8*8 sprites */
	512,	/* 512 sprites */
	2,	/* 2 bits per pixel */
	{ 1, 0 },	/* the two bitplanes are packed in two consecutive bits */
	{ 0, 2, 4, 6, 8, 10, 12, 14 },
	{ 7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 },
	16*8	/* every sprite takes 16 consecutive bytes */
};

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


static struct SN76496interface sn76496_interface =
{
	2,	/* 2 chips */
	4000000,	/* 4 MHz */
	{ 100, 100 }
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			4000000,	/* 4 Mhz */
			0,
			readmem,writemem,0,0,
			ladybug_interrupt,1
		}
	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* single CPU, no need for interleaving */
	0,

	/* video hardware */
	32*8, 32*8, { 1*8, 31*8-1, 4*8, 28*8-1 },
	gfxdecodeinfo,
	32,4*24,
	ladybug_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	generic_vh_start,
	generic_vh_stop,
	ladybug_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_SN76496,
			&sn76496_interface
		}
	}
};



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

  Game driver(s)

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

ROM_START( ladybug_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "lb1.cpu",      0x0000, 0x1000, 0xd09e0adb )
	ROM_LOAD( "lb2.cpu",      0x1000, 0x1000, 0x88bc4a0a )
	ROM_LOAD( "lb3.cpu",      0x2000, 0x1000, 0x53e9efce )
	ROM_LOAD( "lb4.cpu",      0x3000, 0x1000, 0xffc424d7 )
	ROM_LOAD( "lb5.cpu",      0x4000, 0x1000, 0xad6af809 )
	ROM_LOAD( "lb6.cpu",      0x5000, 0x1000, 0xcf1acca4 )

	ROM_REGION_DISPOSE(0x4000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "lb9.vid",      0x0000, 0x1000, 0x77b1da1e )
	ROM_LOAD( "lb10.vid",     0x1000, 0x1000, 0xaa82e00b )
	ROM_LOAD( "lb8.cpu",      0x2000, 0x1000, 0x8b99910b )
	ROM_LOAD( "lb7.cpu",      0x3000, 0x1000, 0x86a5b448 )

	ROM_REGION(0x0060)	/* color proms */
	ROM_LOAD( "10-2.vid",     0x0000, 0x0020, 0xdf091e52 ) /* palette */
	ROM_LOAD( "10-1.vid",     0x0020, 0x0020, 0x40640d8f ) /* sprite color lookup table */
	ROM_LOAD( "10-3.vid",     0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
ROM_END

ROM_START( ladybugb_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "lb1a.cpu",     0x0000, 0x1000, 0xec135e54 )
	ROM_LOAD( "lb2a.cpu",     0x1000, 0x1000, 0x3049c5c6 )
	ROM_LOAD( "lb3a.cpu",     0x2000, 0x1000, 0xb0fef837 )
	ROM_LOAD( "lb4.cpu",      0x3000, 0x1000, 0xffc424d7 )
	ROM_LOAD( "lb5.cpu",      0x4000, 0x1000, 0xad6af809 )
	ROM_LOAD( "lb6a.cpu",     0x5000, 0x1000, 0x88c8002a )

	ROM_REGION_DISPOSE(0x4000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "lb9.vid",      0x0000, 0x1000, 0x77b1da1e )
	ROM_LOAD( "lb10.vid",     0x1000, 0x1000, 0xaa82e00b )
	ROM_LOAD( "lb8.cpu",      0x2000, 0x1000, 0x8b99910b )
	ROM_LOAD( "lb7.cpu",      0x3000, 0x1000, 0x86a5b448 )

	ROM_REGION(0x0060)	/* color proms */
	ROM_LOAD( "10-2.vid",     0x0000, 0x0020, 0xdf091e52 ) /* palette */
	ROM_LOAD( "10-1.vid",     0x0020, 0x0020, 0x40640d8f ) /* sprite color lookup table */
	ROM_LOAD( "10-3.vid",     0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
ROM_END

ROM_START( snapjack_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "sj2a.bin",     0x0000, 0x1000, 0x6b30fcda )
	ROM_LOAD( "sj2b.bin",     0x1000, 0x1000, 0x1f1088d1 )
	ROM_LOAD( "sj2c.bin",     0x2000, 0x1000, 0xedd65f3a )
	ROM_LOAD( "sj2d.bin",     0x3000, 0x1000, 0xf4481192 )
	ROM_LOAD( "sj2e.bin",     0x4000, 0x1000, 0x1bff7d05 )
	ROM_LOAD( "sj2f.bin",     0x5000, 0x1000, 0x21793edf )

	ROM_REGION_DISPOSE(0x4000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "sj2i.bin",     0x0000, 0x1000, 0xff2011c7 )
	ROM_LOAD( "sj2j.bin",     0x1000, 0x1000, 0xf097babb )
	ROM_LOAD( "sj2h.bin",     0x2000, 0x1000, 0xb7f105b6 )
	ROM_LOAD( "sj2g.bin",     0x3000, 0x1000, 0x1cdb03a8 )

	ROM_REGION(0x0060)	/* color proms */
	ROM_LOAD( "sj8t.bin",     0x0000, 0x0020, 0xcbbd9dd1 ) /* palette */
	ROM_LOAD( "sj9k.bin",     0x0020, 0x0020, 0x5b16fbd2 ) /* sprite color lookup table */
	ROM_LOAD( "sj9h.bin",     0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
ROM_END

ROM_START( cavenger_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "1",            0x0000, 0x1000, 0x9e0cc781 )
	ROM_LOAD( "2",            0x1000, 0x1000, 0x5ce5b950 )
	ROM_LOAD( "3",            0x2000, 0x1000, 0xbc28218d )
	ROM_LOAD( "4",            0x3000, 0x1000, 0x2b32e9f5 )
	ROM_LOAD( "5",            0x4000, 0x1000, 0xd117153e )
	ROM_LOAD( "6",            0x5000, 0x1000, 0xc7d366cb )

	ROM_REGION_DISPOSE(0x4000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "9",            0x0000, 0x1000, 0x63357785 )
	ROM_LOAD( "0",            0x1000, 0x1000, 0x52ad1133 )
	ROM_LOAD( "8",            0x2000, 0x1000, 0xb022bf2d )
/*	ROM_LOAD( "7", 0x3000, 0x1000, 0x )	empty socket */

	ROM_REGION(0x0060)	/* color proms */
	ROM_LOAD( "t8.bpr",       0x0000, 0x0020, 0x42a24dd5 ) /* palette */
	ROM_LOAD( "k9.bpr",       0x0020, 0x0020, 0xd736b8de ) /* sprite color lookup table */
	ROM_LOAD( "h9.bpr",       0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
ROM_END



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


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

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



static void ladybug_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[0x6073],3*9);
		osd_fwrite(f,&RAM[0xd380],13*9);
		osd_fclose(f);
	}
}



static int cavenger_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[0x6025],"\x01\x00\x00",3) == 0) &&
	    (memcmp(&RAM[0x6063],"\x0A\x15\x28",3) == 0))
	{
		void *f;


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

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



static void cavenger_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[0x6025],0x41);
		osd_fclose(f);
	}

}

static int snapjack_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[0x6A94],"\x01\x00\x00",3) == 0) &&
	    (memcmp(&RAM[0x6AA0],"\x01\x00\x00\x1E",4) == 0) &&
	    (memcmp(&RAM[0x6AD2],"\x0A\x15\x24",3) == 0))
	{
		void *f;


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

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



static void snapjack_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[0x6A94],0x41);
		osd_fclose(f);
	}

}



struct GameDriver ladybug_driver =
{
	__FILE__,
	0,
	"ladybug",
	"Lady Bug",
	"1981",
	"Universal",
	"Nicola Salmoria",
	0,
	&machine_driver,
	0,

	ladybug_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	ladybug_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	ladybug_hiload, ladybug_hisave
};

struct GameDriver ladybugb_driver =
{
	__FILE__,
	&ladybug_driver,
	"ladybugb",
	"Lady Bug (bootleg)",
	"1982",
	"bootleg",
	"Nicola Salmoria",
	0,
	&machine_driver,
	0,

	ladybugb_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	ladybug_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	ladybug_hiload, ladybug_hisave
};

struct GameDriver snapjack_driver =
{
	__FILE__,
	0,
	"snapjack",
	"Snap Jack",
	"1981?",
	"Universal",
	"Nicola Salmoria",
	0,
	&machine_driver,
	0,

	snapjack_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	snapjack_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	snapjack_hiload, snapjack_hisave
};

struct GameDriver cavenger_driver =
{
	__FILE__,
	0,
	"cavenger",
	"Cosmic Avenger",
	"1981",
	"Universal",
	"Nicola Salmoria",
	0,
	&machine_driver,
	0,

	cavenger_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	cavenger_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	cavenger_hiload, cavenger_hisave
};

⌨️ 快捷键说明

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