Posts: 131
Threads: 20
Joined: Mar 2011
Hi Thomas,
First, I really want to congratulate you for your simulator. I have it running just fine on my gold old Palm M500. I have started (but not finished) such a simulator myself, and I know how much work it is. Congrats !
Then, I think that what would be great is to take advantage of the freedom you get by writting a simulator instead of an emulator to actually improve the original calculator. Here is a list of what could be great improvements over the (already impressive) features of an HP42S:
1) Direct alpha entry a la HP41, with labeled letters, rather than the ennoying 2stroke letter entry.
2) Algeabraic equations, with full editing capabilities, a la 17BII/27S rather than a la 32SII. This is great when solving complex multivar equations.
3) Fraction mode, a la 32SII
4) Matrix descriptors a la 15C rather than a la 42S, i.e. explicit name (e.g A(3,3)) rather than [3x3 matrix] where you loose track of the content. You could even have a 'RESULT' 15C equivalent to manipulate matrixes directly rather than having to 'STO' them back in their original variables.
5) Having a complex entry mode different from the display mode, i.e. entering them in polar form while the current display is rectangular (a la HP48)
6) File and time functions a la HP41.
This would make the best calc even done by HP ! What do you think ?
Again congrats and thanks,
Vincent
Posts: 610
Threads: 53
Joined: Aug 2005
Hi Thomas,
I guess everybody has his own dream of the perfect calculator, but unfortunately only few of us have the particular knowledge of implementing it.
I'm really happy that your emulator is available to us, and, cherry on the cake, for free !
So far it worked perfect for me, though I did not check advanced functions.
I won't request many improvements, but just one for userfriendliness, as I wish it to be my permanent calculator on my desktop. Could you implement computr keyboard input for the essential keys, such as numbers, arithmetic operators, and of course ENTER... ?
And once again, good job !
Posts: 727
Threads: 43
Joined: Jul 2005
Could you implement computer keyboard input for the essential keys, such as numbers, arithmetic operators, and of course ENTER... ?
Absolutely. Configurable keyboard mapping would be a big plus, and it will definitely be available in the next major release (1.1).
I'm not exactly sure how it will work, but I'm leaning towards adopting the KML format used by Emu42, so you would be able to use the same keyboard mappings (and the same skins) as Emu42.
Expect this sometime early next year. Right now I'm just fixing bugs, and once that winds down I need a bit of a break, to get my energy back for all the cool stuff that's still on my wish list.
Posts: 727
Threads: 43
Joined: Jul 2005
Here is a list of what could be great improvements over the (already impressive) features of an HP42S: [...]
Direct alpha entry is on my own TODO list, too. Perhaps it will be done by PC keyboard mapping, like Emu42, or maybe something more direct  things like PalmOS Graffiti input, and alternative input methods for the disabled, are all things I have to consider, too.
Complex data entry independent of the display mode, and things like HP41CXtype file and time functions, are easy to add. As long as a new function can be implemented using the 5 data types of the 42S, adding it to Free42 is pretty simple. (Displaymodeindependent complex data entry can also be accomplished in about a dozen lines of user code.)
Fractions and algebraic equations are a different story, because you have to add new data types. These would require new code all over the place, because almost every command has to be modified to handle them.
Speaking for myself, regarding algebraic equations: I have tried the HP28S and the HP48G in the past. I thought they were really clever and very elegant, but in the end, not really very useful. For symbolic math, anything less than Mathematica or Maple is useless (and handhelds necessarily don't have the fullsize keyboards and displays that you need in order to work with that type of software). For programming, structured languages are a poor fit for handhelds too, again because of keyboard and display limitations. (Try writing functions with conditionals and/or loops nested more than a couple of levels deep. You will not be a happy camper editing such code on a 28/48  been there, done that.)
For handhelds, I'm much happier, and more productive, with keystroke programming. I'll leave the algebraic and RPL stuff to those who like it. If I liked it myself, I'd have written Free48, not Free42. :)
Posts: 131
Threads: 20
Joined: Mar 2011
Hi Thomas,
Thanks a lot for your reply.
I agree with most of the things you said. I can understand your position on RPL, although in my view RPL does not really require more keystrokes than RPN. I even find the loops easier in RPL than RPN... :)
More fundamentally for Free42, I think the algebraic equations are a different discussion altogether. Neither the 17BII nor the 32SII are RPL machines, but they implement algebraic expressions. If you want to implement, let's say, a Time Value of Money, this is more naturally done if you can time the expression rather than building a RPN program. The 32SII is unique in that it combines both the power of RPN programming with the convenience of equation entry.
Just my 2 cents :)
Cheers,
Vincent
Posts: 536
Threads: 56
Joined: Jul 2005
i have a suggestion for implementing fractions without requiring new types. provide a rationalizer that turns X into P/Q. what i did in scicalc is compute P and Q no bigger than a max size (eg 6 digits each) and if P/Q was within a very small error of X, say 1e20 (in my case, maybe 1e10 for you), then accept it, otherwise reject. that is to say my “rationalizer” would only rationalise number it believed to be rational rather than find rational approximations for an X (of course the latter might also be useful).
my algorithm was based on continued fractions (i can give you some code if you like). alternatively, there is a better algorithm designed by joe horn, detailed in datafile V22N6 called the PDQ algorithm. unfortunately, i cant untangle it from the code. does anyone know any other references to this method, joe horn??
Posts: 170
Threads: 24
Joined: Jan 1970
The reason I once wrote a version of QPI for the HP42S was that I missed the possibility to calculate with fractions. Given the speed of Free42 it should give an almost immediate answer  even though its all written in FOCAL. (However, I am a little bit curious on how it behaves on the binary artithmetic implementation in Free42.)
And besides I think it is more important to "fool proof" the functionality of the existing HP42S functions *first* before going off for something new. This way we would get a very stable implementation that we could trust in the same way we can trust the results on the HP42S. Only then would I try to extend the functionality base beyond the original.
Best regards,
Erik Ehrling
Posts: 727
Threads: 43
Joined: Jul 2005
Well, I guess one way to add symbolic equations to the Free42 architecture would be to simply support unlimitedlength strings, plus an EVAL function that maps names to variables and/or user programs and/or builtin functions and basically transforms infix notation to RPN on the fly. For maximum geek points, I probably wouldn't be able to resist writing a COMPILE function that transforms an expression to a regular stored user program, MVAR declarations and all. :)
Of course if you expect things like "a" ENTER "b" + to return "a+b", things will get uglier, because then you're back to having to add that type of functionality everywhere... And before too long you'll start wishing for an expression simplifier, and symbolic SOLVE and INTEG, and that's when I'll start thinking about Mathematica again...
On the topic of rational numbers: if that can be done adequately as just another display mode, without adding a new type, than that's pretty easy... But just out of curiosity: who would actually *use* such a mode? (I can just feel another discussion about the (non)importance of "exact" results coming on! Like it's not enough having to put the BCD crowd in their place. <g>)
Posts: 727
Threads: 43
Joined: Jul 2005
If you want to implement, let's say, a Time Value of Money, this is more naturally done if you can type the expression rather than building a RPN program.
FWIW, this kind of stuff is totally easy on the 42S.
What you do is, you write a program like this:
01 LBL "TVM"
02 MVAR "N"
03 MVAR "I"
04 MVAR "PMT"
05 MVAR "PV"
06 MVAR "FV"
...now write the code that computes FV as a function of the
other four parameters, which you can fetch using RCL "N",
RCL "I" etc...
41 RCL "FV"
42 END
Then go to SOLVE, select "TVM" from the menu, and presto, you have TVM, just like on a real financial calculator. The solver shows a menu consisting of the names listed in the MVAR instructions, and you can set the corresponding variables, and solve for any of them, by pressing the corresponding keys. It's not the most efficient approach in terms of CPU usage, but even the real 42S is fast enough to make this usable.
It's been a while since I used the 28S and 48G, but I think the 42S solver works just as well, and is just as easy to use, as the one on the RPL machines. The only difference is you have to do RPN keystroke programming instead of equations or RPL, but hey, if you don't like RPN or keystroke programming, the 42S (or a 42S emulator) is probably not for you anyway.
Posts: 131
Threads: 20
Joined: Mar 2011
Hi Thomas,
Thanks for your answer.
I beg to differ, though. Although TVM is a fairly trivial exmaple to implement in RPN, some other equations may require to store a lot of intermediate results in registers, and it makes sense to code them in algebraic form. And this holds, even if you love RPN ! Both methods are complentary  RPN for keystroke programming, equations for complex formulas. That's why the 32SII was the most sold RPN calculator, even though its way to enter equations is more primitive than the 17BII/27S :)
Cheers,
Vincent
Posts: 727
Threads: 43
Joined: Jul 2005
Although TVM is a fairly trivial exmaple to implement in RPN, some other equations may require to store a lot of intermediate results in registers, and it makes sense to code them in algebraic form.
I see your point, but still, how do you envision adding that kind of capability to the HP42S? I still think that once you start dealing with the secondary issues of supporting complicated algebraic expressions, you'll find yourself having to implement an unlimiteddepth stack, and a sophisticated expression editor, and support things like expression simplification and other symbolic operations (derivatives, at least, and before you know it you'll want symbolic integration and root finding, too).
I think once you start going down that road, it will lead you straight to the HP28[CS] and its successors. There's nothing wrong with that per se, but for me, the biggest asset of the HP42S is its simplicity (as in "its ease of use", not as in "its limitations"), and for me, losing that simplicity is not acceptable.
Having said that, if you could suggest a user interface design that supports algebraic expressions, *without* adding any keystrokes, or complexity in the display, for when you're doing the kinds of things people use the HP42S for today, I would be interested to hear about it.
Posts: 172
Threads: 21
Joined: Sep 2005
IMHO, you, Thomas, have already done a greatgreat job and the present release is fully functional for me.
The only possibilities I would like you to add refer to:
a) the use of keyboard : 09, ., +, , *, /, ENTER, AZ to be entered directly from the keyboard;
b) the use of shift key (press the function above the key directly, instead of using the shift key to do it).
Both of the above have already been mentioned by other posters. If we discuss the functionality of the calculator itself, we may always come to another calculator, not the 42s any more.
On my PCs I always use good old ttCalc v1.3 as the Windows calculator and would be happy to replace it by a Free42.
Posts: 131
Threads: 20
Joined: Mar 2011
Hi Thomas,
Do you own a 17B/17BII/18C/19B/19BII or 27S? There is a nice equation editor, which does not do derivatives or anything complexe like this, but just allow you to specify multivariables equations, with a IF and SUM functionality a la Excel, and L() and G() (LET and GET) functionality to store intermediate results. These advanced functionality would not be needed in the 42, which has more advanced RPN programmability.
Alternativelly, the 32SII is even less complex. You are restricted to one character variables, you have no editing capabilities, and no IF nor SUM.
None of these model have anything to do with the complex RPL system of the 28/48. The equation functionality fits nicely in the calculator  as a complement to RPN (in the case of the 32SII).
Cheers,
Vincent
Posts: 727
Threads: 43
Joined: Jul 2005
I don't own any of those machines, I'm afraid. I'll have to take a look if I can find manual scans for any of them on the HP Museum CDs... I know there's a 32S manual there, but none for the 32SII... Do you know if that makes much difference, regarding the equation functionality?
Thanks!
 Thomas
