From 4f9c94763321394d5000a9a74ec6183ec75b8dbf Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 11 Nov 2023 14:01:16 +0100 Subject: leonardo/renaissa: add nvram --- src/mame/layout/saitek_galileo.lay | 14 ++-------- src/mame/layout/saitek_leonardo.lay | 10 +------ src/mame/layout/saitek_renaissance.lay | 30 ++++++++------------ src/mame/psion/psion.cpp | 5 ++-- src/mame/saitek/leonardo.cpp | 51 +++++++++++++++++++++++++++------- src/mame/saitek/renaissance.cpp | 51 ++++++++++++++++++++++++++-------- 6 files changed, 99 insertions(+), 62 deletions(-) diff --git a/src/mame/layout/saitek_galileo.lay b/src/mame/layout/saitek_galileo.lay index dbcc15263a3..dd314bc4895 100644 --- a/src/mame/layout/saitek_galileo.lay +++ b/src/mame/layout/saitek_galileo.lay @@ -478,13 +478,8 @@ license:CC0-1.0 - - - - - - + @@ -522,8 +517,7 @@ license:CC0-1.0 - - + @@ -591,8 +585,6 @@ license:CC0-1.0 - - @@ -659,7 +651,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/saitek_leonardo.lay b/src/mame/layout/saitek_leonardo.lay index f27a6865f76..05fd38e980c 100644 --- a/src/mame/layout/saitek_leonardo.lay +++ b/src/mame/layout/saitek_leonardo.lay @@ -467,10 +467,6 @@ license:CC0-1.0 - - - - @@ -507,7 +503,6 @@ license:CC0-1.0 - @@ -609,7 +604,6 @@ license:CC0-1.0 - @@ -680,8 +674,6 @@ license:CC0-1.0 - - @@ -746,7 +738,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/saitek_renaissance.lay b/src/mame/layout/saitek_renaissance.lay index fa5461f17ac..a143b83f441 100644 --- a/src/mame/layout/saitek_renaissance.lay +++ b/src/mame/layout/saitek_renaissance.lay @@ -487,17 +487,12 @@ license:CC0-1.0 - - - - - - - - - - + + + + + @@ -530,12 +525,11 @@ license:CC0-1.0 - - - - - - + + + + + @@ -574,8 +568,6 @@ license:CC0-1.0 - - @@ -678,7 +670,7 @@ license:CC0-1.0 - + diff --git a/src/mame/psion/psion.cpp b/src/mame/psion/psion.cpp index 2e63a397b95..5c1da0365fa 100644 --- a/src/mame/psion/psion.cpp +++ b/src/mame/psion/psion.cpp @@ -13,6 +13,7 @@ Note: - 4 lines display has an custom LCD controller derived from an HD66780 - NVRAM works only if the machine is turned off (with OFF menu) before closing MAME + - psion1 goes into standby right after a cold boot, so press the ON button More info: http://archive.psion2.org/org2/techref/index.htm @@ -46,7 +47,7 @@ uint8_t psion_state::kb_read() } else { - //Read all the input lines + // Read all the input lines for (int line = 0; line < 7; line++) data &= m_kb_lines[line]->read(); } @@ -605,8 +606,8 @@ void psion1_state::psion1(machine_config &config) psion_2lines(config); HD6301X0(config.replace(), m_maincpu, 3.6864_MHz_XTAL); - m_maincpu->nvram_enable_backup(true); m_maincpu->set_addrmap(AS_PROGRAM, &psion1_state::psion1_mem); + m_maincpu->nvram_enable_backup(true); m_maincpu->in_p2_cb().set(FUNC(psion1_state::port2_r)); m_maincpu->out_p2_cb().set(FUNC(psion1_state::port2_w)); m_maincpu->in_p5_cb().set(FUNC(psion1_state::port5_r)); diff --git a/src/mame/saitek/leonardo.cpp b/src/mame/saitek/leonardo.cpp index 9c6442deb60..4dc1f9fc419 100644 --- a/src/mame/saitek/leonardo.cpp +++ b/src/mame/saitek/leonardo.cpp @@ -14,6 +14,11 @@ The expansion modules are basically entire chesscomputers, making the whole thing combined a 'dual brain' chesscomputer. The embedded chess engine is by Julio Kaplan and Craig Barnes, same as the one in SciSys Turbo S-24K. +NOTE: In order for nvram to work properly, press the STOP button to turn off +the chesscomputer before exiting MAME. Other than ACL (which is an unemulated +hardware button that disconnects the battery), there is no known method to +force a cold boot. So if nvram somehow becomes broken, remove the nvram files. + Hardware notes: Leonardo (1986): @@ -50,8 +55,7 @@ to be upgraded with an EMI PCB (power supply related, meaningless for emulation) TODO: - OSA PC link, uses MCU serial interface -- add nvram (MCU port $14?) -- add power-off, not useful with missing nvram support +- MCU internal nvram belongs in m6801.cpp *******************************************************************************/ @@ -60,6 +64,7 @@ TODO: #include "bus/saitek_osa/expansion.h" #include "cpu/m6800/m6801.h" #include "machine/input_merger.h" +#include "machine/nvram.h" #include "machine/sensorboard.h" #include "sound/spkrdev.h" #include "video/pwm.h" @@ -87,6 +92,8 @@ public: m_inputs(*this, "IN.%u", 0) { } + DECLARE_INPUT_CHANGED_MEMBER(go_button); + void leonardo(machine_config &config); void leonardoa(machine_config &config); void galileo(machine_config &config); @@ -107,6 +114,7 @@ private: void main_map(address_map &map); + void standby(int state); void update_display(); void mux_w(u8 data); void leds_w(u8 data); @@ -135,16 +143,34 @@ void leo_state::machine_start() save_item(NAME(m_led_data)); } + + +/******************************************************************************* + I/O +*******************************************************************************/ + +// power + void leo_state::machine_reset() { m_stb->in_clear<0>(); } +void leo_state::standby(int state) +{ + if (state) + m_display->clear(); +} +INPUT_CHANGED_MEMBER(leo_state::go_button) +{ + if (newval && m_maincpu->standby()) + { + machine_reset(); + m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); + } +} -/******************************************************************************* - I/O -*******************************************************************************/ // misc @@ -267,8 +293,8 @@ void leo_state::main_map(address_map &map) { map(0x0000, 0x0027).m(m_maincpu, FUNC(hd6303y_cpu_device::hd6301y_io)); map(0x0002, 0x0002).rw(FUNC(leo_state::unk_r), FUNC(leo_state::unk_w)); // external - map(0x0040, 0x013f).ram(); // internal - map(0x4000, 0x5fff).ram(); + map(0x0040, 0x013f).ram().share("internal"); // internal + map(0x4000, 0x5fff).ram().share("nvram"); map(0x6000, 0x6000).w(FUNC(leo_state::mux_w)); map(0x7000, 0x7000).w(FUNC(leo_state::leds_w)); map(0x8000, 0xffff).rom(); @@ -329,8 +355,7 @@ static INPUT_PORTS_START( leonardo ) PORT_CONFSETTING( 0x04, DEF_STR( Normal ) ) PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("Go") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F1) PORT_NAME("ACL") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, leo_state, go_button, 0) PORT_NAME("Go") INPUT_PORTS_END static INPUT_PORTS_START( galileo ) // same buttons, but different locations @@ -363,7 +388,7 @@ static INPUT_PORTS_START( galileo ) // same buttons, but different locations PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Set Up") PORT_MODIFY("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Go") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, leo_state, go_button, 0) PORT_NAME("Go") INPUT_PORTS_END @@ -377,6 +402,8 @@ void leo_state::leonardo(machine_config &config) // basic machine hardware HD6303Y(config, m_maincpu, 12_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &leo_state::main_map); + m_maincpu->nvram_enable_backup(true); + m_maincpu->standby_cb().set(FUNC(leo_state::standby)); m_maincpu->in_p2_cb().set(FUNC(leo_state::p2_r)); m_maincpu->out_p2_cb().set(FUNC(leo_state::p2_w)); m_maincpu->in_p5_cb().set(FUNC(leo_state::p5_r)); @@ -389,9 +416,13 @@ void leo_state::leonardo(machine_config &config) config.set_maximum_quantum(attotime::from_hz(6000)); + NVRAM(config, "internal", nvram_device::DEFAULT_ALL_0); + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); + SENSORBOARD(config, m_board).set_type(sensorboard_device::MAGNETS); 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); // video hardware PWM_DISPLAY(config, m_display).set_size(8+2, 8+2); diff --git a/src/mame/saitek/renaissance.cpp b/src/mame/saitek/renaissance.cpp index 020f28ec54e..6bee95cd044 100644 --- a/src/mame/saitek/renaissance.cpp +++ b/src/mame/saitek/renaissance.cpp @@ -8,6 +8,10 @@ Saitek Kasparov Renaissance Saitek's 2nd version modular chesscomputer. It accepts the same modules as Leonardo/Galileo. "OSA" version for Renaissance is 1.5. +NOTE: In order for nvram to work properly, press the STOP button to turn off +the chesscomputer before exiting MAME. Unlike Leonardo/Galileo, it looks like +it will always do a cold boot if you reset without having pressed STOP. + Hardware notes: - 6301Y0(mode 1) or HD6303YP MCU @ 10MHz - 8KB RAM, 32KB ROM @@ -35,6 +39,7 @@ TODO: #include "bus/saitek_osa/expansion.h" #include "cpu/m6800/m6801.h" #include "machine/input_merger.h" +#include "machine/nvram.h" #include "machine/sensorboard.h" #include "sound/spkrdev.h" #include "video/pwm.h" @@ -68,8 +73,8 @@ public: { } template DECLARE_INPUT_CHANGED_MEMBER(change_view); + DECLARE_INPUT_CHANGED_MEMBER(go_button); - // machine configs void ren(machine_config &config); protected: @@ -94,6 +99,7 @@ private: void lcd_pwm_w(offs_t offset, u8 data); void lcd_output_w(offs_t offset, u64 data); + void standby(int state); void update_display(); void mux_w(u8 data); void leds_w(u8 data); @@ -124,11 +130,6 @@ void ren_state::machine_start() save_item(NAME(m_led_data)); } -void ren_state::machine_reset() -{ - m_stb->in_clear<0>(); -} - template INPUT_CHANGED_MEMBER(ren_state::change_view) { if (oldval && !newval) @@ -145,6 +146,29 @@ template INPUT_CHANGED_MEMBER(ren_state::change_view) I/O *******************************************************************************/ +// power + +void ren_state::machine_reset() +{ + m_stb->in_clear<0>(); +} + +void ren_state::standby(int state) +{ + if (state) + m_display->clear(); +} + +INPUT_CHANGED_MEMBER(ren_state::go_button) +{ + if (newval && m_maincpu->standby()) + { + machine_reset(); + m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); + } +} + + // LCD void ren_state::lcd_pwm_w(offs_t offset, u8 data) @@ -154,7 +178,7 @@ void ren_state::lcd_pwm_w(offs_t offset, u8 data) void ren_state::lcd_output_w(offs_t offset, u64 data) { - m_lcd_pwm->write_row(offset, data); + m_lcd_pwm->write_row(offset, m_maincpu->standby() ? 0 : data); } @@ -283,11 +307,11 @@ void ren_state::p6_w(u8 data) void ren_state::main_map(address_map &map) { map(0x0000, 0x0027).m(m_maincpu, FUNC(hd6303y_cpu_device::hd6301y_io)); - map(0x0040, 0x013f).ram(); // internal + map(0x0040, 0x013f).ram().share("internal"); // internal map(0x2000, 0x2000).w(FUNC(ren_state::mux_w)); map(0x2400, 0x2400).w(FUNC(ren_state::leds_w)); map(0x2600, 0x2600).rw(FUNC(ren_state::control_r), FUNC(ren_state::control_w)); - map(0x4000, 0x5fff).ram(); + map(0x4000, 0x5fff).ram().share("nvram"); map(0x6000, 0x607f).w("lcd", FUNC(sed1502_device::write)); map(0x8000, 0xffff).rom(); } @@ -345,8 +369,7 @@ static INPUT_PORTS_START( ren ) PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Go") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F1) PORT_NAME("ACL") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, ren_state, go_button, 0) PORT_NAME("Go") PORT_START("VIEW") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CHANGED_MEMBER(DEVICE_SELF, ren_state, change_view<+1>, 0) @@ -364,6 +387,8 @@ void ren_state::ren(machine_config &config) // basic machine hardware HD6303Y(config, m_maincpu, 10_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &ren_state::main_map); + m_maincpu->nvram_enable_backup(true); + m_maincpu->standby_cb().set(FUNC(ren_state::standby)); m_maincpu->in_p2_cb().set(FUNC(ren_state::p2_r)); m_maincpu->out_p2_cb().set(FUNC(ren_state::p2_w)); m_maincpu->in_p5_cb().set(FUNC(ren_state::p5_r)); @@ -376,9 +401,13 @@ void ren_state::ren(machine_config &config) config.set_maximum_quantum(attotime::from_hz(6000)); + NVRAM(config, "internal", nvram_device::DEFAULT_ALL_0); + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); + SENSORBOARD(config, m_board).set_type(sensorboard_device::MAGNETS); 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); // video hardware SED1502(config, m_lcd, 32768).write_segs().set(FUNC(ren_state::lcd_output_w)); -- cgit v1.2.3