📄 rthunder.c
字号:
{ 0x1000, 0x13ff, shared_w },
{ 0x1400, 0x1fff, MWA_RAM },
{ 0x2000, 0x2000, YM2151_register_port_0_w },
{ 0x2001, 0x2001, YM2151_data_port_0_w },
{ 0xb000, 0xb000, MWA_NOP }, /* irq ack? */
{ 0xb800, 0xb800, watchdog_reset_w }, /* watchdog? */
{ 0x4000, 0xbfff, MWA_ROM },
{ 0xf000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
/*******************************************************************/
INPUT_PORTS_START( input_ports )
PORT_START
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Looks like cocktail control */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
PORT_BITX( 0x80, 0x80, IPT_SERVICE | IPF_TOGGLE, "Service Switch", OSD_KEY_F1, IP_JOY_NONE, 0 )
PORT_START
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Looks like cocktail control */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* DSWA */
PORT_DIPNAME( 0x03, 0x00, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x01, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x02, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x03, "3 Coins/1 Credit" )
PORT_DIPNAME( 0x04, 0x00, "Screen Hold", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x04, "On" )
PORT_DIPNAME( 0x08, 0x00, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x08, "On" )
PORT_DIPNAME( 0x10, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x60, 0x00, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x20, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x40, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x60, "3 Coins/1 Credit" )
PORT_BITX( 0x80, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x80, "On" )
PORT_START /* DSWB */
PORT_DIPNAME( 0x01, 0x00, "Continues", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "6" )
PORT_DIPSETTING( 0x01, "3" )
PORT_DIPNAME( 0x06, 0x00, "Cabinet type", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "A" ) /* Normal */
PORT_DIPSETTING( 0x02, "B" ) /* Screen Flipped */
/* PORT_DIPSETTING( 0x04, "INVALID" ) */
PORT_DIPSETTING( 0x06, "C" ) /* Cocktail */
PORT_DIPNAME( 0x08, 0x08, "Level Select", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x08, "On" )
PORT_DIPNAME( 0x10, 0x00, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Normal" )
PORT_DIPSETTING( 0x10, "Easy" )
PORT_DIPNAME( 0x20, 0x20, "Timer value", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "120 secs" )
PORT_DIPSETTING( 0x20, "150 secs" )
PORT_DIPNAME( 0x40, 0x00, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "70K, 200K" )
PORT_DIPSETTING( 0x40, "100K, 300K" )
PORT_DIPNAME( 0x80, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x80, "5" )
PORT_START
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Looks like cocktail control */
INPUT_PORTS_END
/*******************************************************************/
static struct GfxLayout tile_layout =
{
8,8,
2048*3,
3,
{ 0xc000*8*2, 0, 0xc000*8 },
{ 0,1,2,3,4,5,6,7 },
{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 },
8*8
};
static struct GfxLayout sprite_layout =
{
16,16,
4096,
4,
{ 0,1,2,3 },
{ 0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4,
8*4,9*4,10*4,11*4,12*4,13*4,14*4,15*4 },
{ 0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64,
8*64,9*64,10*64,11*64,12*64,13*64,14*64,15*64 },
16*64
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ MEM_GFX_TILES, 0x00000, &tile_layout, 2048*0, 256 },
{ MEM_GFX_SPRITES, 0x00000, &sprite_layout, 2048*1, 128 },
{ -1 }
};
/*******************************************************************/
static struct YM2151interface ym2151_interface =
{
1, /* 1 chip */
3579580, /* 3.579580 MHz ? */
{ 30 },
{ 0 },
{ 0 }
};
static struct namcos1_interface ns1_interface =
{
12000, /* Hz */
70, /* volume */
-1
};
static void rt_init_machine( void ) {
int_enabled[0] = int_enabled[1] = 1;
rt_stop_mcu_timer();
hd_regs[0x08] = 0;
}
static int rt_interrupt( void ) {
int cpu = cpu_getactivecpu();
if ( int_enabled[cpu] ) {
int_enabled[cpu] = 0;
return interrupt();
}
return ignore_interrupt();
}
static struct MachineDriver machine_driver =
{
{
{
CPU_M6809,
6000000, /* 6.0 MHz */
MEM_CPU1,
readmem1,writemem1,0,0,
rt_interrupt,1
},
{
CPU_M6809,
6000000, /* 6.0 MHz */
MEM_CPU2,
readmem2,writemem2,0,0,
rt_interrupt,1
},
{
CPU_HD63701, /* or compatible 6808 with extra instructions */
4000000, /* 4.0 Mhz */
MEM_MCU,
mcu_readmem,mcu_writemem,0,0,
interrupt, 1 /* irq's triggered by the main cpu */
}
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
100, /* cpu slices */
&rt_init_machine, /* init machine */
/* video hardware */
288, 224, { 0, 287, 0, 223 },
gfxdecodeinfo,
256,4096,
rthunder_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
rthunder_vh_start,
rthunder_vh_stop,
rthunder_vh_screenrefresh,
/* sound hardware */
SOUND_SUPPORTS_STEREO,0,0,0,
{
{
SOUND_YM2151,
&ym2151_interface
},
{
SOUND_NAMCOS1,
&ns1_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( rthunder_rom )
ROM_REGION( 0x10000 ) /* 6809 code for CPU1 */
ROM_LOAD( "rt3-1b.rom", 0x8000, 0x8000, 0x7d252a1b )
ROM_REGION( 0x40000 ) /* bank switched data for CPU1 */
ROM_LOAD( "rt1-17.rom", 0x00000, 0x10000, 0x766af455 )
ROM_LOAD( "rt1-18.rom", 0x10000, 0x10000, 0x3f9f2f5d )
ROM_LOAD( "rt3-19.rom", 0x20000, 0x10000, 0xc16675e9 )
ROM_LOAD( "rt3-20.rom", 0x30000, 0x10000, 0xc470681b )
ROM_REGION( 0x10000 ) /* 6809 code for CPU2 */
ROM_LOAD( "rt3-2b.rom", 0x8000, 0x8000, 0xa7ea46ee )
ROM_REGION( 0x8000 ) /* bank switched data for CPU2 */
ROM_LOAD( "rt3-3.rom", 0x0000, 0x8000, 0xa13f601c )
ROM_REGION( 0x24000 ) /* tiles */
ROM_LOAD( "rt1-7.rom", 0x00000, 0x10000, 0xa85efa39 ) /* plane 1,2 */
ROM_LOAD( "rt1-5.rom", 0x10000, 0x08000, 0xd0fc470b )
ROM_LOAD( "rt1-8.rom", 0x18000, 0x08000, 0xf7a95820 ) /* plane 3 */
ROM_LOAD( "rt1-6.rom", 0x20000, 0x04000, 0x6b57edb2 )
ROM_REGION( 0x80000 ) /* sprites */
ROM_LOAD( "rt1-9.rom", 0x00000, 0x10000, 0x8e070561 )
ROM_LOAD( "rt1-10.rom", 0x10000, 0x10000, 0xcb8fb607 )
ROM_LOAD( "rt1-11.rom", 0x20000, 0x10000, 0x2bdf5ed9 )
ROM_LOAD( "rt1-12.rom", 0x30000, 0x10000, 0xe6c6c7dc )
ROM_LOAD( "rt1-13.rom", 0x40000, 0x10000, 0x489686d7 )
ROM_LOAD( "rt1-14.rom", 0x50000, 0x10000, 0x689e56a8 )
ROM_LOAD( "rt1-15.rom", 0x60000, 0x10000, 0x1d8bf2ca )
ROM_LOAD( "rt1-16.rom", 0x70000, 0x10000, 0x1bbcf37b )
ROM_REGION( 4096+512 ) /* color proms */
ROM_LOAD( "rt1-3.bin", 2048*0, 2048, 0x95c7d944 ) /* tiles colortable */
ROM_LOAD( "rt1-4.bin", 2048*1, 2048, 0x1391fec9 ) /* sprites colortable */
ROM_LOAD( "rt1-1.bin", 4096+0*256, 256, 0xa6834adb ) /* red & green components */
ROM_LOAD( "rt1-2.bin", 4096+1*256, 256, 0x1be31e81 ) /* blue component */
ROM_REGION( 0x10000 ) /* MCU data */
ROM_LOAD( "rt3-4.rom", 0x04000, 0x8000, 0x00cf293f )
ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
#if 0
ROM_REGION( 0x20000 ) /* PCM samples for Hitachi CPU */
ROM_LOAD( "rt1-21.rom", 0x00000, 0x10000, 0x454968f3 )
ROM_LOAD( "rt2-22.rom", 0x10000, 0x10000, 0xfe963e72 )
ROM_REGION( 32 ) /* ??? */
ROM_LOAD( "rt1-5.bin", 0x0000, 0x0020, 1 )
#endif
ROM_END
static void rthunder_gfx_untangle( void ) {
/* shuffle tile ROMs so regular gfx unpack routines can be used */
int size = 0x18000;
unsigned char *gfx = Machine->memory_region[MEM_GFX_TILES];
unsigned char *buffer = malloc( size );
if ( buffer ) {
unsigned char *dest1 = gfx;
unsigned char *dest2 = gfx + ( size / 2 );
unsigned char *mono = gfx + size;
int i;
memcpy( buffer, gfx, size );
for ( i = 0; i < size; i += 2 ) {
unsigned char data1 = buffer[i];
unsigned char data2 = buffer[i+1];
*dest1++ = ( data1 & 0xf0 ) | ( data2 >> 4 );
*dest2++ = ( data1 << 4 ) | ( data2 & 0xf );
*mono ^= 0xff; mono++;
}
free( buffer );
}
}
struct GameDriver rthunder_driver =
{
__FILE__,
0,
"rthunder",
"Rolling Thunder",
"1986",
"Namco",
"Jimmy Hamm\nPhil Stroffolino\nErnesto Corvi",
0,
&machine_driver,
0,
rthunder_rom,
rthunder_gfx_untangle, 0,
0,
0, /* sound prom */
input_ports,
PROM_MEMORY_REGION(MEM_COLOR), 0, 0,
ORIENTATION_DEFAULT,
0,0
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -