<< Click to Display Table of Contents >> Navigation: 3. Script Language > Stack-Operations > Stack Commands |
MiniRobotLanguage (MRL)
STV. Command
STack from/to Variable
Intention
STV. saves the whole actual stack into a variable or restores the whole stack from a variable. You can also use this command to change the maximum number of stack elements.
This will not only get the Top-Element from the stack, but will save the complete stack into the variable in a binary format.
This will only be useful to restore the stack later from the variable.
Syntax
STV. P1|P2
Parameter Explanation
P1
- TXT or VAR
P2
- VAR
The following Stack-Commands can be given as Parameter and will be executed one after the other:
TOVAR - Transfers the complete Stack into a variable.
TOVCLEAR - like TOVA, but also clears the stack.
FROM - restores a stack from Variable VAR.
SWAP - Exchange given Element and TOS
DUPLICATE - Duplicate given Element
REMOVE - Remove given Element
SIZE - change the maximum stack size (limited only by Memory)
You can write the first four letters or use the full word.
Example
DBM.2
: $$A00=1
VAR.$$B00=Stackplace 2
JMP. over
STS.GLOB
PUV.$$B00
STS.DUMP
' Following command copies the Global stack into $$AAA
STV.TOVA|$$AAA
STS.DUMP|CLEA|DUMP
STV.FROM|$$AAA
STS.DUMP
:over
STS.LOCA|DUMP
PUV.$$B00
STS.DUMP
' Following command copies the Local stack into $$AAA
STV.TOVA|$$AAA
STS.DUMP
STS.CLEA|DUMP
STV.FROM|$$AAA
STS.DUMP
DMP.
END.
Remarks
When using FROM, please note that stack-content is been completely replaced by the content in VAR When using TOVC the stack content is been cleared while there is a copy in VAR.
Limitations:
See also:
• PUS. - Push Parameter onto Stack/Que
• PUV. PUsh variables on the User-Stack
• POP. - POP Variable from Stack
• POV. - POp Variables from User-Stack