📄 digdug.c
字号:
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_START1 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_START2 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
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 GfxLayout charlayout1 =
{
8,8, /* 8*8 characters */
128, /* 128 characters */
1, /* 1 bit per pixel */
{ 0 }, /* one bitplane */
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
{ 7, 6, 5, 4, 3, 2, 1, 0 },
8*8 /* every char takes 8 consecutive bytes */
};
static struct GfxLayout charlayout2 =
{
8,8, /* 8*8 characters */
256, /* 256 characters */
2, /* 2 bits per pixel */
{ 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 }, /* characters are rotated 90 degrees */
{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 }, /* bits are packed in groups of four */
16*8 /* every char takes 16 bytes */
};
static struct GfxLayout spritelayout =
{
16,16, /* 16*16 sprites */
256, /* 256 sprites */
2, /* 2 bits per pixel */
{ 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */
{ 39 * 8, 38 * 8, 37 * 8, 36 * 8, 35 * 8, 34 * 8, 33 * 8, 32 * 8,
7 * 8, 6 * 8, 5 * 8, 4 * 8, 3 * 8, 2 * 8, 1 * 8, 0 * 8 },
{ 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
24*8+0, 24*8+1, 24*8+2, 24*8+3 },
64*8 /* every sprite takes 64 bytes */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ 1, 0x0000, &charlayout1, 0, 8 },
{ 1, 0x2000, &spritelayout, 8*2, 64 },
{ 1, 0x1000, &charlayout2, 64*4 + 8*2, 64 },
{ -1 } /* end of array */
};
static struct namco_interface namco_interface =
{
3072000/32, /* sample rate */
3, /* number of voices */
32, /* gain adjustment */
255, /* playback volume */
6 /* memory region */
};
static struct MachineDriver machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
3125000, /* 3.125 Mhz */
0,
readmem_cpu1,writemem_cpu1,0,0,
digdug_interrupt_1,1
},
{
CPU_Z80,
3125000, /* 3.125 Mhz */
3, /* memory region #3 */
readmem_cpu2,writemem_cpu2,0,0,
digdug_interrupt_2,1
},
{
CPU_Z80,
3125000, /* 3.125 Mhz */
4, /* memory region #4 */
readmem_cpu3,writemem_cpu3,0,0,
digdug_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 */
digdig_init_machine,
/* video hardware */
28*8, 36*8, { 0*8, 28*8-1, 0*8, 36*8-1 },
gfxdecodeinfo,
32,8*2+64*4+64*4,
digdug_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
digdug_vh_start,
digdug_vh_stop,
digdug_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_NAMCO,
&namco_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( digdug_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "136007.101", 0x0000, 0x1000, 0xb9198079 )
ROM_LOAD( "136007.102", 0x1000, 0x1000, 0xb2acbe49 )
ROM_LOAD( "136007.103", 0x2000, 0x1000, 0xd6407b49 )
ROM_LOAD( "136007.104", 0x3000, 0x1000, 0xb3ad42c3 )
ROM_REGION_DISPOSE(0x8000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "136007.108", 0x0000, 0x0800, 0x3d24a3af )
ROM_LOAD( "136007.115", 0x1000, 0x1000, 0x754539be )
ROM_LOAD( "136007.116", 0x2000, 0x1000, 0xe22957c8 )
ROM_LOAD( "136007.117", 0x3000, 0x1000, 0xa3bbfd85 )
ROM_LOAD( "136007.118", 0x4000, 0x1000, 0x458499e9 )
ROM_LOAD( "136007.119", 0x5000, 0x1000, 0xc58252a0 )
ROM_REGION(0x220) /* color proms */
ROM_LOAD( "digdug.5n", 0x0000, 0x020, 0x4cb9da99 )
ROM_LOAD( "digdug.1c", 0x0020, 0x100, 0x00c7c419 )
ROM_LOAD( "digdug.2n", 0x0120, 0x100, 0xe9b3e08e )
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "136007.105", 0x0000, 0x1000, 0x0a2aef4a )
ROM_LOAD( "136007.106", 0x1000, 0x1000, 0xa2876d6e )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "136007.107", 0x0000, 0x1000, 0xa41bce72 )
ROM_REGION(0x01000) /* 4k for the playfield graphics */
ROM_LOAD( "136007.114", 0x0000, 0x1000, 0xd6822397 )
ROM_REGION(0x100) /* sound prom */
ROM_LOAD( "digdug.spr", 0x0000, 0x100, 0x7a2815b4 )
ROM_END
ROM_START( digdugnm_rom )
ROM_REGION(0x10000) /* 64k for code for the first CPU */
ROM_LOAD( "136007.101", 0x0000, 0x1000, 0xb9198079 )
ROM_LOAD( "136007.102", 0x1000, 0x1000, 0xb2acbe49 )
ROM_LOAD( "136007.103", 0x2000, 0x1000, 0xd6407b49 )
ROM_LOAD( "dd1.4b", 0x3000, 0x1000, 0xf4cebc16 )
ROM_REGION_DISPOSE(0x8000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "dd1.9", 0x0000, 0x0800, 0xf14a6fe1 )
ROM_LOAD( "dd1.11", 0x1000, 0x1000, 0x7b383983 )
ROM_LOAD( "136007.116", 0x2000, 0x1000, 0xe22957c8 )
ROM_LOAD( "dd1.14", 0x3000, 0x1000, 0x2829ec99 )
ROM_LOAD( "136007.118", 0x4000, 0x1000, 0x458499e9 )
ROM_LOAD( "136007.119", 0x5000, 0x1000, 0xc58252a0 )
ROM_REGION(0x220) /* color proms */
ROM_LOAD( "digdug.5n", 0x0000, 0x020, 0x4cb9da99 )
ROM_LOAD( "digdug.1c", 0x0020, 0x100, 0x00c7c419 )
ROM_LOAD( "digdug.2n", 0x0120, 0x100, 0xe9b3e08e )
ROM_REGION(0x10000) /* 64k for the second CPU */
ROM_LOAD( "dd1.5b", 0x0000, 0x1000, 0x370ef9b4 )
ROM_LOAD( "dd1.6b", 0x1000, 0x1000, 0x361eeb71 )
ROM_REGION(0x10000) /* 64k for the third CPU */
ROM_LOAD( "136007.107", 0x0000, 0x1000, 0xa41bce72 )
ROM_REGION(0x01000) /* 4k for the playfield graphics */
ROM_LOAD( "dd1.10b", 0x0000, 0x1000, 0x2cf399c2 )
ROM_REGION(0x100) /* sound prom */
ROM_LOAD( "digdug.spr", 0x0000, 0x100, 0x7a2815b4 )
ROM_END
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 (works for Namco & Atari) */
if (RAM[0x89b1] == 0x35 && RAM[0x89b4] == 0x35)
{
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x89a0],37);
osd_fclose(f);
digdug_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[0x89a0],37);
osd_fclose(f);
}
}
struct GameDriver digdug_driver =
{
__FILE__,
0,
"digdug",
"Dig Dug (Atari)",
"1982",
"[Namco] (Atari license)",
"Aaron Giles\nMartin Scragg\nNicola Salmoria\nMirko Buffoni\nAlan J McCormick",
0,
&machine_driver,
0,
digdug_rom,
0, 0,
0,
0, /* sound_prom */
digdug_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
struct GameDriver digdugnm_driver =
{
__FILE__,
&digdug_driver,
"digdugnm",
"Dig Dug (Namco)",
"1982",
"Namco",
"Aaron Giles\nMartin Scragg\nNicola Salmoria\nMirko Buffoni\nAlan J McCormick",
0,
&machine_driver,
0,
digdugnm_rom,
0, 0,
0,
0, /* sound_prom */
digdug_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_DEFAULT,
hiload, hisave
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -