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

📄 congo.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
{
	{ 1, 0x0000, &zaxxon_charlayout1,  0, 32 },	/* characters */
	{ 1, 0x1800, &zaxxon_charlayout2,  0, 32 },	/* background tiles */
	{ 1, 0x7800, &spritelayout, 0, 32 },		/* sprites */
	{ -1 } /* end of array */
};



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

static struct Samplesinterface samples_interface =
{
	5	/* 5 channels */
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			3072000,	/* 3.072 Mhz ?? */
			0,
			readmem,writemem,0,0,
			congo_interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			2000000,
			4,
			sh_readmem, sh_writemem, 0,0,
			interrupt, 4
		}
	},
	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 */
	congo_init_machine,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1,2*8, 30*8-1 },
	gfxdecodeinfo,
	256,32*8,
	zaxxon_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	zaxxon_vh_start,
	zaxxon_vh_stop,
	zaxxon_vh_screenrefresh,

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



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

  Game driver(s)

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

ROM_START( congo_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "congo1.bin",   0x0000, 0x2000, 0x09355b5b )
	ROM_LOAD( "congo2.bin",   0x2000, 0x2000, 0x1c5e30ae )
	ROM_LOAD( "congo3.bin",   0x4000, 0x2000, 0x5ee1132c )
	ROM_LOAD( "congo4.bin",   0x6000, 0x2000, 0x5332b9bf )

	ROM_REGION_DISPOSE(0x13800)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "congo5.bin",   0x00000, 0x1000, 0x7bf6ba2b )	/* characters */
	/* 1000-1800 empty space to convert the characters as 3bpp instead of 2 */
	ROM_LOAD( "congo8.bin",   0x01800, 0x2000, 0xdb99a619 )	/* background tiles */
	ROM_LOAD( "congo9.bin",   0x03800, 0x2000, 0x93e2309e )
	ROM_LOAD( "congo10.bin",  0x05800, 0x2000, 0xf27a9407 )
	ROM_LOAD( "congo12.bin",  0x07800, 0x2000, 0x15e3377a )	/* sprites */
	ROM_LOAD( "congo13.bin",  0x09800, 0x2000, 0x1d1321c8 )
	ROM_LOAD( "congo11.bin",  0x0b800, 0x2000, 0x73e2709f )
	ROM_LOAD( "congo14.bin",  0x0d800, 0x2000, 0xbf9169fe )
	ROM_LOAD( "congo16.bin",  0x0f800, 0x2000, 0xcb6d5775 )
	ROM_LOAD( "congo15.bin",  0x11800, 0x2000, 0x7b15a7a4 )
	ROM_REGION(0x8000)      /* background data */
	ROM_LOAD( "congo6.bin",   0x0000, 0x2000, 0xd637f02b )
	/* 2000-3fff empty space to match Zaxxon */
	ROM_LOAD( "congo7.bin",   0x4000, 0x2000, 0x80927943 )
	/* 6000-7fff empty space to match Zaxxon */

	ROM_REGION(0x100)    /* color prom */
	ROM_LOAD( "congo.u68",    0x0000, 0x100, 0xb788d8ae ) /* palette */

	ROM_REGION(0x10000) /*64K for the sound cpu*/
	ROM_LOAD( "congo17.bin",  0x0000, 0x2000, 0x5024e673 )
ROM_END

