diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c index d31cb9f2635..f2f0d4fc492 100644 --- a/src/mess/drivers/rainbow.c +++ b/src/mess/drivers/rainbow.c @@ -221,7 +221,7 @@ public: } DECLARE_READ8_MEMBER(read_video_ram_r); - DECLARE_WRITE8_MEMBER(clear_video_interrupt); + DECLARE_WRITE_LINE_MEMBER(clear_video_interrupt); DECLARE_READ8_MEMBER(diagnostic_r); DECLARE_WRITE8_MEMBER(diagnostic_w); @@ -1010,7 +1010,7 @@ INTERRUPT_GEN_MEMBER(rainbow_state::vblank_irq) raise_8088_irq(IRQ_8088_VBL); } -WRITE8_MEMBER( rainbow_state::clear_video_interrupt ) +WRITE_LINE_MEMBER( rainbow_state::clear_video_interrupt ) { lower_8088_irq(IRQ_8088_VBL); } @@ -1146,8 +1146,6 @@ WRITE_LINE_MEMBER(rainbow_state::irq_hi_w) static const vt_video_interface video_interface = { "chargen", - DEVCB_DRIVER_MEMBER(rainbow_state, read_video_ram_r), - DEVCB_DRIVER_MEMBER(rainbow_state, clear_video_interrupt) }; /* F4 Character Displayer */ @@ -1214,6 +1212,8 @@ static MACHINE_CONFIG_START( rainbow, rainbow_state ) MCFG_GFXDECODE_ADD("gfxdecode", "vt100_video:palette", rainbow) MCFG_RAINBOW_VIDEO_ADD("vt100_video", "screen", video_interface) + MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r)) + MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt)) MCFG_FD1793_ADD("wd1793", rainbow_wd17xx_interface ) MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(floppy_intf) diff --git a/src/mess/drivers/vt100.c b/src/mess/drivers/vt100.c index 9e6dc29b97f..e1ff3dc057f 100644 --- a/src/mess/drivers/vt100.c +++ b/src/mess/drivers/vt100.c @@ -54,7 +54,7 @@ public: DECLARE_WRITE8_MEMBER(vt100_baud_rate_w); DECLARE_WRITE8_MEMBER(vt100_nvr_latch_w); DECLARE_READ8_MEMBER(vt100_read_video_ram_r); - DECLARE_WRITE8_MEMBER(vt100_clear_video_interrupt); + DECLARE_WRITE_LINE_MEMBER(vt100_clear_video_interrupt); required_shared_ptr m_p_ram; bool m_keyboard_int; bool m_receiver_int; @@ -369,7 +369,7 @@ READ8_MEMBER( vt100_state::vt100_read_video_ram_r ) return m_p_ram[offset]; } -WRITE8_MEMBER( vt100_state::vt100_clear_video_interrupt ) +WRITE_LINE_MEMBER( vt100_state::vt100_clear_video_interrupt ) { m_vertical_int = 0; } @@ -377,8 +377,6 @@ WRITE8_MEMBER( vt100_state::vt100_clear_video_interrupt ) static const vt_video_interface vt100_video_interface = { "chargen", - DEVCB_DRIVER_MEMBER(vt100_state, vt100_read_video_ram_r), - DEVCB_DRIVER_MEMBER(vt100_state, vt100_clear_video_interrupt) }; INTERRUPT_GEN_MEMBER(vt100_state::vt100_vertical_interrupt) @@ -428,6 +426,8 @@ static MACHINE_CONFIG_START( vt100, vt100_state ) MCFG_DEFAULT_LAYOUT( layout_vt100 ) MCFG_VT100_VIDEO_ADD("vt100_video", "screen", vt100_video_interface) + MCFG_VT_VIDEO_RAM_CALLBACK(READ8(vt100_state, vt100_read_video_ram_r)) + MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(vt100_state, vt100_clear_video_interrupt)) MCFG_DEVICE_ADD("i8251", I8251, 0) MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) diff --git a/src/mess/video/vtvideo.c b/src/mess/video/vtvideo.c index 3ed5dd26794..fd880f163d1 100644 --- a/src/mess/video/vtvideo.c +++ b/src/mess/video/vtvideo.c @@ -47,6 +47,8 @@ const device_type RAINBOW_VIDEO = &device_creator; vt100_video_device::vt100_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_video_interface(mconfig, *this), + m_read_ram(*this), + m_write_clear_video_interrupt(*this), m_palette(*this, "palette") { } @@ -55,6 +57,8 @@ vt100_video_device::vt100_video_device(const machine_config &mconfig, device_typ vt100_video_device::vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, VT100_VIDEO, "VT100 Video", tag, owner, clock, "vt100_video", __FILE__), device_video_interface(mconfig, *this), + m_read_ram(*this), + m_write_clear_video_interrupt(*this), m_palette(*this, "palette") { } @@ -82,8 +86,6 @@ void vt100_video_device::device_config_complete() // or initialize to defaults if none provided else { - memset(&m_in_ram_cb, 0, sizeof(m_in_ram_cb)); - memset(&m_clear_video_cb, 0, sizeof(m_clear_video_cb)); m_char_rom_tag = ""; } } @@ -95,8 +97,8 @@ void vt100_video_device::device_config_complete() void vt100_video_device::device_start() { /* resolve callbacks */ - m_in_ram_func.resolve(m_in_ram_cb, *this); - m_clear_video_interrupt.resolve(m_clear_video_cb, *this); + m_read_ram.resolve_safe(0); + m_write_clear_video_interrupt.resolve_safe(); m_gfx = machine().root_device().memregion(m_char_rom_tag)->base(); assert(m_gfx != NULL); @@ -264,7 +266,7 @@ WRITE8_MEMBER( vt100_video_device::dc012_w ) break; case 0x09: // clear vertical frequency interrupt; - m_clear_video_interrupt(0, 0); + m_write_clear_video_interrupt(0); break; case 0x0a: @@ -438,12 +440,12 @@ void vt100_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cli UINT8 display_type = 3; // binary 11 UINT16 temp = 0; - if (m_in_ram_func(0) != 0x7f) + if (m_read_ram(0) != 0x7f) return; while (line < (m_height + m_skip_lines)) { - code = m_in_ram_func(addr + xpos); + code = m_read_ram(addr + xpos); if (code == 0x7f) { // end of line, fill empty till end of line @@ -455,7 +457,7 @@ void vt100_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cli } } // move to new data - temp = m_in_ram_func(addr + xpos + 1) * 256 + m_in_ram_func(addr + xpos + 2); + temp = m_read_ram(addr + xpos + 1) * 256 + m_read_ram(addr + xpos + 2); addr = (temp) & 0x1fff; // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO) if (addr & 0x1000) addr &= 0xfff; else addr |= 0x2000; @@ -708,7 +710,7 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c while (line < (m_height + m_skip_lines)) { - code = m_in_ram_func(addr + xpos); + code = m_read_ram(addr + xpos); if ( code == 0x00 ) // TODO: investigate side effect on regular zero character! display_type |= 0x80; // DEFAULT: filler chars (till end of line) and empty lines (00) will be blanked @@ -732,10 +734,10 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c attr_addr = 0x1000 | ( (addr + xpos + 1) & 0x0fff ); // MOVE TO NEW DATA - temp = m_in_ram_func(addr + xpos + 2) * 256 + m_in_ram_func(addr + xpos + 1); + temp = m_read_ram(addr + xpos + 2) * 256 + m_read_ram(addr + xpos + 1); addr = (temp) & 0x0fff; - temp = m_in_ram_func(attr_addr); + temp = m_read_ram(attr_addr); scroll_region = (temp) & 1; display_type = (temp >> 1) & 3; @@ -752,7 +754,7 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c if (line >= m_skip_lines) { attr_addr = 0x1000 | ( (addr + xpos) & 0x0fff ); - temp = m_in_ram_func(attr_addr); // get character attribute + temp = m_read_ram(attr_addr); // get character attribute // CONFIRMED: Reverse active on 1. No attributes = 0x0E // 1 = display char. in REVERSE (encoded as 8) diff --git a/src/mess/video/vtvideo.h b/src/mess/video/vtvideo.h index c69c396d5bb..5e3fc375f3e 100644 --- a/src/mess/video/vtvideo.h +++ b/src/mess/video/vtvideo.h @@ -15,13 +15,15 @@ #include "emu.h" +#define MCFG_VT_VIDEO_RAM_CALLBACK(_read) \ + devcb = &vt100_video_device::set_ram_rd_callback(*device, DEVCB2_##_read); + +#define MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(_write) \ + devcb = &vt100_video_device::set_clear_video_irq_wr_callback(*device, DEVCB2_##_write); + struct vt_video_interface { const char *m_char_rom_tag; /* character rom region */ - - /* this gets called for every memory read */ - devcb_read8 m_in_ram_cb; - devcb_write8 m_clear_video_cb; }; @@ -34,6 +36,9 @@ public: vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~vt100_video_device() {} + template static devcb2_base &set_ram_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_ram.set_callback(object); } + template static devcb2_base &set_clear_video_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clear_video_interrupt.set_callback(object); } + DECLARE_READ8_MEMBER(lba7_r); DECLARE_WRITE8_MEMBER(dc012_w); DECLARE_WRITE8_MEMBER(dc011_w); @@ -52,8 +57,8 @@ protected: virtual void display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type); TIMER_CALLBACK_MEMBER(lba7_change); - devcb_resolved_read8 m_in_ram_func; - devcb_resolved_write8 m_clear_video_interrupt; + devcb2_read8 m_read_ram; + devcb2_write8 m_write_clear_video_interrupt; UINT8 *m_gfx; /* content of char rom */