uses
  uIOADDA1,
  Crt;

var
  i : integer;
  IOADDA : pIOADDA1;
  DAdata:array[0..7]of integer;
  c : char;

function prev(W:Word):Word;
begin
  case W of
    0:Prev:=0;
    1:Prev:=64;
    2:Prev:=2048;
    3:Prev:=4095;
  end;
end;

begin
  WriteLn('Test desky IOADDA1 s 6 D/A prevodniky bezi...');
  IOADDA:=New(pIOADDA1,Init($2300{ $300}));
  if IOADDA=nil then RunError(203);

  with IOADDA^ do
  begin
    FillChar(DAdata,SizeOf(DAdata),0);

    repeat

      for i:={0}2 to 7 do
        WriteDA (i,Prev(DAdata[i]));

      if Keypressed then
         begin
         c := ReadKey;
           Case c of
           'a' : DAdata[0] := (DAdata[0] + 1) and 3 ;
           's' : DAdata[1] := (DAdata[1] + 1) and 3 ;
           '1' : DAdata[2] := (DAdata[2] + 1) and 3 ;
           '2' : DAdata[3] := (DAdata[3] + 1) and 3 ;
           '3' : DAdata[4] := (DAdata[4] + 1) and 3 ;
           '4' : DAdata[5] := (DAdata[5] + 1) and 3 ;
           '5' : DAdata[6] := (DAdata[6] + 1) and 3 ;
           '6' : DAdata[7] := (DAdata[7] + 1) and 3 ;

           'z' : DAdata[0] := (DAdata[0] - 1) and 3 ;
           'x' : DAdata[1] := (DAdata[1] - 1) and 3 ;
           'q' : DAdata[2] := (DAdata[2] - 1) and 3 ;
           'w' : DAdata[3] := (DAdata[3] - 1) and 3 ;
           'e' : DAdata[4] := (DAdata[4] - 1) and 3 ;
           'r' : DAdata[5] := (DAdata[5] - 1) and 3 ;
           't' : DAdata[6] := (DAdata[6] - 1) and 3 ;
           'y' : DAdata[7] := (DAdata[7] - 1) and 3 ;
           end;

         end;
{   delay (500);}

     GotoXY(1,1);
     writeln('0:  ',Prev(DAdata[0]),'  +a -z           ');
     writeln('1:  ',Prev(DAdata[1]),'  +s -x           ');
     writeln('2:  ',Prev(DAdata[2]),'  +1 -q           ');
     writeln('3:  ',Prev(DAdata[3]),'  +2 -w           ');
     writeln('4:  ',Prev(DAdata[4]),'  +3 -e           ');
     writeln('5:  ',Prev(DAdata[5]),'  +4 -r           ');
     writeln('6:  ',Prev(DAdata[6]),'  +5 -t           ');
     writeln('7:  ',Prev(DAdata[7]),'  +6 -y           ');

    until false;

  end; {with}

{      i:=ReadAD(0,false,false);
      write(i);
      i:=ReadAD(1,false,false);
      write ('    ',i);
      i:=ReadAD(2,false,false);
      write ('    ',i);
      i:=ReadAD(3,false,false);
      write ('    ',i);
      i:=ReadAD(4,false,false);
      write ('    ',i);
      i:=ReadAD(5,false,false);
      write ('    ',i);
      i:=ReadAD(6,false,false);
      write ('    ',i);
      i:=ReadAD(7,false,false);
      writeln ('    ',i);
      delay (500);
    until false;
  end;}
end.