src/emu/machine/upd1990a.c
| r14890 | r14891 | |
| 193 | 193 | save_item(NAME(m_c)); |
| 194 | 194 | save_item(NAME(m_clk)); |
| 195 | 195 | save_item(NAME(m_tp)); |
| 196 | save_item(NAME(m_c_unlatched)); |
| 196 | 197 | } |
| 197 | 198 | |
| 198 | 199 | |
| r14890 | r14891 | |
| 298 | 299 | |
| 299 | 300 | if (m_cs && m_stb && !m_clk) |
| 300 | 301 | { |
| 302 | m_c = m_c_unlatched; // if STB = 1, latch in the command bits |
| 303 | |
| 301 | 304 | switch (m_c) |
| 302 | 305 | { |
| 303 | 306 | case MODE_REGISTER_HOLD: |
| r14890 | r14891 | |
| 426 | 429 | |
| 427 | 430 | if (!m_clk && state) // rising edge |
| 428 | 431 | { |
| 432 | logerror("Rising edge\n"); |
| 429 | 433 | if (m_c == MODE_SHIFT) |
| 430 | 434 | { |
| 435 | logerror("MODE_SHIFT\n"); |
| 431 | 436 | m_shift_reg[0] >>= 1; |
| 432 | 437 | m_shift_reg[0] |= (BIT(m_shift_reg[1], 0) << 7); |
| 433 | 438 | |
| r14890 | r14891 | |
| 445 | 450 | |
| 446 | 451 | if (m_oe) |
| 447 | 452 | { |
| 453 | logerror("OE\n"); |
| 448 | 454 | m_data_out = BIT(m_shift_reg[0], 0); |
| 449 | 455 | |
| 450 | 456 | if (LOG) logerror("uPD1990A '%s' DATA OUT %u\n", tag(), m_data_out); |
| r14890 | r14891 | |
| 466 | 472 | { |
| 467 | 473 | if (LOG) logerror("uPD1990A '%s' C0 %u\n", tag(), state); |
| 468 | 474 | |
| 469 | | m_c = (m_c & 0x06) | state; |
| 475 | m_c_unlatched = (m_c_unlatched & 0x06) | state; |
| 470 | 476 | } |
| 471 | 477 | |
| 472 | 478 | |
| r14890 | r14891 | |
| 478 | 484 | { |
| 479 | 485 | if (LOG) logerror("uPD1990A '%s' C1 %u\n", tag(), state); |
| 480 | 486 | |
| 481 | | m_c = (m_c & 0x05) | (state << 1); |
| 487 | m_c_unlatched = (m_c_unlatched & 0x05) | (state << 1); |
| 482 | 488 | } |
| 483 | 489 | |
| 484 | 490 | |
| r14890 | r14891 | |
| 490 | 496 | { |
| 491 | 497 | if (LOG) logerror("uPD1990A '%s' C2 %u\n", tag(), state); |
| 492 | 498 | |
| 493 | | m_c = (m_c & 0x03) | (state << 2); |
| 499 | m_c_unlatched = (m_c_unlatched & 0x03) | (state << 2); |
| 494 | 500 | } |
| 495 | 501 | |
| 496 | 502 | |