Skip to content

Commit

Permalink
New working clones
Browse files Browse the repository at this point in the history
------------------
Computerized Arcade (COP421 version, model 60-2159A) [hap, Sean Riddle]
  • Loading branch information
happppp committed May 29, 2023
1 parent f85946f commit a5217a6
Show file tree
Hide file tree
Showing 6 changed files with 586 additions and 51 deletions.
186 changes: 158 additions & 28 deletions src/mame/handheld/hh_cop400.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ devices, mostly LED electronic games/toys.

// internal artwork
#include "bshipg.lh" // clickable
#include "comparca.lh" // clickable
#include "ctstein.lh" // clickable
#include "einvaderc.lh"
#include "funjacks.lh" // clickable
Expand Down Expand Up @@ -302,14 +303,14 @@ class h2hbaskbc_state : public hh_cop400_state
void h2hbaskbc_state::write_d(u8 data)
{
// D: led select
m_d = data & 0xf;
m_d = data;
}

void h2hbaskbc_state::write_g(u8 data)
{
// G: led select, input mux
m_inp_mux = data;
m_g = data & 0xf;
m_g = data;
}

void h2hbaskbc_state::write_l(u8 data)
Expand Down Expand Up @@ -453,8 +454,8 @@ class einvaderc_state : public hh_cop400_state
void update_display();
void write_d(u8 data);
void write_g(u8 data);
DECLARE_WRITE_LINE_MEMBER(write_sk);
DECLARE_WRITE_LINE_MEMBER(write_so);
void write_sk(int state);
void write_so(int state);
void write_l(u8 data);
};

Expand Down Expand Up @@ -482,15 +483,15 @@ void einvaderc_state::write_g(u8 data)
update_display();
}

WRITE_LINE_MEMBER(einvaderc_state::write_sk)
void einvaderc_state::write_sk(int state)
{
// SK: speaker out + led grid 8
m_speaker->level_w(state);
m_sk = state;
update_display();
}

WRITE_LINE_MEMBER(einvaderc_state::write_so)
void einvaderc_state::write_so(int state)
{
// SO: led grid 9
m_so = state;
Expand Down Expand Up @@ -708,7 +709,7 @@ class lchicken_state : public hh_cop400_state

void lchicken(machine_config &config);

DECLARE_READ_LINE_MEMBER(motor_switch_r);
int motor_switch_r();

protected:
virtual void machine_start() override;
Expand Down Expand Up @@ -739,7 +740,7 @@ void lchicken_state::machine_start()

// handlers

READ_LINE_MEMBER(lchicken_state::motor_switch_r)
int lchicken_state::motor_switch_r()
{
return m_motor_pos > 0xe8; // approximation
}
Expand All @@ -765,7 +766,7 @@ void lchicken_state::write_d(u8 data)
{
// D0-D3: input mux
// D3: motor on
m_inp_mux = data & 0xf;
m_inp_mux = data;
m_motor_on_out = ~data >> 3 & 1;
}

Expand Down Expand Up @@ -1280,7 +1281,7 @@ void mbaskb2_state::sub_write_g(u8 data)
void mbaskb2_state::sub_write_d(u8 data)
{
// D: led select (high)
m_d = data & 0xf;
m_d = data;
update_display();
}

Expand Down Expand Up @@ -1443,7 +1444,7 @@ void lafootb_state::write_l(u8 data)
void lafootb_state::write_d(u8 data)
{
// D: led select, D2,D3: input mux
m_d = data & 0xf;
m_d = data;
m_inp_mux = data >> 2 & 3;
update_display();
}
Expand Down Expand Up @@ -1561,15 +1562,15 @@ void mdallas_state::write_d(u8 data)
{
// D: select digit, input mux high
m_inp_mux = (m_inp_mux & 0xf) | (data << 4 & 0x30);
m_d = data & 0xf;
m_d = data;
update_display();
}

void mdallas_state::write_g(u8 data)
{
// G: select digit, input mux low
m_inp_mux = (m_inp_mux & 0x30) | (data & 0xf);
m_g = data & 0xf;
m_g = data;
update_display();
}

Expand Down Expand Up @@ -1786,7 +1787,7 @@ class lightfgt_state : public hh_cop400_state

private:
void update_display();
DECLARE_WRITE_LINE_MEMBER(write_so);
void write_so(int state);
void write_d(u8 data);
void write_l(u8 data);
u8 read_g();
Expand All @@ -1800,7 +1801,7 @@ void lightfgt_state::update_display()
m_display->matrix(grid, m_l);
}

