diff --git a/src/mame/drivers/ctk551.cpp b/src/mame/drivers/ctk551.cpp index bb9051be3a9..9e7fa40d6db 100644 --- a/src/mame/drivers/ctk551.cpp +++ b/src/mame/drivers/ctk551.cpp @@ -64,6 +64,7 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_lcdc(*this, "lcdc") + , m_outputs(*this, "%02x.%d.%d", 0U, 0U, 0U) , m_led_touch(*this, "led_touch") , m_led_power(*this, "led_power") { @@ -85,16 +86,16 @@ private: virtual void driver_start() override; - HD44780_PIXEL_UPDATE(lcd_update); - void palette_init(palette_device &palette); - required_device m_maincpu; required_device m_lcdc; + output_finder<64, 8, 5> m_outputs; output_finder<> m_led_touch; output_finder<> m_led_power; ioport_value m_switch; + + DECLARE_WRITE_LINE_MEMBER(render_w); }; @@ -121,16 +122,21 @@ WRITE_LINE_MEMBER(ctk551_state::apo_w) m_led_power = !state; } -HD44780_PIXEL_UPDATE(ctk551_state::lcd_update) -{ - if (x < 6 && y < 8 && line < 2 && pos < 8) - bitmap.pix(line * 8 + y, pos * 6 + x) = state; -} -void ctk551_state::palette_init(palette_device &palette) +WRITE_LINE_MEMBER(ctk551_state::render_w) { - palette.set_pen_color(0, rgb_t(255, 255, 255)); - palette.set_pen_color(1, rgb_t(0, 0, 0)); + if(!state) + return; + + const u8 *render = m_lcdc->render(); + for(int x=0; x != 64; x++) { + for(int y=0; y != 8; y++) { + u8 v = *render++; + for(int z=0; z != 5; z++) + m_outputs[x][y][z] = (v >> z) & 1; + } + render += 8; + } } void ctk551_state::ctk551_io_map(address_map &map) @@ -146,6 +152,7 @@ void ctk551_state::driver_start() { m_led_touch.resolve(); m_led_power.resolve(); + m_outputs.resolve(); m_switch = 0x2; @@ -173,19 +180,12 @@ void ctk551_state::ctk551(machine_config &config) // LCD HD44780(config, m_lcdc, 0); m_lcdc->set_lcd_size(2, 8); - m_lcdc->set_pixel_update_cb(FUNC(ctk551_state::lcd_update)); - // screen (for testing only) - // TODO: the actual LCD with custom segments - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + auto &screen = SCREEN(config, "screen", SCREEN_TYPE_SVG); screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ - screen.set_screen_update("lcdc", FUNC(hd44780_device::screen_update)); - screen.set_size(6 * 8, 8 * 2); + screen.set_size(1000, 737); screen.set_visarea_full(); - screen.set_palette("palette"); - - PALETTE(config, "palette", FUNC(ctk551_state::palette_init), 2); + screen.screen_vblank().set(FUNC(ctk551_state::render_w)); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -363,9 +363,13 @@ INPUT_PORTS_END ROM_START(ctk551) ROM_REGION(0x100000, "maincpu", 0) ROM_LOAD16_WORD_SWAP("ctk551.lsi2", 0x000000, 0x100000, CRC(66fc34cd) SHA1(47e9559edc106132f8a83462ed17a6c5c3872157)) + + ROM_REGION(285230, "screen", 0) + ROM_LOAD("ctk551lcd.svg", 0, 285230, CRC(9ec1787c) SHA1(9a2f2eb36fa7574baa92cdec1a6f62d5dffd63a7)) + ROM_END } // anonymous namespace // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -SYST( 1999, ctk551, 0, 0, ctk551, ctk551, ctk551_state, empty_init, "Casio", "CTK-551", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +SYST( 1999, ctk551, 0, 0, ctk551, ctk551, ctk551_state, empty_init, "Casio", "CTK-551", MACHINE_SUPPORTS_SAVE )