Pascal: Linking from PILOT

Use the LP (LINK TO PASCAL) command to exit PILOT and enter Pascal. If you are in a PILOT lesson and wish to use a Pascal program, insert the following command into your lesson.
For this example, the Pascal program is named MyProg.code.

LP:MyProg

Don't enter the ".code" suffix on the file name, since PILOT automatically adds it.

Use Pascal version 1.0 to compile your Pascal program, but link it to the system.library file provided on the PILOT Lesson1: Student Diskette. The "*$U name *" compiler option allows you to do this.

After executing the LP command, the PILOT interpreter no longer has control. LP closes any open PILOT data files, and errases from memory the status and locations of PILOT variables.

When the Pascal program ends, the system reboots your PILOT "Hello" lesson. To return to a specific spot in your PILOT lesson, have your PILOT program "leave a trail". The following example instructs PILOT to return to the label "bolts" in the lesson "Mechanics":

D:N$(50)
T:going off to Pascal...

R:Open file "restart"
C:N$="restart"
FOX:1,N$

R:leave a trail in the form of the
R:appropriate L: command
C:N$="L:Mechnaics,bolts"
FO:1,N$

R go off to Pascal file MyProg.code
LP:MyProg

The Hello lesson on the PILOT disk looks for the restart file, as follows:

D:N$(50)
C:N$="restart"
FIX:1,N$

R: If error flag is raised, the restart file
R: does not exist, so link to the normal first lesson

LE:firstlesson

R: Otherwise, read in the record containing our
R: restart lesson and label, and link there.

FI:1,N$
XI:N$
Published Date: Feb 18, 2012