pTAL Conversion Guide
Pointers
pTAL Conversion Guide—527302-002
10-43
Alternatives to Using Address Constants in Native
Processes
pTAL
In native processes, using absolute addresses, as in the previous example, is not 
meaningful because native processes do not have a user data segment. If you attempt 
to use a pointer that has been initialized with a value such as %100000, your program 
will abort when it attempts to use the pointer, as in the following statement:
p := 3;
For native processes, you must recode pointer initializations so that the pointers point 
to existing memory areas. You can do this by allocating a global array, for example, 
which holds the same data as you store in the upper 32K words of the user data 
segment for TNS processes.
Specifically, in native processes you must:
•
Change the declaration of MEM_PTR from an INT to a WADDR.
•
Change the address increments from signed operators to unsigned operators.
•
Allocate a global array, which you use to simulate the upper half of the user data 
segment. You use the base of the array to correspond to the location %100000 in 
the user data segment of TNS processes.
You use conditional compilation directives to include different statements and 
declarations when you create native object code with pTAL than when you create TNS 
object code with TAL. In general, you need to change only the declarations and 
initializations of pointers including, however, all locations in your programs that assign 
an address constant to a pointer.
Example 10-20 on page 10-43 shows how Example 10-19 on page 10-42 looks after 
making the recommended changes for pTAL and native mode.
@area_2 := mem_ptr; ! Pointer to 2nd memory area
mem_ptr := mem_ptr + 2048; ! Allocate space for area_2
IF mem_ptr '>' mem_limit THEN CALL error_abort;
@area_3 := mem_ptr; ! Pointer to 3rd memory area
mem_ptr := mem_ptr + 4096; ! Allocate space for area_3
IF mem_ptr '>' mem_limit THEN CALL error_abort;
Example 10-20. pTAL Space Allocation (page1of2)
INT .area_1, .area_2, .area_3; ! Pointers to memory areas
WADDR mem_ptr, mem_limit;
?IF PTAL
INT(32) .upper32k [0:16383];
?ENDIF
...
Example 10-19. TAL Space Allocation (page 2 of 2)










