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

📄 darkseal.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			darkseal_readmem,darkseal_writemem,0,0,
			m68_level6_irq,1 /* VBL */
		}, /*
		{
			CPU_??? | CPU_AUDIO_CPU,
			1250000,
			2,
			darkseal_readmem,darkseal_writemem,0,0,
			interrupt,1
		}   */
	},
	57, 1536, /* frames per second, vblank duration taken from Burger Time */
	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,
	1280, 1280, /* Space for 2048, but video hardware only uses 1280 */
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
	0,
	darkseal_vh_start,
	darkseal_vh_stop,
	darkseal_vh_screenrefresh,

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

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

ROM_START( darkseal_rom )
	ROM_REGION(0x80000) /* 68000 code */
  /* Nothing :) */

	ROM_REGION_DISPOSE(0x220000) /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "fz-02.rom",    0x000000, 0x10000, 0x3c9c3012 )	/* chars */
	ROM_LOAD( "fz-03.rom",    0x010000, 0x10000, 0x264b90ed )

  	ROM_LOAD( "mac-03.rom",   0x020000, 0x80000, 0x9996f3dc ) /* tiles 1 */
	ROM_LOAD( "mac-02.rom",   0x0a0000, 0x80000, 0x49504e89 ) /* tiles 2 */
  	ROM_LOAD( "mac-00.rom",   0x120000, 0x80000, 0x52acf1d6 ) /* sprites */
  	ROM_LOAD( "mac-01.rom",   0x1a0000, 0x80000, 0xb28f7584 )

	ROM_REGION(0x10000)	/* Unknown sound CPU */
	ROM_LOAD( "fz-06.rom",    0x00000, 0x10000, 0xc4828a6d )

	ROM_REGION(0x40000)	/* ADPCM samples */
  	ROM_LOAD( "fz-08.rom",    0x00000, 0x20000, 0xc9bf68e1 )
	ROM_LOAD( "fz-07.rom",    0x20000, 0x20000, 0x588dd3cb )

	ROM_REGION(0x80000) /* Encrypted code */
  	ROM_LOAD( "ga-04.rom",    0x00000, 0x20000, 0xa1a985a9 ) /* Paired with 1 */
	ROM_LOAD( "ga-00.rom",    0x20000, 0x20000, 0xfbf3ac63 ) /* Paired with 5 */
  	ROM_LOAD( "ga-01.rom",    0x40000, 0x20000, 0x98bd2940 )
 	ROM_LOAD( "ga-05.rom",    0x60000, 0x20000, 0xd5e3ae3f )
ROM_END

ROM_START( gatedoom_rom )
	ROM_REGION(0x80000) /* 68000 code */
  	/* Nothing :) */

	ROM_REGION_DISPOSE(0x220000) /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "fz-02.rom",    0x000000, 0x10000, 0x3c9c3012 )	/* chars */
	ROM_LOAD( "fz-03.rom",    0x010000, 0x10000, 0x264b90ed )

  	/* the following four have not been verified on a real Gate of Doom */
	/* board - might be different from Dark Seal! */
	ROM_LOAD( "mac-03.rom",   0x020000, 0x80000, 0x9996f3dc ) /* tiles 1 */
  	ROM_LOAD( "mac-02.rom",   0x0a0000, 0x80000, 0x49504e89 ) /* tiles 2 */
	ROM_LOAD( "mac-00.rom",   0x120000, 0x80000, 0x52acf1d6 ) /* sprites */
 	ROM_LOAD( "mac-01.rom",   0x1a0000, 0x80000, 0xb28f7584 )

	ROM_REGION(0x10000)	/* Unknown sound CPU */
	ROM_LOAD( "fz-06.rom",    0x00000, 0x10000, 0xc4828a6d )

	ROM_REGION(0x40000)	/* ADPCM samples */
  	ROM_LOAD( "fz-08.rom",    0x00000, 0x20000, 0xc9bf68e1 )
	ROM_LOAD( "fz-07.rom",    0x20000, 0x20000, 0x588dd3cb )

	ROM_REGION(0x80000) /* Encrypted code */
	ROM_LOAD( "gb04.bin",     0x00000, 0x20000, 0x4c3bbd2b ) /* Paired with 1 */
	ROM_LOAD( "gb00.bin",     0x20000, 0x20000, 0xa88c16a1 ) /* Paired with 5 */
	ROM_LOAD( "gb01.bin",     0x40000, 0x20000, 0x59e367f4 )
 	ROM_LOAD( "gb05.bin",     0x60000, 0x20000, 0x252d7e14 )
ROM_END

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

