sc1/sc2: small update (nw)

This commit is contained in:
hap 2019-02-25 20:27:33 +01:00
parent d63a891a58
commit 59c5e5cef7
4 changed files with 120 additions and 146 deletions

View File

@ -2,19 +2,24 @@
// copyright-holders:Sandro Ronco // copyright-holders:Sandro Ronco
/*************************************************************************** /***************************************************************************
Schachcomputer SC 1 Schachcomputer SC 1 driver
ToDo: VEB Mikroelektronik's 1st chess computer. It was canceled before wide release.
- speaker
- LEDs 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 - 7seg sometimes flashes
- setting level doesn't work? game should boot with "PS 1"
****************************************************************************/ ****************************************************************************/
#include "emu.h" #include "emu.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "machine/z80pio.h" #include "machine/z80pio.h"
#include "sound/spkrdev.h" #include "sound/dac.h"
#include "sound/volt_reg.h"
#include "speaker.h" #include "speaker.h"
#include "sc1.lh" #include "sc1.lh"
@ -29,9 +34,10 @@ public:
driver_device(mconfig, type, tag), driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_pio(*this, "z80pio"), m_pio(*this, "z80pio"),
m_speaker(*this, "speaker"), m_dac(*this, "dac"),
m_keypad(*this, "LINE%u", 1), 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); void sc1(machine_config &config);
@ -42,24 +48,28 @@ protected:
private: private:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<z80pio_device> m_pio; required_device<z80pio_device> m_pio;
required_device<speaker_sound_device> m_speaker; required_device<dac_bit_interface> m_dac;
required_ioport_array<8> m_keypad; required_ioport_array<8> m_keypad;
output_finder<4> m_digits; output_finder<4> m_digits;
output_finder<2> m_leds;
void sc1_io(address_map &map); void sc1_io(address_map &map);
void sc1_mem(address_map &map); void sc1_mem(address_map &map);
uint8_t m_matrix; uint8_t m_matrix;
DECLARE_WRITE8_MEMBER( matrix_w ); DECLARE_WRITE8_MEMBER(matrix_w);
DECLARE_WRITE8_MEMBER( pio_port_a_w ); DECLARE_WRITE8_MEMBER(pio_port_a_w);
DECLARE_READ8_MEMBER( pio_port_b_r ); DECLARE_READ8_MEMBER(pio_port_b_r);
}; };
void sc1_state::machine_start() void sc1_state::machine_start()
{ {
m_digits.resolve(); m_digits.resolve();
m_leds.resolve();
m_matrix = 0;
save_item(NAME(m_matrix)); 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; uint8_t digit = bitswap<8>(data,3,4,6,0,1,2,7,5) & 0x7f;
if (m_matrix & 0x04) 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; m_matrix = data;
} }
READ8_MEMBER( sc1_state::pio_port_b_r ) READ8_MEMBER(sc1_state::pio_port_b_r)
{ {
uint8_t data = 0; uint8_t data = 0;
@ -157,7 +172,7 @@ static INPUT_PORTS_START( sc1 )
PORT_START("LINE8") PORT_START("LINE8")
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) 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 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)); m_pio->in_pb_callback().set(FUNC(sc1_state::pio_port_b_r));
/* sound hardware */ /* sound hardware */
SPEAKER(config, "mono").front_center(); SPEAKER(config, "speaker").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50); 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 */ /* Driver */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS // 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 )

View File

