Previous 15994 Revisions Next

r1222 Sunday 4th November, 2007 at 17:10:12 UTC by Stefano Priore
[A7800] Input ports cleanup
[src/mess/drivers]a7800.c
[src/mess/machine]a7800.c

src/mess/machine/a7800.c
r1221r1222
5252
5353/****** RIOT ****************************************/
5454
55/* TODO: Convert the definitions into a syntax accepting readinputportbytag */
56
5557static const struct riot6532_interface r6532_interface =
5658{
5759   input_port_0_r,
r1221r1222
128130   a7800_ctrl_lock = 0;
129131   a7800_ctrl_reg = 0;
130132   maria_flag = 0;
131   
133
132134   /* set banks to default states */
133135   memory = memory_region(REGION_CPU1);
134136   memory_set_bankptr( 1, memory + 0x4000 );
r1221r1222
360362   switch(offset)
361363   {
362364      case 0x08:
363           return((input_port_1_r(0) & 0x02) << 6);
365           return((readinputportbytag("buttons") & 0x02) << 6);
364366      case 0x09:
365           return((input_port_1_r(0) & 0x08) << 4);
367           return((readinputportbytag("buttons") & 0x08) << 4);
366368      case 0x0A:
367           return((input_port_1_r(0) & 0x01) << 7);
369           return((readinputportbytag("buttons") & 0x01) << 7);
368370      case 0x0B:
369           return((input_port_1_r(0) & 0x04) << 5);
371           return((readinputportbytag("buttons") & 0x04) << 5);
370372      case 0x0c:
371         if((input_port_1_r(0) & 0x08) ||(input_port_1_r(0) & 0x02))
373         if((readinputportbytag("buttons") & 0x08) ||(readinputportbytag("buttons") & 0x02))
372374            return 0x00;
373375         else
374376            return 0x80;
375377      case 0x0d:
376         if((input_port_1_r(0) & 0x01) ||(input_port_1_r(0) & 0x04))
378         if((readinputportbytag("buttons") & 0x01) ||(readinputportbytag("buttons") & 0x04))
377379            return 0x00;
378380         else
379381            return 0x80;
src/mess/drivers/a7800.c
r1221r1222
4949
5050
5151INPUT_PORTS_START( a7800 )
52   PORT_START      /* IN0 */
53   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2)
54   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2)
55   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2)
56   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2)
57   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1)
58   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1)
59   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1)
60   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1)
52   PORT_START_TAG("joysticks")            /* IN0 */
53   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)    PORT_PLAYER(2) PORT_8WAY
54   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN)  PORT_PLAYER(2) PORT_8WAY
55   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT)  PORT_PLAYER(2) PORT_8WAY
56   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY
57   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)    PORT_PLAYER(1) PORT_8WAY
58   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN)  PORT_PLAYER(1) PORT_8WAY
59   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT)  PORT_PLAYER(1) PORT_8WAY
60   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY
6161
62   PORT_START      /* IN1 */
63   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
64   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
65   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2)
66   PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1)
67   PORT_BIT ( 0xF0, IP_ACTIVE_LOW, IPT_UNUSED )
62   PORT_START_TAG("buttons")              /* IN1 */
63   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1)       PORT_PLAYER(2)
64   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1)       PORT_PLAYER(1)
65   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON2)       PORT_PLAYER(2)
66   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2)       PORT_PLAYER(1)
67   PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED)
6868
69   PORT_START      /* IN2 */
70   PORT_BIT (0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
71   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_VBLANK)
69   PORT_START_TAG("vblank")               /* IN2 */
70   PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
71   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_VBLANK)
7272
73   PORT_START      /* IN3 */
74   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_2)
75   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Select")
76   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
77   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_CLOSEBRACE)
78   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
79   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
80   PORT_DIPNAME( 0x40, 0x00, "Left Diff. Switch" ) PORT_CODE(KEYCODE_3) PORT_TOGGLE
81   PORT_DIPSETTING(    0x40, "A" )
82   PORT_DIPSETTING(    0x00, "B" )
83   PORT_DIPNAME( 0x80, 0x00, "Right Diff. Switch" ) PORT_CODE(KEYCODE_4) PORT_TOGGLE
84   PORT_DIPSETTING(    0x80, "A" )
85   PORT_DIPSETTING(    0x00, "B" )
73   PORT_START_TAG("console_buttons")      /* IN3 */
74   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)  PORT_NAME("Reset")         PORT_CODE(KEYCODE_R)
75   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)  PORT_NAME("Select")        PORT_CODE(KEYCODE_S)
76   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
77   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)  PORT_NAME(DEF_STR(Pause))  PORT_CODE(KEYCODE_O)
78   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
79   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
80   PORT_DIPNAME(0x40, 0x00, "Left Difficulty Switch")
81   PORT_DIPSETTING(0x40, "A" )
82   PORT_DIPSETTING(0x00, "B" )
83   PORT_DIPNAME(0x80, 0x00, "Right Difficulty Switch")
84   PORT_DIPSETTING(0x80, "A" )
85   PORT_DIPSETTING(0x00, "B" )
8686INPUT_PORTS_END
8787
8888#define NTSC_GREY    \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team