\documentclass[a4paper]{article}
\begin{document}

\begin{center}
The HP9100 -- HP's first calculators.
\end{center}
 
In 1968, Hewlett-Packard sold their first calculator, a transistorised 
desktop machine called the HP9100A. 1 year later they released an 
improved model, the HP9100B, which had twice as much memory and a couple 
of extra functions. Since I only have an HP9100B (it's that machine on 
the bench there), most of this talk will be directed towards that machine.

For the time, the HP9100 was an amazing product. As well as performing 
the standard 4 functions, it also had the scientific fuctions 
(logarithms, trigonometric functions, etc) and was programmable. A 
sequence of operations, including branches and even subroutines (on the 
HP9100B) could be stored in non-volatile magnetic core memory and 
executed when desired. Programs could be saved on little magnetic cards 
and loaded back again

\noindent
{\bf Wave an HP9100 card about if I've remembered to bring one}

I am not going to say too much about using the machine because you all 
know how to use a calculator. Just out of curiousity, how many of you 
have used a stack-based (RPN/RPL) calculator or a stack based language 
(Forth, Postscript, \ldots)? 

\noindent
{\bf In this part, demonstrate things as appropriate}

The HP9100 has a 3 level stack called X (the keyboard register), Y (the 
accumulator) and Z (Temporary storage). All 3 stack registers are 
displayed on the built-in CRT display. Numbers typed on the keyboard go 
into the X register. Single-argument functions take the number from X and 
return the result to X. Two argument functions take the values from X and 
Y and return the result to Y (not X, as you'd expect on more modern 
machines).

I would now like to tell you a little about the internals of the machine.
Over the years, many myths have been spread about the machine, some by
myself, and I intend to clear those up as well.

If you are going to investigate a machine, it's sensible to begin with 
the available manuals. HP published 3 manuals on the 9100 : 

\noindent
{\bf Put up OHP : HP's view of the 9100 with the lower part covered}

\begin{itemize}
\item Operating and Programming manual --- a good guide on using the 
machine, but nothing on how it works
\item Interfacing manual --- how to connect peripherals to the connector 
on the back. A fair amount of internal information, actually --- if you 
can decipher it, as much of it is hidden
\item Service manual --- how to `fix' a broken machine. This documents the 
`top case' --- the PSU and CRT driver), but almost no 
technical information at all on the logic units --- HP intended you to swap 
boards until it worked again. This is, of course, no way to repair a machine.
\end{itemize}

From these, we get the HP view of the 9100 :

\noindent
{\bf Uncover the rest of the OHP}

As you can see, the processor section is made up of various modules, 
which themselves consist of 'Deep Magic'.


So, if the manuals are no good, what else could I use? The machine 
itself, of course. I took my 9100B to bits. Not just pulling out the 
plug-in cards. But also taking the 4 modules that make up the `base 
assembly' apart. And then desoldering the 4 modules that make up the ROM 
from each other. And taking the keyboard and card reader apart. And I 
probed them with test equipment. And I thought a bit. And I probed some 
more. And thought some more. I waved my magic wand (which happens to 
say `LogicDart' on it). And in the end I came up with ARD's view of the 
9100B 

\noindent
{\bf Put up OHP : ARD's view of the 9100B}

As you can clearly see, the magic has gone, replaced by simple 
electronics. And that's the first thing that struck me about the 9100 --- 
how very simple it is. There are only a few thousand components inside. 
Compare that to the millions of components on a modern chip.

Obviously, in a short talk like this, I can't explain everything. But I 
can at least explain some of the machine. Since the power supply and the 
display circuits in the top case are already relatively well understood, 
I shall not be describing those, but will concentrate on the logic in the 
processor unit.

I shall begin with the board that I looked at first when I was working it 
all out. This one. It's clear that it contains a number of identical 
stages and some simple control circuitry. There are 40 hybrid circuits, 
80 transistors, and 80 diodes in the main part of the board, so it 
appears there are either 40 or 20 circuits on it. And a little 
investigation showed that the hybrids were used in pairs, suggesting 20 
identical circuits.

A few measurements on the hybrid suggested that the internal circuit was 

\noindent 
{\bf Put up the OHP : flip-flop circuit, part 1}

Since they appear in pairs, lets have another one

\noindent
{\bf Put up the OHP : flip-flop circuit, part 2 as well}

Add the 4 transistors and 4 diodes

\noindent
{\bf Put up the OHP : flip-flop circuit, part 3 as well}

And wire it all up

\noindent
{\bf Put up the OHP : flip flop circuit part 4 as well}

Now that circuit is one that I recognise. In 1919, Eccles and Jordan, 
wrote a paper entitled 'A trigger relay using 3-electrode electron tubes' 
in which they described how interconnecting a pair of triodes could make 
a circuit with 2 stable states --- in other words the first flip-flop. 
This circuit, of course, is fundamental to electronic computers.

\noindent
{\bf Put up the OHP : Eccles and Jordan paper (if I have it)}

And that's what we have here. The lower 2 transistors are an 
Eccles-Jordan flip-flop. The upper 2 are simply inverters for the input 
signals. In order to make it change state, we need to apply a positive 
pulse (towards ground) on the top plate of one of the 100pF capacitors. 
That will cut off the appropriate transistor, allowing the other one to 
turn on.

And to do that, we need to turn on one of the upper transistors. In turn, 
to do that, we need to sink current out of its base. While the clock line 
is `high' (close to ground), that current will be supplied by the diode, 
and thus the transistor can't turn on. But as soon as the clock goes low, 
current is drawn out of the base, turning on the transistor and operating 
the flip-flop.

It is important to remember that the flip-flops in the 9100 are 
current-operated, and that there is almost no change in voltage between 
an active and inactive logic input. This has several consequences, among 
them : 
\begin{itemize}
\item You can't use a logic probe or logic analyser to examine the 
flip-flop inputs in a 9100, since these instruments respond to voltage 
changes.
\item You can't drive several inputs `in parallel', since if you tried to 
sink current from 2 or more inputs in this way, it's not certain that all 
of them would in fact supply current, and thus change state.
\end{itemize}

Since the emitter of that transistor is connected to a -2.4V supply, the 
current sink must be at a lower voltage (towards the -15V rail) than 
that. But the outputs swing (essentially) between the supply rails.

Also note that both outputs (normal and inverted) are available. In 
modern electronics, inverting a signal inside an integrated circuit 
is easy, while routing signals around a PCB is more difficult. So, although 
all (symmetrical) flip-flops can provide both outputs, it's rare to use 
them. In the 9100, inverters are `expensive' --- they need a transistor, 
and they need power. So in general, both outputs of the flip-flops are 
used, since that gets an inverter `for free'.

Having got some flip-flops, we need gates to interconnect them. There are 
only 2 basic circuits in the 9100 : 

\noindent
{\bf Put up OHP : gating circuits}

The top one is an OR gate. To sink current into the 'Output' node, we 
need to sink current from at least one of the inputs.

The lower out is a form of AND gate. To sink current into the output 
node, the end of the resistor needs to be low (towards the -15V rail), 
and the input of the other diode must not be high (towards the 0V rail), 
since if it is above -2.4V, the current will come through this diode and 
not from the flip-flop input via that diode.

And those are the basic logic circuits in the 9100B. Of course you can
make more complex versions, for example extra diodes/inputs on the AND
gate. And you can link the outputs of the AND gates together to make
AND-OR gates. I will now explain how they are used together with some of
the other circuitry.

I will begin with the `A1 control logic board', here. This board contains
the master clock --- this is the crystal, and a braided wire ROM. There are
29 cores across the bottom of the board. 64 wires are each threaded though
some of the cores and not through others. A current pulse through one of
these wires will induce a voltage in the coils wound on the cores that it
passes through. The outputs of these coils then control other parts of the
machine. 

There have been many myths spread about the function of this ROM. It is 
not a clock sequencer. And nor is it an instruction decoder. Instead it's 
a microcode program. It is, in a sense, the control program for the 
9100's CPU. 

Since there are 64 wires, this ROM has 64 locations, and needs 6 address 
lines. The address is provided by 6 of the flip-flops on the board 
alongside it in the machine, and as ever both the `normal' and `inverted' 
outputs are used to simplify the ROM address decoder on the control logic 
board. The next overhead shows how the high 3 address lines are decoded 
to drive the wires --- a similar circuit decodes the low 3 address lines.

\noindent
{\bf Put up OHP : Control logic sheet 3}
 
For example, when the high 3 bits correspond to a high (octal) digit of 5,
then AddrF (an output of one of the flip-flops) is high, so Q16 is cut
off. AddrF/ is low, so Q26 is turned on. AddrE/ is high, cutting off
Q17,Q18, Q7 and Q8. Similarly AddrD is high, cutting off Q28 and Q34. Only
Q27 and Q33 can turn on, and only Q27 has current supplied to its emitter
through Q26. So the 5x wires are selected. 

So, the flip-flops address the locations of the ROM, but what controls
{\em them}? The answer is logic gates on the main gating board here --- a
board which contains no transistors at all. Just diode AND and OR gates
like I described earlier  The next overhead shows part of the control
logic. It looks complicated, so I am not going to explain it in detail. 

\noindent
{\bf Put up OHP : Gating board sheet 8}

The important thing to notice is that in every case there's an input into 
the logic from one of the C6x lines. KAddrB is controlled by C61, etc. 
These C6x lines are outputs from the braided wire ROM. In other words 
each location in the microprogram contains the address of the next 
instruction --- each instruction ends with a GOTO. 

Actually, that logic doesn't tell the full story. There's another part to 
the microcode branching. The logic on this `Left Sideboard' is a selector 
that selects one of 5 inputs from logic on the gating board and applies 
it to one of the flip-flop inputs 

\noindent
{\bf Put up OHP : Left Sideboard sheet 3}

This circuit consists of 5 transistor buffers that enable each of the 5 
inputs, controlled by the Dn lines from the main ROM, which I will 
explain in a moment (one of the problems with giving a talk like this --- 
and indeed with figuring out how the machine works --- is that much of the 
logic depends on other sections). In turn, the inputs to this selector 
come form complex AND-OR gates on the main gating board, like the ones on 
the next overhead.

\noindent 
{\bf Put up OHP : Gating board sheet 14}

Notice inputs like YRAD and YRUN from the switches on the keyboard. And 
also the logic gates here, here and here to detect whrn the main arithmetic 
register contains the value 0,1 or 9. Again, the control lines for these 
gates are some of the Dn outputs of the main ROM.

The main ROM assembly is a 512*64 bit unit with the data stored by the 
coupling between PCB tracks on this PCB. For once the commonly-held view 
is correct --- this ROM contains the main program of the HP9100B, 
enabling it to perform the mathematical functions, run user programs, and 
so on.

\noindent
{\bf Put up OHP : ROM assembly layout}

The address decoder part here takes in 9 bits (and their inverses, of
course), and selects a particular address track that runs through the ROM
matrix. This is coupled to some of the sense loop tracks that then drive
the sense amplifier modules here and here that then produce logic signals 
to the gating board. 

\noindent
{\bf Put up OHP : ROM Data Pulse Transformer}

I don't intend to say anything about the actual operation of the ROM, but 
I can't resist showing you a beautiful piece of HP engineering. The 
outputs of the ROM matrix are transformer coupled to the sense amplifier. 
And the pulse transformers consist of a ferrite core with a secondary 
widing on it that is fitted over the pin that connects the ROM PCB to the 
sense amplifier PCB. That pin forms the primary winding of the transformer.

Again, having got a ROM, we need to consider how it's addressed. The 
address is provided by 9 of the flip-flops on the same board as the 
microcode address logic. And the inputs to those flip-flops come from 
logic gates on the gating board.

\noindent
{\bf Put up OHP : Gating board sheet 12}

Again, I don't intend to explain the logic in detail. But note (again) 
that there's an input to each address gate from one of the Dn lines, 
which are the outputs of the main ROM. Again, each word of the ROM 
contains the address of the next instruction. 

Having described the basics of the control logic, I now want to describe 
a little of the arithmetic circuity. There are several myths concerning 
this --- the main one being that the circuitry is based on an HP 
minicomputer, normally either the 2100 or the 2114. It isn't. The main 
difference between the 9100 and every other computer that I have ever 
worked on is that there is no ALU in the 9100. There isn't even a full adder.

To make a full adder between 2 registers, even if you have both the 
`normal' and `inverted' outputs from the registers, you need inverters. 
And as above, inverters are the one thing that's avoided in the 9100 
wherever possible.

So, how does the 9100 do arithmetic? The only operations available are
Increment and Decrement of the main arithmetic registers which, of course,
consist of flip-flops on these cards. The next overhead shows the logic
that is connected to the K-input --- the clear input if you like --- of
bit 3 (the `eights bit') of the main accumulator. 

\noindent
{\bf Put up OHP : Gating board sheet 19}

It consists of an AND-OR gate using the standard circuits I described 
earlier. 

Signal DA2 is an output from the instruction decoder on the `Right 
Sideboard' here, and causes an increment operation on this register. 
Here, it causes bit 3 to be cleared when we increment 9 (to 0 --- this 
is a BCD machine). It also (combined with logic on the J input) causes 
this bit to be toggled when we increment 7 (carry 2 is low), thus 
incrementing it to 8

Similarly DB2, another output from the instruction decoder is used to
decrement this register. Here, it causes the bit to be cleared when 8 is 
decremented.

Two other inputs to this gate are worth noting. The first is the once 
controlled by DA0. This has as it's input the output of the next higher 
bit of the register --- E24. And this pattern is repeated on the other J 
and K inputs. This enables this register to be used as a shift register.

The input controlled by DC0 is NK23 --- one of the outputs of the 
keyboard and magnetic card reader. Again, this pattern is repeated for the 
other bits in the register, and allows the keyboard or card reader data 
to be transfered to the accumulator.

The next overhead shows another example of this logic --- in this case 
the logic for the J-input --- the `set' input of bit 2 (the `fours bit') 
of this accumulator.

\noindent
{\bf Put up OHP : Gating board sheet 20}

This time there is no input from the card reader or keyboard (this logic 
only applies to the K inputs), but DA0 still enables the shift register 
function. DB2 causes this bit to be set when 8 is decremented to 7. And 
DA2 causes it to be set when 3 (i.e. both lower bits set, which is 
equivalent to neither of them being clear) is incremented to 4.

There is obviously a lot more similar logic associated with the remainder
of the 6 bit accumulator and with the other registers. However, to explain
it all would take rather more time than I have available, so I will leave
the arithmetic circuits at this point. Similarly I will not describe the
user memory in detail. It's contained on this 2-board assembly and is a
relatively conventional ferrite core memory unit. However, if you are
interested, please feel free to ask questions about them. 

I will end the technical part of the talk with a brief description of the 
keyboard and card reader

\noindent
{\bf Put up OHP : Simplified keyboard diagram}

The keyboard depends on the fact that in this circuit, closing the switch
turns on both transistors, since both receive base current through the
switch from the resistors associated with the other transistor. Thus, if a
matrix of keys is used, with the bases of the PNP transistors connected to
the rows of the matrix and the bases of the NPN transistors to the 
columns, then closing a particular switch in the matrix will turn on the 
appropriate row and column transistors.

\noindent
{\bf Put up OHP : Keyboard sheet 2}

And that's basically what's done in the HP9100 keyboard. A keyswitch will 
connect a `row' line to a `column' line, which through the diodes will 
turn on the associated transistors and thus send the appropriat output 
bits to the processor.

For example, Q8 is turned on whenever a key in an odd-numbered row is 
pressed, thus setting bit K0 via Q1. And Q13 is turned on whenever a key 
in a column of 4 or greater is pressed, setting bit K5 via Q6. There is a 
slight complication (not shown on this diagram) to ensure that keys in 
row or column 0 do turn on the appropriate column or row transistors.

One more feature of the keyboard needs to be explained. Since the 
keyboard sends a 6 bit code which is transfered into a 6-bit register, it 
is clear that it can only have 64 keys. And yet an HP9100B has 65 keys 
(feel free to count them). 

The solution is that 2 keys --- Hyper and X$\leftarrow$() are actually at
the same point in the matrix, with the switch contacts wired in parallel.
They send the same code, and can be used interchangeably. Pressing 2,
X$\leftarrow$() SIN will return the sinh of 2. 

And so, finally, the card reader. The first interesting point about this 
is that it is the only module which is not essential to the operation of 
the machine. If you pull it out, the rest of the HP9100B works perfectly. 
This isn't even true of the keyboard --- a missing keyboard will result 
in no display.

The card reader uses magnetic cards, like this one. It records and 
reproduces 4 tracks in each direction. Three of them are data tracks 
which store the 6 bit values from the main accumulator register. One 
track stores bits 0 and 1 alternately, another 2 and 3, etc. The encoding 
scheme is very simple --- a pulse indicates one state of the particular 
bit, a space indicates the other state.

The fourth track contains timing information. An edge of one polarity 
indicates that the even bits are being writen or read, an edge of the 
other polarity indicates that the odd bits are being written or read.

The card reader module clearly consists of 2 main sections --- the 
control circuit board and the mecahnism. 

\noindent
{\bf Put up OHP : Card reader sheet 1}

This overhead shows the mechanism wiring. It is interesting to note that 
the motor is not electronically controlled, it is controlled by the 
microswitches on the mechanism. When the unit is turned on, the motor 
runs until this cam on the motor spindle operates the inner timing 
switch, thus breaking the -15V connection to the motor. When a card is 
inserted, it operates the card inserted switch, applying power to the 
enter switch. If the user then presses this switch, the motor is started. 
The motor then lifts the card, causing the card inserted switch to return 
to the idle state, removing the motor supply. But before this happens, 
the inner timing switch operates, ensuring that the motor runs for one 
complete revolution.

Shortly after the card has started to move, the outer timing switch sends 
a signal to the control logic to tell it to start recording or reading data.

The operation in record mode is similar, although now both the card 
inserted and write protect switches have to be operated to supply power 
to the record switch. A card with the corner clipped off will not operate 
the write protect switch, and thus won't be recorded upon.

\noindent
{\bf Put up OHP : Card reader sheet 2}

This overhead shows one of the data channels of the card reader. The 
lower half of the diagram is the record part of the circuit. The 
transistor gates on the left select either bit 0 or bit 1 and combine it 
with the write clock signal before feeding it on to the write driver Q6 
and then to the head.

The upper part is the read amplifier, and this collapses one other myth 
about the 9100 --- that there are no integrated circuits (chips) in it. 
There are 8 8-pin cans in the card reader (2 in each read amplifer) which 
appear to be standard op-amps. The first one is the read amplifier 
itself, and the second one is a comparator which squares off the 
reproduced pulses.

Note that the card reader does not output a 6-bit word to the processor 
--- there is no latch or shift register at the output of the read 
amplifier. Instead it sends 2 3-bit sections and uses the fact that it is 
feeding them into J-K flip-flops that are initially set. One 3-bit one 
clears the appropriate even-numbered bits and the other one the 
appropriate odd-numbered bits.

I would like to end by saying a few words about repairing these machines. 
Most of the components in an HP9100B are standard electronic parts that 
are still available --- small-signal NPN and PNP transistors, switching 
diodes, and so on. And thus actually making the repair is easy. The 
only parts that are difficult to find are the power transformer (which 
could, at least in theory, be rewound) and the CRT.

Actually tracing logic faults is a little harder due to the fact that the 
flip-flops are current-operated and thus the signals can't be examined 
using conventional logic probes or logic analysers. But it is possible to 
look at the outputs of the flip-flops with these instruments, and thus to 
trace the microcode. And therefore to find out where the machine is going 
wrong.

Incidentally, most 9100B faults result in nothing on the CRT screen. The 
first check in this case should be the -15V supply rail. Then check the 
-2.4V bias supply and the master clock signals on the testpoints on the 
A1 control logic board. If these are correct, then try an operation which 
will result in an error, for example : Stop, Stop (to stop a program or 
clear a pending GOTO), 1, change sign, square root. If the error lamp 
comes on, then the processor is mostly working and the fault is likely to 
be in the top case (High voltage power supply or CRT driver problems). If 
it doesn't, then there's likely to be a processor fault (although do 
check the bulb is working first).

In this respect, if you {\em must} swap modules between machines, it's 
worth noting that faults in the top case (power supply or CRT driver) can 
damage the boards in the processor unit, but faults in the processor are 
unlikely to damage the top case. It's safe to try `unknown' processor 
parts (or even the complete processor) in a working machine, but don't 
try a known-good processor with a possibly faulty top case.

Common mechanical problems relate to the keyboard switches (which can be 
dismantled and cleaned) the O-rings on the keyboard shafts (which are 
easily available from model engineering suppliers) and the card reader. 
Like the later hand-held programmable calculators, the rubber drive 
roller in the 9100B decays with time and turns sticky.

The cure is simple, at least in theory. You remove the old hub with a 
special puller tool like this, make a new hub with a 1" diamerter O-ring 
as the tyre and press it back on with special drifts like these. But 
since HP never intended the card reader to be repaired in the field, the 
special tools were never available. The only way to get them is to spend 
an afternoon with a milling machine and lathe and make them up --- as I 
did. Similarly, you need a lathe to make up the new hub, although that is 
a lot easier than making up the tools.

\end{document}
