📄 contra.c
字号:
0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
32*16+0*32, 32*16+1*32, 32*16+2*32, 32*16+3*32,
32*16+4*32, 32*16+5*32, 32*16+6*32, 32*16+7*32
},
32*32
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ 1, 0x00000, &tilelayout, 128, 8*4 },
{ 1, 0x40000, &tilelayout, 128+16*8*4, 8*4 },
{ 1, 0x80000, &spritelayout, 0, 8 },
{ 1, 0xC0000, &spritelayout, 0, 8 },
{ -1 }
};
static struct YM2151interface ym2151_interface =
{
1, /* 1 chip */
3582071, /* seems to be the standard */
{ 60 },
{ 0 }
};
static struct MachineDriver contra_machine_driver =
{
{
{
CPU_M6809,
1500000,
0,
readmem,writemem,0,0,
interrupt,1
},
{
CPU_M6809 | CPU_AUDIO_CPU,
2000000,
3,
readmem_sound,writemem_sound,0,0,
ignore_interrupt,0 /* IRQs are caused by the main CPU */
},
},
60,DEFAULT_REAL_60HZ_VBLANK_DURATION,
10, /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
contra_init_machine, /* init machine */
/* video hardware */
37*8, 32*8, { 0*8, 35*8-1, 2*8, 30*8-1 },
gfxdecodeinfo,
128, 128 + 16*8*4 + 16*8*4,
contra_vh_convert_color_prom,
VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
0,
contra_vh_start,
contra_vh_stop,
contra_vh_screenrefresh,
/* sound hardware */
SOUND_SUPPORTS_STEREO,0,0,0,
{
{
SOUND_YM2151,
&ym2151_interface
}
}
};
ROM_START( contra_rom )
ROM_REGION(0x28000) /* 64k for code + 96k for banked ROMs */
ROM_LOAD( "633e03.18a", 0x20000, 0x08000, 0x7fc0d8cf )
ROM_CONTINUE( 0x08000, 0x08000 )
ROM_LOAD( "633e02.17a", 0x10000, 0x10000, 0xb2f7bd9a )
ROM_REGION_DISPOSE(0x10000*16) /* temporary space for graphics */
ROM_LOAD( "g-7.rom", 0x00000, 0x10000, 0x57f467d2 ) /* foreground tiles */
ROM_LOAD( "g-10.rom", 0x10000, 0x10000, 0xe6db9685 )
ROM_LOAD( "g-9.rom", 0x20000, 0x10000, 0x875c61de )
ROM_LOAD( "g-8.rom", 0x30000, 0x10000, 0x642765d6 )
ROM_LOAD( "g-4.rom", 0x40000, 0x10000, 0x2cc7e52c ) /* background tiles */
ROM_LOAD( "g-5.rom", 0x50000, 0x10000, 0xe01a5b9c )
ROM_LOAD( "g-6.rom", 0x60000, 0x10000, 0xaeea6744 )
/* 0x70000 is unpopulated */
ROM_LOAD( "g-11.rom", 0x80000, 0x10000, 0xbd9ba92c ) /* enemy sprites */
ROM_LOAD( "g-12.rom", 0x90000, 0x10000, 0xd0be7ec2 )
ROM_LOAD( "g-13.rom", 0xA0000, 0x10000, 0x2b513d12 )
ROM_LOAD( "g-14.rom", 0xB0000, 0x10000, 0xfca77c5a )
ROM_LOAD( "g-15.rom", 0xC0000, 0x10000, 0xdaa2324b ) /* player sprites */
ROM_LOAD( "g-16.rom", 0xD0000, 0x10000, 0xe27cc835 )
ROM_LOAD( "g-17.rom", 0xE0000, 0x10000, 0xce4330b9 )
ROM_LOAD( "g-18.rom", 0xF0000, 0x10000, 0x1571ce42 )
ROM_REGION(0x0200) /* lookup table PROMs */
ROM_LOAD( "633e09.12g", 0x0000, 0x0100, 0x14ca5e19 ) /* fg lookup table */
ROM_LOAD( "633e08.10g", 0x0100, 0x0100, 0x9f0949fa ) /* ? bg lookup table ? */
ROM_REGION(0x10000) /* 64k for SOUND code */
ROM_LOAD( "633e01.12a", 0x08000, 0x08000, 0xd1549255 )
ROM_END
ROM_START( contrab_rom )
ROM_REGION(0x28000) /* 64k for code + 96k for banked ROMs */
ROM_LOAD( "contra.20", 0x20000, 0x08000, 0xd045e1da )
ROM_CONTINUE( 0x08000, 0x08000 )
ROM_LOAD( "633e02.17a", 0x10000, 0x10000, 0xb2f7bd9a )
ROM_REGION_DISPOSE(0x10000*16) /* temporary space for graphics */
ROM_LOAD( "g-7.rom", 0x00000, 0x10000, 0x57f467d2 ) /* foreground tiles */
ROM_LOAD( "g-10.rom", 0x10000, 0x10000, 0xe6db9685 )
ROM_LOAD( "g-9.rom", 0x20000, 0x10000, 0x875c61de )
ROM_LOAD( "g-8.rom", 0x30000, 0x10000, 0x642765d6 )
ROM_LOAD( "g-4.rom", 0x40000, 0x10000, 0x2cc7e52c ) /* background tiles */
ROM_LOAD( "g-5.rom", 0x50000, 0x10000, 0xe01a5b9c )
ROM_LOAD( "g-6.rom", 0x60000, 0x10000, 0xaeea6744 )
/* 0x70000 is unpopulated */
ROM_LOAD( "g-11.rom", 0x80000, 0x10000, 0xbd9ba92c ) /* enemy sprites */
ROM_LOAD( "g-12.rom", 0x90000, 0x10000, 0xd0be7ec2 )
ROM_LOAD( "g-13.rom", 0xA0000, 0x10000, 0x2b513d12 )
ROM_LOAD( "g-14.rom", 0xB0000, 0x10000, 0xfca77c5a )
ROM_LOAD( "g-15.rom", 0xC0000, 0x10000, 0xdaa2324b ) /* player sprites */
ROM_LOAD( "g-16.rom", 0xD0000, 0x10000, 0xe27cc835 )
ROM_LOAD( "g-17.rom", 0xE0000, 0x10000, 0xce4330b9 )
ROM_LOAD( "g-18.rom", 0xF0000, 0x10000, 0x1571ce42 )
ROM_REGION(0x0200) /* lookup table PROMs */
ROM_LOAD( "633e09.12g", 0x0000, 0x0100, 0x14ca5e19 ) /* fg lookup table */
ROM_LOAD( "633e08.10g", 0x0100, 0x0100, 0x9f0949fa ) /* ? bg lookup table ? */
ROM_REGION(0x10000) /* 64k for SOUND code */
ROM_LOAD( "633e01.12a", 0x08000, 0x08000, 0xd1549255 )
ROM_END
ROM_START( gryzorb_rom )
ROM_REGION(0x28000) /* 64k for code + 96k for banked ROMs */
ROM_LOAD( "g-2.rom", 0x20000, 0x08000, 0xbdb9196d )
ROM_CONTINUE( 0x08000, 0x08000 )
ROM_LOAD( "g-3.rom", 0x10000, 0x10000, 0x5d5f7438 )
ROM_REGION_DISPOSE(0x10000*16) /* temporary space for graphics */
ROM_LOAD( "g-7.rom", 0x00000, 0x10000, 0x57f467d2 ) /* foreground tiles */
ROM_LOAD( "g-10.rom", 0x10000, 0x10000, 0xe6db9685 )
ROM_LOAD( "g-9.rom", 0x20000, 0x10000, 0x875c61de )
ROM_LOAD( "g-8.rom", 0x30000, 0x10000, 0x642765d6 )
ROM_LOAD( "g-4.rom", 0x40000, 0x10000, 0x2cc7e52c ) /* background tiles */
ROM_LOAD( "g-5.rom", 0x50000, 0x10000, 0xe01a5b9c )
ROM_LOAD( "g-6.rom", 0x60000, 0x10000, 0xaeea6744 )
/* 0x70000 is unpopulated */
ROM_LOAD( "g-11.rom", 0x80000, 0x10000, 0xbd9ba92c ) /* enemy sprites */
ROM_LOAD( "g-12.rom", 0x90000, 0x10000, 0xd0be7ec2 )
ROM_LOAD( "g-13.rom", 0xA0000, 0x10000, 0x2b513d12 )
ROM_LOAD( "g-14.rom", 0xB0000, 0x10000, 0xfca77c5a )
ROM_LOAD( "g-15.rom", 0xC0000, 0x10000, 0xdaa2324b ) /* player sprites */
ROM_LOAD( "g-16.rom", 0xD0000, 0x10000, 0xe27cc835 )
ROM_LOAD( "g-17.rom", 0xE0000, 0x10000, 0xce4330b9 )
ROM_LOAD( "g-18.rom", 0xF0000, 0x10000, 0x1571ce42 )
ROM_REGION(0x0200) /* lookup table PROMs */
ROM_LOAD( "633e09.12g", 0x0000, 0x0100, 0x14ca5e19 ) /* fg lookup table */
ROM_LOAD( "633e08.10g", 0x0100, 0x0100, 0x9f0949fa ) /* ? bg lookup table ? */
ROM_REGION(0x10000) /* 64k for SOUND code */
ROM_LOAD( "633e01.12a", 0x08000, 0x08000, 0xd1549255 )
ROM_END
static int contra_hiload(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[0];
/* check if the hi score table has already been initialized */
if (memcmp(&RAM[0x1125],"\x02\x58\x00",3) == 0)
{
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x1120],64);
osd_fclose(f);
/* copy the high score to the work RAM as well */
RAM[0x1118] = RAM[0x1124];
RAM[0x1119] = RAM[0x1125];
RAM[0x111a] = RAM[0x1126];
RAM[0x111b] = RAM[0x1127];
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void contra_hisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[0];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0x1120],64);
osd_fclose(f);
}
}
struct GameDriver contra_driver =
{
__FILE__,
0,
"contra",
"Contra (US)",
"1987",
"Konami",
"Carlos A. Lozano\nJose Tejada Gomez\nPhil Stroffolino\nEric Hustvedt",
0,
&contra_machine_driver,
0,
contra_rom,
0, 0,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
contra_hiload, contra_hisave
};
struct GameDriver contrab_driver =
{
__FILE__,
&contra_driver,
"contrab",
"Contra (US bootleg)",
"1987",
"bootleg",
"Carlos A. Lozano\nJose Tejada Gomez\nPhil Stroffolino\nEric Hustvedt",
0,
&contra_machine_driver,
0,
contrab_rom,
0, 0,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
contra_hiload, contra_hisave
};
struct GameDriver gryzorb_driver =
{
__FILE__,
&contra_driver,
"gryzorb",
"Contra (Japan bootleg)",
"1987",
"bootleg",
"Carlos A. Lozano\nJose Tejada Gomez\nPhil Stroffolino\nEric Hustvedt",
0,
&contra_machine_driver,
0,
gryzorb_rom,
0, 0,
0,
0,
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_90,
contra_hiload, contra_hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -