From b230ac240fbdf6cfe89b27b3d644440eb2d35377 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 14 Mar 2020 18:19:14 +0100 Subject: New working machines -------------------- President Chess [hap, Berger] --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/novag_supremo.cpp | 8 +- src/mame/drivers/saitek_president.cpp | 237 ++++++++++++++++++ src/mame/layout/saitek_president.lay | 452 ++++++++++++++++++++++++++++++++++ src/mame/mame.lst | 5 +- src/mame/mess.flt | 1 + 6 files changed, 699 insertions(+), 5 deletions(-) create mode 100644 src/mame/drivers/saitek_president.cpp create mode 100644 src/mame/layout/saitek_president.lay diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 4e4e8cd51ad..20722dd928a 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3275,6 +3275,7 @@ files { MAME_DIR .. "src/mame/drivers/saitek_cp2000.cpp", MAME_DIR .. "src/mame/drivers/saitek_delta1.cpp", MAME_DIR .. "src/mame/drivers/saitek_mark5.cpp", + MAME_DIR .. "src/mame/drivers/saitek_president.cpp", MAME_DIR .. "src/mame/drivers/saitek_risc2500.cpp", MAME_DIR .. "src/mame/includes/saitek_stratos.h", MAME_DIR .. "src/mame/drivers/saitek_ssystem3.cpp", diff --git a/src/mame/drivers/novag_supremo.cpp b/src/mame/drivers/novag_supremo.cpp index dcbdcb0ad93..eac5a2aef61 100644 --- a/src/mame/drivers/novag_supremo.cpp +++ b/src/mame/drivers/novag_supremo.cpp @@ -16,8 +16,8 @@ Supremo also had a "limited edition" rerelease in 1990, plastic is fake-wood instead of black, otherwise it's the same game. TODO: -- does not work, most likely due to incomplete cpu emulation - (extra I/O ports, unemulated timer registers) +- does not work, most likely due to incomplete cpu emulation (unemulated timer registers) +- is 1988 version the same ROM? ******************************************************************************/ @@ -78,7 +78,7 @@ void supremo_state::machine_start() void supremo_state::main_map(address_map &map) { - map(0x0000, 0x000e).m(m_maincpu, FUNC(hd6303y_cpu_device::m6801_io)); + map(0x0000, 0x0027).m(m_maincpu, FUNC(hd6303y_cpu_device::hd6301y_io)); map(0x0040, 0x013f).ram(); // internal map(0x4000, 0x47ff).ram(); map(0x8000, 0xffff).rom(); @@ -135,5 +135,5 @@ ROM_END ******************************************************************************/ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS -CONS( 1988, supremo, 0, 0, supremo, supremo, supremo_state, empty_init, "Novag", "Supremo", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +CONS( 1990, supremo, 0, 0, supremo, supremo, supremo_state, empty_init, "Novag", "Supremo - Limited Edition", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/saitek_president.cpp b/src/mame/drivers/saitek_president.cpp new file mode 100644 index 00000000000..91208dd4c23 --- /dev/null +++ b/src/mame/drivers/saitek_president.cpp @@ -0,0 +1,237 @@ +// license:BSD-3-Clause +// copyright-holders:hap +// thanks-to:Berger +/****************************************************************************** + +SciSys President Chess (model 231) + +The ROMs are inside a module, at the top-right. No known upgrades were released. +Apparently the chessboard was not that reliable. The manual even says to flip the +computer and shake it when one of the reed sensors is malfunctioning. + +Hardware notes: +- 6502A @ 2MHz +- 16KB ROM(2*HN482764G), 2KB RAM(HM6116P-4) +- 64+12 leds, magnet sensors chessboard + +TODO: +- verify CPU speed / XTAL +- measure interrupt frequency +- the manual claims that it does a self-test at boot, but on MAME that only + happens if you hold down one of the buttons + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/sensorboard.h" +#include "sound/dac.h" +#include "sound/volt_reg.h" +#include "video/pwm.h" +#include "speaker.h" + +// internal artwork +#include "saitek_president.lh" // clickable + + +namespace { + +class president_state : public driver_device +{ +public: + president_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_board(*this, "board"), + m_display(*this, "display"), + m_dac(*this, "dac"), + m_inputs(*this, "IN.%u", 0) + { } + + // machine configs + void prschess(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + // devices/pointers + required_device m_maincpu; + required_device m_board; + required_device m_display; + required_device m_dac; + required_ioport_array<3> m_inputs; + + // address maps + void main_map(address_map &map); + + // I/O handlers + void update_display(); + DECLARE_WRITE8_MEMBER(leds0_w); + DECLARE_WRITE8_MEMBER(leds1_w); + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_READ8_MEMBER(input_r); + + u8 m_inp_mux = 0; + u8 m_led_data[2] = { 0, 0 }; +}; + +void president_state::machine_start() +{ + save_item(NAME(m_inp_mux)); + save_item(NAME(m_led_data)); +} + + + +/****************************************************************************** + I/O +******************************************************************************/ + +void president_state::update_display() +{ + u16 led_data = m_led_data[1] << 8 | m_led_data[0]; + led_data = bitswap<16>(led_data, 15,14,5,4,3,2,1,0,7,6,13,12,11,10,9,8); + m_display->matrix(1 << m_inp_mux, led_data); +} + +WRITE8_MEMBER(president_state::leds0_w) +{ + m_led_data[0] = ~data; + update_display(); +} + +WRITE8_MEMBER(president_state::leds1_w) +{ + m_led_data[1] = ~data; + update_display(); +} + +WRITE8_MEMBER(president_state::control_w) +{ + // d0-d3: input mux, led select + m_inp_mux = data & 0xf; + update_display(); + + // d5: speaker out + m_dac->write(BIT(data, 5)); + + // other: ? +} + +READ8_MEMBER(president_state::input_r) +{ + u8 data = 0; + + // read chessboard sensors + if (m_inp_mux < 8) + data = m_board->read_file(m_inp_mux); + + // read other buttons + else if (m_inp_mux < 11) + data = m_inputs[m_inp_mux - 8]->read(); + + return data; +} + + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +void president_state::main_map(address_map &map) +{ + map(0x0000, 0x07ff).ram(); + map(0x4000, 0x4000).w(FUNC(president_state::leds0_w)); + map(0x4100, 0x4100).w(FUNC(president_state::leds1_w)); + map(0x4200, 0x4200).w(FUNC(president_state::control_w)); + map(0x4300, 0x4300).r(FUNC(president_state::input_r)); + map(0xc000, 0xffff).rom(); +} + + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +static INPUT_PORTS_START( prschess ) + PORT_START("IN.0") + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("Interrupt") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Move") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Take Back") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Hint") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Legal") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("Level") + + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Player V Computer") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Player V Player") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Change Sides") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Clear Board") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Verify / Set Up") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("White") + + PORT_START("IN.2") + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Pawn") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Knight") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Bishop") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Rook") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Queen") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("King") +INPUT_PORTS_END + + + +/****************************************************************************** + Machine Configs +******************************************************************************/ + +void president_state::prschess(machine_config &config) +{ + /* basic machine hardware */ + M6502(config, m_maincpu, 2000000); + m_maincpu->set_addrmap(AS_PROGRAM, &president_state::main_map); + m_maincpu->set_periodic_int(FUNC(president_state::nmi_line_pulse), attotime::from_hz(100)); // guessed + + 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)); + + /* video hardware */ + PWM_DISPLAY(config, m_display).set_size(8+1, 16); + config.set_default_layout(layout_saitek_president); + + /* sound hardware */ + 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); +} + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START( prschess ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("y03_rl", 0xc000, 0x2000, CRC(862c3f42) SHA1(e2d2f1d7a0382b0774e86ca83e270dab1df700c2) ) // HN482764G + ROM_LOAD("y03_rh", 0xe000, 0x2000, CRC(ef95cb9f) SHA1(02f763cf9cab1b4be8964ddb5d93efb05a898123) ) // " +ROM_END + +} // anonymous namespace + + + +/****************************************************************************** + Drivers +******************************************************************************/ + +// YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS +CONS( 1982, prschess, 0, 0, prschess, prschess, president_state, empty_init, "SciSys", "President Chess", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/layout/saitek_president.lay b/src/mame/layout/saitek_president.lay new file mode 100644 index 00000000000..c938e7243b8 --- /dev/null +++ b/src/mame/layout/saitek_president.lay @@ -0,0 +1,452 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/mame.lst b/src/mame/mame.lst index f747dffaae4..ebb48ea4d0e 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -10502,7 +10502,7 @@ cmpchess cncchess @source:compmahj.cpp -compmahj // 1987 Nintendo Computer Mahjong +compmahj // 1983 Nintendo Computer Mah-jong Yakuman @source:compucolor.cpp compclr2 // @@ -34977,6 +34977,9 @@ ccdelta1 // ccmk5 ccmk6 +@source:saitek_president.cpp +prschess + @source:saitek_risc2500.cpp risc2500 // risc2500a // diff --git a/src/mame/mess.flt b/src/mame/mess.flt index 663982916b0..cf280103527 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -767,6 +767,7 @@ saitek_corona.cpp saitek_cp2000.cpp saitek_delta1.cpp saitek_mark5.cpp +saitek_president.cpp saitek_risc2500.cpp saitek_ssystem3.cpp saitek_stratos.cpp -- cgit v1.2.3