diff options
| author | 2026-05-20 02:31:52 +0200 | |
|---|---|---|
| committer | 2026-05-20 02:38:09 +0200 | |
| commit | 54a21a47ba886b8f9c6aa7d10977cacee112a2ae (patch) | |
| tree | 895c9239b5930894c28dc30000440619f818f21e /src | |
| parent | f125c7a141c26513ca3210276b45e781920b4f16 (diff) | |
dominator/senterprise: move lcd hw to its own device
Diffstat (limited to 'src')
| -rw-r--r-- | src/mame/newcrest/chess3008_lcd.cpp | 104 | ||||
| -rw-r--r-- | src/mame/newcrest/chess3008_lcd.h | 42 | ||||
| -rw-r--r-- | src/mame/newcrest/dominator.cpp | 64 | ||||
| -rw-r--r-- | src/mame/newcrest/senterprise.cpp | 105 |
4 files changed, 170 insertions, 145 deletions
diff --git a/src/mame/newcrest/chess3008_lcd.cpp b/src/mame/newcrest/chess3008_lcd.cpp new file mode 100644 index 00000000000..f3bdd9a3b3a --- /dev/null +++ b/src/mame/newcrest/chess3008_lcd.cpp @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/******************************************************************************* + +Newcrest CXG Chess 3008 LCD, with Sanyo LC7580 or LC7582. + +Embedded LCD hardware used in: +- CXG Chess 3008 +- CXG Super Enterprise C +- CXG Sphinx Titan +- CXG Sphinx Galaxy +- CXG Sphinx Dominator +- CXG Sphinx Commander + +It drives 2 small digital watch LCDs, with several unused segments (eg. S, PM). +The only reason it's in a device, is so the digit unscrambling won't need to be +copy-pasted into several drivers. + +TODO: +- add output callbacks if necessary + +*******************************************************************************/ + +#include "emu.h" +#include "chess3008_lcd.h" + + +DEFINE_DEVICE_TYPE(CHESS3008_LCD, chess3008_lcd_device, "chess3008_lcd", "Newcrest CXG Chess 3008 LCD") + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +chess3008_lcd_device::chess3008_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, CHESS3008_LCD, tag, owner, clock), + m_lcd(*this, "lcd"), + m_out_digit(*this, "digit%u", 0U), + m_out_lcd(*this, "s%u.%u", 0U, 0U) +{ +} + + +//------------------------------------------------- +// device_add_mconfig +//------------------------------------------------- + +void chess3008_lcd_device::device_add_mconfig(machine_config &config) +{ + LC7580(config, m_lcd, 0); + m_lcd->write_segs().set(FUNC(chess3008_lcd_device::lcd_output_w)); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void chess3008_lcd_device::device_start() +{ + m_out_digit.resolve(); + m_out_lcd.resolve(); +} + + +//------------------------------------------------- +// I/O handlers +//------------------------------------------------- + +void chess3008_lcd_device::lcd_output_w(offs_t offset, u64 data) +{ + // output individual segments + for (int i = 0; i < 52; i++) + m_out_lcd[offset][i] = BIT(data, i); + + // unscramble digit 7segs + static const u8 seg2digit[4*7] = + { + 0x03, 0x04, 0x00, 0x40, 0x41, 0x02, 0x42, + 0x05, 0x06, 0x07, 0x48, 0x44, 0x45, 0x46, + 0x0c, 0x0d, 0x0b, 0x0a, 0x4a, 0x4c, 0x4b, + 0x0e, 0x0f, 0x10, 0x50, 0x4d, 0x4e, 0x4f + }; + + for (int i = 0; i < 8; i++) + { + u8 digit = 0; + for (int seg = 0; seg < 7; seg++) + { + u8 bit = seg2digit[7 * (i & 3) + seg] + 26 * (i >> 2); + digit |= m_out_lcd[BIT(bit, 6)][bit & 0x3f] << seg; + } + m_out_digit[i] = digit; + } +} + +void chess3008_lcd_device::lcd_w(u8 data) +{ + // d0: LC7580 DATA + // d1: LC7580 CLK + // d2: LC7580 CE + m_lcd->data_w(BIT(data, 0)); + m_lcd->clk_w(BIT(data, 1)); + m_lcd->ce_w(BIT(data, 2)); +} diff --git a/src/mame/newcrest/chess3008_lcd.h b/src/mame/newcrest/chess3008_lcd.h new file mode 100644 index 00000000000..74b04b2bf91 --- /dev/null +++ b/src/mame/newcrest/chess3008_lcd.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/******************************************************************************* + + Newcrest CXG Chess 3008 LCD + +*******************************************************************************/ + +#ifndef MAME_NEWCREST_CHESS3008_LCD_H +#define MAME_NEWCREST_CHESS3008_LCD_H + +#pragma once + +#include "video/lc7580.h" + + +class chess3008_lcd_device : public device_t +{ +public: + // construction/destruction + chess3008_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + + void inh_w(int state) { m_lcd->inh_w(state); } + void lcd_w(u8 data); + +protected: + // device_t implementation + virtual void device_start() override ATTR_COLD; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + +private: + required_device<lc7580_device> m_lcd; + output_finder<8> m_out_digit; + output_finder<2, 52> m_out_lcd; + + void lcd_output_w(offs_t offset, u64 data); +}; + + +DECLARE_DEVICE_TYPE(CHESS3008_LCD, chess3008_lcd_device) + +#endif // MAME_NEWCREST_CHESS3008_LCD_H diff --git a/src/mame/newcrest/dominator.cpp b/src/mame/newcrest/dominator.cpp index df60996d219..8c24b288dd5 100644 --- a/src/mame/newcrest/dominator.cpp +++ b/src/mame/newcrest/dominator.cpp @@ -23,11 +23,12 @@ Sphinx Galaxy is on similar hardware too, with less leds. #include "emu.h" +#include "chess3008_lcd.h" + #include "cpu/m6502/r65c02.h" #include "machine/nvram.h" #include "machine/sensorboard.h" #include "sound/dac.h" -#include "video/lc7580.h" #include "video/pwm.h" #include "speaker.h" @@ -50,9 +51,7 @@ public: m_lcd(*this, "lcd"), m_display(*this, "display"), m_dac(*this, "dac"), - m_inputs(*this, "IN.%u", 0), - m_out_digit(*this, "digit%u", 0U), - m_out_lcd(*this, "s%u.%u", 0U, 0U) + m_inputs(*this, "IN.%u", 0) { } // machine configs @@ -60,83 +59,35 @@ public: void galaxy(machine_config &config); void commander(machine_config &config); -protected: - virtual void machine_start() override ATTR_COLD; - private: // devices/pointers required_device<cpu_device> m_maincpu; required_device<sensorboard_device> m_board; - required_device<lc7582_device> m_lcd; + required_device<chess3008_lcd_device> m_lcd; required_device<pwm_display_device> m_display; required_device<dac_1bit_device> m_dac; required_ioport_array<2> m_inputs; - output_finder<8> m_out_digit; - output_finder<2, 52> m_out_lcd; // address maps void dominator_map(address_map &map) ATTR_COLD; void galaxy_map(address_map &map) ATTR_COLD; // I/O handlers - void lcd_output_w(offs_t offset, u64 data); void control_w(u8 data); void leds_w(offs_t offset, u8 data); u8 input_r(offs_t offset); }; -void dominator_state::machine_start() -{ - m_out_digit.resolve(); - m_out_lcd.resolve(); -} - /******************************************************************************* I/O *******************************************************************************/ -// LC7582 LCD - -void dominator_state::lcd_output_w(offs_t offset, u64 data) -{ - // output individual segments - for (int i = 0; i < 52; i++) - m_out_lcd[offset][i] = BIT(data, i); - - // unscramble digit 7segs - static const u8 seg2digit[4*7] = - { - 0x03, 0x04, 0x00, 0x40, 0x41, 0x02, 0x42, - 0x05, 0x06, 0x07, 0x48, 0x44, 0x45, 0x46, - 0x0c, 0x0d, 0x0b, 0x0a, 0x4a, 0x4c, 0x4b, - 0x0e, 0x0f, 0x10, 0x50, 0x4d, 0x4e, 0x4f - }; - - for (int i = 0; i < 8; i++) - { - u8 digit = 0; - for (int seg = 0; seg < 7; seg++) - { - u8 bit = seg2digit[7 * (i & 3) + seg] + 26 * (i >> 2); - digit |= m_out_lcd[BIT(bit, 6)][bit & 0x3f] << seg; - } - m_out_digit[i] = digit; - } -} - - -// TTL - void dominator_state::control_w(u8 data) { - // d0: LC7582 DATA - // d1: LC7582 CLK - // d2: LC7582 CE - m_lcd->data_w(BIT(data, 0)); - m_lcd->clk_w(BIT(data, 1)); - m_lcd->ce_w(BIT(data, 2)); + // d0-d2: LC7582 pins + m_lcd->lcd_w(data & 7); // d3: speaker out m_dac->write(BIT(data, 3)); @@ -266,8 +217,7 @@ void dominator_state::dominator(machine_config &config) m_board->set_delay(attotime::from_msec(150)); // video hardware - LC7582(config, m_lcd, 0); - m_lcd->write_segs().set(FUNC(dominator_state::lcd_output_w)); + CHESS3008_LCD(config, m_lcd); PWM_DISPLAY(config, m_display).set_size(8+1, 8); config.set_default_layout(layout_cxg_dominator); diff --git a/src/mame/newcrest/senterprise.cpp b/src/mame/newcrest/senterprise.cpp index f3b5cfb2882..6635bff1155 100644 --- a/src/mame/newcrest/senterprise.cpp +++ b/src/mame/newcrest/senterprise.cpp @@ -41,11 +41,12 @@ Super Enterprise (model 210.C): #include "emu.h" +#include "chess3008_lcd.h" + #include "cpu/m6800/m6801.h" #include "machine/nvram.h" #include "machine/sensorboard.h" #include "sound/dac.h" -#include "video/lc7580.h" #include "video/pwm.h" #include "speaker.h" @@ -57,8 +58,6 @@ Super Enterprise (model 210.C): namespace { -// model 210 / shared - class senterp_state : public driver_device { public: @@ -66,6 +65,7 @@ public: driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_board(*this, "board"), + m_lcd(*this, "lcd"), m_display(*this, "display"), m_dac(*this, "dac"), m_inputs(*this, "IN.%u", 0) @@ -74,6 +74,7 @@ public: DECLARE_INPUT_CHANGED_MEMBER(power_off); void senterp(machine_config &config); + void senterpc(machine_config &config); protected: virtual void machine_start() override ATTR_COLD; @@ -82,6 +83,7 @@ protected: // devices/pointers required_device<hd6301y0_cpu_device> m_maincpu; required_device<sensorboard_device> m_board; + optional_device<chess3008_lcd_device> m_lcd; required_device<pwm_display_device> m_display; required_device<dac_1bit_device> m_dac; required_ioport_array<3> m_inputs; @@ -96,6 +98,7 @@ protected: u8 input2_r(); void leds_w(u8 data); void mux_w(u8 data); + void lcd_w(u8 data); TIMER_CALLBACK_MEMBER(set_standby); }; @@ -109,42 +112,6 @@ void senterp_state::machine_start() } -// model 210.C - -class senterpc_state : public senterp_state -{ -public: - senterpc_state(const machine_config &mconfig, device_type type, const char *tag) : - senterp_state(mconfig, type, tag), - m_lcd(*this, "lcd"), - m_out_digit(*this, "digit%u", 0U), - m_out_lcd(*this, "s%u.%u", 0U, 0U) - { } - - void senterpc(machine_config &config); - -protected: - virtual void machine_start() override ATTR_COLD; - -private: - required_device<lc7580_device> m_lcd; - output_finder<8> m_out_digit; - output_finder<2, 52> m_out_lcd; - - void lcd_output_w(offs_t offset, u64 data); - void lcd_w(u8 data); -}; - -void senterpc_state::machine_start() -{ - senterp_state::machine_start(); - - // resolve outputs - m_out_digit.resolve(); - m_out_lcd.resolve(); -} - - /******************************************************************************* Power @@ -177,8 +144,6 @@ INPUT_CHANGED_MEMBER(senterp_state::power_off) I/O *******************************************************************************/ -// common - u8 senterp_state::input1_r() { u8 data = 0; @@ -218,44 +183,10 @@ void senterp_state::mux_w(u8 data) m_display->write_mx(m_inp_mux); } - -// LCD (senterpc) - -void senterpc_state::lcd_output_w(offs_t offset, u64 data) +void senterp_state::lcd_w(u8 data) { - // output individual segments - for (int i = 0; i < 52; i++) - m_out_lcd[offset][i] = BIT(data, i); - - // unscramble digit 7segs - static const u8 seg2digit[4*7] = - { - 0x03, 0x04, 0x00, 0x40, 0x41, 0x02, 0x42, - 0x05, 0x06, 0x07, 0x48, 0x44, 0x45, 0x46, - 0x0c, 0x0d, 0x0b, 0x0a, 0x4a, 0x4c, 0x4b, - 0x0e, 0x0f, 0x10, 0x50, 0x4d, 0x4e, 0x4f - }; - - for (int i = 0; i < 8; i++) - { - u8 digit = 0; - for (int seg = 0; seg < 7; seg++) - { - u8 bit = seg2digit[7 * (i & 3) + seg] + 26 * (i >> 2); - digit |= m_out_lcd[BIT(bit, 6)][bit & 0x3f] << seg; - } - m_out_digit[i] = digit; - } -} - -void senterpc_state::lcd_w(u8 data) -{ - // P22: LC7580 DATA - // P26: LC7580 CLK - // P27: LC7580 CE - m_lcd->data_w(BIT(data, 2)); - m_lcd->clk_w(BIT(data, 6)); - m_lcd->ce_w(BIT(data, 7)); + // P22,P26,P27: LC7580 pins (senterpc) + m_lcd->lcd_w(BIT(data, 2) | (data >> 5 & 6)); // P22+P27: piezo m_dac->write(BIT(data, 2) & BIT(~data, 7)); @@ -354,19 +285,17 @@ void senterp_state::senterp(machine_config &config) DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); } -void senterpc_state::senterpc(machine_config &config) +void senterp_state::senterpc(machine_config &config) { senterp(config); // basic machine hardware - m_maincpu->standby_cb().append(m_lcd, FUNC(lc7580_device::inh_w)); - m_maincpu->out_p2_cb().set(FUNC(senterpc_state::leds_w)); - m_maincpu->out_p2_cb().append(FUNC(senterpc_state::lcd_w)); + m_maincpu->standby_cb().append(m_lcd, FUNC(chess3008_lcd_device::inh_w)); + m_maincpu->out_p2_cb().set(FUNC(senterp_state::leds_w)); + m_maincpu->out_p2_cb().append(FUNC(senterp_state::lcd_w)); // video hardware - LC7580(config, m_lcd, 0); - m_lcd->write_segs().set(FUNC(senterpc_state::lcd_output_w)); - + CHESS3008_LCD(config, m_lcd); config.set_default_layout(layout_cxg_senterprisec); } @@ -394,6 +323,6 @@ ROM_END Drivers *******************************************************************************/ -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS -SYST( 1986, senterp, 0, 0, senterp, senterp, senterp_state, empty_init, "Newcrest Technology / CXG Systems / LogiSoft", "Super Enterprise (model 210)", MACHINE_SUPPORTS_SAVE ) -SYST( 1986, senterpc, senterp, 0, senterpc, senterpc, senterpc_state, empty_init, "Newcrest Technology / CXG Systems / LogiSoft", "Super Enterprise (model 210.C)", MACHINE_SUPPORTS_SAVE ) +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 1986, senterp, 0, 0, senterp, senterp, senterp_state, empty_init, "Newcrest Technology / CXG Systems / LogiSoft", "Super Enterprise (model 210)", MACHINE_SUPPORTS_SAVE ) +SYST( 1986, senterpc, senterp, 0, senterpc, senterpc, senterp_state, empty_init, "Newcrest Technology / CXG Systems / LogiSoft", "Super Enterprise (model 210.C)", MACHINE_SUPPORTS_SAVE ) |
