📄 galaga.c
字号:
255, /* playback volume */
5 /* memory region */
};
static struct Samplesinterface samples_interface =
{
1 /* one channel */
};
static struct MachineDriver machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
3125000, /* 3.125 Mhz */
0,
readmem_cpu1,writemem_cpu1,0,0,
galaga_interrupt_1,1
},
{
CPU_Z80,
3125000, /* 3.125 Mhz */
3, /* memory region #3 */
readmem_cpu2,writemem_cpu2,0,0,
galaga_interrupt_2,1
},
{
CPU_Z80,
3125000, /* 3.125 Mhz */
4, /* memory region #4 */
readmem_cpu3,writemem_cpu3,0,0,
galaga_interrupt_3,2
}
},
60, DEFAULT_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
100, /* 100 CPU slices per frame - an high value to ensure proper */
/* synchronization of the CPUs */
galaga_init_machine,
/* video hardware */
28*8, 36*8, { 0*8, 28*8-1, 0*8, 36*8-1 },
gfxdecodeinfo,
32+64,64*4, /* 32 for the characters, 64 for the stars */
galaga_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
galaga_vh_start,
generic_vh_stop,
galaga_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_NAMCO,
&namco_interface
},
{
SOUND_SAMPLES,
&samples_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( galaga_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "04m_g01.bin", 0x0000, 0x1000, 0xa3a0f743 )
ROM_LOAD( "04k_g02.bin", 0x1000, 0x1000, 0x43bb0d5c )
ROM_LOAD( "04j_g03.bin", 0x2000, 0x1000, 0x753ce503 )
ROM_LOAD( "04h_g04.bin", 0x3000, 0x1000, 0x83874442 )
ROM_REGION_DISPOSE(0x3000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "07m_g08.bin", 0x0000, 0x1000, 0x58b2f47c )
ROM_LOAD( "07e_g10.bin", 0x1000, 0x1000, 0xad447c80 )
ROM_LOAD( "07h_g09.bin", 0x2000, 0x1000, 0xdd6f1afc )
ROM_REGION(0x0220) /* color PROMs */
ROM_LOAD( "5n.bin", 0x0000, 0x0020, 0x54603c6b ) /* palette */
ROM_LOAD( "2n.bin", 0x0020, 0x0100, 0xa547d33b ) /* char lookup table */
ROM_LOAD( "1c.bin", 0x0120, 0x0100, 0xb6f585fb ) /* sprite lookup table */
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "04e_g05.bin", 0x0000, 0x1000, 0x3102fccd )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "04d_g06.bin", 0x0000, 0x1000, 0x8995088d )
ROM_REGION(0x0100) /* sound prom */
ROM_LOAD( "1d.bin", 0x0000, 0x0100, 0x86d92b24 )
ROM_END
ROM_START( galagamw_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "3200a.bin", 0x0000, 0x1000, 0x3ef0b053 )
ROM_LOAD( "3300b.bin", 0x1000, 0x1000, 0x1b280831 )
ROM_LOAD( "3400c.bin", 0x2000, 0x1000, 0x16233d33 )
ROM_LOAD( "3500d.bin", 0x3000, 0x1000, 0x0aaf5c23 )
ROM_REGION_DISPOSE(0x3000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "07m_g08.bin", 0x0000, 0x1000, 0x58b2f47c )
ROM_LOAD( "07e_g10.bin", 0x1000, 0x1000, 0xad447c80 )
ROM_LOAD( "07h_g09.bin", 0x2000, 0x1000, 0xdd6f1afc )
ROM_REGION(0x0220) /* color PROMs */
ROM_LOAD( "5n.bin", 0x0000, 0x0020, 0x54603c6b ) /* palette */
ROM_LOAD( "2n.bin", 0x0020, 0x0100, 0xa547d33b ) /* char lookup table */
ROM_LOAD( "1c.bin", 0x0120, 0x0100, 0xb6f585fb ) /* sprite lookup table */
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "3600e.bin", 0x0000, 0x1000, 0xbc556e76 )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "3700g.bin", 0x0000, 0x1000, 0xb07f0aa4 )
ROM_REGION(0x0100) /* sound prom */
ROM_LOAD( "1d.bin", 0x0000, 0x0100, 0x86d92b24 )
ROM_END
ROM_START( galagads_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "3200a.bin", 0x0000, 0x1000, 0x3ef0b053 )
ROM_LOAD( "3300b.bin", 0x1000, 0x1000, 0x1b280831 )
ROM_LOAD( "3400c.bin", 0x2000, 0x1000, 0x16233d33 )
ROM_LOAD( "3500d.bin", 0x3000, 0x1000, 0x0aaf5c23 )
ROM_REGION_DISPOSE(0x3000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "07m_g08.bin", 0x0000, 0x1000, 0x58b2f47c )
ROM_LOAD( "07e_g10.bin", 0x1000, 0x1000, 0xad447c80 )
ROM_LOAD( "07h_g09.bin", 0x2000, 0x1000, 0xdd6f1afc )
ROM_REGION(0x0220) /* color PROMs */
ROM_LOAD( "5n.bin", 0x0000, 0x0020, 0x54603c6b ) /* palette */
ROM_LOAD( "2n.bin", 0x0020, 0x0100, 0xa547d33b ) /* char lookup table */
ROM_LOAD( "1c.bin", 0x0120, 0x0100, 0xb6f585fb ) /* sprite lookup table */
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "3600fast.bin", 0x0000, 0x1000, 0x23d586e5 )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "3700g.bin", 0x0000, 0x1000, 0xb07f0aa4 )
ROM_REGION(0x0100) /* sound prom */
ROM_LOAD( "1d.bin", 0x0000, 0x0100, 0x86d92b24 )
ROM_END
ROM_START( gallag_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "04m_g01.bin", 0x0000, 0x1000, 0xa3a0f743 )
ROM_LOAD( "gallag.2", 0x1000, 0x1000, 0x5eda60a7 )
ROM_LOAD( "04j_g03.bin", 0x2000, 0x1000, 0x753ce503 )
ROM_LOAD( "04h_g04.bin", 0x3000, 0x1000, 0x83874442 )
ROM_REGION_DISPOSE(0x3000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "gallag.8", 0x0000, 0x1000, 0x169a98a4 )
ROM_LOAD( "07e_g10.bin", 0x1000, 0x1000, 0xad447c80 )
ROM_LOAD( "07h_g09.bin", 0x2000, 0x1000, 0xdd6f1afc )
ROM_REGION(0x0220) /* color PROMs */
ROM_LOAD( "5n.bin", 0x0000, 0x0020, 0x54603c6b ) /* palette */
ROM_LOAD( "2n.bin", 0x0020, 0x0100, 0xa547d33b ) /* char lookup table */
ROM_LOAD( "1c.bin", 0x0120, 0x0100, 0xb6f585fb ) /* sprite lookup table */
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "04e_g05.bin", 0x0000, 0x1000, 0x3102fccd )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "04d_g06.bin", 0x0000, 0x1000, 0x8995088d )
ROM_REGION(0x0100) /* sound prom */
ROM_LOAD( "1d.bin", 0x0000, 0x0100, 0x86d92b24 )
ROM_END
ROM_START( galagab2_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "g1", 0x0000, 0x1000, 0xab036c9f )
ROM_LOAD( "g2", 0x1000, 0x1000, 0xd9232240 )
ROM_LOAD( "04j_g03.bin", 0x2000, 0x1000, 0x753ce503 )
ROM_LOAD( "g4", 0x3000, 0x1000, 0x499fcc76 )
ROM_REGION_DISPOSE(0x3000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "gallag.8", 0x0000, 0x1000, 0x169a98a4 )
ROM_LOAD( "07e_g10.bin", 0x1000, 0x1000, 0xad447c80 )
ROM_LOAD( "07h_g09.bin", 0x2000, 0x1000, 0xdd6f1afc )
ROM_REGION(0x0220) /* color PROMs */
ROM_LOAD( "5n.bin", 0x0000, 0x0020, 0x54603c6b ) /* palette */
ROM_LOAD( "2n.bin", 0x0020, 0x0100, 0xa547d33b ) /* char lookup table */
ROM_LOAD( "1c.bin", 0x0120, 0x0100, 0xb6f585fb ) /* sprite lookup table */
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "04e_g05.bin", 0x0000, 0x1000, 0x3102fccd )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "04d_g06.bin", 0x0000, 0x1000, 0x8995088d )
ROM_REGION(0x0100) /* sound prom */
ROM_LOAD( "1d.bin", 0x0000, 0x0100, 0x86d92b24 )
ROM_END
static const char *galaga_sample_names[] =
{
"*galaga",
"BANG.SAM",
0 /* end of array */
};
static int hiload(void)
{
void *f;
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[0x8a20],"\x00\x00\x00\x00\x02\x24",6) == 0 &&
memcmp(&RAM[0x8a4a],"\x18\x2a\x18",3) == 0 )
{
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x8A20],45);
osd_fclose(f);
/* V.V: copy top score to video RAM */
RAM[0x83ED]=RAM[0x8A20];
RAM[0x83EE]=RAM[0x8A21];
RAM[0x83EF]=RAM[0x8A22];
RAM[0x83F0]=RAM[0x8A23];
RAM[0x83F1]=RAM[0x8A24];
RAM[0x83F2]=RAM[0x8A25];
galaga_hiscoreloaded = 1;
}
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[0x8A20],45);
osd_fclose(f);
}
}
struct GameDriver galaga_driver =
{
__FILE__,
0,
"galaga",
"Galaga (Namco)",
"1981",
"Namco",
"Martin Scragg (hardware info)\nNicola Salmoria (MAME driver)\nMirko Buffoni (additional code)",
0,
&machine_driver,
0,
galaga_rom,
0, 0,
galaga_sample_names,
0, /* sound_prom */
galaganm_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
struct GameDriver galagamw_driver =
{
__FILE__,
&galaga_driver,
"galagamw",
"Galaga (Midway)",
"1981",
"[Namco] (Midway license)",
"Martin Scragg (hardware info)\nNicola Salmoria (MAME driver)\nMirko Buffoni (additional code)",
0,
&machine_driver,
0,
galagamw_rom,
0, 0,
galaga_sample_names,
0, /* sound_prom */
galaga_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
struct GameDriver galagads_driver =
{
__FILE__,
&galaga_driver,
"galagads",
"Galaga (fast shoot)",
"1981",
"hack",
"Martin Scragg (hardware info)\nNicola Salmoria (MAME driver)\nMirko Buffoni (additional code)",
0,
&machine_driver,
0,
galagads_rom,
0, 0,
galaga_sample_names,
0, /* sound_prom */
galaga_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
struct GameDriver gallag_driver =
{
__FILE__,
&galaga_driver,
"gallag",
"Gallag",
"1982",
"bootleg",
"Martin Scragg (hardware info)\nNicola Salmoria (MAME driver)\nMirko Buffoni (additional code)",
0,
&machine_driver,
0,
gallag_rom,
0, 0,
galaga_sample_names,
0, /* sound_prom */
galaganm_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
struct GameDriver galagab2_driver =
{
__FILE__,
&galaga_driver,
"galagab2",
"Galaga (bootleg)",
"1981",
"bootleg",
"Martin Scragg (hardware info)\nNicola Salmoria (MAME driver)\nMirko Buffoni (additional code)",
0,
&machine_driver,
0,
galagab2_rom,
0, 0,
galaga_sample_names,
0, /* sound_prom */
galaganm_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -