pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-8
pTAL
Figure 10-2 on page 10-9 and Figure 10-3 on page 10-9 illustrate the difference
between pointer allocation on TNS and native architectures.
The source code in Figure 10-2
on page 10-9 declares and initializes a pointer, p, and
assigns data to the memory location to which p points. The drawing below the source
code shows the result of the declaration and assignment if you run your program as a
TNS process:
p contains the 16-bit address of the data: %H8000. You can store any 16-bit
integer in p. The data type of this location is (implicitly) INT. The address, %H8000,
is a byte offset in the user data segment.
The location at byte-offset %H8000 contains the 8-bit value 255. The data type of
this storage location is STRING.
Table 10-2. Address Types
Data Type
Address
Type Target Data*
Pointer Size
ExampleTNS Native
BADDR byte 8-bit bytes in the
user data segment
16 32 STRING .s;
WADDR word 16-bit words in the
user data segment
16 32 INT .i;
CBADDR byte 8-bit bytes in a user
code segment
16 32 STRING s=‘P’:="A";
CWADDR word 16-bit words in a
user code segment
16 32 INT i=’P’:=123;
SGBADDR byte 8-bit bytes in
system globals
16 16 STRING .SG s;
SGWADDR word 16-bit words in
system globals
16 16 INT .SG i;
SGXBADDR byte 8-bit bytes in
system globals
16 32 STRING .SGX s;
SGXWADDR word 16-bit words in
system globals
16 32 INT .SGX i;
EXTADDR byte Data in an
extended segment*
32 32 INT .EXT x;
PROCADDR n/a Index of a
procedure in the
PEP table
16 32 PROC x;
BEGIN
END;
* In pTAL, as in TAL, you can address data in the 64K-word user data segment using an extended pointer instead
of a standard pointer. Extended addresses are 32 bits in TAL and pTAL.