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

📄 slapfght.c

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

	ROM_REGION_DISPOSE(0x44000)
	ROM_LOAD( "sf_r11.bin",   0x00000, 0x2000, 0x2ac7b943 )  /* Chars */
	ROM_LOAD( "sf_r10.bin",   0x02000, 0x2000, 0x33cadc93 )
	ROM_LOAD( "sf_r06.bin",   0x04000, 0x8000, 0xb6358305 )  /* Tiles */
	ROM_LOAD( "sf_r09.bin",   0x0c000, 0x8000, 0xe92d9d60 )
	ROM_LOAD( "sf_r08.bin",   0x14000, 0x8000, 0x5faeeea3 )
	ROM_LOAD( "sf_r07.bin",   0x1c000, 0x8000, 0x974e2ea9 )
	ROM_LOAD( "sf_r03.bin",   0x24000, 0x8000, 0x8545d397 )  /* Sprites */
	ROM_LOAD( "sf_r01.bin",   0x2c000, 0x8000, 0xb1b7b925 )
	ROM_LOAD( "sf_r04.bin",   0x34000, 0x8000, 0x422d946b )
	ROM_LOAD( "sf_r02.bin",   0x3c000, 0x8000, 0x587113ae )

	ROM_REGION(0x0300)
	ROM_LOAD( "sf_col21.bin", 0x0000, 0x0100, 0xa0efaf99 )
	ROM_LOAD( "sf_col20.bin", 0x0100, 0x0100, 0xa56d57e5 )
	ROM_LOAD( "sf_col19.bin", 0x0200, 0x0100, 0x5cbf9fbf )

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
	ROM_LOAD( "sf_r05.bin",   0x0000, 0x2000, 0x87f4705a )
ROM_END


ROM_START( getstar_rom )

	ROM_REGION(0x18000)		/* Region 0 - main cpu code */
	ROM_LOAD( "gs_14.rom", 0x00000, 0x4000, 0x1a57a920 )
	ROM_LOAD( "gs_13.rom", 0x04000, 0x4000, 0x805f8e77 )
	ROM_LOAD( "gs_12.rom", 0x10000, 0x8000, 0x3567da17 )

	ROM_REGION_DISPOSE(0x44000)	/* Region 1 - temporary for gfx */
	ROM_LOAD( "gs_07.rom", 0x00000, 0x2000, 0xe3d409e7 )  /* Chars */
	ROM_LOAD( "gs_08.rom", 0x02000, 0x2000, 0x6e5ac9d4 )
	ROM_LOAD( "gs_06.rom", 0x04000, 0x8000, 0xa293cc2e )  /* Tiles */
	ROM_LOAD( "gs_09.rom", 0x0c000, 0x8000, 0x37662375 )
	ROM_LOAD( "gs_10.rom", 0x14000, 0x8000, 0xcf1a964c )
	ROM_LOAD( "gs_11.rom", 0x1c000, 0x8000, 0x05f9eb9a )
	ROM_LOAD( "gs_01.rom", 0x24000, 0x8000, 0x83161ed0 )  /* Sprites */
	ROM_LOAD( "gs_02.rom", 0x2c000, 0x8000, 0x6da86aea )
	ROM_LOAD( "gs_03.rom", 0x34000, 0x8000, 0xf24158cf )
	ROM_LOAD( "gs_04.rom", 0x3c000, 0x8000, 0x643fb282 )

/* colors missing but ought to load something */
	ROM_REGION(0x2000)		/* Region 2 - color proms */
	ROM_LOAD( "gs_05.rom", 0x0000, 0x2000, 0x18daa44c)

	ROM_REGION(0x10000)		/* Region 3 - sound cpu code */
	ROM_LOAD( "gs_05.rom", 0x0000, 0x2000, 0x18daa44c)

ROM_END


