PC-IEEE


DISCLAIMER

-    All names with a copyright are acknowledged.
-    If the reader uses information from this document to write
     software or build hardware, then it is on his own account. I
     cannot be held responsible for blowing up your computer,
     mother-in-law or whatever; it will always be your own fault.
-    I'm not a sexist, with 'he' and 'him' I also mean 'she' and
     'her'.


Copyrights

You may copy every bit on this page for NON-commercial use. I
hope you enjoy it. If you use it, just give me at least some
credit like "Stolen from Ruud" :-)


What is it?

PC-IEEE is a project where I am going to use a PC as an harddisk
for all the Commodores equiped with an IEEE-488 interface like
the older PET/CBM-models. As an small bonus you can use your
CD-ROM, 1.44 MB-drive and your network-drives as well!
Products: software, a cable and a card inside/attached to your
PC.


The story

November 1996 my lovely wife bought me a C= 8032 SK. Unfortunaly
without manuals or what so ever. At the same time I worked at the
Open Univercity of Heerlen which had access to Internet with a 2
MB-line. During my breaks I found almost everything about this
nice looking machine (really, that was the reason she bought it)
except the schematics. I didn't have any plans with it yet due to
the fact that I had no means to repair it in case something went
wrong. Then I could lay my hands on a 8250, 4040, 720, 8296,
3008, 8032 and another 8032 SK. Very recently I was promised a
cartridge with an IEEE-interface for the C64. This triggered the
idea of building an IEEE-interface card for the PC as well.


Pre-realisation

If you forgot how IEEE-488 looked like, take a peek at the
document here on FUMET.
We have 16 lines in total. Eight of them are used for transfering
data. All eight are either input, output or tristate. The state
of each of the other eight lines depends on the fact what role
the device is performing at the moment: a listener, a talker or a
controller.
So we first have to decide what kind of role our PC is going to
play. As a disk it must perform read- and write-operations
meaning performing at least as a talker and a listener. But It
could be handy to give the PC controller facilities as well: in
this way you can copy floppies without the need to activate your
Commodore!


What can we build:

-    A complete card for in your PC
-    An add-on-card for a LPT-port


Building a complete card

The design depends on the choice of buffers. The use of the
MC3446 (or equivalents) as buffers has one big disadvantage: you
need a sepperate in- and outputline for every line of the
interface. This means 16 for the data and 16 for the rest. When
the interface is only used with C= peripherals then 14 wil do.
But then we still need 30 lines.
The second solution is the use of a 74LS245 as buffer for the
data and 7407s to buffer the other lines. But now we need 25
lines: 8 lines are bidirectional, 9 are to be configured as
output and 8 as input. The extra output line is needed for to
steer the 245.
Using the SN75160 and SN75161 you only need 20 lines at maximum.
The only possible problem is their availability and with a price
of ~$8.00 each they aren't cheap.

Second we have to choose the I/O-IC(s) responsible for steering
the buffers. With solution one we need at least 2 PIOs or
equivalent ICs.
With the  second solution  we could use a 8255 if we could
sacrifice 1 output. As the CBMs and PETs don't use REN at all, we
have found our line to sacrifice. Using this solution with the
74LS245 and 7407s has one advantage. You can  'replace'  these by
a SN75160 and 2 MC3446s without the need to change the software.
With only 20 lines the 8255 seems to be the ideal IC for the
third solution . But using the 8255 in combination with the
SN75161 we'll meet an eeny teeny problem due to the way (parts of
the) ports are configured as in- or output. Port A and B can only
be configured as in- or output port for the whole port. C can be
configured in two blocks of 4 lines each.

Possible internal configurations of the 75161:

                                         |  ATN
                                |  NDAC  |  IFC
                                |  NRFD  |  REN
  ATN  |  TE   |  DC   ||  EOI  |  DAVV  |  SQR
-------------------------------------------------
   L   |   L   |   L   ||   O   |   O    |   O
   L   |   L   |   H   ||   I   |   O    |   I    --- A
   L   |   H   |   L   ||   O   |   I    |   O
   L   |   H   |   H   ||   I   |   I    |   I
   H   |   L   |   L   ||   O   |   O    |   O
   H   |   L   |   H   ||   O   |   O    |   I    --- B
   H   |   H   |   L   ||   I   |   I    |   O
   H   |   H   |   H   ||   I   |   I    |   I

