From 442c6ba728847cdb307ec8dc088d9466611bc026 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 8 May 2023 23:16:46 +0200 Subject: [PATCH] Clones promoted to working -------------------------- Scrabble Lexor: Computer Word Game (MN1405 version) [hap, Sean Riddle] New systems marked not working ------------------------------ Basketball (Tomy) [hap, Sean Riddle] --- src/devices/cpu/mn1400/mn1400base.cpp | 30 ++- src/devices/cpu/mn1400/mn1400base.h | 9 +- src/devices/cpu/mn1400/mn1400op.cpp | 14 +- src/mame/handheld/hh_cop400.cpp | 2 +- src/mame/handheld/hh_cops1.cpp | 2 +- src/mame/handheld/hh_hmcs40.cpp | 2 +- src/mame/handheld/hh_melps4.cpp | 2 +- src/mame/handheld/hh_mn1400.cpp | 350 ++++++++++++++++++++++++-- src/mame/handheld/hh_pic16.cpp | 2 +- src/mame/handheld/hh_pps41.cpp | 2 +- src/mame/handheld/hh_rw5000.cpp | 2 +- src/mame/handheld/hh_sm510.cpp | 2 +- src/mame/handheld/hh_smc1k.cpp | 2 +- src/mame/handheld/hh_tms1k.cpp | 2 +- src/mame/handheld/hh_ucom4.cpp | 2 +- src/mame/handheld/scrablex.cpp | 3 +- src/mame/mame.lst | 1 + 17 files changed, 379 insertions(+), 50 deletions(-) diff --git a/src/devices/cpu/mn1400/mn1400base.cpp b/src/devices/cpu/mn1400/mn1400base.cpp index 409f9f9521a..0db736add33 100644 --- a/src/devices/cpu/mn1400/mn1400base.cpp +++ b/src/devices/cpu/mn1400/mn1400base.cpp @@ -50,7 +50,10 @@ mn1400_base_device::mn1400_base_device(const machine_config &mconfig, device_typ m_read_sns(*this), m_write_c(*this), m_write_d(*this), - m_write_e(*this) + m_write_e(*this), + m_c_mask(0xfff), + m_d_mask(0xff), + m_d_bits(0) { } @@ -85,9 +88,9 @@ void mn1400_base_device::device_start() m_datamask = (1 << m_datawidth) - 1; // resolve callbacks - m_read_a.resolve_safe(0xf); - m_read_b.resolve_safe(0xf); - m_read_sns.resolve_safe(3); + m_read_a.resolve_safe(0); + m_read_b.resolve_safe(0); + m_read_sns.resolve_safe(0); m_write_c.resolve_safe(); m_write_d.resolve_safe(); m_write_e.resolve_safe(); @@ -156,14 +159,14 @@ void mn1400_base_device::device_reset() m_ec = false; // clear output ports - m_write_c(m_c = 0); + write_c(0); write_d(0); m_write_e(0); } //------------------------------------------------- -// D output port +// I/O //------------------------------------------------- void mn1400_base_device::device_add_mconfig(machine_config &config) @@ -173,7 +176,20 @@ void mn1400_base_device::device_add_mconfig(machine_config &config) void mn1400_base_device::write_d(u8 data) { - m_write_d(m_opla->read(data)); + u8 output = m_opla->read(data); + output = bitswap<8>(output,7,6,5,3,1,2,0,4); + + // DO outputs may be bonded to different DO pins + if (u32 b = m_d_bits) + output = bitswap<8>(output, b >> 28 & 7, b >> 24 & 7, b >> 20 & 7, b >> 16 & 7, b >> 12 & 7, b >> 8 & 7, b >> 4 & 7, b >> 0 & 7); + + m_write_d(~output & m_d_mask); +} + +void mn1400_base_device::write_c(u16 data) +{ + m_c = data & m_c_mask; + m_write_c(m_c); } diff --git a/src/devices/cpu/mn1400/mn1400base.h b/src/devices/cpu/mn1400/mn1400base.h index f7232d5a277..55f10cb4f65 100644 --- a/src/devices/cpu/mn1400/mn1400base.h +++ b/src/devices/cpu/mn1400/mn1400base.h @@ -32,10 +32,12 @@ public: // up to 12-bit C output port auto write_c() { return m_write_c.bind(); } + auto &set_c_mask(u16 mask) { m_c_mask = mask; return *this; } // up to 8-bit D output port - // for 4-bit, it uses D1-D4 or D1-D3,D5 + // for 4-bit, it commonly uses D1-D3,D5 auto write_d() { return m_write_d.bind(); } + auto &set_d_mask(u8 mask, u32 bits) { m_d_mask = mask; m_d_bits = bits; return *this; } // 4-bit E output port auto write_e() { return m_write_e.bind(); } @@ -83,6 +85,7 @@ protected: u16 m_prgmask; // " u16 m_datamask; // " + virtual void write_c(u16 data); virtual void write_d(u8 data); virtual void cycle(); virtual void increment_pc(); @@ -119,6 +122,10 @@ protected: devcb_write16 m_write_c; devcb_write8 m_write_d; devcb_write8 m_write_e; + + u16 m_c_mask; + u8 m_d_mask; + u32 m_d_bits; }; diff --git a/src/devices/cpu/mn1400/mn1400op.cpp b/src/devices/cpu/mn1400/mn1400op.cpp index 21e51d4cc2b..23bbe7febff 100644 --- a/src/devices/cpu/mn1400/mn1400op.cpp +++ b/src/devices/cpu/mn1400/mn1400op.cpp @@ -244,7 +244,7 @@ void mn1400_cpu_device::op_ci() void mn1400_cpu_device::op_cy() { - // CY: compare A with Y + // CY: compare Y with immediate set_z(m_y ^ (m_op & 0xf)); } @@ -283,7 +283,7 @@ void mn1400_cpu_device::op_dcm() { // DCM: decrement memory cycle(); - u8 temp = ram_r() - 1; + u8 temp = ram_r() + 0xf; ram_w(temp); set_cz(temp); } @@ -354,21 +354,19 @@ void mn1400_cpu_device::op_otie() void mn1400_cpu_device::op_rco() { // RCO: reset C pin - m_c &= ~(1 << m_y); - m_write_c(m_c); + write_c(m_c & ~(1 << m_y)); } void mn1400_cpu_device::op_sco() { // SCO: set C pin - m_c |= 1 << m_y; - m_write_c(m_c); + write_c(m_c | (1 << m_y)); } void mn1400_cpu_device::op_cco() { // CCO: clear C port - m_write_c(m_c = 0); + write_c(0); } @@ -417,7 +415,7 @@ void mn1400_cpu_device::op_bpcz() void mn1400_cpu_device::op_jmp() { // JMP: jump - m_pc = ((m_op & 0xf) << 8 | m_param) & m_prgmask; + m_pc = ((m_op & 7) << 8 | m_param) & m_prgmask; } void mn1400_cpu_device::op_cal() diff --git a/src/mame/handheld/hh_cop400.cpp b/src/mame/handheld/hh_cop400.cpp index 2c86467878f..4a919249ae6 100644 --- a/src/mame/handheld/hh_cop400.cpp +++ b/src/mame/handheld/hh_cop400.cpp @@ -129,7 +129,7 @@ u16 hh_cop400_state::read_inputs(int columns, u16 colmask) // read selected input rows for (int i = 0; i < columns; i++) - if (~m_inp_mux >> i & 1) + if (!BIT(m_inp_mux, i)) ret &= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_cops1.cpp b/src/mame/handheld/hh_cops1.cpp index 8a06baa230a..8b62001caef 100644 --- a/src/mame/handheld/hh_cops1.cpp +++ b/src/mame/handheld/hh_cops1.cpp @@ -106,7 +106,7 @@ u8 hh_cops1_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_hmcs40.cpp b/src/mame/handheld/hh_hmcs40.cpp index 1558f996d0b..2748304fc0d 100644 --- a/src/mame/handheld/hh_hmcs40.cpp +++ b/src/mame/handheld/hh_hmcs40.cpp @@ -223,7 +223,7 @@ u16 hh_hmcs40_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_melps4.cpp b/src/mame/handheld/hh_melps4.cpp index ac884e346f3..e3e670d4d29 100644 --- a/src/mame/handheld/hh_melps4.cpp +++ b/src/mame/handheld/hh_melps4.cpp @@ -88,7 +88,7 @@ u8 hh_melps4_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_mn1400.cpp b/src/mame/handheld/hh_mn1400.cpp index d8aa905ecc7..4de758b127d 100644 --- a/src/mame/handheld/hh_mn1400.cpp +++ b/src/mame/handheld/hh_mn1400.cpp @@ -6,8 +6,7 @@ Matsushita (Panasonic) MN1400 handhelds TODO: -- WIP -- NO_DUMP: it's decapped, but rom layout is not fully verified yet +- internal artwork for compperf and tmbaskb *******************************************************************************/ @@ -47,16 +46,16 @@ protected: required_device m_maincpu; optional_device m_display; optional_device m_speaker; - optional_ioport_array<4> m_inputs; // max 4 + optional_ioport_array<5> m_inputs; // max 5 - u8 m_inp_mux = 0; // multiplexed inputs mask + u16 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 + u16 m_c = 0; // C pins + u8 m_d = 0; // D pins + u8 m_e = 0; // E pins - u8 read_inputs(int columns); + u16 read_inputs(int columns); }; @@ -73,7 +72,6 @@ void hh_mn1400_state::machine_start() void hh_mn1400_state::machine_reset() { - read_inputs(0); } @@ -86,13 +84,13 @@ void hh_mn1400_state::machine_reset() // generic input handlers -u8 hh_mn1400_state::read_inputs(int columns) +u16 hh_mn1400_state::read_inputs(int columns) { - u8 ret = 0; + u16 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; @@ -125,20 +123,86 @@ public: void compperf(machine_config &config); private: + void update_display(); + void write_c(u16 data); + void write_d(u8 data); void write_e(u8 data); + u8 read_sns(); }; // handlers +void compperf_state::update_display() +{ + m_display->matrix(1, ~m_inp_mux); +} + +void compperf_state::write_c(u16 data) +{ + // CO5-CO9: leds/input mux part + m_inp_mux = (m_inp_mux & ~0x3e0) | (data & 0x3e0); + update_display(); +} + +void compperf_state::write_d(u8 data) +{ + // DO0-DO3: leds/input mux part + m_inp_mux = (m_inp_mux & ~0x1e) | (data << 1 & 0x1e); + update_display(); +} + void compperf_state::write_e(u8 data) { - // E2,E3: speaker out + // EO0: leds/input mux part + m_inp_mux = (m_inp_mux & ~1) | (data & 1); + update_display(); + + // EO2,EO3: speaker out m_speaker->level_w(data >> 2 & 3); } +u8 compperf_state::read_sns() +{ + // SNS0: multiplexed inputs, SNS1: set button + u8 sns0 = (m_inputs[2]->read() & m_inp_mux) ? 1 : 0; + return (m_inputs[3]->read() & 2) | sns0; +} + // inputs static INPUT_PORTS_START( compperf ) + PORT_START("IN.0") // AI + PORT_CONFNAME( 0x07, 0x01, "Game" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_CONFSETTING( 0x00, "4" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Score") + + PORT_START("IN.1") // BI + PORT_CONFNAME( 0x03, 0x00, "Mode" ) + PORT_CONFSETTING( 0x01, "T" ) // Test + PORT_CONFSETTING( 0x00, "N" ) // New + PORT_CONFSETTING( 0x02, "R" ) // Repeat + PORT_CONFNAME( 0x0c, 0x00, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x08, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + + PORT_START("IN.2") // EO/DO/CO SNS0 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_BUTTON2 ) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_BUTTON3 ) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_BUTTON4 ) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_BUTTON7 ) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_BUTTON8 ) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_BUTTON9 ) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_BUTTON10 ) // 0 + + PORT_START("IN.3") // SNS1 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Set") INPUT_PORTS_END // config @@ -147,10 +211,18 @@ void compperf_state::compperf(machine_config &config) { // basic machine hardware MN1400(config, m_maincpu, 300000); // approximation - RC osc. R=18K, C=100pF + m_maincpu->write_c().set(FUNC(compperf_state::write_c)); + m_maincpu->set_c_mask(0x3e0); + m_maincpu->write_d().set(FUNC(compperf_state::write_d)); + m_maincpu->set_d_mask(0xf, 0x5321); m_maincpu->write_e().set(FUNC(compperf_state::write_e)); + m_maincpu->read_a().set_ioport("IN.0"); + m_maincpu->read_b().set_ioport("IN.1"); + m_maincpu->read_sns().set(FUNC(compperf_state::read_sns)); // video hardware PWM_DISPLAY(config, m_display).set_size(1, 10); + m_display->set_bri_levels(0.25); config.set_default_layout(layout_hh_mn1400_test); // sound hardware @@ -165,10 +237,10 @@ void compperf_state::compperf(machine_config &config) ROM_START( compperf ) ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "mn1400ml", 0x0000, 0x0400, NO_DUMP ) + ROM_LOAD( "mn1400ml", 0x0000, 0x0400, CRC(8d5ab2af) SHA1(f6281bb5a5a7ffeead107681d68b66a4844e93ad) ) - ROM_REGION( 200, "maincpu:opla", 0 ) - ROM_LOAD( "mn1400_compperf_output.pla", 0, 200, NO_DUMP ) + ROM_REGION( 428, "maincpu:opla", 0 ) // 4-bit + ROM_LOAD( "mn1400_common1_output.pla", 0, 428, CRC(07489d8b) SHA1(4fe65af8ee798490ed0bbe6a77d61713a2fb28b4) ) ROM_END @@ -196,20 +268,111 @@ public: void scrablexa(machine_config &config); private: + void update_display(); + void write_c(u16 data); + void write_d(u8 data); void write_e(u8 data); + template u8 read_abs(); }; // handlers +void scrablexa_state::update_display() +{ + u16 data = bitswap<14>(m_e << 12 | m_c,10,8,6,12,11,7,9,13,5,4,3,2,1,0); + m_display->matrix(m_d, ~data); +} + +void scrablexa_state::write_c(u16 data) +{ + // CO0-CO11: digit segments + m_c = data; + update_display(); +} + +void scrablexa_state::write_d(u8 data) +{ + // DO0-DO4: input mux + // DO0-DO7: digit select + m_inp_mux = data & 0x1f; + m_d = data; + update_display(); +} + void scrablexa_state::write_e(u8 data) { - // E2,E3: speaker out + // EO0,EO1: digit segments + m_e = data; + update_display(); + + // EO2,EO3: speaker out m_speaker->level_w(data >> 2 & 3); } +template +u8 scrablexa_state::read_abs() +{ + // AI/BI/SNS: multiplexed inputs + return read_inputs(5) >> (N * 4); +} + // inputs static INPUT_PORTS_START( scrablexa ) + PORT_START("IN.0") // DO0 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + + PORT_START("IN.1") // DO1 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + + PORT_START("IN.2") // DO2 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR('*') + + PORT_START("IN.3") // DO4 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("Double") + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_NAME("Triple") + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("Word") + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("Bonus") + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("Minus") + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_NAME("Clear") + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("Enter") + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // DO5 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("Flash") + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("Solo") + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_NAME("Score") + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("Timer") + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Review") INPUT_PORTS_END // config @@ -218,10 +381,16 @@ void scrablexa_state::scrablexa(machine_config &config) { // basic machine hardware MN1405(config, m_maincpu, 300000); // approximation - RC osc. R=15K, C=100pF + m_maincpu->write_c().set(FUNC(scrablexa_state::write_c)); + m_maincpu->write_d().set(FUNC(scrablexa_state::write_d)); m_maincpu->write_e().set(FUNC(scrablexa_state::write_e)); + m_maincpu->read_a().set(FUNC(scrablexa_state::read_abs<0>)); + m_maincpu->read_b().set(FUNC(scrablexa_state::read_abs<1>)); + m_maincpu->read_sns().set(FUNC(scrablexa_state::read_abs<2>)); // video hardware - PWM_DISPLAY(config, m_display).set_size(1, 1); + PWM_DISPLAY(config, m_display).set_size(8, 14); + m_display->set_segmask(0xff, 0x3fff); config.set_default_layout(layout_scrablexa); // sound hardware @@ -236,10 +405,145 @@ void scrablexa_state::scrablexa(machine_config &config) ROM_START( scrablexa ) ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mn1405ms", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "mn1405ms", 0x0000, 0x0800, CRC(d6d61d03) SHA1(b319cb0f0539e7516bb28f1182665b05b7dd16b1) ) - ROM_REGION( 200, "maincpu:opla", 0 ) - ROM_LOAD( "mn1400_scrablexa_output.pla", 0, 200, NO_DUMP ) + ROM_REGION( 428, "maincpu:opla", 0 ) + ROM_LOAD( "mn1400_scrablexa_output.pla", 0, 428, CRC(555fe168) SHA1(cf19be34391dae0a8aacc7be53f2a3415fed3108) ) +ROM_END + + + + + +/******************************************************************************* + + Tomy Basketball + * PCB label: TOMY, BASKET, 2E018E01 + * MN9008 (28-pin MN1400, AI0-AI3 replaced with CO0-CO3, die label: 1400 BM-0) + * 2 7seg LEDs, 29 other LEDs, 1-bit sound + + Two versions are known: one with a black bezel and one with a brown bezel, + the internal hardware is the same. + +*******************************************************************************/ + +class tmbaskb_state : public hh_mn1400_state +{ +public: + tmbaskb_state(const machine_config &mconfig, device_type type, const char *tag) : + hh_mn1400_state(mconfig, type, tag) + { } + + void tmbaskb(machine_config &config); + +private: + void update_display(); + void write_c(u16 data); + void write_d(u8 data); + void write_e(u8 data); + u8 read_b(); +}; + +// handlers + +void tmbaskb_state::update_display() +{ + u8 data = bitswap<8>(m_e << 4 | m_d,7,5,1,4,3,2,6,0); + m_display->matrix((m_c >> 1 & 0x30) | (m_c & 0xf), data); +} + +void tmbaskb_state::write_c(u16 data) +{ + // CO0,CO1: digit select + // CO2,CO3,CO5,CO6: led select + m_c = data; + update_display(); + + // CO3,CO5: input mux + m_inp_mux = bitswap<2>(data,5,3); + + // CO7: speaker out + m_speaker->level_w(BIT(data, 7)); +} + +void tmbaskb_state::write_d(u8 data) +{ + // DO0-DO3: led data + m_d = data; + update_display(); +} + +void tmbaskb_state::write_e(u8 data) +{ + // EO0-EO3: led data + m_e = data; + update_display(); +} + +u8 tmbaskb_state::read_b() +{ + // BI1-BI3: multiplexed inputs, BI0: score button + return (read_inputs(2) & 0xe) | (m_inputs[2]->read() & 1); +} + +// inputs + +static INPUT_PORTS_START( tmbaskb ) + PORT_START("IN.0") // CO3 BI (left) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Offense P") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Offense S") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Defense") + + PORT_START("IN.1") // CO5 BI (right) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Offense P") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Offense S") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Defense") + + PORT_START("IN.2") // BI0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Score") + + PORT_START("IN.3") // SNS + PORT_CONFNAME( 0x01, 0x01, DEF_STR( Players ) ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_CONFNAME( 0x02, 0x02, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x02, "1" ) // PRO1 + PORT_CONFSETTING( 0x00, "2" ) // PRO2 +INPUT_PORTS_END + +// config + +void tmbaskb_state::tmbaskb(machine_config &config) +{ + // basic machine hardware + MN1400(config, m_maincpu, 300000); // approximation - RC osc. R=18K, C=100pF + m_maincpu->write_c().set(FUNC(tmbaskb_state::write_c)); + m_maincpu->set_c_mask(0x3ef); + m_maincpu->write_d().set(FUNC(tmbaskb_state::write_d)); + m_maincpu->set_d_mask(0xf, 0x5321); + m_maincpu->write_e().set(FUNC(tmbaskb_state::write_e)); + m_maincpu->read_b().set(FUNC(tmbaskb_state::read_b)); + m_maincpu->read_sns().set_ioport("IN.3"); + + // video hardware + PWM_DISPLAY(config, m_display).set_size(6, 8); + m_display->set_segmask(3, 0x7f); + config.set_default_layout(layout_hh_mn1400_test); + + // sound hardware + SPEAKER(config, "mono").front_center(); + SPEAKER_SOUND(config, m_speaker); + m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); +} + +// roms + +ROM_START( tmbaskb ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tomy_basket_mn9008", 0x0000, 0x0400, CRC(25be3560) SHA1(17855397cf05963c1381191cd4731860b8e180a8) ) + + ROM_REGION( 428, "maincpu:opla", 0 ) // 4-bit + ROM_LOAD( "mn1400_common1_output.pla", 0, 428, CRC(07489d8b) SHA1(4fe65af8ee798490ed0bbe6a77d61713a2fb28b4) ) ROM_END @@ -255,4 +559,6 @@ ROM_END // 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 ) -SYST( 1980, scrablexa, scrablex, 0, scrablexa, scrablexa, scrablexa_state, empty_init, "Selchow & Righter", "Scrabble Lexor: Computer Word Game (MN1405 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +SYST( 1980, scrablexa, scrablex, 0, scrablexa, scrablexa, scrablexa_state, empty_init, "Selchow & Righter", "Scrabble Lexor: Computer Word Game (MN1405 version)", MACHINE_SUPPORTS_SAVE ) + +SYST( 1980, tmbaskb, 0, 0, tmbaskb, tmbaskb, tmbaskb_state, empty_init, "Tomy", "Basketball (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/handheld/hh_pic16.cpp b/src/mame/handheld/hh_pic16.cpp index 1bcfd363237..dc65763194f 100644 --- a/src/mame/handheld/hh_pic16.cpp +++ b/src/mame/handheld/hh_pic16.cpp @@ -162,7 +162,7 @@ u16 hh_pic16_state::read_inputs(int columns, u16 colmask) // read selected input rows for (int i = 0; i < columns; i++) - if (~m_inp_mux >> i & 1) + if (!BIT(m_inp_mux, i)) ret &= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_pps41.cpp b/src/mame/handheld/hh_pps41.cpp index 683160c2b12..016c4a4ff14 100644 --- a/src/mame/handheld/hh_pps41.cpp +++ b/src/mame/handheld/hh_pps41.cpp @@ -106,7 +106,7 @@ u8 hh_pps41_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_rw5000.cpp b/src/mame/handheld/hh_rw5000.cpp index 4aa11149816..6687a5eadb1 100644 --- a/src/mame/handheld/hh_rw5000.cpp +++ b/src/mame/handheld/hh_rw5000.cpp @@ -108,7 +108,7 @@ u8 hh_rw5000_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_sm510.cpp b/src/mame/handheld/hh_sm510.cpp index 4c9a5a38aeb..f7742508a87 100644 --- a/src/mame/handheld/hh_sm510.cpp +++ b/src/mame/handheld/hh_sm510.cpp @@ -276,7 +276,7 @@ u8 hh_sm510_state::read_inputs(int columns, int fixed) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); if (fixed >= 0) diff --git a/src/mame/handheld/hh_smc1k.cpp b/src/mame/handheld/hh_smc1k.cpp index 3ddb0f510a6..a0e21ea621a 100644 --- a/src/mame/handheld/hh_smc1k.cpp +++ b/src/mame/handheld/hh_smc1k.cpp @@ -103,7 +103,7 @@ u8 hh_smc1k_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_tms1k.cpp b/src/mame/handheld/hh_tms1k.cpp index 72231481a40..2adb5d55450 100644 --- a/src/mame/handheld/hh_tms1k.cpp +++ b/src/mame/handheld/hh_tms1k.cpp @@ -437,7 +437,7 @@ u8 hh_tms1k_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/hh_ucom4.cpp b/src/mame/handheld/hh_ucom4.cpp index d3ce0178850..f420cc371e5 100644 --- a/src/mame/handheld/hh_ucom4.cpp +++ b/src/mame/handheld/hh_ucom4.cpp @@ -202,7 +202,7 @@ u8 hh_ucom4_state::read_inputs(int columns) // read selected input rows for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) + if (BIT(m_inp_mux, i)) ret |= m_inputs[i]->read(); return ret; diff --git a/src/mame/handheld/scrablex.cpp b/src/mame/handheld/scrablex.cpp index 6cfea5b6019..6589cedf17a 100644 --- a/src/mame/handheld/scrablex.cpp +++ b/src/mame/handheld/scrablex.cpp @@ -11,7 +11,8 @@ Hardware notes: - Fujitsu MB8841 MCU - 8-digit 14-seg LEDs, 2-bit sound -There's also a version of this game on a Matsushita MN1405 MCU (see hh_mn1400.cpp). +There's also a version of this game on a Matsushita MN1405 MCU (see hh_mn1400.cpp), +even though it's a different MCU, the I/O is very similar. *******************************************************************************/ diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 5ba52455a69..2980084c60c 100755 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -18714,6 +18714,7 @@ gjungler // Gakken @source:handheld/hh_mn1400.cpp compperf // Lakeside scrablexa // Selchow & Righter +tmbaskb // Tomy @source:handheld/hh_pic16.cpp drdunk // Kmart