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

📄 terracre.c

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




static struct YM3526interface ym3526_interface =
{
	1,			/* 1 chip (no more supported) */
	4000000,	/* 4 MHz ? (hand tuned) */
	{ 255 }		/* (not supported) */
};

static struct YM2203interface ym2203_interface =
{
	1,			/* 1 chip */
	3000000,	/* 3 MHz ???? */
	{ YM2203_VOL(40,20), YM2203_VOL(40,20) },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 }
};

static struct DACinterface dac_interface =
{
	2,	/* 2 channels */
	{ 80, 80 }
};

int terracre_interrupt(void)
{
	return (1);
}


static struct MachineDriver ym3526_machine_driver =
{
	{
		{
			CPU_M68000,
			8000000, /* 8 Mhz?? */
			0,
			readmem,writemem,0,0,
			terracre_interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			4000000,	/* 4 MHz???? */
			3,
			sound_readmem,sound_writemem,sound_readport,sound_writeport_3526,
			interrupt,128	/* ??? */
		},
	},
	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 */
	32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
	gfxdecodeinfo,
	256, 1*16+16*16+16*64,
	terrac_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	terrac_vh_start,
	terrac_vh_stop,
	terracre_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
		   SOUND_YM3526,
		   &ym3526_interface
		},
		{
			SOUND_DAC,
			&dac_interface
		}
	}
};

static struct MachineDriver ym2203_machine_driver =
{
	{
		{
			CPU_M68000,
			8000000, /* 8 Mhz?? */
			0,
			readmem,writemem,0,0,
			terracre_interrupt,1
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			4000000,	/* 4 MHz???? */
			3,
			sound_readmem,sound_writemem,sound_readport,sound_writeport_2203,
			interrupt,128	/* ??? */
		},
	},
	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 */
	32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
	gfxdecodeinfo,
	256, 1*16+16*16+16*64,
	terrac_vh_convert_color_prom,

	VIDEO_TYPE_RASTER,
	0,
	terrac_vh_start,
	terrac_vh_stop,
	terracre_vh_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
		   SOUND_YM2203,
		   &ym2203_interface
		},
		{
			SOUND_DAC,
			&dac_interface
		}
	}
};



ROM_START( terracre_rom )
	ROM_REGION(0x20000)	/* 128K for 68000 code */
	ROM_LOAD_ODD( "1a_4b.rom",    0x00000, 0x04000, 0x76f17479 )
	ROM_LOAD_EVEN( "1a_4d.rom",    0x00000, 0x04000, 0x8119f06e )
	ROM_LOAD_ODD( "1a_6b.rom",    0x08000, 0x04000, 0xba4b5822 )
	ROM_LOAD_EVEN( "1a_6d.rom",    0x08000, 0x04000, 0xca4852f6 )
	ROM_LOAD_ODD( "1a_7b.rom",    0x10000, 0x04000, 0xd0771bba )
	ROM_LOAD_EVEN( "1a_7d.rom",    0x10000, 0x04000, 0x029d59d9 )
	ROM_LOAD_ODD( "1a_9b.rom",    0x18000, 0x04000, 0x69227b56 )
	ROM_LOAD_EVEN( "1a_9d.rom",    0x18000, 0x04000, 0x5a672942 )

	ROM_REGION_DISPOSE(0x28000)
	ROM_LOAD( "2a_16b.rom",   0x000000, 0x02000, 0x591a3804 ) /* tiles */
	ROM_LOAD( "1a_15f.rom",   0x002000, 0x08000, 0x984a597f ) /* Background */
	ROM_LOAD( "1a_17f.rom",   0x00a000, 0x08000, 0x30e297ff )
	ROM_LOAD( "2a_6e.rom",    0x012000, 0x04000, 0xbcf7740b ) /* Sprites */
	ROM_LOAD( "2a_7e.rom",    0x016000, 0x04000, 0xa70b565c )
	ROM_LOAD( "2a_6g.rom",    0x01a000, 0x04000, 0x4a9ec3e6 )
	ROM_LOAD( "2a_7g.rom",    0x01e000, 0x04000, 0x450749fc )

	ROM_REGION(0x0500)	/* color PROMs */
	ROM_LOAD( "tc1a_10f.bin", 0x00000, 0x0100, 0xce07c544 )	/* red component */
	ROM_LOAD( "tc1a_11f.bin", 0x00100, 0x0100, 0x566d323a )	/* green component */
	ROM_LOAD( "tc1a_12f.bin", 0x00200, 0x0100, 0x7ea63946 )	/* blue component */
	ROM_LOAD( "tc2a_2g.bin",  0x00300, 0x0100, 0x08609bad )	/* sprite lookup table */
	ROM_LOAD( "tc2a_4e.bin",  0x00400, 0x0100, 0x2c43991f )	/* sprite palette bank */

	ROM_REGION(0x10000)	/* 64k for sound cpu */
	ROM_LOAD( "2a_15b.rom",   0x000000, 0x04000, 0x604c3b11 )
	ROM_LOAD( "2a_17b.rom",   0x004000, 0x04000, 0xaffc898d )
	ROM_LOAD( "2a_18b.rom",   0x008000, 0x04000, 0x302dc0ab )
