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

📄 brkthru.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:

static unsigned char wrong_color_prom[] =
{
	/* brkthru.13 - palette red and green component */
	0x00,0x0F,0xCF,0xFC,0x00,0xF0,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x67,0x0F,0x00,0x78,0xCD,0x89,0xEE,0x00,0xCC,0x4F,0x00,0x88,0x88,0x60,0xEF,
	0x00,0x4A,0x7F,0x00,0x78,0x9A,0x9B,0xDC,0x00,0x4A,0x7F,0x00,0x5B,0xEE,0x9D,0xDD,
	0x00,0x08,0x0F,0x00,0x88,0xCC,0x75,0xEE,0x00,0x67,0x0F,0x00,0x78,0xCD,0x89,0xEE,
	0x00,0x7A,0xBF,0x00,0x88,0xDE,0x75,0xFF,0x00,0x0C,0x0F,0x00,0xFF,0x89,0xDF,0xFF,
	0xAD,0xCE,0x8A,0xEF,0x00,0x95,0xC6,0xF0,0xAD,0xDF,0x79,0x8F,0x43,0x82,0xB2,0xDD,
	0xAD,0x8C,0x9F,0x36,0xF4,0x94,0x2A,0x00,0x77,0xAE,0x9C,0x00,0x88,0x9B,0x7B,0x00,
	0x00,0xFF,0xBB,0x88,0x48,0x16,0x91,0xCC,0x68,0x33,0xAF,0x9C,0x69,0x12,0xCC,0xBB,
	0x99,0x90,0x00,0x91,0xF0,0x0A,0x8C,0xEE,0xF0,0xCF,0xAF,0x8C,0x7E,0x90,0x00,0xEE,
	0xDC,0xB4,0x82,0xB0,0xCC,0x55,0x47,0xFD,0xDC,0xC9,0x94,0x86,0x65,0x19,0x77,0xFF,
	0x00,0x67,0xDE,0xBF,0xB0,0xEE,0x00,0xFF,0x00,0x0F,0x00,0x4F,0xAA,0xBB,0xEE,0xFF,
	0x00,0xD8,0x00,0x1F,0xF2,0xFF,0xFF,0xFF,0x00,0x0F,0xCF,0xFF,0xDF,0xCE,0xBA,0xFF,
	0x7A,0x67,0x56,0x68,0x00,0x57,0xB3,0xAA,0x7A,0x67,0x56,0x68,0x00,0x57,0xB3,0xAA,
	/* brkthru.14 - palette blue component */
	0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x09,0x00,0x00,0x07,0x0B,0x08,0x0F,0x00,0x0D,0x02,0x00,0x09,0x05,0x07,0x0E,
	0x00,0x02,0x02,0x00,0x04,0x05,0x07,0x0B,0x00,0x02,0x02,0x00,0x01,0x0F,0x04,0x0D,
	0x00,0x0B,0x05,0x00,0x07,0x0C,0x01,0x0E,0x00,0x09,0x00,0x00,0x07,0x0B,0x0B,0x0F,
	0x00,0x01,0x0A,0x00,0x08,0x0F,0x01,0x0F,0x00,0x00,0x00,0x00,0x06,0x08,0x04,0x0F,
	0x07,0x07,0x03,0x0C,0x00,0x00,0x00,0x00,0x07,0x0A,0x00,0x06,0x03,0x0F,0x0F,0x0D,
	0x07,0x06,0x01,0x00,0x05,0x03,0x02,0x00,0x07,0x07,0x06,0x08,0x07,0x00,0x06,0x00,
	0x00,0x0F,0x0B,0x08,0x05,0x0E,0x0F,0x0C,0x08,0x03,0x00,0x00,0x02,0x08,0x0C,0x0B,
	0x09,0x0A,0x00,0x07,0x00,0x00,0x04,0x0E,0x00,0x08,0x01,0x04,0x03,0x0E,0x00,0x0E,
	0x0C,0x0B,0x02,0x0E,0x0B,0x05,0x02,0x0F,0x0C,0x00,0x04,0x0F,0x0B,0x06,0x08,0x0F,
	0x00,0x07,0x0B,0x06,0x06,0x0E,0x0E,0x0F,0x00,0x00,0x0F,0x04,0x0A,0x0D,0x0E,0x0F,
	0x00,0x0D,0x0F,0x0A,0x09,0x0F,0x0F,0x0F,0x00,0x00,0x07,0x01,0x09,0x0F,0x0F,0x0F,
	0x01,0x02,0x00,0x04,0x00,0x01,0x01,0x0A,0x01,0x02,0x00,0x04,0x00,0x01,0x01,0x0A,
};



/* handler called by the 3812 emulator when the internal timers cause an IRQ */
static void irqhandler(void)
{
	cpu_cause_interrupt(1,M6809_INT_IRQ);
}

static struct YM2203interface ym2203_interface =
{
	1,
	1500000,	/* Unknown */
	{ YM2203_VOL(25,25) },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 }
};

