Follow me as @jamesthomson on Mastodon or read my developer blog for more.

PCalc, An Origin Story

Many people using PCalc on their shiny devices today don't realise that the app has been around for a lot longer than they think. In some cases, a lot longer than they've been thinking.

PCalc is twenty years old on the 23rd of December 2012, so I thought I should take the opportunity to look back at how it has evolved over the last two decades.

The app you've known for all these years...

PCalc actually started out in 1992 as a design for a central heating control panel.

I was a student at Glasgow University's Computing Science department, taking a class in Human Computer Interaction on how to build good user interfaces. One of the class projects was to design a simulated control panel for a central heating system - setting temperatures, letting you switch heat and water on and off separately, and so on. It was to be implemented as a Hypercard stack. Sadly, it doesn't survive to contradict me, but my design was likely impeccable.

I figured it had to look authentic, and handcrafted a set of custom 1-bit black and white fake LCD digits and little buttons that you could push in. Skeuomorphism has been around a lot longer than Corinthian leather.

At around the same time, we'd started coding using THINK Pascal, and I had begun to explore the Macintosh programming APIs in my own time. I had come to the conclusion that I was not going to be the next Jean Michel Jarre, but I really liked the way the Mac user interface worked in comparison to my old Atari. So I sold all my synthesizers and my ST, and bought one of the latest Mac Classics - 4 meg of RAM, a 40 meg hard disk, and a 512x342 1-bit display.

I was looking for a small project to learn how to program my new Mac properly, and I remembered the graphics I'd done for the control panel, and thought that they would work well for a calculator as well. Take note of “a small project just to do X”, this will be referred to many times during this story.

The built-in Mac OS calculator of the day was a very simple affair, and so I decided I would write a calculator that could do binary and hex, to help me with my programming. And so the idea for PCalc was born. I bought the books Inside Macintosh, Volumes I, II, and III, and sat down to figure it all out. We didn't have the Internet back then - well, no web at least - so that was basically all I had to go on. Eventually, I started to get the internal logic working, and built a user interface around it all. System 7 was new, so I eventually got a copy of the massive Volume VI to see what had changed there. I didn't think I needed any of the stuff in the middle.

