From 59c5e5cef742609f675f005a03698da2cbf5806b Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 25 Feb 2019 20:27:33 +0100 Subject: [PATCH] sc1/sc2: small update (nw) --- src/mame/drivers/sc1.cpp | 52 ++++++++++++++++--------- src/mame/drivers/sc2.cpp | 55 +++++++++++++++------------ src/mame/layout/sc1.lay | 82 +++++++++++++++------------------------- src/mame/layout/sc2.lay | 77 ++++++++++++------------------------- 4 files changed, 120 insertions(+), 146 deletions(-) diff --git a/src/mame/drivers/sc1.cpp b/src/mame/drivers/sc1.cpp index 68579ca10c1..045bbd8f4ee 100644 --- a/src/mame/drivers/sc1.cpp +++ b/src/mame/drivers/sc1.cpp @@ -2,19 +2,24 @@ // copyright-holders:Sandro Ronco /*************************************************************************** -Schachcomputer SC 1 +Schachcomputer SC 1 driver -ToDo: -- speaker -- LEDs +VEB Mikroelektronik's 1st chess computer. It was canceled before wide release. + +TODO: +- speaker, it's very noisy if hooked up as it is now, missing enable-bit? + it still toggles matrix d1 if T(tone off) is pressed +- LEDs, they're not on digit d7 - 7seg sometimes flashes +- setting level doesn't work? game should boot with "PS 1" ****************************************************************************/ #include "emu.h" #include "cpu/z80/z80.h" #include "machine/z80pio.h" -#include "sound/spkrdev.h" +#include "sound/dac.h" +#include "sound/volt_reg.h" #include "speaker.h" #include "sc1.lh" @@ -29,9 +34,10 @@ public: driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_pio(*this, "z80pio"), - m_speaker(*this, "speaker"), + m_dac(*this, "dac"), m_keypad(*this, "LINE%u", 1), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_leds(*this, "led%u", 0U) { } void sc1(machine_config &config); @@ -42,24 +48,28 @@ protected: private: required_device m_maincpu; required_device m_pio; - required_device m_speaker; + required_device m_dac; required_ioport_array<8> m_keypad; + output_finder<4> m_digits; + output_finder<2> m_leds; void sc1_io(address_map &map); void sc1_mem(address_map &map); uint8_t m_matrix; - DECLARE_WRITE8_MEMBER( matrix_w ); - DECLARE_WRITE8_MEMBER( pio_port_a_w ); - DECLARE_READ8_MEMBER( pio_port_b_r ); + DECLARE_WRITE8_MEMBER(matrix_w); + DECLARE_WRITE8_MEMBER(pio_port_a_w); + DECLARE_READ8_MEMBER(pio_port_b_r); }; void sc1_state::machine_start() { m_digits.resolve(); + m_leds.resolve(); + m_matrix = 0; save_item(NAME(m_matrix)); } @@ -69,8 +79,9 @@ void sc1_state::machine_start() ***************************************************************************/ -WRITE8_MEMBER( sc1_state::pio_port_a_w ) +WRITE8_MEMBER(sc1_state::pio_port_a_w) { + // digit segment data uint8_t digit = bitswap<8>(data,3,4,6,0,1,2,7,5) & 0x7f; if (m_matrix & 0x04) @@ -90,12 +101,16 @@ WRITE8_MEMBER( sc1_state::pio_port_a_w ) ***************************************************************************/ -WRITE8_MEMBER( sc1_state::matrix_w ) +WRITE8_MEMBER(sc1_state::matrix_w) { + // d1: speaker out + //m_dac->write(BIT(data, 1)); + + // keypad/led mux m_matrix = data; } -READ8_MEMBER( sc1_state::pio_port_b_r ) +READ8_MEMBER(sc1_state::pio_port_b_r) { uint8_t data = 0; @@ -157,7 +172,7 @@ static INPUT_PORTS_START( sc1 ) PORT_START("LINE8") PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) INPUT_PORTS_END @@ -179,8 +194,9 @@ void sc1_state::sc1(machine_config &config) m_pio->in_pb_callback().set(FUNC(sc1_state::pio_port_b_r)); /* sound hardware */ - SPEAKER(config, "mono").front_center(); - SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50); + SPEAKER(config, "speaker").front_center(); + DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); + VOLTAGE_REGULATOR(config, "vref").add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT); } @@ -197,4 +213,4 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1981, sc1, 0, 0, sc1, sc1, sc1_state, empty_init, "VEB Mikroelektronik Erfurt", "Schachcomputer SC 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1981, sc1, 0, 0, sc1, sc1, sc1_state, empty_init, "VEB Mikroelektronik Erfurt", "Schachcomputer SC 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/sc2.cpp b/src/mame/drivers/sc2.cpp index 4d265c0a336..10d59c906c4 100644 --- a/src/mame/drivers/sc2.cpp +++ b/src/mame/drivers/sc2.cpp @@ -2,7 +2,22 @@ // copyright-holders:Sandro Ronco /*************************************************************************** - Schachcomputer SC 2 +Schachcomputer SC 2 driver + +VEB Mikroelektronik's 2nd chess computer. The chess program is based on +Fidelity Chess Challenger 10. + +keypad legend: + +R - Rückstellen (reset) +K - Programmstufen (level) +W - Figurenwahl (white/black) +P - Problemeingabe (problem mode) +T - Tonabschaltung (sound on/off) +L - Löschen (clear) +Q - Quittierung (enter) + +Fidelity CC10 synonyms: RE, LV, RV, PB, ♪, CL, EN ****************************************************************************/ @@ -33,9 +48,11 @@ public: void sc2(machine_config &config); + // Rückstellen is also tied to CPU RESET + DECLARE_INPUT_CHANGED_MEMBER(reset_button) { m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); } + protected: virtual void machine_start() override; - virtual void machine_reset() override; private: required_device m_maincpu; @@ -54,7 +71,6 @@ private: uint8_t m_digit_data; void sc2_update_display(); - DECLARE_READ8_MEMBER(pio_port_a_r); DECLARE_READ8_MEMBER(pio_port_b_r); DECLARE_WRITE8_MEMBER(pio_port_a_w); DECLARE_WRITE8_MEMBER(pio_port_b_w); @@ -67,16 +83,13 @@ void sc2_state::machine_start() m_digits.resolve(); m_leds.resolve(); - save_item(NAME(m_kp_matrix)); - save_item(NAME(m_led_selected)); - save_item(NAME(m_digit_data)); -} - -void sc2_state::machine_reset() -{ m_kp_matrix = 0; m_led_selected = 0; m_digit_data = 0; + + save_item(NAME(m_kp_matrix)); + save_item(NAME(m_led_selected)); + save_item(NAME(m_digit_data)); } @@ -109,14 +122,12 @@ void sc2_state::sc2_io(address_map &map) void sc2_state::sc2_update_display() { - uint8_t digit_data = bitswap<8>(m_digit_data,7,0,1,2,3,4,5,6) & 0x7f; - // latch display data for (int i = 0; i < 4; i++) { if (!BIT(m_led_selected, i)) { - m_digits[i] = digit_data; + m_digits[i] = m_digit_data & 0x7f; // schach/matt leds if (i < 2) @@ -125,14 +136,9 @@ void sc2_state::sc2_update_display() } } -READ8_MEMBER( sc2_state::pio_port_a_r ) -{ - return m_digit_data; -} - READ8_MEMBER( sc2_state::pio_port_b_r ) { - uint8_t data = m_led_selected & 0x0f; + uint8_t data = 0x0f; // read keypad matrix for (int i = 0; i < 4; i++) @@ -144,11 +150,13 @@ READ8_MEMBER( sc2_state::pio_port_b_r ) WRITE8_MEMBER( sc2_state::pio_port_a_w ) { - m_digit_data = data; + // digit segment data + m_digit_data = bitswap<8>(data,7,0,1,2,3,4,5,6); } WRITE8_MEMBER( sc2_state::pio_port_b_w ) { + // d0-d3: keypad mux(active high), led mux(active low) if (data != 0xf1 && data != 0xf2 && data != 0xf4 && data != 0xf8) { m_led_selected = data; @@ -165,8 +173,8 @@ static INPUT_PORTS_START( sc2 ) PORT_START("LINE1") PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_START("LINE2") PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_A) @@ -183,7 +191,7 @@ static INPUT_PORTS_START( sc2 ) PORT_START("LINE4") PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, sc2_state, reset_button, nullptr) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O) INPUT_PORTS_END @@ -202,7 +210,6 @@ void sc2_state::sc2(machine_config &config) /* devices */ Z80PIO(config, m_pio, 9.8304_MHz_XTAL/4); - m_pio->in_pa_callback().set(FUNC(sc2_state::pio_port_a_r)); m_pio->out_pa_callback().set(FUNC(sc2_state::pio_port_a_w)); m_pio->in_pb_callback().set(FUNC(sc2_state::pio_port_b_r)); m_pio->out_pb_callback().set(FUNC(sc2_state::pio_port_b_w)); diff --git a/src/mame/layout/sc1.lay b/src/mame/layout/sc1.lay index e7878d89293..e87ed0fd85d 100644 --- a/src/mame/layout/sc1.lay +++ b/src/mame/layout/sc1.lay @@ -1,62 +1,40 @@ + + + + + - - - + + - - - - - - - - - - - - - - - - - - - - + + - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sc2.lay b/src/mame/layout/sc2.lay index ffb27d79e96..1c3db18b2ba 100644 --- a/src/mame/layout/sc2.lay +++ b/src/mame/layout/sc2.lay @@ -1,62 +1,35 @@ + + + - - - + + - - - - - - - - - - - - - - - - - - - - + + - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +