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

📄 gladiatr.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 3 页
字号:
	{ 1, 0x00000, &gladiator_tileC, 0, 64 },
	{ 1, 0x00000, &gladiator_tile7, 0, 64 },

	{ -1 } /* end of array */
};

#undef DEFINE_LAYOUT



static struct YM2203interface ym2203_interface =
{
	1,		/* 1 chip */
	1500000,	/* 1.5 MHz? */
	{ YM2203_VOL(255,0xff) },
	{ 0 },
	{ gladiator_dsw3_r },         /* port B read */
	{ gladiator_int_controll_w }, /* port A write */
	{ 0 },
	{ gladiator_ym_irq }          /* NMI request for 2nd cpu */
};

static struct ADPCMinterface adpcm_interface =
{
	1,			/* 1 channel */
    8000,		       /* 8000Hz playback */
	4,		       /* memory region 4 */
	0,			/* init function */
	{ 255, 255, 255 }
};

static struct Samplesinterface	samples_interface =
{
        1       /* 1 channel */
};


static struct MachineDriver machine_driver =
{
	{
		{
			CPU_Z80,
			6000000, /* 6 MHz? */
			0,
			readmem,writemem,readport,writeport,
			interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			3000000, /* 3 MHz? */
			2,	/* memory region #2 */
			readmem_cpu2,writemem_cpu2,readport_cpu2,writeport_cpu2,
			ignore_interrupt,1

		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			1,	/* Using 1 hz to speed up emulation since 6809 code isn't being used*/
			3,
			sound_readmem,sound_writemem,0,0,
			ignore_interrupt,1
		}
	},
	60, DEFAULT_60HZ_VBLANK_DURATION, /* fps, vblank duration */
	10,	/* interleaving */
	gladiator_machine_init,

	/* video hardware */
	32*8, 32*8, { 0, 255, 0+16, 255-16 },

	gfxdecodeinfo,
	512+2, 512+2,
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
	0,
	gladiatr_vh_start,
	gladiatr_vh_stop,
	gladiatr_vh_screenrefresh,

	/* sound hardware */
	0, 0,	0, 0,
	{
		{
			SOUND_YM2203,
			&ym2203_interface
		},
                {
			SOUND_ADPCM,
			&adpcm_interface
                },
		{
			SOUND_SAMPLES,
			&samples_interface
		}
	}
};

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

  Game driver(s)

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

ROM_START( gladiatr_rom )
	ROM_REGION(0x1c000)
	ROM_LOAD( "qb0-5",        0x00000, 	0x4000, 0x25b19efb )
	ROM_LOAD( "qb0-4",        0x04000, 	0x2000, 0x347ec794 )
	ROM_LOAD( "qb0-1",        0x10000, 	0x4000, 0x040c9839 )
	ROM_LOAD( "qc0-3",        0x14000, 	0x8000, 0x8d182326 )

	ROM_REGION_DISPOSE(0x44000)	/* temporary space for graphics (disposed after conversion) */
	/* sprites */
	ROM_LOAD( "qc2-7",        	0x00000, 0x8000, 0xc992c4f7 ) /* plane 3 */
	ROM_LOAD( "qc1-10",       	0x08000, 0x8000, 0x364cdb58 ) /* planes 1,2 */
	ROM_LOAD( "qc2-11",       	0x10000, 0x8000, 0xc9fecfff ) /* planes 1,2 */

	ROM_LOAD( "qc1-6",        	0x30000, 0x4000, 0x651e6e44 ) /* plane 3 */
	ROM_LOAD( "qc0-8",        	0x38000, 0x4000, 0x1c7ffdad ) /* planes 1,2 */
	ROM_LOAD( "qc1-9",        	0x40000, 0x4000, 0x01043e03 ) /* planes 1,2 */

	/* tiles */
	ROM_LOAD( "qb0-12",       	0x18000, 0x8000, 0x0585d9ac ) /* plane 3 */
	ROM_LOAD( "qb0-13",       	0x20000, 0x8000, 0xa6bb797b ) /* planes 1,2 */
	ROM_LOAD( "qb0-14",       	0x28000, 0x8000, 0x85b71211 ) /* planes 1,2 */

	ROM_LOAD( "qc0-15",       	0x34000, 0x2000, 0xa7efa340 ) /* (monochrome) */

	ROM_REGION( 0x10000 ) /* Code for the 2nd CPU */
	ROM_LOAD( "qb0-17",       	0x0000, 0x4000, 0xe78be010 )

	ROM_REGION( 0x20000 )  /* QB0-18 contains 6809 Code & some ADPCM samples */
	ROM_LOAD( "qb0-18",       0x08000, 0x8000, 0xe9591260 )

	ROM_REGION( 0x24600 )	/* Load all ADPCM samples into seperate region */
	ROM_LOAD( "qb0-18",       0x00000, 0x8000, 0xe9591260 )
	ROM_LOAD( "qb0-19",       0x08000, 0x8000, 0x79caa7ed )
	ROM_LOAD( "qb0-20",       0x10000, 0x8000, 0x15916eda )
