From 13ad683745c6dc86f28e773ba884ab3670c53c36 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 24 Oct 2020 23:38:59 -0400 Subject: M50753: add support for the 8-bit IN port. [R. Belmont] --- src/devices/cpu/m6502/m5074x.cpp | 8 ++++++++ src/devices/cpu/m6502/m5074x.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/devices/cpu/m6502/m5074x.cpp b/src/devices/cpu/m6502/m5074x.cpp index c36399bf745..5d7690b60a3 100644 --- a/src/devices/cpu/m6502/m5074x.cpp +++ b/src/devices/cpu/m6502/m5074x.cpp @@ -500,6 +500,7 @@ void m50753_device::m50753_map(address_map &map) { map(0x0000, 0x00bf).ram(); map(0x00e0, 0x00eb).rw(FUNC(m50753_device::ports_r), FUNC(m50753_device::ports_w)); + map(0x00ee, 0x00ee).r(FUNC(m50753_device::in_r)); map(0x00ef, 0x00ef).r(FUNC(m50753_device::ad_r)); map(0x00f2, 0x00f2).w(FUNC(m50753_device::ad_control_w)); map(0x00f3, 0x00f3).rw(FUNC(m50753_device::ad_control_r), FUNC(m50753_device::ad_control_w)); @@ -516,6 +517,7 @@ m50753_device::m50753_device(const machine_config &mconfig, const char *tag, dev m50753_device::m50753_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : m5074x_device(mconfig, type, tag, owner, clock, 16, address_map_constructor(FUNC(m50753_device::m50753_map), this)), m_ad_in(*this), + m_in_p(*this), m_ad_control(0), m_pwm_enabled(false) { @@ -526,6 +528,7 @@ void m50753_device::device_start() m5074x_device::device_start(); m_ad_in.resolve_all_safe(0); + m_in_p.resolve_safe(0); save_item(NAME(m_ad_control)); save_item(NAME(m_pwm_enabled)); @@ -539,6 +542,11 @@ void m50753_device::device_reset() m_pwm_enabled = false; } +uint8_t m50753_device::in_r() +{ + return m_in_p(); +} + uint8_t m50753_device::ad_r() { return m_ad_in[m_ad_control & 0x07](); diff --git a/src/devices/cpu/m6502/m5074x.h b/src/devices/cpu/m6502/m5074x.h index 6af2156622c..ffb57873b15 100644 --- a/src/devices/cpu/m6502/m5074x.h +++ b/src/devices/cpu/m6502/m5074x.h @@ -117,6 +117,8 @@ public: template auto ad_in() { return m_ad_in[Bit].bind(); } + auto read_in_p() { return m_in_p.bind(); } + protected: m50753_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -130,6 +132,7 @@ private: void m50753_map(address_map &map); uint8_t ad_r(); + uint8_t in_r(); void ad_start_w(uint8_t data); uint8_t ad_control_r(); void ad_control_w(uint8_t data); @@ -137,6 +140,7 @@ private: void pwm_control_w(uint8_t data); devcb_read8::array<8> m_ad_in; + devcb_read8 m_in_p; uint8_t m_ad_control; bool m_pwm_enabled; -- cgit v1.2.3