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

📄 dec0.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	ROM_LOAD( "fa07-.bin",    0x020000, 0x08000, 0xe932268b )	/* tiles */
	/* 28000-3ffff empty */
	ROM_CONTINUE(          0x040000, 0x08000 )
	/* 48000-5ffff empty */
	ROM_LOAD( "fa06-.bin",    0x060000, 0x08000, 0xc4dd38c0 )
	/* 68000-7ffff empty */
	ROM_CONTINUE(          0x080000, 0x08000 )
	/* 88000-9ffff empty */
	ROM_LOAD( "fa09-.bin",    0x0a0000, 0x10000, 0x1395e9be )	/* tiles */
	/* b0000-bffff empty */
	ROM_CONTINUE(          0x0c0000, 0x10000 )
	/* d0000-dffff empty */
	ROM_LOAD( "fa08-.bin",    0x0e0000, 0x10000, 0x4d7464db )
	/* f0000-fffff empty */
	ROM_CONTINUE(          0x100000, 0x10000 )
	/* 110000-11ffff empty */
	ROM_LOAD( "fa01-.bin",    0x120000, 0x20000, 0x99b0cd92 )	/* sprites */
	ROM_LOAD( "fa03-.bin",    0x140000, 0x20000, 0x0e7ea74d )
	ROM_LOAD( "fa00-.bin",    0x160000, 0x20000, 0xf7df3fd7 )
	ROM_LOAD( "fa02-.bin",    0x180000, 0x20000, 0x84e8da9d )

	ROM_REGION (0x10000)	/* Custom sound CPU */
	ROM_LOAD( "fa10-.bin",    0x0e000, 0x02000, 0xdfd2ff25 )
	ROM_CONTINUE(0x0000,0xe000)

	ROM_REGION (0x20000)	/* ADPCM samples */
	ROM_LOAD( "fa11-.bin",    0x00000, 0x20000, 0x4e547bad )
ROM_END

ROM_START( midres_rom )
	ROM_REGION(0x80000) /* 68000 code */
	ROM_LOAD_EVEN ( "fl14",         0x00000, 0x20000, 0x2f9507a2 )
	ROM_LOAD_ODD ( "fl12",         0x00000, 0x20000, 0x3815ad9f )
	ROM_LOAD_EVEN ( "fl15",         0x40000, 0x20000, 0x1328354e )
	ROM_LOAD_ODD  ( "fl13",         0x40000, 0x20000, 0xe3b3955e )

	ROM_REGION_DISPOSE(0x1a0000) /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "fl05",         0x008000, 0x08000, 0xd75aba06 )	/* chars */
	ROM_CONTINUE(     0x000000, 0x08000 )	/* the two halves are swapped */
	ROM_LOAD( "fl04",         0x018000, 0x08000, 0x8f5bbb79 )
	ROM_CONTINUE(     0x010000, 0x08000 )
	ROM_LOAD( "fl09",         0x020000, 0x20000, 0x907d5910 )	/* tiles */
	ROM_LOAD( "fl08",         0x040000, 0x20000, 0xa936c03c )
	ROM_LOAD( "fl07",         0x060000, 0x20000, 0x2068c45c )
	ROM_LOAD( "fl06",         0x080000, 0x20000, 0xb7241ab9 )
	ROM_LOAD( "fl11",         0x0a0000, 0x10000, 0xb86b73b4 )	/* tiles */
	/* 0d0000-0dffff empty */
	ROM_CONTINUE(     0x0c0000, 0x10000 )
	/* 110000-11ffff empty */
	ROM_LOAD( "fl10",         0x0e0000, 0x10000, 0x92245b29 )
	/* 0b0000-0bffff empty */
	ROM_CONTINUE(     0x100000, 0x10000 )
	/* 0f0000-0fffff empty */
	ROM_LOAD( "fl01",         0x120000, 0x20000, 0x2c8b35a7 )	/* sprites */
	ROM_LOAD( "fl03",         0x140000, 0x20000, 0x1eefed3c )
	ROM_LOAD( "fl00",         0x160000, 0x20000, 0x756fb801 )
	ROM_LOAD( "fl02",         0x180000, 0x20000, 0x54d2c120 )

	ROM_REGION(0x10000)	/* Custom sound CPU */
	ROM_LOAD( "fl16",         0x0e000, 0x2000, 0x66360bdf )
	ROM_CONTINUE(0x0000,0xe000)

	ROM_REGION(0x20000)	/* ADPCM samples */
	ROM_LOAD( "fl17",         0x00000, 0x20000, 0x9029965d )
ROM_END

ROM_START( midresj_rom )
	ROM_REGION(0x80000) /* 68000 code */
	ROM_LOAD_EVEN ( "fk_14.rom", 0x00000, 0x20000, 0xde7522df )
	ROM_LOAD_ODD  ( "fk_12.rom", 0x00000, 0x20000, 0x3494b8c9 )
	ROM_LOAD_EVEN ( "fl15", 0x40000, 0x20000, 0x1328354e )
	ROM_LOAD_ODD  ( "fl13", 0x40000, 0x20000, 0xe3b3955e )

	ROM_REGION_DISPOSE(0x1a0000) /* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "fk_05.rom", 0x008000, 0x08000, 0x3cdb7453 )	/* chars */
	ROM_CONTINUE(     0x000000, 0x08000 )	/* the two halves are swapped */
	ROM_LOAD( "fk_04.rom", 0x018000, 0x08000, 0x325ba20c )
	ROM_CONTINUE(     0x010000, 0x08000 )
	ROM_LOAD( "fl09", 0x020000, 0x20000, 0x907d5910 )	/* tiles */
	ROM_LOAD( "fl08", 0x040000, 0x20000, 0xa936c03c )
	ROM_LOAD( "fl07", 0x060000, 0x20000, 0x2068c45c )
	ROM_LOAD( "fl06", 0x080000, 0x20000, 0xb7241ab9 )
	ROM_LOAD( "fl11", 0x0a0000, 0x10000, 0xb86b73b4 )	/* tiles */
	/* 0d0000-0dffff empty */
	ROM_CONTINUE(     0x0c0000, 0x10000 )
	/* 110000-11ffff empty */
	ROM_LOAD( "fl10", 0x0e0000, 0x10000, 0x92245b29 )
	/* 0b0000-0bffff empty */
	ROM_CONTINUE(     0x100000, 0x10000 )
	/* 0f0000-0fffff empty */
	ROM_LOAD( "fl01", 0x120000, 0x20000, 0x2c8b35a7 )	/* sprites */
	ROM_LOAD( "fl03", 0x140000, 0x20000, 0x1eefed3c )
	ROM_LOAD( "fl00", 0x160000, 0x20000, 0x756fb801 )
	ROM_LOAD( "fl02", 0x180000, 0x20000, 0x54d2c120 )

	ROM_REGION(0x10000)	/* Unknown or corrupt sound CPU */
	ROM_LOAD( "fl16", 0x00000, 0x10000, 0x66360bdf )

	ROM_REGION(0x20000)	/* ADPCM samples */
	ROM_LOAD( "fl17", 0x00000, 0x20000, 0x9029965d )
ROM_END

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

/* Sly Spy has many areas all mixed in with one another, they need to be
	seperated via patches unless we find some byte written somewhere that
  is used to enable each area on it's own */
