M50753: add support for the 8-bit IN port. [R. Belmont]

This commit is contained in:
arbee 2020-10-24 23:38:59 -04:00
parent f6986973e3
commit 13ad683745
2 changed files with 12 additions and 0 deletions

View File

@ -500,6 +500,7 @@ void m50753_device::m50753_map(address_map &map)
{ {
map(0x0000, 0x00bf).ram(); map(0x0000, 0x00bf).ram();
map(0x00e0, 0x00eb).rw(FUNC(m50753_device::ports_r), FUNC(m50753_device::ports_w)); 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(0x00ef, 0x00ef).r(FUNC(m50753_device::ad_r));
map(0x00f2, 0x00f2).w(FUNC(m50753_device::ad_control_w)); 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)); 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) : 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)), m5074x_device(mconfig, type, tag, owner, clock, 16, address_map_constructor(FUNC(m50753_device::m50753_map), this)),
m_ad_in(*this), m_ad_in(*this),
m_in_p(*this),
m_ad_control(0), m_ad_control(0),
m_pwm_enabled(false) m_pwm_enabled(false)
{ {
@ -526,6 +528,7 @@ void m50753_device::device_start()
m5074x_device::device_start(); m5074x_device::device_start();
m_ad_in.resolve_all_safe(0); m_ad_in.resolve_all_safe(0);
m_in_p.resolve_safe(0);
save_item(NAME(m_ad_control)); save_item(NAME(m_ad_control));
save_item(NAME(m_pwm_enabled)); save_item(NAME(m_pwm_enabled));
@ -539,6 +542,11 @@ void m50753_device::device_reset()
m_pwm_enabled = false; m_pwm_enabled = false;
} }
uint8_t m50753_device::in_r()
{
return m_in_p();
}
uint8_t m50753_device::ad_r() uint8_t m50753_device::ad_r()
{ {
return m_ad_in[m_ad_control & 0x07](); return m_ad_in[m_ad_control & 0x07]();

View File

@ -117,6 +117,8 @@ public:
template <std::size_t Bit> auto ad_in() { return m_ad_in[Bit].bind(); } template <std::size_t Bit> auto ad_in() { return m_ad_in[Bit].bind(); }
auto read_in_p() { return m_in_p.bind(); }
protected: protected:
m50753_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); 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); void m50753_map(address_map &map);
uint8_t ad_r(); uint8_t ad_r();
uint8_t in_r();
void ad_start_w(uint8_t data); void ad_start_w(uint8_t data);
uint8_t ad_control_r(); uint8_t ad_control_r();
void ad_control_w(uint8_t data); void ad_control_w(uint8_t data);
@ -137,6 +140,7 @@ private:
void pwm_control_w(uint8_t data); void pwm_control_w(uint8_t data);
devcb_read8::array<8> m_ad_in; devcb_read8::array<8> m_ad_in;
devcb_read8 m_in_p;
uint8_t m_ad_control; uint8_t m_ad_control;
bool m_pwm_enabled; bool m_pwm_enabled;