Back to art/rants

The "What sort of calculators do you think the people who designed the 80x87 used" page.

A Keuffel & Esser slide rule

Some of you may be keen users of RPN, many languages are based on RPNish systems (for example postscript), and I'm sure we all love our HP calculators - BUT you have to ask your self is RPN what I want my compiler to have to use.

The HP9100AThe 80x87 has 8 registers [compared to the 16 of the HP9100, the first RPN calculator]. The HP9100 (released in 1968) could save and restore the value of any one of the positions on the stack, the 80x87 can only load and store the top value. The HP9100 (which doesn't contain a single chip) can do divisions without getting the answer wrong. The HP9100 has a special little light next to the CRT which indicates when the stack overflows.
 

The Comptometer, 1887Let's say that you'd just designed a very sucessful general purpose microprocessor. You'd given your microprocessor too few general purpose registers - but hey they were expensive and you could do without them. You then realise your users want to do lots and lots of sums (that's kind of odd really since you forgot to put a multiply instruction on this processor - but never mind) and in floating point to boot (which is odd since most of these sums involve money which I'm told is meant to be conserved). So you say "I know, rather that building a device with some floating point registers and floating point counter-parts to the ALU instructions, I'll build a ropey version of the first HP calculator" and so in 1978 history and the 80x87 was made.

The HP 9100 could context switch, it had two register windows and the entire state of the machine could be written out in 3 bit words to a magnetic card reader/writer. The HP 9100 could do conditional execution, call subroutines and even modify its own code. The 80x87 cannot context switch without truncating the values in the stack, it has no register windows.

Here's a little fun test:

soup.f

The Speedee add-a-matic
      function soup
        soup=1.0
      end function

fish.f

      program fish

      do i=1,8
        call soup
      end do

      a=2.0
      b=3.0
      c=a*b

      write(*,*) c

      end





Or for the more modern among you here's the C version


The HP35, 1972
#include <stdio.h>

float soup (void)
{
  return 1.0;
}

int main (int argc, char *argv[])
{
  int i;
  float a, b, c;

  for (i = 0; i < 8; ++i) {
    (*(void (*)(void)) &soup) ();
  }

  a = 3.0;
  b = 2.0;
  c = a * b;

  printf ("%f\n", c);
  return 0;
}
What value to you think this program prints out on an 80x87 - well you guess right it doesn't print out 6, in fact any floating point calculation this program does will give "NaN" isn't that just wonderful. Horrah. That's because unlike the HP9100 the little light on the 80x87 which says that the stack over-flowed doesn't seem to bother most operating systems that much - oh well. I suppose I'm the only person who remembers the Intel adds with a kid's calculator in the shape of a clown stuck into the 80387 socket with the strap line "Use an Intel® NDP or else who knows what you'd have to count on" - quite.