pTAL Reference Manual (H06.03+)
Statements
HP pTAL Reference Manual—523746-005
12-31
Move
Example 12-27 on page 12-31 contrasts copying a bracketed constant with 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.
Example 12-26. MOVE Statement Copying to an Array
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
Example 12-27. MOVE Statement Copying Bracketed and Unbracketed
Constants
STRING x[0:8];
x[0] ':=' [0]; ! Copy one byte
x[0] ':=' 0; ! Copy two bytes
Example 12-28. MOVE Statement Copying From One Structure to Another
LITERAL copies = 3; ! Number of occurrences
STRUCT .s[0:copies - 1]; ! Source structure
BEGIN
INT a, b, c;
END;
STRUCT .d (s) [0:copies - 1]; ! Destination structure
PROC p;
BEGIN
d ':=' s FOR copies ELEMENTS; ! Word move of three
END; ! structure occurrences










