anchor.diff:        F.SaveToFile(aFileName+'.txt');
   
       for i:=0 to F.Size-1 do
  -      if (PAnsiChar(cardinal(F.Memory)+i)^ in [#9,#10,#13]) then
  -        PAnsiChar(cardinal(F.Memory)+i)^ := #32;
  +      if PByte(cardinal(F.Memory)+i)^ in [9,10,13] then //tab, eol
  +        PByte(cardinal(F.Memory)+i)^ := $20; //Space
   
       Num := 0;
       for i:=0 to F.Size-1 do begin
  -      PAnsiChar(cardinal(F.Memory)+Num)^ := PAnsiChar(cardinal(F.Memory)+i)^;
  -      if (Num<=0) or ((PAnsiChar(cardinal(F.Memory)+Num-1)^+PAnsiChar(cardinal(F.Memory)+Num)^<>#32#32) and (PAnsiChar(cardinal(F.Memory)+Num-1)^+PAnsiChar(cardinal(F.Memory)+Num)<>'!!')) then
  +      PByte(cardinal(F.Memory)+Num)^ := PByte(cardinal(F.Memory)+i)^;
  +      if (Num<=0) or (
  +        (PWord(cardinal(F.Memory)+Num-1)^ <> $2020) //Skip double spaces and !!
  +        and (PWord(cardinal(F.Memory)+Num-1)^ <> $2121)) then
           inc(Num);
       end;
   
  -    setlength(Result, Num); //Because some extra characters were removed
  +    SetLength(Result, Num); //Because some extra characters were removed
       F.Position := 0;
       F.ReadBuffer(Result[1], Num);
     finally
  
positive.code:     //Detect whether mission is encoded so we can support decoded/encoded .DAT files
      //We can't test 1st char, it can be any. Instead see how often common chracters meet
      Num := 0;
      for i:=0 to F.Size-1 do
        if PAnsiChar(cardinal(F.Memory)+i)^ in [#9,#10,#13,'0'..'9',' ','!'] then
          inc(Num);
  
      //Usually 30-50% is numerals/spaces, tested on typical KaM maps, take half of that as margin
  
negative.code: end;
  
  
  //Read mission file to a string and if necessary - decode it
  function TMissionParser.ReadMissionFile(const aFileName:string):string;
  var
    i,Num:cardinal;
  