WRITE_LINE_MEMBER(lightfgt_state::write_so)
void lightfgt_state::write_so(int state)
{
// SO: led grid 0 (and input mux)
m_so = state;
Expand Down Expand Up @@ -1902,7 +1903,7 @@ ROM_END
* PCB label: 7924750G02 REV A
* COP420 MCU label COP420-JWE/N
see hh_tms1k.cpp bship driver for more information
This is the COP420 version, see hh_tms1k.cpp bship driver for more information.
*******************************************************************************/

Expand All @@ -1923,7 +1924,7 @@ class bshipg_state : public hh_cop400_state
void write_g(u8 data);
u8 read_l();
u8 read_in();
DECLARE_WRITE_LINE_MEMBER(write_so);
void write_so(int state);
};

// handlers
Expand Down Expand Up @@ -1953,7 +1954,7 @@ u8 bshipg_state::read_in()
return read_inputs(4, 0xf00) >> 8;
}

WRITE_LINE_MEMBER(bshipg_state::write_so)
void bshipg_state::write_so(int state)
{
// SO: led
m_display->matrix(1, state);
Expand Down Expand Up @@ -2082,7 +2083,7 @@ class qkracer_state : public hh_cop400_state
void write_g(u8 data);
void write_l(u8 data);
u8 read_in();
DECLARE_WRITE_LINE_MEMBER(write_sk);
void write_sk(int state);
};

// handlers
Expand All @@ -2096,15 +2097,15 @@ void qkracer_state::write_d(u8 data)
{
// D: select digit, D3: input mux low bit
m_inp_mux = (m_inp_mux & ~1) | (data >> 3 & 1);
m_d = data & 0xf;
m_d = data;
update_display();
}

void qkracer_state::write_g(u8 data)
{
// G: select digit, input mux
m_inp_mux = (m_inp_mux & 1) | (data << 1 & 0x1e);
m_g = data & 0xf;
m_g = data;
update_display();
}

Expand All @@ -2121,7 +2122,7 @@ u8 qkracer_state::read_in()
return read_inputs(5, 0xf);
}

WRITE_LINE_MEMBER(qkracer_state::write_sk)
void qkracer_state::write_sk(int state)
{
// SK: green led
m_sk = state;
Expand Down Expand Up @@ -2309,15 +2310,15 @@ void scat_state::write_d(u8 data)
{
// D: select digit, input mux (low)
m_inp_mux = (m_inp_mux & 0x30) | (data & 0xf);
m_d = data & 0xf;
m_d = data;
update_display();
}

void scat_state::write_g(u8 data)
{
// G: select digit, input mux (high)
m_inp_mux = (m_inp_mux & 0xf) | (data << 4 & 0x30);
m_g = data & 0xf;
m_g = data;
update_display();
}

Expand Down Expand Up @@ -2441,7 +2442,7 @@ class vidchal_state : public hh_cop400_state
void update_display();
void write_d(u8 data);
void write_l(u8 data);
DECLARE_WRITE_LINE_MEMBER(write_sk);
void write_sk(int state);
};

// handlers
Expand All @@ -2465,7 +2466,7 @@ void vidchal_state::write_l(u8 data)
update_display();
}

