(λ (x) (create x) '(knowledge))

Slinging code on a Palm PDA

Power outage desperation, a Palm PDA, and some Ruby · April, 21st, 2024

It's finally spring here in Maine, which means I feel I can safely reflect on this past winter without jinxing it and invoking a Nor'easter upon my poor family. This in fact seems to have been my exact luck this year. It was pretty mild insofar as winters go, only a couple of major snow events. No real travel, heck we even had family up from Georgia in the middle of winter this year! That alone is a testament to how mild it truly was. But all good things must come to an end, and my luck ran out at the tail end of winter with two back to back Nor'easter, both dumping several feet of snow, ice, and freezing rain upon us.

For anyone from Maine, you already know what happens. The power gets knocked out the second one of these starts. If it isn't the wind bring a tree down on a power line, it'll be the ice. We lost power for about 7 days total this year, which is a lot with an infant in the house. Not to worry though, we have a propane heater, lots and lots of warm blankets, and a loft that traps heat like it's nobody's business. We were able to get along just fine. The only thing we didn't have at hand was a reliable way to boil water so we could prepare formula for the baby. But a quick trip to LL Bean and one pocket rocket hiking stove later and that really isn't any sort of a problem at all

All in all, not a bad deal! But what I can't prepare for, is battery power. We have the rechargeable portable batteries. Little ones for the mobile devices, big ones for the cars, heck I even have a UPS in the cabinet to protect my homelab. And let me tell you, after a couple of days without power you run every single one of those things down to the bone! Sure, some of it was my son plugging in the Nintendo Switch to try and sneak in a few extra hours of Kirby, but most of it was just keeping one of the cell phones going so we could try and keep an eye on restoration efforts. At some point, you really do need to know whether or not you need to leave, and if so where that might be.

Fortunately we weathered it all just fine, but sadly with my droid still out of commission, and my absolute unwillingness to waste precious recharge on my Chuwi netbook, I found myself without any reliable way to program/entertain myself (at least with electronics. Many delightful games of 9 Men's Morris and Chess were played happily!). That is, except for my Palm Tungsten T PDA. That little PDA just absolutely refused to die throughout it all. When every other device of mine had died, I could still check the time, take notes, read books, and most surprisingly of all write code, thanks to that itty bitty PDA.

Wow wait, did you just say write code, on a PDA? Oh yes, yes I did. Obviously I meant with an external keyboard I fished off of Ebay for way too much money right? Most certainly not! We're talking writing code, literally writing it with a stylus and grafiti! The depths of my depravity are clear, you can tell precisely how desperate I was to scratch that programming itch!

A word about Grafiti

I've talked about this a few times with friends, but the Tungsten T is somewhat unique. It's the last Palm PDA to use the original Grafiti input system, which also happens to be the one I learned from playing with my mother's Palm PDA when I was a kid. I was never that good with it, but the muscle memory was enough intact that using the second iteration of Grafiti on my Palm T|X was just an unpleasant experience.

This divergence is small, but kind of interesting from a historic perspective. In the early 2000's Xerox sued Palm stating that their Grafiti software infringed upon a patent they had held since 1997 on a unistroke text input system. Ultimately Palm lost the suit and the result was the abandonment of Grafiti in all Palm OS systems. The companies essentially signed a nonaggression pact stating they wouldn't sue each other and Palm went on to develop the Grafiti 2 input system.

What this really comes down to is that on later PalmOS systems where Grafiti 2 is used you need to use multiple strokes to insert certain characters, like K and 4. This isn't really that big of a deal, and there are wonderful hacks for fixing it! The point is, it is difficult enough to use a unistroke system to program with, let alone a semi-multi stroke system that was designed around being just different enough to prevent Xerox from suing Palm into oblivion.

Right, weird Palm PDA trivia over, back to what the heck this thing even is.

The setup

To make all of this craziness work you need three things.

  • A file manager, like 3XCom
  • A text editor, like SiEd
  • A way to transfer files onto the PDA, like pilot-link

Now these tools aren't specific, nothing says I need to use SiEd, 3XCom, or pilot-link. I could probably have used the notepad app, an SD card, and the actual palm desktop application for Windows XP. But I can't imagine a world where I do anything without Linux. The only thing in this workflow that I would really say I'm passionate about is SiEd, it is just a really freaking good text editor for the Palm ecosystem. It's Emacs inspired, so you can do fun things like copy/cut and paste in it, and open multiple files in a split view. That's about where the similarities end, but that's a lot for a PDA! By itself however it can't create new files, at least not in the sense that we want.

See in Palm OS most data is either a PRC or PDB binary file. PRCs are applications, and PDBs are databases. And while both of these formats are extremely well documented I don't really want to be bothered to write a thing, then convert the thing back and forth just to edit it. Fortunately SiEd is designed to operate on plain text files, if they already exist. What does that look like from a setup perspective then? Just a couple of simple things that can be done primarily inside of 3XCom on the Palm PDA.

Create the following folder structure, either on an external SD card, or using 3XCom on the PDA. Then sync an empty file and any code you're working on/referencing into the Devel directory. I personally use the SD card for this because it's more flexible, and the Tungsten T only has 16mb of RAM to work with, so every KB counts.

Devel|>> tree
├── Templates
│   └── empty
├── battery.nim
└── battery.rb

2 directories, 3 files

Thanks to the wonder Cloudpilot emulator I can show you exactly what this crazy setup looks like! The only difference between it and my tungsten is that I used an emulated m515 for these screenshots.

Inside of 3XCom that looks like this.

3XCom displaying the folder structure.

And actually loading and editing the code in SiEd looks just like this!

SiEd showing battery.rb

When you load a single file into SiEd you get about 14 lines of text to work with. The text wrapping happens at about the 36th character making even conservatively short lines wrap aggressively. However despite that fact the result is actually pretty good for a PDA. It's just enough context to get a feel for a short function.

But you can split that tiny screen into half as much real estate shared between two files, making the problem so so so much worse!

SiEd showing a split between battery.rb on the top and battery.nim on the bottom.

Now imagine. I'm sitting in the dark as a snow storm rages outside. We've got a little propane heater burning away in the corner. The aroma of the cheapest possible instant coffee wafts up from the desk in front of me, thank goodness my film photography obsession lead me down the road into Caffenol development a few months back. And in my palm rests a tiny 14 line screen, split between an empty buffer and some Nim. I scratch delightedly at the grafiti input pad writing glyph after glyph on the screen as character by character a ruby version of my battery plugin emerges.

Yes, there were syntax errors. No, I couldn't test it in any way whatsoever until I got power back and could pull the files off with pilot-xfer, but the process was amazing!

Never would I have imagined I would sit here in 2024 and tell anyone that it is not only possible but viable to write working code on a Palm PDA. I am all about using old machines to their furthest potential, but just wow, this one surprised even me!

So there you have it, as long as you're just writing text, a PDA is good enough to get you through in a pinch. It's no replacement for a laptop, or my droid, but damn if this isn't cool. And now I'm poised to start participating in ROOGLOCH, heck my Tungsten T can also record audio, maybe I'll bring a really bad quality LTRG episode to the fine folks reading this blog in the near future.


(defparameter *Will_Sinatra* '((Age . 31) (Occupation . DevOps Engineer) (FOSS-Dev . true) (Locale . Maine) (Languages . ("Lisp" "Fennel" "Lua" "Go" "Nim")) (Certs . ("LFCS"))))

"Very little indeed is needed to live a happy life." - Aurelius