Situation A will occure when a device is configured as a
Listener. This means that EOI cannot be in the same block as
NDAC, NRFD and DAVV. Situation B will occure when a device is
configured as Talker. This means EOI cannot be in the same block
as ATN etc. This would mean we need 5 blocks in total: Data,
TE/DC, EOI, NDAC and ATN. But the 8255 has only 4 :-( There is a
solution for this conflict but a tricky one! At the moment the
SN75161 as well as the 8255 have to be output for certain lines,
the 8255 first reads the output of the SN75161 and programs its
outputlines in the same way.


An add-on-card for a LPT-port

The standard LPT-port has 12 outputs and 5 inputs. My idea is to
use the 8 data-outputs for providing the signals towards the
IEEE-bus, the 4 inputs to read the signals and 3 other outputs to
steer the whole configuration. Because the data-outputs are used
for more then one task, we need to latch the data in 2 74ALS574s.
The output of these ICs is connected to the IEEE-bus via some
7407-buffers to provide the necessary OC-outputs. The input is
taken care of by 2 74LS244s; each half can take care of 4 bits. A
138 delivers the needed signals to dis/enable all ICs. The left
over output on the LPT-port we use to disable the 138.
How does it work? A databyte is placed on the databus and then
the 'address' of the data-574 is supplied to the 138. The corre-
sponding output goes (L) and the data is clocked into the 574.
This can be done with the control-574 as well. Writing $FF to the
574s 'disables' them (needed for the 7407s). Writing the right
address to the 138 selects one of the four 244-halves for
reading.

One thing must be kept in mind and that is the fact that when you
power up your PC the state of the outputs of the 574s are
officialy unknown. My experience is that the outputs are (L)
after powering up. This means that the PC will block the complete
IEEE-bus until a program 'resets' the 574s. If the PC is not to
be used as harddisk at that moment, I advise you to execute a
program in your AUTOEXEC.BAT, .profile or whatever startupfile
your OS uses, to 'reset' the 574s. In this way you can use both
systems without the fear that the PC blocks all transfers on the
IEEE-bus.
If you don't use the PC at all, I mean power off, but still want
to use the rest of the system, then you have again a problem: I
simply don't know how the 7407s and 244s behave if powered down.
In this case I advise you to disconnect the PC from the rest.
Because this connnnecting and disconnecting can become annoying
because of the place of the cables, I came with the following
solution : replace the 7407s by MC3446s! The nice thing about
this solution is that you can use the same software!

Because bi-directional ports are quit common today, I'll give a
solution for this one as well. For a bidirectional LPT-port we
need less hardware as for the standard port. Instead of the 244s
we use 74LS541s. The outputs of these IC we connect with the
datapins of the LPT-port as well. As there are only four enable-
lines we don't need a 138 anymore; we directly connect them to 4
of the outputs of the port.
How does this work? Writing towards the 574s is as above. Reading
of the 541s involves that the direction of databus of the LPT-
port is reversed. Activate the right output and the choosen 541
can be read.

WARNING: with the above 'standard-HW' nothing can go wrong but
with this one everything can! The worst thing that can happen is
that the data bus of the LPT-port is switched to output and both
the 541s are selected.....smoke! (This problem cannot occur after
a reset because the choosen line to enable the 541s are (H) after
startup). Even an 138 won't help (look at IEEE_BI2.GIF).
So to be on the safe side I recommend the 'standard-HW'. The only
disadvantage of this design is that the I/O is a little bit
slower due to the fact that you need to perform an extra read-
operation plus some bitshifting.

One thing isn't mentioned yet and that is the powersupply for the
card. To avoid an external PS we simply take the needed 5 Volt
from the joystick- or keyboard-connector.


Schematics

"IEEE.GIF"    : PC card with 75160/1.
"IEEE2.GIF"   : PC card with 245 and 07s.
"IEEE_LPT.GIF": Add-on with TTL-ICs for standard port.
"IEEE_LP2.GIF": Add-on with MC3446s for standard port.
"IEEE_BI.GIF" : Add-on with TTL-ICs for bidirectional port.
"IEEE_BI2.GIF": Add-on with MC3446s for bidirectional port.


You can reach me at:

rbaltiss@worldaccess.nl


Have fun, Ruud Baltissen
