pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-9
Determining Address Types
Figure 10-3 on page 10-9 is the same as Figure 10-2 on page 10-9 except that pTAL
compiles the source code to run as a native process.
p contains %H00008000%D, the 32-bit address of the data
The address type of p is BADDR
The source code in Figure 10-2 on page 10-9 and Figure 10-3 on page 10-9 is
identical.
Determining Address Types
You cannot explicitly declare or change the address type of a pointer. The native
compilers determine the address type based on the pointer declaration.
Every identifier you declare in a pTAL program has an object data type and an address
type. Table 10-3 on page 10-10 shows the address type for all pTAL constructs except
simple variables. The address type of a simple variable is the same as the address
type of a pointer to data of the same object data type as the simple variable, as in the
following example:
INT .j; ! Pointer with address type WADDR
INT i; ! Simple variable with address type WADDR
Figure 10-2. Pointer Declaration and Memory Allocation in TAL
STRING .p := %H8000; ! Store initial address in p
p := 255; ! Store 255 at byte offset %H8000
Figure 10-3. Pointer Declaration and Memory Allocation in pTAL
STRING .p := %H8000; ! Store initial address in p
p := 255; ! Store 255 at byte offset %H8000
Feature
Architecture
TNS Native
Width of P 16 bits 32 bits
Address type of P INT BADDR
%h8000
255
data type: STRING
p:
%h8000
data type: INT
VST002.vsd
%h00008000
255
data type: STRING
p:
%h00008000
data type: BAADDR
VST027.vsd