The 80 in 84
------------
[Reaction Tester]
Mike Hyams is one of many who still use the ZX80 and
here he presents some valuable tips to all its fans.


Hi there. My name is Zeddy. (What do you mean you've never heard of me? I bet
you've never heard of Tim Hartnell either.) Anyway, there I was, waiting for
a number 84 databus to come along when all of a sudden this geezer shoves a
ZX-printer into my I/O port. Well, I know I've only got a 4K ROM, and there
ain't no way that I'm going to get that printer running, when all of a sudden
...

I think it would be wise to stick a "But seriously folks" in at this point.
Because this article isn't just about interfacing ZX printers with ZX-80s. It's
about the wealth of hardware available, or nearly available, for the 4K ROM
ZX-80.

In most people's eyes the ZX-80 died when the '81 was anounced in 1981. At
that point there were about 50,000 '80s in Britain alone. Add to that the
65,000 in the USA and the rest of the world and you have a force to be
reckoned with. Except, of course, not many people bothered. The ZX-81 and the
Spectrum each had an "essential" hardware extra announced at launch. These
were the printer and, after a while, the microdrive. The hardware add-ons
offered by the independant companies have reflected the quality of Sinclair's
own. For example speech, sound, joysticks, and so on. The ZX-80, however,
only had a 16K RAM pack as its extra. Revolutionary as it was then, it hardly
compensates the '80 owner of today, who sees so much zap-pow-boom going on
around them, that a dash to the nearest computer retailer is imminent; if
it hasn't happened already.

But do not despair; for help, and hardware, is at hand. I will now make a
bold and sweeping statement. At least 50% of ZX-81 hardware will work on a
ZX-80. There, I said it. And it didn't even hurt. I'm going to get a bit
technical for a couple of paragraphs, so those of you who shudder at the sight
of strange words with lines over them can go and amuse themselves with Figure 1. 
By the time you've finished playing with that, us hardware buffs should be
finished.

Now then. The words I just referred to above are ROM_CS and RAM_CS. These are
very important to all Z80 based computers, (and more than likely all other
computers, but that doesn't concern us). First of all, let us consider the
port at the back where you would plug in a RAM pack. If you compare the
circuit diagrams of the '80 and the '81, you will find that all but one of
the tracks on the port match. Address line one is in the same place on both
machines; so is the 0 volts line; and so on.

All except for track 23B, which is on the extreme right underside of the
port, looking at it from the front. On,the '8O this track is not connected; 
on the '81 it is the ROM_CS line. So what? Well, as you will see, it has an 
effect on what hardware can be used.

Having established the differences between the two computers we can now move
on to Technical Bit number two. (Those of you who are getting a bit bored
with all this talk of ports and tracks, try ordering a QL and find out what
REAL boredom is all about.) There are two methods of making your Sinclair
talk to a hardware add on. One is by using memory locations and the other is
by using Input/Output ports. An I/O port is a sort of lateral-thinking
version of the memory. If I were to compare a computer to a human being (and
who doesn't these days) the computer's memory would be like the brain, whereas
the I/O would be things like hands, eyes and mouth. As its name suggests, the
I/O port is the computers link with the outside world. On the Z80 chip there
are 256 of these ports, but some are unavailable for use on the '80. They are
used for the keyboard, cassette, and TV, but, fortunately for us, the same
ports are used on the '81. Fortunately because this means that any hardware
designed for the I/O port on the '81 should work on the '80.

"Aha", I hear you cry. And those of you still playing with Figure 1 should
come back for Revelation number two. The ZX printer is purely I/O driven. The
port it uses, FBh, is well documented in the manual supplied with it. So we
turn to Figure 2. This is a relocatable machine code routine for using the
4K ROM ZX-80 and the ZX printer together, using the equivalent of the COPY
command.

As a brief aside, while some of you are rushing out to buy ZX printers, you
might consider 16K of RAM. When extra RAM first appeared for the '80 the cost
was over 60 for just 3K. 16K packs can now be bought for less than 20. I
know that they are made for the '81, but I think you'll find that they work on
the '80 as well. I use Sinclair's '81 RAMpack and it works perfectly.

To get back to the printer listing; you will notice that the machine code
part is in hex. This is more convenient than decimal when a large amount of
data is being entered. The second byte of the code, which is the third and
fourth characters in string A$, tells the computer how many lines to copy.
For a normal screen copy this is set to 23, or 17 in hex. If you would
rather use the routine as an LPRINT command, this number can be reduced. For
example to dump just one line to the printer, change the second byte to a 1.
This is done by either changing the "17" to "01", or by POKEing the relevant
memory location with a 1; ie. if the code is stored from 32000 onwards then
poke 32001 with a 1. This will then COPY the first line on the screen to the
printer. To activate the routine just use a USR function. The way Figure 2
is set at the moment, RANDOMIZE USR (30000) will produce a screen copy. If
you put the code lower down the memory to say, 18000, then a call to that
address will activate it.

For machine code freaks, I can tell you that this routine can be adapted to
produce hi-res graphics on the printer. I won't tell you how, but I'll give
you a clue. The ZX-80 character set starts at 3584 (or 7x512) and the
pointer is stored in register H, so if you can find the instruction LD H,7
then you're half-way there. The rest is up to you (unless Ray gets lots of
letters, in which case I may explain further. Never let it be said that ZX
Computing doesn't make you think.).

We now know enough about the I/O port to say that ALL I/O mapped products
should work on the '80. After the printer and RAM pack, the most popular
extras would appear to be speech and sound. A quick flick through the pages
of this mag should produce two or three adverts for these on the '81. If you
are interested in purchasing one of these for your '80 then check with the
manufacturer first, to see if it is I/O or memory mapped. Remember, if it is
memory mapped it will probably have a connection to the ROM_CS line which
isn't connected, so it more than likely won't work.

Two units for the '81, ZXM and ZXS, made by Timedata, ARE I/O mapped and DO
work on the '80. These are sound (music) and speech synthesizers, but
unfortunately Timedata has withdrawn them from sale, probably due to lack of
demand, although the official reason is ... "No reason". It might be worth
giving them a call just in case they still have a few in stock, as they were
fine products. Alternatively, there are others still on sale. The Chatterbox
from William Stuart Systems is also I/O mapped (or it was last time I looked)
as is the ZONX-81 from Bi-pak. These units, speech and sound respectively are
still available, and could well extend your ZX-80 beyond what you thought
possible. There are others, such as the Cheetah Sweet Talker, but I'm afraid
I haven't had time to check what type of mapping is used.

One point to bear in mind when using these I/O units is how you are actually
going to program them. Because they are I/O, you have to use the instructions
IN and OUT. After a series of finger stretching exercises you can get to
these in Spectrum BASIC, but on the '80 and '81 they are only available via
machine code. Most, if not all, the above products come supplied with
instructions on how to do this, but it will require some effort to implement
these if you haven't used m/c before. You could always ask a friend.

While browsing through the ads, looking for things to hang on the end of an
'80, I came across two items that could be placed inside the case. The first
is from P.V. Tubes and appears to be a 8K ROM chip. Those of you hankering
after string-slicing and real numbers (but not SLOW) might like to give them
a call. The other chip is a Forth ROM from David Husbands' Skywave Software.
This may or may not work on the '80 because of the lack of SLOW hardware.
Again, a phone call should clear things up.

Before we leave the subject of I/O, a quick mention of Maplins I/O port. For
those of you who want to control your central heating or perhaps run Fulham
Power Station, this could be what you've been looking for.

My next few notes are, I'm afraid, rather hazy. I know the technique, I have
read that it works, but I just haven't got the nerve to do it. What I refer
to is the ROM_CS connection. For those who wish to throw caution to the wind
(you fools) here is the theory.

The ROM_CS pin must be connected to track 23B. To do this break the track
leading to pin 20 of the ROM chip, and put a 680 ohm resistor across the
break. Then take a wire from this pin to track 23B on the edge connector.
This track should be labelled on the circuit board. This now gives a ROM_CS
for all add ons. The amount of hardware that can now be used increases
significantly with this change. I have not made this connection, but I would
be interested to hear from anybody who has, and what they use that takes
advantage of it.

If you look at Figure 3 you can see how the '80 memory is arranged. It
appears that there is more than one ROM, although there is obviously only
one. The problem is that the '80 has been built in such a way that chunks of
memory keep repeating throughout the memory map. If you want to use an add-on
that uses part of the memory with a ROM copy in it, then you're stuck. Unless
you have connected the ROM_CS track. This hardware will try to turn off part
of the memory, usually the 8K-16K bank. If the connection is made, the unit
should work.

One of the most interesting add-ons that utilises the ROM_CS line is an EPROM
programmer. These are available from, amongst others, Eprom Services and
Camel Products. Even if you have moved onto another computer, the possibility
of using an old '80 to make your own ROMs must interest a few of you.

Other peripherals that use the ROM_CS track are the range from Memotech.
These units will need some careful inspection before use, as some of them may
use ROM calls in the firmware supplied. One Memotech unit that should work is
the keyboard. As it uses the I/O method it should be alright, but the legends
on the keys will need changing. The DK'tronics keyboard would be just as
good, but the wires would need to be soldered in as there are no sockets, the
keyboard being part of the circuit board.

On the memory pack side, 32K and 64K RAM packs should work with the
aforementioned connection. Quite how you can POKE a location greater than
32767 from BASIC I'm not sure, but I expect someone has done it.

Well that just about wraps it up. I hope I have shown you thatthe ZX-80 is
not dead, but merely resting. If you have any problems then call the
manufacturer; most are only too pleased to help, and there's usually someone 
near the phone who knows the technical ins and outs (no pun intended). Or 
write to me at the Golden Square address and I'll do my best to help.

The program in Figure 1, by the way, is a little routine that some friends
and I nearly used to study the effects of alcohol on reaction speeds.
However, we never got round to using it because we were too busy trying out
alcohol supplies. Try running the program before and after 10 press-ups. You
may be surprised by the results.

If I can convince Ray to give me some space in a future issue I'll go into the
mathematical aspect of using your '80. With a litle bit of software, and a
little bit more understanding, I'll show you some repetitive floating point
maths. Now where did I put my Log tables?
