Need advice or suggestion on this project:

Someone made an adapter that replaced the original Intellivision game controller with Atari Jaguar controller. I would like it because Intellivision controllers are poorly made and doesn't last long: exposed aluminum oxidates and can crack as well. However the old design from the web site (link below) required a lot of parts to convert the data from one to another, which made the adapter seems overly large. :fearful:

I wanted to try and shrink that to at most mega 2560 sized with no shield. Hopefully I could shrink to Nano sized or even Pro Mini (no need for USB after it's done right?) In theory I'd need only 18 I/O total (13 digital and 5 analog treated as digital) and leaves just one for LED on 13.Everything should run on 5v.

I'd need 10 total for Jaguar (4 output to control columns, 6 to read rows) and 8 for Intellivision side (all 8 output to Intellivision)

here's the web site: The 8-Bit Lab Rat I have made Arduino working with that part, decoding the data from Jaguar controller. However I'm a bit stuck on the next part for Intellivision side:

The 8-Bit Lab Rat for how to connect the output from Jaguar to Intellivision console, and here's the truth table for Intellivision controller:
http://arcarc.xmission.com/Web%20Archives/Deathskull%20(May-2006)/games/tech/intvcont.html

There are 8 "data" pins on Intellivision (9th pin is ground source) and if I was to press a button on Jaguar controller, I'd need to pull associated line(s) to ground. Otherwise leave it floating. The one page above uses a lot of diode and I'd need a mega prototype shield (and a Mega2560 for minimum 31 I/O) to use that, which I wanted to avoid. Can someone guide me into making so Arduino can control only 8 lines and not need to decode up to 21 different buttons from Jaguar then use diode networks to connect to Intellivision.

Take for example, checking the truth table if I pressed up (north, direction #1 in truth table link above) and I pressed button 1 at the same time, I'd need to write LOW to pin 2 (for up), 4 and 6 (for button 1) and leave rest floating. To make things interesting, all lines are shared. So yeah, pressing multiple buttons can screw the game but it's been that way for 30 years now. :smiley: XD People who still plays this are used to not pressing multiple buttons at once.

I'd like a way to figure like this:

if (West, *, 0, or #) is pressed on Jag controller, write LOW to pin named Inv1. However I've had problem using OR multiple times in a single if command.

I am using ! to get LOW (0) if any of the statement on the line is true. Else it should write HIGH (1) to the named output pin

Pin# refers to the connections on Intellivision console. The variable Inv** would be LOW or HIGH (HIGH if true) as read from Jaguar controller. The last part is the worst for me since it need 2 direction at the same time and if any of the 4 sets are true and high, then write low.

digitalWrite !(Pin1, InvLe | InvCl | Inv0 | InvEn);
digitalWrite !(Pin2, InvUp | Inv7 | Inv8 | Inv9 | InvP);
digitalWrite !(Pin3, InvRi | Inv4 | Inv5 | Inv6);
digitalWrite !(Pin4, InvDo | Inv1 | Inv2 | Inv3 | InvP);
digitalWrite !(Pin6, InvS1 | InvS3 | InvP | Inv1 | Inv4 | Inv 7 | InvCl);
digitalWrite !(Pin7, InvS2 | InvS3 | Inv2 | Inv5 | Inv 8 | Inv0);
digitalWrite !(Pin8, InvS1 | InvS2 | InvP | Inv3 | Inv6 | Inv 9 | InvEn);
digitalWrite !(Pin9, (InvUp == InvLe == HIGH) | (InvLe == InvDo == HIGH) | (InvDo == InvRi == HIGH) | (InvRi == InvUp == HIGH);

Arduino doesn't support floating output. Thus I'd like to know if there's a solution to this. I checked schematic and as far as I know, there's no external pull up resistors on any of the controller input but datasheet for really old GI series chips (specifically AY-3-8914) is painfully hard to find. I am guessing there are internal pullups to 5v but I'd like to get the code working before I start poking inside my Intellivision system. I could use LEDs to simulate the output to verify it works as desired befopre I mess with my game system.

Forgive me if you smell something burning, my brain isn't used to complicated true and false statements. Last time I tried to write something complicated, Commodore 64 was the king of the computer and I was still in school. Flash memory was expensive as heck and a floppy disk holding about 180k each side used to be about $3 each. (today you can get 4GB flash for the same price!)

Why do you use an exclamation mark after digitalWrite(). That is not possible.
What you do for pin9 is not okay. You better use a few lines with "if" statements.

If the output signals are for TTL level open collector, you could connect the Arduino outputs to it.
If you set a digital output to a input, it becomes high impedance. You can even set the internal pull-up resistor. That way you can create some kind of open collector.

You could create a table with that data.
In this example, I use "pin 1" as bit 0. You can choose something else if you like.

const int Chart[] = {
  0x02,       // D1 = second pin
  0x12,       // D2 = second and nineth pin
  ...
  };

In the code, the array has to be used to set the outputs.
This is how I would do it, but is requires a longer sketch.

Misplaced ! mark, I moved it and added parenthesis to the variable. So if any of the 4 or 5 variable is true, it should write low.

   digitalWrite (Pin1, !(InvLe | InvCl | Inv0 | InvEn));
   digitalWrite (Pin2, !(InvUp | Inv7 | Inv8 | Inv9 | InvP));
   digitalWrite (Pin3, !(InvRi | Inv4 | Inv5 | Inv6)));
   digitalWrite (Pin4, !(InvDo | Inv1 | Inv2 | Inv3 | InvP));
   digitalWrite (Pin6, !(InvS1 | InvS3 | Inv1 | Inv4 | Inv 7 | InvCl| InvP));
   digitalWrite (Pin7, !(InvS2 | InvS3 | Inv2 | Inv5 | Inv 8 | Inv0));
   digitalWrite (Pin8, !(InvS1 | InvS2 | Inv3 | Inv6 | Inv 9 | InvEn| InvP));

Also expanded pin 9 into a total of 5 step if - else. The first 4 checks if any of the 2 variables are true, write low. Else write high

if (InvUp==InvLe==1) {
digitalWrite(Pin9,LOW); // up and left
}
else if (InvLe==InvDo==HIGH) {
digitalWrite(Pin9,LOW); // down and left
}
else if (InvDo==InvRi==HIGH) {
digitalWrite(Pin9,LOW); // down and right
}
else if (InvRi==InvUp==HIGH) {
digitalWrite(Pin9,LOW); // up and right
}
else
{
digitalWrite(Pin9,HIGH); // no diagonal control
}

No more error message.

I didn't use array because I haven't learned to use array yet. I've had no proper training in Arduino coding and I just go by the seat of my pants. Plus Google search if it's behaving for me. It'd be hard to learn if I didn't make mistake and figure out why.

I'm looking at the table with D1...D15, K0...K9, S1...S3, Clear, Enter.
I'm looking at your code.
But I don't see how that could be the same.

Erdin:
I'm looking at the table with D1...D15, K0...K9, S1...S3, Clear, Enter.
I'm looking at your code.
But I don't see how that could be the same.

That's because I'm using variable that is a bit easier to understand. InvUp for example should suggest up position for Intellivision. The truth table on the web page uses Dxx, Kxx, Sxx which on its own doesn't tell what it's used for and I prefer not to use Dxx unless it's specifically for data bus. (ie between microprocessor and RAM chips)

I've already listed the variables before void setup() all with // comment explaining what it's for. I'll make the final version available fully for anyone who would want to play with Jaguar controller or connecting to Intellivision controller.