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.
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
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.
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?”
Forth programer only can write new forth interpreter. Something that surprised me
now for >20year. That is a kind of running joke. :)
Olaf
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.
> Is there a word processor written in FORTH?
Some wanted to redo TeX in Forth: BuX.
Or was it an April’s joke?
https://wiki.forth-ev.de/doku.php/projects:bux:start
LISP has the same problem.
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.
EDDE is written in Forth. It is the OS, editor, and everything else for the IAI Swyft and the Canon Cat. It is the best and most usable text editor ever created for keyboard-only systems IF you have a couple special keys. https://www.digibarn.com/friends/jef-raskin/slides/canon-cat/index.html
I agree that the HP48 was superior to HP41, not because of Forth but because of the much better display.
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
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?
Do check out SwissMicros. https://www.swissmicros.com/product/dm41x goes to their DM41x.
Slight (nit picking) corrections:
– DM42 is a remake of the HP42s (I agree it’s a super good calculator)
– DM41X is a remake of the HP41C(X)
I’m still waiting for SwissMicros to implement HP-IL. HP-IL was the entire reason I got into the 41, to control equipment and take data from equipment on the workbench, a half-dozen pieces of instrumentation at once. It could handle five times that many at once with primary addressing. I have the HP82169A HPIL-to-IEEE488 interface converter (good for hundreds, possibly thousands of different models of lab instrumentation from HP, Wavetek, Keithley, Philips, Cytek, Krohn-Hite, Gould, and so many more), HP82165A HPIL-to-parallel interface converter (which enables me to use my Epson printer with my HP-41), and the FSI164A (like the HP82164A) HPIL-to-RS232 (two channels of RS-232) interface converter, and they can all be used at once, along with up to 15 devices off the ‘169A simultaneously, and other HP-IL devices like printers, mass storage, data acquisition units, and more. USB doesn’t really compare, except that it’s a lot faster than HP-IL was, especially with the 41 running it. The HP-71B ran HP-IL something like 35 times as fast as the 41 did, partly because its HP-IL module had its own processor to run the HP-IL, not requiring the 71’s own processor to do everything.
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.
Hard part is getting it apart without ruining anything.
Nope. I am an experienced User. I open my 48SX the first time when poured over some tee in the 90. And also speed it up from 2Mhz to 4Mhz. .-)
But 49,49,50 do not have the HP quality seen in earlier models. Keys don’t feel the same at all ( and the 49 is awful and ugly).
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.
Dashes or commas, pick one.
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!
An implementation of BASIC-80 would have been a hundred thousand times more useful. 🙄
May the forth be with you
A version running on Android would be nice.
See RpnCalc (Edward Falk) on Google Play.
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.
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.
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.
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.
I loved my 15C. There was a NIB one in eBay for $1,200. They seem to go used for anywhere from $75 for a beater to $400 for a nice one.
I miss it.
[MattR] Did you sell it to me for $15 in Longmont back in the 1990s?
Why no love for FORTRAN or ALGOL-60? 😢
Because HP never released a punch card read for the pocket calculator? :-D
nor paper tape! LOL
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.
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
probably not particularly deep; but the VIC-20’s memory, if not expanded, would be awfully limiting.
The Saturn processor used in the 71 and later units was much more conducive to Forth than the 41’s Nut processor which had 56-bit (7-byte) registers (including in RAM), 10-bit machine-language instructions, and a bit-serial data bus. The Saturn processor has a 4-bit data bus, 20-bit address bus, and 64-bit processor registers. The 71 is where I learned Forth; and although it’s a little bit odd, it works well. A stack cell is 20 bits, and you can address nybbles, bytes, or cells. As much as I like my 41cx with several modern modules, I have to say it’s not practical for Forth. I don’t have personal experience with Forth on the 41, but my understanding is that basically you can’t have anything else in main RAM, ie, other programs. Having source code in a text file in extended memory would be kind of limited with only a little over 4KB max, and its text editor is very slow.
The DM41X, and the DM42, are nice. Really nice.
But I just can’t justify the purchase.
Here’s the URL to the Detective Work mentioned in the article
http://www.hp41.org/LibView.cfm?Command=View&ItemID=1178
What are the odds that someone named Angel Martin would know the “detective work” of Angel Margin? LOL! Thanks for providing the link to your work, Angel.
The spelling of the name should be Angel Martin (re. The detective work).
I once heard a programmer call Forth a Write Only Program.
I’ve seen a awful lot of unreadable Forth; but I blame that on the programmer, not the language. It is said that the language also makes good programmers better, and bad ones worse.