ROM_END

ROM_START( ogonsiro_rom )
	ROM_REGION(0x1c000)
	ROM_LOAD( "qb0-5",        0x00000, 	0x4000, 0x25b19efb )
	ROM_LOAD( "qb0-4",        0x04000, 	0x2000, 0x347ec794 )
	ROM_LOAD( "qb0-1",        0x10000, 	0x4000, 0x040c9839 )
	ROM_LOAD( "qb0_3",        0x14000, 	0x8000, 0xd6a342e7 )

	ROM_REGION_DISPOSE(0x44000)	/* temporary space for graphics (disposed after conversion) */
	/* sprites */
	ROM_LOAD( "qb0_7",        	0x00000, 0x8000, 0x4b677bd9 ) /* plane 3 */
	ROM_LOAD( "qb0_10",       	0x08000, 0x8000, 0x87ab6cc4 ) /* planes 1,2 */
	ROM_LOAD( "qb0_11",       	0x10000, 0x8000, 0x25eaa4ff ) /* planes 1,2 */

	ROM_LOAD( "qb0_6",        	0x30000, 0x4000, 0x1a2bc769 ) /* plane 3 */
	ROM_LOAD( "qc0-8",        	0x38000, 0x4000, 0x1c7ffdad ) /* planes 1,2 */
	ROM_LOAD( "qb0_9",        	0x40000, 0x4000, 0x38f5152d ) /* planes 1,2 */

	/* tiles */
	ROM_LOAD( "qb0-12",       	0x18000, 0x8000, 0x0585d9ac ) /* plane 3 */
	ROM_LOAD( "qb0-13",       	0x20000, 0x8000, 0xa6bb797b ) /* planes 1,2 */
	ROM_LOAD( "qb0-14",       	0x28000, 0x8000, 0x85b71211 ) /* planes 1,2 */

	ROM_LOAD( "qb0_15",       	0x34000, 0x2000, 0x5e1332b8 ) /* (monochrome) */

	ROM_REGION( 0x10000 ) /* Code for the 2nd CPU */
	ROM_LOAD( "qb0-17",       	0x0000, 0x4000, 0xe78be010 )

	ROM_REGION( 0x20000 )  /* QB0-18 contains 6809 Code & some ADPCM samples */
	ROM_LOAD( "qb0-18",       0x08000, 0x8000, 0xe9591260 )

	ROM_REGION( 0x24600 )	/* Load all ADPCM samples into seperate region */
	ROM_LOAD( "qb0-18",       0x00000, 0x8000, 0xe9591260 )
	ROM_LOAD( "qb0-19",       0x08000, 0x8000, 0x79caa7ed )
	ROM_LOAD( "qb0-20",       0x10000, 0x8000, 0x15916eda )
ROM_END

