pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

identifier
is the identifier of the pointer.
REFALIGNED
Specifies the alignment of the variables or structures that identifier references.
2
specifies that the variables and structures identifier references are aligned as they would
be aligned in TAL (and might not be well aligned in pTAL).
8
specifies that the variables and structures are well aligned for use in pTAL.
For nonstructure pointers, the default for REFALIGNED is the value you specify in the
REFALIGNED (page 410).
initialization
is an expression representing a memory address. For more information about operations on
addresses, see Chapter 5 (page 69).
Declaring VOLATILE Pointers
Declare pointers VOLATILE if they can be accessed asynchronously by other processes such as
another process in your application or an I/O driver.
Topics:
Simple (page 163)
Structure (page 164)
Simple
When you declare a VOLATILE simple pointer, the value of the pointer and the data referenced
by the pointer are treated as VOLATILE and are maintained in memory, not in a register. Each
reference to a VOLATILE data item causes the data item to be read or written to memory even
when code is optimized. Based on the order of reads and writes in the source code, VOLATILE
also causes that precise order of memory references to be preserved, again, when code is optimized.
Example 101 Declaring VOLATILE Simple Pointers
INT i;
INT a;
INT b[0:9];
VOLATILE INT .p1 := @a;
VOLATILE INT .p2 := @b;
i := p1; ! pTAL treats pointer p1 and data p1 references,
! a, as volatile. Program reads value of pointer
! p1 each time statement executes
i := a; ! pTAL does not treat direct reference to a as
! volatile even though p1 still points to it,
! because a is not declared volatile
i := p2[a]; ! For each reference to p2[a], program:
! * Reads value of pointer p2 from memory
! * Adds value of a, which can be kept in a
! register because a is not volatile
! * Reads from memory the value referenced by
! p2[a]
i := p2[p1]; ! Data referenced by p2[p1] is the same as p2[a]
! in the preceding example, but both p1 and p2
Declaring VOLATILE Pointers 163