TAL Programmer's Guide
Using Simple Pointers
Using Pointers
096254 Tandem Computers Incorporated 9–5
Extended Pointers
You can initialize global extended pointers with extended addresses converted from
standard addresses by the $DBL, $UDBL, and $DBLL standard functions. These
functions compute the initialized value if their arguments are constant expressions or
expressions that follow the rules applied to standard global pointers. Here is an
example of the $UDBL function:
INT a[0:2];
INT .EXT ptr := $UDBL(@a[0] '<<' 1);
In the preceding example, the word address returned by $UDBL must be converted to
a byte address by shifting it left by one bit, because extended addresses are always
byte addresses.
Pointers in BLOCK Declarations
A data declaration and any declaration that refers to that declaration must appear in
the same BLOCK declaration. For example, the following data declarations must
appear in the same BLOCK declaration:
BLOCK my_globals; !BLOCK declaration
STRING .EXT array[0:5];
STRING .EXT ptr_a := @array[0];
END BLOCK; !End BLOCK declaration
Initializing Local or
Sublocal Simple Pointers
At the local or sublocal level, you can initialize simple pointers with any arithmetic
expression, including those shown previously for global pointers. In other words, you
can use initialization expressions that contain variables, constants, and LITERALs.
You can initialize a local or sublocal standard simple pointer with the content of an
array element:
INT array[0:1] := [%100000, %110000]; !Declare ARRAY
INT .int_ptr1 := array[0]; !Declare INT_PTR1; initialize
! it with %100000
INT .int_ptr2 := array[1]; !Declare INT_PTR2; initialize
! it with %110000
You can initialize a local or sublocal standard simple pointer with the address of a
structure item:
STRUCT .x; !Declare structure
BEGIN
INT i;
END;
INT .ip := @x.i; !Declare IP; initialize it
! with address of structure
! item