{ File: [22,311]VRCDTST.PAS      Last edit: 14-APR-1988 17:20:42 
}

Program VRCDTST;


{History:

   Philip Hannay.  14-Apr-88.  Created for testing VRCD.

}

%include ex:[22,320]general3.typ;

%include ex:[22,320]vrcd.ext;
%include ex:[22,320]cr56ta.ext;
%include ex:[22,320]catr56.ext;

Type
  ch516 = packed array [1..516] of char;

Var
 task: ch6;
 rtask: rad56;
 msg1: ch516;  {even boundry buffer}
 fill1: char;
 msg2: ch516;  {odd boundry buffer}
 fill2: char;
 stat, i, len: integer;
 resp: char;
 bufadr: address;
 rrtask: ch4;

Begin
writeln('Begin VRCD test');
writeln;
write('Specify sender task name, CR for "do not care"> ');
readln(task);
rtask[1]:= 0;
rtask[2]:= 0;
if task <> '      ' then catr56(task,rtask);
rrtask:= loophole(ch4, rtask);
for i:=1 to 4 do msg1[i]:= rrtask[i];
for i:=5 to 516 do msg1[i]:= ' ';
msg2:=msg1;
writeln;
write('Enter max msg length in words>');
readln(len);
writeln;
writeln;
bufadr:= loophole(address,ref(msg1));
writeln('Receiving using word aligned buffer, buffer address = ',bufadr:-6);
writeln;
VRCD(bufadr,len);
stat:= $DSW;
writeln;
writeln('Receive done, DSW = ',stat:1);
writeln;
if stat > 2
  then begin
    {write out message received}
    for i:=1 to 4 do rrtask[i]:= msg1[i];
    rtask:= loophole(rad56, rrtask);
    cr56ta(rtask,task);
    len:= (stat-2)*2;
    writeln('Sending task was "',task,'", message length is ', len:1);
    write('Message was "');
    for i:= 5 to len+4 do write(msg1[i]);
    writeln('"');
    writeln;
    end;
bufadr:= loophole(address,ref(msg2));
writeln('Receiving using non-word aligned message, buffer address = ',
   bufadr:-6);
writeln;
VRCD(bufadr,len);
stat:= $DSW;
writeln;
writeln('Receive done, DSW = ',stat:1);
writeln;
writeln('Done with test');
end.
