From 32c155ee38052c5e607ea0cf5ee681699e6f4534 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 23 Mar 2019 16:48:09 +0100 Subject: hh_tms1k: added switches to simon layout, added buttons to zodiac layout, changed inputs to sliders in alphie (nw) --- src/emu/render.h | 1 + src/emu/rendlay.cpp | 4 +- src/mame/drivers/hh_tms1k.cpp | 57 ++++++++++---- src/mame/includes/hh_tms1k.h | 4 + src/mame/layout/alphie.lay | 38 ++++++--- src/mame/layout/simon.lay | 94 +++++++++++++++++++++- src/mame/layout/zodiac.lay | 178 +++++++++++++++++++++++++++++++++++++----- 7 files changed, 325 insertions(+), 51 deletions(-) diff --git a/src/emu/render.h b/src/emu/render.h index 1500dafea73..93621ea92c1 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -852,6 +852,7 @@ public: std::string m_input_tag; // input tag of this item ioport_port * m_input_port; // input port of this item ioport_value m_input_mask; // input mask of this item + u8 m_input_shift; // input mask rightshift for raw (trailing 0s) bool m_input_raw; // get raw data from input port screen_device * m_screen; // pointer to screen int m_orientation; // orientation of this item diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 3f08b56ced4..d083ba5510a 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3283,6 +3283,7 @@ layout_view::item::item( , m_input_tag(env.get_attribute_string(itemnode, "inputtag", "")) , m_input_port(nullptr) , m_input_mask(0) + , m_input_shift(0) , m_input_raw(false) , m_screen(nullptr) , m_orientation(orientation_add(env.parse_orientation(itemnode.get_child("orientation")), orientation)) @@ -3309,6 +3310,7 @@ layout_view::item::item( if (index != -1) m_screen = screen_device_iterator(env.machine().root_device()).byindex(index); m_input_mask = env.get_attribute_int(itemnode, "inputmask", 0); + for (u32 mask = m_input_mask; (mask != 0) && (~mask & 1); mask >>= 1) m_input_shift++; m_input_raw = env.get_attribute_int(itemnode, "inputraw", 0) == 1; if (m_have_output && m_element) m_output = m_element->default_state(); @@ -3384,7 +3386,7 @@ int layout_view::item::state() const { if (m_input_raw) { - return m_input_port->read() & m_input_mask; + return (m_input_port->read() & m_input_mask) >> m_input_shift; } else { diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 37b19a1b17d..3ee31117893 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -228,7 +228,7 @@ #include "tcfballa.lh" #include "timaze.lh" #include "xl25.lh" // clickable -#include "zodiac.lh" +#include "zodiac.lh" // clickable //#include "hh_tms1k_test.lh" // common test-layout - use external artwork @@ -394,6 +394,17 @@ u8 hh_tms1k_state::read_rotated_inputs(int columns, u8 rowmask) return ret; } +void hh_tms1k_state::switch_change(int sel, u32 mask, bool next) +{ + // config switches (for direct control) + ioport_field *inp = m_inp_matrix[sel]->field(mask); + + if (next && inp->has_next_setting()) + inp->select_next_setting(); + else if (!next && inp->has_previous_setting()) + inp->select_previous_setting(); +} + INPUT_CHANGED_MEMBER(hh_tms1k_state::reset_button) { // when an input is directly wired to MCU INIT pin @@ -1213,7 +1224,7 @@ static INPUT_PORTS_START( zodiac ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHAR(13) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Clear") PORT_CHAR(8) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Clear") PORT_CHAR(8) PORT_START("IN.5") // R8 PORT_CONFNAME( 0x03, 0x01, "Mode") @@ -6724,6 +6735,12 @@ static INPUT_PORTS_START( simon ) PORT_CONFSETTING( 0x04, "2" ) PORT_CONFSETTING( 0x08, "3" ) PORT_CONFSETTING( 0x01, "4" ) + + PORT_START("SWITCH") // fake + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_prev<0>, 0x07) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_next<0>, 0x07) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_prev<3>, 0x0f) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_next<3>, 0x0f) INPUT_PORTS_END void simon_state::simon(machine_config &config) @@ -8373,8 +8390,6 @@ public: hh_tms1k_state(mconfig, type, tag) { } - TIMER_DEVICE_CALLBACK_MEMBER(show_arm_position); - DECLARE_WRITE16_MEMBER(write_r); DECLARE_WRITE16_MEMBER(write_o); DECLARE_READ8_MEMBER(read_k); @@ -8383,13 +8398,6 @@ public: // handlers -TIMER_DEVICE_CALLBACK_MEMBER(alphie_state::show_arm_position) -{ - // arm position 1(up) to 5(down) - output().set_value("q_pos", 32 - count_leading_zeros(m_inp_matrix[1]->read())); - output().set_value("a_pos", 32 - count_leading_zeros(m_inp_matrix[2]->read())); -} - WRITE16_MEMBER(alphie_state::write_r) { // R1-R5, input mux (using d5 for Vss) @@ -8419,17 +8427,25 @@ READ8_MEMBER(alphie_state::read_k) // config -static const ioport_value alphie_armpos_table[5] = { 0x01, 0x02, 0x04, 0x08, 0x10 }; - static INPUT_PORTS_START( alphie ) PORT_START("IN.0") // K1 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, true) PORT_START("IN.1") // K2 - PORT_BIT( 0x1f, 0x00, IPT_POSITIONAL_V ) PORT_PLAYER(2) PORT_POSITIONS(5) PORT_REMAP_TABLE(alphie_armpos_table) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) PORT_NAME("Question Arm") + PORT_CONFNAME( 0x1f, 0x01, "Question" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_CONFSETTING( 0x08, "4" ) + PORT_CONFSETTING( 0x10, "5" ) PORT_START("IN.2") // K4 - PORT_BIT( 0x1f, 0x00, IPT_POSITIONAL_V ) PORT_POSITIONS(5) PORT_REMAP_TABLE(alphie_armpos_table) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) PORT_NAME("Answer Arm") + PORT_CONFNAME( 0x1f, 0x01, "Answer" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_CONFSETTING( 0x08, "4" ) + PORT_CONFSETTING( 0x10, "5" ) PORT_START("IN.3") // K8 PORT_CONFNAME( 0x0f, 0x01, "Activity" ) @@ -8437,6 +8453,14 @@ static INPUT_PORTS_START( alphie ) PORT_CONFSETTING( 0x02, "Lunar Landing" ) PORT_CONFSETTING( 0x04, "Robot Land" ) PORT_CONFSETTING( 0x08, "Tunes" ) + + PORT_START("SWITCH") // fake + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_prev<1>, 0x1f) PORT_NAME("Question Arm Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_next<1>, 0x1f) PORT_NAME("Question Arm Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_prev<2>, 0x1f) PORT_NAME("Answer Arm Up") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_next<2>, 0x1f) PORT_NAME("Answer Arm Down") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_prev<3>, 0x0f) PORT_NAME("Activity Selector Left") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, switch_next<3>, 0x0f) PORT_NAME("Activity Selector Right") INPUT_PORTS_END // output PLA is guessed @@ -8455,7 +8479,6 @@ void alphie_state::alphie(machine_config &config) m_maincpu->r().set(FUNC(alphie_state::write_r)); m_maincpu->o().set(FUNC(alphie_state::write_o)); - TIMER(config, "arm_position").configure_periodic(FUNC(alphie_state::show_arm_position), attotime::from_msec(50)); TIMER(config, "display_decay").configure_periodic(FUNC(hh_tms1k_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_alphie); @@ -10326,7 +10349,7 @@ COMP( 1980, mathmagi, 0, 0, mathmagi, mathmagi, mathmagi_state, emp CONS( 1979, bcheetah, 0, 0, bcheetah, bcheetah, bcheetah_state, empty_init, "Bandai", "System Control Car: Cheetah", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW | MACHINE_MECHANICAL ) // *** CONS( 1978, amaztron, 0, 0, amaztron, amaztron, amaztron_state, empty_init, "Coleco", "Amaze-A-Tron", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_IMPERFECT_CONTROLS ) // *** -COMP( 1979, zodiac, 0, 0, zodiac, zodiac, zodiac_state, empty_init, "Coleco", "Zodiac - The Astrology Computer", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, zodiac, 0, 0, zodiac, zodiac, zodiac_state, empty_init, "Coleco", "Zodiac - The Astrology Computer", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1978, cqback, 0, 0, cqback, cqback, cqback_state, empty_init, "Coleco", "Electronic Quarterback", MACHINE_SUPPORTS_SAVE ) CONS( 1979, h2hfootb, 0, 0, h2hfootb, h2hfootb, h2hfootb_state, empty_init, "Coleco", "Head to Head: Electronic Football", MACHINE_SUPPORTS_SAVE ) CONS( 1979, h2hbaskb, 0, 0, h2hbaskb, h2hbaskb, h2hbaskb_state, empty_init, "Coleco", "Head to Head: Electronic Basketball (TMS1000 version)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/hh_tms1k.h b/src/mame/includes/hh_tms1k.h index 234a2f9b4be..c595772468b 100644 --- a/src/mame/includes/hh_tms1k.h +++ b/src/mame/includes/hh_tms1k.h @@ -62,6 +62,10 @@ public: virtual DECLARE_WRITE_LINE_MEMBER(auto_power_off); virtual void power_off(); + void switch_change(int sel, u32 mask, bool next); + template DECLARE_INPUT_CHANGED_MEMBER(switch_next) { if (newval) switch_change(Sel, (u32)(uintptr_t)param, true); } + template DECLARE_INPUT_CHANGED_MEMBER(switch_prev) { if (newval) switch_change(Sel, (u32)(uintptr_t)param, false); } + // display common int m_display_wait; // led/lamp off-delay in milliseconds (default 33ms) int m_display_maxy; // display matrix number of rows diff --git a/src/mame/layout/alphie.lay b/src/mame/layout/alphie.lay index 259af608f92..6d417825279 100644 --- a/src/mame/layout/alphie.lay +++ b/src/mame/layout/alphie.lay @@ -10,19 +10,34 @@ + + + + + + + + + + + + + + + + + + + + - - - - - - - + + @@ -45,9 +60,12 @@ - - - + + + + + + diff --git a/src/mame/layout/simon.lay b/src/mame/layout/simon.lay index c268c37ec88..98129551cfb 100644 --- a/src/mame/layout/simon.lay +++ b/src/mame/layout/simon.lay @@ -7,16 +7,15 @@ - - + - + @@ -40,6 +39,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -131,7 +173,6 @@ - @@ -149,6 +190,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/zodiac.lay b/src/mame/layout/zodiac.lay index 2b2597bfbca..cf04cc1d466 100644 --- a/src/mame/layout/zodiac.lay +++ b/src/mame/layout/zodiac.lay @@ -3,40 +3,131 @@ - + - + - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - @@ -50,6 +141,8 @@ + + @@ -78,5 +171,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3