Posts: 727
Threads: 43
Joined: Jul 2005
I found some relevant manuals on the HP Museum CDs  18C, 27S, 32S, and 27S/19B Technical Applications.
I think I'm up to speed with those machines' algebraic equation functionality now... And as far as adding that type of feature to Free42 is concerned, I don't see any major obstacles. It *will* require unlimitedlength strings, and an unlimitedlength alpha register, but that's all doable without too much pain.
Don't hold your breath just yet, though! There is a lot to do for Free42 1.1, and I think all the stuff on that todo list (program import/export, PC keyboard and PalmOS graffiti mapping, printer emulation, and customizable skins) should come first.
So, equations look like a good candidate for Free42 1.2 enhancements. Probably 2Q2005, unless I go insane and go on another mad hacking run (like the one that brought forth Free42 1.0!)... Then it could be sooner. Who knows? :)
Posts: 131
Threads: 20
Joined: Mar 2011
Hi Thomas,
Thanks a lot for this investigation  much appreciated.
The 32S does not have the equation functionality the 32SII has, so you won't find it. But you can still find the 32SII/33S manual on the HP web site. Basically, the 32SII equation functionality is less sophisticated than the 17BII/27S one, and therefore it is better to implement the latter way; however, the 32SII is the only machine that has both the equation functionality and RPN programming; hence, you can have an equation directly in a RPN program, which is useful when you have a complex expression with a lot of variables to evaluate in a program.
Just one more thing  there is a small behaviour difference between the real HP42S and Free42: if you type XEQ, STO or RCL on a real HP42S, you can then enter alpha mode (to enter a variable or lable) EITHER by pressing enter directly (as in Free42) or by shiftENTER (which is legal on the HP42S, but not in Free42). Small matter, but anyway :)
I understand your priorites. Thanks for your openness to other ideas, and congrats for this great program.
Cheers,
Vincent
Posts: 727
Threads: 43
Joined: Jul 2005
[...]the 32SII is the only machine that has both the equation functionality and RPN programming; hence, you can have an equation directly in a RPN program, which is useful when you have a complex expression with a lot of variables to evaluate in a program.
OK... I found those manuals you mentioned on the HP web site; I'll take a look at them later on. When I do add equation functionality to Free42, I'll try and make sure I borrow *all* the neat ideas I can find.
Well, maybe not quite all, but good integration with the rest of the 42S is of course a must. You should be able to evaluate equations from an RPN program, and use them from the solver, the integrator, DPLOT, etc. I have some ideas how to achieve that but of course it's still a long way off.
Just one more thing  there is a small behaviour difference between the real HP42S and Free42: if you type XEQ, STO or RCL on a real HP42S, you can then enter alpha mode (to enter a variable or lable) EITHER by pressing enter directly (as in Free42) or by shiftENTER (which is legal on the HP42S, but not in Free42). Small matter, but anyway :)
A bug is a bug! Thanks for letting me know. This will be fixed in Free42 1.0.9, probably later this week.
Just started work on the printer emulation for 1.1...
Posts: 131
Threads: 20
Joined: Mar 2011
Great job Thomas ! I really appreciated your openness and your responsiveness. There should be more developpers like you... Do you know Charles Lee (P41CX HP41 Palm emulator's author) ? He has the same passion as your have :)
Thanks again and cheers,
Vincent
Posts: 727
Threads: 43
Joined: Jul 2005
Thanks for your kind words. One does what one can...
Re: Charles Lee & P41CX: I don't know the gentleman but I do know his product. If I wasn't such an HP42S nut, I'd probably just pay the registration fee for P41CX and never use anything else ever again.
Maybe if Free42 *looked* as nice as P41CX I could start asking money for it, too. :)
Posts: 131
Threads: 20
Joined: Mar 2011
Dear Thomas,
I'm sure one day soon Free42 will look as nice as P41CX...:)
By the way, on both versions 1.0.9 and 1.0.10, calling 'BST' on a dummy argument from the catalog crashes the simulator (Fatal Alert). I guess this is not normal behaviour... :)
Thanks and cheers,
Vincent
Posts: 727
Threads: 43
Joined: Jul 2005
Dear Thomas, I'm sure one day soon Free42 will look as nice as P41CX...:)
I hope so but for now, my todo list only keeps on getting longer and longer! I'll never get around to it...
By the way, on both versions 1.0.9 and 1.0.10, calling 'BST' on a dummy argument from the catalog crashes the simulator (Fatal Alert). I guess this is not normal behaviour... :)
Of course it's normal. All software longer than 1,000 lines of code is supposed to crash every now and then, by Microsoft decree. :D
What do you mean by "calling BST on a dummy argument"? I don't know how to reproduce this problem.
Thanks!
 Thomas
