Programming languages and old computers entice me. However, I must tell you, that the amount of time and money spent on these devices can get out of hand pretty fast. But the joy of restoring and rediscovering the masterpieces — the operating systems, the languages and the programming environments of these bygone era machines — is priceless. An accidental discovery of an old language can slowly turn into an obsession. One such chance discovery was OPL — the Open Programming Language and the Psion Series 5.
Psion was one of the pioneers of handheld organizers and PDAs. In 1984, they launched the Organizer I, which they promoted as the world’s “first practical pocket computer” in Canada. Continuing their impressive work, they subsequently launched the Series 3 (a 16-bit handheld computer) and its successor (the 32-bit Psion Series 5). I think Psion Series 5 machines, such as the 5mx, especially, were marvels of their times.
Launched in 1999, the Series 5mx had everything you could want from a workable computer of that era — right in your palm. It had a backlit greyscale LCD, along with a very impressive QWERTY keyboard — one of the best in a gadget this size, which elegantly slid out gently from the clamshell when opened, and was a charm to type on.
If handheld keyboards were diamonds, this would be the “Koh-i-noor” of them all.
The 5mx had a ARM710-based 36 Mhz processor and usually 16MB of RAM. One of the most distinctive features of the Psion Series 5 was the amazing touchscreen and a stylus which could be stored in an inconspicuous slot in the device. You can still do some serious artwork with the stylus, reiterating the fact that touchscreen technology was quite advanced even in those days. There is a serial and infrared interface for external communications and a slot for a CF card, which can run a 1GB CF quite easily. The moment I set my eyes on it, I knew I was going to get it someday, and before I knew it, an impulse purchase on eBay had been made.
The Operating System
The Series 5 computers had EPOC32 as the base OS, which was a precursor to the Symbian OS itself, and a successor of the EPOC16 used in the Psion Series 3 machines. The OS was a pre-emptive multitasking system specially designed for embedded computers. The OS design, in all its layers, was highly object-oriented and was mostly done in C++. The effect of the object-oriented design of the OS is reflected in the applications that run on EPOC32, as well as its successor operating system — the Symbian OS, which at some point of time ran more than 44 percent of all smartphones in the world. The applications for EPOC OSes resembled desktop GUIs and were very functional and intuitive. For example, the triangle on the top left corner opens up a floating context menu for the current application showing usual desktop elements like File, Edit, View and so on. If you are of the more investigative breed, you can install part of the SDK to run an EPOC32 emulator on your desktop. Get the emulator from here and then install it either on your Windows machine or Linux machine (through Wine). I have put up the instructions in a gist for setting it up on Linux. Once the emulator starts, you will be greeted with a not-so familiar interface for you to explore.
The UI is pretty unique in some areas. For example, if you look closely in the photograph and the emulator, the icons — System, Word, Sheet — are actually quite detailed stickers on the screen, clicking “Extras” pops up an application drawer with a similar look and feel just above this physical App bar. Same is the case with the buttons on the left. The buttons on the right, however, are digitally drawn. Many devices in those times, like the earlier Apple MessagePads and Palm PDAs, had similar physical menus that integrated with screen functionalities.
Programming with OPL
Programming a Psion 5mx is quite easy with languages like C++ and OPL. There are even some ports for Python 2.2 and Lua 5 done by developers in the past. Even though all the development support has officially ceased, and apart from very few websites maintained by individual developers, there is nothing much left except some random manuals and dead links scattered around. For ease of programming, lets stick to OPL for now.
The OPL language is an interpreted language which resembles BASIC and was first introduced in 1984 by Psion. It is a structured, procedure-driven programming language and much easier to setup and work with than the others. Its success in earlier versions of Psion, and the inclusion in later Symbian versions, made it quite popular in its time. It was eventually open-sourced by Symbian in the end of 2002. You can get the source code of the whole language from SourceForge these days; however, any updates to the project seem to have ceased in 2006. Still, it can be a nice resource for people who want to learn how interpreted languages work in embedded platforms. A brief look at the source code tells us that OPL’s core components, like the translator and runtime, are themselves written in C++. On the Series 5, OPL programs interface with core OS components using C++ OP extension (OPX) libraries, which are like a layer to interface high level OPL calls with lower level device-specific functionalities. The usual way to write OPL code is to write it in a simple text (OPL) and input it to the translator (which can either be on the emulator, standalone or is also on the Psion). This translator generates an OPO file (the object code) which is be supplied to the “OPL Runtime” on the Psion for execution.
As the OPL code can be directly translated and run on the 5mx, lets warm up with a small program which simply displays a dialog box. For those who don’t have a Psion, It should be easy to test on the emulator as well. To save you from the hassle of downloading the complete SDK, writing and then translating the app on the desktop, we will simply use the emulator to write our first app.
Start the emulator by following instructions in my gist. Click on the “Program” icon on the home screen in the emulator (refer to the screenshot in the previous section). Now you are in the OPL programming environment. Here is the small Hello Psion program the you can input directly now:
dINIT "The Ultimate Question"
dTExt "", "Answer to Life, Universe and Everything is.. "
dBUttons "42",%r, "Wololo",%w
dTExt "", "You are right :)"
dTExt "", "You are Wrong :( Try again?"
dBUttons "Yes",%y, "No",%n
Alternatively, you can save this file as a normal text file (such as, HelloPsion.tpl), and put it in the EPOC emulator’s C drive (~/.wine/dosdevices/c:/Epoc32/Wins/C). Then launch “Program,” and press Ctrl+Shift+I to import plain text in the editor. You can also copy this file on the CF card and import it on a real Psion 5mx. Click on the “Trans” button on the right corner. The translator will generate the OPO file and ask you to execute it. Thats it. Here is how it should look:
If you want to know more about OPL programming, and how complex structured programs can be written, follow this link. Apart from that, there have been some efforts to get your favorite tools like VIM on the 5mx as well. Another resource worth visiting is the ProSoft website for OPL programs, tips and tricks for Psion (if you own one). I have managed to get the serial communication work on the 5mx with my Raspberry Pi and computer. This means I can SSH to my remote machines and VMs and use them directly (which is actually my usual work routine with Psion). And now, for the finale, I just want to let you all know that Linux runs on the Psion 5mx. This is going to be my next experiment with the 5mx. You can read more about it on the OpenPsion project page. This, I’d say, is only recommended for advanced users, but if you manage to pull it off, you can expect to see something like this:
It is a unique feeling to experience and compare how engineers approach miniaturization of devices then and now. It’s quite impressive to see the elegant marvels of the embedded world those guys were able to pull off some 18 years ago. In a way, each and every step — by the likes of RIM, Nokia, Psion, Palm, Apple, etc. — was, in fact, a template for the Nexus 5 or the iPhone in my hand right now. What will be the future of handhelds and smartphones 18 years from now? Will the screen size continue to increase? Will we continue our endeavor for feature fusion in handhelds? How will we interact with those devices? I will let the consumers and the producers decide — while I hunt for my next retro-machine to purchase.