📄 ldrun.c
字号:
SOUND_AY8910,
&irem_ay8910_interface
},
{
SOUND_MSM5205,
&irem_msm5205_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( ldrun_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "lr-a-4e", 0x0000, 0x2000, 0x5d7e2a4d )
ROM_LOAD( "lr-a-4d", 0x2000, 0x2000, 0x96f20473 )
ROM_LOAD( "lr-a-4b", 0x4000, 0x2000, 0xb041c4a9 )
ROM_LOAD( "lr-a-4a", 0x6000, 0x2000, 0x645e42aa )
ROM_REGION_DISPOSE(0xc000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "lr-e-2d", 0x0000, 0x2000, 0x24f9b58d ) /* characters */
ROM_LOAD( "lr-e-2j", 0x2000, 0x2000, 0x43175e08 )
ROM_LOAD( "lr-e-2f", 0x4000, 0x2000, 0xe0317124 )
ROM_LOAD( "lr-b-4k", 0x6000, 0x2000, 0x8141403e ) /* sprites */
ROM_LOAD( "lr-b-3n", 0x8000, 0x2000, 0x55154154 )
ROM_LOAD( "lr-b-4c", 0xa000, 0x2000, 0x924e34d0 )
ROM_REGION(0x0620) /* color proms */
ROM_LOAD( "lr-e-3m", 0x0000, 0x0100, 0x53040416 ) /* character palette red component */
ROM_LOAD( "lr-b-1m", 0x0100, 0x0100, 0x4bae1c25 ) /* sprite palette red component */
ROM_LOAD( "lr-e-3l", 0x0200, 0x0100, 0x67786037 ) /* character palette green component */
ROM_LOAD( "lr-b-1n", 0x0300, 0x0100, 0x9cd3db94 ) /* sprite palette green component */
ROM_LOAD( "lr-e-3n", 0x0400, 0x0100, 0x5b716837 ) /* character palette blue component */
ROM_LOAD( "lr-b-1l", 0x0500, 0x0100, 0x08d8cf9a ) /* sprite palette blue component */
ROM_LOAD( "lr-b-5p", 0x0600, 0x0020, 0xe01f69e2 ) /* sprite height, one entry per 32 */
/* sprites. Used at run time! */
ROM_REGION(0x10000) /* 64k for the audio CPU (6803) */
ROM_LOAD( "lr-a-3f", 0xc000, 0x2000, 0x7a96accd ) /* samples (ADPCM 4-bit) */
ROM_LOAD( "lr-a-3h", 0xe000, 0x2000, 0x3f7f3939 )
ROM_END
ROM_START( ldruna_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "roma4c", 0x0000, 0x2000, 0x279421e1 )
ROM_LOAD( "lr-a-4d", 0x2000, 0x2000, 0x96f20473 )
ROM_LOAD( "roma4b", 0x4000, 0x2000, 0x3c464bad )
ROM_LOAD( "roma4a", 0x6000, 0x2000, 0x899df8e0 )
ROM_REGION_DISPOSE(0xc000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "lr-e-2d", 0x0000, 0x2000, 0x24f9b58d ) /* characters */
ROM_LOAD( "lr-e-2j", 0x2000, 0x2000, 0x43175e08 )
ROM_LOAD( "lr-e-2f", 0x4000, 0x2000, 0xe0317124 )
ROM_LOAD( "lr-b-4k", 0x6000, 0x2000, 0x8141403e ) /* sprites */
ROM_LOAD( "lr-b-3n", 0x8000, 0x2000, 0x55154154 )
ROM_LOAD( "lr-b-4c", 0xa000, 0x2000, 0x924e34d0 )
ROM_REGION(0x0620) /* color proms */
ROM_LOAD( "lr-e-3m", 0x0000, 0x0100, 0x53040416 ) /* character palette red component */
ROM_LOAD( "lr-b-1m", 0x0100, 0x0100, 0x4bae1c25 ) /* sprite palette red component */
ROM_LOAD( "lr-e-3l", 0x0200, 0x0100, 0x67786037 ) /* character palette green component */
ROM_LOAD( "lr-b-1n", 0x0300, 0x0100, 0x9cd3db94 ) /* sprite palette green component */
ROM_LOAD( "lr-e-3n", 0x0400, 0x0100, 0x5b716837 ) /* character palette blue component */
ROM_LOAD( "lr-b-1l", 0x0500, 0x0100, 0x08d8cf9a ) /* sprite palette blue component */
ROM_LOAD( "lr-b-5p", 0x0600, 0x0020, 0xe01f69e2 ) /* sprite height, one entry per 32 */
/* sprites. Used at run time! */
ROM_REGION(0x10000) /* 64k for the audio CPU (6803) */
ROM_LOAD( "lr-a-3f", 0xc000, 0x2000, 0x7a96accd ) /* samples (ADPCM 4-bit) */
ROM_LOAD( "lr-a-3h", 0xe000, 0x2000, 0x3f7f3939 )
ROM_END
ROM_START( ldrun2p_rom )
ROM_REGION(0x18000) /* 64k for code + 32k for banked ROM */
ROM_LOAD( "lr4-a-4e", 0x00000, 0x4000, 0x5383e9bf )
ROM_LOAD( "lr4-a-4d.c", 0x04000, 0x4000, 0x298afa36 )
ROM_LOAD( "lr4-v-4k", 0x10000, 0x8000, 0x8b248abd ) /* banked at 8000-bfff */
ROM_REGION_DISPOSE(0x24000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "lr4-v-2b", 0x00000, 0x4000, 0x4118e60a ) /* characters */
ROM_LOAD( "lr4-v-2d", 0x04000, 0x4000, 0x542bb5b5 )
ROM_LOAD( "lr4-v-2c", 0x08000, 0x4000, 0xc765266c )
ROM_LOAD( "lr4-b-4k", 0x0c000, 0x4000, 0xe7fe620c ) /* sprites */
ROM_LOAD( "lr4-b-4f", 0x10000, 0x4000, 0x6f0403db )
ROM_LOAD( "lr4-b-3n", 0x14000, 0x4000, 0xad1fba1b )
ROM_LOAD( "lr4-b-4n", 0x18000, 0x4000, 0x0e568fab )
ROM_LOAD( "lr4-b-4c", 0x1c000, 0x4000, 0x82c53669 )
ROM_LOAD( "lr4-b-4e", 0x20000, 0x4000, 0x767a1352 )
ROM_REGION(0x0620) /* color proms */
ROM_LOAD( "lr4-v-1m", 0x0000, 0x0100, 0xfe51bf1d ) /* character palette red component */
ROM_LOAD( "lr4-b-1m", 0x0100, 0x0100, 0x5d8d17d0 ) /* sprite palette red component */
ROM_LOAD( "lr4-v-1n", 0x0200, 0x0100, 0xda0658e5 ) /* character palette green component */
ROM_LOAD( "lr4-b-1n", 0x0300, 0x0100, 0xda1129d2 ) /* sprite palette green component */
ROM_LOAD( "lr4-v-1p", 0x0400, 0x0100, 0x0df23ebe ) /* character palette blue component */
ROM_LOAD( "lr4-b-1l", 0x0500, 0x0100, 0x0d89b692 ) /* sprite palette blue component */
ROM_LOAD( "lr4-b-5p", 0x0600, 0x0020, 0xe01f69e2 ) /* sprite height, one entry per 32 */
/* sprites. Used at run time! */
ROM_REGION(0x10000) /* 64k for the audio CPU (6803) */
ROM_LOAD( "lr4-a-3d", 0x8000, 0x4000, 0x86c6d445 )
ROM_LOAD( "lr4-a-3f", 0xc000, 0x4000, 0x097c6c0a )
ROM_END
static int ldrun_hiload(void)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if (memcmp(&RAM[0xE5E5],"\x01\x01\x00",3) == 0 &&
memcmp(&RAM[0xE6AA],"\x20\x20\x04",3) == 0 )
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0xE5E5],200);
osd_fclose(f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void ldrun_hisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0xE5E5],200);
osd_fclose(f);
}
}
static int ldrun2p_hiload(void)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if (memcmp(&RAM[0xE735],"\x00\x28\x76",3) == 0 &&
memcmp(&RAM[0xE7FA],"\x20\x20\x06",3) == 0 )
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0xE735],200);
osd_fclose(f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void ldrun2p_hisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0xE735],200);
osd_fclose(f);
}
}
struct GameDriver ldrun_driver =
{
__FILE__,
0,
"ldrun",
"Lode Runner (set 1)",
"1984",
"Irem (licensed from Broderbund)",
"Lee Taylor\nJohn Clegg\nAaron Giles (sound)",
0,
&machine_driver,
0,
ldrun_rom,
0, 0,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
ldrun_hiload, ldrun_hisave
};
struct GameDriver ldruna_driver =
{
__FILE__,
&ldrun_driver,
"ldruna",
"Lode Runner (set 2)",
"1984",
"Irem (licensed from Broderbund)",
"Lee Taylor\nJohn Clegg\nAaron Giles (sound)",
0,
&machine_driver,
0,
ldruna_rom,
0, 0,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
ldrun_hiload, ldrun_hisave
};
struct GameDriver ldrun2p_driver =
{
__FILE__,
0,
"ldrun2p",
"Lode Runner IV - Teikoku Karano Dasshutsu",
"1986",
"Irem (licensed from Broderbund)",
"Lee Taylor\nJohn Clegg\nAaron Giles (sound)\nNicola Salmoria",
0,
&ldrun2p_machine_driver,
0,
ldrun2p_rom,
0, 0,
0,
0,
ldrun2p_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
ldrun2p_hiload, ldrun2p_hisave
};
/***************************************************************************
Kid Niki
1986 Irem (licensed to Data East)
Spelunker (needs fixed colors)
1986 Irem (licensed from Broderbund)
Z80 (main CPU)
sound: 6803 + YM2149(2) + OKI M5205(2)
***************************************************************************/
extern void irem_background_hscroll_w( int offset, int data );
extern void irem_background_vscroll_w( int offset, int data );
extern void irem_text_vscroll_w( int offset, int data );
extern void irem_background_bank_w( int offset, int data );
extern void irem_vh_stop( void );
extern int kidniki_vh_start( void );
extern int spelunk2_vh_start( void );
extern void kidniki_vh_screenrefresh( struct osd_bitmap *bitmap, int fullrefresh );
extern void spelunk2_vh_screenrefresh( struct osd_bitmap *bitmap, int fullrefresh );
extern unsigned char *irem_textram;
/* memory regions */
#define MEM_MAIN_CPU 0
#define MEM_SOUND_CPU 1
#define MEM_TILES 2
#define MEM_CHARS 3
#define MEM_SPRITES 4
#define MEM_COLOR 5
#define MEM_SPR_SIZE 6
/* graphics banks */
#define GFX_TILES 0
#define GFX_CHARS 1
#define GFX_SPRITES 2
static void background_tilemap_w( int offset, int data ){
videoram[offset] = data;
dirtybuffer[offset/2] = 1;
}
INPUT_PORTS_START( kidniki_input_ports )
PORT_START
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_START
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL )
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_COCKTAIL )
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_COCKTAIL )
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_COCKTAIL )
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN | IPF_COCKTAIL )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN | IPF_COCKTAIL )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
PORT_START /* coinage not yet verified - copied from Vigilante */
PORT_DIPNAME( 0xF0, 0xF0, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0xA0, "6 Coins/1 Credit" )
PORT_DIPSETTING( 0xB0, "5 Coins/1 Credit" )
PORT_DIPSETTING( 0xC0, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0xD0, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x10, "8 Coins/3 Credits" )
PORT_DIPSETTING( 0xE0, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x20, "5 Coins/3 Credits" )
PORT_DIPSETTING( 0x30, "3 Coins/2 Credits" )
PORT_DIPSETTING( 0xF0, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x40, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x90, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x80, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x70, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x60, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0x50, "1 Coin/6 Credits" )
PORT_DIPSETTING( 0x00, "Free Play" )
PORT_START
PORT_DIPNAME( 0x01, 0x01, "Flip Screen", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x02, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x02, "Cocktail" )
PORT_DIPNAME( 0x04, 0x04, "Coin Mode", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "Mode 1" )
PORT_DIPSETTING( 0x00, "Mode 2" )
PORT_DIPNAME( 0x08, 0x08, "Game Repeats", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Yes" )
PORT_DIPSETTING( 0x08, "No" )
PORT_DIPNAME( 0x10, 0x10, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x10, "Yes" )
/* In stop mode, press 2 to stop and 1 to restart */
PORT_BITX ( 0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Stop Mode", IP_KEY_NONE, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x20, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_BITX( 0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_BITX( 0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
static struct IOReadPort irem_readport[] = {
{ 0x00, 0x00, input_port_0_r },
{ 0x01, 0x01, input_port_1_r },
{ 0x02, 0x02, input_port_2_r },
{ 0x03, 0x03, input_port_3_r },
{ 0x04, 0x04, input_port_4_r },
{ -1 } /* end of table */
};
static void kidniki_bankswitch_w(int offset,int data){
static int bank_table[16] = {
0,1,2,3, 4,5,6,7,
12,12,12,12, 8,9,10,11
};
int base = bank_table[data&0xf] * 0x2000;
unsigned char *mem = &Machine->memory_region[MEM_MAIN_CPU][0x10000];
cpu_setbank( 1,&mem[base] );
}
static struct IOWritePort kidniki_writeport[] =
{
{ 0x00, 0x00, irem_sound_cmd_w },
/* 0x01 is most likely screen flip */
{ 0x80, 0x81, irem_background_hscroll_w },
{ 0x82, 0x83, irem_text_vscroll_w },
{ 0x84, 0x84, irem_background_bank_w },
{ 0x85, 0x85, kidniki_bankswitch_w },
{ -1 } /* end of table */
};
static struct MemoryReadAddress kidniki_readmem[] = {
{ 0x0000, 0x7fff, MRA_ROM },
{ 0x8000, 0x9fff, MRA_BANK1 },
{ 0xa000, 0xafff, MRA_RAM, &videoram },
{ 0xc000, 0xc0ff, MRA_RAM },
{ 0xd000, 0xdfff, MRA_RAM, &irem_textram },
{ 0xe000, 0xe3ff, MRA_RAM },
{ 0xe400, 0xffff, MRA_RAM, &spriteram },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress kidniki_writemem[] = {
{ 0x0000, 0x9fff, MWA_ROM },
{ 0xa000, 0xafff, background_tilemap_w },
{ 0xc000, 0xffff, MWA_RAM },
{ -1 } /* end of table */
};
/*************************************************************/
static struct GfxLayout kidniki_tile_layout =
{
8,8, /* character size */
0x1000, /* number of characters */
3, /* 3 bits per pixel */
{ 0, 0x8000*8,0x8000*8*2 },
{ 0, 1, 2, 3, 4,5,6,7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
64 /* character offset */
};
static struct GfxLayout kidniki_char_layout =
{
12,8, /* character size */
0x400, /* number of characters */
3, /* bits per pixel */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -