📄 mcr2.c
字号:
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN4 -- player 2 spinner */
PORT_ANALOG( 0xff, 0x00, IPT_DIAL | IPF_REVERSE | IPF_PLAYER2, 10, 0, 0, 0 )
PORT_START /* AIN0 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
/***************************************************************************
Graphics layouts
***************************************************************************/
/* note that characters are half the resolution of sprites in each direction, so we generate
them at double size */
/* 512 characters; used by all the mcr2 games */
static struct GfxLayout mcr2_charlayout_512 =
{
16, 16,
512,
4,
{ 512*16*8, 512*16*8+1, 0, 1 },
{ 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14 },
{ 0, 0, 2*8, 2*8, 4*8, 4*8, 6*8, 6*8, 8*8, 8*8, 10*8, 10*8, 12*8, 12*8, 14*8, 14*8 },
16*8
};
/* 64 sprites; used by all mcr2 games but Journey */
#define X (64*128*8)
#define Y (2*X)
#define Z (3*X)
static struct GfxLayout mcr2_spritelayout_64 =
{
32,32,
64,
4,
{ 0, 1, 2, 3 },
{ Z+0, Z+4, Y+0, Y+4, X+0, X+4, 0, 4, Z+8, Z+12, Y+8, Y+12, X+8, X+12, 8, 12,
Z+16, Z+20, Y+16, Y+20, X+16, X+20, 16, 20, Z+24, Z+28, Y+24, Y+28,
X+24, X+28, 24, 28 },
{ 0, 32, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7, 32*8, 32*9, 32*10, 32*11,
32*12, 32*13, 32*14, 32*15, 32*16, 32*17, 32*18, 32*19, 32*20, 32*21,
32*22, 32*23, 32*24, 32*25, 32*26, 32*27, 32*28, 32*29, 32*30, 32*31 },
128*8
};
#undef X
#undef Y
#undef Z
/* 128 sprites; used by Journey - it features an mcr3 spriteboard */
#define X (128*128*8)
#define Y (2*X)
#define Z (3*X)
static struct GfxLayout mcr3_spritelayout_128 =
{
32,32,
128,
4,
{ 0, 1, 2, 3 },
{ Z+0, Z+4, Y+0, Y+4, X+0, X+4, 0, 4, Z+8, Z+12, Y+8, Y+12, X+8, X+12, 8, 12,
Z+16, Z+20, Y+16, Y+20, X+16, X+20, 16, 20, Z+24, Z+28, Y+24, Y+28,
X+24, X+28, 24, 28 },
{ 0, 32, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7, 32*8, 32*9, 32*10, 32*11,
32*12, 32*13, 32*14, 32*15, 32*16, 32*17, 32*18, 32*19, 32*20, 32*21,
32*22, 32*23, 32*24, 32*25, 32*26, 32*27, 32*28, 32*29, 32*30, 32*31 },
128*8
};
#undef X
#undef Y
#undef Z
static struct GfxDecodeInfo mcr2_gfxdecodeinfo[] =
{
{ 1, 0x0000, &mcr2_charlayout_512, 0, 4 }, /* colors 0-63 */
{ 1, 0x4000, &mcr2_spritelayout_64, 16, 1 }, /* colors 16-31 */
{ -1 } /* end of array */
};
/* Wacko uses different colors for the sprites */
static struct GfxDecodeInfo wacko_gfxdecodeinfo[] =
{
{ 1, 0x0000, &mcr2_charlayout_512, 0, 4 }, /* colors 0-63 */
{ 1, 0x4000, &mcr2_spritelayout_64, 0, 1 }, /* colors 0-15 */
{ -1 } /* end of array */
};
static struct GfxDecodeInfo journey_gfxdecodeinfo[] =
{
{ 1, 0x0000, &mcr2_charlayout_512, 0, 4 }, /* colors 0-63 */
{ 1, 0x4000, &mcr3_spritelayout_128, 0, 4 }, /* colors 0-63 */
{ -1 } /* end of array */
};
/***************************************************************************
Sound interfaces
***************************************************************************/
static struct AY8910interface ay8910_interface =
{
2, /* 2 chips */
2000000, /* 2 MHz ?? */
{ 255, 255 },
{ 0 },
{ 0 },
{ 0 },
{ 0 }
};
/***************************************************************************
Machine drivers
***************************************************************************/
static struct MachineDriver mcr2_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
2500000, /* 2.5 Mhz */
0,
mcr2_readmem,mcr2_writemem,readport,writeport,
mcr_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
2000000, /* 2 Mhz */
2, /* memory region #2 */
sound_readmem,sound_writemem,0,0,
interrupt,26
}
},
30, DEFAULT_30HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - sound CPU has enough interrupts to handle synchronization */
mcr_init_machine,
/* video hardware */
32*16, 30*16, { 0, 32*16-1, 0, 30*16-1 },
mcr2_gfxdecodeinfo,
64, 64,
0,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,
0,
generic_vh_start,
generic_vh_stop,
mcr2_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
}
}
};
static struct MachineDriver wacko_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
2500000, /* 2.5 Mhz */
0,
mcr2_readmem,mcr2_writemem,readport,writeport,
mcr_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
2000000, /* 2 Mhz */
2, /* memory region #2 */
sound_readmem,sound_writemem,0,0,
interrupt,26
}
},
30, DEFAULT_30HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - sound CPU has enough interrupts to handle synchronization */
mcr_init_machine,
/* video hardware */
32*16, 30*16, { 0, 32*16-1, 0, 30*16-1 },
wacko_gfxdecodeinfo,
64, 64,
0,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,
0,
generic_vh_start,
generic_vh_stop,
mcr2_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
}
}
};
static struct MachineDriver kroozr_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
2500000, /* 2.5 Mhz */
0,
mcr2_readmem,mcr2_writemem,kroozr_readport,writeport,
mcr_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
2000000, /* 2 Mhz */
2, /* memory region #2 */
sound_readmem,sound_writemem,0,0,
interrupt,26
}
},
30, DEFAULT_30HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - sound CPU has enough interrupts to handle synchronization */
mcr_init_machine,
/* video hardware */
32*16, 30*16, { 0, 32*16-1, 0, 30*16-1 },
mcr2_gfxdecodeinfo,
64, 64,
0,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,
0,
generic_vh_start,
generic_vh_stop,
mcr2_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
}
}
};
static struct MachineDriver journey_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
7500000, /* Looks like it runs at 7.5 Mhz rather than 5 or 2.5 */
0,
journey_readmem,journey_writemem,readport,writeport,
mcr_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
2000000, /* 2 Mhz */
2, /* memory region #2 */
sound_readmem,sound_writemem,0,0,
interrupt,26
}
},
30, DEFAULT_30HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - sound CPU has enough interrupts to handle synchronization */
mcr_init_machine,
/* video hardware */
32*16, 30*16, { 0, 32*16-1, 0, 30*16-1 },
journey_gfxdecodeinfo,
64, 64,
0,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,
0,
journey_vh_start,
generic_vh_stop,
journey_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
}
}
};
/***************************************************************************
High score save/load
***************************************************************************/
static int mcr2_hiload(int addr, int len)
{
unsigned char *RAM = Machine->memory_region[0];
/* see if it's okay to load */
if (mcr_loadnvram)
{
void *f;
f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0);
if (f)
{
osd_fread(f,&RAM[addr],len);
osd_fclose (f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void mcr2_hisave(int addr, int len)
{
unsigned char *RAM = Machine->memory_region[0];
void *f;
f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1);
if (f)
{
osd_fwrite(f,&RAM[addr],len);
osd_fclose (f);
}
}
static int shollow_hiload(void) { return mcr2_hiload(0xc600, 0x8a); }
static void shollow_hisave(void) { mcr2_hisave(0xc600, 0x8a); }
static int tron_hiload(void) { return mcr2_hiload(0xc4f0, 0x97); }
static void tron_hisave(void) { mcr2_hisave(0xc4f0, 0x97); }
static int kroozr_hiload(void) { return mcr2_hiload(0xc466, 0x95); }
static void kroozr_hisave(void) { mcr2_hisave(0xc466, 0x95); }
static int domino_hiload(void) { return mcr2_hiload(0xc000, 0x92); }
static void domino_hisave(void) { mcr2_hisave(0xc000, 0x92); }
static int wacko_hiload(void) { return mcr2_hiload(0xc000, 0x91); }
static void wacko_hisave(void) { mcr2_hisave(0xc000, 0x91); }
static int twotiger_hiload(void) { return mcr2_hiload(0xc000, 0xa0); }
static void twotiger_hisave(void) { mcr2_hisave(0xc000, 0xa0); }
static int journey_hiload(void) { return mcr2_hiload(0xc000, 0x9e); }
static void journey_hisave(void) { mcr2_hisave(0xc000, 0x9e); }
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( shollow_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "sh-pro.00", 0x0000, 0x2000, 0x95e2b800 )
ROM_LOAD( "sh-pro.01", 0x2000, 0x2000, 0xb99f6ff8 )
ROM_LOAD( "sh-pro.02", 0x4000, 0x2000, 0x1202c7b2 )
ROM_LOAD( "sh-pro.03", 0x6000, 0x2000, 0x0a64afb9 )
ROM_LOAD( "sh-pro.04", 0x8000, 0x2000, 0x22fa9175 )
ROM_LOAD( "sh-pro.05", 0xa000, 0x2000, 0x1716e2bb )
ROM_REGION_DISPOSE(0x0c000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "sh-bg.00", 0x00000, 0x2000, 0x3e2b333c )
ROM_LOAD( "sh-bg.01", 0x02000, 0x2000, 0xd1d70cc4 )
ROM_LOAD( "sh-fg.03", 0x04000, 0x2000, 0x37ea9d07 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -