diff options
| author | 2025-08-23 12:13:00 +0200 | |
|---|---|---|
| committer | 2025-08-23 12:13:45 +0200 | |
| commit | a2620b35211270f58256da228d081f99153849f6 (patch) | |
| tree | f4c729ddea08ad313ed86c629afc407a11d1b30c | |
| parent | 9156bdcfa98a88b4419e19b8ea67947613847793 (diff) | |
adi_unk_kbd: Simplify key reading
| -rw-r--r-- | src/mame/misc/adi_unk_kbd.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mame/misc/adi_unk_kbd.cpp b/src/mame/misc/adi_unk_kbd.cpp index d883260156c..64d45813ddc 100644 --- a/src/mame/misc/adi_unk_kbd.cpp +++ b/src/mame/misc/adi_unk_kbd.cpp @@ -282,17 +282,12 @@ int adi_unk_kbd_device::t1_r() uint8_t adi_unk_kbd_device::bus_r() { + uint16_t selected_rows = (m_key_row_p2 << 8 | m_key_row_p1) >> 1; uint8_t data = 0xff; - // read keys selected by port 1 (bit 1 to 7) - for (unsigned i = 1; i < 8; i++) - if (BIT(m_key_row_p1, i) == 0) - data &= m_keys[i - 1]->read(); - - // read keys selected by port 2 (bit 0 to 6) - for (unsigned i = 0; i < 7; i++) - if (BIT(m_key_row_p2, i) == 0) - data &= m_keys[i + 7]->read(); + for (unsigned i = 0; i < 14; i++) + if (BIT(selected_rows, i) == 0) + data &= m_keys[i]->read(); return data; } |