ROM_START( tiptop_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "tiptop1.bin",  0x0000, 0x2000, 0xe19dc77b )
	ROM_LOAD( "tiptop2.bin",  0x2000, 0x2000, 0x3fcd3b6e )
	ROM_LOAD( "tiptop3.bin",  0x4000, 0x2000, 0x1c94250b )
	ROM_LOAD( "tiptop4.bin",  0x6000, 0x2000, 0x577b501b )

	ROM_REGION_DISPOSE(0x13800)      /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "congo5.bin",   0x00000, 0x1000, 0x7bf6ba2b )	/* characters */
	/* 1000-1800 empty space to convert the characters as 3bpp instead of 2 */
	ROM_LOAD( "congo8.bin",   0x01800, 0x2000, 0xdb99a619 )	/* background tiles */
	ROM_LOAD( "congo9.bin",   0x03800, 0x2000, 0x93e2309e )
	ROM_LOAD( "congo10.bin",  0x05800, 0x2000, 0xf27a9407 )
	ROM_LOAD( "congo12.bin",  0x07800, 0x2000, 0x15e3377a )	/* sprites */
	ROM_LOAD( "congo13.bin",  0x09800, 0x2000, 0x1d1321c8 )
	ROM_LOAD( "congo11.bin",  0x0b800, 0x2000, 0x73e2709f )
	ROM_LOAD( "congo14.bin",  0x0d800, 0x2000, 0xbf9169fe )
	ROM_LOAD( "congo16.bin",  0x0f800, 0x2000, 0xcb6d5775 )
	ROM_LOAD( "congo15.bin",  0x11800, 0x2000, 0x7b15a7a4 )
	ROM_REGION(0x8000)      /* background data */
	ROM_LOAD( "congo6.bin",   0x0000, 0x2000, 0xd637f02b )
	/* 2000-3fff empty space to match Zaxxon */
	ROM_LOAD( "congo7.bin",   0x4000, 0x2000, 0x80927943 )
	/* 6000-7fff empty space to match Zaxxon */

	ROM_REGION(0x100)    /* color prom */
	ROM_LOAD( "congo.u68",    0x0000, 0x100, 0xb788d8ae ) /* palette */

	ROM_REGION(0x10000) /*64K for the sound cpu*/
	ROM_LOAD( "congo17.bin",  0x0000, 0x2000, 0x5024e673 )
ROM_END


/* Samples for Congo Bongo, these are needed for now    */
/* as I haven't gotten around to calculate a formula for the */
/* simple oscillators producing the drums VL*/
/* As for now, thanks to Tim L. for providing samples */

static const char *congo_samplenames[] =
{
	"*congo",
	"gorilla.sam",
	"bass.sam",
	"congaa.sam",
	"congab.sam",
	"rim.sam",
	0
};



static int hiload(void)
{
	unsigned char *RAM = Machine->memory_region[0];
	/* check if the hi score table has already been initialized */
	if (memcmp(&RAM[0x8030],"\x00\x89\x00",3) == 0 &&
	    memcmp(&RAM[0x8099],"\x00\x37\x00",3) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x8020],21*6);
			RAM[0x80bd] = RAM[0x8030];
			RAM[0x80be] = RAM[0x8031];
			RAM[0x80bf] = RAM[0x8032];
			osd_fclose(f);
		}

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



static void hisave(void)
{
    unsigned char *RAM = Machine->memory_region[0];
	/* make sure that the high score table is still valid (entering the */
	/* test mode corrupts it) */
	if (memcmp(&RAM[0x8030],"\x00\x00\x00",3) != 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
		{
			osd_fwrite(f,&RAM[0x8020],21*6);
			osd_fclose(f);
		}
	}
}



struct GameDriver congo_driver =
{
	__FILE__,
	0,
	"congo",
	"Congo Bongo",
	"1983",
	"Sega",
	"Ville Laitinen (MAME driver)\nNicola Salmoria (Zaxxon driver)\nTim Lindquist (color & sound info)",
	0,
	&machine_driver,
	0,

	congo_rom,
	0, 0,
	congo_samplenames,
	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(3), 0, 0,
	ORIENTATION_ROTATE_90,

	hiload, hisave
};

struct GameDriver tiptop_driver =
{
	__FILE__,
	&congo_driver,
	"tiptop",
	"Tip Top",
	"1983",
	"Sega",
	"Ville Laitinen (MAME driver)\nNicola Salmoria (Zaxxon driver)\nTim Lindquist (color & sound info)",
	0,
	&machine_driver,
	0,

	tiptop_rom,
	0, 0,
	congo_samplenames,
	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(3), 0, 0,
	ORIENTATION_ROTATE_90,

	hiload, hisave
};

⌨️ 快捷键说明

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