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

📄 bionicc.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	2048,   /* 2048 character */
	2,      /* 2 bitplanes */
	{ 4,0 },
	{ 0,1,2,3,8,9,10,11 },
	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
	128   /* every character takes 128 consecutive bytes */
};

static struct GfxLayout scroll2layout_bionicc=
{
	8,8,    /* 8*8 tiles */
	2048,   /* 2048 tiles */
	4,      /* 4 bits per pixel */
	{ (0x08000*8)+4,0x08000*8,4,0 },
	{ 0,1,2,3, 8,9,10,11 },
	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
	128   /* every tile takes 128 consecutive bytes */
};

static struct GfxLayout scroll1layout_bionicc=
{
	16,16,  /* 16*16 tiles */
	2048,   /* 2048 tiles */
	4,      /* 4 bits per pixel */
	{ (0x020000*8)+4,0x020000*8,4,0 },
	{
		0,1,2,3, 8,9,10,11,
		(8*4*8)+0,(8*4*8)+1,(8*4*8)+2,(8*4*8)+3,
		(8*4*8)+8,(8*4*8)+9,(8*4*8)+10,(8*4*8)+11
	},
	{
		0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
		8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16
	},
	512   /* each tile takes 512 consecutive bytes */
};

static struct GfxDecodeInfo gfxdecodeinfo_bionicc[] =
{
	{ 1, 0x48000, &scroll2layout_bionicc, 0,    4 },
	{ 1, 0x58000, &scroll1layout_bionicc, 64,   4 },
	{ 1, 0x00000, &spritelayout_bionicc,  128, 16 },
	{ 1, 0x40000, &vramlayout_bionicc,    384, 16 },
	{ -1 }
};



static struct YM2151interface ym2151_interface =
{
	1,                      /* 1 chip */
	3579580,                /* 3.579580 MHz ? */
	{ 60 },
	{ 0 }
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M68000,
			10000000, /* ?? MHz ? */
			0,
			readmem,writemem,0,0,
			bionicc_interrupt,8
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			4000000,  /* 4 Mhz ??? TODO: find real FRQ */
			2,      /* memory region #2 */
			sound_readmem,sound_writemem,0,0,
			nmi_interrupt,4	/* ??? */
		}
	},
	60, 5000, 
	1,
	0,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
	gfxdecodeinfo_bionicc,
	64*3+256, /* colours */
	64*3+256, /* Colour table length */
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
	0,
	bionicc_vh_start,
	bionicc_vh_stop,
	bionicc_vh_screenrefresh,

	SOUND_SUPPORTS_STEREO,0,0,0,
	{
		 { SOUND_YM2151,  &ym2151_interface },
	}
};



ROM_START( bionicc_rom )
	ROM_REGION(0x40000)      /* 68000 code */
	ROM_LOAD_EVEN( "tsu_02b.rom",  0x00000, 0x10000, 0xcf965a0a ) /* 68000 code */
	ROM_LOAD_ODD ( "tsu_04b.rom",  0x00000, 0x10000, 0xc9884bfb ) /* 68000 code */
	ROM_LOAD_EVEN( "tsu_03b.rom",  0x20000, 0x10000, 0x4e157ae2 ) /* 68000 code */
	ROM_LOAD_ODD ( "tsu_05b.rom",  0x20000, 0x10000, 0xe66ca0f9 ) /* 68000 code */

	ROM_REGION_DISPOSE(0x098000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "tsu_10.rom",   0x000000, 0x08000, 0xf1180d02 )	/* Sprites */
	ROM_LOAD( "tsu_09.rom",   0x008000, 0x08000, 0x6a049292 )
	ROM_LOAD( "tsu_15.rom",   0x010000, 0x08000, 0xea912701 )
	ROM_LOAD( "tsu_14.rom",   0x018000, 0x08000, 0x46b2ad83 )
	ROM_LOAD( "tsu_20.rom",   0x020000, 0x08000, 0x17857ad2 )
	ROM_LOAD( "tsu_19.rom",   0x028000, 0x08000, 0xb5c82722 )
	ROM_LOAD( "tsu_22.rom",   0x030000, 0x08000, 0x5ee1ae6a )
	ROM_LOAD( "tsu_21.rom",   0x038000, 0x08000, 0x98777006 )
	ROM_LOAD( "tsu_08.rom",   0x040000, 0x08000, 0x9bf0b7a2 )	/* VIDEORAM (text layer) tiles */
	ROM_LOAD( "tsu_07.rom",   0x048000, 0x08000, 0x9469efa4 )	/* SCROLL2 Layer Tiles */
	ROM_LOAD( "tsu_06.rom",   0x050000, 0x08000, 0x40bf0eb4 )
	ROM_LOAD( "ts_12.rom",    0x058000, 0x08000, 0xe4b4619e )	/* SCROLL1 Layer Tiles */
	ROM_LOAD( "ts_11.rom",    0x060000, 0x08000, 0xab30237a )
	ROM_LOAD( "ts_17.rom",    0x068000, 0x08000, 0xdeb657e4 )
	ROM_LOAD( "ts_16.rom",    0x070000, 0x08000, 0xd363b5f9 )
	ROM_LOAD( "ts_13.rom",    0x078000, 0x08000, 0xa8f5a004 )
	ROM_LOAD( "ts_18.rom",    0x080000, 0x08000, 0x3b36948c )
	ROM_LOAD( "ts_23.rom",    0x088000, 0x08000, 0xbbfbe58a )
	ROM_LOAD( "ts_24.rom",    0x090000, 0x08000, 0xf156e564 )

	ROM_REGION(0x10000) /* 64k for the audio CPU */
	ROM_LOAD( "tsu_01b.rom",  0x00000, 0x8000, 0xa9a6cafa )
