pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
NOTE:
1. In assignment statements, only INT constants are allowed. They are interpreted as a ‘G’-relative
byte address.
2. In assignment statements, only INT constants are allowed. They are interpreted as a ‘G’-relative
word address.
3. Input INT interpreted as ‘SG’-relative byte address.
4. Input INT interpreted as ‘SG’-relative word address.
5. Output INT holds ‘SG’-relative byte address.
6. Output INT holds ‘SG’-relative word address.
7. Compiler assumes object is in lower half of the stack or in the lower half of the ‘SG’ segment
(TNS only); there is no dynamic check for msb=0.
8. The result is undefined if lsb=1; the round-down effect of TNS is not guaranteed. pTAL issues
a warning if the BADDR or SGBADDR address is known to be an odd-byte offset from some
word-addressed base. No warning is issued if pTAL cannot determine whether the offset is
odd or even.
9. Conversions between CWADDR and CBADDR are unsupported and illegal, because these
conversions are probably unneeded, and because it is difficult to ensure that a word-addressed
‘P’-relative structure is in the byte-addressable lower half of a TNS code segment.
10. PROCPTR, PROC32PTR, and PROC64PTR variables and addresses of procedures are implicitly
of type PROCADDR, PROC32ADDR, and PROC64ADDR, respectively, but are subject to
matching of parameter profiles and procedure attributes. See “Assignments to Procedure
Pointers” (page 269). Implicit conversions from PROC32ADDR to PROCADDR, PROC32ADDR
to PROC64ADDR, and PROCADDR to PROC64ADDR are also allowed (again subject to the
parameter and attribute matching rules, described in the section noted directly above).
11. $XADR of a CWADDR and CBADDR yields an EXTADDR.
12. In assignment statements, only FIXED(0) constants are allowed. They are interpreted as a byte
address.
13. $FIX of an EXT64ADDR yields a FIXED(0).
Using Indexes to Access Array Elements
Indexing produces the correct result for all data types including structures. Use indexing wherever
possible to adjust pointers.
Example 6 Using Indexing to Access an Array Element
int .p;
@p := @p[2] ! This statement is equivalent to
@p := @p '+' 4; ! this statement
Incrementing and Decrementing Addresses (Stepping Pointers)
You can increment or decrement the value of a pointer (step a pointer) by:
• Using Arithmetic Operations to Adjust Addresses (page 55)
• Computing the Number of Bytes Between Addresses (page 55)
• Comparing Addresses to Addresses (page 56)
• Comparing Addresses to Constants (page 56)
• Comparing Procedure Addresses and Procedure Pointers (page 56)
• Testing a Pointer for a Nonzero Value (page 56)
54 Data Representation