Name that calculator - from the program listing... - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Name that calculator - from the program listing... (/thread-11783.html) |
Name that calculator - from the program listing... - Ángel Martin - 11-11-2018 07:58 PM Here's a reverse puzzle for the eagle-eyed amongst the audience: Upon ocular inspection (i.e. eye-balling it) name the calculator on which the program below runs Code: 01 LBL "COUNT" Not really sure, you say? Here's a second listing example that may (or may not) help: Code: 01 LBL "BLIP" So what say you, is this fictitious or a real case? ;-) Spoiler: The solution soon at a TOS near you, believe it or not... RE: Name that calculator - from the program listing... - Massimo Gnerucci - 11-11-2018 08:16 PM (11-11-2018 07:58 PM)Ángel Martin Wrote: Here's a reverse puzzle for the eagle-eyed amongst the audience: What module did you devised this time Ángel? Looks intriguing! RE: Name that calculator - from the program listing... - mfleming - 11-11-2018 08:17 PM HP41! So, a High Level Language module? Which syntax is it modeled on, BASIC or Pascal? Looks similar enough to RPL to make certain members' head explode ~Mark RE: Name that calculator - from the program listing... - JurgenRo - 11-11-2018 08:18 PM (11-11-2018 07:58 PM)Ángel Martin Wrote: Here's a reverse puzzle for the eagle-eyed amongst the audience: It is real for sure and it's the HP41C equipped with the 41CL board and a new amazing module by Ángel :-))) RE: Name that calculator - from the program listing... - Sylvain Cote - 11-12-2018 12:43 AM Another jewel from Ángel the magician! HP-41 of course! I would assume CL is not mandatory for this one, using alpha to hold enter/exit condition is brilliant.
RE: Name that calculator - from the program listing... - Ángel Martin - 11-12-2018 08:00 AM (11-12-2018 12:43 AM)Sylvain Cote Wrote: Another jewel from Ángel the magician! You're all correct - but let's not set up expectations too high though: - These extensions will be released in a forthcoming revision of the Formula_Evaluation Module, revision 1G. - At the heart of the implementation lies the EVAL? function (which actually is a FOCAL routine, if you need to know). Both WHILE and IF perform some housekeeping with the RTN addresses, foreseeing both a TRUE and a FALSE contingency, and then launch EVAL? for a Boolean evaluation of the test condition stated in ALPHA. Depending on the result the RTN addresses are re-arranged so the program flow responds to the desired scheme. - DO/WHILE supports up to three levels of nested calls, but IF.ELSE.ENDIF currently does not. However, it's possible to have and IF.ELSE.ENDIF structure within a DO/WHILE loop; and vice-versa. Here's a couple of examples to whet you appetite (BTW, the mathematicians out there can provide some real-life application to try?) The code below increments the value in Y until reaching 10, which (showing off the most inefficient way to do it) is tested using the value of its decimal LOG. This shows that the test condition can be *anything* supported by EVAL? Code: 01 LBL "YLO10" The next example shows the Fibonacci numbers between 1 and 100: Code: 01 LBL "FIB$" Exciting times in the ASDL, a.k.a "Archeological Software Development Lab ;-) ÁM RE: Name that calculator - from the program listing... - Ángel Martin - 11-12-2018 10:17 AM Here's an example using the IF.ELSE.ENDIF structure to calculate the roots of a second degree equation, a.x^2 + b.x + c = 0 The program is *not* optimized for size; the purpose of the example is to show the strings more clearly in the respective branches. Feel free to improve on it, for instance by calculating the value of the discriminant beforehand and reusing it in the appropriate sections. Code: 01 LBL “QRT” On entry the coefficients a,b,c are expected in (Z, Y, X} respectively. On exit the roots are placed in {Y,X} if real (F4 set), or the Imaginary and real parts of the complex conjugate roots (F4 clear). Example: try it for x^2 = 1, that is a=1, b=0, and c=-1 Result: x1= 1, x2 = -1 and to exercise the complex branch, how about x^2 + x + 1 = 0 resulting Re(z) = -0.5 ; Im(z) = 0.866025404 Cheers, ÁM RE: Name that calculator - from the program listing... - Ángel Martin - 11-12-2018 03:20 PM ok, to put this one to bed - below is the optimized code for the same example. It uses one intermediate calculation for the discriminant, which saves a ton of bytes in the strings: Code: 01 LBL "QRT" ÁM RE: Name that calculator - from the program listing... - derekamos - 11-14-2018 09:59 AM Hi Angel, you have reached LISPyness in profundus. DA RE: Name that calculator - from the program listing... - Eddie W. Shore - 11-14-2018 01:54 PM My guess is the HP 42S. RE: Name that calculator - from the program listing... - Ángel Martin - 11-14-2018 05:38 PM (11-14-2018 09:59 AM)derekamos Wrote: Hi Angel, you have reached LISPyness in profundus. I long time ago I read that LISP stands for "Lots of Insidious Superfluous Parentheses" ;-) RE: Name that calculator - from the program listing... - Ángel Martin - 11-14-2018 05:40 PM (11-14-2018 01:54 PM)Eddie W. Shore Wrote: My guess is the HP 42S. Not quite! - add this to the list of "things the 41 can do that are not possible on the 42" Not such a big deal anyway, the 42 has plenty of other ways to get the task done.... but not this one! RE: Name that calculator - from the program listing... - derekamos - 11-14-2018 11:26 PM Angel wrote: "Lots of Insidious Superfluous Parentheses". Ah, but my angle is the Lisp-ability to write macros for code/functions that don't exist, I.E surpassing the 41's RPN with other needed functions, no need for insidious "((()))" there. DA |