static void slyspy_patch(void)
{
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];

	/* Move pf2 registers so they don't conflict */
	WRITE_WORD (&RAM[0x132E],0x0023);
	WRITE_WORD (&RAM[0x133A],0x0023);
	WRITE_WORD (&RAM[0x1346],0x0023);
	WRITE_WORD (&RAM[0x1352],0x0023);
	WRITE_WORD (&RAM[0x135E],0x0023);
	WRITE_WORD (&RAM[0x136A],0x0023);
	WRITE_WORD (&RAM[0x1376],0x0023);
	WRITE_WORD (&RAM[0x1382],0x0023);

	WRITE_WORD (&RAM[0xD292],0x0023);

	/* Move pf1 registers so they don't conflict */
	WRITE_WORD (&RAM[0x12BC],0x0023);
	WRITE_WORD (&RAM[0x12C8],0x0023);
	WRITE_WORD (&RAM[0x12D4],0x0023);
	WRITE_WORD (&RAM[0x12E0],0x0023);
	WRITE_WORD (&RAM[0x12EC],0x0023);
	WRITE_WORD (&RAM[0x12F8],0x0023);
	WRITE_WORD (&RAM[0x1304],0x0023);
	WRITE_WORD (&RAM[0x1310],0x0023);

	/* Move row scroll */
	WRITE_WORD (&RAM[0xE3D8],0x0023);
	WRITE_WORD (&RAM[0xE3DE],0x0023);
	WRITE_WORD (&RAM[0xE3E4],0x0023);
	WRITE_WORD (&RAM[0xE3EA],0x0023);
	WRITE_WORD (&RAM[0xE3F0],0x0023);

	/* Playfield 2(?) rowscroll area & 0x80 byte colscroll area */
	WRITE_WORD (&RAM[0x1162],0x0023);
	WRITE_WORD (&RAM[0x1176],0x0023);

	/* Playfield 3(?) rowscroll area & 0x80 byte colscroll area */
	WRITE_WORD (&RAM[0x10EE],0x0023);
	WRITE_WORD (&RAM[0x1102],0x0023);

	/* Text areas used by end sequence, conflicts with pf2 */
	WRITE_WORD (&RAM[0x4542],0x0023);
	WRITE_WORD (&RAM[0x48D2],0x0023);
	WRITE_WORD (&RAM[0x4900],0x0023);
	WRITE_WORD (&RAM[0x4946],0x0023);
	WRITE_WORD (&RAM[0x49D0],0x0023);
	WRITE_WORD (&RAM[0x49FC],0x0023);
	WRITE_WORD (&RAM[0x4A40],0x0023);
	WRITE_WORD (&RAM[0x4A70],0x0023);

	/* Uncomment this to make end sequence appear at end of first level *
	WRITE_WORD (&RAM[0x5e0],0x4E71);
	WRITE_WORD (&RAM[0x5e2],0x4E71);	 */
}

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

/* Mish - Decryption of code bank rom 8 */
static void hippo_decode(void)
{
	unsigned char *MYRAM = Machine->memory_region[4];
	int i;

	/* Read each byte, decrypt it */
	for (i=0x00000; i<0x10000; i++) {
	  	int swap1=MYRAM[i]&0x80;
	    int swap2=MYRAM[i]&0x1;

	    MYRAM[i]=(MYRAM[i]&0x7e);
	    if (swap1) MYRAM[i]+=0x1;
	    if (swap2) MYRAM[i]+=0x80;
	}
}

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

