⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omegrace.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	{ 0x5c00, 0x5cff, MWA_RAM }, /* NVRAM */
	{ 0x8000, 0x8fff, MWA_RAM }, /* vector ram */
	{ 0x9000, 0x9fff, MWA_ROM }, /* vector rom */
	{ -1 }	/* end of table */
};


static struct MemoryReadAddress sound_readmem[] =
{
	{ 0x0000, 0x07ff, MRA_ROM },
	{ 0x1000, 0x13ff, MRA_RAM },
	{ -1 } /* end of table */
};

static struct MemoryWriteAddress sound_writemem[] =
{
	{ 0x0000, 0x07ff, MWA_ROM },
	{ 0x1000, 0x13ff, MWA_RAM },
	{ -1 } /* end of table */
};


static struct IOReadPort readport[] =
{
	{ 0x08, 0x08, omegrace_vg_go },
 	{ 0x09, 0x09, omegrace_watchdog_r },
	{ 0x0b, 0x0b, omegrace_vg_status_r }, /* vg_halt */
	{ 0x10, 0x10, input_port_0_r }, /* DIP SW C4 */
	{ 0x17, 0x17, input_port_1_r }, /* DIP SW C6 */
	{ 0x11, 0x11, input_port_2_r }, /* Player 1 input */
	{ 0x12, 0x12, input_port_3_r }, /* Player 2 input */
	{ 0x15, 0x15, omegrace_spinner1_r }, /* 1st controller */
	{ 0x16, 0x16, input_port_5_r }, /* 2nd controller (cocktail) */
	{ -1 }	/* end of table */
};

static struct IOWritePort writeport[] =
{
  	{ 0x0a, 0x0a, avgdvg_reset },
 	{ 0x13, 0x13, omegrace_leds_w }, /* coin counters, leds, flip screen */
	{ 0x14, 0x14, omegrace_soundlatch_w }, /* Sound command */
	{ -1 }	/* end of table */
};

static struct IOReadPort sound_readport[] =
{
	{ 0x00, 0x00, soundlatch_r },
	{ -1 }
};

static struct IOWritePort sound_writeport[] =
{
	{ 0x00, 0x00, AY8910_control_port_0_w },
	{ 0x01, 0x01, AY8910_write_port_0_w },
	{ 0x02, 0x02, AY8910_control_port_1_w },
	{ 0x03, 0x03, AY8910_write_port_1_w },
        { -1 }  /* end of table */
};

INPUT_PORTS_START( input_ports )
	PORT_START /* SW0 */
	PORT_DIPNAME ( 0x03, 0x00, "1st Bonus Ship", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "40K" )
	PORT_DIPSETTING (    0x01, "50K" )
	PORT_DIPSETTING (    0x02, "70K" )
	PORT_DIPSETTING (    0x03, "100K" )
	PORT_DIPNAME ( 0x0c, 0x00, "2nd/3rd Bonus", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "150K 250K" )
	PORT_DIPSETTING (    0x04, "250K 500K" )
	PORT_DIPSETTING (    0x08, "500K 750K" )
	PORT_DIPSETTING (    0x0c, "750K 1000K" )
	PORT_DIPNAME ( 0x30, 0x00, "Credit/Ship", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "1/2 2/4" )
	PORT_DIPSETTING (    0x10, "1/2 2/5" )
	PORT_DIPSETTING (    0x20, "1/3 2/6" )
	PORT_DIPSETTING (    0x30, "1/3 2/7" )
	PORT_DIPNAME ( 0x40, 0x00, "Unknown1", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "Off" )
	PORT_DIPSETTING (    0x40, "On" )
	PORT_DIPNAME ( 0x80, 0x00, "Unknown2", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "Off" )
	PORT_DIPSETTING (    0x80, "On" )

	PORT_START /* SW1 */
	PORT_DIPNAME ( 0x07, 0x07, "Left Coin", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "1 Coin/2 Credits" )
	PORT_DIPSETTING (    0x01, "1 Coin/3 Credits" )
	PORT_DIPSETTING (    0x02, "1 Coin/5 Credits" )
	PORT_DIPSETTING (    0x03, "4 Coins/5 Credits" )
	PORT_DIPSETTING (    0x04, "3 Coins/4 Credits" )
	PORT_DIPSETTING (    0x05, "2 Coins/3 Credits" )
	PORT_DIPSETTING (    0x06, "2 Coins/1 Credit" )
	PORT_DIPSETTING (    0x07, "1 Coin/1 Credit" )
	PORT_DIPNAME ( 0x38, 0x00, "Right Coin", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "1 Coin/2 Credits" )
	PORT_DIPSETTING (    0x08, "1 Coin/3 Credits" )
	PORT_DIPSETTING (    0x10, "1 Coin/5 Credits" )
	PORT_DIPSETTING (    0x18, "4 Coins/5 Credits" )
	PORT_DIPSETTING (    0x20, "3 Coins/4 Credits" )
	PORT_DIPSETTING (    0x28, "2 Coins/3 Credits" )
	PORT_DIPSETTING (    0x30, "2 Coins/1 Credit" )
	PORT_DIPSETTING (    0x38, "1 Coin/1 Credit" )
	PORT_DIPNAME ( 0x40, 0x00, "Free Play", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "Off" )
	PORT_DIPSETTING (    0x40, "On" )
	PORT_DIPNAME ( 0x80, 0x00, "Cabinet", IP_KEY_NONE )
	PORT_DIPSETTING (    0x00, "Upright" )
	PORT_DIPSETTING (    0x80, "Cocktail" )

	PORT_START /* IN2 -port 0x11 */
	PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
	PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
	PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_TILT )
	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
	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" )

	PORT_START /* IN3 - port 0x12 */
	PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
	PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
	PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_START3 | IPF_COCKTAIL )
	PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_START4 | IPF_COCKTAIL )
	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 )
	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START2 )

	PORT_START /* IN4 - port 0x15 - spinner */
	PORT_ANALOG (0x3f, 0x00, IPT_DIAL, 12, 0, 0, 0 )

	PORT_START /* IN5 - port 0x16 - second spinner */
	PORT_ANALOG (0x3f, 0x00, IPT_DIAL | IPF_COCKTAIL, 12, 0, 0, 0 )
