src/mess/drivers/pb1000.c
| r9931 | r9932 | |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | 8 | - improve the pb2000c gate array emulation |
| 9 | | - pb1000 touchscreen |
| 10 | 9 | - i/o port |
| 11 | 10 | |
| 12 | 11 | ****************************************************************************/ |
| r9931 | r9932 | |
| 44 | 43 | UINT16 pb2000c_kb_r(running_machine *machine); |
| 45 | 44 | UINT16 pb1000_kb_r(running_machine *machine); |
| 46 | 45 | void kb_matrix_w(running_machine *machine, UINT8 matrix); |
| 46 | UINT16 read_touchscreen(running_machine *machine, UINT8 line); |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | static ADDRESS_MAP_START(pb1000_mem, ADDRESS_SPACE_PROGRAM, 16, pb1000_state) |
| r9931 | r9932 | |
| 163 | 163 | PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_LALT) |
| 164 | 164 | PORT_START("NULL") |
| 165 | 165 | 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") |
| 166 | 174 | INPUT_PORTS_END |
| 167 | 175 | |
| 168 | 176 | static INPUT_PORTS_START( pb2000c ) |
| r9931 | r9932 | |
| 345 | 353 | } |
| 346 | 354 | |
| 347 | 355 | |
| 356 | UINT16 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 | |
| 348 | 371 | UINT16 pb1000_state::pb1000_kb_r(running_machine *machine) |
| 349 | 372 | { |
| 350 | 373 | static const char *const bitnames[] = {"NULL", "KO1", "KO2", "KO3", "KO4", "KO5", "KO6", "KO7", "KO8", "KO9", "KO10", "KO11", "KO12", "NULL", "NULL", "NULL"}; |
| r9931 | r9932 | |
| 354 | 377 | { |
| 355 | 378 | //Read all the input lines |
| 356 | 379 | for (int line = 1; line <= 12; line++) |
| 380 | { |
| 357 | 381 | data |= input_port_read(machine, bitnames[line]); |
| 382 | data |= read_touchscreen(machine, line); |
| 383 | } |
| 358 | 384 | |
| 359 | 385 | } |
| 360 | 386 | else |
| 361 | 387 | { |
| 362 | 388 | data = input_port_read(machine, bitnames[m_kb_matrix & 0x0f]); |
| 389 | data |= read_touchscreen(machine, m_kb_matrix & 0x0f); |
| 363 | 390 | } |
| 364 | 391 | |
| 365 | 392 | return data; |