A C Compiler For The HP49g+
Cheese Source writes "As previously mentioned on Slashdot, HP's latest and greatest calculator is the HP49g+. While it sports a very powerful (for a calculator) ARM9 cpu, it is only 3 times the speed of the 49g, running at 4MHz. This is because it has to emulate an older processor. Of course, some calculator geeks are now writing adapting a free, open-source C compiler for it. Based on GCC, you can now make programs that run natively on the CPU between 12 and 203MHz. 1000 factorial is calculated and displayed in the blink of an eye (the built in command takes 30 seconds). It will also allow for some great games."
GCC has been available for a long time for the 68000 based TI calculators with TIGCC. Is this about a port of GCC that runs on the calculator?
So how long until a NetHack port is complete? Come on, we all know what's important.
I don't want knowledge. I want certainty. - Law, David Bowie
Now with a C compiler available, how about building an Ethernet interface and porting the Contiki OS to iy? A Contiki port would bring TCP/IP networking, multitasking and a bunch of other cool stuff to the HP. Contiki has already been ported to a lot of weird stuff, like the GBA and the C64, so it would probably work well on the HP.
> So what they're saying is, rather than porting their calculator software to a new platform, they found it easier to write an emulator that pretends to be the old processor? Sounds like a pretty crappy design decision to me.
HP has a bit of an history of using great hardware for their calculators then botching them with inferior software.
The HP48g/gx had 512KB of ROM, a good chunk of it was used to store standard applications programmed in "external" (odd name given to a dialect of RPL that used internal entry-points liberally. Those would render as "<external>" when you'd try to see the source within the calculator, hence the name.) Applications written in "external" would commonly be about 15% faster than user-RPL programs. However in both case, you still use the RPL framework, which means your program is essentially interpreted, token after token.
That may be acceptable for user-written programs, but it's a bit sloppy for processor intensive applications that are in charge of plotting graphs and resolving symbolic equations.
A group of hackers once rewrote a good chunk of the built-in applications entirely in assembly, with the goal of making it fit on a 128K memory card. Unsurprisingly, the resulting environment was many times faster and more responsive than the original version.
That said, a whole lot of software has been written for the HP48 in many areas (although I seem to only remember seeing great games and textbook browsers for some strange reason..)
I can understand the value of an emulator to keep this software library available to the newer models.
A long time ago i bought an HP41C (not "V"!) and it was (still is...) a very good, small & rugged machine. No nonsense. Back then HP were making the very best calculators in the world.
Nowadays, a certain Miss has decided to decimate the "Calculators" division of HP and it shows. THe present calculators at HP have the same look and (cheesy) feel as the TI calculators. They are bulky and large, they sport cheesy buttons and it is actually hard to find a model that supports the sooo efficient & fast RPN notation. In short: they suck. I feel like we will never ever again see really well built & designed calculators now. Too bad.
Interestingly enough, the only calculator left in their product line that still has the feeling & quality of true HP calculators is the "Financial" HP12C... It seems Economists have it all... !
Maybe we should petition for Agilent to start designing calculators? One can always dream...
Note that Nickle will quite happily compute 10,000! (exactly) in a fraction of a second on a similar machine, through the miracle of Karatsuba multiplies. It also supports arbitrary-precision rationals and definable-precision floats (default 256b mantissa) with arbitrary exponent, and features a calculator-like interactive mode. I don't use much of anything else for numeric calculations anymore. (Of course, I co-wrote it.)
Hi,
I'm one of the people working on this. Maybe I can answer a few questions:
Whats the point? Why Bother?
Well, this is just an obscure hobby; no-one is spending 6 hours a day coding for this project. For me its just a way to learn a little about compilers. The main aim is to make it possible to create decent programs (mainly games) for this system. Coding for devices such as calculators has some interesting challenges to it, esp when you have to reverse engineer the hardware like we did.
Is this a real port of GCC? I thought ARM already has a port.
Yes it does, and its very good. We have tried to avoid modifying GCC itself to avoid extra work in the future. What we have done is write HP specific libraries and linking programs to executable may run. It works, so why not?
1000! in half a second is slow, 10,000! takes about a second to calculate on [some platform]
Indeed. Calculating factorials quickly is easy. Displaying the result (a massive, massive integer) is not. The factorial program trades off some calculation speed to markedly improve display speed. The "half a second" measurement comes from when the CPU is executing at 75MHz. I'm guessing running at 203MHz would speed that up a little.
Is the calculator really running a saturn emulator?
Yes, it is. SysRPL is an obscure language used only in these calculators. The complete Saturn CPU is being emulated, not just the SysRPL envrioment.
Yes, it makes things very slow - but there is a decade of debugged code written in sysRPL and Saturn asm. Throwing all that away would be very expensive for HP. With calculators, having the correct answer is critical. Emulating old code means the ROM should be fairly bug-free.
Of course an OS completely rewritten for the ARM would have been great - but its not economically feasible.