diff --git a/src/mame/drivers/cxg_dominator.cpp b/src/mame/drivers/cxg_dominator.cpp index 166aae962da..ff1e72eb1f3 100644 --- a/src/mame/drivers/cxg_dominator.cpp +++ b/src/mame/drivers/cxg_dominator.cpp @@ -160,7 +160,7 @@ void dominator_state::main_map(address_map &map) map(0x0000, 0x1fff).ram().share("nvram"); map(0x4000, 0x400f).rw(FUNC(dominator_state::input_r), FUNC(dominator_state::leds_w)); map(0x4010, 0x4010).w(FUNC(dominator_state::control_w)); - //map(0x7f00, 0x7fff).nopr(); // mid-opcode dummy read + map(0x7f00, 0x7fff).nopr(); // dummy read on 6502 absolute X page wrap map(0x8000, 0xffff).rom(); } diff --git a/src/mame/drivers/fidel_desdis.cpp b/src/mame/drivers/fidel_desdis.cpp index cbe105e2dca..545d40ebbb2 100644 --- a/src/mame/drivers/fidel_desdis.cpp +++ b/src/mame/drivers/fidel_desdis.cpp @@ -96,12 +96,13 @@ protected: template TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(Line, CLEAR_LINE); } // I/O handlers + void update_lcd(); virtual DECLARE_WRITE8_MEMBER(control_w); virtual DECLARE_WRITE8_MEMBER(lcd_w); virtual DECLARE_READ8_MEMBER(input_r); - u8 m_select; - u32 m_lcd_data; + u8 m_select = 0; + u32 m_lcd_data = 0; }; void desdis_state::init_fdes2100d() @@ -111,10 +112,6 @@ void desdis_state::init_fdes2100d() void desdis_state::machine_start() { - // zerofill - m_select = 0; - m_lcd_data = 0; - // register for savestates save_item(NAME(m_select)); save_item(NAME(m_lcd_data)); @@ -140,9 +137,8 @@ private: void fdes2265_map(address_map &map); void fdes2325_map(address_map &map); - // I/O handlers, slightly different (control_w is d0 instead of d7, lcd_w is inverted) + // I/O handlers, slightly different (control_w is d0 instead of d7) virtual DECLARE_WRITE8_MEMBER(control_w) override { desdis_state::control_w(space, offset, data << 7); } - virtual DECLARE_WRITE8_MEMBER(lcd_w) override { desdis_state::lcd_w(space, offset, ~data); } }; void desmas_state::init_fdes2265() @@ -169,10 +165,17 @@ void desmas_state::init_fdes2265() // TTL/generic +void desdis_state::update_lcd() +{ + u8 mask = (m_select & 8) ? 0 : 0xff; + for (int i = 0; i < 4; i++) + m_display->write_row(i+2, (m_lcd_data >> (8*i) & 0xff) ^ mask); + + m_display->update(); +} + WRITE8_MEMBER(desdis_state::control_w) { - u8 q3_old = m_select & 8; - // a0-a2,d7: 74259 u8 mask = 1 << offset; m_select = (m_select & ~mask) | ((data & 0x80) ? mask : 0); @@ -192,13 +195,8 @@ WRITE8_MEMBER(desdis_state::control_w) if (m_rombank != nullptr) m_rombank->set_entry(~m_select >> 2 & 1); - // 74259 Q3: lcd common, update on rising edge - if (~q3_old & m_select & 8) - { - for (int i = 0; i < 4; i++) - m_display->write_row(i+2, m_lcd_data >> (8*i) & 0xff); - } - m_display->update(); + // 74259 Q3: lcd polarity + update_lcd(); } WRITE8_MEMBER(desdis_state::lcd_w) @@ -210,6 +208,8 @@ WRITE8_MEMBER(desdis_state::lcd_w) m_lcd_data = (m_lcd_data & ~mask) | ((data >> i & 1) ? 0 : mask); mask <<= 8; } + + update_lcd(); } READ8_MEMBER(desdis_state::input_r) diff --git a/src/mame/drivers/fidel_phantom.cpp b/src/mame/drivers/fidel_phantom.cpp index 60f549c4a92..edba60f4f0d 100644 --- a/src/mame/drivers/fidel_phantom.cpp +++ b/src/mame/drivers/fidel_phantom.cpp @@ -76,12 +76,10 @@ private: void main_map(address_map &map); TIMER_DEVICE_CALLBACK_MEMBER(motors_timer); - DECLARE_WRITE8_MEMBER(mux_w); + void update_lcd(); + DECLARE_WRITE8_MEMBER(control_w); DECLARE_WRITE8_MEMBER(lcd_w); - DECLARE_WRITE8_MEMBER(lcd_mask_w); DECLARE_WRITE8_MEMBER(motors_w); - DECLARE_WRITE8_MEMBER(led_w); - DECLARE_WRITE8_MEMBER(rombank_w); DECLARE_READ8_MEMBER(input_r); DECLARE_READ8_MEMBER(motors_r); DECLARE_READ8_MEMBER(irq_ack_r); @@ -89,8 +87,7 @@ private: DECLARE_READ8_MEMBER(vmotor_ff_clear_r); void update_pieces_position(int state); - uint8_t m_mux; - uint8_t m_lcd_mask; + uint8_t m_select; uint32_t m_lcd_data; uint8_t m_motors_ctrl; uint8_t m_hmotor_pos; @@ -108,8 +105,7 @@ void phantom_state::machine_start() { m_out_motor.resolve(); - save_item(NAME(m_mux)); - save_item(NAME(m_lcd_mask)); + save_item(NAME(m_select)); save_item(NAME(m_lcd_data)); save_item(NAME(m_motors_ctrl)); save_item(NAME(m_hmotor_pos)); @@ -125,8 +121,7 @@ void phantom_state::machine_start() void phantom_state::machine_reset() { - m_mux = 0; - m_lcd_mask = 0; + m_select = 0; m_lcd_data = 0; m_motors_ctrl = 0; m_hmotor_pos = 0xff; @@ -148,6 +143,10 @@ void phantom_state::init_fphantom() } +/****************************************************************************** + Motor Sim +******************************************************************************/ + TIMER_DEVICE_CALLBACK_MEMBER(phantom_state::motors_timer) { if (m_motors_ctrl & 0x03) m_vmotor_sensor0_ff = true; @@ -212,25 +211,31 @@ void phantom_state::update_pieces_position(int state) I/O ******************************************************************************/ -WRITE8_MEMBER(phantom_state::mux_w) +void phantom_state::update_lcd() { + u8 mask = (m_select & 0x80) ? 0xff : 0; + for (int i = 0; i < 4; i++) + m_display->write_row(i+2, (m_lcd_data >> (8*i) & 0xff) ^ mask); + + m_display->update(); +} + +WRITE8_MEMBER(phantom_state::control_w) +{ + // a0-a2,d1: 74259 uint8_t mask = 1 << offset; - m_mux = (m_mux & ~mask) | ((data & 0x02) ? mask : 0); -} + m_select = (m_select & ~mask) | ((data & 0x02) ? mask : 0); -WRITE8_MEMBER(phantom_state::lcd_mask_w) -{ - m_lcd_mask = (data & 0x02) ? 0x00 : 0xff; -} + // 74259 Q0-Q3: 7442 a0-a3 + // 7442 0-8: led data, input mux + // 74259 Q4: led select + m_display->matrix_partial(0, 1, BIT(~m_select, 4), 1 << (m_select & 0xf), false); -WRITE8_MEMBER(phantom_state::led_w) -{ - m_display->matrix_partial(0, 2, 1, BIT(~data, 7) << m_mux); -} + // 74259 Q6: bookrom bank + m_rombank->set_entry(BIT(m_select, 6)); -WRITE8_MEMBER(phantom_state::rombank_w) -{ - m_rombank->set_entry(data & 1); + // 74259 Q7: lcd polarity + update_lcd(); } WRITE8_MEMBER(phantom_state::motors_w) @@ -254,38 +259,36 @@ WRITE8_MEMBER(phantom_state::motors_w) WRITE8_MEMBER(phantom_state::lcd_w) { - data ^= m_lcd_mask; - + // a0-a2,d0,d2,d4,d6: 4*74259 to lcd digit segments u32 mask = bitswap<8>(1 << offset,3,7,6,0,1,2,4,5); for (int i = 0; i < 4; i++) { m_lcd_data = (m_lcd_data & ~mask) | (BIT(data, i * 2) ? mask : 0); mask <<= 8; - - m_display->write_row(i+2, m_lcd_data >> (8*i) & 0xff); } - m_display->update(); + update_lcd(); } READ8_MEMBER(phantom_state::input_r) { + uint8_t mux = m_select & 0xf; uint8_t data = 0xff; - if (m_mux == 8) + if (mux == 8) { if (BIT(m_input->read(), offset * 2 + 1)) data &= ~0x40; if (BIT(m_input->read(), offset * 2 + 0)) data &= ~0x80; } else if (offset < 4) { - if (BIT(m_board->read_file(offset * 2 + 1), m_mux)) data &= ~0x40; - if (BIT(m_board->read_file(offset * 2 + 0), m_mux)) data &= ~0x80; + if (BIT(m_board->read_file(offset * 2 + 1), mux)) data &= ~0x40; + if (BIT(m_board->read_file(offset * 2 + 0), mux)) data &= ~0x80; } else { - if (BIT(m_board->read_file( 8 + (offset & 1)), m_mux)) data &= ~0x40; // black captured pieces - if (BIT(m_board->read_file(11 - (offset & 1)), m_mux)) data &= ~0x80; // white captured pieces + if (BIT(m_board->read_file( 8 + (offset & 1)), mux)) data &= ~0x40; // black captured pieces + if (BIT(m_board->read_file(11 - (offset & 1)), mux)) data &= ~0x80; // white captured pieces } return data; @@ -341,10 +344,7 @@ READ8_MEMBER(phantom_state::vmotor_ff_clear_r) void phantom_state::main_map(address_map &map) { map(0x0000, 0x1fff).ram(); - map(0x2000, 0x2003).w(FUNC(phantom_state::mux_w)); - map(0x2004, 0x2004).w(FUNC(phantom_state::led_w)); - map(0x2006, 0x2006).w(FUNC(phantom_state::rombank_w)); - map(0x20ff, 0x20ff).w(FUNC(phantom_state::lcd_mask_w)); + map(0x2000, 0x2007).mirror(0x00f8).w(FUNC(phantom_state::control_w)); map(0x2100, 0x2107).w(FUNC(phantom_state::lcd_w)).nopr(); map(0x2200, 0x2200).w(FUNC(phantom_state::motors_w)); map(0x2400, 0x2405).r(FUNC(phantom_state::input_r)); @@ -399,8 +399,8 @@ void phantom_state::fphantom(machine_config &config) TIMER(config, "motors_timer").configure_periodic(FUNC(phantom_state::motors_timer), attotime::from_hz(120)); /* video hardware */ - PWM_DISPLAY(config, m_display).set_size(2+4, 9); - m_display->set_segmask(0x3c, 0x7f); + PWM_DISPLAY(config, m_display).set_size(1+4, 9); + m_display->set_segmask(0x1e, 0x7f); config.set_default_layout(layout_fidel_phantom); diff --git a/src/mame/drivers/mephisto_modena.cpp b/src/mame/drivers/mephisto_modena.cpp index 6a067126691..4dd0f90f106 100644 --- a/src/mame/drivers/mephisto_modena.cpp +++ b/src/mame/drivers/mephisto_modena.cpp @@ -13,10 +13,11 @@ Hold Pawn + Knight buttons at boot for test mode. #include "cpu/m6502/m65c02.h" #include "machine/nvram.h" -#include "machine/mmboard.h" +#include "machine/sensorboard.h" #include "machine/timer.h" #include "sound/dac.h" #include "sound/volt_reg.h" +#include "video/pwm.h" #include "speaker.h" @@ -30,25 +31,24 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_board(*this, "board") + , m_display(*this, "display") , m_dac(*this, "dac") , m_keys(*this, "KEY") , m_digits(*this, "digit%u", 0U) - , m_leds(*this, "led%u.%u", 0U, 0U) { } void modena(machine_config &config); protected: - virtual void machine_reset() override; virtual void machine_start() override; private: required_device m_maincpu; - required_device m_board; + required_device m_board; + required_device m_display; required_device m_dac; required_ioport m_keys; output_finder<4> m_digits; - output_finder<3, 8> m_leds; void modena_mem(address_map &map); @@ -56,10 +56,12 @@ private: DECLARE_WRITE8_MEMBER(digits_w); DECLARE_WRITE8_MEMBER(io_w); DECLARE_WRITE8_MEMBER(led_w); + void update_display(); TIMER_DEVICE_CALLBACK_MEMBER(nmi_on) { m_maincpu->set_input_line(M6502_NMI_LINE, ASSERT_LINE); } TIMER_DEVICE_CALLBACK_MEMBER(nmi_off) { m_maincpu->set_input_line(M6502_NMI_LINE, CLEAR_LINE); } + uint8_t m_board_mux = 0xff; uint8_t m_digits_idx = 0; uint8_t m_io_ctrl = 0; }; @@ -67,49 +69,53 @@ private: void mephisto_modena_state::machine_start() { m_digits.resolve(); - m_leds.resolve(); save_item(NAME(m_digits_idx)); save_item(NAME(m_io_ctrl)); } -void mephisto_modena_state::machine_reset() -{ - m_digits_idx = 0; - m_io_ctrl = 0; -} - /****************************************************************************** I/O ******************************************************************************/ +void mephisto_modena_state::update_display() +{ + m_display->matrix(m_io_ctrl >> 1 & 7, ~m_board_mux); +} + READ8_MEMBER(mephisto_modena_state::input_r) { - if (m_board->mux_r() == 0xff) - return m_keys->read(); - else - return m_board->input_r() ^ 0xff; + uint8_t data = 0; + + // read buttons + if (~m_io_ctrl & 1) + data |= m_keys->read(); + + // read chessboard sensors + for (int i=0; i<8; i++) + if (!BIT(m_board_mux, i)) + data |= m_board->read_rank(i); + + return data; } WRITE8_MEMBER(mephisto_modena_state::led_w) { - m_board->mux_w(data); - - for (int sel = 0; sel < 3; sel++) - { - if (BIT(m_io_ctrl, sel+1)) - { - for (int i = 0; i < 8; i++) - m_leds[sel][i] = BIT(data, i) ? 0 : 1; - } - } + // d0-d7: chessboard mux, led data + m_board_mux = data; + update_display(); } WRITE8_MEMBER(mephisto_modena_state::io_w) { + // d0: button select + // d1-d3: led select + // d4: lcd polarity + // d6: speaker out m_io_ctrl = data; + update_display(); m_dac->write(BIT(data, 6)); } @@ -131,7 +137,8 @@ void mephisto_modena_state::modena_mem(address_map &map) map(0x4000, 0x4000).w(FUNC(mephisto_modena_state::digits_w)); map(0x5000, 0x5000).w(FUNC(mephisto_modena_state::led_w)); map(0x6000, 0x6000).w(FUNC(mephisto_modena_state::io_w)); - map(0x7000, 0x7fff).r(FUNC(mephisto_modena_state::input_r)); + map(0x7000, 0x7000).r(FUNC(mephisto_modena_state::input_r)); + map(0x7f00, 0x7fff).nopr(); // dummy read on 6502 absolute X page wrap map(0x8000, 0xffff).rom().region("maincpu", 0); } @@ -161,6 +168,7 @@ INPUT_PORTS_END void mephisto_modena_state::modena(machine_config &config) { + /* basic machine hardware */ M65C02(config, m_maincpu, XTAL(4'194'304)); // W65C02SP or RP65C02G m_maincpu->set_addrmap(AS_PROGRAM, &mephisto_modena_state::modena_mem); timer_device &nmi_on(TIMER(config, "nmi_on")); @@ -170,8 +178,12 @@ void mephisto_modena_state::modena(machine_config &config) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - MEPHISTO_BUTTONS_BOARD(config, m_board); - m_board->set_disable_leds(true); + 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)); + + /* video hardware */ + PWM_DISPLAY(config, m_display).set_size(3, 8); config.set_default_layout(layout_mephisto_modena); /* sound hardware */ diff --git a/src/mame/drivers/mephisto_mondial68k.cpp b/src/mame/drivers/mephisto_mondial68k.cpp index cd452ffd3d3..4e41ccdaac8 100644 --- a/src/mame/drivers/mephisto_mondial68k.cpp +++ b/src/mame/drivers/mephisto_mondial68k.cpp @@ -15,13 +15,15 @@ Hardware: ***************************************************************************/ #include "emu.h" + #include "cpu/m68000/m68000.h" #include "machine/74259.h" #include "machine/sensorboard.h" -#include "machine/timer.h" #include "sound/dac.h" #include "sound/volt_reg.h" #include "video/pcf2100.h" +#include "video/pwm.h" + #include "speaker.h" // internal artwork @@ -36,17 +38,16 @@ public: , m_maincpu(*this, "maincpu") , m_dac(*this, "dac") , m_board(*this, "board") + , m_display(*this, "display") , m_lcd(*this, "lcd") , m_inputs(*this, "IN.%u", 0) , m_digits(*this, "digit%u", 0U) - , m_leds(*this, "led%u", 0U) { } void mondial68k(machine_config &config); protected: virtual void machine_start() override; - virtual void machine_reset() override; void mondial68k_mem(address_map &map); @@ -54,46 +55,38 @@ protected: DECLARE_WRITE8_MEMBER(input_mux_w); DECLARE_WRITE8_MEMBER(board_mux_w); DECLARE_READ8_MEMBER(inputs_r); - TIMER_DEVICE_CALLBACK_MEMBER(refresh_leds); + void update_display(); required_device m_maincpu; required_device m_dac; required_device m_board; + required_device m_display; required_device m_lcd; required_ioport_array<4> m_inputs; output_finder<4> m_digits; - output_finder<16> m_leds; - uint8_t m_input_mux; - uint8_t m_board_mux; + uint8_t m_input_mux = 0xff; + uint8_t m_board_mux = 0xff; }; void mondial68k_state::machine_start() { m_digits.resolve(); - m_leds.resolve(); save_item(NAME(m_input_mux)); save_item(NAME(m_board_mux)); } -void mondial68k_state::machine_reset() -{ - m_input_mux = 0; - m_board_mux = 0; -} - /****************************************************************************** I/O ******************************************************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(mondial68k_state::refresh_leds) +void mondial68k_state::update_display() { - for (int i=0; i<16; i++) - m_leds[0 + i] = 0; + m_display->matrix(m_input_mux >> 6, ~m_board_mux); } WRITE32_MEMBER(mondial68k_state::lcd_s_w) @@ -105,30 +98,29 @@ WRITE32_MEMBER(mondial68k_state::lcd_s_w) WRITE8_MEMBER(mondial68k_state::board_mux_w) { + // d0-d7: chessboard mux, led data m_board_mux = data; + update_display(); } WRITE8_MEMBER(mondial68k_state::input_mux_w) { + // d0-d3: button mux + // d6,d7: led select m_input_mux = data; - for (int i=0; i<8; i++) - { - if (!BIT(m_board_mux, i)) - { - if (BIT(m_input_mux, 7)) m_leds[0 + i] = 1; - if (BIT(m_input_mux, 6)) m_leds[8 + i] = 1; - } - } + update_display(); } READ8_MEMBER(mondial68k_state::inputs_r) { - if (!(m_input_mux & 0x01)) return m_inputs[0]->read(); - else if (!(m_input_mux & 0x02)) return m_inputs[1]->read(); - else if (!(m_input_mux & 0x04)) return m_inputs[2]->read(); - else if (!(m_input_mux & 0x08)) return m_inputs[3]->read(); - uint8_t data = 0x00; + + // read buttons + for (int i=0; i<4; i++) + if (!BIT(m_input_mux, i)) + data |= m_inputs[i]->read(); + + // read chessboard sensors for (int i=0; i<8; i++) if (!BIT(m_board_mux, i)) data |= m_board->read_rank(i); @@ -211,14 +203,14 @@ void mondial68k_state::mondial68k(machine_config &config) /* video hardware */ PCF2112(config, m_lcd, 50); // frequency guessed m_lcd->write_segs().set(FUNC(mondial68k_state::lcd_s_w)); + + PWM_DISPLAY(config, m_display).set_size(2, 8); config.set_default_layout(layout_mephisto_mondial68k); /* 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); - - TIMER(config, "refresh_leds").configure_periodic(FUNC(mondial68k_state::refresh_leds), attotime::from_hz(10)); } diff --git a/src/mame/layout/fidel_phantom.lay b/src/mame/layout/fidel_phantom.lay index a98ade96bee..d9926999a65 100644 --- a/src/mame/layout/fidel_phantom.lay +++ b/src/mame/layout/fidel_phantom.lay @@ -641,17 +641,17 @@ license:CC0 - - - - + + + + - - - + + + - - + + diff --git a/src/mame/layout/mephisto_modena.lay b/src/mame/layout/mephisto_modena.lay index d65ade190d5..d03f5213eb6 100644 --- a/src/mame/layout/mephisto_modena.lay +++ b/src/mame/layout/mephisto_modena.lay @@ -199,14 +199,14 @@ license:CC0 - - - - - - - - + + + + + + + + @@ -288,8 +288,8 @@ license:CC0 - - + + @@ -309,18 +309,18 @@ license:CC0 - - - - - - - - - - - - + + + + + + + + + + + + @@ -329,7 +329,7 @@ license:CC0 - + @@ -342,10 +342,10 @@ license:CC0 - - - - + + + + @@ -395,12 +395,12 @@ license:CC0 - - - - - - + + + + + + @@ -431,23 +431,23 @@ license:CC0 - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/src/mame/layout/mephisto_mondial68k.lay b/src/mame/layout/mephisto_mondial68k.lay index 77946e2450f..46b379c0803 100644 --- a/src/mame/layout/mephisto_mondial68k.lay +++ b/src/mame/layout/mephisto_mondial68k.lay @@ -445,23 +445,23 @@ license:CC0 - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + +