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

📄 smashtv.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	PORT_BITX(0x40, IP_ACTIVE_LOW, 0, "Service Credit", OSD_KEY_7, IP_JOY_NONE, 0)
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) /* coin3 */

	PORT_START	    /* IN3 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER2 )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* volume down */
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* volume up */
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER1 )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )

	PORT_START	    /* IN4 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER3 | IPF_8WAY )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER3 | IPF_8WAY )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER3 | IPF_8WAY )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	    /* IN5 */
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER4 | IPF_8WAY )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER4 | IPF_8WAY )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER4 | IPF_8WAY )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 | IPF_8WAY )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	    /* DS1 */
	PORT_DIPNAME( 0x80, 0x80, "Players", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "4" )
	PORT_DIPSETTING(    0x80, "2" )
	PORT_DIPNAME( 0x40, 0x40, "Validator", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Installed" )
	PORT_DIPSETTING(    0x40, "None" )
	PORT_DIPNAME( 0x20, 0x20, "Video", IP_KEY_NONE )
	PORT_DIPSETTING(    0x00, "Off" )
	PORT_DIPSETTING(    0x20, "Show" )
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_DIPNAME( 0x02, 0x00, "Powerup Test", IP_KEY_NONE )
	PORT_DIPSETTING(    0x02, "On" )
	PORT_DIPSETTING(    0x00, "Off" )
	PORT_DIPNAME( 0x01, 0x01, "Test Switch", IP_KEY_NONE )
	PORT_DIPSETTING(    0x01, "Off" )
	PORT_DIPSETTING(    0x00, "On" )

	PORT_START	    /* DS2 */
	PORT_DIPNAME( 0x80, 0x00, "Coinage Source", IP_KEY_NONE )
	PORT_DIPSETTING(    0x80, "Dipswitch" )
	PORT_DIPSETTING(    0x00, "CMOS" )
	PORT_DIPNAME( 0x7c, 0x7c, "Coinage", IP_KEY_NONE )
	PORT_DIPSETTING(    0x7c, "USA-1" )
	PORT_DIPSETTING(    0x3c, "USA-2" )
	PORT_DIPSETTING(    0x5c, "USA-3" )
	PORT_DIPSETTING(    0x1c, "USA-4" )
	PORT_DIPSETTING(    0x6c, "USA-ECA" )
	PORT_DIPSETTING(    0x74, "German-1" )
	PORT_DIPSETTING(    0x34, "German-2" )
	PORT_DIPSETTING(    0x54, "German-3" )
	PORT_DIPSETTING(    0x14, "German-4" )
	PORT_DIPSETTING(    0x64, "German-5" )
	PORT_DIPSETTING(    0x78, "French-1" )
	PORT_DIPSETTING(    0x38, "French-2" )
	PORT_DIPSETTING(    0x58, "French-3" )
	PORT_DIPSETTING(    0x18, "French-4" )
	PORT_DIPSETTING(    0x68, "French-ECA" )
	PORT_DIPSETTING(    0x0c, "Free Play" )
	PORT_DIPNAME( 0x03, 0x00, "Coin Counters", IP_KEY_NONE )
	PORT_DIPSETTING(    0x03, "1 Counter, 1 count/coin" )
	PORT_DIPSETTING(    0x02, "1 Counter, Totalizing" )
	PORT_DIPSETTING(    0x01, "2 Counters, 1 count/coin" )
	PORT_DIPSETTING(    0x00, "1 Counter, 1 count/coin" )


	PORT_START	    /* IN8 */
	PORT_DIPNAME( 0xff, 0xff, "IN8", IP_KEY_NONE )
	PORT_DIPSETTING(    0xff, "Off" )
	PORT_DIPSETTING(    0x00, "On" )
	PORT_START	    /* IN9 */
	PORT_DIPNAME( 0xff, 0xff, "IN9", IP_KEY_NONE )
	PORT_DIPSETTING(    0xff, "Off" )
	PORT_DIPSETTING(    0x00, "On" )

INPUT_PORTS_END

/*
 *   Sound interface
 */

static struct DACinterface dac_interface =
{
	3, /* DAC, CVSD, DAC2 (narc only) */
	{ 30, 30, 30 }
};
static struct YM2151interface ym2151_interface =
{
	1,          /* 1 chip */
	3579545,    /* 3.579545 MHz */
	{ 30 },
	{ smashtv_ym2151_int }
};
static struct YM2151interface narc_ym2151_interface =
{
	1,          /* 1 chip */
	3579545,    /* 3.579545 MHz */
	{ 30 },
	{ narc_ym2151_int }
};
static struct OKIM6295interface okim6295_interface =
{
	1,          /* 1 chip */
	8000,       /* 8000 Hz frequency */
	4,          /* memory region 4 */
	{ 50 }
};

void mk_adpcm_bs_w(int offset, int data)
{
	if (!(data&0x04))
	{
		okim6295_interface.region=4;
	}
	else
	{
		if (data&0x01)
		{
			okim6295_interface.region=5;
		}
		else
		{
			okim6295_interface.region=6;
		}
	}
}

/* Y-unit games */
static struct MachineDriver smashtv_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_TMS34010,
			50000000,	/* 50 Mhz */
			0,
			smashtv_readmem,smashtv_writemem,0,0,
			ignore_interrupt,1
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			8000000,	/* 8 Mhz */
			3,
			smashtv_sound_readmem,smashtv_sound_writemem,0,0,
			ignore_interrupt,1
		},
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,
	smashtv_init_machine,

	/* video hardware */
	512, 288, { 0, 394, 20, 275 },

	0,
	65536,0,
        0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_16BIT,
	0,
	wms_vh_start,
	wms_vh_stop,
	wms_vh_screenrefresh,

	/* sound hardware */
	SOUND_SUPPORTS_STEREO,0,0,0,
	{
		{
			SOUND_DAC,
			&dac_interface
		},
		{
			SOUND_YM2151,
			&ym2151_interface
		}
	}
};

