TAL Reference Manual

Statements
TAL Reference Manual526371-001
12-38
Examples of STORE Statements
Modularize any use of STORE statements as much as possible; they are not portable
to future software platforms.
Examples of STORE Statements
1. This example stores the content of the register stack starting at the current setting
of the RP into variables of various data types:
LITERAL len = 100;
STRING .byte[0:len - 1];
INT word;
INT(32) twowords;
STORE twowords, word, byte[3];
2. This example loads the values from two variables onto the register stack, and then
stores them back into the same variables:
STACK x, y;
!Some code here
STORE y, x;
3. This example shows two versions of a swap operation:
INT temp;
INT x;
INT y;
temp := x;
x := y; !Version 1 needs five memory references
y := temp; ! if you use OPTIMIZE 2
STACK x,y; !Version 2 needs four memory references,
STORE x,y; !uses the register stack, and is faster
! on TNS systems
USE Statement
The USE statement optimizes repetitive references to localized expressions or iteration
variables. It associates an identifier with an index register and reserves the register for
your use.
identifier
is an identifier to associate with an index register.
identifierUSE
,
VST1222.vsd