mirror of
https://github.com/holub/mame
synced 2025-06-05 12:26:35 +03:00
mulcd: re-add background, contrast control, and leds
This commit is contained in:
parent
6b3b77a50f
commit
b3259b130e
@ -558,7 +558,7 @@ void mu100_state::p2_w(u16 data)
|
||||
m_lcd->control_write(cur_p1);
|
||||
}
|
||||
}
|
||||
m_lcd->set_contrast((8 - ((cur_p2 >> 3) & 7))/8.0);
|
||||
m_lcd->set_contrast((data >> 3) & 7);
|
||||
cur_p2 = data;
|
||||
}
|
||||
|
||||
|
42
src/mame/layout/mulcd.lay
Normal file
42
src/mame/layout/mulcd.lay
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
license:CC0
|
||||
-->
|
||||
<mamelayout version="2">
|
||||
|
||||
<!-- define elements -->
|
||||
|
||||
<element name="led" defstate="0">
|
||||
<disk state="0"><color red="0.07" green="0.1" blue="0.02" /></disk>
|
||||
<disk state="1"><color red="0.7" green="1.0" blue="0.2" /></disk>
|
||||
</element>
|
||||
|
||||
<element name="lcda" defstate="0">
|
||||
<rect>
|
||||
<color state="0" red="0" green="0" blue="0" />
|
||||
<color state="7" red="0.95" green="0.95" blue="0.95" />
|
||||
</rect>
|
||||
</element>
|
||||
|
||||
<element name="lcdm"><rect><color red="0.7" green="1.0" blue="0.2" /></rect></element>
|
||||
|
||||
|
||||
<!-- build screen -->
|
||||
|
||||
<view name="Internal Layout">
|
||||
<bounds x="0" y="0" width="121" height="30.21" />
|
||||
|
||||
<screen index="0"><bounds x="0" y="0" width="100" height="30.21" /></screen>
|
||||
<element name="contrast" ref="lcda" blend="add"><bounds x="0" y="0" width="100" height="30.21" /></element>
|
||||
<element ref="lcdm" blend="multiply"><bounds x="0" y="0" width="100" height="30.21" /></element>
|
||||
|
||||
<element name="LED0" ref="led"><bounds x="104" y="2" width="4" height="4" /></element>
|
||||
<element name="LED1" ref="led"><bounds x="113" y="2" width="4" height="4" /></element>
|
||||
<element name="LED2" ref="led"><bounds x="104" y="13" width="4" height="4" /></element>
|
||||
<element name="LED3" ref="led"><bounds x="113" y="13" width="4" height="4" /></element>
|
||||
<element name="LED4" ref="led"><bounds x="104" y="24" width="4" height="4" /></element>
|
||||
<element name="LED5" ref="led"><bounds x="113" y="24" width="4" height="4" /></element>
|
||||
|
||||
</view>
|
||||
|
||||
</mamelayout>
|
@ -7,6 +7,8 @@
|
||||
#include "emu.h"
|
||||
#include "mulcd.h"
|
||||
|
||||
#include "mulcd.lh"
|
||||
|
||||
DEFINE_DEVICE_TYPE(MULCD, mulcd_device, "mulcd", "Yamaha MU/VL70/FS1R common LCD")
|
||||
|
||||
ROM_START( mulcd )
|
||||
@ -27,6 +29,7 @@ mulcd_device::mulcd_device(const machine_config &mconfig, const char *tag, devic
|
||||
device_t(mconfig, MULCD, tag, owner, clock),
|
||||
m_lcd(*this, "hd44780"),
|
||||
m_outputs(*this, "%03x.%d.%d", 0U, 0U, 0U),
|
||||
m_contrast(*this, "contrast"),
|
||||
m_led_outputs(*this, "LED%d", 0U)
|
||||
{
|
||||
}
|
||||
@ -34,23 +37,24 @@ mulcd_device::mulcd_device(const machine_config &mconfig, const char *tag, devic
|
||||
void mulcd_device::device_start()
|
||||
{
|
||||
m_outputs.resolve();
|
||||
m_contrast.resolve();
|
||||
m_led_outputs.resolve();
|
||||
}
|
||||
|
||||
void mulcd_device::device_reset()
|
||||
{
|
||||
m_contrast = 1.0;
|
||||
m_leds = 0;
|
||||
set_contrast(0);
|
||||
set_leds(0);
|
||||
}
|
||||
|
||||
void mulcd_device::set_contrast(float contrast)
|
||||
void mulcd_device::set_contrast(u8 contrast)
|
||||
{
|
||||
// 0 to 7
|
||||
m_contrast = contrast;
|
||||
}
|
||||
|
||||
void mulcd_device::set_leds(u8 leds)
|
||||
{
|
||||
m_leds = leds;
|
||||
for(int x=0; x != 6; x++)
|
||||
m_led_outputs[x] = (leds >> x) & 1;
|
||||
}
|
||||
@ -77,9 +81,10 @@ void mulcd_device::device_add_mconfig(machine_config &config)
|
||||
m_lcd->set_lcd_size(4, 20);
|
||||
|
||||
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_size(900, 272);
|
||||
screen.set_refresh_hz(60);
|
||||
screen.set_size(1920/1.5, 580/1.5);
|
||||
screen.set_visarea_full();
|
||||
screen.screen_vblank().set(FUNC(mulcd_device::render_w));
|
||||
|
||||
config.set_default_layout(layout_mulcd);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ 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);
|
||||
void set_contrast(u8 contrast);
|
||||
void set_leds(u8 leds);
|
||||
u8 data_read() { return m_lcd->data_r(); }
|
||||
u8 control_read() { return m_lcd->control_r(); }
|
||||
@ -33,11 +33,9 @@ protected:
|
||||
private:
|
||||
required_device<hd44780_device> m_lcd;
|
||||
output_finder<64, 8, 5> m_outputs;
|
||||
output_finder<> m_contrast;
|
||||
output_finder<6> m_led_outputs;
|
||||
|
||||
float m_contrast;
|
||||
u8 m_leds;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(render_w);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user