📄 kchamp.c
字号:
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x80, 0x80, "Free Play", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
/********************
* 1 Player Version *
********************/
INPUT_PORTS_START( kc_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT | IPF_4WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP | IPF_4WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN | IPF_4WAY )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT | IPF_4WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT | IPF_4WAY )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN | IPF_4WAY )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN | IPF_PLAYER2 | IPF_4WAY )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x03, 0x03, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x01, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x03, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x02, "1 Coin/2 Credits" )
PORT_DIPNAME( 0x0c, 0x0c, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x04, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x0c, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x08, "1 Coin/2 Credits" )
PORT_DIPNAME( 0x10, 0x10, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x20, 0x20, "Free Play", IP_KEY_NONE )
PORT_DIPSETTING( 0x20, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x40, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x80, 0x80, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
static struct GfxLayout tilelayout =
{
8,8, /* tile size */
256*8, /* number of tiles */
2, /* bits per pixel */
{ 0x4000*8, 0 }, /* plane offsets */
{ 0,1,2,3,4,5,6,7 }, /* x offsets */
{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, /* y offsets */
8*8 /* offset to next tile */
};
static struct GfxLayout spritelayout =
{
16,16, /* tile size */
512, /* number of tiles */
2, /* bits per pixel */
{ 0xC000*8, 0 }, /* plane offsets */
{ 0,1,2,3,4,5,6,7,
0x2000*8+0,0x2000*8+1,0x2000*8+2,0x2000*8+3,
0x2000*8+4,0x2000*8+5,0x2000*8+6,0x2000*8+7 }, /* x offsets */
{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,
8*8,9*8,10*8,11*8,12*8,13*8,14*8, 15*8 }, /* y offsets */
16*8 /* ofset to next tile */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ 1, 0x18000, &tilelayout, 32*4, 32 },
{ 1, 0x08000, &spritelayout, 0, 16 },
{ 1, 0x04000, &spritelayout, 0, 16 },
{ 1, 0x00000, &spritelayout, 0, 16 },
{ -1 }
};
static int kc_interrupt( void ) {
if ( nmi_enable )
return Z80_NMI_INT;
return Z80_IGNORE_INT;
}
static void msmint( int data ) {
static int counter = 0;
if ( msm_play_lo_nibble )
MSM5205_data_w( 0, msm_data & 0x0f );
else
MSM5205_data_w( 0, ( msm_data >> 4 ) & 0x0f );
msm_play_lo_nibble ^= 1;
if ( !( counter ^= 1 ) ) {
if ( sound_nmi_enable ) {
cpu_cause_interrupt( 1, Z80_NMI_INT );
}
}
}
static struct AY8910interface ay8910_interface =
{
2, /* 2 chips */
1500000, /* 12 Mhz / 8 = 1.5 Mhz */
{ 50, 50 },
{ 0 },
{ 0 },
{ 0 },
{ 0 }
};
static struct MSM5205interface msm_interface =
{
1, /* 1 chips */
3906, /* 12Mhz / 16 / 2 / 96 = 3906.25Hz playback */
&msmint, /* irq */
{ 100 }
};
/********************
* 1 Player Version *
********************/
static int sound_int( void ) {
if ( sound_nmi_enable )
return Z80_NMI_INT;
return Z80_IGNORE_INT;
}
static struct DACinterface dac_interface =
{
1,
{ 100 }
};
static struct MachineDriver kchampvs_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
3000000, /* 12Mhz / 4 = 3.0 Mhz */
0,
readmem,writemem,readport,writeport,
kc_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
3000000, /* 12Mhz / 4 = 3.0 Mhz */
3,
sound_readmem,sound_writemem,sound_readport,sound_writeport,
ignore_interrupt, 0
/* irq's triggered from main cpu */
/* nmi's from msm5205 */
}
},
60,DEFAULT_60HZ_VBLANK_DURATION,
1, /* Interleaving forced by interrupts */
0, /* init machine */
/* video hardware */
32*8, 32*8, { 0, 32*8-1, 2*8, 30*8-1 },
gfxdecodeinfo,
256, /* number of colors */
256, /* color table length */
kchamp_vh_convert_color_prom,
VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
0,
kchampvs_vh_start,
generic_vh_stop,
kchamp_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
},
{
SOUND_MSM5205,
&msm_interface
}
}
};
/********************
* 1 Player Version *
********************/
static struct MachineDriver kchamp_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
3000000, /* 12Mhz / 4 = 3.0 Mhz */
0,
kc_readmem, kc_writemem, kc_readport, kc_writeport,
kc_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
3000000, /* 12Mhz / 4 = 3.0 Mhz */
3,
kc_sound_readmem,kc_sound_writemem,kc_sound_readport,kc_sound_writeport,
ignore_interrupt, 0,
sound_int, 125 /* Hz */
/* irq's triggered from main cpu */
/* nmi's from 125 Hz clock */
}
},
60,DEFAULT_60HZ_VBLANK_DURATION,
1, /* Interleaving forced by interrupts */
0, /* init machine */
/* video hardware */
32*8, 32*8, { 0, 32*8-1, 2*8, 30*8-1 },
gfxdecodeinfo,
256, /* number of colors */
256, /* color table length */
kchamp_vh_convert_color_prom,
VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
0,
kchamp1p_vh_start,
generic_vh_stop,
kchamp_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
},
{
SOUND_DAC,
&dac_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( kchampvs_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "bs24", 0x0000, 0x2000, 0x829da69b )
ROM_LOAD( "bs23", 0x2000, 0x2000, 0x091f810e )
ROM_LOAD( "bs22", 0x4000, 0x2000, 0xd4df2a52 )
ROM_LOAD( "bs21", 0x6000, 0x2000, 0x3d4ef0da )
ROM_LOAD( "bs20", 0x8000, 0x2000, 0x623a467b )
ROM_LOAD( "bs19", 0xa000, 0x4000, 0x43e196c4 )
ROM_REGION_DISPOSE(0x20000)
ROM_LOAD( "bs00", 0x00000, 0x2000, 0x51eda56c ) /* top, plane0 */ /* sprites */
ROM_LOAD( "bs06", 0x02000, 0x2000, 0x593264cf ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "bs01", 0x04000, 0x2000, 0xb4842ea9 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "bs07", 0x06000, 0x2000, 0x8cd166a5 ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "bs02", 0x08000, 0x2000, 0x4cbd3aa3 ) /* top, plane0 */ /* sprites */
ROM_LOAD( "bs08", 0x0A000, 0x2000, 0x6be342a6 ) /* bot, plane0 */ /* sprites */
ROM_LOAD( "bs03", 0x0C000, 0x2000, 0x8dcd271a ) /* top, plane1 */ /* sprites */
ROM_LOAD( "bs09", 0x0E000, 0x2000, 0x4ee1dba7 ) /* bot, plane1 */ /* sprites */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -