HP-41C, The Forth Edition

If you have an HP-41 — arguably the best calculator ever made, you might not have noticed that there’s a version of Forth for it. The code was written a while back in assembly and will work on anything that actually emulates the device properly, such as a SwissMicros DM41X. [Calculator Clique] shows you how it works in a recent video that you can watch below.

The original code dates back to 1984, but some recent detective work by [Angel Margin] has the code running again. If you know about synthetic programming on the 41C and the oddities of its internal architecture, you can’t help but be impressed.

Of course, Forth is meant to be easy to port over, but if you read about some of the architectural challenges, you start to realize this could be one of the more difficult implementations you’ve ever seen. Don’t forget you have what is, by today’s standards, an extremely limited amount of resources.

That being said, calling the HP41C a calculator is almost a crime. It is really a tiny computer hiding inside a calculator case. Then again, the best calculators always are.

We wonder if the code would run on an emulated 41C? Were you part of the TI calculator gang? No problem.

39 thoughts on “HP-41C, The Forth Edition

  1. It is not necessary to tell us about an forth interpreter because we know that there exist a forth interpreter for almost every MCU and every machine in the world. The only problem, nobody use it.

    Oh and the best calculator every made is the HP48 because it is with forth from the factory. :-)

    Olaf

    1. I feel the same about such languages in handheld devices. It is just more comfortable to run tensor calculus in MATLAB. I’m sure there are highly specific problems that repeat enough for some people to have their toolbox of FORTH programs on the go always in their pocket, but not for me sadly.

      If I may rant: MATLAB deprecating functions however is very annoying. I’m stuck on some old releases, because rewriting my scripts would consume a lot of time I don’t have. One point back to FORTH.

    2. FORTH was even ported to the TI-99/4A but all I ever heard about it was people writing additions to the FORTH language for it – but nobody ever seemed to write any useful software *in* FORTH. “Where are the FORTH games? Is there a word processor written in FORTH?”

        1. More true than a joke :-) Nearly everything published was about implementations. In fairness, the majority of Forth based projects were for embedded code and arcade game systems.

        1. Lisp is rather common in certain dev spaces as is Clojure. Forth had a brief heyday when Sun Sparcs were big — lots of application machines that didn’t run SunOS had control programs in Forth straight to the firmware. Microcontrollers took over that space real quick though.

      1. If you like the HP48’s display… you really need to check SwissMicros’ DM42 which is a fantastic modernization of the HP41CX, but with a modern display, and a ton of extra stuff. The quality is actually a lot better than HP’s of the day (current HP calcs are no where near as well made as they once did), along with a wickedly long battery life. My desk has a HP41CX, a HP48, and a HP11c close by, but I typically always reach for my DM42

        1. I wonder why does nobody make a modern graphic calculator?
          I mean not a smartphone with buttons cosplaying as a calculator, but selecting a good low power MCU, with a good display technology that makes for great viewing without drawing too much power… A device that would run for months on battery, without having to recharge every week, without “shutting it down”, that boots instantly…

          Also no onboard WiFi or Bluetooth to have it exam compatible, but have an external modules for those who want it…
          Or perhaps we ditch exam compatibility because only TI and HP are recognized anyways by those who enforce the rules…

          I would be curious to see what improvements could be made to the graphing calculator with modern hardware when building it from the ground up. Perhaps one that is so low power that it runs on supercaps and a small solar cell? Or another one with super crisp display, and hdmi out to output on a larger screen, and a usb port to plug a keyboard and mouse?
          Gpios and analog inputs to capture data and plot/analyze the data?
          Micro SD to store stuff?

          What about the form factor? Vertical, or horizontal? Clamshell like the Nintendo DS might be nice!
          Imagine a great keyboard on the bottom and either a nice regular screen on the top of a color epaper for more battery life?

      2. Interesting. Ich bought my HP48SX in 1990 and love it a lot. The look and feel, the keys, the language (yes :), the expensive HP-smell, but if I look at it with modern spoiled eyes the display looks not so good, because the contrast of the old graphic-lcd are very low.
        Sometimes I think I will replace the old lcd by an oled. That is not impossible, I did some investigation in this direction, but unfortunatly some work.

    3. I used Forth for embedded systems and loved it. Forth is also great for bootstrapping a new architecture or system when there is no other software. Alas Forth was too close to the machine and too ‘odd’ to make it as a mainstream programming language.

  2. With Forth the 41C might have had a chance in my pocket. But it looks like I gave it away again before that Forth showed up (1980 or -81).

    SIGH!

      1. The 41c was the best in it’s day if you could afford one. $295 in 1979 would be $1200 today. My college ‘calculator’ was made by Pickett. I still have it. Stating that the 41c is arguably the best ever wins today’s award for hyperbole.

        1. The ‘best ever’ (which is also applied to the followup 42 and 48) are because of its performance per unit size and its keyboard feel. Plus, in the case of the 41, the interface options: it has four hardware bays for whatever you want to do, like adding extra commands, driving a printer, adding memory. There was a huge market of addon hardware available. Nobody now wants to have a direct hardware interface between their multimeter and their handheld calculator, so we don’t think about that when assigning “the best ever” metrics, but when my 41CV was brand new, that was a thing, and the 41 did a better job of it than any other calculator that I know of, before or since, save possibly the HP 71/75 calculator/computers, and those needed a docking station to get the standard(ish) interface that let them talk to printers or test instrumentation.

          1. I don’t know about the 75; but the 71 did not need a docking station. The HP-IL module fits entirely inside the machine, with the connectors accessible on the back.

            HP-IL, along with the interface converters to IEEE-488, RS-232, parallel, and video (all of which I have), allowed these little machines to be interfaced to dozens of things at the same time. This is the whole reason I got into the 41—and it’s why I cannot get interested in a 42, 48, 50, or DM-anything. Most people’s idea of I/O is very anemic, thinking only of things like mass storage and printer. I used the 41 and 71 for interfacing to lab instrumentation. My web page about how I got into the 41 and all the stuff I have for it is at http://wilsonminesco.com/HP41intro.html .

            I’m a strong advocate for Forth, and I use it almost exclusively on the workbench. It’s the way my brain works. I cannot latch onto C. (I have a web page about that, at http://wilsonminesco.com/stacks/Cbeef.html . I like Forth far more than BASIC as well, and am much more productive in Forth.

            Unfortunately, as much as I like the 41 and Forth, they go together about like ice cream and pickles. The 41’s architecture is not conducive to Forth at all. Yeah, it works, but it’s very slow and limited.

        2. I have an HP45 and a 15C. The 15C I use many times a day. What makes it great aside form the layout, is that it runs for 15+ years on three hearing aid batteries. I’m on my third set.

          I also have a couple of Swiss Micro, a 16L for digital logic and math which I rarely use these days, and a DM42 for the nice display. I should use the DM42 more often.

          Also a TI because I taught high school math an physics. Hate it. What a racket.

          Forth is like mother’s milk to me.

  3. 100% Not sure why they did not since the 71B had it, why the rest of the Saturn based units, IE the Pioneer Series(hp-42) and the Merlins(hp-48), the 18,19 and 28 family’s did not was a shame.

    1. I had a Forth cartage for my Vic-20. I was even able to type in a program or two. But they would go away, whenever I turned it off. My book said I could write a Word processer program, not sure how deep my stacks would of been

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.