📄 gsword.c
字号:
{ -1 }
};
static struct MemoryWriteAddress writemem_cpu3[] =
{
{ 0x0000, 0x5fff, MWA_ROM },
{ 0x6000, 0x7fff, MWA_NOP },
{ 0x8001, 0xffff, MWA_NOP },
{ -1 }
};
static struct IOReadPort readport[] =
{
{ 0x00, 0xff, gsword_port_c1r },
{ -1 }
};
static struct IOWritePort writeport[] =
{
{ 0x00, 0xff, gsword_port_c1w },
{ -1 }
};
static struct IOReadPort readport_cpu2[] =
{
{ 0x00, 0xff, gsword_port_c2r },
{ -1 }
};
static struct IOWritePort writeport_cpu2[] =
{
{ 0x00, 0xFF, gsword_port_c2w },
{ -1 }
};
INPUT_PORTS_START( input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN)
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BITX(0x80, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE, "Coin A", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1)
PORT_START /* DSW0 */
/* NOTE: Switches 0 & 1, 6,7,8 not used */
/* Coins configurations were handled */
/* via external hardware & not via program */
PORT_DIPNAME( 0x1c, 0x00, "Coin#1", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x04, "1 Coin/2 Credit" )
PORT_DIPSETTING( 0x08, "1 Coin/4 Credit" )
PORT_DIPSETTING( 0x0c, "1 Coin/5 Credit" )
PORT_DIPSETTING( 0x14, "2 Coin/1 Credit" )
PORT_DIPSETTING( 0x18, "4 Coin/1 Credit" )
PORT_DIPSETTING( 0x1c, "5 Coin/1 Credit" )
PORT_START /* DSW1 */
/* NOTE: Switches 0 & 1 not used */
PORT_DIPNAME( 0x0c, 0x04, "Stage 1 Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Easy" )
PORT_DIPSETTING( 0x04, "Normal" )
PORT_DIPSETTING( 0x08, "Hard" )
PORT_DIPSETTING( 0x0c, "Hardest" )
PORT_DIPNAME( 0x10, 0x10, "Stage 2 Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Easy" )
PORT_DIPSETTING( 0x10, "Hard" )
PORT_DIPNAME( 0x20, 0x20, "Stage 3 Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Easy" )
PORT_DIPSETTING( 0x20, "Hard" )
PORT_DIPNAME( 0x40, 0x40, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x40, "On" )
PORT_DIPNAME( 0x80, 0x00, "Free Game Round", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x80, "On" )
PORT_START /* DSW2 */
/* NOTE: Switches 0 & 1 not used */
PORT_DIPNAME( 0x04, 0x00, "Free Play", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x04, "Yes" )
PORT_DIPNAME( 0x88, 0x80, "Cabinet Type", IP_KEY_NONE )
PORT_DIPSETTING( 0x88, "Cocktail" )
PORT_DIPSETTING( 0x80, "Upright" )
PORT_DIPNAME( 0x30, 0x00, "Stage Begins", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Fencing" )
PORT_DIPSETTING( 0x10, "Kendo" )
PORT_DIPSETTING( 0x20, "Rome" )
PORT_DIPSETTING( 0x30, "Kendo" )
PORT_DIPNAME( 0x40, 0x00, "Video Flip", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x40, "Yes" )
INPUT_PORTS_END
static struct GfxLayout gsword_text =
{
8,8, /* 8x8 characters */
1024, /* 1024 characters */
2, /* 2 bits per pixel */
{ 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
16*8 /* every char takes 16 bytes */
};
static struct GfxLayout gsword_sprites1 =
{
16,16, /* 16x16 sprites */
64*2, /* 128 sprites */
2, /* 2 bits per pixel */
{ 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3},
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
64*8 /* every sprite takes 64 bytes */
};
static struct GfxLayout gsword_sprites2 =
{
32,32, /* 32x32 sprites */
64, /* 64 sprites */
2, /* 2 bits per pixel */
{ 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3,
64*8+0, 64*8+1, 64*8+2, 64*8+3, 72*8+0, 72*8+1, 72*8+2, 72*8+3,
80*8+0, 80*8+1, 80*8+2, 80*8+3, 88*8+0, 88*8+1, 88*8+2, 88*8+3},
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8,
128*8, 129*8, 130*8, 131*8, 132*8, 133*8, 134*8, 135*8,
160*8, 161*8, 162*8, 163*8, 164*8, 165*8, 166*8, 167*8 },
64*8*4 /* every sprite takes (64*8=16x6)*4) bytes */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
/* character set */
{ 1, 0x00000, &gsword_text, 0, 64 },
{ 1, 0x04000, &gsword_sprites1, 64*4, 64 },
{ 1, 0x06000, &gsword_sprites2, 64*4, 64 },
{ -1 } /* end of array */
};
static struct AY8910interface ay8910_interface =
{
2, /* 2 chips */
1500000, /* 1.5 MHZ ?????? */
{ 255, 255 },
{ 0,0 },
{ 0,0 },
{ 0,0 },
{ 0,0 }
};
static struct MSM5205interface msm5205_interface =
{
2, /* 2 chips */
4000, /* 4000Hz playback ? */
0, /* interrupt function */
{ 255, 255 }
};
static struct MachineDriver machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
3072000, /* 3.072 Mhz ? */
0,
gsword_readmem,gsword_writemem,
readport,writeport,
interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
3140000, /* 3.140 Mhz ? */
3,
readmem_cpu2,writemem_cpu2,
readport_cpu2,writeport_cpu2,
ignore_interrupt,0
},
{
CPU_Z80 | CPU_AUDIO_CPU,
3140000, /* 3.140 Mhz ? */
4,
readmem_cpu3,writemem_cpu3,
0,0,
ignore_interrupt,0
}
},
60, DEFAULT_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
10, /* Allow time for 2nd cpu to interleave*/
0,
/* video hardware */
32*8, 32*8,{ 0*8, 32*8-1, 2*8, 30*8-1 },
gfxdecodeinfo,
256, 64*4+64*4,
gsword_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
gsword_vh_start,
gsword_vh_stop,
gsword_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
},
{
SOUND_MSM5205,
&msm5205_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( gsword_rom )
ROM_REGION(0x10000) /* 64K for main CPU */
ROM_LOAD( "gs1", 0x0000, 0x2000, 0x565c4d9e )
ROM_LOAD( "gs2", 0x2000, 0x2000, 0xd772accf )
ROM_LOAD( "gs3", 0x4000, 0x2000, 0x2cee1871 )
ROM_LOAD( "gs4", 0x6000, 0x2000, 0xca9d206d )
ROM_LOAD( "gs5", 0x8000, 0x1000, 0x2a892326 )
ROM_REGION_DISPOSE(0xa000) /* graphics (disposed after conversion) */
ROM_LOAD( "gs10", 0x0000, 0x2000, 0x517c571b ) /* tiles */
ROM_LOAD( "gs11", 0x2000, 0x2000, 0x7a1d8a3a )
ROM_LOAD( "gs6", 0x4000, 0x2000, 0x1b0a3cb7 ) /* sprites */
ROM_LOAD( "gs7", 0x6000, 0x2000, 0xef5f28c6 )
ROM_LOAD( "gs8", 0x8000, 0x2000, 0x46824b30 )
ROM_REGION(0x0360) /* color PROMs */
ROM_LOAD( "ac0-1.bpr", 0x0000, 0x0100, 0x5c4b2adc ) /* palette high bits */
ROM_LOAD( "ac0-2.bpr", 0x0100, 0x0100, 0x966bda66 ) /* palette low bits */
ROM_LOAD( "ac0-3.bpr", 0x0200, 0x0100, 0xdae13f77 ) /* sprite lookup table? */
ROM_LOAD( "003", 0x0300, 0x0020, 0x43a548b8 ) /* address decoder? not used */
ROM_LOAD( "004", 0x0320, 0x0020, 0x43a548b8 ) /* address decoder? not used */
ROM_LOAD( "005", 0x0340, 0x0020, 0xe8d6dec0 ) /* address decoder? not used */
ROM_REGION(0x10000) /* 64K for 2nd CPU */
ROM_LOAD( "gs15", 0x0000, 0x2000, 0x1aa4690e )
ROM_LOAD( "gs16", 0x2000, 0x2000, 0x10accc10 )
ROM_REGION(0x10000) /* 64K for 3nd z80 */
ROM_LOAD( "gs12", 0x0000, 0x2000, 0xa6589068 )
ROM_LOAD( "gs13", 0x2000, 0x2000, 0x4ee79796 )
ROM_LOAD( "gs14", 0x4000, 0x2000, 0x455364b6 )
ROM_END
static int gsword_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];
/* Work RAM - 9c00 (3*10 for scores), 9c78(6*10 for names)*/
/* check if the hi score table has already been initialized */
if( memcmp(&RAM[0x9c00],"\x00\x00\x01",3) == 0)
{
void *f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0);
if (f)
{
osd_fread(f,&RAM[0x9c00],3*10);
osd_fread(f,&RAM[0x9c78],6*10);
osd_fclose(f);
}
return 1;
}
return 0; /* we can't load the hi scores yet */
}
static void gsword_hisave(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];
void *f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1);
if (f)
{
osd_fwrite(f,&RAM[0x9c00],3*10);
osd_fwrite(f,&RAM[0x9c78],6*10);
osd_fclose(f);
}
}
struct GameDriver gsword_driver =
{
__FILE__,
0,
"gsword",
"Great Swordsman",
"1984",
"Taito",
"Steve Ellenoff\nJarek Parchanski\n",
GAME_WRONG_COLORS,
&machine_driver,
0,
gsword_rom,
0, 0,
0,
0, /* sound_prom */
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
gsword_hiload, gsword_hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -