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

📄 lwings.c

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



ROM_START( trojan_rom )
	ROM_REGION(0x20000)     /* 64k for code + 3*16k for the banked ROMs images */
	ROM_LOAD( "tb04.bin",     0x00000, 0x8000, 0x92670f27 )
	ROM_LOAD( "tb06.bin",     0x10000, 0x8000, 0xa4951173 )
	ROM_LOAD( "tb05.bin",     0x18000, 0x8000, 0x9273b264 )

	ROM_REGION_DISPOSE(0xa0000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "tb03.bin",     0x00000, 0x4000, 0x581a2b4c )     /* characters */
	ROM_LOAD( "tb13.bin",     0x10000, 0x8000, 0x285a052b )     /* tiles */
	ROM_LOAD( "tb09.bin",     0x18000, 0x8000, 0xaeb693f7 )
	ROM_LOAD( "tb12.bin",     0x20000, 0x8000, 0xdfb0fe5c )
	ROM_LOAD( "tb08.bin",     0x28000, 0x8000, 0xd3a4c9d1 )
	ROM_LOAD( "tb11.bin",     0x30000, 0x8000, 0x00f0f4fd )
	ROM_LOAD( "tb07.bin",     0x38000, 0x8000, 0xdff2ee02 )
	ROM_LOAD( "tb14.bin",     0x40000, 0x8000, 0x14bfac18 )
	ROM_LOAD( "tb10.bin",     0x48000, 0x8000, 0x71ba8a6d )
	ROM_LOAD( "tb18.bin",     0x50000, 0x8000, 0x862c4713 )     /* sprites */
	ROM_LOAD( "tb16.bin",     0x58000, 0x8000, 0xd86f8cbd )
	ROM_LOAD( "tb17.bin",     0x60000, 0x8000, 0x12a73b3f )
	ROM_LOAD( "tb15.bin",     0x68000, 0x8000, 0xbb1a2769 )
	ROM_LOAD( "tb22.bin",     0x70000, 0x8000, 0x39daafd4 )
	ROM_LOAD( "tb20.bin",     0x78000, 0x8000, 0x94615d2a )
	ROM_LOAD( "tb21.bin",     0x80000, 0x8000, 0x66c642bd )
	ROM_LOAD( "tb19.bin",     0x88000, 0x8000, 0x81d5ab36 )
	ROM_LOAD( "tb25.bin",     0x90000, 0x8000, 0x6e38c6fa )     /* Bk Tiles */
	ROM_LOAD( "tb24.bin",     0x98000, 0x8000, 0x14fc6cf2 )

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
	ROM_LOAD( "tb02.bin",     0x0000, 0x8000, 0x21154797 )

	ROM_REGION(0x08000)     /* 64k for ADPCM CPU (CPU not emulated) */
	ROM_LOAD( "tb01.bin",     0x0000, 0x4000, 0x1c0f91b2 )

	ROM_REGION(0x08000)
	ROM_LOAD( "tb23.bin",     0x00000, 0x08000, 0xeda13c0e )  /* Tile Map */
ROM_END

ROM_START( trojanj_rom )
	ROM_REGION(0x20000)     /* 64k for code + 3*16k for the banked ROMs images */
	ROM_LOAD( "troj-04.rom",  0x00000, 0x8000, 0x0b5a7f49 )
	ROM_LOAD( "troj-06.rom",  0x10000, 0x8000, 0xdee6ed92 )
	ROM_LOAD( "tb05.bin",     0x18000, 0x8000, 0x9273b264 )

	ROM_REGION_DISPOSE(0xa0000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "tb03.bin",     0x00000, 0x4000, 0x581a2b4c )     /* characters */
	ROM_LOAD( "tb13.bin",     0x10000, 0x8000, 0x285a052b )     /* tiles */
	ROM_LOAD( "tb09.bin",     0x18000, 0x8000, 0xaeb693f7 )
	ROM_LOAD( "tb12.bin",     0x20000, 0x8000, 0xdfb0fe5c )
	ROM_LOAD( "tb08.bin",     0x28000, 0x8000, 0xd3a4c9d1 )
	ROM_LOAD( "tb11.bin",     0x30000, 0x8000, 0x00f0f4fd )
	ROM_LOAD( "tb07.bin",     0x38000, 0x8000, 0xdff2ee02 )
	ROM_LOAD( "tb14.bin",     0x40000, 0x8000, 0x14bfac18 )
	ROM_LOAD( "tb10.bin",     0x48000, 0x8000, 0x71ba8a6d )
	ROM_LOAD( "tb18.bin",     0x50000, 0x8000, 0x862c4713 )     /* sprites */
	ROM_LOAD( "tb16.bin",     0x58000, 0x8000, 0xd86f8cbd )
	ROM_LOAD( "tb17.bin",     0x60000, 0x8000, 0x12a73b3f )
	ROM_LOAD( "tb15.bin",     0x68000, 0x8000, 0xbb1a2769 )
	ROM_LOAD( "tb22.bin",     0x70000, 0x8000, 0x39daafd4 )
	ROM_LOAD( "tb20.bin",     0x78000, 0x8000, 0x94615d2a )
	ROM_LOAD( "tb21.bin",     0x80000, 0x8000, 0x66c642bd )
	ROM_LOAD( "tb19.bin",     0x88000, 0x8000, 0x81d5ab36 )
	ROM_LOAD( "tb25.bin",     0x90000, 0x8000, 0x6e38c6fa )     /* Bk Tiles */
	ROM_LOAD( "tb24.bin",     0x98000, 0x8000, 0x14fc6cf2 )

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
	ROM_LOAD( "tb02.bin",     0x0000, 0x8000, 0x21154797 )

	ROM_REGION(0x08000)     /* 64k for ADPCM CPU (CPU not emulated) */
	ROM_LOAD( "tb01.bin",     0x0000, 0x4000, 0x1c0f91b2 )

	ROM_REGION(0x08000)
	ROM_LOAD( "tb23.bin",     0x00000, 0x08000, 0xeda13c0e )  /* Tile Map */
