From 16cebbef34d3c24fa79f14342f3ba35fdc524fa2 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 20 Feb 2024 17:03:05 +0100 Subject: Systems promoted to working --------------------------- Sphinx Chess Professor [hap, Berger] --- src/devices/video/hlcd0515.cpp | 2 +- src/devices/video/lc7580.cpp | 60 +++-- src/devices/video/lc7580.h | 10 +- src/mame/cxg/dominator.cpp | 4 +- src/mame/cxg/professor.cpp | 27 ++- src/mame/layout/cxg_professor.lay | 481 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 547 insertions(+), 37 deletions(-) create mode 100644 src/mame/layout/cxg_professor.lay diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp index ed9e5cb7b0a..0984c1e218d 100644 --- a/src/devices/video/hlcd0515.cpp +++ b/src/devices/video/hlcd0515.cpp @@ -105,7 +105,7 @@ void hlcd0515_device::device_start() //------------------------------------------------- -// nvram (when VDD is battery-backed, rare occurence) +// nvram (when VDD is battery-backed) //------------------------------------------------- bool hlcd0515_device::nvram_write(util::write_stream &file) diff --git a/src/devices/video/lc7580.cpp b/src/devices/video/lc7580.cpp index 17090f74578..f97ab2161fd 100644 --- a/src/devices/video/lc7580.cpp +++ b/src/devices/video/lc7580.cpp @@ -26,8 +26,12 @@ DEFINE_DEVICE_TYPE(LC7582, lc7582_device, "lc7582", "Sanyo LC7582 LCD Driver") lc7580_device::lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock), + device_nvram_interface(mconfig, *this), m_write_segs(*this) -{ } +{ + // disable nvram by default + nvram_enable_backup(false); +} lc7580_device::lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : lc7580_device(mconfig, LC7580, tag, owner, clock) @@ -49,8 +53,6 @@ void lc7580_device::device_start() m_ce = 0; m_clk = 0; m_blank = false; - m_duty = 0; - m_addsp = 0; m_shift = 0; std::fill_n(m_latch, std::size(m_latch), 0); @@ -59,21 +61,49 @@ void lc7580_device::device_start() save_item(NAME(m_ce)); save_item(NAME(m_clk)); save_item(NAME(m_blank)); - save_item(NAME(m_duty)); - save_item(NAME(m_addsp)); save_item(NAME(m_shift)); save_item(NAME(m_latch)); } +//------------------------------------------------- +// nvram (when VDD is battery-backed) +//------------------------------------------------- + +bool lc7580_device::nvram_write(util::write_stream &file) +{ + size_t actual; + + if (file.write(&m_shift, sizeof(m_shift), actual) || (sizeof(m_shift) != actual)) + return false; + if (file.write(&m_latch, sizeof(m_latch), actual) || (sizeof(m_latch) != actual)) + return false; + + return true; +} + +bool lc7580_device::nvram_read(util::read_stream &file) +{ + size_t actual; + + if (file.read(&m_shift, sizeof(m_shift), actual) || (sizeof(m_shift) != actual)) + return false; + if (file.read(&m_latch, sizeof(m_latch), actual) || (sizeof(m_latch) != actual)) + return false; + + return true; +} + + //------------------------------------------------- // handlers //------------------------------------------------- void lc7580_device::refresh_output() { - if (m_duty) + if (BIT(m_latch[0], 53)) { + // 1/2 duty u64 segs[2] = { 0, 0 }; // COM1 on even bits, COM2 on uneven bits @@ -85,7 +115,8 @@ void lc7580_device::refresh_output() } else { - m_write_segs(0, m_blank ? 0 : m_latch[0]); + // 1/1 duty + m_write_segs(0, m_blank ? 0 : m_latch[0] & ((1ULL << 53) - 1)); m_write_segs(1, 0); } } @@ -95,7 +126,7 @@ void lc7580_device::clk_w(int state) state = (state) ? 1 : 0; // clock shift register - if (state && !m_clk) + if (!state && m_clk) m_shift = m_shift >> 1 | u64(m_data) << 55; m_clk = state; @@ -108,16 +139,11 @@ void lc7580_device::ce_w(int state) // latch at falling edge if (!state && m_ce) { - // d53: DP (drive mode select, aka duty) - // d54: DQ (AD/DSP function) + // d0-d52: segment data + // d53(0): DP (drive mode select, aka duty) + // d54(0): DQ (AD/DSP function) // d55: latch select - if (!BIT(m_shift, 55)) - { - m_duty = BIT(m_shift, 53); - m_addsp = BIT(m_shift, 54); - } - - m_latch[BIT(m_shift, 55)] = m_shift & u64(0x1f'ffff'ffff'ffff); + m_latch[BIT(m_shift, 55)] = m_shift; refresh_output(); } diff --git a/src/devices/video/lc7580.h b/src/devices/video/lc7580.h index 583ce3c45d6..8bb6bdf7bcb 100644 --- a/src/devices/video/lc7580.h +++ b/src/devices/video/lc7580.h @@ -31,7 +31,7 @@ pin desc */ -class lc7580_device : public device_t +class lc7580_device : public device_t, public device_nvram_interface { public: lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); @@ -49,6 +49,12 @@ protected: // device_t implementation virtual void device_start() override; + virtual void device_reset() override { refresh_output(); } + + // device_nvram_interface implementation + virtual void nvram_default() override { ; } + virtual bool nvram_read(util::read_stream &file) override; + virtual bool nvram_write(util::write_stream &file) override; private: void refresh_output(); @@ -58,8 +64,6 @@ private: int m_clk; bool m_blank; - int m_duty; - int m_addsp; u64 m_shift; u64 m_latch[2]; diff --git a/src/mame/cxg/dominator.cpp b/src/mame/cxg/dominator.cpp index e87845df2ec..ffc7e5f503d 100644 --- a/src/mame/cxg/dominator.cpp +++ b/src/mame/cxg/dominator.cpp @@ -131,9 +131,9 @@ void dominator_state::lcd_s_w(offs_t offset, u64 data) void dominator_state::control_w(u8 data) { - // d0: LC7582 DATA - // d1: LC7582 CLK // d2: LC7582 CE + // d1: LC7582 CLK + // d0: LC7582 DATA 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/cxg/professor.cpp b/src/mame/cxg/professor.cpp index a0544a8d90b..41b9806c42d 100644 --- a/src/mame/cxg/professor.cpp +++ b/src/mame/cxg/professor.cpp @@ -5,7 +5,7 @@ CXG Sphinx Chess Professor (CXG-243) -NOTE: Before exiting MAME, press the STOP button to turn the power off. Otherwise, +NOTE: Before exiting MAME, press the OFF button to turn the power off. Otherwise, NVRAM won't save properly. The chess engine is by Frans Morsch, similar to the one in Mephisto Europa. @@ -17,9 +17,6 @@ Hardware notes: - Sanyo LC7580, LCD with custom segments - 8*8 chessboard buttons, 16 LEDs, piezo -TODO: -- internal artwork - *******************************************************************************/ #include "emu.h" @@ -34,7 +31,7 @@ TODO: #include "speaker.h" // internal artwork -//#include "cxg_professor.lh" +#include "cxg_professor.lh" namespace { @@ -122,9 +119,9 @@ void professor_state::control_w(u8 data) // P23: speaker out m_dac->write(BIT(data, 3)); - // P24: LC7580 DATA - // P25: LC7580 CLK // P26: LC7580 CE + // P25: LC7580 CLK + // P24: LC7580 DATA m_lcd->data_w(BIT(data, 4)); m_lcd->clk_w(BIT(data, 5)); m_lcd->ce_w(BIT(data, 6)); @@ -201,7 +198,8 @@ void professor_state::professor(machine_config &config) HD6301Y0(config, m_maincpu, 8_MHz_XTAL); m_maincpu->nvram_enable_backup(true); m_maincpu->standby_cb().set(m_maincpu, FUNC(hd6301y_cpu_device::nvram_set_battery)); - //m_maincpu->standby_cb().append(FUNC(professor_state::standby)); + m_maincpu->standby_cb().append(m_lcd, FUNC(lc7580_device::inh_w)); + m_maincpu->standby_cb().append([this](int state) { if (state) m_display->clear(); }); m_maincpu->out_p1_cb().set(FUNC(professor_state::leds_w<0>)); m_maincpu->out_p4_cb().set(FUNC(professor_state::leds_w<1>)); m_maincpu->out_p2_cb().set(FUNC(professor_state::control_w)); @@ -211,19 +209,20 @@ void professor_state::professor(machine_config &config) SENSORBOARD(config, m_board).set_type(sensorboard_device::BUTTONS); m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess)); m_board->set_delay(attotime::from_msec(150)); - //m_board->set_nvram_enable(true); + m_board->set_nvram_enable(true); // video hardware LC7580(config, m_lcd, 0); m_lcd->write_segs().set(FUNC(professor_state::lcd_s_w)); + m_lcd->nvram_enable_backup(true); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG)); screen.set_refresh_hz(60); - screen.set_size(1920/4, 977/4); + screen.set_size(1920/5, 921/5); screen.set_visarea_full(); PWM_DISPLAY(config, m_display).set_size(2, 8); - //config.set_default_layout(layout_cxg_professor); + config.set_default_layout(layout_cxg_professor); // sound hardware SPEAKER(config, "speaker").front_center(); @@ -240,8 +239,8 @@ ROM_START( scprof ) ROM_REGION( 0x4000, "maincpu", 0 ) ROM_LOAD("1988_107_newcrest_hd6301y0j76p", 0x0000, 0x4000, CRC(681456c7) SHA1(99f8ab7369dbc2c93335affc38838295a8a2c5f3) ) - ROM_REGION( 100000, "screen", 0 ) - ROM_LOAD("scprof.svg", 0, 100000, NO_DUMP ) + ROM_REGION( 61763, "screen", 0 ) + ROM_LOAD("scprof.svg", 0, 61763, CRC(2c26e603) SHA1(028b6406ff2aa89af75dc4133d3cb9a1bbcb846d) ) ROM_END } // anonymous namespace @@ -253,4 +252,4 @@ ROM_END *******************************************************************************/ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS -SYST( 1989, scprof, 0, 0, professor, professor, professor_state, empty_init, "CXG Systems / Newcrest Technology", "Sphinx Chess Professor", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +SYST( 1989, scprof, 0, 0, professor, professor, professor_state, empty_init, "CXG Systems / Newcrest Technology", "Sphinx Chess Professor", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/layout/cxg_professor.lay b/src/mame/layout/cxg_professor.lay new file mode 100644 index 00000000000..6af59fa5de0 --- /dev/null +++ b/src/mame/layout/cxg_professor.lay @@ -0,0 +1,481 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3