ROM_END

/**********************************************************/
/* Notes: All the roms are the same except the SOUND ROMs */
/**********************************************************/

ROM_START( terracra_rom )
	ROM_REGION(0x20000)	/* 128K for 68000 code */
	ROM_LOAD_ODD( "1a_4b.rom",    0x00000, 0x04000, 0x76f17479 )
	ROM_LOAD_EVEN( "1a_4d.rom",    0x00000, 0x04000, 0x8119f06e )
	ROM_LOAD_ODD( "1a_6b.rom",    0x08000, 0x04000, 0xba4b5822 )
	ROM_LOAD_EVEN( "1a_6d.rom",    0x08000, 0x04000, 0xca4852f6 )
	ROM_LOAD_ODD( "1a_7b.rom",    0x10000, 0x04000, 0xd0771bba )
	ROM_LOAD_EVEN( "1a_7d.rom",    0x10000, 0x04000, 0x029d59d9 )
	ROM_LOAD_ODD( "1a_9b.rom",    0x18000, 0x04000, 0x69227b56 )
	ROM_LOAD_EVEN( "1a_9d.rom",    0x18000, 0x04000, 0x5a672942 )

	ROM_REGION_DISPOSE(0x28000)
	ROM_LOAD( "2a_16b.rom",   0x000000, 0x02000, 0x591a3804 ) /* tiles */
	ROM_LOAD( "1a_15f.rom",   0x002000, 0x08000, 0x984a597f ) /* Background */
	ROM_LOAD( "1a_17f.rom",   0x00a000, 0x08000, 0x30e297ff )
	ROM_LOAD( "2a_6e.rom",    0x012000, 0x04000, 0xbcf7740b ) /* Sprites */
	ROM_LOAD( "2a_7e.rom",    0x016000, 0x04000, 0xa70b565c )
	ROM_LOAD( "2a_6g.rom",    0x01a000, 0x04000, 0x4a9ec3e6 )
	ROM_LOAD( "2a_7g.rom",    0x01e000, 0x04000, 0x450749fc )

	ROM_REGION(0x0500)	/* color PROMs */
	ROM_LOAD( "tc1a_10f.bin", 0x00000, 0x0100, 0xce07c544 )	/* red component */
	ROM_LOAD( "tc1a_11f.bin", 0x00100, 0x0100, 0x566d323a )	/* green component */
	ROM_LOAD( "tc1a_12f.bin", 0x00200, 0x0100, 0x7ea63946 )	/* blue component */
	ROM_LOAD( "tc2a_2g.bin",  0x00300, 0x0100, 0x08609bad )	/* sprite lookup table */
	ROM_LOAD( "tc2a_4e.bin",  0x00400, 0x0100, 0x2c43991f )	/* sprite palette bank */

	ROM_REGION(0x10000)	/* 64k to sound cpu */
	ROM_LOAD( "tc2a_15b.bin", 0x000000, 0x04000, 0x790ddfa9 )
	ROM_LOAD( "tc2a_17b.bin", 0x004000, 0x04000, 0xd4531113 )
ROM_END



static int terracre_hiload(void)
{
        void *f;

        /* check if the hi score table has already been initialized */

		if (READ_WORD(&terrac_ram[0x004a]) == 0x330e && READ_WORD(&terrac_ram[0x004c]) == 0x2635 &&
			READ_WORD(&terrac_ram[0x0082]) == 0x320e && READ_WORD(&terrac_ram[0x0084]) == 0x3921)
        {

                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread_msbfirst(f,&terrac_ram[0x46],14*5);
                        memcpy(&terrac_ram[0x8c], &terrac_ram[0x46], 4);
                        osd_fclose(f);
                }
                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}


static void terracre_hisave(void)
{
        void *f;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite_msbfirst(f,&terrac_ram[0x46],14*5);
                osd_fclose(f);
        }
}



struct GameDriver terracre_driver =
{
	__FILE__,
	0,
	"terracre",
	"Terra Cresta (YM3526)",
	"1985",
	"Nichibutsu",
	"Carlos A. Lozano\nMirko Buffoni\nNicola Salmoria",
	0,
	&ym3526_machine_driver,
	0,

	terracre_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	terracre_hiload, terracre_hisave
};

/**********************************************************/
/* Notes: All the roms are the same except the SOUND ROMs */
/**********************************************************/

struct GameDriver terracra_driver =
{
	__FILE__,
	&terracre_driver,
	"terracra",
	"Terra Cresta (YM2203)",
	"1985",
	"Nichibutsu",
	"Carlos A. Lozano\nMirko Buffoni\nNicola Salmoria",
	0,
	&ym2203_machine_driver,
	0,

	terracra_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	terracre_hiload, terracre_hisave
};

⌨️ 快捷键说明

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