TAL Programmer's Guide
Using Extended Data Segments
Managing Addressing
096254 Tandem Computers Incorporated B–23
Example B-4. C-Series Extended Addressing Program
(Page 2 of 3)
PROC ext_addr_example MAIN;
BEGIN
status := ALLOCATESEGMENT (seg_id_zero, seg_id_zero_len);
IF status <> 0 THEN CALL DEBUG;
status := ALLOCATESEGMENT (seg_id_two, seg_id_two_len);
IF status <> 0 THEN CALL DEBUG;
CALL USESEGMENT (seg_id_zero);
IF <> THEN CALL DEBUG;
@byte_ptr := %2000000D; !Set extended pointer to
! first byte of current
! extended segment
byte_ptr ':='
"This is a sample string to be scanned for an X.";
!Put character string into
! current extended segment
byte_array ':=' byte_ptr FOR str_len BYTES;
!Extended move of string
! to user stack
byte_array[-1] := 0; !Delimit the scan area
byte_array[100] := 0; ! with zeros
SCAN byte_array[0] UNTIL "X" -> @offset_ptr;
IF $CARRY THEN CALL DEBUG;
!Scan on stack; if scan
! stopped by 0, call debugger
offset_x := @offset_ptr '-' @byte_array[0];