Previous 199869 Revisions Next

r23858 Saturday 22nd June, 2013 at 09:25:17 UTC by Curt Coder
(MESS) ibm5150: Keyboard WIP. (nw)
[src/mess/machine]kb_pcxt83.c kb_pcxt83.h

trunk/src/mess/machine/kb_pcxt83.c
r23857r23858
9696//-------------------------------------------------
9797
9898INPUT_PORTS_START( ibm_pc_xt_83_keyboard )
99   PORT_START("DR00")
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("DR01")
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("DR02")
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("DR03")
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("DR04")
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("DR05")
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("DR06")
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("DR07")
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("DR08")
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("DR09")
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("DR10")
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("DR11")
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("DR12")
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("DR13")
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("DR14")
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("DR15")
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("DR16")
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("DR17")
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("DR18")
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("DR19")
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("DR20")
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("DR21")
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 )
230
231   PORT_START("DR22")
232   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
233   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
234   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
235   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
236
237   PORT_START("DR23")
238   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
239   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
240   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
241   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
99242INPUT_PORTS_END
100243
101244
r23857r23858
121264ibm_pc_xt_83_keyboard_device::ibm_pc_xt_83_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
122265   : device_t(mconfig, PC_KBD_IBM_PC_XT_83, "IBM PC/XT 5150/5160 Keyboard", tag, owner, clock, "kb_pcxt83", __FILE__),
123266     device_pc_kbd_interface(mconfig, *this),
124     m_maincpu(*this, I8048_TAG)
267     m_maincpu(*this, I8048_TAG),
268     m_dr00(*this, "DR00"),
269     m_dr01(*this, "DR01"),
270     m_dr02(*this, "DR02"),
271     m_dr03(*this, "DR03"),
272     m_dr04(*this, "DR04"),
273     m_dr05(*this, "DR05"),
274     m_dr06(*this, "DR06"),
275     m_dr07(*this, "DR07"),
276     m_dr08(*this, "DR08"),
277     m_dr09(*this, "DR09"),
278     m_dr10(*this, "DR10"),
279     m_dr11(*this, "DR11"),
280     m_dr12(*this, "DR12"),
281     m_dr13(*this, "DR13"),
282     m_dr14(*this, "DR14"),
283     m_dr15(*this, "DR15"),
284     m_dr16(*this, "DR16"),
285     m_dr17(*this, "DR17"),
286     m_dr18(*this, "DR18"),
287     m_dr19(*this, "DR19"),
288     m_dr20(*this, "DR20"),
289     m_dr21(*this, "DR21"),
290     m_dr22(*this, "DR22"),
291     m_dr23(*this, "DR23")
125292{
126293}
127294
r23857r23858
134301{
135302   // state saving
136303   save_item(NAME(m_cnt));
137   save_item(NAME(m_key_depressed));
138304}
139305
140306
r23857r23858
154320
155321WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::bus_w )
156322{
157   m_cnt = data;
323   /*
324   
325       bit     description
326   
327       0       CNT 1
328       1       CNT 2
329       2       CNT 4
330       3       CNT 8
331       4       CNT 16
332       5       CNT 32
333       6       CNT 64
334       7       
335   
336   */
337
338   m_cnt = data & 0x7f;
158339}
159340
160341
r23857r23858
220401
221402READ8_MEMBER( ibm_pc_xt_83_keyboard_device::t1_r )
222403{
223   return m_key_depressed;
404   UINT8 data = 0xff;
405
406   switch (m_cnt >> 2)
407   {
408   case  0: data = m_dr00->read(); break;
409   case  1: data = m_dr01->read(); break;
410   case  2: data = m_dr02->read(); break;
411   case  3: data = m_dr03->read(); break;
412   case  4: data = m_dr04->read(); break;
413   case  5: data = m_dr05->read(); break;
414   case  6: data = m_dr06->read(); break;
415   case  7: data = m_dr07->read(); break;
416   case  8: data = m_dr08->read(); break;
417   case  9: data = m_dr09->read(); break;
418   case 10: data = m_dr10->read(); break;
419   case 11: data = m_dr11->read(); break;
420   case 12: data = m_dr12->read(); break;
421   case 13: data = m_dr13->read(); break;
422   case 14: data = m_dr14->read(); break;
423   case 15: data = m_dr15->read(); break;
424   case 16: data = m_dr16->read(); break;
425   case 17: data = m_dr17->read(); break;
426   case 18: data = m_dr18->read(); break;
427   case 19: data = m_dr19->read(); break;
428   case 20: data = m_dr20->read(); break;
429   case 21: data = m_dr21->read(); break;
430   case 22: data = m_dr22->read(); break;
431   case 23: data = m_dr23->read(); break;
432   }
433
434   int sense = m_cnt & 0x03;
435
436   return BIT(data, sense);
224437}
trunk/src/mess/machine/kb_pcxt83.h
r23857r23858
5353
5454private:
5555   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;
5680
5781   UINT8 m_cnt;
58   int m_key_depressed;
5982};
6083
6184

Previous 199869 Revisions Next


© 1997-2024 The MAME Team