trunk/src/mess/machine/victor9kb.c
r241644 | r241645 | |
28 | 28 | const device_type VICTOR9K_KEYBOARD = &device_creator<victor9k_keyboard_device>; |
29 | 29 | |
30 | 30 | |
31 | | |
32 | 31 | //------------------------------------------------- |
33 | 32 | // ROM( victor9k_keyboard ) |
34 | 33 | //------------------------------------------------- |
r241644 | r241645 | |
237 | 236 | // victor9k_keyboard_device - constructor |
238 | 237 | //------------------------------------------------- |
239 | 238 | |
240 | | victor9k_keyboard_device::victor9k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
241 | | : device_t(mconfig, VICTOR9K_KEYBOARD, "Victor 9000 Keyboard", tag, owner, clock, "victor9kb", __FILE__), |
242 | | m_maincpu(*this, I8021_TAG), |
243 | | m_y0(*this, "Y0"), |
244 | | m_y1(*this, "Y1"), |
245 | | m_y2(*this, "Y2"), |
246 | | m_y3(*this, "Y3"), |
247 | | m_y4(*this, "Y4"), |
248 | | m_y5(*this, "Y5"), |
249 | | m_y6(*this, "Y6"), |
250 | | m_y7(*this, "Y7"), |
251 | | m_y8(*this, "Y8"), |
252 | | m_y9(*this, "Y9"), |
253 | | m_ya(*this, "YA"), |
254 | | m_yb(*this, "YB"), |
255 | | m_yc(*this, "YC"), |
256 | | m_kbrdy_handler(*this), |
257 | | m_kbdata_handler(*this), |
258 | | m_y(0), |
259 | | m_kbrdy(1), |
260 | | m_kbdata(1), |
261 | | m_kback(1) |
| 239 | victor9k_keyboard_device::victor9k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 240 | device_t(mconfig, VICTOR9K_KEYBOARD, "Victor 9000 Keyboard", tag, owner, clock, "victor9kb", __FILE__), |
| 241 | m_maincpu(*this, I8021_TAG), |
| 242 | m_y0(*this, "Y0"), |
| 243 | m_y1(*this, "Y1"), |
| 244 | m_y2(*this, "Y2"), |
| 245 | m_y3(*this, "Y3"), |
| 246 | m_y4(*this, "Y4"), |
| 247 | m_y5(*this, "Y5"), |
| 248 | m_y6(*this, "Y6"), |
| 249 | m_y7(*this, "Y7"), |
| 250 | m_y8(*this, "Y8"), |
| 251 | m_y9(*this, "Y9"), |
| 252 | m_ya(*this, "YA"), |
| 253 | m_yb(*this, "YB"), |
| 254 | m_yc(*this, "YC"), |
| 255 | m_kbrdy_handler(*this), |
| 256 | m_kbdata_handler(*this), |
| 257 | m_y(0), |
| 258 | m_kbrdy(1), |
| 259 | m_kbdata(1), |
| 260 | m_kback(1) |
262 | 261 | { |
263 | 262 | } |
264 | 263 | |
r241644 | r241645 | |
291 | 290 | |
292 | 291 | |
293 | 292 | //------------------------------------------------- |
294 | | // kbrdy_r - |
295 | | //------------------------------------------------- |
296 | | |
297 | | READ_LINE_MEMBER( victor9k_keyboard_device::kbrdy_r ) |
298 | | { |
299 | | return m_kbrdy; |
300 | | } |
301 | | |
302 | | |
303 | | //------------------------------------------------- |
304 | 293 | // kback_w - |
305 | 294 | //------------------------------------------------- |
306 | 295 | |
307 | 296 | WRITE_LINE_MEMBER( victor9k_keyboard_device::kback_w ) |
308 | 297 | { |
| 298 | //logerror("KBACK %u\n", state); |
309 | 299 | m_kback = state; |
310 | 300 | } |
311 | 301 | |
312 | 302 | |
313 | 303 | //------------------------------------------------- |
314 | | // kbdata_r - |
315 | | //------------------------------------------------- |
316 | | |
317 | | READ_LINE_MEMBER( victor9k_keyboard_device::kbdata_r ) |
318 | | { |
319 | | return m_kbdata; |
320 | | } |
321 | | |
322 | | |
323 | | //------------------------------------------------- |
324 | 304 | // kb_p1_r - |
325 | 305 | //------------------------------------------------- |
326 | 306 | |
r241644 | r241645 | |
360 | 340 | m_y = data & 0x0f; |
361 | 341 | } |
362 | 342 | |
363 | | logerror("P1 %02x\n", data); |
| 343 | //logerror("P1 %02x\n", data); |
364 | 344 | } |
365 | 345 | |
366 | 346 | |
r241644 | r241645 | |
374 | 354 | |
375 | 355 | bit description |
376 | 356 | |
377 | | P20 keylatch enable ? |
378 | | P21 |
379 | | P22 key available ? |
380 | | P23 data ? |
| 357 | P20 ? |
| 358 | P21 KBRDY |
| 359 | P22 ? |
| 360 | P23 KBDATA |
381 | 361 | |
382 | 362 | */ |
383 | 363 | |
384 | | int kbrdy = BIT(data, 2); |
| 364 | int kbrdy = BIT(data, 1); |
385 | 365 | |
386 | 366 | if (m_kbrdy != kbrdy) |
387 | 367 | { |
r241644 | r241645 | |
397 | 377 | m_kbdata_handler(m_kbdata); |
398 | 378 | } |
399 | 379 | |
400 | | logerror("P2 %01x\n", data & 0x0f); |
| 380 | //logerror("P2 %02x\n", data); |
401 | 381 | } |
402 | 382 | |
403 | 383 | |
r241644 | r241645 | |
407 | 387 | |
408 | 388 | READ8_MEMBER( victor9k_keyboard_device::kb_t1_r ) |
409 | 389 | { |
410 | | logerror("read T1 %u\n", m_kback); |
411 | | |
412 | 390 | return m_kback; |
413 | 391 | } |