diff options
Diffstat (limited to 'src/devices/machine/mm5740.h')
-rw-r--r-- | src/devices/machine/mm5740.h | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/src/devices/machine/mm5740.h b/src/devices/machine/mm5740.h index 1896f568e4c..286fc1cc826 100644 --- a/src/devices/machine/mm5740.h +++ b/src/devices/machine/mm5740.h @@ -1,10 +1,10 @@ // license:BSD-3-Clause -// copyright-holders: R. Belmont +// copyright-holders: R. Belmont, Mark Garlanger /********************************************************************** MM5740 Keyboard Encoder emulation -********************************************************************** + ********************************************************************** _____ _____ B3 1 |* \_/ | 40 B4 Vll 2 | | 39 B9 @@ -24,16 +24,17 @@ Repeat 16 | | 25 Y3 Key Bounce Mask 17 | | 24 Y2 Vgg 18 | | 23 Y1 - Control 19 | | 22 Y0 + Control 19 | | 22 Y10 Shift Lock I/O 20 |_____________| 21 Shift + Name Pin No. Function ---------------------------------------------------------------------- X1-X9 4-12 Output - Drives the key switch matrix. Y1-Y10 22-31 Inputs - connect to the X drive lines with - the key switch matrix. + the key switch matrix. B1-B9 1,33-40 Tri-stated data outputs. @@ -44,10 +45,10 @@ Data Strobe Control 14 Input to control data strobe output pulse width Output Enable 15 Input to control the chip's TRI-STATE output Repeat 16 Each cycle of this signal will issue - a new data strobe for the pressed key. + a new data strobe for the pressed key. Key-Bounce Mask 17 Use capacitor on this chip to provide - key debouncing + key debouncing Shift 21 Shift key pressed @@ -63,12 +64,9 @@ Vll 2 Ground Vgg 18 -12V - **********************************************************************/ /* TODO: - Support Key-bounce mask - Support Repeat function Support shift lock Support additional internal ROMs */ @@ -78,50 +76,48 @@ Vgg 18 -12V #pragma once - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> mm5740_device - class mm5740_device : public device_t { public: - // construction/destruction - mm5740_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + mm5740_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // public interface - uint16_t b_r(); + u16 b_r(); - template <unsigned N> auto x_cb() { return m_read_x[N].bind(); } + template <unsigned N> auto x_cb() { return m_read_x[N - 1].bind(); } auto shift_cb() { return m_read_shift.bind(); } auto control_cb() { return m_read_control.bind(); } auto data_ready_cb() { return m_write_data_ready.bind(); } - static uint32_t calc_effective_clock_key_debounce(uint32_t capacitance); + void repeat_line_w(int state); + + static u32 calc_effective_clock_key_debounce(u32 capacitance); protected: // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_start() override ATTR_COLD; + + virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; - virtual const tiny_rom_entry *device_rom_region() const override; + TIMER_CALLBACK_MEMBER(perform_scan); private: - devcb_read16 m_read_x[9]; - devcb_read_line m_read_shift, m_read_control; + devcb_read16::array<9> m_read_x; + devcb_read_line m_read_shift; + devcb_read_line m_read_control; devcb_write_line m_write_data_ready; - required_memory_region m_rom; // Internal ROM + required_memory_region m_rom; // Internal ROM - int m_b; // output buffer + s32 m_b; // output buffer + u16 m_offset; // last key pressed (without shift/ctrl modifiers) - int m_x_mask[9]; // mask of what keys are down + u16 m_x_mask[9]; // mask of what keys are down + bool m_repeat; // state of the 'repeat' input. + bool m_last_repeat; // state of the repeat input on the last scan. // timers - emu_timer *m_scan_timer; // keyboard scan timer + emu_timer *m_scan_timer; // keyboard scan timer }; |