static struct YM3526interface ym3526_interface =
{
	1,			/* 1 chip (no more supported) */
	3000000,	/* 3.000000 MHz ? (partially supported) */
	{ 255 },		/* (not supported) */
	irqhandler,
};



static struct MachineDriver brkthru_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6809,
			1250000,        /* 1.25 Mhz ? */
			0,
			readmem,writemem,0,0,
			brkthru_interrupt,2
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			1250000,        /* 1.25 Mhz ? */
			3,	/* memory region #3 */
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,0	/* IRQs are caused by the YM3526 */
		}
	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* 1 CPU slice per frame - interleaving is forced when a sound command is written */
	0,	/* init machine */

	/* video hardware */
	32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },	/* not sure */
	gfxdecodeinfo,
	256,8+8*8+16*8,
	brkthru_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	brkthru_vh_start,
	brkthru_vh_stop,
	brkthru_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_YM2203,
			&ym2203_interface
		},
		{
			SOUND_YM3526,
			&ym3526_interface
		}
	}
};

static struct MachineDriver darwin_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6809,
			1200000,        /* 1.25 Mhz ? */
			0,
			darwin_readmem,darwin_writemem,0,0,
			brkthru_interrupt,2
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			1200000,        /* 1.25 Mhz ? */
			3,	/* memory region #3 */
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,0	/* IRQs are caused by the YM3526 */
		}
	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* 1 CPU slice per frame - interleaving is forced when a sound command is written */
	0,	/* init machine */

	/* video hardware */
	32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },	/* not sure */
	gfxdecodeinfo,
	256,8+8*8+16*8,
	brkthru_vh_convert_color_prom,

	VIDEO_TYPE_RASTER ,
	0,
	brkthru_vh_start,
	brkthru_vh_stop,
	brkthru_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_YM2203,
			&ym2203_interface
		},
		{
			SOUND_YM3526,
			&ym3526_interface
		}
	}
};


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

  Game driver(s)

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

ROM_START( brkthru_rom )
	ROM_REGION(0x20000)     /* 64k for main CPU + 64k for banked ROMs */
	ROM_LOAD( "brkthru.1",    0x04000, 0x4000, 0xcfb4265f )
	ROM_LOAD( "brkthru.2",    0x08000, 0x8000, 0xfa8246d9 )
	ROM_LOAD( "brkthru.4",    0x10000, 0x8000, 0x8cabf252 )
	ROM_LOAD( "brkthru.3",    0x18000, 0x8000, 0x2f2c40c2 )

	ROM_REGION_DISPOSE(0x3a000)	/* temporary space for graphics */
	ROM_LOAD( "brkthru.12",   0x00000, 0x2000, 0x58c0b29b )	/* characters */
	/* background */
	/* we do a lot of scatter loading here, to place the data in a format */
	/* which can be decoded by MAME's standard functions */
	ROM_LOAD( "brkthru.7",    0x02000, 0x4000, 0x920cc56a )	/* bitplanes 1,2 for bank 1,2 */
	ROM_CONTINUE(             0x0a000, 0x4000 )		/* bitplanes 1,2 for bank 3,4 */
	ROM_LOAD( "brkthru.6",    0x12000, 0x4000, 0xfd3cee40 )	/* bitplanes 1,2 for bank 5,6 */
	ROM_CONTINUE(             0x1a000, 0x4000 )		/* bitplanes 1,2 for bank 7,8 */
	ROM_LOAD( "brkthru.8",    0x06000, 0x1000, 0xf67ee64e )	/* bitplane 3 for bank 1,2 */
	ROM_CONTINUE(             0x08000, 0x1000 )
	ROM_CONTINUE(             0x0e000, 0x1000 )		/* bitplane 3 for bank 3,4 */
	ROM_CONTINUE(             0x10000, 0x1000 )
	ROM_CONTINUE(             0x16000, 0x1000 )		/* bitplane 3 for bank 5,6 */
	ROM_CONTINUE(             0x18000, 0x1000 )
	ROM_CONTINUE(             0x1e000, 0x1000 )		/* bitplane 3 for bank 7,8 */
	ROM_CONTINUE(             0x20000, 0x1000 )
	/* sprites */
	ROM_LOAD( "brkthru.9",    0x22000, 0x8000, 0xf54e50a7 )
	ROM_LOAD( "brkthru.10",   0x2a000, 0x8000, 0xfd156945 )
	ROM_LOAD( "brkthru.11",   0x32000, 0x8000, 0xc152a99b )

	ROM_REGION(0x200)	/* color proms */
	ROM_LOAD( "brkthru.13",   0x0000, 0x100, 0xaae44269 ) /* red and green component */
	ROM_LOAD( "brkthru.14",   0x0100, 0x100, 0xf2d4822a ) /* blue component */

	ROM_REGION(0x10000)	/* 64K for sound CPU */
	ROM_LOAD( "brkthru.5",    0x8000, 0x8000, 0xc309435f )
ROM_END

