From 2f11eb0c3e7a57de8770aadc37035d8114e4b2de Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 5 Mar 2015 18:50:06 +0100 Subject: added hh_hmcs40.c skeleton driver --- src/mess/drivers/hh_hmcs40.c | 274 +++++++++++++++++++++++++++++++++++++++++++ src/mess/layout/alnattck.lay | 236 +++++++++++++++++++++++++++++++++++++ src/mess/layout/tmtron.lay | 266 +++++++++++++++++++++++++++++++++++++++++ src/mess/mess.lst | 5 +- src/mess/mess.mak | 3 + src/mess/messcore.mak | 6 +- 6 files changed, 787 insertions(+), 3 deletions(-) create mode 100644 src/mess/drivers/hh_hmcs40.c create mode 100644 src/mess/layout/alnattck.lay create mode 100644 src/mess/layout/tmtron.lay diff --git a/src/mess/drivers/hh_hmcs40.c b/src/mess/drivers/hh_hmcs40.c new file mode 100644 index 00000000000..4594bfd6db5 --- /dev/null +++ b/src/mess/drivers/hh_hmcs40.c @@ -0,0 +1,274 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + Hitachi HMCS40 MCU tabletops/handhelds or other simple devices. + + +***************************************************************************/ + +#include "emu.h" +#include "cpu/hmcs40/hmcs40.h" +#include "sound/speaker.h" + +// test-layouts - use external artwork +#include "alnattck.lh" +#include "tmtron.lh" + + +class hh_hmcs40_state : public driver_device +{ +public: + hh_hmcs40_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<3> m_inp_matrix; // max 3 + optional_device m_speaker; + + // misc common + UINT16 m_inp_mux; + + UINT8 read_inputs(int columns); + + virtual void machine_start(); + + // display common + int m_display_wait; + int m_display_maxy; + int m_display_maxx; + + UINT32 m_grid; + UINT32 m_plate; + + UINT32 m_display_state[0x20]; + UINT32 m_display_cache[0x20]; + UINT8 m_display_decay[0x20][0x20]; + UINT16 m_7seg_mask[0x20]; + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + + // game-specific handlers +}; + + +void hh_hmcs40_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, 0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_7seg_mask, 0, sizeof(m_7seg_mask)); + + m_inp_mux = 0; + m_grid = 0; + m_plate = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + save_item(NAME(m_display_cache)); + save_item(NAME(m_display_decay)); + save_item(NAME(m_7seg_mask)); + + save_item(NAME(m_inp_mux)); + save_item(NAME(m_grid)); + save_item(NAME(m_plate)); +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_hmcs40_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x < m_display_maxx; x++) + { + // turn on powered segments + if (m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + int ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_7seg_mask[y] != 0) + output_set_digit_value(y, active_state[y] & m_7seg_mask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x < m_display_maxx; x++) + output_set_lamp_value(y * mul + x, active_state[y] >> x & 1); + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_hmcs40_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x < m_display_maxx; x++) + if (!(m_display_state[y] >> x & 1) && m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? (setx & mask) : 0; + + display_update(); +} + + +UINT8 hh_hmcs40_state::read_inputs(int columns) +{ + UINT8 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inp_matrix[i]->read(); + + return ret; +} + + + +/*************************************************************************** + + Minidrivers (I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Coleco Alien Attack (manufactured in Taiwan) + * Hitachi HD38800A25 MCU + * cyan/red VFD display Futaba DM-19Z 1J + + NOTE!: MESS external artwork is recommended + +***************************************************************************/ + +static INPUT_PORTS_START( alnattck ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( alnattck, hh_hmcs40_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. + +// MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_alnattck) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Tron (manufactured in Japan) + * boards are labeled THN-02 2E114E07 + * Hitachi HD38800A88 MCU + * cyan/red/green VFD display NEC FIP10AM24T + + NOTE!: MESS external artwork is recommended + +***************************************************************************/ + +static INPUT_PORTS_START( tmtron ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( tmtron, hh_hmcs40_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. + +// MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tmtron) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( alnattck ) + ROM_REGION( 0x1100, "maincpu", 0 ) + ROM_LOAD( "hd38800a25", 0x0000, 0x1100, CRC(18b50869) SHA1(11e9d5f7b4ae818b077b0ee14a3b43190e20bff3) ) +ROM_END + + +ROM_START( tmtron ) + ROM_REGION( 0x1100, "maincpu", 0 ) + ROM_LOAD( "hd38800a88", 0x0000, 0x1100, CRC(33db9670) SHA1(d6f747a59356526698784047bcfdbb59e79b9a23) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1981, alnattck, 0, 0, alnattck, alnattck, driver_device, 0, "Coleco", "Alien Attack", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK | GAME_NOT_WORKING ) + +CONS( 1982, tmtron, 0, 0, tmtron, tmtron, driver_device, 0, "Tomy", "Tron (Tomy)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK | GAME_NOT_WORKING ) diff --git a/src/mess/layout/alnattck.lay b/src/mess/layout/alnattck.lay new file mode 100644 index 00000000000..e1f7e9e120f --- /dev/null +++ b/src/mess/layout/alnattck.lay @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mess/layout/tmtron.lay b/src/mess/layout/tmtron.lay new file mode 100644 index 00000000000..48e3a4e38b0 --- /dev/null +++ b/src/mess/layout/tmtron.lay @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mess/mess.lst b/src/mess/mess.lst index a9edad2bdbb..983b59f7491 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -2173,6 +2173,9 @@ ngenb38 // 1991 386i // 199? // Dedicated handhelds/tabletops +alnattck // Coleco +tmtron // Tomy + maniac // Ideal mathmagi // APF @@ -2191,7 +2194,7 @@ stopthie // Parker Bros stopthiep // Parker Bros (prototype) bankshot // Parker Bros splitsec // Parker Bros -tandy12 // TRS +tandy12 // Tandy Radio Shack edracula // Epoch tmpacman // Tomy diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 7d4a0ac2910..135a9906275 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1288,6 +1288,7 @@ $(MESSOBJ)/hitachi.a: \ $(MESS_DRIVERS)/b16.o \ $(MESS_DRIVERS)/bmjr.o \ $(MESS_DRIVERS)/bml3.o \ + $(MESS_DRIVERS)/hh_hmcs40.o \ $(MESSOBJ)/homebrew.a: \ $(MESS_DRIVERS)/4004clk.o \ @@ -2125,6 +2126,8 @@ $(MESS_DRIVERS)/fidelz80.o: $(MESS_LAYOUT)/fidelz80.lh \ $(MESS_DRIVERS)/gamecom.o: $(MESS_LAYOUT)/gamecom.lh $(MESS_DRIVERS)/glasgow.o: $(MESS_LAYOUT)/glasgow.lh $(MESS_DRIVERS)/h8.o: $(MESS_LAYOUT)/h8.lh +$(MESS_DRIVERS)/hh_hmcs40.o:$(MESS_LAYOUT)/alnattck.lh \ + $(MESS_LAYOUT)/tmtron.lh $(MESS_DRIVERS)/hh_pic16.o: $(MESS_LAYOUT)/maniac.lh $(MESS_DRIVERS)/hh_tms1k.o: $(MESS_LAYOUT)/amaztron.lh \ $(MESS_LAYOUT)/bankshot.lh \ diff --git a/src/mess/messcore.mak b/src/mess/messcore.mak index f25c1f8c304..d0f9e077f20 100644 --- a/src/mess/messcore.mak +++ b/src/mess/messcore.mak @@ -55,12 +55,14 @@ OBJDIRS += \ $(MESS_DRIVERS) \ $(MESS_LAYOUT) \ $(MESS_MACHINE) \ - $(MESS_MACHINE)/c64 \ $(MESS_VIDEO) \ # System-specific directories -OBJDIRS += $(MESS_MACHINE)/ti99 \ +OBJDIRS += \ + $(MESS_MACHINE)/c64 \ + $(MESS_MACHINE)/ti99 \ + #------------------------------------------------- # MESS core objects -- cgit v1.2.3