head     56.3;
access   paws bayes jws quist brad dew jwh;
symbols  ;
locks    ; strict;
comment  @# @;


56.3
date     93.01.27.13.18.01;  author jwh;  state Exp;
branches ;
next     56.2;

56.2
date     93.01.27.11.59.15;  author jwh;  state Exp;
branches ;
next     56.1;

56.1
date     91.11.05.09.55.12;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.30.42;  author jwh;  state Exp;
branches ;
next     54.3;

54.3
date     91.08.21.10.36.30;  author jwh;  state Exp;
branches ;
next     54.2;

54.2
date     91.08.21.09.40.46;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.32.22;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.32.16;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.17.11;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.16.40;  author jwh;  state Exp;
branches ;
next     50.1;

50.1
date     90.10.29.16.30.54;  author jwh;  state Exp;
branches ;
next     49.1;

49.1
date     90.08.14.14.14.41;  author jwh;  state Exp;
branches ;
next     48.1;

48.1
date     90.07.26.11.21.02;  author jwh;  state Exp;
branches ;
next     47.1;

47.1
date     90.05.14.11.05.46;  author dew;  state Exp;
branches ;
next     46.1;

46.1
date     90.05.07.08.52.45;  author jwh;  state Exp;
branches ;
next     45.1;

45.1
date     90.04.19.16.00.43;  author jwh;  state Exp;
branches ;
next     44.1;

44.1
date     90.04.01.22.17.50;  author jwh;  state Exp;
branches ;
next     43.1;

43.1
date     90.03.20.14.10.23;  author jwh;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.17.54.46;  author jwh;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.36.59;  author jwh;  state Exp;
branches ;
next     40.1;

40.1
date     89.09.29.11.58.05;  author jwh;  state Exp;
branches ;
next     39.1;

39.1
date     89.09.26.16.42.52;  author dew;  state Exp;
branches ;
next     38.1;

38.1
date     89.08.29.11.34.48;  author jwh;  state Exp;
branches ;
next     37.1;

37.1
date     89.05.12.11.48.36;  author dew;  state Exp;
branches ;
next     36.1;

36.1
date     89.02.06.10.26.15;  author dew;  state Exp;
branches ;
next     35.1;

35.1
date     89.02.02.13.41.43;  author dew;  state Exp;
branches ;
next     34.1;

34.1
date     89.01.23.16.16.56;  author jwh;  state Exp;
branches ;
next     33.1;

33.1
date     89.01.16.11.48.25;  author dew;  state Exp;
branches ;
next     32.1;

32.1
date     89.01.10.11.57.37;  author bayes;  state Exp;
branches ;
next     31.1;

31.1
date     88.12.14.18.18.32;  author bayes;  state Exp;
branches ;
next     30.1;

30.1
date     88.12.09.13.55.34;  author dew;  state Exp;
branches ;
next     29.1;

29.1
date     88.10.31.15.40.10;  author bayes;  state Exp;
branches ;
next     28.1;

28.1
date     88.10.06.11.06.30;  author dew;  state Exp;
branches ;
next     27.1;

27.1
date     88.09.29.11.49.11;  author bayes;  state Exp;
branches ;
next     26.1;

26.1
date     88.09.28.13.35.16;  author bayes;  state Exp;
branches ;
next     25.1;

25.1
date     88.03.02.09.43.13;  author bayes;  state Exp;
branches ;
next     24.1;

24.1
date     87.08.31.10.13.25;  author jws;  state Exp;
branches ;
next     23.1;

23.1
date     87.08.26.10.57.53;  author bayes;  state Exp;
branches ;
next     22.1;

22.1
date     87.08.17.11.38.16;  author bayes;  state Exp;
branches ;
next     21.1;

21.1
date     87.08.12.14.22.20;  author bayes;  state Exp;
branches ;
next     20.1;

20.1
date     87.07.30.11.34.02;  author bayes;  state Exp;
branches ;
next     19.1;

19.1
date     87.06.01.08.46.44;  author jws;  state Exp;
branches ;
next     18.1;

18.1
date     87.05.20.15.53.27;  author bayes;  state Exp;
branches ;
next     17.1;

17.1
date     87.04.30.10.57.33;  author jws;  state Exp;
branches ;
next     16.1;

16.1
date     87.04.26.16.07.59;  author jws;  state Exp;
branches ;
next     15.1;

