diff --git a/makefile b/makefile index 4e0182de54b..dad69c9c143 100644 --- a/makefile +++ b/makefile @@ -1701,7 +1701,6 @@ generate: \ $(GENDIR)/version.cpp \ $(patsubst %.po,%.mo,$(call rwildcard, language/, *.po)) \ $(patsubst $(SRC)/%.lay,$(GENDIR)/%.lh,$(LAYOUTS)) \ - $(GENDIR)/mame/machine/mulcd.hxx \ $(GENDIR)/includes/SDL2 $(GENDIR)/includes/SDL2: @@ -1738,10 +1737,6 @@ $(GENDIR)/%.lh: $(SRC)/%.lay scripts/build/complay.py | $(GEN_FOLDERS) @echo Compressing $<... $(SILENT)$(PYTHON) scripts/build/complay.py $< $@ layout_$(basename $(notdir $<)) -$(GENDIR)/mame/machine/mulcd.hxx: $(SRC)/mame/machine/mulcd.ppm scripts/build/file2str.py | $(GEN_FOLDERS) - @echo Converting $<... - $(SILENT)$(PYTHON) scripts/build/file2str.py $< $@ mulcd_bkg uint8_t - %.mo: %.po @echo Converting translation $<... ifdef IGNORE_BAD_LOCALISATION diff --git a/src/mame/machine/mulcd.cpp b/src/mame/machine/mulcd.cpp index 597d381a7a7..072b3ee0d01 100644 --- a/src/mame/machine/mulcd.cpp +++ b/src/mame/machine/mulcd.cpp @@ -7,11 +7,12 @@ #include "emu.h" #include "mulcd.h" -#include "../machine/mulcd.hxx" - DEFINE_DEVICE_TYPE(MULCD, mulcd_device, "mulcd", "Yamaha MU/VL70/FS1R common LCD") ROM_START( mulcd ) + ROM_REGION( 524998, "screen", 0) + ROM_LOAD( "mulcd.svg", 0, 524998, CRC(fe07d6c6) SHA1(57a760f77f0f458c8657491f77db2057edc767aa)) + ROM_REGION( 0x1000, "hd44780", 0) // Hand made, 3 characters unused ROM_LOAD( "mu100-font.bin", 0x0000, 0x1000, BAD_DUMP CRC(a7d6c1d6) SHA1(9f0398d678bdf607cb34d83ee535f3b7fcc97c41) ) @@ -24,12 +25,15 @@ const tiny_rom_entry *mulcd_device::device_rom_region() const mulcd_device::mulcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, MULCD, tag, owner, clock), - m_lcd(*this, "hd44780") + m_lcd(*this, "hd44780"), + m_outputs(*this, "%03x.%d.%d", 0U, 0U, 0U), + m_led_outputs(*this, "LED%d", 0U) { } void mulcd_device::device_start() { + m_outputs.resolve(); } void mulcd_device::device_reset() @@ -38,51 +42,32 @@ void mulcd_device::device_reset() m_leds = 0; } -float mulcd_device::lightlevel(const u8 *src, const u8 *render) +void mulcd_device::set_contrast(float contrast) { - u8 l = *src; - if(l == 0) - return 1.0; - int slot = (src[1] << 8) | src[2]; - if(slot >= 0xff00) - return (255-l)/255.0; - - int bit = slot & 7; - int adr = (slot >> 3); - if(render[adr] & (1 << bit)) - return 1-(1-(255-l)/255.0f)*m_contrast; - return 0.95f; + m_contrast = contrast; } -u32 mulcd_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void mulcd_device::set_leds(u8 leds) { + m_leds = leds; + for(int x=0; x != 6; x++) + m_led_outputs[x] = (leds >> x) & 1; +} + +WRITE_LINE_MEMBER(mulcd_device::render_w) +{ + if(!state) + return; + const u8 *render = m_lcd->render(); - const u8 *src = mulcd_bkg + 15; - - for(int y=0; y<241; y++) { - u32 *pix = reinterpret_cast(bitmap.raw_pixptr(y)); - for(int x=0; x<800; x++) { - float light = lightlevel(src, render); - u32 col = (int(0xef*light) << 16) | (int(0xf5*light) << 8); - *pix++ = col; - src += 3; + 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; } - for(int x=800; x<900; x++) - *pix++ = 0; + render += 8; } - - for(int i=0; i<6; i++) - if(m_leds & (1 << i)) { - int x = 830 + 40*(i & 1); - int y = 55 + 65*(i >> 1); - for(int yy=-9; yy <= 9; yy++) { - int dx = int(sqrt((float)(99-yy*yy))); - u32 *pix = reinterpret_cast(bitmap.raw_pixptr(y+yy)) + (x-dx); - for(int xx=0; xx<2*dx+1; xx++) - *pix++ = 0x00ff00; - } - } - return 0; } void mulcd_device::device_add_mconfig(machine_config &config) @@ -90,10 +75,10 @@ void mulcd_device::device_add_mconfig(machine_config &config) HD44780(config, m_lcd); m_lcd->set_lcd_size(4, 20); - auto &screen = SCREEN(config, "screen", SCREEN_TYPE_LCD); + auto &screen = SCREEN(config, "screen", SCREEN_TYPE_SVG); screen.set_refresh_hz(50); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate, asynchronous updating anyway */ - screen.set_screen_update(FUNC(mulcd_device::screen_update)); - screen.set_size(900, 241); - screen.set_visarea(0, 899, 0, 240); + screen.set_size(900, 272); + screen.set_visarea_full(); + screen.screen_vblank().set(FUNC(mulcd_device::render_w)); } diff --git a/src/mame/machine/mulcd.h b/src/mame/machine/mulcd.h index 2bf013a5dd5..deea32b3a3d 100644 --- a/src/mame/machine/mulcd.h +++ b/src/mame/machine/mulcd.h @@ -17,14 +17,13 @@ class mulcd_device : public device_t public: mulcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - void set_contrast(float contrast) { m_contrast = contrast; } - void set_leds(u8 leds) { m_leds = leds; } + void set_contrast(float contrast); + void set_leds(u8 leds); u8 data_read() { return m_lcd->data_r(); } u8 control_read() { return m_lcd->control_r(); } void data_write(u8 data) { m_lcd->data_w(data); } void control_write(u8 data) { m_lcd->control_w(data); } - protected: virtual void device_start() override; virtual void device_reset() override; @@ -33,12 +32,13 @@ protected: private: required_device m_lcd; + output_finder<64, 8, 5> m_outputs; + output_finder<6> m_led_outputs; float m_contrast; u8 m_leds; - float lightlevel(const u8 *src, const u8 *render); - u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(render_w); }; DECLARE_DEVICE_TYPE(MULCD, mulcd_device) diff --git a/src/mame/machine/mulcd.ppm b/src/mame/machine/mulcd.ppm deleted file mode 100644 index 7a826314f7e..00000000000 Binary files a/src/mame/machine/mulcd.ppm and /dev/null differ