/* OKI sample tables for Sly Spy & Mid Res as their sound CPU is not yet emulated */
ADPCM_SAMPLES_START(slyspy_samples)
ADPCM_SAMPLE(0x2e,0x0120,0x0480*2)
ADPCM_SAMPLE(0x2f,0x05a0,0x0440*2)
ADPCM_SAMPLE(0x30,0x09e0,0x0c40*2)
ADPCM_SAMPLE(0x31,0x1620,0x0a00*2)
ADPCM_SAMPLE(0x32,0x2020,0x1400*2)
ADPCM_SAMPLE(0x33,0x3420,0x06c0*2)
ADPCM_SAMPLE(0x34,0x3ae0,0x0c40*2)
ADPCM_SAMPLE(0x35,0x4720,0x0240*2)
ADPCM_SAMPLE(0x36,0x4960,0x0440*2)
ADPCM_SAMPLE(0x37,0x4da0,0x0980*2)
ADPCM_SAMPLE(0x38,0x5720,0x09c0*2)
ADPCM_SAMPLE(0x39,0x60e0,0x0600*2)
ADPCM_SAMPLE(0x3a,0x66e0,0x0280*2)
ADPCM_SAMPLE(0x3b,0x6960,0x0240*2)
ADPCM_SAMPLE(0x3c,0x6ba0,0x0780*2)
ADPCM_SAMPLE(0x3d,0x7320,0x0480*2)
ADPCM_SAMPLE(0x3e,0x77a0,0x1000*2)
ADPCM_SAMPLE(0x3f,0x87a0,0x0a80*2)
ADPCM_SAMPLE(0x40,0xa020,0x0c40*2)
ADPCM_SAMPLE(0x41,0x9220,0x0e00*2)
ADPCM_SAMPLE(0x42,0xac60,0x0400*2)
ADPCM_SAMPLE(0x43,0xb060,0x0a00*2)
ADPCM_SAMPLE(0x44,0xba60,0x1d00*2)
ADPCM_SAMPLE(0x45,0xd760,0x0c40*2)
ADPCM_SAMPLE(0x46,0xe3a0,0x1500*2)
ADPCM_SAMPLE(0x47,0xf8a0,0x1340*2)
ADPCM_SAMPLE(0x48,0x10be0,0x1040*2)
ADPCM_SAMPLE(0x49,0x11c20,0x0b80*2)
ADPCM_SAMPLE(0x4a,0x127a0,0x0680*2)
ADPCM_SAMPLE(0x4b,0x12e20,0x0ac0*2)
ADPCM_SAMPLE(0x4c,0x138e0,0x3e00*2)
ADPCM_SAMPLE(0x4d,0x176e0,0x1400*2)
ADPCM_SAMPLE(0x4e,0x194e0,0x0600*2)
ADPCM_SAMPLE(0x4f,0x19ae0,0x1c00*2)
ADPCM_SAMPLE(0x50,0x18ae0,0x0a00*2)
ADPCM_SAMPLE(0x51,0x1b6e0,0x1a00*2)
ADPCM_SAMPLES_END

ADPCM_SAMPLES_START(midres_samples)
ADPCM_SAMPLE(0x45,0x0130,0x00c0*2)
ADPCM_SAMPLE(0x46,0x01f0,0x03c0*2)
ADPCM_SAMPLE(0x47,0x05b0,0x0600*2)
ADPCM_SAMPLE(0x48,0x0bb0,0x0540*2)
ADPCM_SAMPLE(0x49,0x10f0,0x0600*2)
ADPCM_SAMPLE(0x4a,0x16f0,0x0740*2)
ADPCM_SAMPLE(0x4b,0x1e30,0x0300*2)
ADPCM_SAMPLE(0x4c,0x2130,0x0c00*2)
ADPCM_SAMPLE(0x4d,0x2d30,0x08c0*2)
ADPCM_SAMPLE(0x4e,0x35f0,0x0680*2)
ADPCM_SAMPLE(0x4f,0x3c70,0x0a40*2)
ADPCM_SAMPLE(0x50,0x46b0,0x0b40*2)
ADPCM_SAMPLE(0x51,0x51f0,0x0940*2)
ADPCM_SAMPLE(0x52,0x5b30,0x07c0*2)
ADPCM_SAMPLE(0x53,0x62f0,0x0980*2)
ADPCM_SAMPLE(0x54,0x6c70,0x0a00*2)
ADPCM_SAMPLE(0x55,0x7670,0x1200*2)
ADPCM_SAMPLE(0x56,0x8870,0x0ac0*2)
ADPCM_SAMPLE(0x57,0x9330,0x0800*2)
ADPCM_SAMPLE(0x58,0x9b30,0x0600*2)
ADPCM_SAMPLE(0x59,0xa130,0x0280*2)
ADPCM_SAMPLE(0x5a,0xa3b0,0x1140*2)
ADPCM_SAMPLE(0x5b,0xb4f0,0x1200*2)
ADPCM_SAMPLE(0x5c,0xc6f0,0x1200*2)
ADPCM_SAMPLE(0x5d,0xd8f0,0x0900*2)
ADPCM_SAMPLE(0x5e,0xe1f0,0x1000*2)
ADPCM_SAMPLE(0x5f,0xf1f0,0x0680*2)
ADPCM_SAMPLE(0x60,0x10000,0x2480*2)
ADPCM_SAMPLE(0x61,0x12480,0x0b80*2)
ADPCM_SAMPLE(0x62,0x13000,0x1600*2)
ADPCM_SAMPLE(0x63,0x14600,0x0e00*2)
ADPCM_SAMPLE(0x64,0x15400,0x0a00*2)
ADPCM_SAMPLE(0x65,0x15e00,0x1500*2)
ADPCM_SAMPLE(0x66,0x17300,0x0c80*2)
ADPCM_SAMPLE(0x67,0x17f80,0x1140*2)
ADPCM_SAMPLE(0x68,0x190c0,0x1c40*2)
ADPCM_SAMPLE(0x69,0x1ad00,0x2400*2)
ADPCM_SAMPLE(0x6a,0x1d100,0x1400*2)
ADPCM_SAMPLES_END

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

