Previous 199869 Revisions Next

r19054 Monday 19th November, 2012 at 21:09:41 UTC by Angelo Salese
Improved keyboard even further
[src/mess/drivers]apc.c

trunk/src/mess/drivers/apc.c
r19053r19054
111111   DECLARE_READ8_MEMBER(apc_dma_r);
112112   DECLARE_WRITE8_MEMBER(apc_dma_w);
113113
114   UINT8 m_keyb_press, m_keyb_status;
114   struct {
115      UINT8 status; //status
116      UINT8 data; //key data
117      UINT8 sig; //switch signal port
118      UINT8 sh; //shift switches
119   }m_keyb;
115120   DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
116121
117122   DECLARE_WRITE_LINE_MEMBER(apc_master_set_int_line);
r19053r19054
335340{
336341   UINT8 res;
337342
338   switch(offset)
343   switch(offset & 3)
339344   {
340      case 0: res = m_keyb_press; break;
341      case 1: res = m_keyb_status; break;
342      default:
343         res = 0;
344         //printf("KEYB %08x\n",offset);
345         break;
345      case 0: res = m_keyb.data; pic8259_ir4_w(machine().device("pic8259_master"), 0); break; // according to the source, reading there acks the irq
346      case 1: res = m_keyb.status; break;
347      case 2: res = m_keyb.sig; break; // bit 0: CTRL bit 1: function key (or reversed)
348      case 3: res = machine().root_device().ioport("KEY_MOD")->read() & 0xff; break; // sh
346349   }
347350
348351   return res;
r19053r19054
430433{
431434   if(newval && !oldval)
432435   {
433      m_keyb_press = (UINT8)(FPTR)(param) & 0xff;
434      //m_keyb_status |= 1; //TODO: what this really signals? busy?
436      m_keyb.data = (UINT8)(FPTR)(param) & 0xff;
437      //m_keyb.status &= ~1;
435438      pic8259_ir4_w(machine().device("pic8259_master"), 1);
436439   }
437440
438441   if(oldval && !newval)
439442   {
440      m_keyb_press = 0xff;
441      m_keyb_status &= ~1;
442      pic8259_ir4_w(machine().device("pic8259_master"), 0);
443      m_keyb.data = 0xff;
444      //m_keyb.status |= 1;
443445   }
444446}
445447
r19053r19054
495497
496498   PORT_START("KEY6")
497499   PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x20)
500   PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; / :") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x3a)
501   PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= / +") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2d)
502   PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' / ~") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x40)
503   PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' / \"") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x3b)
498504
499505/*
500506;
r19053r19054
619625   PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CHAR(0x7f) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfc)
620626   PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0d) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfd)
621627
622   /* dummy active high structure */
623   PORT_START("SYSA")
624   PORT_DIPNAME( 0x01, 0x00, "SYSA" )
625   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
626   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
627   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
628   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
629   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
630   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
631   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
632   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
633   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
634   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
635   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
636   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
637   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
638   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
639   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
640   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
641   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
642   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
643   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
644   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
645   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
646   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
647   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
628   PORT_START("KEY_MOD")
629   PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT)
630   PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
648631
649   /* dummy active low structure */
650   PORT_START("DSWA")
651   PORT_DIPNAME( 0x01, 0x01, "DSWA" )
652   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
653   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
654   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
655   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
656   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
657   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
658   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
659   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
660   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
661   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
662   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
663   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
664   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
665   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
666   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
667   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
668   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
669   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
670   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
671   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
672   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
673   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
674   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
675632INPUT_PORTS_END
676633
677634void apc_state::fdc_drq(bool state)
r19053r19054
704661
705662void apc_state::machine_reset()
706663{
707   m_keyb_status = m_keyb_press = 0;
664   m_keyb.status = 0;
665   m_keyb.data = 0;
666   m_keyb.sig = 0;
708667}
709668
710669

Previous 199869 Revisions Next


© 1997-2024 The MAME Team