📄 scramble.c
字号:
if (loop == 0)
{
memset(&RAM[0x43c0],0xff,3*5);
loop = 1;
}
/* check if the hi score table has already been initialized */
if (memcmp(&RAM[0x43c0],"\x00\x00\x00",3) == 0 &&
memcmp(&RAM[0x43cc],"\x00\x00\x00",3) == 0)
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
/* This seems to have more than 5 scores in memory. */
/* If this DISPLAYS more than 5 scores, change 3*5 to 3*10 or */
/* however many it should be. */
osd_fread(f,&RAM[0x43c0],3*5);
/* copy high score */
memcpy(&RAM[0x40a8],&RAM[0x43c0],3);
osd_fclose(f);
}
loop = 0;
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void theend_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)
{
/* This seems to have more than 5 scores in memory. */
/* If this DISPLAYS more than 5 scores, change 3*5 to 3*10 or */
/* however many it should be. */
osd_fwrite(f,&RAM[0x43C0],3*5);
osd_fclose(f);
}
}
static int froggers_hiload(void)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
/* check if the hi score table has already been initialized */
if (memcmp(&RAM[0x43f1],"\x63\x04",2) == 0 &&
memcmp(&RAM[0x43f8],"\x27\x01",2) == 0)
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x43f1],2*5);
RAM[0x43ef] = RAM[0x43f1];
RAM[0x43f0] = RAM[0x43f2];
osd_fclose(f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void froggers_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[0x43f1],2*5);
osd_fclose(f);
}
}
struct GameDriver scramble_driver =
{
__FILE__,
0,
"scramble",
"Scramble",
"1981",
"Stern",
"Nicola Salmoria",
0,
&scramble_machine_driver,
0,
scramble_rom,
0, 0,
0,
0, /* sound_prom */
scramble_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
scramble_hiload, scramble_hisave
};
struct GameDriver atlantis_driver =
{
__FILE__,
0,
"atlantis",
"Battle of Atlantis",
"1981",
"Comsoft",
"Nicola Salmoria\nMike Balfour",
0,
&scramble_machine_driver,
0,
atlantis_rom,
0, 0,
0,
0, /* sound_prom */
atlantis_input_ports,
wrong_color_prom, 0, 0,
ORIENTATION_ROTATE_90,
atlantis_hiload, atlantis_hisave
};
struct GameDriver theend_driver =
{
__FILE__,
0,
"theend",
"The End",
"1980",
"Stern",
"Nicola Salmoria\nVille Laitinen\nMike Balfour",
0,
&theend_machine_driver,
0,
theend_rom,
0, 0,
0,
0, /* sound_prom */
theend_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
theend_hiload, theend_hisave
};
extern struct GameDriver frogger_driver;
struct GameDriver froggers_driver =
{
__FILE__,
&frogger_driver,
"froggers",
"Frog",
"1981",
"bootleg",
"Nicola Salmoria",
0,
&froggers_machine_driver,
0,
froggers_rom,
froggers_decode, 0,
0,
0, /* sound_prom */
froggers_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
froggers_hiload, froggers_hisave
};
extern struct GameDriver amidar_driver;
struct GameDriver amidars_driver =
{
__FILE__,
&amidar_driver,
"amidars",
"Amidar (Scramble hardware)",
"1982",
"Konami",
"Nicola Salmoria\nMike Coates",
0,
&scramble_machine_driver,
0,
amidars_rom,
0, 0,
0,
0, /* sound_prom */
amidars_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
0,0
};
static struct MemoryReadAddress triplep_readmem[] =
{
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x4000, 0x4bff, MRA_RAM }, /* RAM and Video RAM */
{ 0x4c00, 0x4fff, videoram_r }, /* mirror address */
{ 0x5000, 0x507f, MRA_RAM }, /* screen attributes, sprites, bullets */
{ 0x7000, 0x7000, watchdog_reset_r },
{ 0x8100, 0x8100, input_port_0_r }, /* IN0 */
{ 0x8101, 0x8101, input_port_1_r }, /* IN1 */
{ 0x8102, 0x8102, input_port_2_r }, /* IN2 */
{ -1 } /* end of table */
};
static struct MemoryWriteAddress triplep_writemem[] =
{
{ 0x0000, 0x3fff, MWA_ROM },
{ 0x4000, 0x47ff, MWA_RAM },
{ 0x4800, 0x4bff, videoram_w, &videoram, &videoram_size },
{ 0x4c00, 0x4fff, videoram_w }, /* mirror address */
{ 0x5000, 0x503f, galaxian_attributes_w, &galaxian_attributesram },
{ 0x5040, 0x505f, MWA_RAM, &spriteram, &spriteram_size },
{ 0x5060, 0x507f, MWA_RAM, &galaxian_bulletsram, &galaxian_bulletsram_size },
{ 0x6801, 0x6801, interrupt_enable_w },
{ 0x6802, 0x6802, MWA_NOP },
{ 0x6803, 0x6803, scramble_background_w },
{ 0x6804, 0x6804, galaxian_stars_w },
{ 0x6806, 0x6806, galaxian_flipx_w },
{ 0x6807, 0x6807, galaxian_flipy_w },
{ -1 } /* end of table */
};
static int pip(int offset)
{
if (cpu_getpc() == 0x015a) return 0xff;
else if (cpu_getpc() == 0x0886) return 0x05;
else return 0;
}
static int pap(int offset)
{
if (cpu_getpc() == 0x015d) return 0x04;
else return 0;
}
static struct IOReadPort triplep_readport[] =
{
{ 0x01, 0x01, AY8910_read_port_0_r },
{ 0x02, 0x02, pip },
{ 0x03, 0x03, pap },
{ -1 } /* end of table */
};
static struct IOWritePort triplep_writeport[] =
{
{ 0x01, 0x01, AY8910_control_port_0_w },
{ 0x00, 0x00, AY8910_write_port_0_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( triplep_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_START /* IN1 */
PORT_DIPNAME( 0x03, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x02, "5" )
PORT_BITX( 0, 0x03, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "256", IP_KEY_NONE, IP_JOY_NONE, 0 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
PORT_DIPNAME( 0x06, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "A 1/2 B 1/1 C 1/2" )
PORT_DIPSETTING( 0x04, "A 1/3 B 3/1 C 1/3" )
PORT_DIPSETTING( 0x00, "A 1/1 B 2/1 C 1/1" )
PORT_DIPSETTING( 0x06, "A 1/4 B 4/1 C 1/4" )
PORT_DIPNAME( 0x08, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x08, "Cocktail" )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
PORT_BITX( 0x20, 0x00, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x20, "On" )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
PORT_BITX( 0x80, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", OSD_KEY_F1, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x80, "On" )
INPUT_PORTS_END
static struct AY8910interface triplep_ay8910_interface =
{
1, /* 1 chip */
1789750, /* 1.78975 MHz? */
{ 255 },
{ 0 },
{ 0 },
{ 0 },
{ 0 }
};
/* Triple Punch is different - only one CPU, one 8910 */
static struct MachineDriver triplep_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
3072000, /* 3.072 Mhz ? */
0,
triplep_readmem,triplep_writemem,triplep_readport,triplep_writeport,
scramble_vh_interrupt,1
}
},
60, 2500,/* ? */ /* frames per second, vblank duration */
1, /* single CPU, no need for interleaving */
0,
/* video hardware */
32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
scramble_gfxdecodeinfo,
32+64,8*4+2*2, /* 32 for the characters, 64 for the stars */
galaxian_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
scramble_vh_start,
generic_vh_stop,
galaxian_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&triplep_ay8910_interface
}
}
};
ROM_START( triplep_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "triplep.2g", 0x0000, 0x1000, 0xc583a93d )
ROM_LOAD( "triplep.2h", 0x1000, 0x1000, 0xc03ddc49 )
ROM_LOAD( "triplep.2k", 0x2000, 0x1000, 0xe83ca6b5 )
ROM_LOAD( "triplep.2l", 0x3000, 0x1000, 0x982cc3b9 )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "triplep.5f", 0x0000, 0x0800, 0xd51cbd6f )
ROM_LOAD( "triplep.5h", 0x0800, 0x0800, 0xf21c0059 )
ROM_REGION(0x0020) /* color prom */
ROM_LOAD( "tripprom.6e", 0x0000, 0x0020, 0x624f75df )
ROM_END
struct GameDriver triplep_driver =
{
__FILE__,
0,
"triplep",
"Triple Punch",
"1982",
"KKI",
"Nicola Salmoria",
0,
&triplep_machine_driver,
0,
triplep_rom,
0, 0,
0,
0, /* sound_prom */
triplep_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
scramble_hiload, scramble_hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -