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

📄 gameplan.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 3 页
字号:
			  "P2 Move Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)

    PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */

    PORT_DIPNAME(0x03, 0x03, "Coinage 1p/2p", IP_KEY_NONE )
    PORT_DIPSETTING(   0x00, "Free Play" )
    PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
    PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
    PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )

    PORT_DIPNAME(0x08, 0x08, "Lives", IP_KEY_NONE )
	PORT_DIPSETTING(   0x00, "4" )
	PORT_DIPSETTING(   0x08, "5" )

	PORT_DIPNAME(0xc0, 0xc0, "Reaction", IP_KEY_NONE )
	PORT_DIPSETTING(   0xc0, "Slowest" )
	PORT_DIPSETTING(   0x80, "Slow" )
	PORT_DIPSETTING(   0x40, "Fast" )
	PORT_DIPSETTING(   0x00, "Fastest" )

	PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */

    PORT_DIPNAME(0x40, 0x40, "Flip Screen", IP_KEY_NONE )
	PORT_DIPSETTING(   0x40, "Off" )
	PORT_DIPSETTING(   0x00, "On" )

	PORT_DIPNAME(0x80, 0x80, "Cabinet", IP_KEY_NONE )
	PORT_DIPSETTING(   0x80, "Upright" )
	PORT_DIPSETTING(   0x00, "Cocktail" )
INPUT_PORTS_END


INPUT_PORTS_START( megatack_input_ports )
    PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
    PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_TILT,
                      "Slam", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BITX(0x08, IP_ACTIVE_LOW, 0,
                      "Do Tests", OSD_KEY_F1, IP_JOY_NONE, 0)
    PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE,
                      "Select Test", OSD_KEY_F2, IP_JOY_NONE, 0)
    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )      /* coin sw. no.3 */
    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )      /* coin sw. no.2 */
    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )      /* coin sw. no.1 */

    PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )  /* 2 player start */
    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )  /* 1 player start */

    PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1,
                      "Player 1 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
/*        PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1,
                          "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
        PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1,
                          "P1 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)*/
        PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1,
                      "Player 1 Move Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1,
                      "Player 1 Move Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */

    PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2,
                      "Player 2 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
/*        PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2,
                          "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
        PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2,
                          "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)*/
    PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2,
                      "Player 2 Move Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2,
                      "Player 2 Move Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */

    PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */

    PORT_DIPNAME(0x03, 0x03, "Coinage 1p/2p", IP_KEY_NONE )
    PORT_DIPSETTING(   0x00, "Free Play" )
    PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
    PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
    PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )

    PORT_DIPNAME(0x08, 0x08, "Lives", IP_KEY_NONE )
    PORT_DIPSETTING(   0x08, "3" )
    PORT_DIPSETTING(   0x00, "4" )

    PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */

    PORT_DIPNAME(0x07, 0x07, "Bonus Life", IP_KEY_NONE )
    PORT_DIPSETTING(   0x07, "20000" )
    PORT_DIPSETTING(   0x06, "30000" )
    PORT_DIPSETTING(   0x05, "40000" )
    PORT_DIPSETTING(   0x04, "50000" )
    PORT_DIPSETTING(   0x03, "60000" )
    PORT_DIPSETTING(   0x02, "70000" )
    PORT_DIPSETTING(   0x01, "80000" )
    PORT_DIPSETTING(   0x00, "90000" )

    PORT_DIPNAME(0x10, 0x10, "Monitor View", IP_KEY_NONE )
    PORT_DIPSETTING(   0x10, "Direct" )
    PORT_DIPSETTING(   0x00, "Mirror" )

    PORT_DIPNAME(0x20, 0x20, "Monitor Orientation", IP_KEY_NONE )
    PORT_DIPSETTING(   0x20, "Horizontal" )
    PORT_DIPSETTING(   0x00, "Vertical" )

    PORT_DIPNAME(0x40, 0x40, "Flip Screen", IP_KEY_NONE )
    PORT_DIPSETTING(   0x40, "Off" )
    PORT_DIPSETTING(   0x00, "On" )

    PORT_DIPNAME(0x80, 0x80, "Cabinet", IP_KEY_NONE )
    PORT_DIPSETTING(   0x80, "Upright" )
    PORT_DIPSETTING(   0x00, "Cocktail" )
INPUT_PORTS_END


INPUT_PORTS_START( challeng_input_ports )
    PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
    PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_TILT,
                      "Slam", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BITX(0x08, IP_ACTIVE_LOW, 0,
                      "Do Tests", OSD_KEY_F1, IP_JOY_NONE, 0)
    PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE,
                      "Select Test", OSD_KEY_F2, IP_JOY_NONE, 0)
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )      /* coin sw. no.3 */
    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )      /* coin sw. no.2 */
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )      /* coin sw. no.1 */

    PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */

    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )  /* 2 player start */
    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )  /* 1 player start */

    PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */

    PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1,
                          "P1 Warp", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1,
                          "P1 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1,
                          "P1 Bomb", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1,
                          "P1 Move Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1,
                          "P1 Move Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */

    PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */

    PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2,
                          "P2 Warp", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2,
                          "P2 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2,
                          "P2 Bomb", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2,
                          "P2 Move Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
    PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2,
                          "P2 Move Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0)
    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */

    PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */

    PORT_DIPNAME(0x03, 0x03, "Coinage 1p/2p", IP_KEY_NONE )
    PORT_DIPSETTING(   0x00, "Free Play" )
    PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
    PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
    PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )

    PORT_DIPNAME(0xc0, 0xc0, "Lives", IP_KEY_NONE )
    PORT_DIPSETTING(   0xc0, "3" )
    PORT_DIPSETTING(   0x80, "4" )
    PORT_DIPSETTING(   0x40, "5" )
    PORT_DIPSETTING(   0x00, "6" )

    PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
    PORT_DIPNAME(0x07, 0x07, "Bonus Life", IP_KEY_NONE )
    PORT_DIPSETTING(   0x01, "20000" )
    PORT_DIPSETTING(   0x00, "30000" )
    PORT_DIPSETTING(   0x07, "40000" )
    PORT_DIPSETTING(   0x06, "50000" )
    PORT_DIPSETTING(   0x05, "60000" )
    PORT_DIPSETTING(   0x04, "70000" )
    PORT_DIPSETTING(   0x03, "80000" )
    PORT_DIPSETTING(   0x02, "90000" )
    PORT_DIPNAME(0x10, 0x10, "Monitor View", IP_KEY_NONE )
    PORT_DIPSETTING(   0x10, "Direct" )
    PORT_DIPSETTING(   0x00, "Mirror" )
    PORT_DIPNAME(0x20, 0x20, "Monitor Orientation", IP_KEY_NONE )
    PORT_DIPSETTING(   0x20, "Horizontal" )
    PORT_DIPSETTING(   0x00, "Vertical" )
    PORT_DIPNAME(0x40, 0x40, "Flip Screen", IP_KEY_NONE )
    PORT_DIPSETTING(   0x40, "Off" )
    PORT_DIPSETTING(   0x00, "On" )
    PORT_DIPNAME(0x80, 0x80, "Cabinet", IP_KEY_NONE )
    PORT_DIPSETTING(   0x80, "Upright" )
    PORT_DIPSETTING(   0x00, "Cocktail" )
INPUT_PORTS_END



static unsigned char palette[] =
{
	0xff,0xff,0xff, /* 0 WHITE   */
	0x20,0xff,0xff, /* 1 CYAN    */
	0xff,0x20,0xff, /* 2 MAGENTA */
	0x20,0x20,0xFF, /* 3 BLUE    */
	0xff,0xff,0x20, /* 4 YELLOW  */
	0x20,0xff,0x20, /* 5 GREEN   */
	0xff,0x20,0x20, /* 6 RED     */
	0x00,0x00,0x00, /* 7 BLACK   */
};


static unsigned short colortable[] =
{
	0, 0,	0, 1,	0, 2,	0, 3,	0, 4,	0, 5,	0, 6,	0, 7,
};


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


static struct MachineDriver machine_driver =
{
    /* basic machine hardware */
    {							/* MachineCPU */
		{
			CPU_M6502,
			3579000 / 4,		/* 3.579 / 4 MHz */
			0,					/* memory_region */
			readmem, writemem, 0, 0,
			gameplan_interrupt,1 /* 1 interrupt per frame */
		},
		{
            CPU_M6502 | CPU_AUDIO_CPU,
			3579000 / 4,		/* 3.579 / 4 MHz */
			2,					/* memory_region */
			readmem_snd,writemem_snd,0,0,
			gameplan_interrupt,1
		},
	},
	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
	1,							/* CPU slices per frame */
    0,							/* init_machine */

    /* video hardware */
    32*8, 32*8,					/* screen_width, height */
    { 0, 32*8-1, 0, 32*8-1 },		/* visible_area */
    0,
    sizeof(palette)/3, sizeof(colortable)/sizeof(short),
	0,

	VIDEO_TYPE_RASTER, 0,
	gameplan_vh_start,
	gameplan_vh_stop,
	gameplan_vh_screenrefresh,

	0, 0, 0, 0,
	{
		{
			SOUND_AY8910,
			&ay8910_interface
		}
	}
};

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

  Game driver(s)

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

/*
the manuals for Megattack and the schematics for Kaos are up
on spies now. I took a quick look at the rom mapping for kaos
and it looks like the roms are split this way:

9000 G2 bot 2k
9800 J2 bot 2k
A000 J1 bot 2k
A800 G1 bot 2k
B000 F1 bot 2k
B800 E1 bot 2k

D000 G2 top 2k
D800 J2 top 2k
E000 J1 top 2k
E800 G1 top 2k
F000 F1 top 2k
F800 E1 top 2k

⌨️ 快捷键说明

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