From 72e27f9e02616647744d0cf79a54dfbe84dfe8fb Mon Sep 17 00:00:00 2001 From: arbee Date: Mon, 19 Oct 2020 21:51:56 -0400 Subject: [PATCH] M50753: Add both IRQ lines and route them to the correct interrupt bits. [R. Belmont] --- src/devices/cpu/m6502/m5074x.cpp | 64 +++++++++++++++++++++++++------- src/devices/cpu/m6502/m5074x.h | 10 +++++ 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/devices/cpu/m6502/m5074x.cpp b/src/devices/cpu/m6502/m5074x.cpp index 02fefaf57c4..c36399bf745 100644 --- a/src/devices/cpu/m6502/m5074x.cpp +++ b/src/devices/cpu/m6502/m5074x.cpp @@ -1,7 +1,7 @@ // license:BSD-3-Clause // copyright-holders:R. Belmont, Olivier Galibert /* - Mitsubishi M5074x 8-bit microcontroller family + Mitsubishi M5074x/5075x 8-bit microcontroller family */ #include "emu.h" @@ -11,19 +11,19 @@ // MACROS / CONSTANTS //************************************************************************** -#define IRQ_CNTRREQ (0x80) -#define IRQ_CNTRENA (0x40) -#define IRQ_TMR1REQ (0x20) -#define IRQ_TMR1ENA (0x10) -#define IRQ_TMR2REQ (0x08) -#define IRQ_TMR2ENA (0x04) -#define IRQ_INTREQ (0x02) -#define IRQ_INTENA (0x01) +static constexpr u8 IRQ_CNTRREQ = 0x80; +static constexpr u8 IRQ_CNTRENA = 0x40; +static constexpr u8 IRQ_TMR1REQ = 0x20; +static constexpr u8 IRQ_TMR1ENA = 0x10; +static constexpr u8 IRQ_TMR2REQ = 0x08; +static constexpr u8 IRQ_TMR2ENA = 0x04; +static constexpr u8 IRQ_INTREQ = 0x02; +static constexpr u8 IRQ_INTENA = 0x01; -#define TMRC_TMRXREQ (0x80) -#define TMRC_TMRXENA (0x40) -#define TMRC_TMRXHLT (0x20) -#define TMRC_TMRXMDE (0x0c) +static constexpr u8 TMRC_TMRXREQ = 0x80; +static constexpr u8 TMRC_TMRXENA = 0x40; +static constexpr u8 TMRC_TMRXHLT = 0x20; +static constexpr u8 TMRC_TMRXMDE = 0x0c; //************************************************************************** // DEVICE DEFINITIONS @@ -568,3 +568,41 @@ 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) + { + case M50753_INT1_LINE: + if (state == ASSERT_LINE) + { + m_intctrl |= IRQ_50753_INT1REQ; + } + else + { + m_intctrl &= ~IRQ_50753_INT1REQ; + } + break; + + case M50753_INT2_LINE: + if (state == ASSERT_LINE) + { + m_intctrl |= IRQ_50753_INT2REQ; + } + else + { + m_intctrl &= ~IRQ_50753_INT2REQ; + } + break; + + case M5074X_SET_OVERFLOW: // the base 740 class can handle this + m740_device::execute_set_input(M740_SET_OVERFLOW, state); + break; + } + + recalc_irqs(); +} diff --git a/src/devices/cpu/m6502/m5074x.h b/src/devices/cpu/m6502/m5074x.h index 47cde166925..6af2156622c 100644 --- a/src/devices/cpu/m6502/m5074x.h +++ b/src/devices/cpu/m6502/m5074x.h @@ -107,6 +107,14 @@ class m50753_device : public m5074x_device public: m50753_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + enum + { + M50753_INT1_LINE = INPUT_LINE_IRQ0, + M50753_INT2_LINE = INPUT_LINE_IRQ1, + + M5074X_SET_OVERFLOW = M740_SET_OVERFLOW + }; + template auto ad_in() { return m_ad_in[Bit].bind(); } protected: @@ -116,6 +124,8 @@ protected: virtual void device_start() override; virtual void device_reset() override; + virtual void execute_set_input(int inputnum, int state) override; + private: void m50753_map(address_map &map);