
Reversing Sinclair's amazing 1974 calculator hack - half the ROM of the HP-35 - kens
http://files.righto.com/calculator/sinclair_scientific_simulator.html
======
sirsar
This is great.

 _Scientific calculators usually provide constants such as e and π but there
was no space in the ROM for these constants. The Sinclair Scientific used the
brilliant solution of printing the constants on the calculator 's case_

~~~
rarw
That's gotta be the hackiest hack ever - write it on the outside. Genius.

------
ck2
I am not sure what is more amazing, the original creation or the cleverness of
the person who figured out everything they did.

I guess the original creation but wow, now that is a dedicated hobbyist.

 _The Visual 6502 group enjoys dissolving old chips in acid, photographing the
die, and reverse-engineering them._

Wow!

~~~
arbuge
_The Visual 6502 group enjoys dissolving old chips in acid, photographing the
die, and reverse-engineering them._

Unfortunately (or not, depending on your perspective) it's not just the Visual
6502 group that enjoys that. Any leading chip in the marketplace these days is
almost immediately reverse engineered in this way. I haven't been in the chip
business for a few years but I recall a company which offered this as a
complete service - they'd send you detailed circuit schematics and so forth.

~~~
beambot
FlyLogic used to do some awesome teardowns too:
[http://www.flylogic.net/blog/](http://www.flylogic.net/blog/)

If you go back through their blog posts, they have some cool techniques for
bypassing "security" metal meshes to read out the secure FLASH/ROM sections of
chips.

IIRC, one of the guys behind FlyLogic was involved in the high-profile reverse
engineering of satellite receivers (ie. satellite pirating).

~~~
rdl
Zac Franken and Adam Laurie are doing this kind of stuff and making tools for
hobbyists ([http://zacsblog.aperturelabs.com/2013/02/diy-decapping-
machi...](http://zacsblog.aperturelabs.com/2013/02/diy-decapping-machine-
decapinator-part-1.html))

------
6ren

      Unfortunately, as calculator prices collapsed, so did Sinclair Radionics' profits,
      and the company was broken up in 1979 after heavy losses.
    

He fought Moore's law, and the law won.

But this whole thing reminds me of Woz's work in the first Apples. Why wasn't
his genius work similarly wiped out? Soon after the Apple, there were dozens -
hundreds - of new personal computer manufacturers.

I think it's software. The value of a platform is what you can do with it.
Software increases what you can do, therefore increases the value of the
platform. There's increasing returns, so once it gets started, it gets harder
and harder to stop.

Branding is also important (Jobs), which is why the Apple eventually fell to
the "PC" \- because the strongest computer brand in the world for decades was
IBM.

~~~
ck2
Apple fell to the PC because the hardware was a fraction of the price since
clones were allowed to exist in the PC world.

Apple sued their clones out of existence. Might all be using Apple today if
they had not.

Then they eventually switched to pc hardware themselves.

~~~
Tloewald
Apple seems to be still around. You can google it to check. Apple's problem
with PC was initially simply that IBM sold the PC. For many years PCs were
more or comparably expensive and much less useful than Macs, but sold because
they were backed by IBM. And Apple did very well despite its lower market
share until John Sculley started listening to pundits and lowered prices in
the early 90s. Even so that worked Ok until Spindler listened to more pundits
and started allowing clones.

------
znmeb
While clever and inexpensive, the low speed and low accuracy of this device
made it unusable. It was billed as "3-figure accuracy", but in fact it only
got that on some cases. A bright undergrad or grad student could quickly
uncover _useful_ problems that it flat out couldn't solve.

In short, it was a toy. Anyone basing one's academic grade on this thing was a
fool. You really _did_ have to spend the money for an HP-35, or the later
Texas Instruments SR-5x calculators that were less expensive.

------
ajross
The bit that is probably most striking to modern eyes is the data
representation. With 320 instructions there's simply no room for the "obvious"
code to translate to and from a display representation. So everything was
stored in BCD and operated on one (decimal!) digit at a time using a 4-bit
ALU.

~~~
alayne
I was under the impression that BCD was commonly used in calculators. I know
that my HP 48 used BCD and was able to address 4 bit nibbles.

~~~
kens
You're right that BCD is very common for calculators. BCD was also commonly
used in microcomputers, since you save all the binary-to-ASCII code for I/O.
This is why x86 has a bunch of BCD instructions like AAA (ASCII adjust after
addition), which was important enough to be a single-byte opcode.

The 6502 is notable for its highly-efficient and patented
([https://www.google.com/patents/US3991307](https://www.google.com/patents/US3991307))
decimal arithmetic mode. I'll write up its interesting circuits sometime. One
consequence of the patent is the processor in the NES video game is a 6502
clone that lacks decimal mode.

~~~
Scaevolus
I had thought the 2A03 didn't have BCD to save silicon-- but apparently they
just crudely disabled it by removing 5 transistors[1]! Would Ricoh's second-
source 6502 license have been more expensive if they included BCD?

[1]
[http://www.visual6502.org/wiki/index.php?title=6502DecimalMo...](http://www.visual6502.org/wiki/index.php?title=6502DecimalMode#Decimal_mode_and_the_NES.27_RP2A03G)

------
ableal
_" You might be surprised to learn that the calculator chip cannot perform
multiplication natively. There's no floating point unit to multiply two
numbers._"

Quite true. The sexy multiplier chips from TRW
([http://en.wikipedia.org/wiki/TRW_Inc](http://en.wikipedia.org/wiki/TRW_Inc).
) were still a few years off, and not intended for mere calculators. Same for
the Intel x87 floating point co-processors
([http://en.wikipedia.org/wiki/8087](http://en.wikipedia.org/wiki/8087)).

Nowadays the silicon real-estate cost for floating point math is trivial, and
chip area is filled out with RAM cache for lack of anything better to do ...

------
ChuckMcM
Nicely done, especially compared to the fits that HP went through trying to
figure out how they could prove or disprove that all 11 digits of their
calculation were correct.

~~~
joezydeco
I wouldn't call them "fits", really.

40 years ago these calculators were looked upon with a bit of skepticism.
Engineers that were used to seeing the log tables with their own eyes and
hand-manipulating slide rules were being asked to _trust_ the results coming
out of these calculators.

And lives depended on it, really. If you were a civil engineer designing a
bridge and you needed to be _absolutely sure_ the numbers you were using were
accurate to 7 places and totally correct, would you suddenly put all your
faith in this small brown box with no way to examine the inner workings?

HP went through a lot to build that trust and it was rightly earned. HP's
reputation for building solid accurate calculators kept that business going
for decades to come.

~~~
WalterBright
Trusting the numbers coming out of a calculator was ALWAYS a bad idea,
especially if lives depended on it. It wasn't just the calculator making a
mistake - you could have made a mistake keying in the numbers.

This is dealt with by:

1\. running the results through the inverse equations to verify that you get
the inputs back again

2\. calculating the results using an independent method to verify them

3\. having a different group of people independently check your numbers

4\. have your results pass a "reasonableness" test, i.e. do they make sense

5\. put the resulting design on a test rig and verify the numbers
experimentally

How do I know this? I worked on critical flight control systems for Boeing.

Any engineer who just punches numbers into a calculator and bets lives on the
results ought to be fired.

~~~
wtallis
These days, we can also have our calculators keep track of the units
associated with a quantity, which helps greatly with sanity-checking. If the
units come out wrong or mis-match anywhere in the calculation, you'll know
immediately.

~~~
WalterBright
It's nice to have extra checks, but that changes nothing about what I said. If
you are making designs that lives depend on, it is not HP's responsibility, it
is YOURS and you should be using the techniques I outlined.

I'm sorry to be so blunt about this, but I feel strongly about it. I too often
run into engineers that either argue that they can design a perfect system
that is not subject to human error, or they try to shift responsibility onto
other people or organizations.

------
Tloewald
I owned Sinclair's programmable scientific calculator from a few years later
which was similarly "interesting". It had 36 program steps (vs. 72 for the
HP65 iirc), so storage system, and only one memory. Each constant in a program
counted as N+1 steps where N was the number of button presses were needed. So
it taught me about multiply re-entrant code.

I also owned a Sinclair ZX-80 (aka Timex) computer, later upgraded to a ZX-81
ROM with 16kB of memory.

Overall, Sinclair's problem seems to have been going a little too far in the
"worse is better" direction with every product.

------
Zenst
If you need to explain this too less geeky friends then telling them that this
amount of storage is less than a single letter on a modern display. Which on a
32bit display at 12x12 you would be on 576 bytes (8 bits) and this is compared
to a 320 11 bit word (320x11/8=440) 440 bytes.

This makes chess on a 1k zx81 including display seem like bloat-ware now :).

Nowadays we have more storage on the keyboard controller chips, heck the older
ones during the 90's had 4 KB storage, so almost 10x more ROM alone to work
with - for a keyboard.

~~~
nwh
Given that Sprite managed to get Linux booting on a hard disks processor [0],
I'm increasingly aware that the embedded device we use are overpowered. Makes
for some interesitng hacking though, I bet you could run a webserver on my
washing machine.

[0]:
[http://spritesmods.com/?art=hddhack](http://spritesmods.com/?art=hddhack)

------
rootbear
So is 'reversing' a common lazy shorthand for 'reverse engineering'? The title
confused me until I realized what it was about. Feeling like an old fart...

~~~
kens
Simple explanation - there wasn't room to fit "reverse engineering" into an
80-character title.

~~~
nealabq
Very apt, considering the topic.

Tho in 1974 Sinclair could've fit it in a 37-char title.

------
jordanthoms
I really wish someone would make a modern scientific calculator - Imagine what
would be possible on a modern ARM processor. Even the new HP calculators use
old ~70mhz ARM processors emulating the even older saturn HP48 code...

You could build it on top of Android, and have the software be open-source
while making money from selling the hardware (so you could run it on a
touchscreen, but if you wanted a keyboard you'd buy the calculator).

~~~
goblinfoblin
There are modern calculators: Mathematica, Matlab, and the most used: Excel

For tasks that need to be done away from a computer sure a calculator is handy
but that has rather dwindled down to basic calculations. Schoolwork sure
calculators are great but I never needed more than my HP-48 and when I did it
was usually an assignment meant more for MATLAB/Mathematica.

Now for your point of building it on top of android, what I want is not
another device but I want a new calculator built for android. Everyone has a
smartphone these days why should I have to buy a calculator when I have a
strong computer in my pocket. We just need an interface for smartphones and
the appropriately strong (Programmable) back end.

This looks nice but I don't have an iPhone
[https://itunes.apple.com/us/app/nd1/id368497993?mt=8](https://itunes.apple.com/us/app/nd1/id368497993?mt=8)

~~~
ghshephard
Calca is also a nice take on the "modern calculator"

[http://calca.io/](http://calca.io/)

------
AsymetricCom
What's more interesting than how the calculator works is how Sinclair was able
to write the code for such a chip, which the article doesn't attempt to guess
at. I wonder if he used some kind of boostrap on paper, looking at the
algorithms.

~~~
kens
I don't know about the Sinclair development specifically, but for the HP-35,
they wrote a register-level simulator in software that let them develop the
algorithms and single-step through for debugging. My favorite quote from the
article: "Correcting a problem was a simple matter of changing a punched card
or two."

[http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1972-06.pdf](http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1972-06.pdf)

The article goes into a lot of detail on the HP-35 internals, so it's worth a
look.

------
ivanbrussik
80085

thats my calculator hack

------
rarw
Reverse Polish Notation - sounds like the punch line to a really bad math joke

~~~
nealabq
After I got used to RPN (I had a lovely old HP-21) I found it much more
intuitive. Stack-based thinking. No parentheses! (And I've used LISP for
years, but that's entirely different.)

RPN vs Infix/Algebraic used to be a holy-war topic. Like emacs vs vi, or
iPhone vs Android.

Once you go RPN, you can never go back again.

~~~
TheLoneWolfling
The one issue I've already had with RPN is that you require a separator
between numbers anyways - in RPN it's too easy to parse "23 4 +" as "2 34 +",
for example, especially if you're writing quickly.

~~~
orclev
Might have been better to demonstrate that using subtraction as addition is
commutative and thus either one works fine in this case.

~~~
sokoloff
One is 27; the other is 36.

~~~
orclev
LOL, apparently I suck as a parser. I read them as just swaps of the numbers,
I.E. 23 4 + vs. 4 23 +.

