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

📄 xain.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	32*8	
};

static struct GfxLayout tileslayout =
{
	16,16,	/* 8*8 chars */
	512,	/* 512 characters */
	4,	/* 4 bits per pixel */
        { 0x8000*8+0, 0x8000*8+4, 0, 4 },	/* plane offset */
	{ 3, 2, 1, 0, 16*8+3, 16*8+2, 16*8+1, 16*8+0,
          32*8+3,32*8+2 ,32*8+1 ,32*8+0 ,48*8+3 ,48*8+2 ,48*8+1 ,48*8+0 },
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
          8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
	64*8	/* every char takes 64 consecutive bytes */
};

static struct GfxDecodeInfo gfxdecodeinfo[] =
{
	/* 8x8 text */
	{ 1, 0x00000, &charlayout,    0, 8 },

	/* 16x16 Background */
	{ 1, 0x08000, &tileslayout, 256, 8 },
	{ 1, 0x18000, &tileslayout, 256, 8 },
	{ 1, 0x28000, &tileslayout, 256, 8 },
	{ 1, 0x38000, &tileslayout, 256, 8 },

	/* 16x16 Background */
	{ 1, 0x48000, &tileslayout, 384, 8 },
	{ 1, 0x58000, &tileslayout, 384, 8 },
	{ 1, 0x68000, &tileslayout, 384, 8 },
	{ 1, 0x78000, &tileslayout, 384, 8 },

	/* Sprites */
	{ 1, 0x88000, &tileslayout, 128, 8 },
	{ 1, 0x98000, &tileslayout, 128, 8 },
	{ 1, 0xa8000, &tileslayout, 128, 8 },
	{ 1, 0xb8000, &tileslayout, 128, 8 },
	{ -1 } 
};

static struct YM2203interface ym2203_interface =
{
	2,			/* 2 chips */
	1500000,	/* 1.5 MHz (?) */      /* Real unknown */
	{ YM2203_VOL(40,50), YM2203_VOL(40,50) },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 }
};

static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
 			CPU_M6809,
			2000000,	/* 2 Mhz (?) */
			0,
			readmem,writemem,0,0,
			xainA_interrupt,4      /* Number Unknown */
		},
		{
 			CPU_M6809,
			2000000,	/* 2 Mhz (?) */
			2,
			readmemB,writememB,0,0,
			xainB_interrupt,4      /* Number Unknown */
		},
		{
 			CPU_M6809 | CPU_AUDIO_CPU,
			2000000,	/* 2 Mhz (?) */
			3,
			readmem_sound,writemem_sound,0,0,
			xain_sound_interrupt,16 /* Number Unknown */
		},

	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
	4*60, 	/* 240 CPU slices per frame */
	xain_init_machine,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1, 1*8, 30*8-1 },
	gfxdecodeinfo,
	512, 512,
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
	0,
	xain_vh_start,
	xain_vh_stop,
	xain_vh_screenrefresh,

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



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

  Game driver(s)

***************************************************************************/
ROM_START( xain_rom )
	ROM_REGION(0x14000)	/* 64k for code */
	ROM_LOAD( "1.rom",        0x08000, 0x8000, 0x79f515a7 )
	ROM_LOAD( "2.rom",        0x04000, 0x4000, 0xd22bf859 )
	ROM_CONTINUE(      0x10000, 0x4000 )

	ROM_REGION_DISPOSE(0xc8000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "12.rom",       0x00000, 0x8000, 0x83c00dd8 ) /* Characters */
	ROM_LOAD( "21.rom",       0x08000, 0x8000, 0x11eb4247 ) /* Characters */
	ROM_LOAD( "13.rom",       0x10000, 0x8000, 0x8f0aa1a7 ) /* Characters */
	ROM_LOAD( "22.rom",       0x18000, 0x8000, 0x422b536e ) /* Characters */
	ROM_LOAD( "14.rom",       0x20000, 0x8000, 0x45681910 ) /* Characters */
	ROM_LOAD( "23.rom",       0x28000, 0x8000, 0x828c1b0c ) /* Characters */
	ROM_LOAD( "15.rom",       0x30000, 0x8000, 0xa8eeabc8 ) /* Characters */
	ROM_LOAD( "24.rom",       0x38000, 0x8000, 0xf10f7dd9 ) /* Characters */
	ROM_LOAD( "16.rom",       0x40000, 0x8000, 0xe59a2f27 ) /* Characters */

	ROM_LOAD( "6.rom",        0x48000, 0x8000, 0x5c6c453c ) /* Characters */
	ROM_LOAD( "7.rom",        0x50000, 0x8000, 0x8d637639 ) /* Characters */
	ROM_LOAD( "5.rom",        0x58000, 0x8000, 0x59d87a9a ) /* Characters */
	ROM_LOAD( "8.rom",        0x60000, 0x8000, 0x71eec4e6 ) /* Characters */
	ROM_LOAD( "4.rom",        0x68000, 0x8000, 0x84884a2e ) /* Characters */
	ROM_LOAD( "9.rom",        0x70000, 0x8000, 0x7fc9704f ) /* Characters */

	ROM_LOAD( "25.rom",       0x88000, 0x8000, 0x252976ae ) /* Sprites */
	ROM_LOAD( "17.rom",       0x90000, 0x8000, 0x4d977f33 ) /* Sprites */
	ROM_LOAD( "26.rom",       0x98000, 0x8000, 0xe6f1e8d5 ) /* Sprites */
	ROM_LOAD( "18.rom",       0xa0000, 0x8000, 0x3f3b62a0 ) /* Sprites */
	ROM_LOAD( "27.rom",       0xa8000, 0x8000, 0x785381ed ) /* Sprites */
	ROM_LOAD( "19.rom",       0xb0000, 0x8000, 0x76641ee3 ) /* Sprites */
	ROM_LOAD( "28.rom",       0xb8000, 0x8000, 0x59754e3d ) /* Sprites */
	ROM_LOAD( "20.rom",       0xc0000, 0x8000, 0x37671f36 ) /* Sprites */

	ROM_REGION(0x14000)	/* 64k for code */
	ROM_LOAD( "10.rom",       0x08000, 0x8000, 0xa1a860e2 )
	ROM_LOAD( "11.rom",       0x04000, 0x4000, 0x948b9757 )
	ROM_CONTINUE(       0x10000, 0x4000 )

	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "3.rom",        0x8000, 0x8000, 0xa5318cb8 )