/* Z-Unit */
static struct MachineDriver narc_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_TMS34010,
			48000000,	/* 48 Mhz */
			0,
			smashtv_readmem,smashtv_writemem,0,0,
			ignore_interrupt,1
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			2000000,	/* 2 Mhz */
			3,
			narc_music_readmem,narc_music_writemem,0,0,
			ignore_interrupt,1
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			2000000,	/* 2 Mhz */
			4,
			narc_digitizer_readmem,narc_digitizer_writemem,0,0,
			ignore_interrupt,1
		},
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,
	narc_init_machine,

	/* video hardware */
    512, 432, { 0, 511, 27, 426 },

	0,
	65536,0,
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_16BIT,
	0,
	wms_vh_start,
	wms_vh_stop,
	wms_vh_screenrefresh,

	/* sound hardware */
	SOUND_SUPPORTS_STEREO,0,0,0,
	{
		{
			SOUND_DAC,
			&dac_interface
		},
		{
			SOUND_YM2151,
			&narc_ym2151_interface
		}
	}
};

static struct MachineDriver trog_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_TMS34010,
			50000000,	/* 50 Mhz */
			0,
			smashtv_readmem,smashtv_writemem,0,0,
			ignore_interrupt,1
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			8000000,	/* 8 Mhz */
			3,
			smashtv_sound_readmem,smashtv_sound_writemem,0,0,
			ignore_interrupt,1
		},
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,
	trog_init_machine,

	/* video hardware */
	512, 288, { 0, 395, 20, 275 },

	0,
	65536,0,
	0,

	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_16BIT,
	0,
	wms_vh_start,
	wms_vh_stop,
	wms_vh_screenrefresh,

	/* sound hardware */
	SOUND_SUPPORTS_STEREO,0,0,0,
	{
		{
			SOUND_DAC,
			&dac_interface
		},
		{
			SOUND_YM2151,
			&ym2151_interface
		}
	}
};

/* Y-Unit */
static struct MachineDriver mk_machine_driver =
{
	/* basic machine hardware */
	{
		{
			CPU_TMS34010,
			50000000,	/* 50 Mhz */
			0,
			smashtv_readmem,smashtv_writemem,0,0,
			ignore_interrupt,1
		},
		{
			CPU_M6809 | CPU_AUDIO_CPU,
			8000000,	/* 8 Mhz */
			3,
			mk_sound_readmem,mk_sound_writemem,0,0,
			ignore_interrupt,1
		},
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1, /* cpu slices */
	mk_init_machine,

	/* video hardware */
	512, 304, { 0, 399, 27, 281 },

	0,
	65536,0,
    0,

    VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_16BIT,
	0,
	wms_vh_start,
	wms_vh_stop,
	wms_vh_screenrefresh,

	/* sound hardware */
	SOUND_SUPPORTS_STEREO,0,0,0,
	{
		{
			SOUND_DAC,
			&dac_interface
		},
		{
			SOUND_YM2151,
			&narc_ym2151_interface
		},
		{
			SOUND_OKIM6295,
			&okim6295_interface

⌨️ 快捷键说明

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