1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 /**********************************************************************
4
5 IBM Model F PC/AT 84-key / 3270PC 122-key keyboard emulation
6
7 *********************************************************************/
8
9 /*
10
11 TODO:
12
13 - cpu LC timing
14 - 3270PC keys
15
16 */
17
18 /*
19
20 Part No Layout
21 -------------------
22 6450225 UK 84-key
23 6110344 UK 122-key
24
25 */
26
27 #include "emu.h"
28 #include "pcat84.h"
29
30
31
32 //**************************************************************************
33 // MACROS / CONSTANTS
34 //**************************************************************************
35
36 #define I8048_TAG "m5"
37
38
39
40 //**************************************************************************
41 // DEVICE DEFINITIONS
42 //**************************************************************************
43
44 DEFINE_DEVICE_TYPE(PC_KBD_IBM_PC_AT_84, ibm_pc_at_84_keyboard_device, "kb_pcat84", "IBM PC/AT Keyboard")
45 DEFINE_DEVICE_TYPE(PC_KBD_IBM_3270PC_122, ibm_3270pc_122_keyboard_device, "kb_3270pc", "IBM 3270PC Keyboard")
46
47
48 //-------------------------------------------------
49 // ROM( ibm_pc_at_84_keyboard )
50 //-------------------------------------------------
51
ROM_START(ibm_pc_at_84_keyboard)52 ROM_START( ibm_pc_at_84_keyboard )
53 ROM_REGION( 0x400, I8048_TAG, 0 )
54 /*
55 Keyboard Part No 6450225
56
57 PH 1503099
58 D 878154
59 8441 D H
60 */
61 ROM_LOAD( "1503099.m5", 0x000, 0x400, CRC(1e921f37) SHA1(5f722bdb3b57f5a532c02a5c3f78f30d785796f2) )
62 ROM_END
63
64
65 //-------------------------------------------------
66 // rom_region - device-specific ROM region
67 //-------------------------------------------------
68
69 const tiny_rom_entry *ibm_pc_at_84_keyboard_device::device_rom_region() const
70 {
71 return ROM_NAME( ibm_pc_at_84_keyboard );
72 }
73
74
75 //-------------------------------------------------
76 // ROM( ibm_3270pc_122_keyboard )
77 //-------------------------------------------------
78
79 ROM_START( ibm_3270pc_122_keyboard )
80 ROM_REGION( 0x400, I8048_TAG, 0 )
81 /*
82 Keyboard Part No 6110344
83
84 PH 1385001
85 D
86 8512 D H
87 */
CRC(c19767e9)88 ROM_LOAD( "1385001.m5", 0x000, 0x400, CRC(c19767e9) SHA1(a3701e4617383a4de0fd5e2e86c4b74beaf94a7b) )
89 ROM_END
90
91
92 //-------------------------------------------------
93 // rom_region - device-specific ROM region
94 //-------------------------------------------------
95
96 const tiny_rom_entry *ibm_3270pc_122_keyboard_device::device_rom_region() const
97 {
98 return ROM_NAME( ibm_3270pc_122_keyboard );
99 }
100
101
102 //-------------------------------------------------
103 // device_add_mconfig - add device configuration
104 //-------------------------------------------------
105
device_add_mconfig(machine_config & config)106 void ibm_pc_at_84_keyboard_device::device_add_mconfig(machine_config &config)
107 {
108 I8048(config, m_maincpu, 5364000);
109 m_maincpu->bus_out_cb().set(FUNC(ibm_pc_at_84_keyboard_device::bus_w));
110 m_maincpu->p1_in_cb().set(FUNC(ibm_pc_at_84_keyboard_device::p1_r));
111 m_maincpu->p1_out_cb().set(FUNC(ibm_pc_at_84_keyboard_device::p1_w));
112 m_maincpu->p2_in_cb().set(FUNC(ibm_pc_at_84_keyboard_device::p2_r));
113 m_maincpu->p2_out_cb().set(FUNC(ibm_pc_at_84_keyboard_device::p2_w));
114 m_maincpu->t0_in_cb().set(FUNC(ibm_pc_at_84_keyboard_device::t0_r));
115 m_maincpu->t1_in_cb().set(FUNC(ibm_pc_at_84_keyboard_device::t1_r));
116 }
117
118
119 //-------------------------------------------------
120 // INPUT_PORTS( ibm_pc_at_84_keyboard )
121 //-------------------------------------------------
122
123 INPUT_PORTS_START( ibm_pc_at_84_keyboard )
124 PORT_START("DR00")
PORT_CODE(KEYCODE_F9)125 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
126 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
127 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
128 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
129 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
130 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
131 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
132 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
133
134 PORT_START("DR01")
135 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
136 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
137 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
138 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
139 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB))
140 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
141 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
142 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
143
144 PORT_START("DR02")
145 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
146 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
147 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
148 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
149 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
150 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
151 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
152 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
153
154 PORT_START("DR03")
155 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
156 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
157 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
158 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
159 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
160 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
161 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
162 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
163
164 PORT_START("DR04")
165 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
166 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
167 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
168 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
169 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
170 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
171 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
172 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
173
174 PORT_START("DR05")
175 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
176 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
177 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
178 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
179 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
180 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
181 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
182 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
183
184 PORT_START("DR06")
185 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
186 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
187 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
188 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
189 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
190 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
191 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
192 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
193
194 PORT_START("DR07")
195 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
196 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
197 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
198 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
199 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
200 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
201 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
202 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
203
204 PORT_START("DR08")
205 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
206 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
207 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
208 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
209 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
210 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
211 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
212 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
213
214 PORT_START("DR09")
215 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
216 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
217 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
218 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
219 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
220 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
221 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
222 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
223
224 PORT_START("DR10")
225 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM )
226 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
227 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
228 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
229 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
230 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
231 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
232 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
233
234 PORT_START("DR11")
235 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
236 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
237 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
238 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
239 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
240 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
241 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
242 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
243
244 PORT_START("DR12")
245 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
246 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
247 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
248 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
249 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
250 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
251 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
252 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
253
254 PORT_START("DR13")
255 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
256 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
257 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
258 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
259 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
260 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
261 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
262 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
263
264 PORT_START("DR14")
265 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
266 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
267 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
268 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
269 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
270 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
271 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
272 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
273
274 PORT_START("DR15")
275 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
276 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
277 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
278 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
279 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad * PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
280 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
281 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
282 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Sys Req")
283 INPUT_PORTS_END
284
285
286 //-------------------------------------------------
287 // input_ports - device-specific input ports
288 //-------------------------------------------------
289
290 ioport_constructor ibm_pc_at_84_keyboard_device::device_input_ports() const
291 {
292 return INPUT_PORTS_NAME( ibm_pc_at_84_keyboard );
293 }
294
295
296 //-------------------------------------------------
297 // INPUT_PORTS( ibm_3270pc_122_keyboard )
298 //-------------------------------------------------
299
300 INPUT_PORTS_START( ibm_3270pc_122_keyboard )
PORT_INCLUDE(ibm_pc_at_84_keyboard)301 PORT_INCLUDE(ibm_pc_at_84_keyboard)
302
303 PORT_START("KBDIDA")
304 PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )
305 PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW )
306 PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )
307 PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
308 PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
309 PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
310
311 PORT_START("KBDIDB")
312 PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )
313 PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW )
314 PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )
315 PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
316 PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
317 PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
318 INPUT_PORTS_END
319
320
321 //-------------------------------------------------
322 // input_ports - device-specific input ports
323 //-------------------------------------------------
324
325 ioport_constructor ibm_3270pc_122_keyboard_device::device_input_ports() const
326 {
327 return INPUT_PORTS_NAME( ibm_3270pc_122_keyboard );
328 }
329
330
331
332 //**************************************************************************
333 // LIVE DEVICE
334 //**************************************************************************
335
336 //-------------------------------------------------
337 // ibm_pc_at_84_keyboard_device - constructor
338 //-------------------------------------------------
339
ibm_pc_at_84_keyboard_device(const machine_config & mconfig,device_type type,const char * tag,device_t * owner,uint32_t clock)340 ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
341 device_t(mconfig, type, tag, owner, clock),
342 device_pc_kbd_interface(mconfig, *this),
343 m_maincpu(*this, I8048_TAG),
344 m_dr(*this, "DR%02u", 0),
345 m_kbdida(*this, "KBDIDA"),
346 m_kbdidb(*this, "KBDIDB"),
347 m_leds(*this, "led%u", 0U),
348 m_db(0),
349 m_cnt(0),
350 m_sense(0),
351 m_t1(1)
352 {
353 }
354
ibm_pc_at_84_keyboard_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)355 ibm_pc_at_84_keyboard_device::ibm_pc_at_84_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
356 ibm_pc_at_84_keyboard_device(mconfig, PC_KBD_IBM_PC_AT_84, tag, owner, clock)
357 {
358 }
359
ibm_3270pc_122_keyboard_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)360 ibm_3270pc_122_keyboard_device::ibm_3270pc_122_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
361 ibm_pc_at_84_keyboard_device(mconfig, PC_KBD_IBM_3270PC_122, tag, owner, clock)
362 {
363 }
364
365
366 //-------------------------------------------------
367 // device_start - device-specific startup
368 //-------------------------------------------------
369
device_start()370 void ibm_pc_at_84_keyboard_device::device_start()
371 {
372 set_pc_kbdc_device();
373
374 m_leds.resolve();
375
376 // state saving
377 save_item(NAME(m_db));
378 save_item(NAME(m_cnt));
379 save_item(NAME(m_sense));
380 save_item(NAME(m_t1));
381 }
382
383
384 //-------------------------------------------------
385 // device_reset - device-specific reset
386 //-------------------------------------------------
387
device_reset()388 void ibm_pc_at_84_keyboard_device::device_reset()
389 {
390 m_maincpu->reset();
391 }
392
393
394 //-------------------------------------------------
395 // bus_w -
396 //-------------------------------------------------
397
bus_w(uint8_t data)398 void ibm_pc_at_84_keyboard_device::bus_w(uint8_t data)
399 {
400 /*
401
402 bit description
403
404 0 SENSE 0
405 1 SENSE 1
406 2 SENSE 2
407 3 CNT 0
408 4 CNT 1
409 5 CNT 2
410 6 CNT 3
411 7 CNT G
412
413 */
414
415 m_db = data;
416
417 if (!BIT(data, 7))
418 {
419 m_cnt = (data >> 3) & 0x0f;
420 }
421 }
422
423
424 //-------------------------------------------------
425 // p1_r -
426 //-------------------------------------------------
427
p1_r()428 uint8_t ibm_pc_at_84_keyboard_device::p1_r()
429 {
430 /*
431
432 bit description
433
434 0
435 1
436 2 KBDID A1
437 3 KBDID A2
438 4 KBDID A3
439 5 KBDID A4
440 6 KBDID A5
441 7 KBDID A6
442
443 */
444
445 uint8_t data = 0;
446
447 data |= m_kbdida->read() << 2;
448
449 return data;
450 }
451
452
453 //-------------------------------------------------
454 // p1_w -
455 //-------------------------------------------------
456
p1_w(uint8_t data)457 void ibm_pc_at_84_keyboard_device::p1_w(uint8_t data)
458 {
459 /*
460
461 bit description
462
463 0 SENSE G
464 1 T1
465 2
466 3
467 4
468 5
469 6
470 7
471
472 */
473
474 if (!BIT(data, 0))
475 {
476 m_sense = m_db & 0x07;
477 }
478
479 m_t1 = BIT(data, 1);
480 }
481
482
483 //-------------------------------------------------
484 // p2_r -
485 //-------------------------------------------------
486
p2_r()487 uint8_t ibm_pc_at_84_keyboard_device::p2_r()
488 {
489 /*
490
491 bit description
492
493 0 KBDID B1
494 1 KBDID B2
495 2 KBDID B3
496 3 KBDID B4
497 4 KBDID B5
498 5 KBDID B6
499 6
500 7
501
502 */
503
504 uint8_t data = 0xc0;
505
506 data |= m_kbdidb->read();
507
508 return data;
509 }
510
511
512 //-------------------------------------------------
513 // p2_w -
514 //-------------------------------------------------
515
p2_w(uint8_t data)516 void ibm_pc_at_84_keyboard_device::p2_w(uint8_t data)
517 {
518 /*
519
520 bit description
521
522 0 SCROLL LED
523 1 NUM LED
524 2 CAPS LED
525 3
526 4
527 5
528 6 CLOCK
529 7 DATA
530
531 */
532
533 m_leds[LED_SCROLL] = BIT(data, 0);
534 m_leds[LED_NUM] = BIT(data, 1);
535 m_leds[LED_CAPS] = BIT(data, 2);
536
537 m_pc_kbdc->data_write_from_kb(!BIT(data, 7));
538 m_pc_kbdc->clock_write_from_kb(!BIT(data, 6));
539 }
540
541
542 //-------------------------------------------------
543 // t0_r -
544 //-------------------------------------------------
545
READ_LINE_MEMBER(ibm_pc_at_84_keyboard_device::t0_r)546 READ_LINE_MEMBER( ibm_pc_at_84_keyboard_device::t0_r )
547 {
548 return !data_signal();
549 }
550
551
552 //-------------------------------------------------
553 // t1_r -
554 //-------------------------------------------------
555
READ_LINE_MEMBER(ibm_pc_at_84_keyboard_device::t1_r)556 READ_LINE_MEMBER( ibm_pc_at_84_keyboard_device::t1_r )
557 {
558 return key_depressed();
559 }
560
561
562 //-------------------------------------------------
563 // key_depressed -
564 //-------------------------------------------------
565
key_depressed()566 int ibm_pc_at_84_keyboard_device::key_depressed()
567 {
568 uint8_t data = m_dr[m_cnt]->read();
569
570 return m_t1 && BIT(data, m_sense);
571 }
572