ROM_END

ROM_START( solarwar_rom )
	ROM_REGION(0x14000)	/* 64k for code */
	ROM_LOAD( "p9-0.bin",     0x08000, 0x8000, 0x8ff372a8 )
	ROM_LOAD( "pa-0.bin",     0x04000, 0x4000, 0x154f946f )
	ROM_CONTINUE(         0x10000, 0x4000 )

	ROM_REGION_DISPOSE(0xc8000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "12.rom",       0x00000, 0x8000, 0x83c00dd8 ) /* Characters */
	ROM_LOAD( "21.rom",       0x08000, 0x8000, 0x11eb4247 ) /* Characters */
	ROM_LOAD( "13.rom",       0x10000, 0x8000, 0x8f0aa1a7 ) /* Characters */
	ROM_LOAD( "22.rom",       0x18000, 0x8000, 0x422b536e ) /* Characters */
	ROM_LOAD( "14.rom",       0x20000, 0x8000, 0x45681910 ) /* Characters */
	ROM_LOAD( "23.rom",       0x28000, 0x8000, 0x828c1b0c ) /* Characters */
	ROM_LOAD( "15.rom",       0x30000, 0x8000, 0xa8eeabc8 ) /* Characters */
	ROM_LOAD( "pn-0.bin",     0x38000, 0x8000, 0xd2ed6f94 ) /* Characters */
	ROM_LOAD( "pf-0.bin",     0x40000, 0x8000, 0x6e627a77 ) /* Characters */

	ROM_LOAD( "6.rom",        0x48000, 0x8000, 0x5c6c453c ) /* Characters */
	ROM_LOAD( "7.rom",        0x50000, 0x8000, 0x8d637639 ) /* Characters */
	ROM_LOAD( "5.rom",        0x58000, 0x8000, 0x59d87a9a ) /* Characters */
	ROM_LOAD( "8.rom",        0x60000, 0x8000, 0x71eec4e6 ) /* Characters */
	ROM_LOAD( "4.rom",        0x68000, 0x8000, 0x84884a2e ) /* Characters */
	ROM_LOAD( "9.rom",        0x70000, 0x8000, 0x7fc9704f ) /* Characters */

	ROM_LOAD( "25.rom",       0x88000, 0x8000, 0x252976ae ) /* Sprites */
	ROM_LOAD( "17.rom",       0x90000, 0x8000, 0x4d977f33 ) /* Sprites */
	ROM_LOAD( "26.rom",       0x98000, 0x8000, 0xe6f1e8d5 ) /* Sprites */
	ROM_LOAD( "18.rom",       0xa0000, 0x8000, 0x3f3b62a0 ) /* Sprites */
	ROM_LOAD( "27.rom",       0xa8000, 0x8000, 0x785381ed ) /* Sprites */
	ROM_LOAD( "19.rom",       0xb0000, 0x8000, 0x76641ee3 ) /* Sprites */
	ROM_LOAD( "28.rom",       0xb8000, 0x8000, 0x59754e3d ) /* Sprites */
	ROM_LOAD( "20.rom",       0xc0000, 0x8000, 0x37671f36 ) /* Sprites */

	ROM_REGION(0x14000)	/* 64k for code */
	ROM_LOAD( "p1-0.bin",     0x08000, 0x8000, 0xf5f235a3 )
	ROM_LOAD( "p0-0.bin",     0x04000, 0x4000, 0x51ae95ae )
	ROM_CONTINUE(         0x10000, 0x4000 )

	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "3.rom",        0x8000, 0x8000, 0xa5318cb8 )
ROM_END



static int 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[0x1bca],"\x27\x2c\x26",3) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x1bc7],6*10);
			RAM[0x0033] = RAM[0x1bc7];
			RAM[0x0034] = RAM[0x1bc8];
			RAM[0x0035] = RAM[0x1bc9];
			osd_fclose(f);
		}

		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[0x1bc7],6*10);
		osd_fclose(f);
	}
}



struct GameDriver xsleena_driver =
{
	__FILE__,
	0,
	"xsleena",
	"Xain'd Sleena",
	"1986",
	"Technos",
	"Carlos A. Lozano\nRob Rosenbrock\nPhil Stroffolino\n",
	0,
	&machine_driver,
	0,

	xain_rom,
	0, 0,
	0,
	0,

	input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	0, 0
};

struct GameDriver solarwar_driver =
{
	__FILE__,
	&xsleena_driver,
	"solarwar",
	"Solar Warrior",
	"1986",
	"Technos (Memetron license)",
	"Carlos A. Lozano\nRob Rosenbrock\nPhil Stroffolino\n",
	0,
	&machine_driver,
	0,

	solarwar_rom,
	0, 0,
	0,
	0,

	input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

	0, 0
};

⌨️ 快捷键说明

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