/* High scores are at location C060 - C0A5 ( 70 bytes )	*/
/* 10 * 3 bytes for score				*/
/* 10 * 3 bytes for initials				*/
/* 10 * 1 byte for level reached ( area ) 		*/
static int slapfigh_hiload(void)
{
unsigned char	*RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];

	/* check to see if high scores initialised */
	if ((memcmp(&RAM[0xc060],"\x50\x30\x00",3) == 0) &&
	    (memcmp(&RAM[0xc0a3],"\x06\x05\x04",3) == 0))
	 {
	  void	*f;
	  int	lead0;

	  if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
	   {
	    osd_fread(f,&RAM[0xc060],10*7);
	    RAM[0xc05d] = RAM[0xc060];
	    RAM[0xc05e] = RAM[0xc061];
	    RAM[0xc05f] = RAM[0xc062];
	    lead0 = 0;
	    if ((RAM[0xc062]>>4) == 0)
	      RAM[0xc118] = 0x2D;
	    else
	     {
	      RAM[0xc118] = RAM[0xc062]>>4;
	      lead0 = 1;		/* don't throw away 0 anymore ... */
	     }
	    if (((RAM[0xc062]&0x0f) == 0) && (lead0 == 0))
	      RAM[0xc119] = 0x2D;
	    else
	     {
	      RAM[0xc119] = RAM[0xc062]&0x0f;
	      lead0 = 1;		/* don't throw away 0 anymore ... */
	     }
	    if (((RAM[0xc061]>>4) == 0) && (lead0 == 0))
	      RAM[0xc11A] = 0x2D;
	    else
	     {
	      RAM[0xc11A] = RAM[0xc061]>>4;
	      lead0 = 1;		/* don't throw away 0 anymore ... */
	     }
	    if (((RAM[0xc061]&0x0f) == 0) && (lead0 == 0))
	      RAM[0xc11B] = 0x2D;
	    else
	     {
	      RAM[0xc11B] = RAM[0xc061]&0x0F;
	      lead0 = 1;		/* don't throw away 0 anymore ... */
	     }
	    if (((RAM[0xc060]>>4) == 0) && (lead0 == 0))
	      RAM[0xc11C] = 0x2D;
	    else
	     {
	      RAM[0xc11C] = RAM[0xc060]>>4;
	      lead0 = 1;		/* don't throw away 0 anymore ... */
	     }
	    if (((RAM[0xc060]&0x0F) == 0) && (lead0 == 0))
	      RAM[0xc11D] = 0x2D;
	    else
	     {
	      RAM[0xc11D] = RAM[0xc060]&0x0F;
	      lead0 = 1;		/* don't throw away 0 anymore ... */
	     }

	    osd_fclose(f);
	   }
	  return 1;	/* hi scores loaded */
	 }
	else
	  return 0;	/* high scores not loaded yet */
}

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

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

}




/* High scores are at location C0DB - C123 ( 70+3 bytes )               */
/*  1 * 3 bytes for the highest score (divided by ten and BCD)	*/
/* 10 * 3 bytes for score		  (divided by ten and BCD)	*/
/* 10 * 3 bytes for initials							*/
/* 10 * 1 byte for level reached		 				*/
static int tigerh_hiload(void)
{
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];

        if (memcmp(&RAM[0xc0db],"\x00\x20\x00\x00\x20\x00",6) == 0)
        {
                void  *f;

                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread(f, &RAM[0xc0db], 73);
                        RAM[0xc15f] = RAM[0xc0db] & 0x0f;
                        RAM[0xc15e] = RAM[0xc0db] >> 4;
                        RAM[0xc15d] = RAM[0xc0dc] & 0x0f;
                        RAM[0xc15c] = RAM[0xc0dc] >> 4;
                        RAM[0xc15b] = RAM[0xc0dd] & 0x0f;
                        RAM[0xc15a] = RAM[0xc0dd] >> 4;

                        /* The minimum hiscore is 20000 */
                        if (RAM[0xc15a] == 0)
                        {
                                RAM[0xc15a] = 0x2d;
                                if (RAM[0xc15b] == 0) RAM[0xc15b] = 0x2d;
                        }
                        osd_fclose(f);
                }

                return 1;       /* hi scores loaded */
        }
        else
                return 0;       /* high scores not loaded yet */
}



static void tigerh_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[0xc0db],73);
                osd_fclose(f);
        }

}



/* High scores are at location C0D2 - C11A ( 70+3 bytes )		*/
/*  1 * 3 bytes for the highest score (divided by ten and BCD)	*/
/* 10 * 3 bytes for score		  (divided by ten and BCD)	*/
/* 10 * 3 bytes for initials							*/
/* 10 * 1 byte for level reached		 				*/

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

/* phase 0: dirty memory just 1 byte ahead of hi-scores */

	if (phase==0)
	{
		RAM[0xc11b]=0xFF;
		phase++;		/* goto phase 1 */
		return 0;		/* can't load hi-scores yet */
	}

