This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
Next revision
|
Previous revision
Last revision
Both sides next revision
|
manual:chapter5:asm [2019/12/04 15:36] claudio [Example code] |
manual:chapter5:asm [2021/09/29 01:40] jojo1973 [Assembly-like Instruction Set] |
In these cases a compact subset of instructions, with a different syntax and based on the manipulation of a small number of global registers, may achieve greater clarity; this subset of the language, given its compact format, is called **Assembly-like Instruction Set**. | In these cases a compact subset of instructions, with a different syntax and based on the manipulation of a small number of global registers, may achieve greater clarity; this subset of the language, given its compact format, is called **Assembly-like Instruction Set**. |
| |
The Assembly-like Instruction Set is not meant as a separate programming language neither its feature are intended to be sandboxed in exclusive environments: its statements can be freely intermingled with **newRPL** commands and to suit anyone's programming style. | The Assembly-like Instruction Set is not meant as a separate programming language neither its features are intended to be sandboxed in exclusive environments: its statements can be freely intermingled with **newRPL** commands to suit anyone's programming style. |
| |
==== Registers and pseudo-registers ==== | ==== Registers and pseudo-registers ==== |
| '':A=S2'' '':S2=S1'' '':S1=A'' | Swap stack level 1 with level 2 using register ''A'' as temporary storage. An error is raised if the stack contains less than 2 levels | | | '':A=S2'' '':S2=S1'' '':S1=A'' | Swap stack level 1 with level 2 using register ''A'' as temporary storage. An error is raised if the stack contains less than 2 levels | |
| '':C+=B^#2'' | Square the value register ''B'' and adds the result to register ''C'' | | | '':C+=B^#2'' | Square the value register ''B'' and adds the result to register ''C'' | |
| | '':B=R^#2 π'' | Assign ''%%'%%π^2%%'%%'' to register B. This example shows that register ''R'' must not necessarily be the second argument of a binary operator | |
| |
==== Assignment with math functions ==== | ==== Assignment with math functions ==== |