From fe0db6545c8077cef465dfa52f9124903fcc74e2 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 29 Jun 2019 01:33:55 +0200 Subject: [PATCH] cforte: add chesspieces (nw) --- scripts/target/mame/mess.lua | 2 +- src/mame/drivers/cking_master.cpp | 4 +- src/mame/drivers/cxg_ch2001.cpp | 4 +- src/mame/drivers/novag_cforte.cpp | 172 +++++++---- src/mame/drivers/novag_scon.cpp | 6 +- src/mame/layout/aci_boris.lay | 2 + src/mame/layout/cmpchess.lay | 2 + src/mame/layout/cncchess.lay | 2 + src/mame/layout/novag_cforte.lay | 442 +++++++++++++++++++--------- src/mame/layout/novag_delta1.lay | 2 + src/mame/layout/novag_mk1.lay | 2 + src/mame/layout/novag_mk2.lay | 3 + src/mame/layout/scisys_chesstrv.lay | 50 +++- 13 files changed, 465 insertions(+), 228 deletions(-) diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 91c57e81d36..6f4b0ccf2cd 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1918,7 +1918,6 @@ files { MAME_DIR .. "src/mame/machine/novagbase.cpp", MAME_DIR .. "src/mame/includes/novagbase.h", - MAME_DIR .. "src/mame/drivers/novag_cforte.cpp", MAME_DIR .. "src/mame/drivers/novag_diablo.cpp", MAME_DIR .. "src/mame/drivers/novag_sexpert.cpp", } @@ -2815,6 +2814,7 @@ files { createMESSProjects(_target, _subtarget, "novag") files { + MAME_DIR .. "src/mame/drivers/novag_cforte.cpp", MAME_DIR .. "src/mame/drivers/novag_delta1.cpp", MAME_DIR .. "src/mame/drivers/novag_mk1.cpp", MAME_DIR .. "src/mame/drivers/novag_mk2.cpp", diff --git a/src/mame/drivers/cking_master.cpp b/src/mame/drivers/cking_master.cpp index 1e8f1a6e67f..4f6ceeb3e1b 100644 --- a/src/mame/drivers/cking_master.cpp +++ b/src/mame/drivers/cking_master.cpp @@ -40,9 +40,9 @@ public: master_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_irq_on(*this, "irq_on"), m_display(*this, "display"), m_board(*this, "board"), - m_irq_on(*this, "irq_on"), m_dac(*this, "dac"), m_mainmap(*this, "mainmap"), m_inputs(*this, "IN.%u", 0) @@ -59,9 +59,9 @@ protected: private: // devices/pointers required_device m_maincpu; + required_device m_irq_on; required_device m_display; required_device m_board; - required_device m_irq_on; required_device m_dac; required_device m_mainmap; required_ioport_array<2> m_inputs; diff --git a/src/mame/drivers/cxg_ch2001.cpp b/src/mame/drivers/cxg_ch2001.cpp index 35d3d852625..d7b503ba567 100644 --- a/src/mame/drivers/cxg_ch2001.cpp +++ b/src/mame/drivers/cxg_ch2001.cpp @@ -33,9 +33,9 @@ public: ch2001_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_irq_on(*this, "irq_on"), m_display(*this, "display"), m_board(*this, "board"), - m_irq_on(*this, "irq_on"), m_dac(*this, "dac"), m_speaker_off(*this, "speaker_off"), m_inputs(*this, "IN.%u", 0) @@ -50,9 +50,9 @@ protected: private: // devices/pointers required_device m_maincpu; + required_device m_irq_on; required_device m_display; required_device m_board; - required_device m_irq_on; required_device m_dac; required_device m_speaker_off; required_ioport_array<2> m_inputs; diff --git a/src/mame/drivers/novag_cforte.cpp b/src/mame/drivers/novag_cforte.cpp index de1d488efcc..79c93898b01 100644 --- a/src/mame/drivers/novag_cforte.cpp +++ b/src/mame/drivers/novag_cforte.cpp @@ -3,29 +3,28 @@ // thanks-to:Berger /****************************************************************************** -* novag_cforte.cpp, subdriver of machine/novagbase.cpp, machine/chessbase.cpp +Novag Constellation Forte -TODO: -- RS232 port? - -******************************************************************************* - -Novag Constellation Forte overview: +Hardware notes: - R65C02P4 @ 5MHz (10MHz XTAL) - 2*2KB RAM(NEC D449C-3), 2*32KB ROM(27C256) - HLCD0538P, 10-digit 7seg LCD display - TTL, 18 LEDs, 8*8 chessboard buttons +- ports for optional printer and chess clock I/O is similar to supercon ******************************************************************************/ #include "emu.h" -#include "includes/novagbase.h" #include "cpu/m6502/r65c02.h" +#include "video/pwm.h" +#include "machine/sensorboard.h" #include "machine/nvram.h" +#include "machine/timer.h" #include "video/hlcd0538.h" +#include "sound/beep.h" #include "speaker.h" // internal artwork @@ -34,24 +33,43 @@ I/O is similar to supercon namespace { -class cforte_state : public novagbase_state +class cforte_state : public driver_device { public: cforte_state(const machine_config &mconfig, device_type type, const char *tag) : - novagbase_state(mconfig, type, tag), - m_hlcd0538(*this, "hlcd0538") + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_irq_on(*this, "irq_on"), + m_display(*this, "display"), + m_board(*this, "board"), + m_lcd(*this, "lcd"), + m_beeper(*this, "beeper"), + m_inputs(*this, "IN.%u", 0) { } // machine drivers void cforte(machine_config &config); +protected: + virtual void machine_start() override; + private: // devices/pointers - optional_device m_hlcd0538; + required_device m_maincpu; + required_device m_irq_on; + required_device m_display; + required_device m_board; + required_device m_lcd; + required_device m_beeper; + required_ioport_array<8> m_inputs; // address maps void main_map(address_map &map); + // periodic interrupts + template TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(Line, ASSERT_LINE); } + template TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(Line, CLEAR_LINE); } + // I/O handlers void update_display(); DECLARE_WRITE64_MEMBER(lcd_output_w); @@ -59,8 +77,23 @@ private: DECLARE_WRITE8_MEMBER(control_w); DECLARE_READ8_MEMBER(input1_r); DECLARE_READ8_MEMBER(input2_r); + + u8 m_inp_mux; + u8 m_led_select; }; +void cforte_state::machine_start() +{ + // zerofill + m_inp_mux = 0; + m_led_select = 0; + + // register for savestates + save_item(NAME(m_inp_mux)); + save_item(NAME(m_led_select)); +} + + /****************************************************************************** Devices, I/O @@ -68,17 +101,6 @@ private: // TTL/generic -void cforte_state::update_display() -{ - // 3 led rows - display_matrix(8, 3, m_led_data, m_led_select, false); - - // lcd panel (mostly handled in lcd_output_w) - set_display_segmask(0x3ff0, 0xff); - set_display_size(8, 3+13); - display_update(); -} - WRITE64_MEMBER(cforte_state::lcd_output_w) { // 4 rows used @@ -89,20 +111,27 @@ WRITE64_MEMBER(cforte_state::lcd_output_w) // 2 segments per row for (int dig = 0; dig < 13; dig++) { - m_display_state[dig+3] = 0; + data = 0; for (int i = 0; i < 4; i++) - m_display_state[dig+3] |= ((rowdata[i] >> (2*dig) & 3) << (2*i)); + data |= ((rowdata[i] >> (2*dig) & 3) << (2*i)); - m_display_state[dig+3] = bitswap<8>(m_display_state[dig+3],7,2,0,4,6,5,3,1); + data = bitswap<8>(data,7,2,0,4,6,5,3,1); + m_display->write_row(dig+3, data); } - update_display(); + m_display->update(); +} + +void cforte_state::update_display() +{ + // 3 led rows + m_display->matrix_partial(0, 3, m_led_select, m_inp_mux); } WRITE8_MEMBER(cforte_state::mux_w) { // d0-d7: input mux, led data - m_inp_mux = m_led_data = data; + m_inp_mux = data; update_display(); } @@ -111,9 +140,9 @@ WRITE8_MEMBER(cforte_state::control_w) // d0: HLCD0538 data in // d1: HLCD0538 clk // d2: HLCD0538 lcd - m_hlcd0538->data_w(data & 1); - m_hlcd0538->clk_w(data >> 1 & 1); - m_hlcd0538->lcd_w(data >> 2 & 1); + m_lcd->data_w(data & 1); + m_lcd->clk_w(data >> 1 & 1); + m_lcd->lcd_w(data >> 2 & 1); // d3: unused? @@ -127,15 +156,27 @@ WRITE8_MEMBER(cforte_state::control_w) READ8_MEMBER(cforte_state::input1_r) { + u8 data = 0; + // d0-d7: multiplexed inputs (chessboard squares) - return ~read_inputs(8) & 0xff; + for (int i = 0; i < 8; i++) + if (BIT(m_inp_mux, i)) + data |= m_board->read_rank(i ^ 7, true); + + return ~data; } READ8_MEMBER(cforte_state::input2_r) { + u8 data = 0; + // d0-d5: ? // d6,d7: multiplexed inputs (side panel) - return (read_inputs(8) >> 2 & 0xc0) ^ 0xff; + for (int i = 0; i < 8; i++) + if (BIT(m_inp_mux, i)) + data |= m_inputs[i]->read() << 6; + + return ~data; } @@ -161,39 +202,37 @@ void cforte_state::main_map(address_map &map) ******************************************************************************/ static INPUT_PORTS_START( cforte ) - PORT_INCLUDE( generic_cb_buttons ) + PORT_START("IN.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("New Game") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Player/Player / Gambit/Large / King") - PORT_MODIFY("IN.0") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("New Game") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Player/Player / Gambit/Large / King") + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_NAME("Verify/Set Up / Pro-Op") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Random/Tour/Normal / Training Level / Queen") - PORT_MODIFY("IN.1") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_NAME("Verify/Set Up / Pro-Op") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Random/Tour/Normal / Training Level / Queen") + PORT_START("IN.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Change Color / Time Control / Priority") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Sound / Depth Search / Bishop") - PORT_MODIFY("IN.2") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Change Color / Time Control / Priority") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Sound / Depth Search / Bishop") + PORT_START("IN.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Flip Display / Clear Board / Clear Book") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Solve Mate / Infinite / Knight") - PORT_MODIFY("IN.3") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Flip Display / Clear Board / Clear Book") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Solve Mate / Infinite / Knight") + PORT_START("IN.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Print Moves / Print Evaluations / Print Book") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Print Board / Interface / Rook") - PORT_MODIFY("IN.4") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Print Moves / Print Evaluations / Print Book") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Print Board / Interface / Rook") + PORT_START("IN.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Trace Forward / Auto Play / No/End") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Print List / Acc. Time / Pawn") - PORT_MODIFY("IN.5") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Trace Forward / Auto Play / No/End") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Print List / Acc. Time / Pawn") + PORT_START("IN.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Hint / Next Best / Yes/Start") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Set Level") - PORT_MODIFY("IN.6") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Hint / Next Best / Yes/Start") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Set Level") - - PORT_MODIFY("IN.7") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Go / ->") - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Take Back / Restore / <-") + PORT_START("IN.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Go / ->") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Take Back / Restore / <-") INPUT_PORTS_END @@ -215,11 +254,14 @@ void cforte_state::cforte(machine_config &config) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); - /* video hardware */ - HLCD0538(config, m_hlcd0538); - m_hlcd0538->write_cols().set(FUNC(cforte_state::lcd_output_w)); + 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(200)); - TIMER(config, "display_decay").configure_periodic(FUNC(cforte_state::display_decay_tick), attotime::from_msec(1)); + /* video hardware */ + HLCD0538(config, m_lcd).write_cols().set(FUNC(cforte_state::lcd_output_w)); + PWM_DISPLAY(config, m_display).set_size(3+13, 8); + m_display->set_segmask(0x3ff0, 0xff); config.set_default_layout(layout_novag_cforte); /* sound hardware */ @@ -255,5 +297,5 @@ ROM_END ******************************************************************************/ // YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS -CONS( 1986, cfortea, 0, 0, cforte, cforte, cforte_state, empty_init, "Novag", "Constellation Forte (version A)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_IMPERFECT_CONTROLS ) -CONS( 1986, cforteb, cfortea, 0, cforte, cforte, cforte_state, empty_init, "Novag", "Constellation Forte (version B)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_IMPERFECT_CONTROLS ) +CONS( 1986, cfortea, 0, 0, cforte, cforte, cforte_state, empty_init, "Novag", "Constellation Forte (version A)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1986, cforteb, cfortea, 0, cforte, cforte, cforte_state, empty_init, "Novag", "Constellation Forte (version B)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/novag_scon.cpp b/src/mame/drivers/novag_scon.cpp index 174d98a2660..0c38de59f3b 100644 --- a/src/mame/drivers/novag_scon.cpp +++ b/src/mame/drivers/novag_scon.cpp @@ -5,7 +5,7 @@ Novag Super Constellation Chess Computer (model 844) Hardware notes: -- UMC UM6502C @ 4 MHz (8MHz XTAL), 600Hz? IRQ(source unknown?) +- UMC UM6502C @ 4 MHz (8MHz XTAL), 512Hz? IRQ(source unknown?) - 2*2KB RAM TC5516APL-2 battery-backed, 2*32KB ROM custom label - TTL, buzzer, 24 LEDs, 8*8 chessboard buttons - external ports for clock and printer, not emulated here @@ -203,13 +203,13 @@ void scon_state::scon(machine_config &config) /* basic machine hardware */ M6502(config, m_maincpu, 8_MHz_XTAL/2); // UM6502C m_maincpu->set_addrmap(AS_PROGRAM, &scon_state::main_map); - m_maincpu->set_periodic_int(FUNC(scon_state::irq0_line_hold), attotime::from_hz(600)); // guessed + m_maincpu->set_periodic_int(FUNC(scon_state::irq0_line_hold), attotime::from_hz(512)); // guessed NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); 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_delay(attotime::from_msec(200)); /* video hardware */ PWM_DISPLAY(config, m_display).set_size(3, 8); diff --git a/src/mame/layout/aci_boris.lay b/src/mame/layout/aci_boris.lay index d96e325c0b9..91c027496a1 100644 --- a/src/mame/layout/aci_boris.lay +++ b/src/mame/layout/aci_boris.lay @@ -1,6 +1,8 @@ + + diff --git a/src/mame/layout/cmpchess.lay b/src/mame/layout/cmpchess.lay index 3cd4abb44ec..63fee7cc253 100644 --- a/src/mame/layout/cmpchess.lay +++ b/src/mame/layout/cmpchess.lay @@ -1,6 +1,8 @@ + + diff --git a/src/mame/layout/cncchess.lay b/src/mame/layout/cncchess.lay index 432c6146365..25a05b5f8f6 100644 --- a/src/mame/layout/cncchess.lay +++ b/src/mame/layout/cncchess.lay @@ -1,6 +1,8 @@ + + diff --git a/src/mame/layout/novag_cforte.lay b/src/mame/layout/novag_cforte.lay index ec82af339dd..1116cfd9c18 100644 --- a/src/mame/layout/novag_cforte.lay +++ b/src/mame/layout/novag_cforte.lay @@ -4,6 +4,8 @@ + + @@ -49,9 +51,6 @@ - - - @@ -166,10 +165,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + @@ -211,125 +494,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -388,23 +552,23 @@ - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/src/mame/layout/novag_delta1.lay b/src/mame/layout/novag_delta1.lay index 43268e1da9c..68b110ed6df 100644 --- a/src/mame/layout/novag_delta1.lay +++ b/src/mame/layout/novag_delta1.lay @@ -1,6 +1,8 @@ + + diff --git a/src/mame/layout/novag_mk1.lay b/src/mame/layout/novag_mk1.lay index 301f9cde1e3..d42b84108f6 100644 --- a/src/mame/layout/novag_mk1.lay +++ b/src/mame/layout/novag_mk1.lay @@ -1,6 +1,8 @@ + + diff --git a/src/mame/layout/novag_mk2.lay b/src/mame/layout/novag_mk2.lay index cf5b3fd7878..67a243b285a 100644 --- a/src/mame/layout/novag_mk2.lay +++ b/src/mame/layout/novag_mk2.lay @@ -1,5 +1,8 @@ + + + diff --git a/src/mame/layout/scisys_chesstrv.lay b/src/mame/layout/scisys_chesstrv.lay index e41a73519c5..d3c7c0f7337 100644 --- a/src/mame/layout/scisys_chesstrv.lay +++ b/src/mame/layout/scisys_chesstrv.lay @@ -398,7 +398,7 @@ - + @@ -475,23 +475,18 @@ - + - - - - - - - - - - - - - - + + + + + + + + + @@ -544,6 +539,29 @@ + + + + + + + + + + + + + + + + + + + + + + +