@ -2,7 +2,22 @@
// copyright-holders:Sandro Ronco // 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); 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: protected:
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override;
private: private:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
@ -54,7 +71,6 @@ private:
uint8_t m_digit_data; uint8_t m_digit_data;
void sc2_update_display(); void sc2_update_display();
DECLARE_READ8_MEMBER(pio_port_a_r);
DECLARE_READ8_MEMBER(pio_port_b_r); DECLARE_READ8_MEMBER(pio_port_b_r);
DECLARE_WRITE8_MEMBER(pio_port_a_w); DECLARE_WRITE8_MEMBER(pio_port_a_w);
DECLARE_WRITE8_MEMBER(pio_port_b_w); DECLARE_WRITE8_MEMBER(pio_port_b_w);
@ -67,16 +83,13 @@ void sc2_state::machine_start()
m_digits.resolve(); m_digits.resolve();
m_leds.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_kp_matrix = 0;
m_led_selected = 0; m_led_selected = 0;
m_digit_data = 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() 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 // latch display data
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
if (!BIT(m_led_selected, i)) if (!BIT(m_led_selected, i))
{ {
m_digits[i] = digit_data; m_digits[i] = m_digit_data & 0x7f;
// schach/matt leds // schach/matt leds
if (i < 2) 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 ) READ8_MEMBER( sc2_state::pio_port_b_r )
{ {
uint8_t data = m_led_selected & 0x0f; uint8_t data = 0x0f;
// read keypad matrix // read keypad matrix
for (int i = 0; i < 4; i++) 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 ) 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 ) 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) if (data != 0xf1 && data != 0xf2 && data != 0xf4 && data != 0xf8)
{ {
m_led_selected = data; m_led_selected = data;
@ -165,8 +173,8 @@ static INPUT_PORTS_START( sc2 )
PORT_START("LINE1") PORT_START("LINE1")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) 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(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(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_Q) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD)
PORT_START("LINE2") 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) 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_START("LINE4")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) 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(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) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O)
INPUT_PORTS_END INPUT_PORTS_END
@ -202,7 +210,6 @@ void sc2_state::sc2(machine_config &config)
/* devices */ /* devices */
Z80PIO(config, m_pio, 9.8304_MHz_XTAL/4); 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->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->in_pb_callback().set(FUNC(sc2_state::pio_port_b_r));
m_pio->out_pb_callback().set(FUNC(sc2_state::pio_port_b_w)); m_pio->out_pb_callback().set(FUNC(sc2_state::pio_port_b_w));

View File

@ -1,62 +1,40 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<mamelayout version="2"> <mamelayout version="2">
<!-- define elements -->
<element name="static_orange"><rect><color red="1.0" green="0.75" blue="0.1" /></rect></element>
<element name="digit" defstate="0"> <element name="digit" defstate="0">
<led7seg> <led7seg><color red="1.0" green="1.0" blue="0.1" /></led7seg>
<color red="0.75" green="0.75" blue="0.0" />
</led7seg>
</element> </element>
<element name="led" defstate="0"> <element name="led" defstate="0">
<disk state="1"> <disk state="1"><color red="1.0" green="0.0" blue="0.0" /></disk>
<color red="1.0" green="0.0" blue="0.0" /> <disk state="0"><color red="0.15" green="0.0" blue="0.0" /> </disk>
</disk>
<disk state="0">
<color red="0.15" green="0.0" blue="0.0" />
</disk>
</element>
<element name="schach">
<text string="SCHACH">
<color red="1.0" green="1.0" blue="1.0" /></text>
</element>
<element name="matt">
<text string="MATT">
<color red="1.0" green="1.0" blue="1.0" /></text>
</element>
<element name="background">
<rect>
<bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element> </element>
<view name="Default Layout"> <element name="text_schach"><text string="SCHACH" align="1"><color red="0.8" green="0.8" blue="0.8" /></text></element>
<!-- Black background --> <element name="text_matt"><text string="MATT" align="1"><color red="0.8" green="0.8" blue="0.8" /></text></element>
<bezel element="background">
<bounds left="00" top="00" right="240" bottom="95" />
</bezel>
<bezel name="digit0" element="digit">
<bounds x="10" y="10" width="50" height="80" /> <!-- build screen -->
</bezel>
<bezel name="digit1" element="digit"> <view name="Internal Layout">
<bounds x="70" y="10" width="50" height="80" /> <bounds left="5" right="265" top="0" bottom="165" />
</bezel>
<bezel name="digit2" element="digit"> <bezel name="digit0" element="digit"><bounds x="10" y="10" width="50" height="80" /></bezel>
<bounds x="130" y="10" width="50" height="80" /> <bezel name="digit1" element="digit"><bounds x="70" y="10" width="50" height="80" /></bezel>
</bezel> <bezel name="digit2" element="digit"><bounds x="150" y="10" width="50" height="80" /></bezel>
<bezel name="digit3" element="digit"> <bezel name="digit3" element="digit"><bounds x="210" y="10" width="50" height="80" /></bezel>
<bounds x="190" y="10" width="50" height="80" />
</bezel> <bezel element="static_orange"><bounds x="5" y="0" width="120" height="100" /><color alpha="0.5" /></bezel>
<bezel name="led0" element="led"> <bezel element="static_orange"><bounds x="145" y="0" width="120" height="100" /><color alpha="0.5" /></bezel>
<bounds x="10" y="95" width="10" height="10" />
</bezel> <bezel name="led0" element="led"><bounds x="240" y="140" width="20" height="20" /></bezel>
<bezel name="led1" element="led"> <bezel name="led1" element="led"><bounds x="240" y="110" width="20" height="20" /></bezel>
<bounds x="220" y="95" width="10" height="10" />
</bezel> <bezel element="text_matt"><bounds x="170" y="110" width="100" height="20" /></bezel>
<bezel name="schach_str" element="schach"> <bezel element="text_schach"><bounds x="170" y="140" width="100" height="20" /></bezel>
<bounds x="20" y="95" width="40" height="10" />
</bezel>
<bezel name="matt_str" element="matt">
<bounds x="185" y="95" width="40" height="10" />
</bezel>
</view> </view>
</mamelayout> </mamelayout>

View File

@ -1,62 +1,35 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<mamelayout version="2"> <mamelayout version="2">
<!-- define elements -->
<element name="digit" defstate="0"> <element name="digit" defstate="0">
<led7seg> <led7seg><color red="0.25" green="0.9" blue="0.1" /></led7seg>
<color red="0.0" green="0.75" blue="0.0" />
</led7seg>
</element> </element>
<element name="led" defstate="0"> <element name="led" defstate="0">
<disk state="1"> <disk state="1"><color red="1.0" green="0.0" blue="0.0" /></disk>
<color red="1.0" green="0.0" blue="0.0" /> <disk state="0"><color red="0.15" green="0.0" blue="0.0" /> </disk>
</disk>
<disk state="0">
<color red="0.15" green="0.0" blue="0.0" />
</disk>
</element>
<element name="schach">
<text string="SCHACH">
<color red="1.0" green="1.0" blue="1.0" /></text>
</element>
<element name="matt">
<text string="MATT">
<color red="1.0" green="1.0" blue="1.0" /></text>
</element>
<element name="background">
<rect>
<bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element> </element>
<view name="Default Layout"> <element name="text_schach"><text string="SCHACH" align="1"><color red="0.8" green="0.8" blue="0.8" /></text></element>
<!-- Black background --> <element name="text_matt"><text string="MATT" align="2"><color red="0.8" green="0.8" blue="0.8" /></text></element>
<bezel element="background">
<bounds left="00" top="00" right="240" bottom="95" />
</bezel>
<bezel name="digit0" element="digit">
<bounds x="10" y="10" width="50" height="80" /> <!-- build screen -->
</bezel>
<bezel name="digit1" element="digit"> <view name="Internal Layout">
<bounds x="70" y="10" width="50" height="80" /> <bounds left="5" right="265" top="5" bottom="160" />
</bezel>
<bezel name="digit2" element="digit"> <bezel name="digit0" element="digit"><bounds x="10" y="10" width="50" height="80" /></bezel>
<bounds x="130" y="10" width="50" height="80" /> <bezel name="digit1" element="digit"><bounds x="70" y="10" width="50" height="80" /></bezel>
</bezel> <bezel name="digit2" element="digit"><bounds x="150" y="10" width="50" height="80" /></bezel>
<bezel name="digit3" element="digit"> <bezel name="digit3" element="digit"><bounds x="210" y="10" width="50" height="80" /></bezel>
<bounds x="190" y="10" width="50" height="80" />
</bezel> <bezel name="led0" element="led"><bounds x="10" y="135" width="20" height="20" /></bezel>
<bezel name="led0" element="led"> <bezel name="led1" element="led"><bounds x="240" y="135" width="20" height="20" /></bezel>
<bounds x="10" y="95" width="10" height="10" />
</bezel> <bezel element="text_schach"><bounds x="10" y="110" width="100" height="20" /></bezel>
<bezel name="led1" element="led"> <bezel element="text_matt"><bounds x="160" y="110" width="100" height="20" /></bezel>
<bounds x="220" y="95" width="10" height="10" />
</bezel>
<bezel name="schach_str" element="schach">
<bounds x="20" y="95" width="40" height="10" />
</bezel>
<bezel name="matt_str" element="matt">
<bounds x="185" y="95" width="40" height="10" />
</bezel>
</view> </view>
</mamelayout> </mamelayout>