pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-12
Pointers and Addresses
You can declare variables whose data type is an address type. Such a variable can be
used to hold an initial or temporary address or as a formal procedure parameter for
which the actual parameter is an address.
The address type of a STRING variable in the user data segment is BADDR, which is
why Example 2-7 on page 2-12 works.
STRING .SG sgb; STRING System
Global
Segment
SGBADDR byte 16 bits
INT .SGX sgw; INT System
Global
Segment
SGXWADDR 16-bit word 16/32
bits
STRING .SGX sgb; STRING System
Global
Segment
SGXBADDR byte 16/32
bits
INT i=‘P’:= 3 INT User Code
Segment
CWADDR 16-bit word 16/32
bits
STRING s=‘P’:= "a" STRING User Code
Segment
CBADDR byte 16/32
bits
PROCPTR p;
END PROCPTR
PROCPTR User Code
Segment
PROCADDR NA 16/32
bits
Example 2-7. Exchanging Contents of STRING Pointers
BADDR temp;
STRING .a;
STRING .b;
! Swap the addresses in A and B
temp := @a;
@a := @b;
@b := temp;
Table 2-1. pTAL Address Types (page2of2)
Example Pointer or
Declaration
Object
Data Type
Data
Location
Address
Type Granularity Width
1
1. The notation “16/32 bits” means 16 bits on TNS architecture, 32 bits on native architecture.
2. On TNS architecture, extended pointers (pointers declared using .EXT notation) contain 32 bits and can
reference data in any segment including code segments and the user data segment. On native architecture,
extended pointers also contain 32 bits but using them to reference segments other than extended data segments
is more restricted.
3. Extended addresses must reference data on even-byte boundaries, except STRING data, which can be
referenced on either an even-byte or an odd-byte boundary.