summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2020-01-05 13:15:22 +0100
committer hap <happppp@users.noreply.github.com>2020-01-05 13:15:36 +0100
commit45da347b366f698de51a732884653b036be3a681 (patch)
tree060393e7a2ddcc3ffe02879292da5e8c7d289922
parent7c32014214f83d0ecff58dd0c633bf820f56f45e (diff)
mmboard: put display module in its own file (nw)
-rw-r--r--scripts/target/mame/mess.lua2
-rw-r--r--src/mame/drivers/mephisto_berlin.cpp11
-rw-r--r--src/mame/drivers/mephisto_modular.cpp15
-rw-r--r--src/mame/drivers/mephisto_modular_tm.cpp7
-rw-r--r--src/mame/drivers/mephisto_polgar.cpp20
-rw-r--r--src/mame/machine/mmboard.cpp167
-rw-r--r--src/mame/machine/mmboard.h43
-rw-r--r--src/mame/video/mmdisplay2.cpp106
-rw-r--r--src/mame/video/mmdisplay2.h54
9 files changed, 226 insertions, 199 deletions
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index 1c89fe13140..88dff0a0418 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -2385,6 +2385,8 @@ files {
MAME_DIR .. "src/mame/drivers/mephisto_polgar.cpp",
MAME_DIR .. "src/mame/machine/mmboard.cpp",
MAME_DIR .. "src/mame/machine/mmboard.h",
+ MAME_DIR .. "src/mame/video/mmdisplay2.cpp",
+ MAME_DIR .. "src/mame/video/mmdisplay2.h",
}
createMESSProjects(_target, _subtarget, "hitachi")
diff --git a/src/mame/drivers/mephisto_berlin.cpp b/src/mame/drivers/mephisto_berlin.cpp
index 09ec03c7818..b88a835b3a5 100644
--- a/src/mame/drivers/mephisto_berlin.cpp
+++ b/src/mame/drivers/mephisto_berlin.cpp
@@ -20,6 +20,7 @@ Undocumented buttons:
#include "machine/bankdev.h"
#include "machine/nvram.h"
#include "machine/mmboard.h"
+#include "video/mmdisplay2.h"
// internal artwork
#include "mephisto_berlin.lh"
@@ -83,8 +84,8 @@ void berlin_state::berlin_mem(address_map &map)
map(0x900000, 0x903fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask16(0xff00);
map(0xa00000, 0xa00000).r(FUNC(berlin_state::input_r));
map(0xb00000, 0xb00000).w(m_board, FUNC(mephisto_board_device::mux_w));
- map(0xc00000, 0xc00000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0xd00008, 0xd00008).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0xc00000, 0xc00000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0xd00008, 0xd00008).w("display", FUNC(mephisto_display_module2_device::io_w));
map(0xe00000, 0xe00000).w(m_board, FUNC(mephisto_board_device::led_w));
}
@@ -95,8 +96,8 @@ void berlin_state::berlinp_mem(address_map &map)
map(0x800000, 0x800000).r(FUNC(berlin_state::input_r));
map(0x900000, 0x900000).w(m_board, FUNC(mephisto_board_device::mux_w));
map(0xa00000, 0xa00000).w(m_board, FUNC(mephisto_board_device::led_w));
- map(0xb00000, 0xb00000).w("display", FUNC(mephisto_display_modul_device::io_w));
- map(0xc00000, 0xc00000).w("display", FUNC(mephisto_display_modul_device::latch_w));
+ map(0xb00000, 0xb00000).w("display", FUNC(mephisto_display_module2_device::io_w));
+ map(0xc00000, 0xc00000).w("display", FUNC(mephisto_display_module2_device::latch_w));
map(0xd00000, 0xd07fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0xff000000);
}
@@ -135,7 +136,7 @@ void berlin_state::berlin(machine_config &config)
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&berlin_state::nvram_map).set_options(ENDIANNESS_BIG, 8, 13);
MEPHISTO_BUTTONS_BOARD(config, m_board);
- MEPHISTO_DISPLAY_MODUL(config, "display");
+ MEPHISTO_DISPLAY_MODULE2(config, "display");
config.set_default_layout(layout_mephisto_berlin);
}
diff --git a/src/mame/drivers/mephisto_modular.cpp b/src/mame/drivers/mephisto_modular.cpp
index 978302beb04..392a25db3fa 100644
--- a/src/mame/drivers/mephisto_modular.cpp
+++ b/src/mame/drivers/mephisto_modular.cpp
@@ -76,6 +76,7 @@ Reminder: unsupported on Almeria and Portorose 1.01, this is not a bug.
#include "machine/nvram.h"
#include "machine/timer.h"
#include "machine/mmboard.h"
+#include "video/mmdisplay2.h"
// internal artwork
#include "mephisto_alm16.lh" // clickable
@@ -239,8 +240,8 @@ void mmodular_state::alm16_mem(address_map &map)
map(0xf00000, 0xf00003).portr("KEY1");
map(0xf00004, 0xf00007).portr("KEY2");
map(0xf00008, 0xf0000b).portr("KEY3");
- map(0xd80000, 0xd80000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0xd80008, 0xd80008).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0xd80000, 0xd80000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0xd80008, 0xd80008).w("display", FUNC(mephisto_display_module2_device::io_w));
}
void mmodular_state::port16_mem(address_map &map)
@@ -270,8 +271,8 @@ void mmodular_state::alm32_mem(address_map &map)
map(0x800000fc, 0x800000fc).r("board", FUNC(mephisto_board_device::input_r));
map(0x88000000, 0x88000007).w("board", FUNC(mephisto_board_device::mux_w)).umask32(0xff000000);
map(0x90000000, 0x90000007).w("board", FUNC(mephisto_board_device::led_w)).umask32(0xff000000);
- map(0xa0000000, 0xa0000000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0xa0000010, 0xa0000010).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0xa0000000, 0xa0000000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0xa0000010, 0xa0000010).w("display", FUNC(mephisto_display_module2_device::io_w));
map(0xa8000000, 0xa8007fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0xff000000);
}
@@ -305,8 +306,8 @@ void mmodular_state::gen32_mem(address_map &map)
map(0xd8000004, 0xd8000004).r(FUNC(mmodular_state::bavaria1_r));
map(0xd8000008, 0xd8000008).w(FUNC(mmodular_state::bavaria_w));
map(0xd800000c, 0xd800000c).r(FUNC(mmodular_state::bavaria2_r));
- map(0xe0000000, 0xe0000000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0xe0000010, 0xe0000010).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0xe0000000, 0xe0000000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0xe0000010, 0xe0000010).w("display", FUNC(mephisto_display_module2_device::io_w));
map(0xe8000000, 0xe8007fff).m("nvram_map", FUNC(address_map_bank_device::amap8)).umask32(0xff000000);
map(0xf0000004, 0xf0000007).portr("KEY1");
map(0xf0000008, 0xf000000b).portr("KEY2");
@@ -403,7 +404,7 @@ void mmodular_state::alm16(machine_config &config)
TIMER(config, "bav_busy").configure_generic(nullptr);
/* video hardware */
- MEPHISTO_DISPLAY_MODUL(config, "display");
+ MEPHISTO_DISPLAY_MODULE2(config, "display");
config.set_default_layout(layout_mephisto_alm16);
}
diff --git a/src/mame/drivers/mephisto_modular_tm.cpp b/src/mame/drivers/mephisto_modular_tm.cpp
index 52b203bc64a..22b62221eda 100644
--- a/src/mame/drivers/mephisto_modular_tm.cpp
+++ b/src/mame/drivers/mephisto_modular_tm.cpp
@@ -39,6 +39,7 @@ After boot, it copies ROM to RAM, probably to circumvent waitstates on slow ROM.
#include "machine/nvram.h"
#include "machine/timer.h"
#include "machine/mmboard.h"
+#include "video/mmdisplay2.h"
// internal artwork
#include "mephisto_modular_tm.lh" // clickable
@@ -138,8 +139,8 @@ void mmtm_state::mmtm_2m_map(address_map &map)
map(0xfc020004, 0xfc020007).portr("KEY1");
map(0xfc020008, 0xfc02000b).portr("KEY2");
map(0xfc020010, 0xfc020013).portr("KEY3");
- map(0xfc040000, 0xfc040000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0xfc060000, 0xfc060000).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0xfc040000, 0xfc040000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0xfc060000, 0xfc060000).w("display", FUNC(mephisto_display_module2_device::io_w));
map(0xfc080000, 0xfc080000).w("board", FUNC(mephisto_board_device::mux_w));
map(0xfc0a0000, 0xfc0a0000).w("board", FUNC(mephisto_board_device::led_w));
map(0xfc0c0000, 0xfc0c0000).r("board", FUNC(mephisto_board_device::input_r));
@@ -204,7 +205,7 @@ void mmtm_state::mmtm_v(machine_config &config)
ADDRESS_MAP_BANK(config, "nvram_map").set_map(&mmtm_state::nvram_map).set_options(ENDIANNESS_BIG, 8, 13);
MEPHISTO_SENSORS_BOARD(config, "board");
- MEPHISTO_DISPLAY_MODUL(config, "display");
+ MEPHISTO_DISPLAY_MODULE2(config, "display");
config.set_default_layout(layout_mephisto_modular_tm);
}
diff --git a/src/mame/drivers/mephisto_polgar.cpp b/src/mame/drivers/mephisto_polgar.cpp
index 838314807c5..3691af2d614 100644
--- a/src/mame/drivers/mephisto_polgar.cpp
+++ b/src/mame/drivers/mephisto_polgar.cpp
@@ -14,13 +14,15 @@ TODO:
#include "emu.h"
+
#include "cpu/m6502/m65c02.h"
#include "cpu/m6502/m65sc02.h"
#include "machine/74259.h"
#include "machine/nvram.h"
#include "machine/mmboard.h"
#include "machine/chessmachine.h"
-#include "video/hd44780.h"
+#include "video/mmdisplay2.h"
+
#include "speaker.h"
// internal artwork
@@ -91,7 +93,7 @@ protected:
private:
required_device<mephisto_board_device> m_board;
- required_device<mephisto_display_modul_device> m_display;
+ required_device<mephisto_display_module2_device> m_display;
output_finder<16> m_leds;
uint8_t m_led_latch;
};
@@ -130,8 +132,8 @@ READ8_MEMBER(mephisto_polgar_state::polgar_keys_r)
void mephisto_polgar_state::polgar_mem(address_map &map)
{
map(0x0000, 0x1fff).ram().share("nvram");
- map(0x2000, 0x2000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0x2004, 0x2004).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0x2000, 0x2000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0x2004, 0x2004).w("display", FUNC(mephisto_display_module2_device::io_w));
map(0x2400, 0x2400).w("board", FUNC(mephisto_board_device::led_w));
map(0x2800, 0x2800).w("board", FUNC(mephisto_board_device::mux_w));
map(0x2c00, 0x2c07).r(FUNC(mephisto_polgar_state::polgar_keys_r));
@@ -157,8 +159,8 @@ void mephisto_risc_state::mrisc_mem(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x1fff).ram().share("nvram");
- map(0x2000, 0x2000).w("display", FUNC(mephisto_display_modul_device::latch_w));
- map(0x2004, 0x2004).w("display", FUNC(mephisto_display_modul_device::io_w));
+ map(0x2000, 0x2000).w("display", FUNC(mephisto_display_module2_device::latch_w));
+ map(0x2004, 0x2004).w("display", FUNC(mephisto_display_module2_device::io_w));
map(0x2c00, 0x2c07).r(FUNC(mephisto_risc_state::polgar_keys_r));
map(0x2400, 0x2400).w("board", FUNC(mephisto_board_device::led_w));
map(0x2800, 0x2800).w("board", FUNC(mephisto_board_device::mux_w));
@@ -203,7 +205,7 @@ void mephisto_milano_state::milano_mem(address_map &map)
{
map(0x0000, 0x1fbf).ram().share("nvram");
- map(0x1fc0, 0x1fc0).w(m_display, FUNC(mephisto_display_modul_device::latch_w));
+ map(0x1fc0, 0x1fc0).w(m_display, FUNC(mephisto_display_module2_device::latch_w));
map(0x1fd0, 0x1fd0).w(FUNC(mephisto_milano_state::milano_led_w));
map(0x1fe0, 0x1fe0).r(FUNC(mephisto_milano_state::milano_input_r));
map(0x1fe8, 0x1fef).w("outlatch", FUNC(hc259_device::write_d7));
@@ -314,7 +316,7 @@ void mephisto_polgar_state::polgar(machine_config &config)
outlatch.q_out_cb<5>().set_output("led105");
MEPHISTO_SENSORS_BOARD(config, "board");
- MEPHISTO_DISPLAY_MODUL(config, "display");
+ MEPHISTO_DISPLAY_MODULE2(config, "display");
config.set_default_layout(layout_mephisto_polgar);
}
@@ -345,7 +347,7 @@ void mephisto_risc_state::mrisc(machine_config &config)
outlatch.parallel_out_cb().set_membank("rombank").rshift(6).mask(0x03).exor(0x01);
MEPHISTO_SENSORS_BOARD(config, "board");
- MEPHISTO_DISPLAY_MODUL(config, "display");
+ MEPHISTO_DISPLAY_MODULE2(config, "display");
config.set_default_layout(layout_mephisto_polgar);
}
diff --git a/src/mame/machine/mmboard.cpp b/src/mame/machine/mmboard.cpp
index b85c7c56e38..489853a6c80 100644
--- a/src/mame/machine/mmboard.cpp
+++ b/src/mame/machine/mmboard.cpp
@@ -2,96 +2,72 @@
// copyright-holders:Sandro Ronco
/**********************************************************************
-Mephisto Sensors Board emulation
+Hegener + Glaser Mephisto Sensors Board, for modular chesscomputers
- Modular
- Muenchen
- Exclusive
-Mephisto Display Modul emulation
-
-This device can also apply to non-modular boards if I/O is same
+This device can also apply to non-modular boards if I/O is similar
+Bavaria board is not emulated here, additional handlers for it are in the driver.
*********************************************************************/
#include "emu.h"
#include "mmboard.h"
-#include "sound/volt_reg.h"
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
DEFINE_DEVICE_TYPE(MEPHISTO_SENSORS_BOARD, mephisto_sensors_board_device, "msboard", "Mephisto Sensors Board")
DEFINE_DEVICE_TYPE(MEPHISTO_BUTTONS_BOARD, mephisto_buttons_board_device, "mbboard", "Mephisto Buttons Board")
-DEFINE_DEVICE_TYPE(MEPHISTO_DISPLAY_MODUL, mephisto_display_modul_device, "mdisplay_modul", "Mephisto Display Modul")
-
-
-//***************************************************************************
-// IMPLEMENTATION
-//***************************************************************************
//-------------------------------------------------
-// device_add_mconfig - add device-specific
-// machine configuration
+// constructor
//-------------------------------------------------
-void mephisto_sensors_board_device::device_add_mconfig(machine_config &config)
+mephisto_board_device::mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_board(*this, "board")
+ , m_led_pwm(*this, "led_pwm")
+ , m_sensordelay(attotime::from_msec(150))
+ , m_led_out(*this, "led%u", 0U)
+ , m_disable_leds(false)
{
- set_config(config, sensorboard_device::MAGNETS);
}
-void mephisto_buttons_board_device::device_add_mconfig(machine_config &config)
+mephisto_sensors_board_device::mephisto_sensors_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : mephisto_board_device(mconfig, MEPHISTO_SENSORS_BOARD, tag, owner, clock)
{
- set_config(config, sensorboard_device::BUTTONS);
}
-void mephisto_board_device::set_config(machine_config &config, sensorboard_device::sb_type board_type)
+mephisto_buttons_board_device::mephisto_buttons_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : mephisto_board_device(mconfig, MEPHISTO_BUTTONS_BOARD, tag, owner, clock)
{
- SENSORBOARD(config, m_board).set_type(board_type);
- m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
-
- PWM_DISPLAY(config, m_led_pwm).set_size(8, 8);
- m_led_pwm->output_x().set(FUNC(mephisto_board_device::refresh_leds_w));
}
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
//-------------------------------------------------
-// mephisto_board_device - constructor
+// device_add_mconfig
//-------------------------------------------------
-mephisto_board_device::mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock)
- , m_board(*this, "board")
- , m_led_pwm(*this, "led_pwm")
- , m_sensordelay(attotime::from_msec(150))
- , m_led_out(*this, "led%u", 0U)
- , m_disable_leds(false)
+void mephisto_sensors_board_device::device_add_mconfig(machine_config &config)
{
+ set_config(config, sensorboard_device::MAGNETS);
}
-//-------------------------------------------------
-// mephisto_sensors_board_device - constructor
-//-------------------------------------------------
-
-mephisto_sensors_board_device::mephisto_sensors_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mephisto_board_device(mconfig, MEPHISTO_SENSORS_BOARD, tag, owner, clock)
+void mephisto_buttons_board_device::device_add_mconfig(machine_config &config)
{
+ set_config(config, sensorboard_device::BUTTONS);
}
-//-------------------------------------------------
-// mephisto_buttons_board_device - constructor
-//-------------------------------------------------
-
-mephisto_buttons_board_device::mephisto_buttons_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mephisto_board_device(mconfig, MEPHISTO_BUTTONS_BOARD, tag, owner, clock)
+void mephisto_board_device::set_config(machine_config &config, sensorboard_device::sb_type board_type)
{
+ SENSORBOARD(config, m_board).set_type(board_type);
+ m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
+
+ PWM_DISPLAY(config, m_led_pwm).set_size(8, 8);
+ m_led_pwm->output_x().set(FUNC(mephisto_board_device::refresh_leds_w));
}
+
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -106,17 +82,23 @@ void mephisto_board_device::device_start()
m_board->set_delay(m_sensordelay);
}
+
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void mephisto_board_device::device_reset()
{
- m_mux = 0x00;
+ m_mux = 0xff;
m_led_data = 0x00;
update_led_pwm();
}
+
+//-------------------------------------------------
+// I/O handlers
+//-------------------------------------------------
+
WRITE8_MEMBER( mephisto_board_device::refresh_leds_w )
{
if (!m_disable_leds)
@@ -150,84 +132,3 @@ WRITE8_MEMBER( mephisto_board_device::led_w )
m_led_data = data;
update_led_pwm();
}
-
-
-
-//-------------------------------------------------
-// mephisto_display_modul_device - constructor
-//-------------------------------------------------
-
-mephisto_display_modul_device::mephisto_display_modul_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MEPHISTO_DISPLAY_MODUL, tag, owner, clock)
- , m_lcdc(*this, "hd44780")
- , m_dac(*this, "dac")
-{
-}
-
-//-------------------------------------------------
-// device_add_mconfig
-//-------------------------------------------------
-
-void mephisto_display_modul_device::device_add_mconfig(machine_config &config)
-{
- /* video hardware */
- screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
- screen.set_refresh_hz(50);
- screen.set_size(16*6, 9*2);
- screen.set_visarea(0, 16*6-1, 0, 9*2-3);
- screen.set_screen_update("hd44780", FUNC(hd44780_device::screen_update));
- screen.set_palette("palette");
- PALETTE(config, "palette", FUNC(mephisto_display_modul_device::lcd_palette), 2);
-
- HD44780(config, m_lcdc, 0);
- m_lcdc->set_lcd_size(2, 16);
-
- /* sound hardware */
- SPEAKER(config, "speaker").front_center();
- DAC_2BIT_BINARY_WEIGHTED_ONES_COMPLEMENT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
-
-
-void mephisto_display_modul_device::lcd_palette(palette_device &palette) const
-{
- palette.set_pen_color(0, rgb_t(138, 146, 148));
- palette.set_pen_color(1, rgb_t(92, 83, 88));
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void mephisto_display_modul_device::device_start()
-{
- save_item(NAME(m_latch));
- save_item(NAME(m_ctrl));
-}
-
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void mephisto_display_modul_device::device_reset()
-{
- m_latch = 0;
- m_ctrl = 0;
-}
-
-WRITE8_MEMBER(mephisto_display_modul_device::latch_w)
-{
- m_latch = data;
-}
-
-WRITE8_MEMBER(mephisto_display_modul_device::io_w)
-{
- if (BIT(data, 1) && !BIT(m_ctrl, 1))
- m_lcdc->write(BIT(data, 0), m_latch);
-
- m_dac->write(data >> 2 & 3);
-
- m_ctrl = data;
-}
diff --git a/src/mame/machine/mmboard.h b/src/mame/machine/mmboard.h
index 425495dc9d5..eec9804e658 100644
--- a/src/mame/machine/mmboard.h
+++ b/src/mame/machine/mmboard.h
@@ -2,7 +2,7 @@
// copyright-holders:Sandro Ronco
/**********************************************************************
- Mephisto Modular
+ Mephisto Sensors Board
*********************************************************************/
@@ -11,20 +11,9 @@
#pragma once
-
#include "machine/sensorboard.h"
-#include "video/hd44780.h"
-#include "sound/dac.h"
#include "video/pwm.h"
-#include "emupal.h"
-#include "screen.h"
-#include "speaker.h"
-
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
// ======================> mephisto_board_device
@@ -91,39 +80,9 @@ protected:
};
-// ======================> mephisto_display_modul_device
-
-class mephisto_display_modul_device : public device_t
-{
-public:
- // construction/destruction
- mephisto_display_modul_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
-
- hd44780_device *get() { return m_lcdc; }
-
- DECLARE_WRITE8_MEMBER(latch_w);
- DECLARE_WRITE8_MEMBER(io_w);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
- virtual void device_add_mconfig(machine_config &config) override;
-
- void lcd_palette(palette_device &palette) const;
-
-private:
- optional_device<hd44780_device> m_lcdc;
- required_device<dac_byte_interface> m_dac;
- uint8_t m_latch;
- uint8_t m_ctrl;
-};
-
-
// device type definition
DECLARE_DEVICE_TYPE(MEPHISTO_SENSORS_BOARD, mephisto_sensors_board_device)
DECLARE_DEVICE_TYPE(MEPHISTO_BUTTONS_BOARD, mephisto_buttons_board_device)
-DECLARE_DEVICE_TYPE(MEPHISTO_DISPLAY_MODUL, mephisto_display_modul_device)
#endif // MAME_MACHINE_MMBOARD_H
diff --git a/src/mame/video/mmdisplay2.cpp b/src/mame/video/mmdisplay2.cpp
new file mode 100644
index 00000000000..93b212ddbe2
--- /dev/null
+++ b/src/mame/video/mmdisplay2.cpp
@@ -0,0 +1,106 @@
+// license:BSD-3-Clause
+// copyright-holders:Sandro Ronco
+/**********************************************************************
+
+Hegener + Glaser Mephisto Display Module for modular chesscomputers,
+the 2nd version with 2 LCD lines. The 16/32bit module also includes 8KB NVRAM,
+but that part is emulated in the driver.
+
+TODO:
+- add mmdisplay1.cpp, the one with shift registers and 4-digit lcd
+
+*********************************************************************/
+
+#include "emu.h"
+
+#include "mmdisplay2.h"
+#include "sound/volt_reg.h"
+
+
+DEFINE_DEVICE_TYPE(MEPHISTO_DISPLAY_MODULE2, mephisto_display_module2_device, "mdisplay2", "Mephisto Display Module 2")
+
+//-------------------------------------------------
+// constructor
+//-------------------------------------------------
+
+mephisto_display_module2_device::mephisto_display_module2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, MEPHISTO_DISPLAY_MODULE2, tag, owner, clock)
+ , m_lcdc(*this, "hd44780")
+ , m_dac(*this, "dac")
+{
+}
+
+
+//-------------------------------------------------
+// device_add_mconfig
+//-------------------------------------------------
+
+void mephisto_display_module2_device::device_add_mconfig(machine_config &config)
+{
+ /* video hardware */
+ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
+ screen.set_refresh_hz(50);
+ screen.set_size(16*6, 9*2);
+ screen.set_visarea(0, 16*6-1, 0, 9*2-3);
+ screen.set_screen_update("hd44780", FUNC(hd44780_device::screen_update));
+ screen.set_palette("palette");
+ PALETTE(config, "palette", FUNC(mephisto_display_module2_device::lcd_palette), 2);
+
+ HD44780(config, m_lcdc, 0);
+ m_lcdc->set_lcd_size(2, 16);
+
+ /* sound hardware */
+ SPEAKER(config, "speaker").front_center();
+ DAC_2BIT_BINARY_WEIGHTED_ONES_COMPLEMENT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
+ voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
+ vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
+ vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
+}
+
+void mephisto_display_module2_device::lcd_palette(palette_device &palette) const
+{
+ palette.set_pen_color(0, rgb_t(138, 146, 148));
+ palette.set_pen_color(1, rgb_t(92, 83, 88));
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void mephisto_display_module2_device::device_start()
+{
+ save_item(NAME(m_latch));
+ save_item(NAME(m_ctrl));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void mephisto_display_module2_device::device_reset()
+{
+ m_latch = 0;
+ m_ctrl = 0;
+}
+
+
+//-------------------------------------------------
+// I/O handlers
+//-------------------------------------------------
+
+WRITE8_MEMBER(mephisto_display_module2_device::latch_w)
+{
+ m_latch = data;
+}
+
+WRITE8_MEMBER(mephisto_display_module2_device::io_w)
+{
+ if (BIT(data, 1) && !BIT(m_ctrl, 1))
+ m_lcdc->write(BIT(data, 0), m_latch);
+
+ m_dac->write(data >> 2 & 3);
+
+ m_ctrl = data;
+}
diff --git a/src/mame/video/mmdisplay2.h b/src/mame/video/mmdisplay2.h
new file mode 100644
index 00000000000..26e2d2bfad4
--- /dev/null
+++ b/src/mame/video/mmdisplay2.h
@@ -0,0 +1,54 @@
+// license:BSD-3-Clause
+// copyright-holders:Sandro Ronco
+/**********************************************************************
+
+ Mephisto Display Module (2nd version)
+
+*********************************************************************/
+
+#ifndef MAME_VIDEO_MMDISPLAY2_H
+#define MAME_VIDEO_MMDISPLAY2_H
+
+#pragma once
+
+#include "video/hd44780.h"
+#include "sound/dac.h"
+
+#include "emupal.h"
+#include "screen.h"
+#include "speaker.h"
+
+
+// ======================> mephisto_display_module2_device
+
+class mephisto_display_module2_device : public device_t
+{
+public:
+ // construction/destruction
+ mephisto_display_module2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+
+ hd44780_device *get() { return m_lcdc; }
+
+ DECLARE_WRITE8_MEMBER(latch_w);
+ DECLARE_WRITE8_MEMBER(io_w);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+
+ void lcd_palette(palette_device &palette) const;
+
+private:
+ optional_device<hd44780_device> m_lcdc;
+ required_device<dac_byte_interface> m_dac;
+ uint8_t m_latch;
+ uint8_t m_ctrl;
+};
+
+
+// device type definition
+DECLARE_DEVICE_TYPE(MEPHISTO_DISPLAY_MODULE2, mephisto_display_module2_device)
+
+#endif // MAME_VIDEO_MMDISPLAY2_H