Previous 15994 Revisions Next

r5600 Sunday 6th September, 2009 at 01:26:20 UTC by Barry Rodewald
[X1] Made keyboard IRQs occur on key release, in addition to key presses, and corrected tenkey 'game' keys.
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5599r5600
359359 *
360360 *************************************/
361361
362static UINT8 sub_cmd,key_flag;
362static UINT8 sub_cmd;//,key_flag;
363363static UINT8 sub_cmd_length;
364364static UINT8 sub_val[4];
365365
r5599r5600
446446         if(key3 & 0x00000008) ret |= 0x01;  // C
447447         break;
448448      case 1:
449         if(pad & 0x00000040) ret |= 0x80;  // Tenkey 7
450         if(pad & 0x00000008) ret |= 0x40;  // Tenkey 4
451         if(pad & 0x00000001) ret |= 0x20;  // Tenkey 1
452         if(pad & 0x00000080) ret |= 0x10;  // Tenkey 8
453         if(pad & 0x00000002) ret |= 0x08;  // Tenkey 2
454         if(pad & 0x00000100) ret |= 0x04;  // Tenkey 9
455         if(pad & 0x00000020) ret |= 0x02;  // Tenkey 6
456         if(pad & 0x00000004) ret |= 0x01;  // Tenkey 3
449         if(pad & 0x00000080) ret |= 0x80;  // Tenkey 7
450         if(pad & 0x00000010) ret |= 0x40;  // Tenkey 4
451         if(pad & 0x00000002) ret |= 0x20;  // Tenkey 1
452         if(pad & 0x00000100) ret |= 0x10;  // Tenkey 8
453         if(pad & 0x00000004) ret |= 0x08;  // Tenkey 2
454         if(pad & 0x00000200) ret |= 0x04;  // Tenkey 9
455         if(pad & 0x00000040) ret |= 0x02;  // Tenkey 6
456         if(pad & 0x00000008) ret |= 0x01;  // Tenkey 3
457457         break;
458458      case 2:
459459         if(key1 & 0x10000000) ret |= 0x80;  // ESC
r5599r5600
16371637static TIMER_CALLBACK(keyboard_callback)
16381638{
16391639   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1640   UINT8 key_press;
1641   static UINT8 old_key_val;
1640   UINT32 key1 = input_port_read(machine,"key1");
1641   UINT32 key2 = input_port_read(machine,"key2");
1642   UINT32 key3 = input_port_read(machine,"key3");
1643   UINT32 key4 = input_port_read(machine,"tenkey");
1644   static UINT32 old_key1,old_key2,old_key3,old_key4;
16421645
16431646   if(key_irq_vector)
16441647   {
1645      key_press = check_keyboard_press(machine);
1646      if(key_press && key_press != old_key_val)
1648      if((key1 != old_key1) || (key2 != old_key2) || (key3 != old_key3) || (key4 != old_key4))
16471649      {
1648         old_key_val = key_press;
1650         // generate keyboard IRQ
16491651         sub_io_w(space,0,0xe6);
1650         cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
1651      }
1652      else
1653      {
1654         old_key_val = key_press;
1655         key_flag = 0;
1656      }
1652         cputag_set_input_line(machine,"maincpu",0,ASSERT_LINE);
1653         old_key1 = key1;
1654         old_key2 = key2;
1655         old_key3 = key3;
1656         old_key4 = key4;
1657      }
16571658   }
16581659}
16591660

Previous 15994 Revisions Next


© 1998-2018 The MESS Team