mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
M50753: Finish A/D converter, including completion IRQ. [R. Belmont]
This commit is contained in:
parent
2b4e83ee51
commit
e1a1f62635
@ -498,13 +498,18 @@ void m50753_device::m50753_map(address_map &map)
|
||||
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(0x00f2, 0x00f2).w(FUNC(m50753_device::ad_start_w));
|
||||
map(0x00f3, 0x00f3).rw(FUNC(m50753_device::ad_control_r), FUNC(m50753_device::ad_control_w));
|
||||
map(0x00f5, 0x00f5).rw(FUNC(m50753_device::pwm_control_r), FUNC(m50753_device::pwm_control_w));
|
||||
map(0x00f9, 0x00ff).rw(FUNC(m50753_device::tmrirq_r), FUNC(m50753_device::tmrirq_w));
|
||||
map(0xe800, 0xffff).rom().region(DEVICE_SELF, 0);
|
||||
}
|
||||
|
||||
// interrupt bits on 50753 are slightly different from the 740/741.
|
||||
static constexpr u8 IRQ_50753_INT1REQ = 0x80;
|
||||
static constexpr u8 IRQ_50753_INTADC = 0x20;
|
||||
static constexpr u8 IRQ_50753_INT2REQ = 0x02;
|
||||
|
||||
m50753_device::m50753_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
m50753_device(mconfig, M50753, tag, owner, clock)
|
||||
{
|
||||
@ -545,12 +550,18 @@ uint8_t m50753_device::in_r()
|
||||
|
||||
uint8_t m50753_device::ad_r()
|
||||
{
|
||||
m_intctrl &= ~IRQ_50753_INTADC;
|
||||
recalc_irqs();
|
||||
|
||||
return m_ad_in[m_ad_control & 0x07]();
|
||||
}
|
||||
|
||||
void m50753_device::ad_start_w(uint8_t data)
|
||||
{
|
||||
logerror("%s: A-D start (IN%d)\n", machine().describe_context(), m_ad_control & 0x07);
|
||||
|
||||
// starting a conversion. M50753 documentation says conversion time is 72 microseconds.
|
||||
m_timers[TIMER_ADC]->adjust(attotime::from_usec(72));
|
||||
}
|
||||
|
||||
uint8_t m50753_device::ad_control_r()
|
||||
@ -573,10 +584,6 @@ void m50753_device::pwm_control_w(uint8_t data)
|
||||
m_pwm_enabled = BIT(data, 0);
|
||||
}
|
||||
|
||||
// interrupt bits on 50753 are slightly different from the 740/741.
|
||||
static constexpr u8 IRQ_50753_INT1REQ = 0x80;
|
||||
static constexpr u8 IRQ_50753_INT2REQ = 0x02;
|
||||
|
||||
void m50753_device::execute_set_input(int inputnum, int state)
|
||||
{
|
||||
switch (inputnum)
|
||||
@ -606,3 +613,24 @@ void m50753_device::execute_set_input(int inputnum, int state)
|
||||
|
||||
recalc_irqs();
|
||||
}
|
||||
|
||||
void m50753_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_ADC:
|
||||
m_timers[TIMER_ADC]->adjust(attotime::never);
|
||||
|
||||
// if interrupt source is the ADC, do it.
|
||||
if (m_ad_control & 4)
|
||||
{
|
||||
m_intctrl |= IRQ_50753_INTADC;
|
||||
recalc_irqs();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
m5074x_device::device_timer(timer, id, param, ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ class m5074x_device : public m740_device
|
||||
TIMER_2,
|
||||
TIMER_X,
|
||||
|
||||
TIMER_ADC,
|
||||
|
||||
NUM_TIMERS
|
||||
};
|
||||
|
||||
@ -125,6 +127,7 @@ 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 execute_set_input(int inputnum, int state) override;
|
||||
|
||||
@ -136,6 +139,7 @@ private:
|
||||
void ad_start_w(uint8_t data);
|
||||
uint8_t ad_control_r();
|
||||
void ad_control_w(uint8_t data);
|
||||
void ad_trigger_w(uint8_t data);
|
||||
uint8_t pwm_control_r();
|
||||
void pwm_control_w(uint8_t data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user