From 9ce5064498973ff3cc4ff796e613c94166e26146 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 May 2023 21:09:21 +0200 Subject: hh_mn1400: add skeleton driver New systems marked not working ------------------------------ Computer Perfection [hap, Sean Riddle] --- src/mame/handheld/hh_cop400.cpp | 15 ++-- src/mame/handheld/hh_mn1400.cpp | 167 +++++++++++++++++++++++++++++++++++++ src/mame/handheld/hh_pic16.cpp | 13 +-- src/mame/handheld/hh_smc1k.cpp | 4 +- src/mame/layout/hh_mn1400_test.lay | 36 ++++++++ src/mame/mame.lst | 3 + 6 files changed, 223 insertions(+), 15 deletions(-) create mode 100644 src/mame/handheld/hh_mn1400.cpp create mode 100644 src/mame/layout/hh_mn1400_test.lay diff --git a/src/mame/handheld/hh_cop400.cpp b/src/mame/handheld/hh_cop400.cpp index 1f8faa5a8f9..2c86467878f 100644 --- a/src/mame/handheld/hh_cop400.cpp +++ b/src/mame/handheld/hh_cop400.cpp @@ -80,14 +80,15 @@ protected: optional_device m_speaker; optional_ioport_array<6> m_inputs; // max 6 - // misc common - u8 m_l = 0; // MCU port L write data - u8 m_g = 0; // MCU port G write data - u8 m_d = 0; // MCU port D write data - int m_so = 0; // MCU SO line state - int m_sk = 0; // MCU SK line state u16 m_inp_mux = ~0; // multiplexed inputs mask + // MCU output pin state + u8 m_l = 0; // port L + u8 m_g = 0; // port G + u8 m_d = 0; // port D + int m_so = 0; // SO line + int m_sk = 0; // SK line + u16 read_inputs(int columns, u16 colmask = ~0); void set_power(bool state); }; @@ -98,12 +99,12 @@ protected: void hh_cop400_state::machine_start() { // register for savestates + save_item(NAME(m_inp_mux)); save_item(NAME(m_l)); save_item(NAME(m_g)); save_item(NAME(m_d)); save_item(NAME(m_so)); save_item(NAME(m_sk)); - save_item(NAME(m_inp_mux)); } void hh_cop400_state::machine_reset() diff --git a/src/mame/handheld/hh_mn1400.cpp b/src/mame/handheld/hh_mn1400.cpp new file mode 100644 index 00000000000..6cdf6c2a883 --- /dev/null +++ b/src/mame/handheld/hh_mn1400.cpp @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:hap +// thanks-to:Sean Riddle +/******************************************************************************* + +Matsushita (Panasonic) MN1400 handhelds + +TODO: +- WIP +- NO_DUMP: it's decapped, but rom layout is not fully verified yet + +*******************************************************************************/ + +#include "emu.h" + +#include "cpu/mn1400/mn1400.h" +#include "sound/spkrdev.h" +#include "video/pwm.h" + +#include "screen.h" +#include "speaker.h" + +#include "hh_mn1400_test.lh" // common test-layout - use external artwork + + +namespace { + +class hh_mn1400_state : public driver_device +{ +public: + hh_mn1400_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_display(*this, "display"), + m_speaker(*this, "speaker"), + m_inputs(*this, "IN.%u", 0) + { } + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + // devices + required_device m_maincpu; + optional_device m_display; + optional_device m_speaker; + optional_ioport_array<4> m_inputs; // max 4 + + u8 m_inp_mux = 0; // multiplexed inputs mask + + // MCU output pins state + u16 m_c = 0; // C pins + u8 m_d = 0; // D pins + u8 m_e = 0; // E pins + + u8 read_inputs(int columns); +}; + + +// machine start/reset + +void hh_mn1400_state::machine_start() +{ + // register for savestates + save_item(NAME(m_inp_mux)); + save_item(NAME(m_c)); + save_item(NAME(m_d)); + save_item(NAME(m_e)); +} + +void hh_mn1400_state::machine_reset() +{ + read_inputs(0); +} + + + +/******************************************************************************* + + Helper Functions + +*******************************************************************************/ + +// generic input handlers + +u8 hh_mn1400_state::read_inputs(int columns) +{ + u8 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inputs[i]->read(); + + return ret; +} + + + +/******************************************************************************* + + Minidrivers (subclass, I/O, Inputs, Machine Config, ROM Defs) + +*******************************************************************************/ + +/******************************************************************************* + + Lakeside Computer Perfection + * MN1400ML MCU (die label: 1400 ML-0) + * 10 LEDs, 2-bit sound + +*******************************************************************************/ + +class compperf_state : public hh_mn1400_state +{ +public: + compperf_state(const machine_config &mconfig, device_type type, const char *tag) : + hh_mn1400_state(mconfig, type, tag) + { } + + void compperf(machine_config &config); + +private: +}; + +// handlers + +// inputs + +static INPUT_PORTS_START( compperf ) +INPUT_PORTS_END + +// config + +void compperf_state::compperf(machine_config &config) +{ + // basic machine hardware + MN1400(config, m_maincpu, 300000); + + // video hardware + PWM_DISPLAY(config, m_display).set_size(1, 10); + config.set_default_layout(layout_hh_mn1400_test); + + // sound hardware + SPEAKER(config, "mono").front_center(); + SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); +} + +// roms + +ROM_START( compperf ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mn1400ml", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + + +} // anonymous namespace + +/******************************************************************************* + + Game driver(s) + +*******************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 1979, compperf, 0, 0, compperf, compperf, compperf_state, empty_init, "Lakeside", "Computer Perfection", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/handheld/hh_pic16.cpp b/src/mame/handheld/hh_pic16.cpp index 659aebaa272..1bcfd363237 100644 --- a/src/mame/handheld/hh_pic16.cpp +++ b/src/mame/handheld/hh_pic16.cpp @@ -114,13 +114,14 @@ protected: optional_device m_speaker; optional_ioport_array<6> m_inputs; // max 6 - // misc common - u8 m_a = 0; // MCU port A write data - u8 m_b = 0; // " B - u8 m_c = 0; // " C - u8 m_d = 0; // " D u16 m_inp_mux = ~0; // multiplexed inputs mask + // MCU output pin state + u8 m_a = 0; // port A + u8 m_b = 0; // port B + u8 m_c = 0; // port C + u8 m_d = 0; // port D + u16 read_inputs(int columns, u16 colmask = ~0); u8 read_rotated_inputs(int columns, u8 rowmask = ~0); void set_power(bool state); @@ -132,11 +133,11 @@ protected: void hh_pic16_state::machine_start() { // register for savestates + save_item(NAME(m_inp_mux)); save_item(NAME(m_a)); save_item(NAME(m_b)); save_item(NAME(m_c)); save_item(NAME(m_d)); - save_item(NAME(m_inp_mux)); } void hh_pic16_state::machine_reset() diff --git a/src/mame/handheld/hh_smc1k.cpp b/src/mame/handheld/hh_smc1k.cpp index 6f8205fbd64..3ddb0f510a6 100644 --- a/src/mame/handheld/hh_smc1k.cpp +++ b/src/mame/handheld/hh_smc1k.cpp @@ -52,10 +52,10 @@ protected: optional_ioport_array<4> m_inputs; // max 4 output_finder<4, 32> m_out_x; + u8 m_inp_mux = 0; + virtual void write_segs(offs_t offset, u32 data); u8 read_inputs(int columns); - - u8 m_inp_mux = 0; }; diff --git a/src/mame/layout/hh_mn1400_test.lay b/src/mame/layout/hh_mn1400_test.lay new file mode 100644 index 00000000000..31bd31012e0 --- /dev/null +++ b/src/mame/layout/hh_mn1400_test.lay @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 5aee52b2b54..2c726595a25 100755 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -18711,6 +18711,9 @@ zackman // Bandai cfrogger // Coleco gjungler // Gakken +@source:handheld/hh_mn1400.cpp +compperf // Lakeside + @source:handheld/hh_pic16.cpp drdunk // Kmart flash // Ideal -- cgit v1.2.3