summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-05-06 11:55:26 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-05-06 11:55:26 -0400
commitaa414babb9a18651b7fa751ff3fad16a789b71b8 (patch)
treedf8d34ff04e3a5d980b3587b786fd716532604f2 /src/devices/video
parent2131ffd9756117258ae26b4de2e51908ccd96021 (diff)
ppu2c0x: Change NMI to line callback (nw)
Diffstat (limited to 'src/devices/video')
-rw-r--r--src/devices/video/ppu2c0x.cpp10
-rw-r--r--src/devices/video/ppu2c0x.h8
2 files changed, 8 insertions, 10 deletions
diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp
index 6fee9f3a33d..98dd5d9b5d4 100644
--- a/src/devices/video/ppu2c0x.cpp
+++ b/src/devices/video/ppu2c0x.cpp
@@ -128,6 +128,7 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type,
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(ppu2c0x_device::ppu2c0x), this))
, m_cpu(*this, finder_base::DUMMY_TAG)
, m_scanline(0) // reset the scanline count
+ , m_int_callback(*this)
, m_refresh_data(0)
, m_refresh_latch(0)
, m_x_fine(0)
@@ -154,8 +155,6 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type,
/* usually, no security value... */
m_security_value = 0;
-
- m_nmi_callback_proc = nmi_delegate();
}
ppu2c0x_rgb_device::ppu2c0x_rgb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, type, tag, owner, clock)
@@ -221,7 +220,7 @@ ppu2c05_04_device::ppu2c05_04_device(const machine_config &mconfig, const char *
void ppu2c0x_device::device_start()
{
// bind our handler
- m_nmi_callback_proc.bind_relative_to(*owner());
+ m_int_callback.resolve_safe();
// allocate timers
m_hblank_timer = timer_alloc(TIMER_HBLANK);
@@ -477,7 +476,6 @@ static const gfx_layout ppu_charlayout =
void ppu2c0x_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
int blanked, vblank;
- int *regs = &m_regs[0];
switch (id)
{
@@ -495,8 +493,8 @@ void ppu2c0x_device::device_timer(emu_timer &timer, device_timer_id id, int para
case TIMER_NMI:
// Actually fire the VMI
- if (!m_nmi_callback_proc.isnull())
- m_nmi_callback_proc(regs);
+ m_int_callback(ASSERT_LINE);
+ m_int_callback(CLEAR_LINE);
m_nmi_timer->adjust(attotime::never);
break;
diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h
index 100d557e748..4160394bd32 100644
--- a/src/devices/video/ppu2c0x.h
+++ b/src/devices/video/ppu2c0x.h
@@ -61,8 +61,8 @@
#define MCFG_PPU2C0X_CPU(_tag) \
downcast<ppu2c0x_device &>(*device).set_cpu_tag(_tag);
-#define MCFG_PPU2C0X_SET_NMI(_class, _method) \
- downcast<ppu2c0x_device &>(*device).set_nmi_delegate(ppu2c0x_device::nmi_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr));
+#define MCFG_PPU2C0X_INT_CALLBACK(_devcb) \
+ downcast<ppu2c0x_device &>(*device).set_int_callback(DEVCB_##_devcb);
#define MCFG_PPU2C0X_IGNORE_SPRITE_WRITE_LIMIT \
downcast<ppu2c0x_device &>(*device).use_sprite_write_limitation_disable();
@@ -106,7 +106,7 @@ public:
virtual DECLARE_WRITE8_MEMBER( palette_write );
void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
- template <typename Object> void set_nmi_delegate(Object &&cb) { m_nmi_callback_proc = std::forward<Object>(cb); }
+ template <typename Object> devcb_base &set_int_callback(Object &&cb) { return m_int_callback.set_callback(std::forward<Object>(cb)); }
/* routines */
virtual void init_palette();
@@ -231,7 +231,7 @@ private:
scanline_delegate m_scanline_callback_proc; /* optional scanline callback */
hblank_delegate m_hblank_callback_proc; /* optional hblank callback */
vidaccess_delegate m_vidaccess_callback_proc; /* optional video access callback */
- nmi_delegate m_nmi_callback_proc; /* nmi access callback from interface */
+ devcb_write_line m_int_callback; /* nmi access callback from interface */
int m_regs[PPU_MAX_REG]; /* registers */
int m_refresh_data; /* refresh-related */