static void darkseal_decrypt(void)
{
	unsigned char *RAM = Machine->memory_region[4];
	unsigned char *OUT = Machine->memory_region[0];
	int newword,i;

	/* Read each byte, decrypt it, and make it a word so 68000 core can read it */
	for (i=0x00000; i<0x40000; i++) {
		int swap1=RAM[i]&0x40;
		int swap2=RAM[i]&0x2;

		/* Mask to 0xbd, misses bits 2 & 7 */
		RAM[i]=(RAM[i]&0xbd);
		if (swap1) RAM[i]+=0x2;
		if (swap2) RAM[i]+=0x40;

		swap1=RAM[i+0x40000]&0x40;
		swap2=RAM[i+0x40000]&0x2;

		/* Mask to 0xbd, misses bits 2 & 7 */
		RAM[i+0x40000]=(RAM[i+0x40000]&0xbd);
		if (swap1) RAM[i+0x40000]+=0x2;
		if (swap2) RAM[i+0x40000]+=0x40;

		newword=((RAM[i])<<8) + RAM[i+0x40000];
		WRITE_WORD (&OUT[i*2],newword);
		WRITE_WORD (&ROM[i*2],newword);
	}

	/* Free encrypted memory region */
	free(Machine->memory_region[4]);
	Machine->memory_region[4] = 0;
}

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

/* Why do I have to double length???  Bug in ADPCM code? */
ADPCM_SAMPLES_START(darkseal_samples)
ADPCM_SAMPLE(0x47,0x00f8,0x1000*2)
ADPCM_SAMPLE(0x48,0x10f8,0x0600*2)
ADPCM_SAMPLE(0x49,0x16f8,0x1000*2)
ADPCM_SAMPLE(0x4a,0x26f8,0x1600*2)
ADPCM_SAMPLE(0x4b,0x3cf8,0x1200*2)
ADPCM_SAMPLE(0x4c,0x4ef8,0x0800*2)
ADPCM_SAMPLE(0x4d,0x56f8,0x1200*2)
ADPCM_SAMPLE(0x4e,0x68f8,0x1000*2)
ADPCM_SAMPLE(0x4f,0x78f8,0x1200*2)
ADPCM_SAMPLE(0x50,0x8af8,0x0600*2)
ADPCM_SAMPLE(0x51,0x90f8,0x1200*2)
ADPCM_SAMPLE(0x52,0xa2f8,0x1000*2)
ADPCM_SAMPLE(0x53,0xb2f8,0x1200*2)
ADPCM_SAMPLE(0x54,0xc4f8,0x0800*2)
ADPCM_SAMPLE(0x55,0xccf8,0x0e00*2)
ADPCM_SAMPLE(0x56,0xdaf8,0x1a00*2)
ADPCM_SAMPLE(0x57,0xf4f8,0x3000*2)
ADPCM_SAMPLE(0x58,0x124f8,0x1a00*2)
ADPCM_SAMPLE(0x59,0x13ef8,0x1600*2)
ADPCM_SAMPLE(0x5a,0x154f8,0x1000*2)
ADPCM_SAMPLE(0x5b,0x164f8,0x0600*2)
ADPCM_SAMPLE(0x5c,0x16af8,0x1200*2)
ADPCM_SAMPLE(0x5d,0x17cf8,0x0600*2)
ADPCM_SAMPLE(0x5e,0x182f8,0x0a00*2)
ADPCM_SAMPLE(0x5f,0x18cf8,0x1600*2)
ADPCM_SAMPLE(0x60,0x1a2f8,0x0800*2)
ADPCM_SAMPLE(0x61,0x1aaf8,0x0400*2)
ADPCM_SAMPLE(0x62,0x1aef8,0x0800*2)
ADPCM_SAMPLE(0x63,0x1b6f8,0x1000*2)
ADPCM_SAMPLE(0x64,0x1c6f8,0x0600*2)
ADPCM_SAMPLE(0x65,0x1ccf8,0x2000*2)
ADPCM_SAMPLES_END



/* hi load / save added 12/02/98 HSC */

static int hiload(void)
{
    void *f;
    /* check if the hi score table has already been initialized */
    if (READ_WORD(&ram_drkseal[0x3e00])==0x50 && READ_WORD(&ram_drkseal[0x3e04])==0x50 && READ_WORD(&ram_drkseal[0x3e32])==0x4800 && READ_WORD(&ram_drkseal[0x3e34])==0x462e)
    {
        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
        {
			osd_fread_msbfirst(f,&ram_drkseal[0x3e00],56);
			osd_fclose(f);

		}

		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_drkseal[0x3e00],56);
				osd_fclose(f);
        }
}


struct GameDriver darkseal_driver =
{
	__FILE__,
	0,
	"darkseal",
	"Dark Seal",
	"1990",
	"Data East Corporation",
	"Bryan McPhail",
	0,
	&darkseal_machine_driver,
	0,

	darkseal_rom,
	0, darkseal_decrypt,
	0,
	(void *)darkseal_samples,

	darkseal_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,
	hiload , hisave  /* hsc 12/02/98 */
};

struct GameDriver gatedoom_driver =
{
	__FILE__,
	&darkseal_driver,
	"gatedoom",
	"Gate Of Doom",
	"1990",
	"Data East Corporation",
	"Bryan McPhail",
	0,
	&darkseal_machine_driver,
	0,

	gatedoom_rom,
	0, darkseal_decrypt,
	0,
	(void *)darkseal_samples,

	darkseal_input_ports,

	0, 0, 0,
	ORIENTATION_DEFAULT,
	hiload , hisave /* hsc 12/02/98 */
};

⌨️ 快捷键说明

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