Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 38
Checking Address Limits of an Extended Data
Segment
If the MOVEX call was successful, then the call returns an error value of 0. Any other
value indicates an error. Typical causes of error are a nonexistent data segment
(error 2) or an out-of-bounds address (error 22).
The following example uses assignment statements to perform a similar move between
flat segments:
INT(32) BASE^ADDR1;
INT(32) BASE^ADDR2;
INT(32) .EXT SOURCE^PTR;
INT(32) .EXT TARGET^PTR;
OPTIONS.<14> := 1; !SET OPTION BIT FOR FLAT SEGMENT!
FOR I := 0 TO 9 DO
BEGIN
SEGID[I] := I;
SIZE := 8000D;
ERROR := SEGMENT_ALLOCATE_(SEGID[I],
SIZE,
!swap^file:length!,
ERROR^DETAIL,
!pin!,
!segment^type!,
BASE^ADDRESS[I],
!max^size!,
OPTIONS);
IF ERROR <> 0 THEN CALL ERROR^HANDLER;
END;
.
.
@SOURCE^PTR := BASE^ADDR1;
@TARGET^PTR := BASE^ADDR2;
TARGET^PTR ":=" SOURCE^PTR FOR 512 BYTES;
Checking Address Limits of an Extended Data Segment
You can use the ADDRESS_DELIMIT_ procedure to obtain the addresses of the first
and last bytes of a particular area of your logical address space such as a flat segment
or a current selectable segment.
You supply an address contained within the address area of interest, passing it to
ADDRESS_DELIMIT_ in the value parameter address. You can use the
segment-id output parameter to obtain the segment ID of the area if it is an extended
data segment. You can also use the address-descriptor output parameter to
obtain a set of flags that describe the area.
In the following example, an address contained in an extended data segment is passed
to ADDRESS_DELIMIT_. The procedure returns the address of the last byte of the
segment and also the segment ID.
INT .EXT MY^EXT^DATA[0:99];
INT(32) HIGH^ADDR;
INT ERROR,
ERROR^DETAIL,
SEGMENT^ID;