pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-12
Determining Address Types
Data in the User Data Segment (BADDR and WADDR
Address Types)
The address type of pointers declared without .EXT to data in the user data segment is
WADDR, except for STRING pointers, for which the address type is BADDR:
INT a; ! Variable with address type WADDR
INT .b; ! Pointer with address type WADDR
STRING .c; ! Pointer with address type BADDR
INT(32) d[0:9]; ! Direct array with address type WADDR
INT .e[0:9]; ! Indirect array with address type WADDR
Data in System Globals (SGBADDR, SGWADDR,
SGXBADDR, and SGXWADDR Address Types)
The address type of pointers to system globals is one of SGBADDR, SGWADDR,
SGXBADDR, or SGXWADDR. pTAL provides two ways to declare pointers to data in
system globals, as follows:
You can declare pointers using .SG notation as in TAL:
INT .SG i; ! Pointer is in user data segment,
! data is in system globals
You can declare pointers using .SGX notation:
INT .SGX i; ! Pointer is in user data segment,
! data is in system globals
TAL and pTAL allocate 16 bits for pointers you declare with .SG notation. For pointers
you declare with .SGX notation, pTAL allocates 32 bits, but TAL allocates 16 bits:
STRING .SG s; ! s is 16 bits on TNS and native architectures
INT .SG i; ! i is 16 bits on TNS and native architectures
STRING .SGX s; ! s is 16 bits on TNS architecture,
! 32 bits on native architecture
INT .SGX i; ! i is 16 bits on TNS architecture
! 32 bits on native architecture
If you share source files that include pointers to system globals, some of which have
not been converted to pTAL, continue to use .SG pointers. If all source files that use a
shared declaration have been converted to pTAL, you can convert .SG pointers to
.SGX pointers, although all programs must be recompiled at the same time.