I did a quick check using the diff util:
$> diff Layer3.pas tsd_mpeg.pas | grep -e '^<' | wc -l
591
So out of the 1301 lines of the Layer3.pas, 710 where taken verbatim and in order.
When removing spaces (to find similar lines with different spacing or indentation):
$> diff Layer3_nospace.pas tsd_mpeg_nospace.pas | grep -e '^<' | wc -l
503
It is 798 out of 1301, so around 61%
As diff considers order, I also sorted the lines, to check just for lines occuring in both:
$> diff Layer3_nospace_sorted.pas tsd_mpeg_nospace_sorted | grep -e '^<' | wc -l
490
It increases to 811. But this is a little bit unfair as it includes empty lines, so after removing them with sort -u:
$> diff Layer3_nospace_sorted.pas tsd_mpeg_nospace_sorted | grep -e '^<' | wc -l
374
$> wc -l Layer3_nospace_sorted.pas
768 Layer3_nospace_sorted.pas
It is 394 out of 768 lines, which is 51%
So it is either around half or nearly 2/3 of the Delphi code, which is also present in the pilot logic code.
To answer the question about legality, well, there is this neat saying: "No plaintiff, no judge". So unless someone is actually going to try legal action, does it really matter?
PS: about how to read the diff | grep | wc results, the number in the end is the number of lines that where in the Layer3 but not in the tsd file, so the number of lines in both is the total minus that number