INPUT_PORTS_END



static struct GfxLayout fakelayout =
{
        1,1,
        0,
        1,
        { 0 },
        { 0 },
        { 0 },
        0
};

static struct GfxDecodeInfo gfxdecodeinfo[] =
{
        { 0, 0,      &fakelayout,     0, 256 },
        { -1 } /* end of array */
};

static unsigned char color_prom[] = { VEC_PAL_BW };



static struct AY8910interface ay8910_interface =
{
	2,	/* 2 chips */
	1500000,	/* 1.5 MHz */
	{ 255, 255 },
	{ 0 },
	{ 0 },
	{ 0 },
	{ 0 }
};



static struct MachineDriver machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_Z80,
			3000000,	/* 3.0 MHz */
			0,
			readmem,writemem,readport,writeport,
			0,0, /* no vblank interrupt */
			interrupt, 250 /* 250 Hz */
		},
		{
			CPU_Z80 | CPU_AUDIO_CPU,
			1500000,	/* 1.5 MHz */
			2, 		/* memory region 1*/
			sound_readmem,sound_writemem,sound_readport,sound_writeport,
			0, 0, /* no vblank interrupt */
			nmi_interrupt, 250 /* 250 Hz */
		}
	},
	40, 0,	/* frames per second, vblank duration (vector game, so no vblank) */
	1, /* the soundcpu is synchronized by the new timer code */

	omegrace_init_machine,

	/* video hardware */
	400, 300, { 0, 1020, -10, 1010 },
	gfxdecodeinfo,
	256,256,
	avg_init_colors,

	VIDEO_TYPE_VECTOR,
	0,
	dvg_start,
	dvg_stop,
	dvg_screenrefresh,

	/* sound hardware */
	0,0,0,0,
	{
		{
			SOUND_AY8910,
			&ay8910_interface
		}
	}
};


/***************************************************************************

  Game driver(s)

***************************************************************************/

ROM_START( omegrace_rom )
	ROM_REGION(0x10000)	/* 64k for code */
	ROM_LOAD( "omega.m7",     0x0000, 0x1000, 0x0424d46e )
	ROM_LOAD( "omega.l7",     0x1000, 0x1000, 0xedcd7a7d )
	ROM_LOAD( "omega.k7",     0x2000, 0x1000, 0x6d10f197 )
	ROM_LOAD( "omega.j7",     0x3000, 0x1000, 0x8e8d4b54 )
	ROM_LOAD( "omega.e1",     0x9000, 0x0800, 0x1d0fdf3a )
	ROM_LOAD( "omega.f1",     0x9800, 0x0800, 0xd44c0814 )

	ROM_REGION_DISPOSE(0x0800)	/* temporary space for graphics (disposed after conversion) */
	ROM_REGION(0x10000)	/* 64k for audio cpu */
	ROM_LOAD( "sound.k5",     0x0000, 0x0800, 0x7d426017 )
ROM_END

static int hiload(void)
{
	/* no reason to check hiscore table. It's an NV_RAM! */
	/* However, it does not work yet. Don't know why. BW */
	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,0)) != 0)
	{
		osd_fread(f,&RAM[0x5c00],0x100);
		osd_fclose(f);
	}
	return 1;
}

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[0x5c00],0x100);
		osd_fclose(f);
	}
}

struct GameDriver omegrace_driver =
{
	__FILE__,
	0,
	"omegrace",
	"Omega Race",
	"1981",
	"Midway",
	"Al Kossow (original code)\nBernd Wiebelt (MAME driver)\ndedicated to Natalia & Lara\n"VECTOR_TEAM,
	0,
	&machine_driver,
	0,

	omegrace_rom,
	0, 0,
	0,
	0,	/* sound_prom */

	input_ports,

	color_prom, 0, 0,
	ORIENTATION_DEFAULT,

	hiload, hisave
};


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -