diff options
Diffstat (limited to 'src/mame/drivers/novag_cforte.cpp')
-rw-r--r-- | src/mame/drivers/novag_cforte.cpp | 172 |
1 files changed, 107 insertions, 65 deletions
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<hlcd0538_device> m_hlcd0538; + required_device<cpu_device> m_maincpu; + required_device<timer_device> m_irq_on; + required_device<pwm_display_device> m_display; + required_device<sensorboard_device> m_board; + required_device<hlcd0538_device> m_lcd; + required_device<beep_device> m_beeper; + required_ioport_array<8> m_inputs; // address maps void main_map(address_map &map); + // periodic interrupts + template<int Line> TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(Line, ASSERT_LINE); } + template<int Line> 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 ) |