ROM_END



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


	/* check if the hi score table has already been initialized */
	if (memcmp(&RAM[0xce97],"\x00\x23\x60",3) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0xce00],13*7);
			RAM[0xce97] = RAM[0xce00];
			RAM[0xce98] = RAM[0xce01];
			RAM[0xce99] = RAM[0xce02];
			osd_fclose(f);
		}

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

static void trojan_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[0xce00],13*7);
		osd_fclose(f);
	}
}



struct GameDriver trojan_driver =
{
	__FILE__,
	0,
	"trojan",
	"Trojan (US)",
	"1986",
	"Capcom (Romstar license)",
	"Paul Leaman\nPhil Stroffolino\nMarco Cassili (dip switches)",
	0,
	&trojan_machine_driver,
	0,

	trojan_rom,
	0, 0,
	0,
	(void *)trojan_samples, /* sound_prom */

	trojan_input_ports,

	NULL, 0, 0,
	ORIENTATION_DEFAULT,
	trojan_hiload, trojan_hisave
};

struct GameDriver trojanj_driver =
{
	__FILE__,
	&trojan_driver,
	"trojanj",
	"Trojan (Japan)",
	"1986",
	"Capcom",
	"Paul Leaman\nPhil Stroffolino\nMarco Cassili (dip switches)",
	0,
	&trojan_machine_driver,
	0,

	trojanj_rom,
	0, 0,
	0,
	(void *)trojan_samples, /* sound_prom */

	trojan_input_ports,

	NULL, 0, 0,
	ORIENTATION_DEFAULT,
	trojan_hiload, trojan_hisave
};

/***************************************************************************
 Avengers - Doesn't work due to copy protection

 Function at 0x2ec1 writes to an output port (0xf809 = scroll y),
 peforms a short delay then reads 0xf80d.

 There are also two interrupts (0x10 and NMI)

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

extern int avengers_interrupt(void);

int avengers_protection_r(int offset)
{
	int value;
	value=lwings_scrolly[1];

	return value;
}

/*
E2 00 E4 03 E6 0C E8 10 EA 19 EC 25 EE 38 F0 3B F2 3E F4 49 F4 s
*/
ADPCM_SAMPLES_START(avengers_samples)
	ADPCM_SAMPLE(0x00, 0x00e2, (0x03e4 -0x00e2)*2 )
	ADPCM_SAMPLE(0x01, 0x03e4, (0x0ce6 -0x03e4)*2 )
	ADPCM_SAMPLE(0x02, 0x0ce6, (0x10e8 -0x0ce6)*2 )
	ADPCM_SAMPLE(0x03, 0x10e8, (0x19ea -0x10e8)*2 )
	ADPCM_SAMPLE(0x04, 0x19ea, (0x25ec -0x19ea)*2 )
	ADPCM_SAMPLE(0x05, 0x25ec, (0x38ee -0x25ec)*2 )
	ADPCM_SAMPLE(0x06, 0x38ee, (0x3bf0 -0x38ee)*2 )
	ADPCM_SAMPLE(0x07, 0x3bf0, (0x3ef2 -0x3bf0)*2 )
	ADPCM_SAMPLE(0x08, 0x3ef2, (0x49f4 -0x3ef2)*2 )
