diff options
Diffstat (limited to 'src/devices/machine/msm6200.h')
-rw-r--r-- | src/devices/machine/msm6200.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/devices/machine/msm6200.h b/src/devices/machine/msm6200.h new file mode 100644 index 00000000000..584511fb808 --- /dev/null +++ b/src/devices/machine/msm6200.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders: Devin Acker +/*************************************************************************** + OKI MSM6200 keyboard controller (HLE) +***************************************************************************/ + +#ifndef MAME_MACHINE_MSM6200_H +#define MAME_MACHINE_MSM6200_H + +#pragma once + +class msm6200_device : public device_t +{ +public: + msm6200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + auto irq_cb() { return m_irq_cb.bind(); } + + void write(offs_t offset, u8 data); + u8 read(); + +protected: + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + +private: + static constexpr unsigned TIMER_RATE = 256; // arbitrary + + TIMER_CALLBACK_MEMBER(scan_timer); + + optional_ioport_array<38> m_keys; + optional_ioport m_velocity; + + devcb_write_line m_irq_cb; + + emu_timer *m_timer; + + u8 m_cmd, m_row, m_key_data; + u8 m_key_state; + u8 m_last_state[38]; +}; + +// device type definition +DECLARE_DEVICE_TYPE(MSM6200, msm6200_device) + +#endif // MAME_MACHINE_MSM6200_H |