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

📄 sprint2.c

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

static struct GfxLayout carlayout =
{
        16,8,    /* 16*8 characters */
        32,      /* 32 characters */
        1,       /* 1 bit per pixel */
        { 0 },        /* no separation in 1 bpp */
        { 7, 6, 5, 4, 0x200*8 + 7, 0x200*8 + 6, 0x200*8 + 5, 0x200*8 + 4,
          15, 14, 13, 12, 0x200*8 + 15, 0x200*8 + 14, 0x200*8 + 13, 0x200*8 + 12  },
        { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
        16*8     /* every char takes 16 consecutive bytes */
};

static struct GfxDecodeInfo gfxdecodeinfo[] =
{
        { 1, 0x0000, &charlayout, 0x00, 0x02 }, /* offset into colors, # of colors */
        { 1, 0x0400, &carlayout, 0x04, 0x04 }, /* offset into colors, # of colors */
	{ -1 } /* end of array */
};

static unsigned char palette[] =
{
        0x00,0x00,0x00, /* BLACK - oil slicks, text, black car */
        0x55,0x55,0x55, /* DK GREY - default background */
        0x80,0x80,0x80, /* LT GREY - grey cars */
        0xff,0xff,0xff, /* WHITE - track, text, white car */
};

static unsigned short colortable[] =
{
        0x01, 0x00, /* Black playfield */
        0x01, 0x03, /* White playfield */
        0x01, 0x03, /* White car */
        0x01, 0x00, /* Black car */
        0x01, 0x02, /* Grey car 1 */
        0x01, 0x02  /* Grey car 2 */
};


static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			333333,        /* 0.3 Mhz ???? */
			0,
			readmem,writemem,0,0,
			interrupt,1
		}
	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* single CPU, no need for interleaving */
	0,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 }, /* it's actually 32x28, but we'll leave room for our gear indicator */
	gfxdecodeinfo,
	sizeof(palette)/3,sizeof(colortable)/sizeof(unsigned short),
	0,

	VIDEO_TYPE_RASTER,
	0,
	sprint2_vh_start,
	sprint2_vh_stop,
	sprint2_vh_screenrefresh,

	/* sound hardware */
	0,
	0,
	0,
	0
};

static struct MachineDriver sprint1_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_M6502,
			333333,        /* 0.3 Mhz ???? */
			0,
			sprint1_readmem,writemem,0,0,
			interrupt,1
		}
	},
	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,	/* single CPU, no need for interleaving */
	0,

	/* video hardware */
	32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 }, /* it's actually 32x28, but we'll leave room for our gear indicator */
	gfxdecodeinfo,
	sizeof(palette)/3,sizeof(colortable)/sizeof(unsigned short),
	0,

	VIDEO_TYPE_RASTER,
	0,
	sprint2_vh_start,
	sprint2_vh_stop,
	sprint1_vh_screenrefresh,

	/* sound hardware */
	0,
	0,
	0,
	0

};





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

  Game ROMs

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

ROM_START( sprint1_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "6290-01.b1",   0x2000, 0x0800, 0x41fc985e )
	ROM_LOAD( "6291-01.c1",   0x2800, 0x0800, 0x07f7a920 )
	ROM_LOAD( "6442-01.d1",   0x3000, 0x0800, 0xe9ff0124 )
	ROM_RELOAD(             0xF000, 0x0800 )
	ROM_LOAD( "6443-01.e1",   0x3800, 0x0800, 0xd6bb00d0 )
	ROM_RELOAD(             0xF800, 0x0800 )

	ROM_REGION_DISPOSE(0x800)     /* 2k for graphics */
	ROM_LOAD( "6396-01.p4",   0x0000, 0x0200, 0x801b42dd )
	ROM_LOAD( "6397-01.r4",   0x0200, 0x0200, 0x135ba1aa )
	ROM_LOAD( "6398-01.k6",   0x0400, 0x0200, 0xc9e1017e )
	ROM_LOAD( "6399-01.j6",   0x0600, 0x0200, 0x63d685b2 )
ROM_END

ROM_START( sprint2_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "6290-01.b1",   0x2000, 0x0800, 0x41fc985e )
	ROM_LOAD( "6291-01.c1",   0x2800, 0x0800, 0x07f7a920 )
	ROM_LOAD( "6404sp2.d1",   0x3000, 0x0800, 0xd2878ff6 )
	ROM_RELOAD(             0xF000, 0x0800 )
	ROM_LOAD( "6405sp2.e1",   0x3800, 0x0800, 0x6c991c80 )
	ROM_RELOAD(             0xF800, 0x0800 )

	ROM_REGION_DISPOSE(0x800)     /* 2k for graphics */
	ROM_LOAD( "6396-01.p4",   0x0000, 0x0200, 0x801b42dd )
	ROM_LOAD( "6397-01.r4",   0x0200, 0x0200, 0x135ba1aa )
	ROM_LOAD( "6398-01.k6",   0x0400, 0x0200, 0xc9e1017e )
	ROM_LOAD( "6399-01.j6",   0x0600, 0x0200, 0x63d685b2 )
ROM_END



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

  Hi Score Routines

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

static int sprint1_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[0x0057],"000",3) == 0)
	{
		void *f;


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

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



static void sprint1_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[0x0057],3);
		osd_fclose(f);
	}

}


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

  Game driver(s)

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

struct GameDriver sprint1_driver =
{
	__FILE__,
	0,
	"sprint1",
	"Sprint 1",
	"1978",
	"Atari",
	"Mike Balfour",
	0,
	&sprint1_machine_driver,
	0,

	sprint1_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	sprint1_input_ports,

	0, palette, colortable,
	ORIENTATION_DEFAULT,
	sprint1_hiload,sprint1_hisave
};

struct GameDriver sprint2_driver =
{
	__FILE__,
	&sprint1_driver,
	"sprint2",
	"Sprint 2",
	"1976",
	"Atari",
	"Mike Balfour",
	0,
	&machine_driver,
	0,

	sprint2_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	sprint2_input_ports,

	0, palette, colortable,
	ORIENTATION_DEFAULT,
	0,0
};

⌨️ 快捷键说明

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