program picbob;

uses crush13h,crt;

var c:char;
    a,x,y:integer;
    count:integer;

procedure copypage_l(y1:integer;from:word;y2:integer;too:word);
var a:integer;
begin
     for a:=y2 to y2+200 do
         begin
              if a>-1 then if a<200 then move(mem[from:320*(a-y2)],mem[too:320*a],320);
         end;
end;

procedure interlace(from1,from2:word;y2:integer;too:word);
var a:integer;
begin
     for a:=y2 to y2+200 do
         begin
              if a>-1 then if a<200 then
               if a mod 2 = 0 then move(mem[from1:320*(a-y2)],mem[too:320*a],320)
               else move(mem[from2:320*(a-y2)],mem[too:320*a],320);
         end;
end;

procedure interlace_2(from:word;y2:integer;too:word);
var a:integer;
begin
     for a:=y2 to y2+200 do
         begin
              if a>-1 then if a<200 then
               if a mod 2 = 0 then move(mem[from:320*(a-y2)],mem[too:320*a],320);
         end;
end;

procedure interlace_3(from:word;y2:integer;too:word);
var a:integer;
begin
     for a:=y2 to y2+200 do
         begin
              if a>-1 then if a<200 then
               if a mod 2 <> 0 then move(mem[from:320*(a-y2)],mem[too:320*a],320);
         end;
end;

Procedure copypage_bob(from,Where:Word);
const minx=0;
      maxx=319;
      miny=0;
      maxy=199;
Var Dx,Dy:Word;
    A,B:integer;
    Segm,Offs:Word;
    c1,c2,c3:integer;
Begin

     for y:=0 to 199 do begin
     for x:=0 to 319 do begin

     c1:=getpixel(x,y,from);
     c2:=getpixel(x,y,where);
     c3:=c2+c1;

     if c3>255 then c3:=255;
     if c3<0 then c3:=0;
     PutPixel(x,y,c3,Where);
     end;
     end;

End;

begin
     video_mode ( $13);
     initvirt;

     cls (0,vp[1]);
     cls (0,vp[2]);
     loadpcx ('c:\ps\neopaint\pcx\claw3.pcx',vp[1]);

     loadpcx ('c:\ps\neopaint\pcx\moia95_2.pcx',vp[2]);
     count:=0;

     repeat

     count:=count+1;
     if count>64000 then count:=0;

     waitvbl;

     cls(0,vga);
     move(mem[vp[1]:0],mem[vga:0],64000);
     copypage_bob(vp[2],vga);
     waitvbl;

     if keypressed=true then
        begin
             c:=readkey;
        end;

     until c=#27;

     closevirt;
     video_mode ( 03);
end.