15.1
date     87.04.13.09.48.13;  author jws;  state Exp;
branches ;
next     14.1;

14.1
date     87.04.01.15.57.10;  author jws;  state Exp;
branches ;
next     13.1;

13.1
date     87.02.28.18.51.24;  author jws;  state Exp;
branches ;
next     12.1;

12.1
date     87.02.02.13.44.39;  author jws;  state Exp;
branches ;
next     11.1;

11.1
date     87.01.19.10.10.57;  author jws;  state Exp;
branches ;
next     10.1;

10.1
date     86.12.24.11.25.52;  author jws;  state Exp;
branches ;
next     9.1;

9.1
date     86.12.12.15.09.09;  author bayes;  state Exp;
branches ;
next     8.1;

8.1
date     86.11.27.12.19.24;  author jws;  state Exp;
branches ;
next     7.1;

7.1
date     86.11.20.14.29.54;  author hal;  state Exp;
branches ;
next     6.1;

6.1
date     86.11.04.18.24.45;  author paws;  state Exp;
branches ;
next     5.1;

5.1
date     86.10.28.17.13.53;  author hal;  state Exp;
branches ;
next     4.1;

4.1
date     86.09.30.20.08.03;  author hal;  state Exp;
branches ;
next     3.1;

3.1
date     86.09.01.12.18.33;  author hal;  state Exp;
branches ;
next     2.1;

2.1
date     86.07.30.15.07.31;  author hal;  state Exp;
branches ;
next     1.1;

1.1
date     86.06.30.16.39.52;  author danm;  state tmp;
branches ;
next     ;


desc
@Base file for PWS 3.2 release.

@


56.3
log
@
pws2rcs automatic delta on Wed Jan 27 13:14:25 MST 1993
@
text
@module ldr;

import sysglobals, misc, fs, loader, asm;

export
   procedure openlinkfile(var filename: string);
   procedure load(filetogo:fid;  permanent: boolean);

   procedure initsysunit;
   procedure lockfiles;
   procedure openfiles;

   procedure go;
   procedure loadrom(name: fid);


implement

procedure lockfiles;
begin
  close(input);
  close(output,     'LOCK');
  close(gfiles[2]^);                      {KEYBOARD}
  close(gfiles[4]^, 'LOCK');              {LISTING}
end;

procedure openfiles;
begin
  if not fibp(addr(input   ))^.freadable  then
				    reset  (input,      'CONSOLE:');
  with   fibp(addr(output  ))^ do
     begin
     if (fleof>0) and fwriteable then close  (output,     'LOCK');
     if not fwriteable then         rewrite(output,     'CONSOLE:');
     end;

  if not fibp(gfiles[2]     )^.freadable  then          {KEYBOARD}
				    reset  (gfiles[2]^, 'SYSTERM:');
  with   fibp(gfiles[4]     )^ do
     begin                                              {LISTING}
     if (fleof>0) and fwriteable then close  (gfiles[4]^, 'LOCK');
     if not fwriteable then         rewrite(gfiles[4]^, 'PRINTER:LISTING.ASC');
     end;
end;

procedure initsysunit;
var i: integer;
begin
  syvid := '#';  strwrite(syvid,2,i,sysunit:1);
  i := findvolume(syvid, true);
  dkvid := syvid;
end; (*INITUNITABLE*)

procedure go;
var  lastioresult:integer;
     userheap: anyptr;
     done: boolean;
     modptr: moddescptr;
begin {GO}
  if entrypoint = nil then writeln('(no start address)')
  else
      begin
      page(output);
      mark(userheap);
      modptr := entrypoint;
      repeat
	done := modptr^.lastmodule;
	if modptr^.startaddr<>0 then
	  begin
	  userprogram(modptr^.startaddr,userstack); (*** ALL PROGRAMS ARE ENTERED HERE ****)
	  if escapecode <> 0 then
	      begin
	      lastioresult:=ioresult;{save ioresult}
	      release(userheap);
	      if escapecode <> -1 then printerror(escapecode,lastioresult);
	      done := true;
	      end;
	  end;
	modptr := modptr^.link;
      until done;
      end;
end;  {GO}

procedure loadrom(name: fid);
var modptr: moddescptr; upcname: tid;
begin
  entrypoint := nil;
  if strlen(name) <= tidleng then
    begin
    upcname := name;    upc(upcname);
    modptr := sysdefs;
    while modptr <> nil do with modptr^ do
      begin
      if (startaddr<>0) and
		      ((progname=name) or (ucase and (progname=upcname))) then
	begin
	entrypoint := modptr;
	modptr := nil;
	end
      else modptr := link;
      end;
    end;
