7 ms·
Reversing Sinclair's 1974 calculator hack (2013)
- userbinator 5y agoYou might be surprised to learn that the calculator chip cannot perform multiplication natively. There's no floating point unit to multiply two numbers. Instead, multiplication is performed through repeated addition, digit by digit. I believe all the ultra-cheap 4-function calculator ASICs do this or something similar; the speed is not at all important, but die area and resulting price are.
- fsckboy 5y ago> through repeated addition, digit by digit when i read ideas like this I'm not sure what they mean none of the early microprocessors had multiply instructions, but you can carry out a binary multiply using repeated shift+add, and if you don't have a shift you can add a number to itself and that's a shift... so all you are doing is adding but it's not the naive idea of adding a number over and over to simulate multiplication or do they mean digit by digit and they are doing BCD multiplies? again, not that many adds are being performed so it's not a performance nightmare. youngbloods don't realize how rarely a C programmer would invoke a multiply (or really need to) (and NEVER inside a loop) even a decade after these early calculators
- kens 5y agoThe multiplies are done by repeated BCD addition, one digit at a time, along with BCD shifting, equivalent to multiplication by 10.
- kens 5y agoAuthor here if anyone has questions about old calculator chips...
- S_A_P 5y agoNo questions from me but definitely excited when I see righto articles come up here. It’s appreciated!!
- gtfoutttt 5y agoGreat article and great job on the software! Do you know if there's any of these calculators still around and available to purchase? I've always wanted to get my hands on a curta but One of these would be awesome too.
- kens 5y agoIt looks like the Sinclair Scientific sells on eBay for about $45, but there aren't any for sale right now. The Curta, on the other hand, goes for over $1000, so not exactly an impulse purchase.
- gfaure 5y agoThe price of Curtas seems to have gone up over the past 18 months. eBay has plenty of listings for Curta I and IIs, but you'd have to shell out more than US$1000 for one, unless the unit was in bad condition.
- gtfoutttt 5y agoWhat first piqued my interest in them was a watch and clock show in my town. I remember really thinking they were marvelous engineering, but I also remember that number of $1000 as an average for a working one. However it's kinda iffy buying one that you can't actually test first. It's been too long since I've purchased anything on eBay so I don't know what the return policies are. The guy at the show mentioned "always test the _one_ slider. Those go first" Edit- spelling
- gfaure 5y agoeBay leaves the return policies to the individual sellers, so some sellers absorb the cost of returns, some require you to pay postage, and some don't accept returns at all. Naturally some of this probably gets absorbed into the listing price.
- systemBuilder 5y agoThis was a fun article I was astonished that you could fit all eight of those function types in to only 320 instructions!
- kens 5y agoYes, I was curious and a bit skeptical when I heard that they fit these scientific operations into 320 instructions. That's what motivated me to look at the chip in detail, to see how they did it.
- IMAYousaf 5y agoDo you have any good suggested reading material on how to look at chips in the way that you mean? I have no knowledge when it comes to this type of hardware.
- kens 5y agoFor understanding chips of that era, one good source is Introduction to VLSI Systems, which has a PDF at: https://ai.eecs.umich.edu/people/conway/VLSI/VLSIText/PP-V2/V2.pdf https://ai.eecs.umich.edu/people/conway/VLSI/VLSIText/PP-V2/...
- anyfoo 5y agoThat is so classic Sinclair. Barely working enough to be useful ("three decimal places of accuracy at best", "sin 1 takes about 7.5 seconds", and constants like pi and e are written on the case instead of fitting in ROM), but useful nonetheless, and dirt cheap. Sinclair products were almost comical in how ingeniously their engineers shaved off any pennies they could. In the ZX81, the video circuit is a bizarre and extremely interesting contraption that abuses the Z80's DRAM refresh circuitry, and on the mechanical side only two screws hold down the PCB to the case, despite there being many more intended screw holes in both PCB and case (someone must have figured out that hey, it still holds in place with two). I have marveled a lot at what the engineers came up with, and cursed at it just as much. For the ZX81's ingenious video circuit and sleek case, you get a device with chips that get dangerously (literally painfully) hot, and most CPU time used for drawing the screen--without the ability to set individual pixels in any way. The keyboard "cable" plugged into the PCB is just an extension of the paper-like foil that makes up the terrible, terrible keyboard, and that can easily self-destruct when disassembling your ZX81: The foil does not like any amount of bending, including the bending when you fold the case open. I could go on an on about how clever Sinclair's engineering was to barely stay past the line of what makes a working product so brilliantly.
- sydthrowaway 5y ago“Real artists ship”
- WalterBright 5y ago> "three decimal places of accuracy at best" To be fair, that's all their competition (a slide rule) was capable of.
- jacquesm 5y agoIf that. I used to be pretty good at reading them and depending on where you were in the range two would already be quite impressive.
- jacquesm 5y agoIt's a fantastic example of 'good enough', because the alternative was doing this all by hand or using mechanical tools which - while sometimes quite fast - were error prone especially for long and repetitive calculations. An Olivetti electronic/mechanical calculator for instance took up half your desk, was horribly slow and consumed a ton of power. No way that you would ever take it with you and working with the beast would require a serious investment in time, they weren't cheap either. These little calculators were complete game changers. The model in the article was one of my prized possessions, there simply was no alternative that I could have afforded.
- mmastrac 5y ago320 opcodes? We can golf that down to 300 for sure!
- djmips 5y agoIt's already been golfed. And it's instructions not opcodes.
- dang 5y agoDiscussed at the time (of the article, not the 1974 calculator hack): Reversing Sinclair's amazing 1974 calculator hack - half the ROM of the HP-35 - https://news.ycombinator.com/item?id=6302364 https://news.ycombinator.com/item?id=6302364 - Aug 2013 (96 comments)
- WalterBright 5y agoIt's a marvelous piece of engineering any engineer would be proud of.
- bambax 5y ago> 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 I love this so much. I sometimes wonder what single-purpose electronic devices could be replaced with a piece of paper or a purely mechanical instrument. Could one make a countdown timer with no spring, just having a ball fall down a kind of maze for instance?
- rvba 5y agoYou mean a hourglass, like the ones used as timers in kitchen?
- bambax 5y agoYes sure an hourglass is that, but I was thinking of a marble drop game were you would have to select a path for each specific time. Anyway.
- thehappypm 5y agoThat actually sounds pretty neat. A hot wheels track timer!
- pwrrr 5y agoAmazing! I had the ZX81.
- nickcw 5y agoMy Dad had one of those calculators he built from a kit. I remember it had a great bug if you divided by 0. It would go mad for a moment then start counting very quickly on the screen. My time spent with the calculator was doing that, and trying to make sums which came up with rude words when held upside down! (I was too young to appreciate the trig features!) The old man build lots of Sinclair kits including the watch, and it was the ZX80 that got me into computing. That took a long time for him to make it work as the PCB had a cracked track. Happy days and thanks for all the good memories Mr Sinclair (as we always used to call him in our house!).
- mrlonglong 5y ago80085 was a fun one. Easily amused, I was.
- 123pie123 5y agowhen I first saw the title - I was strangely hoping someone had managed to get doom running on it
- jacquesm 5y agoI love these articles. At the end there is this bit: "The Sinclair Scientific came out in 1974 and was the first single-chip scientific calculator (if you ignore the display driver chips). It was stylishly compact, just 3/4 inch thick. It originally sold for the price of $119.95 or £49.95 and by the end of the year was available as a kit for the amazingly low price of £9.95. Unfortunately, as calculator prices collapsed, so did Sinclair Radionics' profits, and the company was broken up in 1979 after heavy losses." In a nutshell that is both the genius and the curse of Clive Sinclair, he moved markets with complete disregard for the consequences effectively out-competing himself and the would move on to some other field. I always thought that was the best kind of inventor, the one that doesn't care about milking the cows they field, but that democratizes a field to the point that they themselves become obsolete. Imagine if he had not shown that you can have < $20 calculators or < $100 computers, that would have had major impact on so many people, their careers and the solutions they built that the world would probably look different today. More Sir Clive, less Zuckerberg and the like.
- mannykannot 5y agoThe epitome of disruptive technology.
- scoopertrooper 5y agoNo disrespect to Sinclair, but this reads like Great Man history to me. Computers aren't (relatively) cheap today because Sinclair gave people the idea they could be cheap. They're cheap because of the incremental efforts of thousand of people from research scientists to manufacturing engineers. For instance, the cheaper version of the calculator was built around Texas Instrument's TMS1802NC. If Sinclair didn't seize on the opportunity to use the TMS1802NC to reduce costs, then one of his competitors would have eventually done it. You see it happening today. The iPhone launched for $658.38 (inflation adjusted), but today you can buy the vastly superior iPhone SE for half that price. You can go cheaper still if you're willing to go down the Android route. We didn't need Sinclair to show us that was possible.
- TheOtherHobbes 5y ago