1. Not old. Vintage. :)

Adding a Second PIA to the Atari 8-Bit

Credit: ZZT


The Atari PIA

PORTA Adr. D300 (54016) PORTA
PACTL Adr. D302 (54018) PACTL

Note: Don't mess with PORTB or your Atari may crash because three ouputs makes subcontrol between PIA and MMU (memory management).

ALL PORT-A INPUT

1 POKE 54018,56
2 POKE 54016,0
3 POKE 54018,60
Now PIA is ready to GET data
4 DATA=PEEK(54016)

ALL PORT A OUTPUT
1 POKE 54018,56
2 POKE 54016,255
3 POKE 54018,60
Now PIA is ready to PUT data
4 POKE 54016,DATA

In booting process, PORT-A is set all input to read joysticks. If you want the oposite, type "all output routine". To back, type "all input routine", or just press reset.

Warning, if you set PIA as all output, don't short any line to ground or Vcc or may damage the PIA.

This is for the Atari PIA.


With the original PIA, if you want more output or inputs, you are in trouble.

I solve this problem like this:

I take a good look at the 800XL schematic and see how the PIA talk with the CPU. Adress A0 A1 Data Bus D0 to D7, Clock 02, Reset, R/W, IRQ and...... CS2. There's the magic. (CS means Chip Select).

The 800XL have a small 74LS138 chip at U2. This one decodes three adress (A8 A9 A10) to eight outputs. Each one to select chips from D000 to D700. Like this:

PIN 15 D000 select GTIA
PIN 14 D100 free
PIN 13 D200 select POKEY
PIN 12 D300 select PIA
PIN 11 D400 free
PIN 10 D500 cartridge (cctl)
PIN 9 D600 free
PIN 7 D700 free

I already use D500 for many other mods, so, I know is a very safe direction to make anything. I use D500 U2 pin10 to pin 23 of the second PIA.

Here is the equivalence between the standard PIA addressing mode and the second one:

PORTA D300 54016 ==> D500 54528
PORTB D301 54017 ==> D501 54529
PACTL D302 54018 ==> D502 54530
PBCTL D303 54019 ==> D503 54531

All signals can be taken directly from the existing PIA (piggback) or from parallel port or cartridge port. The only exeption is CS2 (pin 23), this one must be connected to U2 pìn 10.

Now, you can use both ports of this second PIA to have 16 extra outputs, or 8 inputs and 8 output... or what you want. And notice, you still having the PORTA free.

The only issue: you cant use the cartridge and the second PIA at the same time. But if you dont use the cartridge.... no problem.

Now I'm testing D100, aparently is absolute free and let me use the cartridge at the same time... testing.

ZZT

Here the interaction between the 800XL and PIA and how I connect the second one. Dashed line for D500 or D100 to choose. both address work fine for me, but if D500 is used, you can't run the cartridge. So, you can put another PIA! One in D100, two in D300 (standard) and three at D500.

Also two extra outputs at CA2 and CB2!
__________________________________________
Here PIA 2 setup at D500

ALL PORT-A INPUT
1 POKE 54530,56
2 POKE 54528,0
3 POKE 54530,60
Now PIA is ready to GET data
4 DATA=PEEK(54528)

ALL PORT-A OUTPUT
1 POKE 54530,56
2 POKE 54528,255
3 POKE 54530,60
Now PIA is ready to PUT data
4 POKE 54528,DATA
---------------------
ALL PORT-B INPUT
1 POKE 54531,56
2 POKE 54529,0
3 POKE 54531,60
Now PIA is ready to GET data
4 DATA=PEEK(54529)

ALL PORT-B OUTPUT
1 POKE 54531,56
2 POKE 54529,255
3 POKE 54531,60
Now PIA is ready to PUT data
4 POKE 54529,DATA

Rate This Article:

    1. Graham Apr 27, 2020
      Yep Still have the design on tap, also breaks down D500, to 8 blocks, by supplying additional address lines.
      happy to post up under Hmm I guess hardware.
      not looked around enough yet to find where 'stuff' is
    2. Timothy Kline Feb 15, 2020
      I am absolutely clueless on why this is not taken advantage of. In fact, that gives me an idea... let's talk about this more in Hardware... see you there!
      Graham and Andy Barr like this.
    3. M.D.Baker Feb 15, 2020
      Excellent. I do believe I also saved some second PIA instructions (schematic form mostly) from SimplyGraham on AS. when we got side-tracked in the what's new pussycat thread over there.
      Graham, Andy Barr and Timothy Kline like this.