program wavetransition;

uses crush13h,crt;

var c:char;
    x,y:integer;
    count1,add1:integer;

begin
     video_mode ( $13);
     initvirt;

     loadpcx ('wave.pcx',vp[2]);

     count1:=0;
     add1:=1;

     repeat

      count1:=count1+add1;
      if count1>255 then add1:=-1;
      if count1<0 then add1:=1;

      for x:=0 to 319 do for y:=0 to 199 do
       if mem[vp[2]:x+y*320]<count1
        then mem[vga:x+y*320]:=0
         else mem[vga:x+y*320]:=255;


      if keypressed=true then c:=readkey;
     until c=#27;

     closevirt;
     video_mode ( 03);
end.