Previous 15994 Revisions Next

r8712 Wednesday 4th August, 2010 at 22:09:11 UTC by Angelo Salese
[PC-6001]: improved the joycode handling
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r8711r8712
622622   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
623623   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
624624   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
625   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
625   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
626626   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
627627   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
628628
r8711r8712
632632   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
633633   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
634634   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
635   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
635   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
636636   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
637637   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
638638
r8711r8712
863863
864864static UINT8 check_joy_press(running_machine *machine)
865865{
866   /* check joycode */
867   {
868      UINT8 p1_key = input_port_read(machine,"P1") ^ 0xff;
866   UINT8 p1_key = input_port_read(machine,"P1") ^ 0xff;
867   static UINT8 joy_press;
869868
870      popmessage("%02x",p1_key);
871
872869      /*
873870         PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
874871         PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r8711r8712
880877         PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
881878      */
882879
883      if(p1_key & 0x01) return 0x64; //up
884      if(p1_key & 0x02) return 0x68; //down
885      if(p1_key & 0x04) return 0x60; //left
886      if(p1_key & 0x08) return 0x70; //right
887      if(p1_key & 0x10) return 0x80; //fire
880   joy_press = 0;
881
882   switch(p1_key & 0xf)
883   {
884      case 0x01: joy_press = 0x04; break; //up
885      case 0x02: joy_press = 0x08; break; //down
886      case 0x04: joy_press = 0x20; break;
887      case 0x05: joy_press = 0x24; break; //up-left
888      case 0x06: joy_press = 0x28; break; //down-left
889      case 0x08: joy_press = 0x10; break; //right
890      case 0x09: joy_press = 0x14; break; //up-right
891      case 0x0a: joy_press = 0x18; break;//down-right
888892   }
889893
890   return 0;
894   if(p1_key & 0x10) { joy_press |= 0x80; } //button 1 (space?)
895   if(p1_key & 0x20) { joy_press |= 0x01; } //button 2 (shift)
896
897   return joy_press;
891898}
892899
893900static TIMER_CALLBACK(cassette_callback)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team