TAL Reference Manual

Statements
TAL Reference Manual526371-001
12-30
Examples of MOVE Statements
Variables (including structure data items) are byte addressed or word addressed as
follows:
If the move contains more than one
source and one of the sources causes an
extended move sequence, the compiler emits an extended move sequence for all the
sources. The compiler generates the extended address of each variable, generates a
byte count corresponding to
count, and emits a MVBX instruction for the move
statement.
After an element move,
next-addr might point into the middle of an element, rather than
at the beginning of the element. If
destination is word addressed and source is byte
addressed and you copy an odd number of bytes,
next-addr will not point to an
element boundary.
Examples of MOVE Statements
1. This example copies spaces into the first five elements of an array, and then uses
next-addr as destination to copy dashes into the next five elements:
LITERAL len = 10; !Length of array
LITERAL num = 5; !Number of elements
STRING .array[0:len - 1]; !Destination array
STRING .next_addr; !Next address simple pointer
array[0] ':=' num * [" "] -> @next_addr;
!Do first copy and capture next-addr
next_addr ':=' num * ["-"];
!Use next-addr as start of second copy
2. This example contrasts copying a bracketed constant versus copying an
unbracketed constant. A bracketed constant copies a single byte regardless of the
size of the constant. An unbracketed constant copies words, doublewords, or
quadruplewords depending on the size of the constant:
STRING x[0:8]; !Declare STRING array X
x[0] ':=' [0]; !Copy one byte
x[0] ':=' 0; !Copy two bytes
Byte addressed STRING simple variables
STRING arrays
Variables to which STRING simple pointers point
Variables to which STRING structure pointers point
Substructures
Word addressed INT, INT(32), FIXED, REAL(32), or REAL(64) simple variables
INT, INT(32), FIXED, REAL(32), or REAL(64) arrays
Variables to which INT, INT(32), FIXED, REAL(32), or
REAL(64) simple
pointers point
Variables to which INT structure pointers point
Structures