ADPCM_SAMPLES_END

/*
machine driver is exactly the same as trojan apart from
a new custom interrupt handler
*/

static struct MachineDriver avengers_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			4000000,        /* 4 Mhz (?) */
			0,
			readmem,trojan_writemem,0,0,
			avengers_interrupt,2
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			3000000,        /* 3 Mhz (?) */
			2,      /* memory region #2 */
			sound_readmem,sound_writemem,0,0,
			interrupt,4
		}
	},
	60, 2500,       /* frames per second, vblank duration */
				/* hand tuned to get rid of sprite lag */
	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, 1*8, 31*8-1 },
	gfxdecodeinfo_trojan,
	1024, 1024,
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
	0,
	trojan_vh_start,
	trojan_vh_stop,
	trojan_vh_screenrefresh,

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

INPUT_PORTS_START( avengers_input_ports )
	PORT_START      /* IN0 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )

	PORT_START      /* IN1 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */

	PORT_START      /* IN2 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */

	PORT_START      /* DSW0 */
	PORT_DIPNAME( 0xff, 0x00, "DSW 0", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "On" )
	PORT_DIPSETTING(    0xff, "Off" )

	PORT_START      /* DSW1 */
	PORT_DIPNAME( 0xff, 0x00, "DSW 1", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "On" )
	PORT_DIPSETTING(    0xff, "Off" )
INPUT_PORTS_END


ROM_START( avengers_rom )
	ROM_REGION(0x20000)     /* 64k for code + 3*16k for the banked ROMs images */
	ROM_LOAD( "04.10n",       0x00000, 0x8000, 0xa94aadcc )
	ROM_LOAD( "06.13n",       0x10000, 0x8000, 0x39cd80bd )
	ROM_LOAD( "05.12n",       0x18000, 0x8000, 0x06b1cec9 )

	ROM_REGION_DISPOSE(0xa0000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "03.8k",        0x00000, 0x4000, 0x4a297a5c )  /* characters */
	/* tiles */
	ROM_LOAD( "13.6b",        0x10000, 0x8000, 0x9b5ff305 ) /* plane 1 */
	ROM_LOAD( "09.6a",        0x18000, 0x8000, 0x08323355 )
	ROM_LOAD( "12.4b",        0x20000, 0x8000, 0x6d5261ba ) /* plane 2 */
	ROM_LOAD( "08.4a",        0x28000, 0x8000, 0xa13d9f54 )
	ROM_LOAD( "11.3b",        0x30000, 0x8000, 0xa2911d8b ) /* plane 3 */
	ROM_LOAD( "07.3a",        0x38000, 0x8000, 0xcde78d32 )
	ROM_LOAD( "14.8b",        0x40000, 0x8000, 0x44ac2671 ) /* plane 4 */
	ROM_LOAD( "10.8a",        0x48000, 0x8000, 0xb1a717cb )

	/* sprites */
	ROM_LOAD( "18.7l",        0x50000, 0x8000, 0x3c876a17 ) /* planes 0,1 */
	ROM_LOAD( "16.3l",        0x58000, 0x8000, 0x4b1ff3ac )
	ROM_LOAD( "17.5l",        0x60000, 0x8000, 0x4eb543ef )
	ROM_LOAD( "15.2l",        0x68000, 0x8000, 0x8041de7f )

	ROM_LOAD( "22.7n",        0x70000, 0x8000, 0xbdaa8b22 ) /* planes 2,3 */
	ROM_LOAD( "20.3n",        0x78000, 0x8000, 0x566e3059 )
	ROM_LOAD( "21.5n",        0x80000, 0x8000, 0x301059aa )
	ROM_LOAD( "19.2n",        0x88000, 0x8000, 0xa00485ec )

	/* ROMs 24 and 25 contains tiles in same format as sprites, used for title screen */
	ROM_LOAD( "25.15n",       0x90000, 0x8000, 0x230d9e30 ) /* planes 0,1 */
	ROM_LOAD( "24.13n",       0x98000, 0x8000, 0xa6354024 ) /* planes 2,3 */

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
	ROM_LOAD( "02.15h",       0x0000, 0x8000, 0x107a2e17 ) /* ?? */

	ROM_REGION(0x10000)     /* ADPCM CPU (not emulated) */
	ROM_LOAD( "01.6d",        0x0000, 0x8000, 0xc1e5d258 ) /* adpcm player - "Talker" ROM */

	ROM_REGION(0x08000)
	ROM_LOAD( "23.9n",        0x0000, 0x08000, 0xc0a93ef6 )  /* Tile Map */