ROM_START( gcastle_rom )
	ROM_REGION(0x1c000)
	ROM_LOAD( "qb0-5",        0x00000, 	0x4000, 0x25b19efb )
	ROM_LOAD( "qb0-4",        0x04000, 	0x2000, 0x347ec794 )
	ROM_LOAD( "qb0-1",        0x10000, 	0x4000, 0x040c9839 )
	ROM_LOAD( "qb0_3",        0x14000, 	0x8000, 0xd6a342e7 )

	ROM_REGION_DISPOSE(0x44000)	/* temporary space for graphics (disposed after conversion) */
	/* sprites */
	ROM_LOAD( "gc2-7",        	0x00000, 0x8000, 0xbb2cb454 ) /* plane 3 */
	ROM_LOAD( "qb0_10",       	0x08000, 0x8000, 0x87ab6cc4 ) /* planes 1,2 */
	ROM_LOAD( "gc2-11",       	0x10000, 0x8000, 0x5c512365 ) /* planes 1,2 */

	ROM_LOAD( "gc1-6",        	0x30000, 0x4000, 0x94f49be2 ) /* plane 3 */
	ROM_LOAD( "qc0-8",        	0x38000, 0x4000, 0x1c7ffdad ) /* planes 1,2 */
	ROM_LOAD( "gc1-9",        	0x40000, 0x4000, 0x69b977fd ) /* planes 1,2 */

	/* tiles */
	ROM_LOAD( "qb0-12",       	0x18000, 0x8000, 0x0585d9ac ) /* plane 3 */
	ROM_LOAD( "qb0-13",       	0x20000, 0x8000, 0xa6bb797b ) /* planes 1,2 */
	ROM_LOAD( "qb0-14",       	0x28000, 0x8000, 0x85b71211 ) /* planes 1,2 */

	ROM_LOAD( "qb0_15",       	0x34000, 0x2000, 0x5e1332b8 ) /* (monochrome) */

	ROM_REGION( 0x10000 ) /* Code for the 2nd CPU */
	ROM_LOAD( "qb0-17",       	0x0000, 0x4000, 0xe78be010 )

	ROM_REGION( 0x20000 )  /* QB0-18 contains 6809 Code & some ADPCM samples */
	ROM_LOAD( "qb0-18",       0x08000, 0x8000, 0xe9591260 )

	ROM_REGION( 0x24600 )	/* Load all ADPCM samples into seperate region */
	ROM_LOAD( "qb0-18",       0x00000, 0x8000, 0xe9591260 )
	ROM_LOAD( "qb0-19",       0x08000, 0x8000, 0x79caa7ed )
	ROM_LOAD( "qb0-20",       0x10000, 0x8000, 0x15916eda )
ROM_END

/*Manually combine samples: lgzaid - p1 with lgzaid p2!*/
static void gladiatr_decode(void)
{
	unsigned char *RAM = Machine->memory_region[4];

	memcpy (&RAM[0x20000], &RAM[0x11d00], 0x2300);	/* copy Part 1 */
	memcpy (&RAM[0x22300], &RAM[0x8000], 0x2300);	/* copy Part 2 */
}

/*************************/
/* Gladiator Samples	 */
/*************************/

