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

📄 exprraid.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
		{
			CPU_M6809,
			4000000,        /* 4 Mhz ??? */
			4,
			sub_readmem,sub_writemem,0,0,
			interrupt, 8 /* wild guess, sounds good? */
		}
	},
	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,

	/* video hardware */
	32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },
	gfxdecodeinfo,
	256, 256,
	exprraid_vh_convert_color_prom,

	VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
	0,
	generic_vh_start,
	generic_vh_stop,
	exprraid_vh_screenrefresh,

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



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

  Game driver(s)

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

ROM_START( exprraid_rom )
    ROM_REGION(0x34000)     /* 64k for code */
	ROM_LOAD( "cz01",    0x4000, 0x4000, 0xdc8f9fba )
    ROM_LOAD( "cz00",    0x8000, 0x8000, 0xa81290bc )

    ROM_REGION_DISPOSE(0x54000)     /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "cz07",    0x00000, 0x4000, 0x686bac23 )	/* characters */
	ROM_LOAD( "cz09",    0x04000, 0x8000, 0x1ed250d1 )	/* sprites */
	ROM_LOAD( "cz08",    0x0c000, 0x8000, 0x2293fc61 )
	ROM_LOAD( "cz13",    0x14000, 0x8000, 0x7c3bfd00 )
	ROM_LOAD( "cz12",    0x1c000, 0x8000, 0xea2294c8 )
	ROM_LOAD( "cz11",    0x24000, 0x8000, 0xb7418335 )
	ROM_LOAD( "cz10",    0x2c000, 0x8000, 0x2f611978 )
	ROM_LOAD( "cz04",    0x34000, 0x8000, 0x643a1bd3 )	/* tiles */
/* Save 0x34000-0x43fff to expand the previous so we can decode the thing */
	ROM_LOAD( "cz05",    0x44000, 0x8000, 0xc44570bf )	/* tiles */
	ROM_LOAD( "cz06",    0x4c000, 0x8000, 0xb9bb448b )	/* tiles */

	ROM_REGION(0x0400) /* color PROMs */
    ROM_LOAD( "cz17.prm", 0x0000, 0x0100, 0xda31dfbc ) /* red */
    ROM_LOAD( "cz16.prm", 0x0100, 0x0100, 0x51f25b4c ) /* green */
    ROM_LOAD( "cz15.prm", 0x0200, 0x0100, 0xa6168d7f ) /* blue */
    ROM_LOAD( "cz14.prm", 0x0300, 0x0100, 0x52aad300 ) /* ??? */

    ROM_REGION(0x8000)     /* 32k for tile maps */
	ROM_LOAD( "cz03",    0x0000, 0x8000, 0x6ce11971 )

    ROM_REGION(0x10000)     /* 64k for the sub cpu */
    ROM_LOAD( "cz02",    0x8000, 0x8000, 0x552e6112 )
ROM_END

ROM_START( wexpress_rom )
    ROM_REGION(0x34000)     /* 64k for code */
	ROM_LOAD( "2",       0x4000, 0x4000, 0xea5e5a8f )
    ROM_LOAD( "1",       0x8000, 0x8000, 0xa7daae12 )

    ROM_REGION_DISPOSE(0x54000)     /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "cz07",    0x00000, 0x4000, 0x686bac23 )	/* characters */
	ROM_LOAD( "cz09",    0x04000, 0x8000, 0x1ed250d1 )	/* sprites */
	ROM_LOAD( "cz08",    0x0c000, 0x8000, 0x2293fc61 )
	ROM_LOAD( "cz13",    0x14000, 0x8000, 0x7c3bfd00 )
	ROM_LOAD( "cz12",    0x1c000, 0x8000, 0xea2294c8 )
	ROM_LOAD( "cz11",    0x24000, 0x8000, 0xb7418335 )
	ROM_LOAD( "cz10",    0x2c000, 0x8000, 0x2f611978 )
	ROM_LOAD( "4",       0x34000, 0x8000, 0xf2e93ff0 )	/* tiles */
/* Save 0x34000-0x43fff to expand the previous so we can decode the thing */
	ROM_LOAD( "cz05",    0x44000, 0x8000, 0xc44570bf )	/* tiles */
	ROM_LOAD( "6",       0x4c000, 0x8000, 0xc3a56de5 )	/* tiles */

	ROM_REGION(0x0400) /* color PROMs */
    ROM_LOAD( "cz17.prm", 0x0000, 0x0100, 0xda31dfbc ) /* red */
    ROM_LOAD( "cz16.prm", 0x0100, 0x0100, 0x51f25b4c ) /* green */
    ROM_LOAD( "cz15.prm", 0x0200, 0x0100, 0xa6168d7f ) /* blue */
    ROM_LOAD( "cz14.prm", 0x0300, 0x0100, 0x52aad300 ) /* ??? */

    ROM_REGION(0x8000)     /* 32k for tile maps */
	ROM_LOAD( "3",        0x0000, 0x8000, 0x242e3e64 )

    ROM_REGION(0x10000)     /* 64k for the sub cpu */
    ROM_LOAD( "cz02",    0x8000, 0x8000, 0x552e6112 )
ROM_END

