summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-10-19 21:51:56 -0400
committer arbee <rb6502@users.noreply.github.com>2020-10-19 21:51:56 -0400
commit72e27f9e02616647744d0cf79a54dfbe84dfe8fb (patch)
tree3ec8f9a005e9a7a6fe085051bfee44f5c08103a0
parentf71ab9fff85cd8ca8961d58d8843b25b3998da92 (diff)
M50753: Add both IRQ lines and route them to the correct interrupt bits. [R. Belmont]
-rw-r--r--src/devices/cpu/m6502/m5074x.cpp64
-rw-r--r--src/devices/cpu/m6502/m5074x.h10
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 <std::size_t Bit> 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);