Previous 199869 Revisions Next

r23891 Sunday 23rd June, 2013 at 21:31:54 UTC by Curt Coder
(MESS) ibm5170: Keyboard WIP. (nw)
[src/mess/machine]kb_pcat84.c kb_pcat84.h kb_pcxt83.c

trunk/src/mess/machine/kb_pcat84.c
r23890r23891
288288   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
289289   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
290290   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
291
292   PORT_START("SW1")
293   PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" )
294   PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" )
295   PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" )
296   PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" )
297   PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" )
298   PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" )
299   PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" )
300   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
301
302   PORT_START("SW2")
303   PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )
304   PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW )
305   PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )
306   PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
291307INPUT_PORTS_END
292308
293309
r23890r23891
349365     m_dr13(*this, "DR13"),
350366     m_dr14(*this, "DR14"),
351367     m_dr15(*this, "DR15"),
368     m_sw1(*this, "SW1"),
369     m_sw2(*this, "SW2"),
352370     m_db(0),
353371     m_cnt(0),
354     m_sense(0)
372     m_sense(0),
373     m_t1(1)
355374{
356375}
357376
r23890r23891
375394     m_dr13(*this, "DR13"),
376395     m_dr14(*this, "DR14"),
377396     m_dr15(*this, "DR15"),
397     m_sw1(*this, "SW1"),
398     m_sw2(*this, "SW2"),
378399     m_db(0),
379400     m_cnt(0),
380     m_sense(0)
401     m_sense(0),
402     m_t1(1)
381403{
382404}
383405
r23890r23891
391413
392414void ibm_pc_at_84_keyboard_device::device_start()
393415{
416   set_pc_kbdc_device();
417
394418   // state saving
395419   save_item(NAME(m_db));
396420   save_item(NAME(m_cnt));
397421   save_item(NAME(m_sense));
422   save_item(NAME(m_t1));
398423}
399424
400425
r23890r23891
431456
432457   m_db = data;
433458
434   if (BIT(data, 7))
459   if (!BIT(data, 7))
435460   {
436461      m_cnt = (data >> 3) & 0x0f;
437462   }
r23890r23891
459484   
460485   */
461486
462   UINT8 data = 0xfc;
487   UINT8 data = 0x01;
463488
489   m_t1 = 1;
490   data |= key_depressed() << 1;
491
492   data |= m_sw1->read() << 2;
493
464494   return data;
465495}
466496
r23890r23891
486516   
487517   */
488518
489   if (BIT(data, 0))
519   if (!BIT(data, 0))
490520   {
491521      m_sense = m_db & 0x07;
492522   }
523
524   m_t1 = BIT(data, 1);
493525}
494526
495527
r23890r23891
514546   
515547   */
516548
517   return 0xff;
549   UINT8 data = 0xc0;
550
551   data |= m_sw2->read() & 0x0f;
552   data |= (m_sw1->read() >> 2) & 0x30;
553
554   return data;
518555}
519556
520557
r23890r23891
539576   
540577   */
541578
542   output_set_led_value(LED_SCROLL, !BIT(data, 0));
543   output_set_led_value(LED_NUM, !BIT(data, 1));
544   output_set_led_value(LED_CAPS, !BIT(data, 2));
579   output_set_led_value(LED_SCROLL, BIT(data, 0));
580   output_set_led_value(LED_NUM, BIT(data, 1));
581   output_set_led_value(LED_CAPS, BIT(data, 2));
545582
546583   m_pc_kbdc->clock_write_from_kb(!BIT(data, 6));
547584   m_pc_kbdc->data_write_from_kb(!BIT(data, 7));
r23890r23891
564601
565602READ8_MEMBER( ibm_pc_at_84_keyboard_device::t1_r )
566603{
604   return key_depressed();
605}
606
607
608//-------------------------------------------------
609//  key_depressed -
610//-------------------------------------------------
611
612int ibm_pc_at_84_keyboard_device::key_depressed()
613{
567614   UINT8 data = 0xff;
568615
569616   switch (m_cnt)
r23890r23891
586633   case 15: data = m_dr15->read(); break;
587634   }
588635
589   return BIT(data, m_sense);
636   return m_t1 && BIT(data, m_sense);   
590637}
trunk/src/mess/machine/kb_pcat84.h
r23890r23891
6363      LED_CAPS
6464   };
6565
66   int key_depressed();
67
6668   required_device<cpu_device> m_maincpu;
6769   required_ioport m_dr00;
6870   required_ioport m_dr01;
r23890r23891
8082   required_ioport m_dr13;
8183   required_ioport m_dr14;
8284   required_ioport m_dr15;
85   required_ioport m_sw1;
86   required_ioport m_sw2;
8387
8488   UINT8 m_db;
8589   int m_cnt;
8690   int m_sense;
91   int m_t1;
8792};
8893
8994
trunk/src/mess/machine/kb_pcxt83.c
r23890r23891
259259//-------------------------------------------------
260260
261261ibm_pc_xt_83_keyboard_device::ibm_pc_xt_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
262   : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM 1501100 Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__),
262   : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM PC/XT Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__),
263263     device_pc_kbd_interface(mconfig, *this),
264264     m_maincpu(*this, I8048_TAG),
265265     m_p10(*this, "P10"),
r23890r23891
288288
289289void ibm_pc_xt_83_keyboard_device::device_start()
290290{
291   set_pc_kbdc_device();
292   
291293   // state saving
292294   save_item(NAME(m_p1));
293295   save_item(NAME(m_p2));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team