var f1,f2,f3,fout : file;
    x,y : word;
    h : word;
    buf2 : array[0..319] of byte;
    buf3 : array[0..319] of byte;
    bufout : array[0..319] of byte;

begin
  assign(f1,'t2-tab3.clb');
  assign(f2,'t2-plasm.clb');
  assign(f3,'t2-plasm.clb');
  assign(fout,'t2-tab.org');
  reset(f1,1);
  reset(f2,1);
  reset(f3,1);
  rewrite(fout,1);
  asm mov ax,13h; int 10h; end;
  for y := 0 to 599 do begin
    blockread(f1,bufout,sizeof(bufout));
    blockread(f2,buf2,sizeof(buf2));
    blockread(f3,buf3,sizeof(buf3));
    if y > 199 then h := y mod 200 else h := y;
    for x := 0 to 319 do if bufout[x] = 1 then bufout[x] := buf2[x];
{    for x := 0 to 319 do if bufout[x] = 34 then bufout[x] := buf3[x];}

    for x := 0 to 319 do mem[$a000:h*320+x] := bufout[x];
    blockwrite(fout,bufout,sizeof(bufout));
  end;
  close(f1);
  close(f2);
  close(f3);

end.