HP Forums
SystemRPL using MASD compiler - 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: SystemRPL using MASD compiler (/thread-18422.html)



SystemRPL using MASD compiler - Marc5278 - 05-29-2022 10:40 PM

I have some experience in UserRPL, but I would like to start programming in SystemRPL using the HP50g's compiler (MASD).

I want to start my SystemRPL programming journey by adding two real numbers.

I wrote the following:
Code:

"!NO CODE
!RPL
::
% 1 %+
;
@
"

When I press "ASM" key I receive an error message "asm Error: Invalid file". After I got the error message I press "ER" to understand the error.

After I press the "ER" key I get the message "label expected" and the cursor appears at the % symbol just before the "+" symbol.

Can you give some hints to understand what I am doing wrong?

What is the next step after the program is compiled?

Thank you in advance.


RE: SystemRPL using MASD compiler - Joe Horn - 05-30-2022 03:06 AM

Do you have Flag -92 set correctly? Clear it for assembly mode, and set for System RPL mode.

The AUR puts it this way: "Note: if the Flag –92 is set, MASD starts in !RPL and !NO CODE mode."

Appendix C describes flag -92 this way:
"Assembler Mode.
Clear: Assembler defaults to making code objects.
Set: Assembler defaults to making System-RPL programs."

EDIT: In case the above was unclear, just set flag -92 and omit the leading two lines from your program (Start with :: ). And be sure that the final character is "@", not followed by a carriage return.


RE: SystemRPL using MASD compiler - Gjermund Skailand - 05-30-2022 09:53 AM

Remember
The very last character in the file must be "@"
no trailing spaces, no carriage returns
BR Gjermund


RE: SystemRPL using MASD compiler - DavidM - 05-30-2022 10:22 AM

(05-29-2022 10:40 PM)Marc5278 Wrote:  When I press "ASM" key I receive an error message "asm Error: Invalid file". After I got the error message I press "ER" to understand the error.

After I press the "ER" key I get the message "label expected" and the cursor appears at the % symbol just before the "+" symbol.

That specific error at that spot leads me to believe that you probably don't have an extable installed.

In addition to the other comments, make sure that you have a suitable extable installed. This contains the official one from HP for a rev. 2.15 50g. I keep mine installed in port 2.

Once you've installed the extable, the built-in assembler/compiler (ASM) should be able to compile your code. If it succeeds, you'll get no error messages and simply see the compiled code object left in stack level 1. It should look something like "1. External" (the fraction mark depends on your calculator's settings). That code is now ready to be saved into a global variable or run directly with EVAL.

A word of warning, however: as written, your code assumes that a real (aka "approximate") number already is present in stack level 1 when it executes. If the stack contains any other kind of object (say, an exact number [ZINT]) or is otherwise empty, the calculator will either crash or be left in an unstable state that will inevitably lead to a crash. So be careful how you experiment with that particular program.

There's nothing inherently wrong with the code as written, it simply needs to be used in the proper context. It will function as I believe you intend, but only if the stack is pre-loaded with a real number before execution. I recommend that you use an emulated calculator for your SysRPL coding efforts so that you can safely (and quickly) recover from the inevitable "oops" moments that come up when developing SysRPL code.

Hope this helps!