Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 37
Moving Data Between Extended Data Segments
To check for completion of a nowait operation on an extended data segment, use the
AWAITIOX procedure.
Moving Data Between Extended Data Segments
The method to use for transferring data between two extended data segments
depends on whether the segments are selectable segments or flat segments.
To move data between flat segments, or between a flat segment and the current
selectable segment, no special procedure call is needed; you can use normal
assignment or move statements. To move data between segments where at least one
of the segments is a not-current selectable segment, use the MOVEX procedure.
(When using the MOVEX procedure, it does not matter whether either the source or
target selectable segment is currently in use.)
Note, however, that MOVEX is a time-consuming procedure, and you should therefore
avoid using it wherever possible.
When calling the MOVEX procedure, you must specify where you want to move data
from, where you want to move data to, and how much data you want to move. You
specify the source and target addresses of the move by indicating the segment ID and
the starting address. You specify the amount of data you want to move as a number of
bytes.
The following example allocates four selectable segments and moves 512 bytes from
the beginning of segment 0 to the beginning of segment 1:
FOR I := 0 TO 3 DO
BEGIN
SEGID[I] := I;
SIZE := 100000D;
ERROR := SEGMENT_ALLOCATE_(SEGID[I],
SIZE,
!swap^file:length!,
ERROR^DETAIL,
!pin!,
!segment^type!,
BASE^ADDRESS[I]);
IF ERROR <> 0 THEN CALL ERROR^HANDLER;
END;
.
.
BYTE^COUNT :=512D;
SOURCE^SEGMENT^ID := 0;
TARGET^SEGMENT^ID := 1;
@SOURCE^PTR := BASE^ADDRESS[0];
@TARGET^PTR := BASE^ADDRESS[1];
ERROR := MOVEX(SOURCE^SEGMENT^ID,
SOURCE^PTR,
TARGET^SEGMENT^ID,
TARGET^PTR,
BYTE^COUNT);