TAL Programmer's Guide

Using Simple Pointers
Using Pointers
9–4 096254 Tandem Computers Incorporated
The following table shows the kinds of global variables to which you can apply the @
operator:
Variable @identifier?
Direct array Yes
Standard indirect array Yes
Extended indirect array No
Direct structure Yes
Standard indirect structure Yes
Extended indirect structure No
Simple pointer No
Structure pointer No
For example, you can initialize a global standard simple pointer with the address of an
array element:
STRING .array[0:3]; !Declare ARRAY
STRING .string_ptr := @array[3];
!Declare STRING_PTR; initialize
! it with address of ARRAY[3]
You can use a STRING simple pointer for byte access to a word-addressed array. To
convert the word address to a byte address, use a left-shift operation ('<<' 1):
INT .word_array[0:39]; !Declare WORD_ARRAY
STRING .byte_ptr := @word_array[0] '<<' 1;
!Declare BYTE_PTR; initialize
! it with converted byte
! address of WORD_ARRAY
You can use an INT simple pointer for word access to a byte-addressed array. To
convert the byte address to a word address when you initialize the pointer, use a right-
shift operation ('>>' 1). (Only even byte addresses can be converted to correct word
addresses):
STRING .byte_array[0:4]; !Declare BYTE_ARRAY
INT .word_ptr := @byte_array[0] '>>' 1;
!Declare WORD_PTR; initialize
! it with converted word
! address of BYTE_ARRAY