ROM_START( wexpresb_rom )
    ROM_REGION(0x34000)     /* 64k for code */
	ROM_LOAD( "wexpress.3", 0x4000, 0x4000, 0xb4dd0fa4 )
    ROM_LOAD( "wexpress.1", 0x8000, 0x8000, 0xe8466596 )

    ROM_REGION_DISPOSE(0x54000)     /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "cz07",    0x00000, 0x4000, 0x686bac23 )	/* characters */
	ROM_LOAD( "cz09",    0x04000, 0x8000, 0x1ed250d1 )	/* sprites */
	ROM_LOAD( "cz08",    0x0c000, 0x8000, 0x2293fc61 )
	ROM_LOAD( "cz13",    0x14000, 0x8000, 0x7c3bfd00 )
	ROM_LOAD( "cz12",    0x1c000, 0x8000, 0xea2294c8 )
	ROM_LOAD( "cz11",    0x24000, 0x8000, 0xb7418335 )
	ROM_LOAD( "cz10",    0x2c000, 0x8000, 0x2f611978 )
	ROM_LOAD( "4",       0x34000, 0x8000, 0xf2e93ff0 )	/* tiles */
/* Save 0x34000-0x43fff to expand the previous so we can decode the thing */
	ROM_LOAD( "cz05",    0x44000, 0x8000, 0xc44570bf )	/* tiles */
	ROM_LOAD( "6",       0x4c000, 0x8000, 0xc3a56de5 )	/* tiles */

	ROM_REGION(0x0400) /* color PROMs */
    ROM_LOAD( "cz17.prm", 0x0000, 0x0100, 0xda31dfbc ) /* red */
    ROM_LOAD( "cz16.prm", 0x0100, 0x0100, 0x51f25b4c ) /* green */
    ROM_LOAD( "cz15.prm", 0x0200, 0x0100, 0xa6168d7f ) /* blue */
    ROM_LOAD( "cz14.prm", 0x0300, 0x0100, 0x52aad300 ) /* ??? */

    ROM_REGION(0x8000)     /* 32k for tile maps */
	ROM_LOAD( "3",        0x0000, 0x8000, 0x242e3e64 )

    ROM_REGION(0x10000)     /* 64k for the sub cpu */
    ROM_LOAD( "cz02",    0x8000, 0x8000, 0x552e6112 )
ROM_END

static void exprraid_gfx_expand( void ) {

	/* Expand the background rom so we can use regular decode routines */

	unsigned char	*gfx = Machine->memory_region[1];
	int				offs = 0x10000-0x1000;
	int				i;

	gfx += 0x34000;

	for ( i = 0x8000-0x1000; i >= 0; i-= 0x1000 ) {

		memcpy( &(gfx[offs]), &(gfx[i]), 0x1000 );

		offs -= 0x1000;

		memcpy( &(gfx[offs]), &(gfx[i]), 0x1000 );

		offs -= 0x1000;
	}
}


static void wexpress_decode_rom( void )
{
	unsigned char *RAM = Machine->memory_region[0];
	int i;


	/* HACK!: Implement custom opcode as regular with a mapped io read */
	for ( i = 0; i < 0x10000; i++ ) {
		/* make sure is what we want to patch */
		if ( RAM[i] == 0x4b && RAM[i+1] == 0x00 && RAM[i+2] == 0x29 && RAM[i+3] == 0x02 ) {
			/* replace custom opcode with: LDA	$FF */
			ROM[i] = 0xa5;
			i++;
			RAM[i] = 0xff;
		} else
			ROM[i] = RAM[i];
	}
}

static void exprraid_decode_rom( void )
{
	unsigned char *RAM = Machine->memory_region[0];
	


	/* decode vectors */
	RAM[0xfffa] = RAM[0xfff7];
	RAM[0xfffb] = RAM[0xfff6];

	RAM[0xfffc] = RAM[0xfff1];
	RAM[0xfffd] = RAM[0xfff0];

	RAM[0xfffe] = RAM[0xfff3];
	RAM[0xffff] = RAM[0xfff2];

	/* HACK!: Implement custom opcode as regular with a mapped io read */
	wexpress_decode_rom();
}



static int hiload(void)
{
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
	static int resetcount;


	/* during a reset, leave time to the game to clear the screen */
	if (++resetcount < 10) return 0;

	if(memcmp(&RAM[0x0240],"\x20\x31\x53",3) == 0 &&
			memcmp(&RAM[0x028D],"\x00\x77\x00",3) == 0)
	{
		void *f;

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

		resetcount = 0;

		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[0x0240],80);
		osd_fclose(f);
	}
}



struct GameDriver exprraid_driver =
{
	__FILE__,
	0,
	"exprraid",
	"Express Raider",
	"1986",
	"Data East USA",
	"Ernesto Corvi\nNicola Salmoria",
	0,
	&machine_driver,
	0,

	exprraid_rom,
	exprraid_gfx_expand, exprraid_decode_rom,
	0,
	0,      /* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver wexpress_driver =
{
	__FILE__,
	&exprraid_driver,
	"wexpress",
	"Western Express",
	"1986",
	"Data East Corporation",
	"Ernesto Corvi\nNicola Salmoria",
	0,
	&machine_driver,
	0,

	wexpress_rom,
	exprraid_gfx_expand, wexpress_decode_rom,
	0,
	0,      /* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

struct GameDriver wexpresb_driver =
{
	__FILE__,
	&exprraid_driver,
	"wexpresb",
	"Western Express (bootleg)",
	"1986",
	"bootleg",
	"Ernesto Corvi\nNicola Salmoria",
	0,
	&machine_driver,
	0,

	wexpresb_rom,
	exprraid_gfx_expand, 0,
	0,
	0,      /* sound_prom */

	input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};

⌨️ 快捷键说明

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