Previous 15994 Revisions Next

r14125 Sunday 22nd January, 2012 at 21:20:25 UTC by Curt Coder
[WANGPC] WIP. (nw)
[src/mess/machine]wangpckb.c wangpckb.h

src/mess/machine/wangpckb.c
r14124r14125
2727 
2828    CPU         - Intel P8051AH "20-8051-225"
2929    PSG         - Texas Instruments SN76496N
30   XR          - Exar Semiconductor XR22-908-030? (hard to read)
30   XR          - Exar Semiconductor XR22-908-03B? (hard to read)
3131    CN1         - 1x6 pin PCB header
3232    SW1         - 8-way DIP switch
3333    SW2         - 8-way DIP switch
r14124r14125
8080//-------------------------------------------------
8181 
8282static ADDRESS_MAP_START( wangpc_keyboard_io, AS_IO, 8, wangpc_keyboard_device )
83   AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w)
83   AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ(kb_p1_r) AM_WRITENOP
8484   AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITE(kb_p2_w)
8585   AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_WRITE(kb_p3_w)
86   AM_RANGE(0x4848, 0x4848) AM_READ_PORT("Y0")
87   AM_RANGE(0x4949, 0x4949) AM_READ_PORT("Y1")
88   AM_RANGE(0x4a4a, 0x4a4a) AM_READ_PORT("Y2")
89   AM_RANGE(0x4b4b, 0x4b4b) AM_READ_PORT("Y3")
90   AM_RANGE(0x4c4c, 0x4c4c) AM_READ_PORT("Y4")
91   AM_RANGE(0x4d4d, 0x4d4d) AM_READ_PORT("Y5")
92   AM_RANGE(0x4e4e, 0x4e4e) AM_READ_PORT("Y6")
93   AM_RANGE(0x4f4f, 0x4f4f) AM_READ_PORT("Y7")
94   AM_RANGE(0x5050, 0x5050) AM_READ_PORT("Y8")
95   AM_RANGE(0x5151, 0x5151) AM_READ_PORT("Y9")
96   AM_RANGE(0x5252, 0x5252) AM_READ_PORT("YA")
97   AM_RANGE(0x5353, 0x5353) AM_READ_PORT("YB")
98   AM_RANGE(0x5454, 0x5454) AM_READ_PORT("YC")
99   AM_RANGE(0x5555, 0x5555) AM_READ_PORT("YD")
100   AM_RANGE(0x5656, 0x5656) AM_READ_PORT("YE")
101   AM_RANGE(0x5757, 0x5757) AM_READ_PORT("YF")
10286ADDRESS_MAP_END
10387 
10488 
r14124r14125
397381 
398382READ8_MEMBER( wangpc_keyboard_device::kb_p1_r )
399383{
400   return 0xff;
401}
384   UINT8 data = 0xff;
402385 
386   switch (m_y & 0x0f)
387   {
388      case 0: data &= input_port_read(this, "Y0"); break;
389      case 1: data &= input_port_read(this, "Y1"); break;
390      case 2: data &= input_port_read(this, "Y2"); break;
391      case 3: data &= input_port_read(this, "Y3"); break;
392      case 4: data &= input_port_read(this, "Y4"); break;
393      case 5: data &= input_port_read(this, "Y5"); break;
394      case 6: data &= input_port_read(this, "Y6"); break;
395      case 7: data &= input_port_read(this, "Y7"); break;
396      case 8: data &= input_port_read(this, "Y8"); break;
397      case 9: data &= input_port_read(this, "Y9"); break;
398      case 0xa: data &= input_port_read(this, "YA"); break;
399      case 0xb: data &= input_port_read(this, "YB"); break;
400      case 0xc: data &= input_port_read(this, "YC"); break;
401      case 0xd: data &= input_port_read(this, "YD"); break;
402      case 0xe: data &= input_port_read(this, "YE"); break; // SW1?
403      case 0xf: data &= input_port_read(this, "YF"); break; // SW2?
404   }
403405 
404//-------------------------------------------------
405//  kb_p1_w -
406//-------------------------------------------------
407 
408WRITE8_MEMBER( wangpc_keyboard_device::kb_p1_w )
409{
406   return data;
410407}
411408 
412409 
r14124r14125
416413 
417414WRITE8_MEMBER( wangpc_keyboard_device::kb_p2_w )
418415{
416   /*
417   
418      bit      description
419       
420      P2.0   row 0
421      P2.1   row 1
422      P2.2   row 2
423      P2.3   row 3
424      P2.4
425      P2.5
426      P2.6   chip enable for something
427      P2.7
428 
429   */
430 
431   m_y = data;
419432}
420433 
421434 
r14124r14125
425438 
426439WRITE8_MEMBER( wangpc_keyboard_device::kb_p3_w )
427440{
441   /*
442   
443      bit      description
444       
445      P3.0   
446      P3.1   
447      P3.2
448      P3.3   chip enable for something
449      P3.4
450      P3.5
451      P3.6
452      P3.7
453 
454   */
428455}
src/mess/machine/wangpckb.h
r14124r14125
6161   
6262   // not really public
6363   DECLARE_READ8_MEMBER( kb_p1_r );
64   DECLARE_WRITE8_MEMBER( kb_p1_w );
6564   DECLARE_WRITE8_MEMBER( kb_p2_w );
6665   DECLARE_WRITE8_MEMBER( kb_p3_w );
6766   
r14124r14125
7372 
7473private:
7574   required_device<cpu_device> m_maincpu;
75   
76   UINT8 m_y;
7677};
7778 
7879 

Previous 15994 Revisions Next


© 1998-2018 The MESS Team