ROM_START( darwin_rom )
	ROM_REGION(0x20000)     /* 64k for main CPU + 64k for banked ROMs */
	ROM_LOAD( "darw_04.rom",  0x04000, 0x4000, 0x0eabf21c )
	ROM_LOAD( "darw_05.rom",  0x08000, 0x8000, 0xe771f864 )
	ROM_LOAD( "darw_07.rom",  0x10000, 0x8000, 0x97ac052c )
	ROM_LOAD( "darw_06.rom",  0x18000, 0x8000, 0x2a9fb208 )

	ROM_REGION_DISPOSE(0x3a000)	/* temporary space for graphics */
	ROM_LOAD( "darw_09.rom",  0x00000, 0x2000, 0x067b4cf5 )   /* characters */
	/* background */
	/* we do a lot of scatter loading here, to place the data in a format */
	/* which can be decoded by MAME's standard functions */
	ROM_LOAD( "darw_03.rom",  0x02000, 0x4000, 0x57d0350d )   /* bitplanes 1,2 for bank 1,2 */
	ROM_CONTINUE(             0x0a000, 0x4000 )		/* bitplanes 1,2 for bank 3,4 */
	ROM_LOAD( "darw_02.rom",  0x12000, 0x4000, 0x559a71ab )   /* bitplanes 1,2 for bank 5,6 */
	ROM_CONTINUE(             0x1a000, 0x4000 )		/* bitplanes 1,2 for bank 7,8 */
	ROM_LOAD( "darw_01.rom",  0x06000, 0x1000, 0x15a16973 )   /* bitplane 3 for bank 1,2 */
	ROM_CONTINUE(             0x08000, 0x1000 )
	ROM_CONTINUE(             0x0e000, 0x1000 )		/* bitplane 3 for bank 3,4 */
	ROM_CONTINUE(             0x10000, 0x1000 )
	ROM_CONTINUE(             0x16000, 0x1000 )		/* bitplane 3 for bank 5,6 */
	ROM_CONTINUE(             0x18000, 0x1000 )
	ROM_CONTINUE(             0x1e000, 0x1000 )		/* bitplane 3 for bank 7,8 */
	ROM_CONTINUE(             0x20000, 0x1000 )
	/* sprites */
	ROM_LOAD( "darw_10.rom",  0x22000, 0x8000, 0x487a014c )
	ROM_LOAD( "darw_11.rom",  0x2a000, 0x8000, 0x548ce2d1 )
	ROM_LOAD( "darw_12.rom",  0x32000, 0x8000, 0xfaba5fef )

	ROM_REGION(0x200)	/* color proms - missing! */

	ROM_REGION(0x10000)	/* 64K for sound CPU */
	ROM_LOAD( "darw_08.rom",  0x8000, 0x8000, 0x6b580d58 )
ROM_END


static int 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[0x0531],"\x00\x01\x50\x00",4) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{

			osd_fread(f,&RAM[0x0531],4*5+3*5);

			memcpy(&RAM[0x0402], &RAM[0x0531], 4);
			osd_fclose(f);
		}

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



static void 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[0x0531],4*5+3*5);
		osd_fclose(f);
	}
}

static int darwin_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[0x1b6c],"\x00\x04\x48\x30",4) == 0 )&& \
	    (memcmp(&RAM[0x1b93],"\x8b\x8b\x8b\x8a\x8a\x8a\x89\x89\x89" ,9) == 0))
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{

			osd_fread(f,&RAM[0x1b6c],0x10);
			osd_fread(f,&RAM[0x1b93],0x09);
			osd_fclose(f);
		}

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



static void darwin_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[0x1b6c],0x10);
		osd_fwrite(f,&RAM[0x1b93],0x09);
		osd_fclose(f);
	}
}



struct GameDriver brkthru_driver =
{
	__FILE__,
	0,
	"brkthru",
	"Break Thru",
	"1986",
	"Data East USA",
	"Phil Stroffolino (MAME driver)\nCarlos Lozano (hardware info)\nNicola Salmoria (MAME driver)\nTim Lindquist (color info)\nMarco Cassili\nBryan McPhail (sound)",
	0,
	&brkthru_machine_driver,
	0,

	brkthru_rom,
	0, 0,
	0,
	0,

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};
struct GameDriver darwin_driver =
{
	__FILE__,
	0,
	"darwin",
	"Darwin 4078 (Japan)",
	"1986",
	"Data East Corporation",
	"Phil Stroffolino (MAME driver)\nCarlos Lozano (Breakthru hardware info)\nNicola Salmoria (MAME driver)\nTim Lindquist (color info)\nMarco Cassili\nBryan McPhail (sound)\nVille Laitinen (MAME driver)",
	GAME_WRONG_COLORS,
	&darwin_machine_driver,
	0,

	darwin_rom,
	0, 0,
	0,
	0,

	darwin_input_ports,

	wrong_color_prom, 0, 0,	/* wrong! */
	ORIENTATION_ROTATE_270,

	darwin_hiload, darwin_hisave
};

⌨️ 快捷键说明

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