diff options
| author | 2026-04-28 13:51:19 +0200 | |
|---|---|---|
| committer | 2026-04-28 13:58:43 +0200 | |
| commit | 3c9b1249acd4a3e455646b5d751db800fc890bf5 (patch) | |
| tree | bdd8315b5938322f33fd5579c22846b4a197e9ff | |
| parent | 67bbb92cf19042cd0776bff9f2b175af5867d9bc (diff) | |
sony/smc777_kbd.cpp: clear scan code on key_break, handle a vestigial BUSY flag for commands (bugatk fire button)
| -rw-r--r-- | src/mame/sony/smc777_kbd.cpp | 31 | ||||
| -rw-r--r-- | src/mame/sony/smc777_kbd.h | 5 |
2 files changed, 32 insertions, 4 deletions
diff --git a/src/mame/sony/smc777_kbd.cpp b/src/mame/sony/smc777_kbd.cpp index e472a65051b..b75d221ebd0 100644 --- a/src/mame/sony/smc777_kbd.cpp +++ b/src/mame/sony/smc777_kbd.cpp @@ -34,8 +34,13 @@ smc777_kbd_device::smc777_kbd_device(const machine_config &mconfig, const char * void smc777_kbd_device::device_start() { + m_aux_timer = timer_alloc(FUNC(smc777_kbd_device::aux_ready), this); + m_aux_timer->adjust(attotime::never); + m_aux_hs = 4; + save_item(NAME(m_command)); save_item(NAME(m_status)); + save_item(NAME(m_aux_hs)); save_item(NAME(m_scan_code)); save_item(NAME(m_repeat_interval)); save_item(NAME(m_repeat_start)); @@ -52,6 +57,7 @@ void smc777_kbd_device::device_reset() reset_key_state(); start_processing(attotime::from_hz(1'200)); typematic_stop(); + // don't reset aux timer: we do that separatedly m_command = 0; m_status = 0; @@ -300,16 +306,22 @@ void smc777_kbd_device::key_make(uint8_t row, uint8_t column) { m_scan_code = translate(row, column); m_status |= 5; + //printf("%d %d\n", row, column); // take count of multipresses like this (testable in games like ldrun/cloderun) m_held_keys ++; } void smc777_kbd_device::key_break(uint8_t row, uint8_t column) { -// m_scan_code = 0; m_held_keys --; if (m_held_keys <= 0) + { + // clear code for safety + // (would cause drift in stuff like hudson1~5, where pressing enter at MAME startup + // will get stuck from POST up to game selection) + m_scan_code = 0; m_status &= ~4; + } } void smc777_kbd_device::key_repeat(uint8_t row, uint8_t column) @@ -337,7 +349,9 @@ void smc777_kbd_device::scan_mode(u8 data) } // IEF: enable interrupt if (BIT(data, 0)) - LOG("Enable ief_key (tbd)\n"); + { + LOG("Enable ief_key (TBD)\n"); + } } u8 smc777_kbd_device::data_r(offs_t offset) @@ -405,7 +419,9 @@ u8 smc777_kbd_device::status_r(offs_t offset) res|= (m_key_mod->read() & 3) << 6; } else - res = 4 | (m_command == 0x80); + { + res = m_aux_hs | (m_command == 0x80); + } return res; } @@ -457,5 +473,14 @@ void smc777_kbd_device::control_w(offs_t offset, u8 data) LOG("Initialize key\n"); break; } + m_aux_hs &= ~4; + // TODO: timing + m_aux_timer->adjust(attotime::from_usec(250)); } } + +// - bugatk expects BUSY to go low otherwise space key won't work during gameplay +TIMER_CALLBACK_MEMBER(smc777_kbd_device::aux_ready) +{ + m_aux_hs |= 4; +} diff --git a/src/mame/sony/smc777_kbd.h b/src/mame/sony/smc777_kbd.h index ab2aea6cdf0..8f7a969d0f5 100644 --- a/src/mame/sony/smc777_kbd.h +++ b/src/mame/sony/smc777_kbd.h @@ -34,7 +34,7 @@ private: void scan_mode(u8 data); u8 m_command; - u8 m_status; + u8 m_status, m_aux_hs; u8 m_scan_code; u16 m_repeat_interval; u16 m_repeat_start; @@ -43,6 +43,9 @@ private: bool m_fkey_dir; u8 m_fkey_target; u8 m_fkey_index; + + emu_timer *m_aux_timer; + TIMER_CALLBACK_MEMBER(aux_ready); }; DECLARE_DEVICE_TYPE(SMC777_KBD, smc777_kbd_device) |