ADPCM_SAMPLES_START( glad_samples )
	/* samples on ROM 1 */
	/* dtirene, paw, death, atirene, gong, atirene2  */
	/* samples on ROM 2 */
	/* lgzaid-p2, lgirene, dtsolon, irene, solon, zaid, fight  */
	/* samples on ROM 3 */
	/* dtzaid, atzaid, lgzaid-p1, lgsolon, atsolon, agadon  */
	/*NOTES: lgzaid - part 1: 1d00- 4000 - Length = 0x2300 */
	/*NOTES: lgzaid - part 2: 8000- A300 - Lenght = 0x2300 */

	ADPCM_SAMPLE( 0x000, 0x10000+0x0000, (0x1000-0x0000)*2 )	
	ADPCM_SAMPLE( 0x001, 0x10000+0x1000, (0x1d00-0x1000)*2 )	
	ADPCM_SAMPLE( 0x002, 0x20000+0x0000, (0x4600-0x0000)*2 )	
	ADPCM_SAMPLE( 0x003, 0x8000+0x2200, (0x3e00-0x2300)*2 )		
	ADPCM_SAMPLE( 0x004, 0x0000, (0x1300-0x0000)*2 )		
	ADPCM_SAMPLE( 0x005, 0x1300, (0x1f00-0x1300)*2 )		
	ADPCM_SAMPLE( 0x006, 0x1f00, (0x2C00-0x1f00)*2 )		
	ADPCM_SAMPLE( 0x007, 0x2C00, (0x3000-0x2C00)*2 )		
	ADPCM_SAMPLE( 0x008, 0x7000, (0x7c00-0x7000)*2 )		
	ADPCM_SAMPLE( 0x009, 0x10000+0x5e00, (0x6e00-0x5e00)*2 )	
	ADPCM_SAMPLE( 0x00a, 0x8000+0x3d00, (0x5400-0x3e00)*2 )		
	ADPCM_SAMPLE( 0x00b, 0x10000+0x4000, (0x5e00-0x4000)*2 )	
	ADPCM_SAMPLE( 0x00c, 0x3FA0, (0x7000-0x3FA0)*2 )		
	ADPCM_SAMPLE( 0x00d, 0x8000+0x5500, (0x6000-0x5500)*2 )		
	ADPCM_SAMPLE( 0x00e, 0x8000+0x6000, (0x6a00-0x6000)*2 )		
	ADPCM_SAMPLE( 0x00f, 0x8000+0x6a00, (0x7100-0x6a00)*2 )		
	ADPCM_SAMPLE( 0x010, 0x10000+0x7000,(0x7B00-0x7000)*2 )		
	ADPCM_SAMPLE( 0x011, 0x8000+0x7100, (0x7A00-0x7100)*2 )		

ADPCM_SAMPLES_END

/*These samples are played back at 5500Hz since the ADPCM interface can't support
  multiple sample rates at this time*/
static const char *gladiatr_samplenames[]=
{
	"*gladiatr",
        "dtirene.sam",  /*data used to request sample = 0xe7*/
        "atirene.sam",  /*data used to request sample = 0xea*/
        "atirene2.sam", /*data used to request sample = 0xeb*/
	0
};

static int gladiatr_nvram_load(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,0)) != 0)
	{
		osd_fread(f,&RAM[0xf000],0x400);
		osd_fclose(f);
	}
	return 1;
}

static void gladiatr_nvram_save(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[0xf000],0x400);
		osd_fclose(f);
	}
}



struct GameDriver gladiatr_driver =
{
	__FILE__,
	0,
	"gladiatr",
	"Gladiator",
	"1986",
	"Taito America",
	"Victor Trucco\nSteve Ellenoff\nPhil Stroffolino\nNicola Salmoria\nTatsuyuki Satoh\n",
	0,
	&machine_driver,
	0,

	gladiatr_rom,
	gladiatr_decode,
	0,
	gladiatr_samplenames,
	(void *)glad_samples,
	input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	gladiatr_nvram_load, gladiatr_nvram_save
};

struct GameDriver ogonsiro_driver =
{
	__FILE__,
	&gladiatr_driver,
	"ogonsiro",
	"Ohgon no Siro",
	"1986",
	"Taito",
	"Victor Trucco\nSteve Ellenoff\nPhil Stroffolino\nNicola Salmoria\nTatsuyuki Satoh\n",
	0,
	&machine_driver,
	0,

	ogonsiro_rom,
	gladiatr_decode,
	0,
	gladiatr_samplenames,
	(void *)glad_samples,
	input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	gladiatr_nvram_load, gladiatr_nvram_save
};

struct GameDriver gcastle_driver =
{
	__FILE__,
	&gladiatr_driver,
	"gcastle",
	"Golden Castle",
	"1986",
	"Taito",
	"Victor Trucco\nSteve Ellenoff\nPhil Stroffolino\nNicola Salmoria\nTatsuyuki Satoh\n",
	0,
	&machine_driver,
	0,

	gcastle_rom,
	gladiatr_decode,
	0,
	gladiatr_samplenames,
	(void *)glad_samples,
	input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	gladiatr_nvram_load, gladiatr_nvram_save
};

⌨️ 快捷键说明

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