pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Example 165
INT .EXT ea;
INT .EXT64 e64a;
INT .EXT64 n64a;
INT .EXT na;
e64a ‘:=’ ea FOR 10 words -> @n64a; ! OKAY
e64a ‘:=’ ea FOR 10 words -> @na; ! Error: can’t store an address
! of type EXT64ADDR in a variable of type EXTADDR
Example 166 (page 221) 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.
Example 166 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 167 (page 221) 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 167 MOVE Statement Copying Bracketed and Unbracketed Constants
STRING x[0:8];
x[0] ':=' [0]; ! Copy one byte
x[0] ':=' 0; ! Copy two bytes
Example 168 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
Example 169 MOVE Statement Copying a Substructure
LITERAL copies = 3; ! Number of occurrences
STRUCT .s;
BEGIN
STRUCT s_sub[0:copies - 1]; ! Source substructure
BEGIN
INT a, b;
END;
END;
STRUCT .d (s); ! Destination substructure
! is within structure d
PROC p;
Move 221