static int robocopp_hiload(void)
{
	void *f;

	/* check if the hi score table has already been initialized */

	if (READ_WORD(&dec0_ram[0x0ed8]) == 0x4d55 && READ_WORD(&dec0_ram[0x0eda]) == 0x5250 &&
		READ_WORD(&dec0_ram[0x0f68]) == 0x504f && READ_WORD(&dec0_ram[0x0f6a]) == 0x4c49 )
	{
		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread_msbfirst(f,&dec0_ram[0x0ed8],16*10);

/* MISH :  The following lines DO NOT look endian friendly... */

			dec0_ram[0x3522]=dec0_ram[0x0ee0];
			dec0_ram[0x3523]=dec0_ram[0x0ee1];
			dec0_ram[0x3524]=dec0_ram[0x0ee2];
			dec0_ram[0x3525]=dec0_ram[0x0ee3];
			osd_fclose(f);
		}
		return 1;
	}
	else return 0;  /* we can't load the hi scores yet */
}

static void robocopp_hisave(void)
{
        void *f;

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

static int hbarrel_hiload(void)
{
        void *f;

        /* check if the hi score table has already been initialized */

        if (READ_WORD(&dec0_ram[0x3e9c]) == 0x10 && READ_WORD(&dec0_ram[0x3ea0]) == 0x09 &&
			READ_WORD(&dec0_ram[0x3ef0]) == 0x55 && READ_WORD(&dec0_ram[0x3ef2]) == 0x4d26)
        {
                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread_msbfirst(f,&dec0_ram[0x3e9c],4*10);
                        osd_fread_msbfirst(f,&dec0_ram[0x3ecc],4*10);
                        osd_fclose(f);
                }
                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}

static void hbarrel_hisave(void)
{
        void *f;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite_msbfirst(f,&dec0_ram[0x3e9c],4*10);
                osd_fwrite_msbfirst(f,&dec0_ram[0x3ecc],4*10);
                osd_fclose(f);
        }
}

static int hbarrelj_hiload(void)
{
        void *f;

        /* check if the hi score table has already been initialized */

        if (READ_WORD(&dec0_ram[0x3e78]) == 0x10 && READ_WORD(&dec0_ram[0x3e7c]) == 0x09 &&
			READ_WORD(&dec0_ram[0x3ecc]) == 0x55 && READ_WORD(&dec0_ram[0x3ece]) == 0x4d26 )
        {
                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread_msbfirst(f,&dec0_ram[0x3e78],4*10);
                        osd_fread_msbfirst(f,&dec0_ram[0x3ea8],4*10);
                        osd_fclose(f);
                }
                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}

static void hbarrelj_hisave(void)
{
        void *f;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite_msbfirst(f,&dec0_ram[0x3e78],4*10);
                osd_fwrite_msbfirst(f,&dec0_ram[0x3ea8],4*10);
   

⌨️ 快捷键说明

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