Previous 199869 Revisions Next

r23918 Monday 24th June, 2013 at 21:23:34 UTC by Curt Coder
(MESS) ibm5150: Keyboard WIP. (nw)
[src/mess]mess.mak
[src/mess/machine]kb_ibm5160.c kb_ibm5160.h kb_pc83.c* kb_pc83.h* pc_keyboards.c pc_keyboards.h

trunk/src/mess/machine/kb_ibm5160.c
r23917r23918
1/**********************************************************************
2
3    IBM 5160 83-key keyboard emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8*********************************************************************/
9
10#include "kb_ibm5160.h"
11
12
13
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17
18#define I8048_TAG       "u1"
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type PC_KBD_IBM_5160 = &device_creator<ibm_5160_keyboard_device>;
27
28
29//-------------------------------------------------
30//  ROM( ibm_5160_keyboard )
31//-------------------------------------------------
32
33ROM_START( ibm_5160_keyboard )
34   ROM_REGION( 0x400, I8048_TAG, 0 )
35   ROM_LOAD( "8048.u1", 0x000, 0x400, NO_DUMP )
36ROM_END
37
38
39//-------------------------------------------------
40//  rom_region - device-specific ROM region
41//-------------------------------------------------
42
43const rom_entry *ibm_5160_keyboard_device::device_rom_region() const
44{
45   return ROM_NAME( ibm_5160_keyboard );
46}
47
48
49//-------------------------------------------------
50//  ADDRESS_MAP( kb_io )
51//-------------------------------------------------
52
53static ADDRESS_MAP_START( ibm_5160_keyboard_io, AS_IO, 8, ibm_5160_keyboard_device )
54   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w)
55   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP
56   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
57   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t1_r)
58ADDRESS_MAP_END
59
60
61//-------------------------------------------------
62//  MACHINE_DRIVER( ibm_5160_keyboard )
63//-------------------------------------------------
64
65static MACHINE_CONFIG_FRAGMENT( ibm_5160_keyboard )
66   MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20)))
67   MCFG_CPU_IO_MAP(ibm_5160_keyboard_io)
68MACHINE_CONFIG_END
69
70
71//-------------------------------------------------
72//  machine_config_additions - device-specific
73//  machine configurations
74//-------------------------------------------------
75
76machine_config_constructor ibm_5160_keyboard_device::device_mconfig_additions() const
77{
78   return MACHINE_CONFIG_NAME( ibm_5160_keyboard );
79}
80
81
82//-------------------------------------------------
83//  INPUT_PORTS( ibm_5160_keyboard )
84//-------------------------------------------------
85
86INPUT_PORTS_START( ibm_5160_keyboard )
87   PORT_START("DR00")
88   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
89   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
90   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
91   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
92
93   PORT_START("DR01")
94   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
95   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
96   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
97   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
98
99   PORT_START("DR02")
100   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
101   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
102   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
103   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
104
105   PORT_START("DR03")
106   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
107   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
108   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
109   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
110
111   PORT_START("DR04")
112   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
113   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
114   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
115   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
116
117   PORT_START("DR05")
118   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
119   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
120   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
121   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
122
123   PORT_START("DR06")
124   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
125   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
126   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
127   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
128
129   PORT_START("DR07")
130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
131   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
133   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
134
135   PORT_START("DR08")
136   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
138   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
139   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
140
141   PORT_START("DR09")
142   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
143   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
144   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
145   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
146
147   PORT_START("DR10")
148   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
149   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
150   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
151   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
152
153   PORT_START("DR11")
154   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
155   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
156   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
157   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
158
159   PORT_START("DR12")
160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
163   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
164
165   PORT_START("DR13")
166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
167   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
168   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
169   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
170
171   PORT_START("DR14")
172   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
173   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
174   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
175   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
176
177   PORT_START("DR15")
178   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
179   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
180   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
181   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
182
183   PORT_START("DR16")
184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
187   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
188
189   PORT_START("DR17")
190   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
191   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
192   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
193   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
194
195   PORT_START("DR18")
196   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
197   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
198   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
199   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
200
201   PORT_START("DR19")
202   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
203   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
204   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
205   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
206
207   PORT_START("DR20")
208   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
209   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
210   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
211   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
212
213   PORT_START("DR21")
214   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
215   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
216   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
217   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
218
219   PORT_START("DR22")
220   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
221   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
222   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
223   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
224
225   PORT_START("DR23")
226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
229   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
230INPUT_PORTS_END
231
232
233//-------------------------------------------------
234//  input_ports - device-specific input ports
235//-------------------------------------------------
236
237ioport_constructor ibm_5160_keyboard_device::device_input_ports() const
238{
239   return INPUT_PORTS_NAME( ibm_5160_keyboard );
240}
241
242
243
244//**************************************************************************
245//  LIVE DEVICE
246//**************************************************************************
247
248//-------------------------------------------------
249//  ibm_5160_keyboard_device - constructor
250//-------------------------------------------------
251
252ibm_5160_keyboard_device::ibm_5160_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
253   : device_t(mconfig, PC_KBD_IBM_5160, "IBM PC/XT 5150/5160 Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__),
254     device_pc_kbd_interface(mconfig, *this),
255     m_maincpu(*this, I8048_TAG),
256     m_dr00(*this, "DR00"),
257     m_dr01(*this, "DR01"),
258     m_dr02(*this, "DR02"),
259     m_dr03(*this, "DR03"),
260     m_dr04(*this, "DR04"),
261     m_dr05(*this, "DR05"),
262     m_dr06(*this, "DR06"),
263     m_dr07(*this, "DR07"),
264     m_dr08(*this, "DR08"),
265     m_dr09(*this, "DR09"),
266     m_dr10(*this, "DR10"),
267     m_dr11(*this, "DR11"),
268     m_dr12(*this, "DR12"),
269     m_dr13(*this, "DR13"),
270     m_dr14(*this, "DR14"),
271     m_dr15(*this, "DR15"),
272     m_dr16(*this, "DR16"),
273     m_dr17(*this, "DR17"),
274     m_dr18(*this, "DR18"),
275     m_dr19(*this, "DR19"),
276     m_dr20(*this, "DR20"),
277     m_dr21(*this, "DR21"),
278     m_dr22(*this, "DR22"),
279     m_dr23(*this, "DR23")
280{
281}
282
283
284//-------------------------------------------------
285//  device_start - device-specific startup
286//-------------------------------------------------
287
288void ibm_5160_keyboard_device::device_start()
289{
290   // state saving
291   save_item(NAME(m_cnt));
292}
293
294
295//-------------------------------------------------
296//  device_reset - device-specific reset
297//-------------------------------------------------
298
299void ibm_5160_keyboard_device::device_reset()
300{
301   m_maincpu->reset();
302}
303
304
305//-------------------------------------------------
306//  bus_w -
307//-------------------------------------------------
308
309WRITE8_MEMBER( ibm_5160_keyboard_device::bus_w )
310{
311   /*
312   
313       bit     description
314   
315       0       CNT 1
316       1       CNT 2
317       2       CNT 4
318       3       CNT 8
319       4       CNT 16
320       5       CNT 32
321       6       CNT 64
322       7       
323   
324   */
325
326   m_cnt = data & 0x7f;
327}
328
329
330//-------------------------------------------------
331//  p1_r -
332//-------------------------------------------------
333
334READ8_MEMBER( ibm_5160_keyboard_device::p1_r )
335{
336   /*
337   
338       bit     description
339   
340       0       -REQ IN
341       1       DATA IN
342       2       
343       3       
344       4       
345       5       
346       6       
347       7       
348   
349   */
350   
351   UINT8 data = 0;
352
353   data |= clock_signal();
354   data |= data_signal() << 1;
355
356   return data;
357}
358
359
360//-------------------------------------------------
361//  p2_w -
362//-------------------------------------------------
363
364WRITE8_MEMBER( ibm_5160_keyboard_device::p2_w )
365{
366   /*
367   
368       bit     description
369   
370       0       -MATRIX STROBE
371       1       CLOCK OUT
372       2       DATA OUT
373       3       
374       4       
375       5       
376       6       
377       7       
378   
379   */
380
381   m_pc_kbdc->clock_write_from_kb(BIT(data, 1));
382   m_pc_kbdc->data_write_from_kb(BIT(data, 2));
383}
384
385
386//-------------------------------------------------
387//  t1_r -
388//-------------------------------------------------
389
390READ8_MEMBER( ibm_5160_keyboard_device::t1_r )
391{
392   UINT8 data = 0xff;
393
394   switch (m_cnt >> 2)
395   {
396   case  0: data = m_dr00->read(); break;
397   case  1: data = m_dr01->read(); break;
398   case  2: data = m_dr02->read(); break;
399   case  3: data = m_dr03->read(); break;
400   case  4: data = m_dr04->read(); break;
401   case  5: data = m_dr05->read(); break;
402   case  6: data = m_dr06->read(); break;
403   case  7: data = m_dr07->read(); break;
404   case  8: data = m_dr08->read(); break;
405   case  9: data = m_dr09->read(); break;
406   case 10: data = m_dr10->read(); break;
407   case 11: data = m_dr11->read(); break;
408   case 12: data = m_dr12->read(); break;
409   case 13: data = m_dr13->read(); break;
410   case 14: data = m_dr14->read(); break;
411   case 15: data = m_dr15->read(); break;
412   case 16: data = m_dr16->read(); break;
413   case 17: data = m_dr17->read(); break;
414   case 18: data = m_dr18->read(); break;
415   case 19: data = m_dr19->read(); break;
416   case 20: data = m_dr20->read(); break;
417   case 21: data = m_dr21->read(); break;
418   case 22: data = m_dr22->read(); break;
419   case 23: data = m_dr23->read(); break;
420   }
421
422   int sense = m_cnt & 0x03;
423
424   return BIT(data, sense);
425}
trunk/src/mess/machine/kb_ibm5160.h
r23917r23918
1/**********************************************************************
2
3    IBM 5160 83-key keyboard emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8*********************************************************************/
9
10#pragma once
11
12#ifndef __PC_KBD_IBM_5160__
13#define __PC_KBD_IBM_5160__
14
15#include "emu.h"
16#include "cpu/mcs48/mcs48.h"
17#include "machine/pc_kbdc.h"
18#include "machine/rescap.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> ibm_5160_keyboard_device
27
28class ibm_5160_keyboard_device :  public device_t,
29                          public device_pc_kbd_interface
30{
31public:
32   // construction/destruction
33   ibm_5160_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual const rom_entry *device_rom_region() const;
37   virtual machine_config_constructor device_mconfig_additions() const;
38   virtual ioport_constructor device_input_ports() const;
39
40   DECLARE_WRITE8_MEMBER( bus_w );
41   DECLARE_READ8_MEMBER( p1_r );
42   DECLARE_WRITE8_MEMBER( p2_w );
43   DECLARE_READ8_MEMBER( t1_r );
44
45protected:
46   // device-level overrides
47   virtual void device_start();
48   virtual void device_reset();
49
50   // device_pc_kbd_interface overrides
51   virtual DECLARE_WRITE_LINE_MEMBER( clock_write ) { };
52   virtual DECLARE_WRITE_LINE_MEMBER( data_write ) { };
53
54private:
55   required_device<cpu_device> m_maincpu;
56   required_ioport m_dr00;
57   required_ioport m_dr01;
58   required_ioport m_dr02;
59   required_ioport m_dr03;
60   required_ioport m_dr04;
61   required_ioport m_dr05;
62   required_ioport m_dr06;
63   required_ioport m_dr07;
64   required_ioport m_dr08;
65   required_ioport m_dr09;
66   required_ioport m_dr10;
67   required_ioport m_dr11;
68   required_ioport m_dr12;
69   required_ioport m_dr13;
70   required_ioport m_dr14;
71   required_ioport m_dr15;
72   required_ioport m_dr16;
73   required_ioport m_dr17;
74   required_ioport m_dr18;
75   required_ioport m_dr19;
76   required_ioport m_dr20;
77   required_ioport m_dr21;
78   required_ioport m_dr22;
79   required_ioport m_dr23;
80
81   UINT8 m_cnt;
82};
83
84
85// device type definition
86extern const device_type PC_KBD_IBM_5160;
87
88
89
90#endif
trunk/src/mess/machine/kb_pc83.c
r0r23918
1/**********************************************************************
2
3    IBM 5150 83-key keyboard emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8*********************************************************************/
9
10#include "kb_pc83.h"
11
12
13
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17
18#define I8048_TAG       "u1"
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type PC_KBD_IBM_PC_83 = &device_creator<ibm_pc_83_keyboard_device>;
27
28
29//-------------------------------------------------
30//  ROM( ibm_pc_83_keyboard )
31//-------------------------------------------------
32
33ROM_START( ibm_pc_83_keyboard )
34   ROM_REGION( 0x400, I8048_TAG, 0 )
35   ROM_LOAD( "8048.u1", 0x000, 0x400, NO_DUMP )
36ROM_END
37
38
39//-------------------------------------------------
40//  rom_region - device-specific ROM region
41//-------------------------------------------------
42
43const rom_entry *ibm_pc_83_keyboard_device::device_rom_region() const
44{
45   return ROM_NAME( ibm_pc_83_keyboard );
46}
47
48
49//-------------------------------------------------
50//  ADDRESS_MAP( kb_io )
51//-------------------------------------------------
52
53static ADDRESS_MAP_START( ibm_pc_83_keyboard_io, AS_IO, 8, ibm_pc_83_keyboard_device )
54   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w)
55   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP
56   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
57   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t1_r)
58ADDRESS_MAP_END
59
60
61//-------------------------------------------------
62//  MACHINE_DRIVER( ibm_pc_83_keyboard )
63//-------------------------------------------------
64
65static MACHINE_CONFIG_FRAGMENT( ibm_pc_83_keyboard )
66   MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20)))
67   MCFG_CPU_IO_MAP(ibm_pc_83_keyboard_io)
68MACHINE_CONFIG_END
69
70
71//-------------------------------------------------
72//  machine_config_additions - device-specific
73//  machine configurations
74//-------------------------------------------------
75
76machine_config_constructor ibm_pc_83_keyboard_device::device_mconfig_additions() const
77{
78   return MACHINE_CONFIG_NAME( ibm_pc_83_keyboard );
79}
80
81
82//-------------------------------------------------
83//  INPUT_PORTS( ibm_pc_83_keyboard )
84//-------------------------------------------------
85
86INPUT_PORTS_START( ibm_pc_83_keyboard )
87   PORT_START("DR00")
88   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
89   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
90   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
91   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
92
93   PORT_START("DR01")
94   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
95   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
96   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
97   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
98
99   PORT_START("DR02")
100   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
101   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
102   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
103   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
104
105   PORT_START("DR03")
106   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
107   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
108   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
109   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
110
111   PORT_START("DR04")
112   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
113   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
114   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
115   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
116
117   PORT_START("DR05")
118   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
119   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
120   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
121   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
122
123   PORT_START("DR06")
124   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
125   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
126   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
127   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
128
129   PORT_START("DR07")
130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
131   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
133   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
134
135   PORT_START("DR08")
136   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
138   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
139   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
140
141   PORT_START("DR09")
142   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
143   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
144   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
145   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
146
147   PORT_START("DR10")
148   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
149   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
150   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
151   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
152
153   PORT_START("DR11")
154   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
155   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
156   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
157   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
158
159   PORT_START("DR12")
160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
163   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
164
165   PORT_START("DR13")
166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
167   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
168   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
169   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
170
171   PORT_START("DR14")
172   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
173   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
174   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
175   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
176
177   PORT_START("DR15")
178   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
179   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
180   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
181   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
182
183   PORT_START("DR16")
184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
187   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
188
189   PORT_START("DR17")
190   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
191   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
192   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
193   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
194
195   PORT_START("DR18")
196   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
197   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
198   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
199   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
200
201   PORT_START("DR19")
202   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
203   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
204   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
205   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
206
207   PORT_START("DR20")
208   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
209   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
210   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
211   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
212
213   PORT_START("DR21")
214   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
215   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
216   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
217   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
218
219   PORT_START("DR22")
220   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
221   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
222   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
223   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
224
225   PORT_START("DR23")
226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
229   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
230INPUT_PORTS_END
231
232
233//-------------------------------------------------
234//  input_ports - device-specific input ports
235//-------------------------------------------------
236
237ioport_constructor ibm_pc_83_keyboard_device::device_input_ports() const
238{
239   return INPUT_PORTS_NAME( ibm_pc_83_keyboard );
240}
241
242
243
244//**************************************************************************
245//  LIVE DEVICE
246//**************************************************************************
247
248//-------------------------------------------------
249//  ibm_pc_83_keyboard_device - constructor
250//-------------------------------------------------
251
252ibm_pc_83_keyboard_device::ibm_pc_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
253   : device_t(mconfig, PC_KBD_IBM_PC_83, "IBM PC Keyboard", tag, owner, clock, "kb_ibm5150", __FILE__),
254     device_pc_kbd_interface(mconfig, *this),
255     m_maincpu(*this, I8048_TAG),
256     m_dr00(*this, "DR00"),
257     m_dr01(*this, "DR01"),
258     m_dr02(*this, "DR02"),
259     m_dr03(*this, "DR03"),
260     m_dr04(*this, "DR04"),
261     m_dr05(*this, "DR05"),
262     m_dr06(*this, "DR06"),
263     m_dr07(*this, "DR07"),
264     m_dr08(*this, "DR08"),
265     m_dr09(*this, "DR09"),
266     m_dr10(*this, "DR10"),
267     m_dr11(*this, "DR11"),
268     m_dr12(*this, "DR12"),
269     m_dr13(*this, "DR13"),
270     m_dr14(*this, "DR14"),
271     m_dr15(*this, "DR15"),
272     m_dr16(*this, "DR16"),
273     m_dr17(*this, "DR17"),
274     m_dr18(*this, "DR18"),
275     m_dr19(*this, "DR19"),
276     m_dr20(*this, "DR20"),
277     m_dr21(*this, "DR21"),
278     m_dr22(*this, "DR22"),
279     m_dr23(*this, "DR23")
280{
281}
282
283
284//-------------------------------------------------
285//  device_start - device-specific startup
286//-------------------------------------------------
287
288void ibm_pc_83_keyboard_device::device_start()
289{
290   // state saving
291   save_item(NAME(m_cnt));
292}
293
294
295//-------------------------------------------------
296//  device_reset - device-specific reset
297//-------------------------------------------------
298
299void ibm_pc_83_keyboard_device::device_reset()
300{
301   m_maincpu->reset();
302}
303
304
305//-------------------------------------------------
306//  bus_w -
307//-------------------------------------------------
308
309WRITE8_MEMBER( ibm_pc_83_keyboard_device::bus_w )
310{
311   /*
312   
313       bit     description
314   
315       0       CNT 1
316       1       CNT 2
317       2       CNT 4
318       3       CNT 8
319       4       CNT 16
320       5       CNT 32
321       6       CNT 64
322       7       
323   
324   */
325
326   m_cnt = data & 0x7f;
327}
328
329
330//-------------------------------------------------
331//  p1_r -
332//-------------------------------------------------
333
334READ8_MEMBER( ibm_pc_83_keyboard_device::p1_r )
335{
336   /*
337   
338       bit     description
339   
340       0       -REQ IN
341       1       DATA IN
342       2       
343       3       
344       4       
345       5       
346       6       
347       7       
348   
349   */
350   
351   UINT8 data = 0;
352
353   data |= clock_signal();
354   data |= data_signal() << 1;
355
356   return data;
357}
358
359
360//-------------------------------------------------
361//  p2_w -
362//-------------------------------------------------
363
364WRITE8_MEMBER( ibm_pc_83_keyboard_device::p2_w )
365{
366   /*
367   
368       bit     description
369   
370       0       -MATRIX STROBE
371       1       CLOCK OUT
372       2       DATA OUT
373       3       
374       4       
375       5       
376       6       
377       7       
378   
379   */
380
381   m_pc_kbdc->clock_write_from_kb(BIT(data, 1));
382   m_pc_kbdc->data_write_from_kb(BIT(data, 2));
383}
384
385
386//-------------------------------------------------
387//  t1_r -
388//-------------------------------------------------
389
390READ8_MEMBER( ibm_pc_83_keyboard_device::t1_r )
391{
392   UINT8 data = 0xff;
393
394   switch (m_cnt >> 2)
395   {
396   case  0: data = m_dr00->read(); break;
397   case  1: data = m_dr01->read(); break;
398   case  2: data = m_dr02->read(); break;
399   case  3: data = m_dr03->read(); break;
400   case  4: data = m_dr04->read(); break;
401   case  5: data = m_dr05->read(); break;
402   case  6: data = m_dr06->read(); break;
403   case  7: data = m_dr07->read(); break;
404   case  8: data = m_dr08->read(); break;
405   case  9: data = m_dr09->read(); break;
406   case 10: data = m_dr10->read(); break;
407   case 11: data = m_dr11->read(); break;
408   case 12: data = m_dr12->read(); break;
409   case 13: data = m_dr13->read(); break;
410   case 14: data = m_dr14->read(); break;
411   case 15: data = m_dr15->read(); break;
412   case 16: data = m_dr16->read(); break;
413   case 17: data = m_dr17->read(); break;
414   case 18: data = m_dr18->read(); break;
415   case 19: data = m_dr19->read(); break;
416   case 20: data = m_dr20->read(); break;
417   case 21: data = m_dr21->read(); break;
418   case 22: data = m_dr22->read(); break;
419   case 23: data = m_dr23->read(); break;
420   }
421
422   int sense = m_cnt & 0x03;
423
424   return BIT(data, sense);
425}
Property changes on: trunk/src/mess/machine/kb_pc83.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/kb_pc83.h
r0r23918
1/**********************************************************************
2
3    IBM 5150 83-key keyboard emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8*********************************************************************/
9
10#pragma once
11
12#ifndef __PC_KBD_IBM_PC_83__
13#define __PC_KBD_IBM_PC_83__
14
15#include "emu.h"
16#include "cpu/mcs48/mcs48.h"
17#include "machine/pc_kbdc.h"
18#include "machine/rescap.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> ibm_pc_83_keyboard_device
27
28class ibm_pc_83_keyboard_device :  public device_t,
29                          public device_pc_kbd_interface
30{
31public:
32   // construction/destruction
33   ibm_pc_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual const rom_entry *device_rom_region() const;
37   virtual machine_config_constructor device_mconfig_additions() const;
38   virtual ioport_constructor device_input_ports() const;
39
40   DECLARE_WRITE8_MEMBER( bus_w );
41   DECLARE_READ8_MEMBER( p1_r );
42   DECLARE_WRITE8_MEMBER( p2_w );
43   DECLARE_READ8_MEMBER( t1_r );
44
45protected:
46   // device-level overrides
47   virtual void device_start();
48   virtual void device_reset();
49
50   // device_pc_kbd_interface overrides
51   virtual DECLARE_WRITE_LINE_MEMBER( clock_write ) { };
52   virtual DECLARE_WRITE_LINE_MEMBER( data_write ) { };
53
54private:
55   required_device<cpu_device> m_maincpu;
56   required_ioport m_dr00;
57   required_ioport m_dr01;
58   required_ioport m_dr02;
59   required_ioport m_dr03;
60   required_ioport m_dr04;
61   required_ioport m_dr05;
62   required_ioport m_dr06;
63   required_ioport m_dr07;
64   required_ioport m_dr08;
65   required_ioport m_dr09;
66   required_ioport m_dr10;
67   required_ioport m_dr11;
68   required_ioport m_dr12;
69   required_ioport m_dr13;
70   required_ioport m_dr14;
71   required_ioport m_dr15;
72   required_ioport m_dr16;
73   required_ioport m_dr17;
74   required_ioport m_dr18;
75   required_ioport m_dr19;
76   required_ioport m_dr20;
77   required_ioport m_dr21;
78   required_ioport m_dr22;
79   required_ioport m_dr23;
80
81   UINT8 m_cnt;
82};
83
84
85// device type definition
86extern const device_type PC_KBD_IBM_PC_83;
87
88
89
90#endif
Property changes on: trunk/src/mess/machine/kb_pc83.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/pc_keyboards.c
r23917r23918
11
22#include "emu.h"
33#include "machine/pc_keyboards.h"
4#include "machine/kb_ibm5160.h"
54#include "machine/kb_keytro.h"
65#include "machine/kb_msnat.h"
6#include "machine/kb_pc83.h"
7#include "machine/kb_pcxt83.h"
78#include "machine/kb_pcat84.h"
8#include "machine/kb_pcxt83.h"
99
1010SLOT_INTERFACE_START(pc_xt_keyboards)
1111   SLOT_INTERFACE(STR_KBD_KEYTRONIC_PC3270, PC_KBD_KEYTRONIC_PC3270)
12   SLOT_INTERFACE(STR_KBD_IBM_5160, PC_KBD_IBM_5160)
12   SLOT_INTERFACE(STR_KBD_IBM_PC_83, PC_KBD_IBM_PC_83)
1313   SLOT_INTERFACE(STR_KBD_IBM_PC_XT_83, PC_KBD_IBM_PC_XT_83)
1414SLOT_INTERFACE_END
1515
trunk/src/mess/machine/pc_keyboards.h
r23917r23918
1010
1111// PC XT protocol keyboards
1212#define STR_KBD_KEYTRONIC_PC3270    "keytronc_pc3270"
13#define STR_KBD_IBM_5160         "ibm5160"
13#define STR_KBD_IBM_PC_83         "pc"
1414#define STR_KBD_IBM_PC_XT_83      "pcxt"
1515
1616SLOT_INTERFACE_EXTERN(pc_xt_keyboards);
trunk/src/mess/mess.mak
r23917r23918
18061806   $(MESS_MACHINE)/pc_joy.o    \
18071807   $(MESS_MACHINE)/pc_joy_sw.o \
18081808   $(MESS_MACHINE)/pc_keyboards.o \
1809   $(MESS_MACHINE)/kb_ibm5160.o \
18101809   $(MESS_MACHINE)/kb_keytro.o \
18111810   $(MESS_MACHINE)/kb_msnat.o  \
1811   $(MESS_MACHINE)/kb_pc83.o   \
18121812   $(MESS_MACHINE)/kb_pcxt83.o \
18131813   $(MESS_MACHINE)/kb_pcat84.o \
18141814   $(MESS_MACHINE)/ser_mouse.o \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team