/* phase 1: wait for the ram check of c000-cfff to pass the hi-scores area */

	if (phase==1)
	{
		if (RAM[0xc11b]==0xFF)	/* if still dirty */
			return 0;		/* can't load hi-scores yet */
		else
		{
			RAM[0xc11a]=0xFF;	/* dirty last byte of hi-scores */
			phase++;		/* goto phase 2 (final) */
		}
	}

/* phase 2: check to see if high scores have been initialised */

	if (phase==2)
	{

		if ((memcmp(&RAM[0xc0d2],"\x00\x20\x00\x00\x20\x00",6) == 0) &&
		    (RAM[0xc11a] == 0))
		{
		  void	*f;

			if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
			{
				osd_fread(f, &RAM[0xc0d2], 10*7+3);
				osd_fclose(f);
			}

			return 1;	/* hi scores loaded */
		}
		else
			return 0;	/* high scores not loaded yet */
	}
	else return 0;
}



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

	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
	 {
	  osd_fwrite(f,&RAM[0xc0d2],10*7+3);
	  osd_fclose(f);
	 }

}




struct GameDriver tigerh_driver =
{
	__FILE__,
	0,
	"tigerh",
	"Tiger Heli (set 1)",
	"1985",
	"Taito",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	GAME_NOT_WORKING,
	&tigerh_machine_driver,
	0,

	tigerh_rom,
	0, 0,
	0,
	0,

	tigerh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	tigerh_hiload, tigerh_hisave
};

struct GameDriver tigerh2_driver =
{
	__FILE__,
	&tigerh_driver,
	"tigerh2",
	"Tiger Heli (set 2)",
	"1985",
	"Taito",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	GAME_NOT_WORKING,
	&tigerh_machine_driver,
	0,

	tigerh2_rom,
	0, 0,
	0,
	0,

	tigerh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	tigerh_hiload, tigerh_hisave
};

struct GameDriver tigerhb1_driver =
{
	__FILE__,
	&tigerh_driver,
	"tigerhb1",
	"Tiger Heli (bootleg 1)",
	"1985",
	"bootleg",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	0,
	&tigerh_machine_driver,
	0,

	tigerhb1_rom,
	0, 0,
	0,
	0,

	tigerh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	tigerh_hiload, tigerh_hisave
};

struct GameDriver tigerhb2_driver =
{
	__FILE__,
	&tigerh_driver,
	"tigerhb2",
	"Tiger Heli (bootleg 2)",
	"1985",
	"bootleg",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	0,
	&tigerh_machine_driver,
	0,

	tigerhb2_rom,
	0, 0,
	0,
	0,

	tigerh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	tigerh_hiload, tigerh_hisave
};

struct GameDriver slapfigh_driver =
{
	__FILE__,
	0,
	"slapfigh",
	"Slap Fight",
	"1986",
	"Taito",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	GAME_NOT_WORKING,
	&slapfigh_machine_driver,
	0,

	slapfigh_rom,
	0, 0,
	0,
	0,

	slapfigh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	slapfigh_hiload, slapfigh_hisave
};

struct GameDriver slapbtjp_driver =
{
	__FILE__,
	&slapfigh_driver,
	"slapbtjp",
	"Slap Fight (Japanese bootleg)",
	"1986",
	"bootleg",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	0,
	&slapfigh_machine_driver,
	0,

	slapbtjp_rom,
	0, 0,
	0,
	0,

	slapfigh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	slapfigh_hiload, slapfigh_hisave
};

struct GameDriver slapbtuk_driver =
{
	__FILE__,
	&slapfigh_driver,
	"slapbtuk",
	"Slap Fight (English bootleg)",
	"1986",
	"bootleg",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria",
	0,
	&slapbtuk_machine_driver,
	0,

	slapbtuk_rom,
	0, 0,
	0,
	0,

	slapfigh_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_ROTATE_270,

	slapfigh_hiload, slapfigh_hisave
};

struct GameDriver getstar_driver =
{
	__FILE__,
	0,
	"getstar",
	"Get Star (bootleg)",
	"1986",
	"bootleg",
	"Keith Wilkins\nCarlos Baides\nNicola Salmoria\nLuca Elia",
	GAME_WRONG_COLORS,
	&slapfigh_machine_driver,
	0,

	getstar_rom,
	0, 0,
	0,
	0,

	getstar_input_ports,

	PROM_MEMORY_REGION(2), 0, 0,
	ORIENTATION_DEFAULT,

	0,0
};

⌨️ 快捷键说明

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