Posts: 131
Threads: 20
Joined: Mar 2011
Dear Thomas,
Congrats for starting on the printer emulation! Do you intend (on Palm) to print to memos, like P41CX, for export to the PC, or to make a onscreen printer, or both (which would be great ? ;)).
For the bug I was mentionning, sorry, the 'dummy argument' is irrelevant. Just go to the CATALOG, skim through until your reach 'BST', and press the softkey  on Palm, you get a 'Fatal exception error' and you have to reset. Not a big deal since it is pretty silly to call BST this way, but still a bug, as you would say :)
Thanks and cheers,
Vincent
Posts: 727
Threads: 43
Joined: Jul 2005
Congrats for starting on the printer emulation! Do you intend (on Palm) to print to memos, like P41CX, for export to the PC, or to make a onscreen printer, or both (which would be great ? ;)).
Print onscreen, print to memos, print to unlimitedsize text files (on SD card), print to GIF files (so PLOT and other PRLCDusing programs can be used), the works. Needless to say, supporting all of that without turning the user interface into Frankenstein's Monster is a bit of a challenge, and it doesn't help that I want it all to work on all the three platforms I currently support... So I'm still spending a lot of time lying on the couch and staring at the ceiling, waiting for my moment of Zen. :)
For the bug I was mentionning, sorry, the 'dummy argument' is irrelevant. Just go to the CATALOG, skim through until your reach 'BST', and press the softkey  on Palm, you get a 'Fatal exception error' and you have to reset. Not a big deal since it is pretty silly to call BST this way, but still a bug, as you would say :)
Indeed, a bug. I need to check if there are any more lurking like that  all those functions that are usually invoked through specialcase logic rather than the more general mechanisms. Some of these functions have NULL function pointers in the great big master function table, but if there turns out to be a way to invoke them in a way I hadn't anticipated, crash! CLALL suffered from this type of problem, too.
Thanks for the headsup!
Posts: 131
Threads: 20
Joined: Mar 2011
Hey Thomas,
Very ambitious program ! Good luck ! I'm sure the final version will be the biggest hit on Palmgear :)
Cheers,
Vincent