ROM_END

ROM_START( bionicc2_rom )
	ROM_REGION(0x40000)      /* 68000 code */
	ROM_LOAD_EVEN( "02",      0x00000, 0x10000, 0xf2528f08 ) /* 68000 code */
	ROM_LOAD_ODD ( "04",      0x00000, 0x10000, 0x38b1c7e4 ) /* 68000 code */
	ROM_LOAD_EVEN( "03",      0x20000, 0x10000, 0x72c3b76f ) /* 68000 code */
	ROM_LOAD_ODD ( "05",      0x20000, 0x10000, 0x70621f83 ) /* 68000 code */

	ROM_REGION_DISPOSE(0x098000)     /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "tsu_10.rom",   0x000000, 0x08000, 0xf1180d02 )	/* Sprites */
	ROM_LOAD( "tsu_09.rom",   0x008000, 0x08000, 0x6a049292 )
	ROM_LOAD( "tsu_15.rom",   0x010000, 0x08000, 0xea912701 )
	ROM_LOAD( "tsu_14.rom",   0x018000, 0x08000, 0x46b2ad83 )
	ROM_LOAD( "tsu_20.rom",   0x020000, 0x08000, 0x17857ad2 )
	ROM_LOAD( "tsu_19.rom",   0x028000, 0x08000, 0xb5c82722 )
	ROM_LOAD( "tsu_22.rom",   0x030000, 0x08000, 0x5ee1ae6a )
	ROM_LOAD( "tsu_21.rom",   0x038000, 0x08000, 0x98777006 )
	ROM_LOAD( "tsu_08.rom",   0x040000, 0x08000, 0x9bf0b7a2 )	/* VIDEORAM (text layer) tiles */
	ROM_LOAD( "tsu_07.rom",   0x048000, 0x08000, 0x9469efa4 )	/* SCROLL2 Layer Tiles */
	ROM_LOAD( "tsu_06.rom",   0x050000, 0x08000, 0x40bf0eb4 )
	ROM_LOAD( "ts_12.rom",    0x058000, 0x08000, 0xe4b4619e )	/* SCROLL1 Layer Tiles */
	ROM_LOAD( "ts_11.rom",    0x060000, 0x08000, 0xab30237a )
	ROM_LOAD( "ts_17.rom",    0x068000, 0x08000, 0xdeb657e4 )
	ROM_LOAD( "ts_16.rom",    0x070000, 0x08000, 0xd363b5f9 )
	ROM_LOAD( "ts_13.rom",    0x078000, 0x08000, 0xa8f5a004 )
	ROM_LOAD( "ts_18.rom",    0x080000, 0x08000, 0x3b36948c )
	ROM_LOAD( "ts_23.rom",    0x088000, 0x08000, 0xbbfbe58a )
	ROM_LOAD( "ts_24.rom",    0x090000, 0x08000, 0xf156e564 )

	ROM_REGION(0x10000) /* 64k for the audio CPU */
	ROM_LOAD( "tsu_01b.rom",  0x00000, 0x8000, 0xa9a6cafa )
ROM_END

/* hi load / save added 11/20/98 HSC */

