📄 frogger.c
字号:
static struct MachineDriver machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
18432000/6, /* 3.072 Mhz */
0,
readmem,writemem,0,0,
nmi_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
14318000/8, /* 1.78975 Mhz */
3, /* memory region #3 */
sound_readmem,sound_writemem,sound_readport,sound_writeport,
ignore_interrupt,1 /* interrupts are triggered by the main CPU */
}
},
60, 2500, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
0,
/* video hardware */
32*8, 32*8, { 2*8, 30*8-1, 0*8, 32*8-1 },
gfxdecodeinfo,
32,64,
frogger_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
generic_vh_start,
generic_vh_stop,
frogger_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
}
}
};
static struct MachineDriver frogger2_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
18432000/6, /* 3.072 Mhz */
0,
frogger2_readmem,frogger2_writemem,0,0,
nmi_interrupt,1
},
{
CPU_Z80 | CPU_AUDIO_CPU,
14318000/8, /* 1.78975 Mhz */
3, /* memory region #3 */
sound_readmem,sound_writemem,sound_readport,sound_writeport,
ignore_interrupt,1 /* interrupts are triggered by the main CPU */
}
},
60, 2500, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
0,
/* video hardware */
32*8, 32*8, { 2*8, 30*8-1, 0*8, 32*8-1 },
gfxdecodeinfo,
32,64,
frogger_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
generic_vh_start,
generic_vh_stop,
frogger2_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( frogger_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "frogger.ic5", 0x0000, 0x1000, 0xefab0c79 )
ROM_LOAD( "frogger.ic6", 0x1000, 0x1000, 0xaeca9c13 )
ROM_LOAD( "frogger.ic7", 0x2000, 0x1000, 0xdd251066 )
ROM_LOAD( "frogger.ic8", 0x3000, 0x1000, 0xbf293a02 )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "frogger.606", 0x0000, 0x0800, 0xf524ee30 )
ROM_LOAD( "frogger.607", 0x0800, 0x0800, 0x05f7d883 )
ROM_REGION(0x0020) /* color PROMs */
ROM_LOAD( "pr-91.6l", 0x0000, 0x0020, 0x413703bf )
ROM_REGION(0x10000) /* 64k for the audio CPU */
ROM_LOAD( "frogger.608", 0x0000, 0x0800, 0xe8ab0256 )
ROM_LOAD( "frogger.609", 0x0800, 0x0800, 0x7380a48f )
ROM_LOAD( "frogger.610", 0x1000, 0x0800, 0x31d7eb27 )
ROM_END
ROM_START( frogsega_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "frogger.26", 0x0000, 0x1000, 0x597696d6 )
ROM_LOAD( "frogger.27", 0x1000, 0x1000, 0xb6e6fcc3 )
ROM_LOAD( "frogger.34", 0x2000, 0x1000, 0xed866bab )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "frogger.606", 0x0000, 0x0800, 0xf524ee30 )
ROM_LOAD( "frogger.607", 0x0800, 0x0800, 0x05f7d883 )
ROM_REGION(0x0020) /* color PROMs */
ROM_LOAD( "pr-91.6l", 0x0000, 0x0020, 0x413703bf )
ROM_REGION(0x10000) /* 64k for the audio CPU */
ROM_LOAD( "frogger.608", 0x0000, 0x0800, 0xe8ab0256 )
ROM_LOAD( "frogger.609", 0x0800, 0x0800, 0x7380a48f )
ROM_LOAD( "frogger.610", 0x1000, 0x0800, 0x31d7eb27 )
ROM_END
ROM_START( frogger2_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "epr-1031.15", 0x0000, 0x1000, 0x4b7c8d11 )
ROM_LOAD( "epr-1032.16", 0x1000, 0x1000, 0xac00b9d9 )
ROM_LOAD( "epr-1033.33", 0x2000, 0x1000, 0xbc1d6fbc )
ROM_LOAD( "epr-1034.34", 0x3000, 0x1000, 0x9efe7399 )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "epr-1036.1k", 0x0000, 0x0800, 0x658745f8 )
ROM_LOAD( "epr-1037.1h", 0x0800, 0x0800, 0x05f7d883 )
ROM_REGION(0x0020) /* color PROMs */
ROM_LOAD( "pr-91.6l", 0x0000, 0x0020, 0x413703bf )
ROM_REGION(0x10000) /* 64k for the audio CPU */
ROM_LOAD( "epr-1082.42", 0x0000, 0x1000, 0x802843c2 )
ROM_LOAD( "epr-1035.43", 0x1000, 0x0800, 0x14e74148 )
ROM_END
static void frogger_decode(void)
{
int A;
unsigned char *RAM;
/* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
RAM = Machine->memory_region[Machine->drv->cpu[1].memory_region];
for (A = 0;A < 0x0800;A++)
RAM[A] = (RAM[A] & 0xfc) | ((RAM[A] & 1) << 1) | ((RAM[A] & 2) >> 1);
/* likewise, the first gfx ROM has data lines D0 and D1 swapped. Decode it. */
RAM = Machine->memory_region[1];
for (A = 0;A < 0x0800;A++)
RAM[A] = (RAM[A] & 0xfc) | ((RAM[A] & 1) << 1) | ((RAM[A] & 2) >> 1);
}
static void frogger2_decode(void)
{
int A;
unsigned char *RAM;
/* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
RAM = Machine->memory_region[Machine->drv->cpu[1].memory_region];
for (A = 0;A < 0x1000;A++)
RAM[A] = (RAM[A] & 0xfc) | ((RAM[A] & 1) << 1) | ((RAM[A] & 2) >> 1);
}
static int 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[0x83f1],"\x63\x04",2) == 0 &&
memcmp(&RAM[0x83f9],"\x27\x01",2) == 0)
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x83f1],2*5);
RAM[0x83ef] = RAM[0x83f1];
RAM[0x83f0] = RAM[0x83f2];
osd_fclose(f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void 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[0x83f1],2*5);
osd_fclose(f);
}
}
struct GameDriver frogger_driver =
{
__FILE__,
0,
"frogger",
"Frogger (set 1)",
"1981",
"Sega",
"Robert Anschuetz\nNicola Salmoria\nMirko Buffoni\nGerald Vanderick (color info)\nMarco Cassili",
0,
&machine_driver,
0,
frogger_rom,
frogger_decode, 0,
0,
0, /* sound_prom */
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
struct GameDriver frogsega_driver =
{
__FILE__,
&frogger_driver,
"frogsega",
"Frogger (set 2)",
"1981",
"Sega",
"Robert Anschuetz\nNicola Salmoria\nMirko Buffoni\nGerald Vanderick (color info)\nMarco Cassili",
0,
&machine_driver,
0,
frogsega_rom,
frogger_decode, 0,
0,
0, /* sound_prom */
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
/* this version runs on modified Moon Cresta hardware */
struct GameDriver frogger2_driver =
{
__FILE__,
&frogger_driver,
"frogger2",
"Frogger (modified Moon Cresta hardware)",
"1981",
"bootleg?",
"Robert Anschuetz\nNicola Salmoria\nMirko Buffoni\nGerald Vanderick (color info)\nMarco Cassili",
0,
&frogger2_machine_driver,
0,
frogger2_rom,
frogger2_decode, 0,
0,
0, /* sound_prom */
frogger2_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -