diff options
Diffstat (limited to 'src/mame/drivers/scisys_chesstrv.cpp')
-rw-r--r-- | src/mame/drivers/scisys_chesstrv.cpp | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/src/mame/drivers/scisys_chesstrv.cpp b/src/mame/drivers/scisys_chesstrv.cpp index ad2f415a699..bc34f9457c9 100644 --- a/src/mame/drivers/scisys_chesstrv.cpp +++ b/src/mame/drivers/scisys_chesstrv.cpp @@ -5,6 +5,7 @@ SciSys Chess Traveler +Hardware notes: - Fairchild 3870 MCU, label SL90387 (does not use the timer or irq at all) - 256 bytes RAM(3539) - 4-digit 7seg led panel @@ -21,7 +22,8 @@ digit DP lights up). #include "emu.h" #include "cpu/f8/f8.h" #include "machine/f3853.h" -#include "machine/timer.h" +#include "video/pwm.h" +#include "machine/sensorboard.h" // internal artwork #include "scisys_chesstrv.lh" // clickable @@ -35,9 +37,8 @@ public: chesstrv_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_keypad(*this, "LINE%u", 1U), - m_delay_display(*this, "delay_display_%u", 0), - m_out_digit(*this, "digit%u", 0U) + m_display(*this, "display"), + m_inputs(*this, "IN.%u", 0) { } void chesstrv(machine_config &config); @@ -48,15 +49,13 @@ protected: private: // devices/pointers required_device<cpu_device> m_maincpu; - required_ioport_array<4> m_keypad; - required_device_array<timer_device, 4> m_delay_display; - output_finder<4> m_out_digit; + required_device<pwm_display_device> m_display; + required_ioport_array<4> m_inputs; void chesstrv_mem(address_map &map); void chesstrv_io(address_map &map); - TIMER_DEVICE_CALLBACK_MEMBER(delay_display); - + void update_display(); DECLARE_WRITE8_MEMBER(matrix_w); DECLARE_WRITE8_MEMBER(digit_w); DECLARE_READ8_MEMBER(input_r); @@ -69,23 +68,23 @@ private: std::unique_ptr<u8[]> m_ram; u8 m_ram_address; - u8 m_matrix; + u8 m_inp_mux; + u8 m_7seg_data; }; void chesstrv_state::machine_start() { - // resolve handlers - m_out_digit.resolve(); - // zerofill m_ram = make_unique_clear<u8[]>(0x100); m_ram_address = 0; - m_matrix = 0; + m_inp_mux = 0; + m_7seg_data = 0; // register for savestates save_pointer(NAME(m_ram), 0x100); save_item(NAME(m_ram_address)); - save_item(NAME(m_matrix)); + save_item(NAME(m_inp_mux)); + save_item(NAME(m_7seg_data)); } @@ -96,44 +95,37 @@ void chesstrv_state::machine_start() // F3870 ports -TIMER_DEVICE_CALLBACK_MEMBER(chesstrv_state::delay_display) +void chesstrv_state::update_display() { - // clear digits if inactive - if (BIT(m_matrix, 3 - param)) - m_out_digit[param] = 0; + m_display->matrix(~m_inp_mux, m_7seg_data); } WRITE8_MEMBER(chesstrv_state::digit_w) { - // digit segments, update display here - for (int i = 0; i < 4; i++) - if (!BIT(m_matrix, 3 - i)) - m_out_digit[i] = bitswap<8>(data,0,1,2,3,4,5,6,7) & 0x7f; + // digit segments + m_7seg_data = bitswap<8>(data,0,1,2,3,4,5,6,7) & 0x7f; + update_display(); } WRITE8_MEMBER(chesstrv_state::matrix_w) { // d0-d3: input/digit select (active low) - // they're strobed, so on rising edge, delay them going off to prevent flicker or stuck display - for (int i = 0; i < 4; i++) - if (BIT(~m_matrix & data, 3 - i)) - m_delay_display[i]->adjust(attotime::from_msec(20), i); - - m_matrix = data; + m_inp_mux = data; + update_display(); } READ8_MEMBER(chesstrv_state::input_r) { - u8 data = m_matrix; + u8 data = m_inp_mux; // d0-d3: multiplexed inputs from d4-d7 for (int i = 0; i < 4; i++) - if (BIT(m_matrix, i+4)) - data |= m_keypad[i]->read(); + if (BIT(m_inp_mux, i+4)) + data |= m_inputs[i]->read(); // d4-d7: multiplexed inputs from d0-d3 for (int i = 0; i < 4; i++) - if (m_matrix & m_keypad[i]->read()) + if (m_inp_mux & m_inputs[i]->read()) data |= 1 << (i+4); return data; @@ -165,25 +157,25 @@ void chesstrv_state::chesstrv_io(address_map &map) ******************************************************************************/ static INPUT_PORTS_START( chesstrv ) - PORT_START("LINE1") + PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("A 1 / Pawn") PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("B 2 / Knight") PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("C 3 / Bishop") PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("D 4 / Rook") - PORT_START("LINE2") + PORT_START("IN.1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("E 5 / Queen") PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("F 6 / King") PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("G 7 / White") PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("H 8 / Black") - PORT_START("LINE3") + PORT_START("IN.2") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("LV / CS") // level/clear square PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_NAME("FP") // find position PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_O) PORT_NAME("EP") // enter position PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("CB") // clear board - PORT_START("LINE4") + PORT_START("IN.3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CE") // clear entry PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("MM") // multi move @@ -209,10 +201,13 @@ void chesstrv_state::chesstrv(machine_config &config) psu.read_b().set(FUNC(chesstrv_state::input_r)); psu.write_b().set(FUNC(chesstrv_state::matrix_w)); - /* video hardware */ - for (int i = 0; i < 4; i++) - TIMER(config, m_delay_display[i]).configure_generic(FUNC(chesstrv_state::delay_display)); + // built-in chessboard is not electronic + sensorboard_device &board(SENSORBOARD(config, "board").set_type(sensorboard_device::NOSENSORS)); + board.init_cb().set("board", FUNC(sensorboard_device::preset_chess)); + /* video hardware */ + PWM_DISPLAY(config, m_display).set_size(4, 7); + m_display->set_segmask(0xf, 0x7f); config.set_default_layout(layout_scisys_chesstrv); } |