WRITE_LINE_MEMBER(vidchal_state::write_sk)
void vidchal_state::write_sk(int state)
{
// SK: hit led
m_sk = state;
Expand Down Expand Up @@ -2516,6 +2517,133 @@ ROM_END



/*******************************************************************************
Tandy Computerized Arcade (model 60-2159A)
* PCB label: 60-2159A
* COP421 MCU label -B9112 COP421-UPG/N
* 12 lamps behind buttons, 1-bit sound
This is the COP421 version, see hh_tms1k.cpp comparc driver for more information.
*******************************************************************************/

class comparca_state : public hh_cop400_state
{
public:
comparca_state(const machine_config &mconfig, device_type type, const char *tag) :
hh_cop400_state(mconfig, type, tag)
{ }

void comparca(machine_config &config);

private:
void write_d(u8 data);
void write_l(u8 data);
u8 read_l();
u8 read_g();
int read_si();
};

// handlers

void comparca_state::write_d(u8 data)
{
// D: input mux
m_d = m_inp_mux = data;
}

void comparca_state::write_l(u8 data)
{
// L0-L3: lamp data
// L4-L6: lamp select
m_l = data;
m_display->matrix(~m_l >> 4 & 7, m_l);
}

u8 comparca_state::read_l()
{
// L7: Repeat-2 button
return m_inputs[4]->read() << 7 | m_l;
}

u8 comparca_state::read_g()
{
// G: multiplexed inputs
return read_inputs(4, 0xf);
}

int comparca_state::read_si()
{
// SI: D3
return BIT(m_d, 3);
}

// inputs

static INPUT_PORTS_START( comparca )
PORT_START("IN.0") // D0 port G
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 1")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 2")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 3")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4")

PORT_START("IN.1") // D1 port G
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 7")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 8")

PORT_START("IN.2") // D2 port G
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 9")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("Button 11")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_EQUALS) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("Button 12")

PORT_START("IN.3") // D3 port G
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Space-2")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Select")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Play-2/Hit-7")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Start")

PORT_START("IN.4") // L7
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat-2")
INPUT_PORTS_END

// config

void comparca_state::comparca(machine_config &config)
{
// basic machine hardware
COP421(config, m_maincpu, 550000); // approximation - RC osc. R=33K, C=56pF
m_maincpu->set_config(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, false); // guessed
m_maincpu->write_d().set(FUNC(comparca_state::write_d));
m_maincpu->write_l().set(FUNC(comparca_state::write_l));
m_maincpu->read_l().set(FUNC(comparca_state::read_l));
m_maincpu->read_g().set(FUNC(comparca_state::read_g));
m_maincpu->write_so().set(m_speaker, FUNC(speaker_sound_device::level_w));
m_maincpu->read_si().set(FUNC(comparca_state::read_si));

// video hardware
PWM_DISPLAY(config, m_display).set_size(3, 4);
config.set_default_layout(layout_comparca);

// sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}

// roms

ROM_START( comparca )
ROM_REGION( 0x0400, "maincpu", 0 )
ROM_LOAD( "cop421-upg_n.ic1", 0x0000, 0x0400, CRC(dcaf8655) SHA1(68bc84a108476c41f91b882d24cb516ba72a8d99) )
ROM_END





/*******************************************************************************
Texas Instruments My Little Computer
Expand Down Expand Up @@ -2548,7 +2676,7 @@ class lilcomp_state : public hh_cop400_state
void write_l(u8 data);
void write_g(u8 data);
u8 read_g();
DECLARE_WRITE_LINE_MEMBER(write_sk);
void write_sk(int state);

TIMER_DEVICE_CALLBACK_MEMBER(power_off) { set_power(false); }
};
Expand Down Expand Up @@ -2589,7 +2717,7 @@ u8 lilcomp_state::read_g()
return read_inputs(3, m_g);
}

WRITE_LINE_MEMBER(lilcomp_state::write_sk)
void lilcomp_state::write_sk(int state)
{
if (state == m_sk)
return;
Expand Down Expand Up @@ -2698,6 +2826,8 @@ SYST( 1984, solution, 0, 0, scat, solution, scat_state,

SYST( 1987, vidchal, 0, 0, vidchal, vidchal, vidchal_state, empty_init, "Select Merchandise", "Video Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )

SYST( 1981, comparca, comparc, 0, comparca, comparca, comparca_state, empty_init, "Tandy Corporation", "Computerized Arcade (COP421 version, model 60-2159A)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // some of the games: ***

SYST( 1989, lilcomp, 0, 0, lilcomp, lilcomp, lilcomp_state, empty_init, "Texas Instruments", "My Little Computer", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )

// ***: As far as MAME is concerned, the game is emulated fine. But for it to be playable, it requires interaction
Expand Down
Loading

0 comments on commit a5217a6

Please sign in to comment.