Previous 15994 Revisions Next

r9932 Wednesday 5th January, 2011 at 17:52:57 UTC by Sandro Ronco
[PB1000] Added touchscreen support
[src/mess/drivers]pb1000.c

src/mess/drivers/pb1000.c
r9931r9932
66
77        TODO:
88        - improve the pb2000c gate array emulation
9        - pb1000 touchscreen
109        - i/o port
1110
1211****************************************************************************/
r9931r9932
4443   UINT16 pb2000c_kb_r(running_machine *machine);
4544   UINT16 pb1000_kb_r(running_machine *machine);
4645   void kb_matrix_w(running_machine *machine, UINT8 matrix);
46   UINT16 read_touchscreen(running_machine *machine, UINT8 line);
4747};
4848
4949static ADDRESS_MAP_START(pb1000_mem, ADDRESS_SPACE_PROGRAM, 16, pb1000_state)
r9931r9932
163163      PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F")      PORT_CODE(KEYCODE_LALT)
164164   PORT_START("NULL")
165165      PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED)
166
167   //touchscreen
168   PORT_START("POSX")
169      PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(0)
170   PORT_START("POSY")
171      PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_SENSITIVITY(120) PORT_KEYDELTA(0)
172   PORT_START("TOUCH")
173      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Touchscreen")
166174INPUT_PORTS_END
167175
168176static INPUT_PORTS_START( pb2000c )
r9931r9932
345353}
346354
347355
356UINT16 pb1000_state::read_touchscreen(running_machine *machine, UINT8 line)
357{
358   UINT8 x = input_port_read(machine, "POSX")/0x40;
359   UINT8 y = input_port_read(machine, "POSY")/0x40;
360
361   if (input_port_read(machine, "TOUCH"))
362   {
363      if (x == line-7)
364         return (0x1000<<y);
365   }
366
367   return 0x0000;
368}
369
370
348371UINT16 pb1000_state::pb1000_kb_r(running_machine *machine)
349372{
350373   static const char *const bitnames[] = {"NULL", "KO1", "KO2", "KO3", "KO4", "KO5", "KO6", "KO7", "KO8", "KO9", "KO10", "KO11", "KO12", "NULL", "NULL", "NULL"};
r9931r9932
354377   {
355378      //Read all the input lines
356379      for (int line = 1; line <= 12; line++)
380      {
357381         data |= input_port_read(machine, bitnames[line]);
382         data |= read_touchscreen(machine, line);
383      }
358384
359385   }
360386   else
361387   {
362388      data = input_port_read(machine, bitnames[m_kb_matrix & 0x0f]);
389      data |= read_touchscreen(machine, m_kb_matrix & 0x0f);
363390   }
364391
365392   return data;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team