end;

procedure openlinkfile(var filename: string);
var extra:      addrec;
begin {openlinkfile}
  getbytes(extra.a,   sizeof(addrec));  {save old value of loadfib}
  extra.arp^ := loadfib;
  getbytes(loadfib.a, sizeof(fib,1));   {create a FIB for new file}
  finitb(loadfib.fbp^, nil, -1);        {untyped, unbuffered file }
  reset(loadfib.php^, filename, 'shared');
  openlinkf(extra);
end;

procedure printunres;
var modptr:     moddescptr;
    strptr:     addrec;
    i:          shortint;
begin
  modptr := newmods;
  while modptr <> endmod do with modptr^ do
    begin
    if not resolved then
     for i := 0 to listsize - 1 do
      if listaddr^[i]<>0 then
       begin
       strptr.a := extaddr.a + listaddr^[i];
       writeln(strptr.syp^);
       end;
    modptr := link;
    end;
  writeln;
  writeln('The external references above were unresolved.');
  writeln;
  escape(-1);
end;

procedure load(filetogo:fid;  permanent: boolean);

var modnum, ecode:   shortint;
    icode: integer;

  procedure printwhy;
  var s: string80;
  begin
  getioerrmsg(s, ioresult);
  writeln('cannot open ''',filetogo, '''');
  writeln(s);
  end;

begin

(*This routine must:
  1. Set "ENTRYPOINT" to nil (no start address) or correct value.
  2. Load executable code into heap.
  3. Set "SYSDEFS"  to user program symbol table.
  4. Set "USERSTACK" to initial SP value. *)

loadfib.php := nil;
try
  releaseuser;          {get rid of last program}
  mark(lowheap.p);              highheap.a := userstack;
  startreloc := lowheap.a;
  newmods       := sysdefs;     endmod          := sysdefs;

  writeln; writeln('Loading  ''',filetogo,'''');
  openlinkfile(filetogo);
  if fdirectory = nil then      begin printwhy; escape(-1); end;
  for modnum := 1 to fdirectory^[0].dnumfiles do
			   begin loadinfo(modnum, true, false); checkrev; end;
  allresolved := true; matchfile;
  highheap.a := userstack;

  if not allresolved then
    begin
    filetogo := syslibrary;
    if syvid <> '' then openlinkfile(filetogo)
    else fdirectory := nil;
    if fdirectory = nil then printwhy
    else
     begin
      repeat
	libfound := false;
	modnum := fdirectory^[0].dnumfiles;
	while (modnum > 0) and not allresolved do
	  begin
	  loadinfo(modnum, false, true);
	  checkrev;
	  modnum := modnum - 1;
	  end;
      until allresolved or not libfound;
      highheap.a := userstack;
     end;
    end;

  if not allresolved then printunres;

  countcode;

  highheap.a := userstack - totalglobal;
  if highheap.a < (a5 - 32768) then escape(117);
  startglobal := userstack - a5;
  userstack := highheap.a;
  zeromem(highheap.p, totalglobal);

  loadtext(true);

  movedefs(startreloc+totalreloc);

  lowheap.a := startdefs + totaldefs;
  release(lowheap.p);

  if not permanent then
   if entrypoint = nil then
    begin writeln('no start address');
	 escape(-1);
    end;

recover
  begin
  ecode := escapecode; icode := ioresult;
  closefiles;
  if ecode <> -1 then
   case ecode of
   100..105: begin
	     writeln('can''t link object at byte ',wrongbyte:1);
	     writeln(' in text record ',wrongrec:1);
	     writeln(' of module ''', linkmodname.syp^, '''');
	     end;
   110: writeln('symbol def''s nested too deeply');
   111: writeln('improper link info format');
   112: writeln('not enough memory to load');
   116: writeln('''',filetogo, ''' not a codefile');
   117: writeln('available global space exceeded');
   118: writeln('incorrect version number');
   otherwise printerror(ecode,icode);
   end;
  releaseuser;
  escape(-1);
  end;
end;  {LOAD}

end
@


56.2
log
@
pws2rcs automatic delta on Wed Jan 27 11:57:27 MST 1993
@
text
@d1 244
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 244
module ldr;

import sysglobals, misc, fs, loader, asm;

export
   procedure openlinkfile(var filename: string);
   procedure load(filetogo:fid;  permanent: boolean);

   procedure initsysunit;
   procedure lockfiles;
   procedure openfiles;

   procedure go;
   procedure loadrom(name: fid);


implement

procedure lockfiles;
begin
  close(input);
  close(output,     'LOCK');
  close(gfiles[2]^);                      {KEYBOARD}
  close(gfiles[4]^, 'LOCK');              {LISTING}
end;

procedure openfiles;
begin
  if not fibp(addr(input   ))^.freadable  then
				    reset  (input,      'CONSOLE:');
  with   fibp(addr(output  ))^ do
     begin
     if (fleof>0) and fwriteable then close  (output,     'LOCK');
     if not fwriteable then         rewrite(output,     'CONSOLE:');
     end;

  if not fibp(gfiles[2]     )^.freadable  then          {KEYBOARD}
				    reset  (gfiles[2]^, 'SYSTERM:');
  with   fibp(gfiles[4]     )^ do
     begin                                              {LISTING}
     if (fleof>0) and fwriteable then close  (gfiles[4]^, 'LOCK');
     if not fwriteable then         rewrite(gfiles[4]^, 'PRINTER:LISTING.ASC');
     end;
end;

procedure initsysunit;
var i: integer;
begin
  syvid := '#';  strwrite(syvid,2,i,sysunit:1);
  i := findvolume(syvid, true);
  dkvid := syvid;
end; (*INITUNITABLE*)

procedure go;
var  lastioresult:integer;
     userheap: anyptr;
     done: boolean;
     modptr: moddescptr;
begin {GO}
  if entrypoint = nil then writeln('(no start address)')
  else
      begin
      page(output);
      mark(userheap);
      modptr := entrypoint;
      repeat
	done := modptr^.lastmodule;
	if modptr^.startaddr<>0 then
	  begin
	  userprogram(modptr^.startaddr,userstack); (*** ALL PROGRAMS ARE ENTERED HERE ****)
	  if escapecode <> 0 then
	      begin
	      lastioresult:=ioresult;{save ioresult}
	      release(userheap);
	      if escapecode <> -1 then printerror(escapecode,lastioresult);
	      done := true;
	      end;
	  end;
	modptr := modptr^.link;
      until done;
      end;
end;  {GO}

procedure loadrom(name: fid);
var modptr: moddescptr; upcname: tid;
begin
  entrypoint := nil;
  if strlen(name) <= tidleng then
    begin
    upcname := name;    upc(upcname);
    modptr := sysdefs;
    while modptr <> nil do with modptr^ do
      begin
      if (startaddr<>0) and
		      ((progname=name) or (ucase and (progname=upcname))) then
	begin
	entrypoint := modptr;
	modptr := nil;
	end
      else modptr := link;
      end;
    end;
end;

procedure openlinkfile(var filename: string);
var extra:      addrec;
begin {openlinkfile}
  getbytes(extra.a,   sizeof(addrec));  {save old value of loadfib}
  extra.arp^ := loadfib;
  getbytes(loadfib.a, sizeof(fib,1));   {create a FIB for new file}
  finitb(loadfib.fbp^, nil, -1);        {untyped, unbuffered file }
  reset(loadfib.php^, filename, 'shared');
  openlinkf(extra);
end;

procedure printunres;
var modptr:     moddescptr;
    strptr:     addrec;
    i:          shortint;
begin
  modptr := newmods;
  while modptr <> endmod do with modptr^ do
    begin
    if not resolved then
     for i := 0 to listsize - 1 do
      if listaddr^[i]<>0 then
       begin
       strptr.a := extaddr.a + listaddr^[i];
       writeln(strptr.syp^);
       end;
    modptr := link;
    end;
  writeln;
  writeln('The external references above were unresolved.');
  writeln;
  escape(-1);
end;

procedure load(filetogo:fid;  permanent: boolean);

var modnum, ecode:   shortint;
    icode: integer;

  procedure printwhy;
  var s: string80;
  begin
  getioerrmsg(s, ioresult);
  writeln('cannot open ''',filetogo, '''');
  writeln(s);
  end;

begin

(*This routine must:
  1. Set "ENTRYPOINT" to nil (no start address) or correct value.
  2. Load executable code into heap.
  3. Set "SYSDEFS"  to user program symbol table.
  4. Set "USERSTACK" to initial SP value. *)

loadfib.php := nil;
try
  releaseuser;          {get rid of last program}
  mark(lowheap.p);              highheap.a := userstack;
  startreloc := lowheap.a;
  newmods       := sysdefs;     endmod          := sysdefs;

  writeln; writeln('Loading  ''',filetogo,'''');
  openlinkfile(filetogo);
  if fdirectory = nil then      begin printwhy; escape(-1); end;
  for modnum := 1 to fdirectory^[0].dnumfiles do
			   begin loadinfo(modnum, true, false); checkrev; end;
  allresolved := true; matchfile;
  highheap.a := userstack;

  if not allresolved then
    begin
    filetogo := syslibrary;
    if syvid <> '' then openlinkfile(filetogo)
    else fdirectory := nil;
    if fdirectory = nil then printwhy
    else
     begin
      repeat
	libfound := false;
	modnum := fdirectory^[0].dnumfiles;
	while (modnum > 0) and not allresolved do
	  begin
	  loadinfo(modnum, false, true);
	  checkrev;
	  modnum := modnum - 1;
	  end;
      until allresolved or not libfound;
      highheap.a := userstack;
     end;
    end;

  if not allresolved then printunres;

  countcode;

  highheap.a := userstack - totalglobal;
  if highheap.a < (a5 - 32768) then escape(117);
  startglobal := userstack - a5;
  userstack := highheap.a;
  zeromem(highheap.p, totalglobal);

  loadtext(true);

  movedefs(startreloc+totalreloc);

  lowheap.a := startdefs + totaldefs;
  release(lowheap.p);

  if not permanent then
   if entrypoint = nil then
    begin writeln('no start address');
	 escape(-1);
    end;

recover
  begin
  ecode := escapecode; icode := ioresult;
  closefiles;
  if ecode <> -1 then
   case ecode of
   100..105: begin
	     writeln('can''t link object at byte ',wrongbyte:1);
	     writeln(' in text record ',wrongrec:1);
	     writeln(' of module ''', linkmodname.syp^, '''');
	     end;
   110: writeln('symbol def''s nested too deeply');
   111: writeln('improper link info format');
   112: writeln('not enough memory to load');
   116: writeln('''',filetogo, ''' not a codefile');
   117: writeln('available global space exceeded');
   118: writeln('incorrect version number');
   otherwise printerror(ecode,icode);
   end;
  releaseuser;
  escape(-1);
  end;
end;  {LOAD}

end
@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.3
log
@
pws2rcs automatic delta on Wed Aug 21 10:27:27 MDT 1991
@
text
@@


54.2
log
@
pws2rcs automatic delta on Wed Aug 21 09:35:48 MDT 1991
@
text
@d1 244
@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@a0 244
module ldr;

import sysglobals, misc, fs, loader, asm;

export
   procedure openlinkfile(var filename: string);
   procedure load(filetogo:fid;  permanent: boolean);

   procedure initsysunit;
   procedure lockfiles;
   procedure openfiles;

   procedure go;
   procedure loadrom(name: fid);


implement

procedure lockfiles;
begin
  close(input);
  close(output,     'LOCK');
  close(gfiles[2]^);                      {KEYBOARD}
  close(gfiles[4]^, 'LOCK');              {LISTING}
end;

procedure openfiles;
begin
  if not fibp(addr(input   ))^.freadable  then
				    reset  (input,      'CONSOLE:');
  with   fibp(addr(output  ))^ do
     begin
     if (fleof>0) and fwriteable then close  (output,     'LOCK');
     if not fwriteable then         rewrite(output,     'CONSOLE:');
     end;

  if not fibp(gfiles[2]     )^.freadable  then          {KEYBOARD}
				    reset  (gfiles[2]^, 'SYSTERM:');
  with   fibp(gfiles[4]     )^ do
     begin                                              {LISTING}
     if (fleof>0) and fwriteable then close  (gfiles[4]^, 'LOCK');
     if not fwriteable then         rewrite(gfiles[4]^, 'PRINTER:LISTING.ASC');
     end;
end;

procedure initsysunit;
var i: integer;
begin
  syvid := '#';  strwrite(syvid,2,i,sysunit:1);
  i := findvolume(syvid, true);
  dkvid := syvid;
end; (*INITUNITABLE*)

procedure go;
var  lastioresult:integer;
     userheap: anyptr;
     done: boolean;
     modptr: moddescptr;
begin {GO}
  if entrypoint = nil then writeln('(no start address)')
  else
      begin
      page(output);
      mark(userheap);
      modptr := entrypoint;
      repeat
	done := modptr^.lastmodule;
	if modptr^.startaddr<>0 then
	  begin
	  userprogram(modptr^.startaddr,userstack); (*** ALL PROGRAMS ARE ENTERED HERE ****)
	  if escapecode <> 0 then
	      begin
	      lastioresult:=ioresult;{save ioresult}
	      release(userheap);
	      if escapecode <> -1 then printerror(escapecode,lastioresult);
	      done := true;
	      end;
	  end;
	modptr := modptr^.link;
      until done;
      end;
end;  {GO}

procedure loadrom(name: fid);
var modptr: moddescptr; upcname: tid;
begin
  entrypoint := nil;
  if strlen(name) <= tidleng then
    begin
    upcname := name;    upc(upcname);
    modptr := sysdefs;
    while modptr <> nil do with modptr^ do
      begin
      if (startaddr<>0) and
		      ((progname=name) or (ucase and (progname=upcname))) then
	begin
	entrypoint := modptr;
	modptr := nil;
	end
      else modptr := link;
      end;
    end;
end;

procedure openlinkfile(var filename: string);
var extra:      addrec;
begin {openlinkfile}
  getbytes(extra.a,   sizeof(addrec));  {save old value of loadfib}
  extra.arp^ := loadfib;
  getbytes(loadfib.a, sizeof(fib,1));   {create a FIB for new file}
  finitb(loadfib.fbp^, nil, -1);        {untyped, unbuffered file }
  reset(loadfib.php^, filename, 'shared');
  openlinkf(extra);
end;

procedure printunres;
var modptr:     moddescptr;
    strptr:     addrec;
    i:          shortint;
begin
  modptr := newmods;
  while modptr <> endmod do with modptr^ do
    begin
    if not resolved then
     for i := 0 to listsize - 1 do
      if listaddr^[i]<>0 then
       begin
       strptr.a := extaddr.a + listaddr^[i];
       writeln(strptr.syp^);
       end;
    modptr := link;
    end;
  writeln;
  writeln('The external references above were unresolved.');
  writeln;
  escape(-1);
end;

procedure load(filetogo:fid;  permanent: boolean);

var modnum, ecode:   shortint;
    icode: integer;

  procedure printwhy;
  var s: string80;
  begin
  getioerrmsg(s, ioresult);
  writeln('cannot open ''',filetogo, '''');
  writeln(s);
  end;

begin

(*This routine must:
  1. Set "ENTRYPOINT" to nil (no start address) or correct value.
  2. Load executable code into heap.
  3. Set "SYSDEFS"  to user program symbol table.
  4. Set "USERSTACK" to initial SP value. *)

loadfib.php := nil;
try
  releaseuser;          {get rid of last program}
  mark(lowheap.p);              highheap.a := userstack;
  startreloc := lowheap.a;
  newmods       := sysdefs;     endmod          := sysdefs;

  writeln; writeln('Loading  ''',filetogo,'''');
  openlinkfile(filetogo);
  if fdirectory = nil then      begin printwhy; escape(-1); end;
  for modnum := 1 to fdirectory^[0].dnumfiles do
			   begin loadinfo(modnum, true, false); checkrev; end;
  allresolved := true; matchfile;
  highheap.a := userstack;

  if not allresolved then
    begin
    filetogo := syslibrary;
    if syvid <> '' then openlinkfile(filetogo)
    else fdirectory := nil;
    if fdirectory = nil then printwhy
    else
     begin
      repeat
	libfound := false;
	modnum := fdirectory^[0].dnumfiles;
	while (modnum > 0) and not allresolved do
	  begin
	  loadinfo(modnum, false, true);
	  checkrev;
	  modnum := modnum - 1;
	  end;
      until allresolved or not libfound;
      highheap.a := userstack;
     end;
    end;

  if not allresolved then printunres;

  countcode;

  highheap.a := userstack - totalglobal;
  if highheap.a < (a5 - 32768) then escape(117);
  startglobal := userstack - a5;
  userstack := highheap.a;
  zeromem(highheap.p, totalglobal);

  loadtext(true);

  movedefs(startreloc+totalreloc);

  lowheap.a := startdefs + totaldefs;
  release(lowheap.p);

  if not permanent then
   if entrypoint = nil then
    begin writeln('no start address');
	 escape(-1);
    end;

recover
  begin
  ecode := escapecode; icode := ioresult;
  closefiles;
  if ecode <> -1 then
   case ecode of
   100..105: begin
	     writeln('can''t link object at byte ',wrongbyte:1);
	     writeln(' in text record ',wrongrec:1);
	     writeln(' of module ''', linkmodname.syp^, '''');
	     end;
   110: writeln('symbol def''s nested too deeply');
   111: writeln('improper link info format');
   112: writeln('not enough memory to load');
   116: writeln('''',filetogo, ''' not a codefile');
   117: writeln('available global space exceeded');
   118: writeln('incorrect version number');
   otherwise printerror(ecode,icode);
   end;
  releaseuser;
  escape(-1);
  end;
end;  {LOAD}

end
@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@@


50.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


49.1
log
@Automatic bump of revision number for PWS version 3.24b
@
text
@@


48.1
log
@Automatic bump of revision number for PWS version 3.24a
@
text
@@


47.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


46.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@@


44.1
log
@Automatic bump of revision number for PWS version 3.23B
@
text
@@


43.1
log
@Automatic bump of revision number for PWS version 3.23aA
@
text
@@


42.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@@


41.1
log
@Automatic bump of revision number for PWS version 3.23d
@
text
@@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


39.1
log
@Automatic bump of revision number for PWS version 3.23b
@
text
@@


38.1
log
@Automatic bump of revision number for PWS version 3.23a
@
text
@@


37.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@@


36.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


35.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


34.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


33.1
log
@Automatic bump of revision number for PWS version 3.22D
@
text
@@


32.1
log
@Automatic bump of revision number for PWS version 3.22C
@
text
@@


31.1
log
@Automatic bump of revision number for PWS version 3.22B
@
text
@@


30.1
log
@Automatic bump of revision number for PWS version 3.22A
@
text
@@


29.1
log
@Automatic bump of revision number for PWS version 3.22b
@
text
@@


28.1
log
@Automatic bump of revision number for PWS version 3.3b
@
text
@@


27.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@@


26.1
log
@Automatic bump of revision number for PWS version 3.3 Synch
@
text
@@


25.1
log
@Automatic bump of revision number for PWS version 3.2Y
@
text
@@


24.1
log
@Automatic bump of revision number for PWS version 3.2
@
text
@@


23.1
log
@Automatic bump of revision number for PWS version 3.2P
@
text
@@


22.1
log
@Automatic bump of revision number for PWS version 3.2N
@
text
@@


21.1
log
@Automatic bump of revision number for PWS version 3.2M
@
text
@@


20.1
log
@Automatic bump of revision number for PWS version 3.2L
@
text
@@


19.1
log
@Automatic bump of revision number for PWS version 3.2K
@
text
@@


18.1
log
@Automatic bump of revision number for PWS version 3.2J
@
text
@@


17.1
log
@Automatic bump of revision number for PWS version 3.2I+
@
text
@@


16.1
log
@Automatic bump of revision number for PWS version 3.2I
@
text
@@


15.1
log
@Automatic bump of revision number for PWS version 3.2H
@
text
@@


14.1
log
@Automatic bump of revision number for PWS version 3.2G
@
text
@@


13.1
log
@Automatic bump of revision number for PWS version 3.2F
@
text
@@


12.1
log
@Automatic bump of revision number for PWS version 3.2E
@
text
@@


11.1
log
@Automatic bump of revision number for PWS version 3.2D
@
text
@@


10.1
log
@Automatic bump of revision number for PWS version 3.2C
@
text
@@


9.1
log
@Automatic bump of revision number for PWS version 3.2B
@
text
@@


8.1
log
@Automatic bump of revision number for PWS version 3.2A
@
text
@@


7.1
log
@Automatic bump of revision number for PWS version 3.2l
@
text
@@


6.1
log
@Automatic bump of revision number for PWS version 3.2k
@
text
@@


5.1
log
@Automatic bump of revision number for PWS version 3.2j
@
text
@@


4.1
log
@Automatic bump of revision number for PWS version 3.2i
@
text
@@


3.1
log
@Automatic bump of revision number for PWS version 3.2h
@
text
@@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@@


1.1
log
@Initial revision
@
text
@@