The application needed a name (we didn't have “apps” back then) and I decided on PCalc, officially short for Programmers' Calculator. In truth it was really a Programmer's Calculator. That programmer being me. I simply wrote what I wanted to use myself. I started sharing it with a few friends on the course, and slowly improved it over the next six months until the point where it was actually useful and did a lot more than just help with programming. I added a colour interface to it as well, even though I didn't actually have a Mac that could display colours.

See here for more screenshots of the original release. The original "Read Me" file is here.

On December 23rd 1992, I decided I would release it freely to the world as a present.


Again, this was back in 1992 - FTP sites were the new hotness. Our class had discovered this application called Fetch which quickly got passed around. You ran this one application, and it could get you more applications. I quickly realised there was this thing called the Info-Mac Archive which was mirrored all around the world, and I could send my app to them, and it would then be mirrored everywhere automatically for people to download. So, I read all the submission guidelines carefully and packaged it up.

Here's the email:

Date: Wed, 23 Dec 92 17:41:10 GMT
From: thomsonj <thomsonj@dcs.gla.ac.uk>
Subject: [*] PCalc 1.0 Submission

Enclosed is a binhex file containing a submission for your archives.
PCalc is a neat simulation of a programmable scientific calculator.
Please note that it *requires* System 7.x.x.

If you use System 6.0.x or earlier, here is what you are missing:
Programmable functions via a simple mini language.
System 7.x.x savvy:
      Can be controlled & programmed via Apple Events.
      Balloon Help for every button, menu & dialog item.
      Resolves Aliases.
      32-bit clean.
      Multifinder aware.
Large 16+3 digit display.
Hierarchical menu of user functions.
Includes many functions for converting between different weights and measures.
Quick, one click, conversion between decimal, hexadecimal and binary numbers.
AND, OR, NOT, XOR, ROL, ROR and other extra functions in hex and binary mode.
30 named user constants, 10 for each mode.
'Undo' of any action.
Enhanced graphics when viewed on a 256 colour or 16 gray (or better) screen.
Colour graphics and help screens are stored in separate plug-in extensions.
Runs on any Mac with System 7.x.x or greater, with or without Color Quickdraw.

And of course it's freeware. If you only download one calculator this year, give this a try...

[Archived as /info-mac/app/pcalc-10.hqx; 122K]

I got a lot of good feedback, and continued to improve it over the next year. Version 1.0.2 from March 1993 had the following note:

Version 1.0.2 fixes some bugs that caused problems on colour macs, notably
those with 16 and 24-bit displays. Vast speed increases too on some 8-bit
screens. Shouldn't turn bright orange at inconvenient moments either. Some
other silent bug-fixes and support for the ',' key as a decimal separator.

(More importantly, there are a ton of new easter eggs ;-)

Yeah, I really should have bought those missing Inside Mac volumes about how to do colour.

As for one of the easter eggs in question, if you put 42 into three specific memory registers, then clicked the screen, a sound recording of Douglas Adams said “Don't Panic!” and it displayed the following quote from my favourite series, The Hitch Hiker's Guide To The Galaxy:

"Is that all you've got to show for seven and a half million year's work?"

As an aside, sometime later Douglas became a beta tester for my other app, DragThing. I never asked him what he thought of all the Hitch Hiker's references in PCalc, if he ever saw them. The icon has always had a 42 on it, I try to put 42 on the screen whenever I take a screenshot, and there's always been an Ultimate Answer scientific constant in there. I had the pleasure of shaking his enormous hand at WWDC once, and he greeted me with genuine recognition and a smile. I had been due to meet up with him again at a later WWDC, but he died suddenly just beforehand, just a few weeks after we'd exchanged emails, and it hit me quite hard. That's why the PCalc icon still has a 42 on it - it's meant as a tribute to him. I didn't know him very well, but he was always enthusiastic about my work, and as a huge fan of his writing, that meant a lot.

Anyway, I let PCalc make its way around the world, while I actually did some work for my degree. I got distracted a bit after that, first by writing DragThing, and then by going off and getting a job with Apple where I worked on the OS X Finder and Dock. Yes, yes, I know. But that's another story.

When I was back in Glasgow in 2000, I was looking for another small project to learn the new Metrowerks CodeWarrior development environment and accompanying PowerPlant application framework. I still got emails about PCalc, even though it had been seven years since the last update, and it was the perfect size to quickly build something usable. So, PCalc 2 was born. The Pascal core mathematics code was hand-translated into C, and a new user interface was written around it in C++. PCalc 2 would still run on old 68K machines, but it would now not only run natively on PowerPC machines, but it would run on both the Classic Mac OS, as well as on the new OS X, with an appropriate user interface on both.

I'd also decided, based on the popularity of DragThing, that I should probably charge a little bit for it. One reason I'd been happy to let it sit for seven years between releases is that the first version had been completely free. Having paying customers would be a good incentive to keep it updated.

At WWDC in 2001, I pressed my business card into the hand of a young fresh-faced Phil Schiller, and told him about PCalc. Afterwards, I remember his assistant emailed me asking for a serial number for Phil, which I gladly passed on. Later, I learned that Steve Jobs had used PCalc and allegedly had not completely hated it. Steve Wozniak bought a number of copies that year too.

By January of 2002, Apple still didn't have a decent calculator on OS X (some might argue that is still the case), and with the new “angle-poise” iMac G4s about to come out, Apple approached me and licensed PCalc to include it on some iMacs shipped in the US. A very small license fee was agreed per copy, but any number multiplied by around a million is still pretty good!

Sadly, it didn't last - Mac OS 10.2 was released, and with it came a new Apple-written scientific calculator. The rumour was that someone high up in Apple had worked out exactly who they were paying royalties to - an ex-Apple employee they had not always seen eye-to-eye with. But, I couldn't verify that. In any case, PCalc was no longer bundled, and things went a bit quiet again for a while.

In 2005, I rewrote PCalc once again. This time, it was to learn the new Carbon HIToolbox APIs - this was a different way of writing an application, somewhat similar to PowerPlant, but provided by Apple.

PCalc 3 sported the much loved brushed metal appearance that was all the rage back then. There was also a new companion Dashboard Widget which had the same core code, but a user interface written in HTML and javascript. Widgets were the future.

I didn't charge for the update though - I felt bad that I'd not done a release in ages.

In 2006, it was the perfect sized app to port to Intel and learn about that - I got one of the prototype Intel based Macs, and had a universal binary for Intel and PowerPC ready to release by the middle of January. Many updates to the Mac version have followed in the years since.

But 2007 brought us the iPhone, and then 2008 bought us the App Store, and guess what was the ideal app to port to this new platform?

I took the code I'd written for the Dashboard Widget version of PCalc, and got that running within a day or two on the iPhone. From there, I wrote a completely new interface around it, this time in Cocoa. PCalc was the perfect app to have on a touchscreen portable device - it had turned from an imitation of a calculator on a screen where you pressed the buttons with a mouse, into an actual calculator in your hand. It felt like it wasn't pretending any more.

PCalc was in the App Store on day one with around 400 other apps and it did really well. Eventually, a lot of our income was coming from PCalc rather than DragThing, and from iOS rather than Mac OS, and so a lot of the effort went into the iOS version first and then was ported back to the Mac afterwards. I even ported the theme engine from DragThing on the Mac to PCalc on the iPhone. That seemed like an insane thing at the time, that you could take a fairly sophisticated drawing engine running on a Mac Pro and put it on a thing that fits in your hand.

And then came iPads, Retina displays, more iPads, taller iPhones, and... well, you know the rest. And now we have PCalc in the Mac App Store with Retina display support too, and lots of features from the iOS version.

Let's draw a veil over 5318008-gate for the sake of my dignity, as well as the other news story connected to PCalc Lite.

I think it's a pretty safe assumption that I'm going to rewrite PCalc again and again, as long as I code. And I hope you've enjoyed using it over the decades as much as I have too!

You can find PCalc for iOS on the App Store here, and PCalc for Mac here.

Some of the screenshots in this article were produced using Basilisk II, a Mac emulator, running Mac OS 7.5.3 and 8.0. The earliest version of PCalc I could find was 1.0.2 from March 1993. If anybody has the original pcalc-10.hqx file from the Info-Mac archive, I'd appreciate a copy!