Follow me as @jamesthomson on Mastodon or read my developer blog for more.
PCalc, An Origin Story
This is an updated version of a piece I wrote for the 20th anniversary, with an extra ten years of history!
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.
twenty thirty years old on the 23rd of December 2022, so I thought I should take the opportunity to look back at how it has evolved over the last two three 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 <email@example.com>
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.
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:
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.
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.
Let's draw a veil over 5318008-gate for the sake of my dignity.
And then came iPads, Retina displays, more iPads, taller iPhones, and... well, you know the rest. And then we had PCalc in the Mac App Store with Retina display support too, and lots of features from the iOS version.
In fact, in 2014, PCalc 4 launched as a Mac App Store exclusive.
Well before the days of Mac Catalyst, this new version was actually based on the iOS source code, which made development a little easier for me, as I didn't have to write everything multiple times. I also broke out the core code into a separate and portable chunk, which could be used everywhere.
One of the first uses of this new calculation engine was a mini calculator widget for the Notification Center on iOS and macOS that you could use for quick calculations.
It was featured by Apple, and nothing bad happened. That was a rather stressful time, but the publicity caused such a sales bump that I could buy a Retina 5K iMac and have a nice vacation.
The second use was the smallest PCalc in history in 2015.
PCalc for the Apple Watch was a fun exercise in fitting a full calculator interface on a really tiny screen. Of course, I had a calculator watch back in the 80s, so I wanted to make my own.
In contrast, I also introduced the biggest PCalc in history the same year, this time for the Apple TV.
I'm not exactly certain anybody asked for a calculator on their TV, but by this point in time I was now determined to put PCalc anywhere that Apple let me, just out of stubbornness.
In 2016, Apple added the ability for iOS apps to offer alternative app icons, so I started on a little project to make some new ones. People may remember this was a start of a rather stressful time in the world, and I did a lot of these projects to keep myself sane, or at least distracted.
By this point there are over fifty app icons, including a dozen pride flags. I learned a lot about the origins of different pride flags that year!
At the same time, rumours about Apple making an AR/VR headset started to swirl, and I decided I wanted to learn about how to do 3D graphics. I'd done a course at my university, but things had changed just a bit in the 22 years that followed.
Anyway, PCalc's About screen soon got a little bit out of hand. What started as a 3D physics toy where you could throw bananas at the PCalc icon eventually became a small driving game with a worldwide leaderboard and even a physical trophy.
Screenshot courtesy of trophy winner Myke Hurley.
Nowadays, it's a standalone app because it got a bit on the big side.
If you'd like to know more about PCalc's many hidden secrets, and the history of easter eggs in general, I did a fun talk at Hacking with Swift Live.
In 2017, PCalc got a mascot and a set of iMessage stickers, in the form of loveable panda Pascal, who is drawn by David Lanham.
I'd admired David's art for a while in his various sticker packs on Facebook. He had never drawn pandas though (aside from the wrong red ones) and I had the realisation that I could just pay David to make a set of stickers for me, and include them with PCalc. You can now even buy merch of him. (Pascal, not David).
You might notice there are some dice in that About screen screenshot. In 2019 I was also playing D&D on the internet, and my good friend Jason Snell suggested that I should make a dice app for the iPhone. And so, the first spin off from PCalc appeared!
Dice by PCalc took me two weeks from start to release on the App Store, and used a lot of the code and concepts from the PCalc About screen.
I say it took me two weeks, but I didn't exactly stop there. It's become an extremely over-engineered procrastination project. I've designed over fifty dice sets, and it even has a photo mode now. Needless to say, it's also now on Mac, Apple Watch, and Apple TV too. It's also become something of a testbed for me trying out new Apple technologies, like Mac Catalyst and SwiftUI, with an eye to what I might do with PCalc in the future.
Back to PCalc. In 2020, Apple introduced a new style of widgets on iOS and Mac. Non-interactive widgets, this time, which meant that I couldn't make a calculator out of one any more. Was that because of me? Maybe. On iOS, the old widgets still co-exist today, but on the Mac they went away entirely. So I needed to move the widget elsewhere, and I transplated all the code into the menubar.
And that's us pretty much up-to-date now. PCalc had a lot of internal changes in 2022 to add support for multiple calculators in multiple windows, which rolled out on iPadOS first, and will hopefully come to the Mac soon too. But a lot of the core maths code is still disturbingly similar to that first version I wrote in 1992.
I think it's a pretty safe assumption that I'm going to rewrite PCalc again and again, as long as I can write 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.