summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ville Linde <villedevs@gmail.com>2015-08-17 20:29:07 +0300
committer Ville Linde <villedevs@gmail.com>2015-08-17 20:31:30 +0300
commit5d8df651341067f73b0199193aaf6750d36f75ff (patch)
treea358e3f98670ff63a9323486f099ff10e1207ac0 /src
parent77a0a99a0b66c22d5afbc525b9010ca78685d00f (diff)
k057714: add IRQ callback (nw)
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/firebeat.c20
-rw-r--r--src/mame/drivers/konendev.c10
-rw-r--r--src/mame/video/k057714.c12
-rw-r--r--src/mame/video/k057714.h12
4 files changed, 40 insertions, 14 deletions
diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c
index 4c057bd62be..240ff494256 100644
--- a/src/mame/drivers/firebeat.c
+++ b/src/mame/drivers/firebeat.c
@@ -261,6 +261,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(sound_irq_callback);
DECLARE_WRITE_LINE_MEMBER(midi_uart_ch0_irq_callback);
DECLARE_WRITE_LINE_MEMBER(midi_uart_ch1_irq_callback);
+ DECLARE_WRITE_LINE_MEMBER(gcu0_interrupt);
+ DECLARE_WRITE_LINE_MEMBER(gcu1_interrupt);
};
@@ -1229,6 +1231,16 @@ INTERRUPT_GEN_MEMBER(firebeat_state::firebeat_interrupt)
device.execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
}
+WRITE_LINE_MEMBER(firebeat_state::gcu0_interrupt)
+{
+ m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
+}
+
+WRITE_LINE_MEMBER(firebeat_state::gcu1_interrupt)
+{
+ m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
+}
+
MACHINE_RESET_MEMBER(firebeat_state,firebeat)
{
m_layer = 0;
@@ -1271,10 +1283,10 @@ static MACHINE_CONFIG_START( firebeat, firebeat_state )
MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
MCFG_DEVICE_ADD("gcu0", K057714, 0)
- MCFG_K057714_CPU_TAG("maincpu")
+ MCFG_K057714_IRQ_CALLBACK(WRITELINE(firebeat_state, gcu0_interrupt))
MCFG_DEVICE_ADD("gcu1", K057714, 0)
- MCFG_K057714_CPU_TAG("maincpu")
+ MCFG_K057714_IRQ_CALLBACK(WRITELINE(firebeat_state, gcu1_interrupt))
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -1331,10 +1343,10 @@ static MACHINE_CONFIG_START( firebeat2, firebeat_state )
MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
MCFG_DEVICE_ADD("gcu0", K057714, 0)
- MCFG_K057714_CPU_TAG("maincpu")
+ MCFG_K057714_IRQ_CALLBACK(WRITELINE(firebeat_state, gcu0_interrupt))
MCFG_DEVICE_ADD("gcu1", K057714, 0)
- MCFG_K057714_CPU_TAG("maincpu")
+ MCFG_K057714_IRQ_CALLBACK(WRITELINE(firebeat_state, gcu1_interrupt))
MCFG_SCREEN_ADD("lscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/drivers/konendev.c b/src/mame/drivers/konendev.c
index 492eb0218fa..3e3b7607afb 100644
--- a/src/mame/drivers/konendev.c
+++ b/src/mame/drivers/konendev.c
@@ -68,6 +68,8 @@ public:
DECLARE_READ32_MEMBER(unk_78e00000_r);
DECLARE_WRITE32_MEMBER(eeprom_w);
+ DECLARE_WRITE_LINE_MEMBER(gcu_interrupt);
+
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
};
@@ -162,6 +164,12 @@ static INPUT_PORTS_START( konendev )
INPUT_PORTS_END
+WRITE_LINE_MEMBER(konendev_state::gcu_interrupt)
+{
+ m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
+}
+
+
static MACHINE_CONFIG_START( konendev, konendev_state )
/* basic machine hardware */
@@ -180,7 +188,7 @@ static MACHINE_CONFIG_START( konendev, konendev_state )
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gcu", K057714, 0)
- MCFG_K057714_CPU_TAG("maincpu")
+ MCFG_K057714_IRQ_CALLBACK(WRITELINE(konendev_state, gcu_interrupt))
MCFG_NVRAM_ADD_0FILL("nvram0")
MCFG_NVRAM_ADD_0FILL("nvram1")
diff --git a/src/mame/video/k057714.c b/src/mame/video/k057714.c
index 9473607aa30..30b2f932e7a 100644
--- a/src/mame/video/k057714.c
+++ b/src/mame/video/k057714.c
@@ -14,13 +14,14 @@
const device_type K057714 = &device_creator<k057714_device>;
k057714_device::k057714_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, K057714, "K057714 GCU", tag, owner, clock, "k057714", __FILE__)
+ : device_t(mconfig, K057714, "K057714 GCU", tag, owner, clock, "k057714", __FILE__),
+ m_irq(*this)
{
}
void k057714_device::device_start()
{
- m_cpu = machine().device(m_cputag);
+ m_irq.resolve_safe();
m_vram = auto_alloc_array(machine(), UINT32, 0x2000000/4);
memset(m_vram, 0, 0x2000000);
@@ -97,7 +98,12 @@ WRITE32_MEMBER(k057714_device::write)
/* IRQ clear/enable; ppd writes bit off then on in response to interrupt */
/* it enables bits 0x41, but 0x01 seems to be the one it cares about */
if (ACCESSING_BITS_16_31 && (data & 0x00010000) == 0)
- m_cpu->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
+ {
+ if (!m_irq.isnull())
+ {
+ m_irq(CLEAR_LINE);
+ }
+ }
if (ACCESSING_BITS_0_15)
#if PRINT_GCU
printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask);
diff --git a/src/mame/video/k057714.h b/src/mame/video/k057714.h
index 85671ffd5d8..14f1f432b05 100644
--- a/src/mame/video/k057714.h
+++ b/src/mame/video/k057714.h
@@ -9,7 +9,7 @@ class k057714_device : public device_t
{
public:
k057714_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<k057714_device &>(device).m_cputag = tag; }
+ template<class _Object> static devcb_base &static_set_irq_callback(device_t &device, _Object object) { return downcast<k057714_device &>(device).m_irq.set_callback(object); }
int draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -47,17 +47,17 @@ private:
UINT32 m_command_fifo1[4];
UINT32 m_command_fifo1_ptr;
- const char* m_cputag;
- device_t* m_cpu;
-
framebuffer m_frame[4];
UINT32 m_fb_origin_x;
UINT32 m_fb_origin_y;
+
+ devcb_write_line m_irq;
};
extern const device_type K057714;
-#define MCFG_K057714_CPU_TAG(_tag) \
- k057714_device::static_set_cpu_tag(*device, _tag);
+#define MCFG_K057714_IRQ_CALLBACK(_devcb) \
+ devcb = &k057714_device::static_set_irq_callback(*device, DEVCB_##_devcb);
+
#endif