TAL Programmer's Guide

Using Extended Data Segments
Managing Addressing
B–12 096254 Tandem Computers Incorporated
Example B-1. D-Series Extended Segment Allocation
?INSPECT, SYMBOLS
?SOURCE $SYSTEM.SYSTEM.EXTDECS0 (
? SEGMENT_ALLOCATE_, SEGMENT_USE_)
PROC alloc_xsegment MAIN;
BEGIN
DEFINE error = ! ...! #; !Error handling routine
INT .EXT px; !Extended pointer for base
! address of extended segment
INT s;
!Lots of code
s := SEGMENT_ALLOCATE_ (0, 4096D, , , , , px);
!Allocate extended segment 0;
! assign status value to S;
! request 2 pages of extended
! memory; obtain base address
IF s <> 0 THEN error; !Continue if segment 0 is
!allocated; else return error
s := SEGMENT_USE_ (0, , px); !Make segment 0 the current
! extended segment
IF s <> 0 THEN error; !Continue if segment 0 is
!current; else return error
px := 5; !Assign 5 to first word of
! segment 0
s := SEGMENT_ALLOCATE_ (1, 4096D, , , , , px);
!Allocate extended segment 1;
! assign status value to S;
! request 2 pages of extended
! memory; obtain base address
IF s <> 0 THEN error; !Continue if segment 1 is
!allocated; else return error
s := SEGMENT_USE_ (1, , px); !Make segment 1 the current
! extended segment
IF s <> 0 THEN error; !Continue if segment 1 is
! current; else return error
px := 2; !Assign 2 to first word of
! segment 1
!Lots more code
END;