ROM_END

ROM_START( avenger2_rom )
	ROM_REGION(0x20000)     /* 64k for code + 3*16k for the banked ROMs images */
	ROM_LOAD( "avg4.bin",     0x00000, 0x8000, 0x0fea7ac5 )
	ROM_LOAD( "avg6.bin",     0x10000, 0x8000, 0x491a712c )
	ROM_LOAD( "avg5.bin",     0x18000, 0x8000, 0x9a214b42 )

	ROM_REGION_DISPOSE(0xa0000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "03.8k",        0x00000, 0x4000, 0x4a297a5c )  /* characters */
	/* tiles */
	ROM_LOAD( "13.6b",        0x10000, 0x8000, 0x9b5ff305 ) /* plane 1 */
	ROM_LOAD( "09.6a",        0x18000, 0x8000, 0x08323355 )
	ROM_LOAD( "12.4b",        0x20000, 0x8000, 0x6d5261ba ) /* plane 2 */
	ROM_LOAD( "08.4a",        0x28000, 0x8000, 0xa13d9f54 )
	ROM_LOAD( "11.3b",        0x30000, 0x8000, 0xa2911d8b ) /* plane 3 */
	ROM_LOAD( "07.3a",        0x38000, 0x8000, 0xcde78d32 )
	ROM_LOAD( "14.8b",        0x40000, 0x8000, 0x44ac2671 ) /* plane 4 */
	ROM_LOAD( "10.8a",        0x48000, 0x8000, 0xb1a717cb )

	/* sprites */
	ROM_LOAD( "18.7l",        0x50000, 0x8000, 0x3c876a17 ) /* planes 0,1 */
	ROM_LOAD( "16.3l",        0x58000, 0x8000, 0x4b1ff3ac )
	ROM_LOAD( "17.5l",        0x60000, 0x8000, 0x4eb543ef )
	ROM_LOAD( "15.2l",        0x68000, 0x8000, 0x8041de7f )

	ROM_LOAD( "22.7n",        0x70000, 0x8000, 0xbdaa8b22 ) /* planes 2,3 */
	ROM_LOAD( "20.3n",        0x78000, 0x8000, 0x566e3059 )
	ROM_LOAD( "21.5n",        0x80000, 0x8000, 0x301059aa )
	ROM_LOAD( "19.2n",        0x88000, 0x8000, 0xa00485ec )

	/* ROMs 24 and 25 contains tiles in same format as sprites, used for title screen */
	ROM_LOAD( "25.15n",       0x90000, 0x8000, 0x230d9e30 ) /* planes 0,1 */
	ROM_LOAD( "24.13n",       0x98000, 0x8000, 0xa6354024 ) /* planes 2,3 */

	ROM_REGION(0x10000)     /* 64k for the audio CPU */
ROM_LOAD( "02.15h",       0x0000, 0x8000, 0x107a2e17 ) /* MISSING from this set */

	ROM_REGION(0x10000)     /* ADPCM CPU (not emulated) */
	ROM_LOAD( "01.6d",        0x0000, 0x8000, 0xc1e5d258 ) /* adpcm player - "Talker" ROM */

	ROM_REGION(0x08000)
	ROM_LOAD( "23.9n",        0x0000, 0x08000, 0xc0a93ef6 )  /* Tile Map */
ROM_END



struct GameDriver avengers_driver =
{
	__FILE__,
	0,
	"avengers",
	"Avengers (set 1)",
	"1987",
	"Capcom",
	"Paul Leaman\nPhil Stroffolino",
	GAME_NOT_WORKING,
	&avengers_machine_driver,
	0,

	avengers_rom,
	0, 0,
	0,
	(void *)avengers_samples, /* sound_prom */

	avengers_input_ports,

	NULL, 0, 0,
	ORIENTATION_ROTATE_270,
	0,0 /* high score load/save */
};

struct GameDriver avenger2_driver =
{
	__FILE__,
	&avengers_driver,
	"avenger2",
	"Avengers (set 2)",
	"1987",
	"Capcom",
	"Paul Leaman\nPhil Stroffolino",
	GAME_NOT_WORKING,
	&avengers_machine_driver,
	0,

	avenger2_rom,
	0, 0,
	0,
	(void *)avengers_samples, /* sound_prom */

	avengers_input_ports,

	NULL, 0, 0,
	ORIENTATION_ROTATE_270,
	0,0 /* high score load/save */
};

⌨️ 快捷键说明

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