pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-42
Alternatives to Using Address Constants in Native
Processes
TAL programs can store the number 3 in the first word of the upper 32K words of the
user data segment by storing the address %100000 in a pointer and using the pointer
in a statement, as in the following code:
INT .p;
@p := %100000;
p := 3;
Example 10-19 on page 10-42 shows how some TAL programs might allocate space
for consecutive 1K-word, 2K-word, and 4K-word buffers in the upper half of the user
data segment:
Figure 10-7. User Data Segment on TNS Architecture
Example 10-19. TAL Space Allocation (page 1 of 2)
?SOURCE EXTDECS(LASTADDR)
INT .area_1, .area_2, .area_3; ! Pointers to memory areas
INT mem_ptr;
mem_ptr := %100000; ! Address of beginning of
! upper 32K words
mem_limit := LASTADDR;
@area_1 := mem_ptr; ! Pointer to 1st memory area
mem_ptr := mem_ptr + 1024; ! Allocate space for area_1
IF mem_ptr '>' mem_limit THEN CALL error_abort;
Upper
32K
Words
Lower
32K
Words
%177777
%100000
'G'+0
TNS segment limit
TNS stack limit
TNS stack area
Primary global variables
Secondary global variables
VST035.vsd