A C Compiler For The HP49g+ 194
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."
Options? (Score:4, Interesting)
running at 4MHz. This is because it has to emulate an older processor
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.
Also, if customers are writing their own programs with a C compiler to get speed, why not just use something like the Zaurus running Linux, and one of the many, full featured, science/math software suites for Linux?
Re:Options? (Score:5, Insightful)
Re:Options? (Score:4, Insightful)
Regarding the keys, I find them to be just the right size, easy to read, have a distinct press, and not overly plasticy, despite being made of
Re:Options? (Score:5, Insightful)
These sound like the words of someone who has never used HP's 48 series. The keys were made out of a very solid plastic, never wobbled, gave you tactile feedback, etc. I think the other big complaint people have is the placement of the enter key, which was perfect on the 48 (big wide button, center left). Now I believe it's been shrunk and moved to the bottom right.
Now you may not care about all that, but the undeniable truth was that HP had a winning formula on the 48 and they threw it all away with the 49 series.
Re:Options? (Score:2)
The keys on my 49g+ are neither wobbly nor is there a lack of tactile feedback. Are the problems you suggest something that I can expect as it gets older (only had it for about 6 months) or do you suggest that my experience using the 49g+ is signific
Re:Options? (Score:2)
I purchased a 48gx two years ago so that I'd have one of the last good ones. Crazily enough, I bought it brand-new at Fry's for $95 and now many are going for $250 on ebay. Never would I have considered a calculator an investment.
Re:Options? (Score:2)
Re:Options? (Score:2, Insightful)
The first batches of 49G+s were even worse than the current - so bad, in fact, that HP admitted the problem and tweaked a little. Everyone in the group that I'm aware of with such a unit has asked HP for a replacement, and almost everyone got one. (If they're new to the group, and haven't bothered reading any threads before replying, they're quickly pointed to the thousand other which state this.)
If you'd bo
Re:Options? (Score:2)
I have read the posts but I can't seem to find the same problems in my 49g+. Will they develop over time? Maybe, but most of the complaints I read suggested that the problems existed from day 1. Guess my pa
Re:Options? (Score:2, Insightful)
Re:Options? (Score:3, Interesting)
Although, with an external keyboard (or a PDA with a *real* keyboard, like a Jornada 720 or Sigmarion 3) it is pretty fun to use GNU Maxima or GNU Octave. Somehow though, it strikes me as lame that you can get a full GUI'd version of GNU Maxima on Windows CE [1], and
Re:Options? (Score:3, Funny)
But a "turbo" key would have been handy.
Mass production makes strange economies (Score:5, Insightful)
- Simple economics, if it's cheaper to use the faster processor and emulate the other one, it doesn't matter. Recoding for native operation may not have been possible. This is related to my second point:
- All glitches and problems with the existing design are well documented and hammered out. It may not have been feasible as I suspect there is a lot of verification that happens on these guys before they ship. If the calculator has been painstakenly debugged on one processor, it may very well be easier to insure 100% emulation than re-test all the functions.
Re:Mass production makes strange economies (Score:3, Informative)
Re:Mass production makes strange economies (Score:3, Informative)
If the 49 has it's own SysRPL emulator, it would be quite fast (not as fast as pure C, though), but if it's emulating the 48's Saturn processor, which is emulating SysRPL, things could get slow.
p.s. Am I the only one here with the Saturn pr [rhoads.nu]
Re:Mass production makes strange economies (Score:2)
YES!
Re:Options? (Score:5, Insightful)
Ah yes, rampant Consumericanism at its finest.
Maybe the reason 'they' 'don't just use something like a Zaurus running Linux' is because they've already got a fine working H49g+ in 'their' posession.
Don't you get it? You're only 'countering the view' on automatic. The solution to every cool hack is not automatically "you can buy something else instead and it'll be cooler".
(Not a Flame, not a Troll. Truly, this is Consumerican 'logic' at its finest...)
Re:Options? (Score:5, Interesting)
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.
Re:Options? (Score:2)
More info please?
(proud HP48gx owner here)
Re:Options? (Score:2)
Way faster than the stock stuff on my 48gx. Too bad the 128kB memory cards were so goddamn expensive so I didn't get it for a long time.
Re:Options? (Score:3, Informative)
The most commonly used language for advanced programming is 'System RPL', or 'SysRPL'. On modern calculators, SysRPL is mostly executed by an emulated 'Saturn' processor. C on the other hand is executed directly by the ARM chip. The same program written in C will be many (up to 100) times faster then the equivalent SysRPL program.
So possibly the article miswords that the 'emulation' is simply of an older programming language. If it's a common one, I see why they'd keep using it instead of
Re:Options? (Score:5, Insightful)
You don't understand Engineering do you?
The design solution to a problem is about getting the best time, cost, risk and other constraints satisfied in the most optimal way possible. It may be lower risk to emulate an old processor than to port and regression test legacy code.
The best technical solution can often be the worst engineering solution, taking into account other cost and risk factors.
30 seconds? (Score:2, Interesting)
What kind of moronic algorithm is being used there?
http://www.luschny.de/math/factorial/FastFactoriaRe:30 seconds? (Score:4, Informative)
No, really. the 4Mhz cpu it emulates does imho only do 4bit arithmetic, so you need an awfull lot of cycles to handle longer arbitrary precission numbers...
Re:30 seconds? (Score:5, Informative)
At three to seven (the actual comparison) times the 4MHz 48g speed, there is far less than a gap of >>30 between the speed of the emulated processor and the physical one so I stand by (for now) my speculation that there is surely an algorithmic difference between the built-in (example?) one and the new 'native' one...
(But what do I know, I'm just flamebait... apparently...)
Re:30 seconds? (Score:2, Informative)
Um, no. Saturns have 64 bit registers. They do address on 4-bit nibble boundaries though.
Re:30 seconds? (Score:2)
No. The TI-89 can bust through 50! without any noticeable delay.
The TI's biggest slowness when working with large integers is the display time - the "pretty print" routine is slow when working with them. If you put "(100!)^2->X" in a program and execute it, it only takes a fraction of a second.
Note that the TI does not display integers greater than 10^1000.
Re:30 seconds? (Score:2)
Re:30 seconds? (Score:2)
The TI-83+ probably only gives an approximation for large factorials. That's what the TI-85 does. The factorial function on my 85 is very fast for values up to 449! (the last integer with factorial less that 10^1000). However, the result isn't exact--it's truncated after 11 digits or so.
Re:30 seconds? (Score:2, Interesting)
Re:30 seconds? (Score:2)
Convergence (Score:2)
Re:Convergence (Score:2, Funny)
Re:Convergence (Score:2, Insightful)
Why start shifting calculators away from their original uses when PDAs are already available for the less specific functions such as nice graphics, sound, GPS and offer the same portability?
Re:Convergence (Score:4, Funny)
Specifically, the horse in this example is the chip, and the cart is, of course, emacs.
The C compiler is foundational. Now, we need to figure out an interface using the cable kit for a keyboard, and the relentless march of the One True Editor shall take yet another step.
Mwahahahahah...
Re:Convergence - USE GSM(GPRS) for calculating ;) (Score:2, Interesting)
I would call convergence when I use my mobile and a SSH connection via GPRS to use my Maple version of my home PC on the road. OK, your right the HP calculators do have a better keyboard and the display shows better plots, but why not use a HP calculator with SSH conection via mobile to the home PC? I would call it "mobile shell" that offeres much more than using maple *g*. There is a free J2ME SSH1 Client:
http://phoenix.inf.upol.cz/~polakr/ [inf.upol.cz]
BTW: Any chance to get a HP48GX programming manual, toda
RC5? (Score:2)
Re:RC5? (Score:2)
His intention? Try to get arrested taking it across the border as a way of protesting ITAR. (This was before encryption export restrictions were eased.)
GCC on TI (Score:4, Interesting)
Re:GCC on TI (Score:2, Informative)
No.
Re:GCC on TI (Score:5, Informative)
Re:GCC on TI (Score:2)
The Motorola 68k-based calculators, the 89, the 92, and the Voyage 200, are unfortunately prohibited most everywhere (ACTs, etc.) due to the onboard computer algebra system. Great calculator on technical merits, though.
Anyone know of a good GCC/other C compiler for the Zilog Z80 TI series (73 and 80 through 86)? I've seen Z80 compilers on the Internet that can output object code linkable into TI programs (using DEVPAC83), but these aren't explicitly designed for TIs: they use the
GCC Mods (Score:3, Interesting)
I wonder what they had to change in GCC for this project. ARM chips are fairly well supported already.
I poked around briefly in their CVS repo, but didn't see anything obvious that looked like a set of patches to gcc backend source.
Re:GCC Mods (Score:2)
Re:GCC Mods (Score:2)
Thanks, guys, appreciate the info.
Keys? (Score:2)
Re:Keys? (Score:3, Informative)
Unfortunately, no. (Score:2)
I'm fairly disappointed with my 49G+, I'm looking forward to this machine [hydrix.com], which was designed by some of the old HP48 engineers, I believe.
Re:Unfortunately, no. (Score:2)
hard to tell from that pic (Score:2)
They used to have pics of their prototype spread out over the bench, with all the chips in view and the keys on the keyboard all hand-labelled.
I guess they've gotten funding since then.
The keys made the 48.. (Score:2)
My reasoning behind the tungsten emulation was that no keys > crappy keys.
Maybe I'll engineer a little keypad for the Palm for numeric entry you can put side by side, like the old HP business calcs.
Just got one (Score:4, Funny)
Re:Just got one (Score:4, Funny)
HP49g+ details (Score:5, Informative)
Re:HP49g+ details (Score:5, Funny)
Re:HP49g+ details (Score:2)
Re:HP49g+ details (Score:2)
Yes, finally... (Score:2, Funny)
Good thing ! (Score:3, Interesting)
I was already aware of that project, as an user of the TIGCC board (an environment development including heavily patched GCC for TI-68k calculators), which someone else already told about in those comments.
fun times (Score:2, Funny)
Games huh? (Score:4, Interesting)
Re:Games huh? (Score:2)
Re:Games huh? (Score:2, Informative)
Contiki port? (Score:4, Interesting)
Rather than ethernet ... (Score:2)
Why go with ethernet when you could have a SD 802.11b / 256M card [sandisk.com]? The question is can SDIO cards work on the 49+?
HP calculator are no more, really. (Score:5, Interesting)
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...
Don't Fsck with your bankers.... (Score:3, Insightful)
Re:Don't Fsck with your bankers.... (Score:3, Insightful)
Re:Don't Fsck with your bankers.... (Score:2)
Re:HP calculator are no more, really. (Score:2)
Build Libtomcrypt for it! (Score:2)
It compiles in ARM CPU's already, I believe.
Crypto on your calculator!
"That's not a calculator..." (Score:5, Interesting)
Note that Nickle [nickle.org] 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.)
Why do you need 10000! ? (Score:2)
Re:Why do you need 10000! ? (Score:2)
Re:Why do you need 10000! ? (Score:2)
It's mostly a metric of multiplication speed. There are lots of times you need to do a lot of large multiplications in a fraction of a second.
That said, my students were recently working on an ICPC problem in which they needed to find the last non-zero digit of large factorials. "How will we check our solutions?" they asked. Heh...
Re:"That's not a calculator..." (Score:2)
calc: 50,000! 7 sec
nickle: 50,000! 11 sec
calc: 1,000,000! -- No result after 15 min, used 3 megs memory
nickle: 1,000,000! -- Used 500+ megs memory after 5 minutes, 500 megs of swap, and brought system to its knees.
Hey, I thought the 2.6 scheduler was supposed to fix that.
Anyone else... (Score:5, Funny)
You betcha sonny boy. (Score:2)
Guy wrote me a 9 page letter explaining to me how I wrote my own program.
Nah, need to run a webserver on it... (Score:3, Insightful)
Re:Nah, need to run a webserver on it... (Score:4, Funny)
Re:Nah, need to run a webserver on it... (Score:2)
Re:Anyone else... (Score:2)
Re:Anyone else... (Score:2)
You have to do it in assembler for the full 5 points.
Re:Anyone else... (Score:2)
Doing it in bed with twins. Blondes, preferably.
except wearing a calculator on your belt (6 points) and being able to disucss how games run cool on an overclocked OS OS (7 points) is a sure way to turn off the opposite sex
Hello grammer (Score:2)
Seriously, Michael give me your snail mail address and I will send you the MLA guide. We will have you making sentences in NO time.
Re:Hello grammer (sic) (Score:2)
Re:Hello grammer (sic) (Score:2)
Yes, I should definitely spell a subject like Grammar correctly if I am chastising someones lack of familiarity with it, I could not have done that intentionally.
Yes, we are both black
battery usage? (Score:4, Interesting)
What happens to the battery life when you run the ARM at higher clock?
Re:battery usage? (Score:2)
Large number (Score:3, Funny)
So how big a display has this thing got if it can display 1000! Not sure how big it would be, my guess is somewhere between a googol and a googolplex.
Re:Large number (Score:2, Informative)
Larger than a googol, and just barely smaller than a googolplex.
Re:Large number (Score:2)
Re:Large number (Score:2)
Re: (Score:2)
The doom of the calculator (Score:4, Interesting)
See, the only thing that's been preventing the gameboy from being a kickass calculator is the relatively awful control system. However, the upcoming DS has two screens, one of them a touchscreen; you can't get a better small-platform simulation setup than that, IMO, since you can change the key layout per task, and if nessecary trade the keys temporarily for a whole second screen.
It's like a palm pilot calculator, except that it still has a screen while the keys are up, eliminating the most sucking thing about palm pilot calculators.
Seperately, you never need to bother with a connection cable, because it does 802.11, and the screen is quite nice - backlit 256x192 fullcolor with hardware-assisted 3D with antialiasing. The graphing potential of such hardware is massive. You can use sprites for things like cursors and flow analysis.
Oh, right: and the underlying CPU blows the doors off of a 4mHz ARM9. It's got a 66mHz ARM9 *and* a 33mHz arm7. 8 meg of ram for large matrix calculations. The ability to network.
Oh, and games on a gameboy are better than games on any TI.
The end is nigh. HEED MY WARNING. Calculator advocates, repent - unification is at hand, commodity hardware defeats characteristic purpose hardware, generalization is cheaper than specific hardware, the ASIC falls at the sword of the CPU.
Linux boxes for VCRs, Linux boxes for game systems, Linux boxes for kitchen appliances, but when it matters, turn to Nintendo for your calculator.
And in case you were wondering, yes, I'm the gameboy stonecypher, and yes, my calculator, based largely on gnuplot and yacas, is about three quarters done. I may not know shit about math, but my Nintendo sure does.
+1, Insightful to anyone who compares YACAS and whatever other computer algebra systems there are to HP's bujillion calculators I can't be bothered to research.
Re:The doom of the calculator (Score:3, Insightful)
No it's not. Calculators are bought by two kinds of people.
1) Students. Students can't use calculators with softkeys.
2) Professionals. Most professionals want calculators that actually work, not some Gameboy hack designed by Joe Shmoe that comes up with 2.99998 when asked to calculate the square root of nine. (They also want calculators with tactile feedback, long battery life, and the ability to work after being dropped a couple of times.)
[G]eneralization is cheaper than specific
Re:Is it reverse polish notation? (Score:2, Informative)
Re:Is it reverse polish notation? (Score:2)
Re:What is the point (Score:5, Interesting)
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.
Re:What is the point (Score:5, Informative)
Is the 49g+ RPN?
Not by default - but you can set it to be with about 3 button pressed. Then its a proper RPN* calculator unless you set it back.
*The RPN it uses is different from HP's early implementation. The earlier versions have a 4 level stack only. The HP48/9 series effectlvly have an unlimited stack, and you can put all kinds of objects (matrices, programs, symbolics etc) on it. Its alot more powerful then the RPN of say a HP15c, but naturally more complicated to use
Will there be a linux/BSD/[other OS] port?
Well, you have a 203MHz CPU, 512kb RAM, and 2MB ROM. If you can fit linux on that then go for it!