diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c index 2f3b0ba15f1..51166766346 100644 --- a/src/emu/cpu/cop400/cop400.c +++ b/src/emu/cpu/cop400/cop400.c @@ -363,7 +363,7 @@ INSTRUCTION(illegal) OPCODE TABLES ***************************************************************************/ -const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_23_MAP[] = +const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_23_MAP[256] = { {1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) }, {1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) }, @@ -409,7 +409,7 @@ void cop400_cpu_device::cop410_op23(UINT8 opcode) (this->*COP410_OPCODE_23_MAP[opcode23].function)(opcode23); } -const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_33_MAP[] = +const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_33_MAP[256] = { {1, INST(illegal) },{1, INST(skgbz0) },{1, INST(illegal) },{1, INST(skgbz2) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) }, {1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) }, @@ -455,7 +455,7 @@ void cop400_cpu_device::cop410_op33(UINT8 opcode) (this->*COP410_OPCODE_33_MAP[opcode33].function)(opcode33); } -const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_MAP[] = +const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_MAP[256] = { {1, INST(clra) },{1, INST(skmbz0) },{1, INST(xor_) },{1, INST(skmbz2) },{1, INST(xis) },{1, INST(ld) },{1, INST(x) },{1, INST(xds) }, {1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) }, @@ -494,7 +494,7 @@ const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP410_OPCODE_MAP[ {1, INST(jp) },{1, INST(jp) },{1, INST(jp) },{1, INST(jp) },{1, INST(jp) },{1, INST(jp) },{1, INST(jp) },{2, INST(jid) } }; -const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP420_OPCODE_23_MAP[] = +const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP420_OPCODE_23_MAP[256] = { {1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) }, {1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) },{1, INST(ldd) }, @@ -540,7 +540,7 @@ void cop400_cpu_device::cop420_op23(UINT8 opcode) (this->*COP420_OPCODE_23_MAP[opcode23].function)(opcode23); } -const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP420_OPCODE_33_MAP[] = +const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP420_OPCODE_33_MAP[256] = { {1, INST(illegal) },{1, INST(skgbz0) },{1, INST(illegal) },{1, INST(skgbz2) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) }, {1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) },{1, INST(illegal) }, @@ -586,7 +586,7 @@ void cop400_cpu_device::cop420_op33(UINT8 opcode) (this->*COP420_OPCODE_33_MAP[opcode33].function)(opcode33); } -const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP420_OPCODE_MAP[] = +const cop400_cpu_device::cop400_opcode_map cop400_cpu_device::COP420_OPCODE_MAP[256] = { {1, INST(clra) },{1, INST(skmbz0) },{1, INST(xor_) },{1, INST(skmbz2) },{1, INST(xis) },{1, INST(ld) },{1, INST(x) },{1, INST(xds) }, {1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) },{1, INST(lbi) }, diff --git a/src/emu/cpu/cop400/cop400.h b/src/emu/cpu/cop400/cop400.h index 5a53242754a..200b0cfb3f5 100644 --- a/src/emu/cpu/cop400/cop400.h +++ b/src/emu/cpu/cop400/cop400.h @@ -267,12 +267,12 @@ protected: const cop400_opcode_map *m_opcode_map; cop400_opcode_func m_last_opcode_function; - static const cop400_opcode_map COP410_OPCODE_23_MAP[]; - static const cop400_opcode_map COP410_OPCODE_33_MAP[]; - static const cop400_opcode_map COP410_OPCODE_MAP[]; - static const cop400_opcode_map COP420_OPCODE_23_MAP[]; - static const cop400_opcode_map COP420_OPCODE_33_MAP[]; - static const cop400_opcode_map COP420_OPCODE_MAP[]; + static const cop400_opcode_map COP410_OPCODE_23_MAP[256]; + static const cop400_opcode_map COP410_OPCODE_33_MAP[256]; + static const cop400_opcode_map COP410_OPCODE_MAP[256]; + static const cop400_opcode_map COP420_OPCODE_23_MAP[256]; + static const cop400_opcode_map COP420_OPCODE_33_MAP[256]; + static const cop400_opcode_map COP420_OPCODE_MAP[256]; static const cop400_opcode_map COP444_OPCODE_23_MAP[256]; static const cop400_opcode_map COP444_OPCODE_33_MAP[256]; static const cop400_opcode_map COP444_OPCODE_MAP[256]; diff --git a/src/mess/drivers/hh_cop400.c b/src/mess/drivers/hh_cop400.c index 67fa4c0d6ba..7d3c3b1ceb9 100644 --- a/src/mess/drivers/hh_cop400.c +++ b/src/mess/drivers/hh_cop400.c @@ -13,6 +13,7 @@ // internal artwork #include "einvaderc.lh" // test-layout(but still playable) +#include "funjacks.lh" #include "lightfgt.lh" // clickable //#include "hh_cop400_test.lh" // common test-layout - use external artwork @@ -202,12 +203,13 @@ void hh_cop400_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 set UINT8 hh_cop400_state::read_inputs(int columns) { - UINT8 ret = 0; + // active low + UINT8 ret = 0xff; // read selected input rows for (int i = 0; i < columns; i++) if (m_inp_mux >> i & 1) - ret |= m_inp_matrix[i]->read(); + ret &= m_inp_matrix[i]->read(); return ret; } @@ -241,10 +243,10 @@ public: { } void prepare_display(); - DECLARE_WRITE_LINE_MEMBER(write_so); - DECLARE_WRITE_LINE_MEMBER(write_sk); - DECLARE_WRITE8_MEMBER(write_g); DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_WRITE_LINE_MEMBER(write_sk); + DECLARE_WRITE_LINE_MEMBER(write_so); DECLARE_WRITE8_MEMBER(write_l); }; @@ -278,10 +280,8 @@ WRITE8_MEMBER(einvaderc_state::write_g) WRITE_LINE_MEMBER(einvaderc_state::write_sk) { - // SK: speaker out + // SK: speaker out + led grid 8 m_speaker->level_w(state); - - // SK: led grid 8 m_sk = state; prepare_display(); } @@ -319,10 +319,10 @@ static MACHINE_CONFIG_START( einvaderc, einvaderc_state ) MCFG_CPU_ADD("maincpu", COP444, 1000000) // approximation - RC osc. R=47K to +9V, C=100pf to GND(-9V) MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed MCFG_COP400_READ_IN_CB(IOPORT("IN.0")) - MCFG_COP400_WRITE_SO_CB(WRITELINE(einvaderc_state, write_so)) - MCFG_COP400_WRITE_SK_CB(WRITELINE(einvaderc_state, write_sk)) - MCFG_COP400_WRITE_G_CB(WRITE8(einvaderc_state, write_g)) MCFG_COP400_WRITE_D_CB(WRITE8(einvaderc_state, write_d)) + MCFG_COP400_WRITE_G_CB(WRITE8(einvaderc_state, write_g)) + MCFG_COP400_WRITE_SK_CB(WRITELINE(einvaderc_state, write_sk)) + MCFG_COP400_WRITE_SO_CB(WRITELINE(einvaderc_state, write_so)) MCFG_COP400_WRITE_L_CB(WRITE8(einvaderc_state, write_l)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) @@ -340,6 +340,115 @@ MACHINE_CONFIG_END +/*************************************************************************** + + Mattel Funtronics Jacks + * COP410L MCU bonded directly to PCB (die labeled COP410L/B NGS) + * 8 LEDs, 1bit sound + +***************************************************************************/ + +class funjacks_state : public hh_cop400_state +{ +public: + funjacks_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_READ8_MEMBER(read_l); + DECLARE_READ8_MEMBER(read_g); +}; + +// handlers + +WRITE8_MEMBER(funjacks_state::write_d) +{ + // D: led grid + input mux + m_d = m_inp_mux = data ^ 0xf; + display_matrix(2, 4, m_l, m_d ); +} + +WRITE8_MEMBER(funjacks_state::write_l) +{ + // L01: led state + m_l = data & 3; + display_matrix(2, 4, m_l, m_d); +} + +WRITE8_MEMBER(funjacks_state::write_g) +{ + // G1: speaker out + m_speaker->level_w(data >> 1 & 1); + m_g = data; +} + +READ8_MEMBER(funjacks_state::read_l) +{ + // L45: multiplexed inputs + return read_inputs(3) & 0x30; +} + +READ8_MEMBER(funjacks_state::read_g) +{ + // G1: speaker out state + // G23: inputs + return m_inp_matrix[3]->read() | (m_g & 2); +} + + +// config + +static INPUT_PORTS_START( funjacks ) + PORT_START("IN.0") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) + + PORT_START("IN.1") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) + + PORT_START("IN.2") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) // positioned at 1 o'clock on panel, increment clockwise + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) + + PORT_START("IN.3") // port G + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) // speaker + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START ) + PORT_CONFNAME( 0x08, 0x00, "Players" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x08, "2" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( funjacks, funjacks_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP410, 2000000) // approximation - RC osc. R=47K, C=56pf + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed + MCFG_COP400_WRITE_D_CB(WRITE8(funjacks_state, write_d)) + MCFG_COP400_WRITE_L_CB(WRITE8(funjacks_state, write_l)) + MCFG_COP400_WRITE_G_CB(WRITE8(funjacks_state, write_g)) + MCFG_COP400_READ_L_CB(READ8(funjacks_state, read_l)) + MCFG_COP400_READ_G_CB(READ8(funjacks_state, read_g)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_funjacks) + + /* 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 + + + + + /*************************************************************************** Milton Bradley (Electronic) Lightfight @@ -369,10 +478,10 @@ public: void prepare_display(); DECLARE_WRITE_LINE_MEMBER(write_so); - DECLARE_WRITE_LINE_MEMBER(write_sk); - DECLARE_READ8_MEMBER(read_g); DECLARE_WRITE8_MEMBER(write_d); DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE_LINE_MEMBER(write_sk); + DECLARE_READ8_MEMBER(read_g); }; // handlers @@ -415,7 +524,7 @@ READ8_MEMBER(lightfgt_state::read_g) { // G: multiplexed inputs m_inp_mux = (m_so | m_d << 1) ^ 0x1f; - return read_inputs(5) ^ 0xf; + return read_inputs(5); } @@ -423,34 +532,34 @@ READ8_MEMBER(lightfgt_state::read_g) static INPUT_PORTS_START( lightfgt ) PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // note: button 1 is on the left side from player perspective - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) // note: button 1 is on the left side from player perspective + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_COCKTAIL PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_COCKTAIL PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON8 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_COCKTAIL PORT_START("IN.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON4 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON9 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_COCKTAIL PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON10 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON10 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_COCKTAIL INPUT_PORTS_END static MACHINE_CONFIG_START( lightfgt, lightfgt_state ) @@ -459,10 +568,10 @@ static MACHINE_CONFIG_START( lightfgt, lightfgt_state ) MCFG_CPU_ADD("maincpu", COP421, 950000) // approximation - RC osc. R=82K to +6V, C=56pf to GND(-6V) MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed MCFG_COP400_WRITE_SO_CB(WRITELINE(lightfgt_state, write_so)) - MCFG_COP400_WRITE_SK_CB(WRITELINE(lightfgt_state, write_sk)) - MCFG_COP400_READ_G_CB(READ8(lightfgt_state, read_g)) MCFG_COP400_WRITE_D_CB(WRITE8(lightfgt_state, write_d)) MCFG_COP400_WRITE_L_CB(WRITE8(lightfgt_state, write_l)) + MCFG_COP400_WRITE_SK_CB(WRITELINE(lightfgt_state, write_sk)) + MCFG_COP400_READ_G_CB(READ8(lightfgt_state, read_g)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_lightfgt) @@ -491,6 +600,12 @@ ROM_START( einvaderc ) ROM_END +ROM_START( funjacks ) + ROM_REGION( 0x0200, "maincpu", 0 ) + ROM_LOAD( "jacks.bin", 0x0000, 0x0200, CRC(863368ea) SHA1(f116cc27ae721b3a3e178fa13765808bdc275663) ) +ROM_END + + ROM_START( lightfgt ) ROM_REGION( 0x0400, "maincpu", 0 ) ROM_LOAD( "lightfight.bin", 0x0000, 0x0400, CRC(aceb2d65) SHA1(2328cbb195faf93c575f3afa3a1fe0079180edd7) ) @@ -501,4 +616,6 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ CONS( 1981, einvaderc, einvader, 0, einvaderc, einvaderc, driver_device, 0, "Entex", "Space Invader (Entex, COP444)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK | GAME_NOT_WORKING ) +CONS( 1979, funjacks, 0, 0, funjacks, funjacks, driver_device, 0, "Mattel", "Funtronics Jacks", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) + CONS( 1981, lightfgt, 0, 0, lightfgt, lightfgt, driver_device, 0, "Milton Bradley", "Lightfight", GAME_SUPPORTS_SAVE ) diff --git a/src/mess/layout/funjacks.lay b/src/mess/layout/funjacks.lay new file mode 100644 index 00000000000..924c03af199 --- /dev/null +++ b/src/mess/layout/funjacks.lay @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mess/mess.lst b/src/mess/mess.lst index 3fde7a755be..b55bc3941d8 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -2183,6 +2183,7 @@ ngenb38 // 1991 // Dedicated handhelds/tabletops einvaderc // Entex +funjacks // Mattel lightfgt // Milton Bradley bambball // Bambino