From 1b4d25fdba7b4aa7297841076ff4b56624385920 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 17 Apr 2019 09:14:56 -0400 Subject: mcd212: Disentangle from driver state class (nw) --- src/mame/drivers/cdi.cpp | 76 ++++++++++++++++++++++++++++++++++-- src/mame/includes/cdi.h | 2 +- src/mame/video/mcd212.cpp | 99 +++++++---------------------------------------- src/mame/video/mcd212.h | 24 ++++++++++-- 4 files changed, 109 insertions(+), 92 deletions(-) diff --git a/src/mame/drivers/cdi.cpp b/src/mame/drivers/cdi.cpp index 9ac8f14e86f..c6576ba87d8 100644 --- a/src/mame/drivers/cdi.cpp +++ b/src/mame/drivers/cdi.cpp @@ -749,6 +749,73 @@ WRITE8_MEMBER( cdi_state::slave_io_w ) m_slave_io_regs[offset] = data; } +/************************* +* LCD screen * +*************************/ + +static const uint16_t cdi220_lcd_char[20*22] = +{ + 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0002, 0x0002, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0002, 0x0002, 0x0002, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x8000, 0x8000, 0x8000, 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x0000, 0x8000, 0x8000, 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0200, 0x0200, 0x0200, 0x0200, + 0x2000, 0x2000, 0x2000, 0x2000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0200, 0x0200, 0x0200, 0x0200, + 0x1000, 0x1000, 0x1000, 0x1000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0001, 0x0001, 0x0001, 0x0001, 0x0008, 0x0008, 0x0000, 0x0000, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0010, 0x0010, 0x0010, 0x0001, 0x0001, 0x0001, 0x0001, 0x0008, 0x0008, 0x0008, 0x0000, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0001, 0x0001, 0x0001, 0x0001, 0x0008, 0x0008, 0x0008, 0x0008, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0010, 0x0010, 0x0010, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0008, 0x0008, 0x0008, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0008, 0x0008, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400, + 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400 +}; + +void cdi_state::draw_lcd(int y) +{ + if (y >= 22) + return; + + uint32_t *scanline = &m_lcdbitmap.pix32(y); + + for (int lcd = 0; lcd < 8; lcd++) + { + uint16_t data = (m_slave_hle->get_lcd_state()[lcd*2] << 8) | + m_slave_hle->get_lcd_state()[lcd*2 + 1]; + for (int x = 0; x < 20; x++) + { + if (data & cdi220_lcd_char[y*20 + x]) + { + scanline[(7 - lcd)*24 + x] = rgb_t::white(); + } + else + { + scanline[(7 - lcd)*24 + x] = rgb_t::black(); + } + } + } +} + +void cdi_state::video_start() +{ + if (m_lcd) + m_lcd->register_screen_bitmap(m_lcdbitmap); +} + +uint32_t cdi_state::screen_update_cdimono1_lcd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_lcdbitmap, 0, 0, 0, 0, cliprect); + return 0; +} + /************************* * Machine Drivers * *************************/ @@ -764,13 +831,14 @@ void cdi_state::cdimono1_base(machine_config &config) m_mcd212->set_screen("screen"); m_mcd212->int1_callback().set(m_scc, FUNC(cdi68070_device::int1_w)); m_mcd212->int2_callback().set(m_scc, FUNC(cdi68070_device::int2_w)); + m_mcd212->set_scanline_callback(FUNC(cdi_state::draw_lcd)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(384, 302); screen.set_visarea(0, 384-1, 22, 302-1); // TODO: dynamic resolution - screen.set_screen_update(FUNC(cdi_state::screen_update_cdimono1)); + screen.set_screen_update("mcd212", FUNC(mcd212_device::screen_update)); SCREEN(config, m_lcd, SCREEN_TYPE_RASTER); m_lcd->set_refresh_hz(60); @@ -820,13 +888,14 @@ void cdi_state::cdimono2(machine_config &config) m_mcd212->set_screen("screen"); m_mcd212->int1_callback().set(m_scc, FUNC(cdi68070_device::int1_w)); m_mcd212->int2_callback().set(m_scc, FUNC(cdi68070_device::int2_w)); + m_mcd212->set_scanline_callback(FUNC(cdi_state::draw_lcd)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(384, 302); screen.set_visarea(0, 384-1, 22, 302-1); // TODO: dynamic resolution - screen.set_screen_update(FUNC(cdi_state::screen_update_cdimono1)); + screen.set_screen_update("mcd212", FUNC(mcd212_device::screen_update)); SCREEN(config, m_lcd, SCREEN_TYPE_RASTER); m_lcd->set_refresh_hz(60); @@ -877,13 +946,14 @@ void cdi_state::cdi910(machine_config &config) m_mcd212->set_screen("screen"); m_mcd212->int1_callback().set(m_scc, FUNC(cdi68070_device::int1_w)); m_mcd212->int2_callback().set(m_scc, FUNC(cdi68070_device::int2_w)); + m_mcd212->set_scanline_callback(FUNC(cdi_state::draw_lcd)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(384, 302); screen.set_visarea(0, 384-1, 22, 302-1); // TODO: dynamic resolution - screen.set_screen_update(FUNC(cdi_state::screen_update_cdimono1)); + screen.set_screen_update("mcd212", FUNC(mcd212_device::screen_update)); SCREEN(config, m_lcd, SCREEN_TYPE_RASTER); m_lcd->set_refresh_hz(60); diff --git a/src/mame/includes/cdi.h b/src/mame/includes/cdi.h index bce90f13ccc..d88deb73360 100644 --- a/src/mame/includes/cdi.h +++ b/src/mame/includes/cdi.h @@ -118,7 +118,7 @@ public: DECLARE_READ8_MEMBER(quizard_mcu_p1_r); - uint32_t screen_update_cdimono1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_lcd(int y); uint32_t screen_update_cdimono1_lcd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void cdimono1(machine_config &config); void cdimono2(machine_config &config); diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp index e2e27ddde46..7458b4b5fdb 100644 --- a/src/mame/video/mcd212.cpp +++ b/src/mame/video/mcd212.cpp @@ -23,10 +23,11 @@ TODO: #include "emu.h" #include "video/mcd212.h" -#include "includes/cdi.h" #include "screen.h" +#define ENABLE_VERBOSE_LOG 0 + // device type definition DEFINE_DEVICE_TYPE(MCD212, mcd212_device, "mcd212", "MCD212 Video") @@ -48,62 +49,6 @@ static inline void ATTR_PRINTF(3,4) verboselog(device_t& device, int n_level, co #define verboselog(x,y,z, ...) #endif -static const uint16_t cdi220_lcd_char[20*22] = -{ - 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0002, 0x0002, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0002, 0x0002, 0x0002, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x8000, 0x8000, 0x8000, 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x0000, 0x8000, 0x8000, 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0200, 0x0200, 0x0200, 0x0200, - 0x2000, 0x2000, 0x2000, 0x2000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0200, 0x0200, 0x0200, 0x0200, - 0x1000, 0x1000, 0x1000, 0x1000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0001, 0x0001, 0x0001, 0x0001, 0x0008, 0x0008, 0x0000, 0x0000, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x0010, 0x0010, 0x0010, 0x0001, 0x0001, 0x0001, 0x0001, 0x0008, 0x0008, 0x0008, 0x0000, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0001, 0x0001, 0x0001, 0x0001, 0x0008, 0x0008, 0x0008, 0x0008, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0010, 0x0010, 0x0010, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0008, 0x0008, 0x0008, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0008, 0x0008, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400, - 0x1000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0400, 0x0400, 0x0400, 0x0400 -}; - -void mcd212_device::draw_lcd(int y) -{ - cdi_state *state = machine().driver_data(); - if (state->m_slave_hle == nullptr) - { - return; - } - bitmap_rgb32 &bitmap = state->m_lcdbitmap; - uint32_t *scanline = &bitmap.pix32(y); - int x = 0; - int lcd = 0; - - for(lcd = 0; lcd < 8; lcd++) - { - uint16_t data = (state->m_slave_hle->get_lcd_state()[lcd*2] << 8) | - state->m_slave_hle->get_lcd_state()[lcd*2 + 1]; - for(x = 0; x < 20; x++) - { - if(data & cdi220_lcd_char[y*20 + x]) - { - scanline[(7 - lcd)*24 + x] = 0x00ffffff; - } - else - { - scanline[(7 - lcd)*24 + x] = 0; - } - } - } -} - void mcd212_device::update_region_arrays() { int latched_rf0 = 0; @@ -555,8 +500,7 @@ uint32_t mcd212_device::get_screen_width() void mcd212_device::process_ica(int channel) { - cdi_state *state = machine().driver_data(); - uint16_t *ica = channel ? state->m_planeb : state->m_planea; + uint16_t *ica = channel ? m_planeb.target() : m_planea.target(); uint32_t addr = 0x000400/2; uint32_t cmd = 0; while(1) @@ -625,8 +569,7 @@ void mcd212_device::process_ica(int channel) void mcd212_device::process_dca(int channel) { - cdi_state *state = machine().driver_data(); - uint16_t *dca = channel ? state->m_planeb : state->m_planea; + uint16_t *dca = channel ? m_planeb.target() : m_planea.target(); uint32_t addr = (m_channel[channel].dca & 0x0007ffff) / 2; //(get_dcp(mcd212, channel) & 0x0007ffff) / 2; // m_channel[channel].dca / 2; uint32_t cmd = 0; uint32_t count = 0; @@ -758,8 +701,7 @@ static inline uint8_t BYTE_TO_CLUT(int channel, int icm, uint8_t byte) void mcd212_device::process_vsr(int channel, uint8_t *pixels_r, uint8_t *pixels_g, uint8_t *pixels_b) { - cdi_state *state = machine().driver_data(); - uint8_t *data = reinterpret_cast(channel ? state->m_planeb.target() : state->m_planea.target()); + uint8_t *data = reinterpret_cast(channel ? m_planeb.target() : m_planea.target()); uint32_t vsr = get_vsr(channel) & 0x0007ffff; uint8_t done = 0; uint32_t x = 0; @@ -1407,11 +1349,6 @@ TIMER_CALLBACK_MEMBER( mcd212_device::perform_scan ) process_ica(index); } } - draw_lcd(scanline); - } - else if(scanline < 22) - { - draw_lcd(scanline); } else if(scanline >= 22) { @@ -1435,6 +1372,9 @@ TIMER_CALLBACK_MEMBER( mcd212_device::perform_scan ) m_channel[0].csrr ^= 0x20; } } + + if (!m_scanline_callback.isnull()) + m_scanline_callback(scanline); } m_scan_timer->adjust(screen().time_until_pos(( scanline + 1 ) % 302, 0)); } @@ -1489,7 +1429,8 @@ mcd212_device::mcd212_device(const machine_config &mconfig, const char *tag, dev , device_video_interface(mconfig, *this) , m_int1_callback(*this) , m_int2_callback(*this) - , m_lcd(*this, ":lcd") + , m_planea(*this, "^planea") + , m_planeb(*this, "^planeb") { } @@ -1503,6 +1444,7 @@ void mcd212_device::device_resolve_objects() { m_int1_callback.resolve_safe(); m_int2_callback.resolve_safe(); + m_scanline_callback.bind_relative_to(*owner()); } //------------------------------------------------- @@ -1511,6 +1453,8 @@ void mcd212_device::device_resolve_objects() void mcd212_device::device_start() { + ab_init(); + screen().register_screen_bitmap(m_bitmap); m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mcd212_device::perform_scan), this)); @@ -1611,21 +1555,8 @@ void mcd212_device::ab_init() } } -void cdi_state::video_start() -{ - m_mcd212->ab_init(); - if (m_lcd) - m_lcd->register_screen_bitmap(m_lcdbitmap); -} - -uint32_t cdi_state::screen_update_cdimono1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_mcd212->get_bitmap(), 0, 0, 0, 0, cliprect); - return 0; -} - -uint32_t cdi_state::screen_update_cdimono1_lcd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t mcd212_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - copybitmap(bitmap, m_lcdbitmap, 0, 0, 0, 0, cliprect); + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); return 0; } diff --git a/src/mame/video/mcd212.h b/src/mame/video/mcd212.h index 4169bf901f3..a4881e80d08 100644 --- a/src/mame/video/mcd212.h +++ b/src/mame/video/mcd212.h @@ -119,21 +119,34 @@ class mcd212_device : public device_t, public device_video_interface { public: + typedef device_delegate scanline_callback_delegate; + // construction/destruction mcd212_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto int1_callback() { return m_int1_callback.bind(); } auto int2_callback() { return m_int2_callback.bind(); } + template void set_scanline_callback(Object &&cb) { m_scanline_callback = std::forward(cb); } + void set_scanline_callback(scanline_callback_delegate callback) { m_scanline_callback = callback; } + template void set_scanline_callback(const char *devname, void (FunctionClass::*callback)(int), const char *name) + { + set_scanline_callback(scanline_callback_delegate(callback, name, devname, static_cast(nullptr))); + } + template void set_scanline_callback(void (FunctionClass::*callback)(int), const char *name) + { + set_scanline_callback(scanline_callback_delegate(callback, name, nullptr, static_cast(nullptr))); + } + // device members DECLARE_READ16_MEMBER( regs_r ); DECLARE_WRITE16_MEMBER( regs_w ); TIMER_CALLBACK_MEMBER( perform_scan ); - void ab_init(); - bitmap_rgb32& get_bitmap() { return m_bitmap; } + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + struct channel_t { uint8_t csrr; @@ -208,7 +221,10 @@ private: devcb_write_line m_int1_callback; devcb_write_line m_int2_callback; - required_device m_lcd; + scanline_callback_delegate m_scanline_callback; + + required_shared_ptr m_planea; + required_shared_ptr m_planeb; // internal state channel_t m_channel[2]; @@ -245,7 +261,7 @@ private: void draw_cursor(uint32_t *scanline, int y); void draw_scanline(int y); - void draw_lcd(int y); + void ab_init(); }; // device type definition -- cgit v1.2.3