System RPL mode

MASD can also compile System RPL programs (you should read the book “An Introduction to System RPL” before trying to write System RPL programs).

The !RPL directive will switch MASD in RPL mode.

Note: if the Flag –92 is set, MASD starts in !RPL and !NO CODE mode.

Instructions

In RPL mode, MASD interprets instructions/tokens in the following order.

Reals and system binary

If the instruction is a decimal number, a system binary is created (MASD will try, if possible, to use the internally defined system binary). If that number has a decimal point (in the middle, or starts with the decimal point), a real number is created.

Unnamed local variables

If the instruction is a recall or a set of a local variables defined by {{ the correct instruction is generated. A local environment is created using:

{{ var1 var2 ... varN }}

with N<23

These variables have names during compile time, but they are implemented as unnamed local variables, which are faster to access than named local variables.

A local variable is recalled by typing its name or with an optional ending @. Data can be stored in a local variable by typing its name, with a leading or ending ! or a leading =.

Notes:

1.Local variables are available until the next local definition.

2.The local environment is not closed automatically; use ABND or other provided words.

Example:

{{ label1 label2 … labelN }} will become:

'NULLLAM <#N> NDUPN DOBIND (or 1LAMBIND if there is only one variable) And:

label1 1GETLAM label1@ 1GETLAM =label1 1PUTLAM !label1 1PUTLAM label1! 1PUTLAM

Program example:

::

{{A B }} B A!

ABND

;

::

'NULLLAM TWO NDUPN DOBIND 2GETLAM 1PUTLAM

ABND

;

Note that it is your responsibility to destroy the local environment using ABND and that MASD does not handle multiple level of definition of local variables, nor does it destroy the current environment, even if ABND is used.

Variables defined this way will be valid until a new set of variables is defined.

The Development Library 635

Page 533
Image 533
HP 48gII Graphing, 50g Graphing manual System RPL mode, Instructions, Reals and system binary, Unnamed local variables