#ifdef LSB_FIRST
#define ENDIAN_ALIGN(a)	(a)
#else
#define ENDIAN_ALIGN(a) (a^1)
#endif

static int hiload(void)
{

    void *f;
    /* check if the hi score table has already been initialized */
    if (READ_WORD(&ram_bc[0x39e2])==0x2 && READ_WORD(&ram_bc[0x39e4])==0 && READ_WORD(&ram_bc[0x3a2e])==0x434f && READ_WORD(&ram_bc[0x3a30])==0x4d20)
    {
        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
        {
			int hi;
			osd_fread_msbfirst(f,&ram_bc[0x39e2],10*8);
			osd_fclose(f);
			ram_bc[0x57a]=ram_bc[0x39e2];
            ram_bc[0x57b]=ram_bc[0x39e3];
            ram_bc[0x57c]=ram_bc[0x39e4];
            ram_bc[0x57d]=ram_bc[0x39e5];

			hi =(ram_bc[ENDIAN_ALIGN(0x57c)] & 0x0f) +
				(ram_bc[ENDIAN_ALIGN(0x57c)] >> 4) * 10 +
				(ram_bc[ENDIAN_ALIGN(0x57d)] & 0x0f) * 100 +
				(ram_bc[ENDIAN_ALIGN(0x57d)] >> 4) * 1000 +
				(ram_bc[ENDIAN_ALIGN(0x57a)] & 0x0f) * 10000 +
				(ram_bc[ENDIAN_ALIGN(0x57a)] >> 4) * 100000 +
				(ram_bc[ENDIAN_ALIGN(0x57b)] & 0x0f) * 1000000 +
				(ram_bc[ENDIAN_ALIGN(0x57b)] >> 4) * 10000000;

			if (hi >= 10000000)
				ram_bcvid[ENDIAN_ALIGN(0x0d8)] = ram_bc[ENDIAN_ALIGN(0x57b)] >> 4;
			if (hi >= 1000000)
				ram_bcvid[ENDIAN_ALIGN(0x0da)] = ram_bc[ENDIAN_ALIGN(0x57b)] & 0x0F;
			if (hi >= 100000)
				ram_bcvid[ENDIAN_ALIGN(0x0dc)] = ram_bc[ENDIAN_ALIGN(0x57a)] >> 4;
			if (hi >= 10000)
				ram_bcvid[ENDIAN_ALIGN(0x0de)] = ram_bc[ENDIAN_ALIGN(0x57a)] & 0x0F;
			if (hi >= 1000)
				ram_bcvid[ENDIAN_ALIGN(0x0e0)] = ram_bc[ENDIAN_ALIGN(0x57d)] >> 4;
			if (hi >= 100)
				ram_bcvid[ENDIAN_ALIGN(0x0e2)] = ram_bc[ENDIAN_ALIGN(0x57d)] & 0x0F;
			if (hi >= 10)
				ram_bcvid[ENDIAN_ALIGN(0x0e4)] = ram_bc[ENDIAN_ALIGN(0x57c)] >> 4;
			if (hi >= 0)
				ram_bcvid[ENDIAN_ALIGN(0x0e6)] = ram_bc[ENDIAN_ALIGN(0x57c)] & 0x0F;
		}
		return 1;
	}
    else return 0;  /* we can't load the hi scores yet */
}

static void hisave(void)
{
	void *f;

	if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
	{
		osd_fwrite_msbfirst(f,&ram_bc[0x39e2],10*8);
		osd_fclose(f);
	}
}




struct GameDriver bionicc_driver =
{
	__FILE__,
	0,
	"bionicc",
	"Bionic Commando (set 1)",
	"1987",
	"Capcom",
	"Steven Frew\nPhil Stroffolino\nPaul Leaman",
	0,
	&machine_driver,
	0,

	bionicc_rom,
	0,
	0,0,
	0,

	bionicc_input_ports,
	NULL, 0, 0,

	ORIENTATION_DEFAULT,
	hiload,hisave
};

struct GameDriver bionicc2_driver =
{
	__FILE__,
	&bionicc_driver,
	"bionicc2",
	"Bionic Commando (set 2)",
	"1987",
	"Capcom",
	"Steven Frew\nPhil Stroffolino\nPaul Leaman",
	0,
	&machine_driver,
	0,

	bionicc2_rom,
	0,
	0,0,
	0,

	bionicc_input_ports,
	NULL, 0, 0,

	ORIENTATION_DEFAULT,
	hiload, hisave
};

⌨️ 快捷键说明

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