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

📄 tnzs.c

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



static struct YM2203interface ym2203_interface =
{
	1,			/* 1 chip */
	1500000,	/* 1.5 MHz ??? */
	{ YM2203_VOL(30,30) },
	{ input_port_6_r },
	{ input_port_7_r },
	{ 0 },
	{ 0 }
};



static struct MachineDriver tnzs_machine_driver =
{
    /* basic machine hardware */
    {				/* MachineCPU */
		{
			CPU_Z80,
			4000000,		/* 4 Mhz??? */
			0,			/* memory_region */
			readmem,writemem,0,0,
			tnzs_interrupt,1
		},
		{
			CPU_Z80,
            6000000,        /* 6 Mhz??? */
			2,			/* memory_region */
			readmem1,writemem1,0,0,
			interrupt,1
		}
    },
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	200,	/* 100 CPU slices per frame - an high value to ensure proper */
			/* synchronization of the CPUs */
    tnzs_init_machine,		/* init_machine() */

    /* video hardware */
    16*16, 14*16,         /* screen_width, height */
    { 0, 16*16-1, 0, 14*16-1 }, /* visible_area */
    gfxdecodeinfo,
    512, 512,
    0,

    VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
    0,
	tnzs_vh_start,
	tnzs_vh_stop,
	tnzs_vh_screenrefresh,

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




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

  Game driver(s)

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

/* 00000 ROM (static)
   10000 RAM page 0
   14000 RAM page 1
   18000 ROM page 2
   1c000 ROM page 3
   20000 ROM page 4
   24000 ROM page 5
   28000 ROM page 6
   2c000 ROM page 7
  */
ROM_START( tnzs_rom )
    ROM_REGION(0x30000)	/* 64k + bankswitch areas for the first CPU */
    ROM_LOAD( "nzsb5310.bin", 0x00000, 0x08000, 0xa73745c6 )
    /* 32k padding for 2 RAM banks, followed by 5 ROM banks */
    ROM_CONTINUE(             0x18000, 0x18000 )

    ROM_REGION_DISPOSE(0x100000)	/* temporary space for graphics (disposed after conversion) */
	/* ROMs taken from another set (the ones from this set were read incorrectly) */
	ROM_LOAD( "nzsb5316.bin", 0x00000, 0x20000, 0xc3519c2a )
	ROM_LOAD( "nzsb5317.bin", 0x20000, 0x20000, 0x2bf199e8 )
	ROM_LOAD( "nzsb5318.bin", 0x40000, 0x20000, 0x92f35ed9 )
	ROM_LOAD( "nzsb5319.bin", 0x60000, 0x20000, 0xedbb9581 )
	ROM_LOAD( "nzsb5322.bin", 0x80000, 0x20000, 0x59d2aef6 )
	ROM_LOAD( "nzsb5323.bin", 0xa0000, 0x20000, 0x74acfb9b )
	ROM_LOAD( "nzsb5320.bin", 0xc0000, 0x20000, 0x095d0dc0 )
	ROM_LOAD( "nzsb5321.bin", 0xe0000, 0x20000, 0x9800c54d )

    ROM_REGION(0x18000)	/* 64k for the second CPU */
    ROM_LOAD( "nzsb5311.bin", 0x00000, 0x08000, 0x9784d443 )
    ROM_CONTINUE(             0x10000, 0x08000 )
ROM_END




ROM_START( tnzs2_rom )
    ROM_REGION(0x30000)	/* 64k + bankswitch areas for the first CPU */
    ROM_LOAD( "ns_c-11.rom",  0x00000, 0x08000, 0x3c1dae7b )
    /* 32k padding for 2 RAM banks, followed by 5 ROM banks */
    ROM_CONTINUE(             0x18000, 0x18000 )

    ROM_REGION_DISPOSE(0x100000)	/* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "ns_a13.rom",   0x00000, 0x20000, 0x7e0bd5bb )
    ROM_LOAD( "ns_a12.rom",   0x20000, 0x20000, 0x95880726 )
    ROM_LOAD( "ns_a10.rom",   0x40000, 0x20000, 0x2bc4c053 )
    ROM_LOAD( "ns_a08.rom",   0x60000, 0x20000, 0x8ff8d88c )
    ROM_LOAD( "ns_a07.rom",   0x80000, 0x20000, 0x291bcaca )
    ROM_LOAD( "ns_a05.rom",   0xa0000, 0x20000, 0x6e762e20 )
    ROM_LOAD( "ns_a04.rom",   0xc0000, 0x20000, 0xe1fd1b9d )
    ROM_LOAD( "ns_a02.rom",   0xe0000, 0x20000, 0x2ab06bda )

    ROM_REGION(0x18000)	/* 64k for the second CPU */
    ROM_LOAD( "ns_e-3.rom",   0x00000, 0x08000, 0xc7662e96 )
    ROM_CONTINUE(             0x10000, 0x08000 )
ROM_END

static int tnzs_hiload(void)
{
	/* get RAM pointer (this game is multiCPU, we can't assume the global */
	/* RAM pointer is pointing to the right place) */
	unsigned char *RAM = Machine->memory_region[0];

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

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

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

static void tnzs_hisave(void)
{
    unsigned char *RAM = Machine->memory_region[0];
    void *f;

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

static int tnzs2_hiload(void)
{
	/* get RAM pointer (this game is multiCPU, we can't assume the global */
	/* RAM pointer is pointing to the right place) */
	unsigned char *RAM = Machine->memory_region[0];

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

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

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

static void tnzs2_hisave(void)
{
    unsigned char *RAM = Machine->memory_region[0];
    void *f;

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


struct GameDriver tnzs_driver =
{
	__FILE__,
	0,
	"tnzs",
	"The New Zealand Story",
	"1988",
	"Taito",
    "Chris Moore\nMartin Scragg\nRichard Mitton\nSanteri Saarimaa (hi-scores)",
	0,
	&tnzs_machine_driver,
	0,

	tnzs_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	tnzs_input_ports,

    0, 0, 0,
    ORIENTATION_DEFAULT,

    tnzs_hiload, tnzs_hisave
};

struct GameDriver tnzs2_driver =
{
	__FILE__,
	0,
	"tnzs2",
	"The New Zealand Story 2",
	"1988",
	"Taito",
    "Chris Moore\nMartin Scragg\nRichard Mitton\nSanteri Saarimaa (hi-scores)",
	0,
	&tnzs_machine_driver,
	0,

	tnzs2_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	tnzs_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,

    tnzs2_hiload, tnzs2_hisave
};

⌨️ 快捷键说明

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