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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

37.1
date     89.05.12.11.47.15;  author dew;  state Exp;
branches ;
next     36.2;

36.2
date     89.05.09.10.46.34;  author quist;  state Exp;
branches ;
next     36.1;

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

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

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

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

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

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

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

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

28.1
date     88.10.06.11.05.03;  author dew;  state Exp;
branches ;
next     27.3;

27.3
date     88.10.04.15.00.49;  author dew;  state Exp;
branches ;
next     27.2;

27.2
date     88.09.29.15.12.37;  author dew;  state Exp;
branches ;
next     27.1;

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

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

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

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

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

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

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

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

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

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

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

16.1
date     87.04.26.16.04.14;  author jws;  state Exp;
branches ;
next     15.2;

15.2
date     87.04.22.15.58.26;  author bayes;  state Exp;
branches ;
next     15.1;

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

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

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

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

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

10.1
date     86.12.24.11.21.26;  author jws;  state Exp;
branches ;
next     9.2;

9.2
date     86.12.16.10.06.05;  author jws;  state Exp;
branches ;
next     9.1;

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

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

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

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

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

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

3.1
date     86.09.01.12.14.45;  author hal;  state Exp;
branches ;
next     2.5;

2.5
date     86.08.18.09.51.56;  author hal;  state Exp;
branches ;
next     2.4;

2.4
date     86.08.14.10.34.51;  author hal;  state Exp;
branches ;
next     2.3;

2.3
date     86.08.12.10.27.39;  author hal;  state Exp;
branches ;
next     2.2;

2.2
date     86.08.01.17.03.43;  author hal;  state Exp;
branches ;
next     2.1;

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

1.1
date     86.06.30.16.17.18;  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 bootdammodule;
import sysglobals,asm,mini,hfsboot;
export

  type string2=string[2];
       string6=string[6];       {added for LANSRM node lengths. SFB 1/19/89}
       string20=string[20];

  var nodestr: string[50];
      { hfsbflg tells whether we are booting from an HFS disc }
      hfsbflg['HFSBFLG']: boolean;

  procedure initbootdam;
  procedure bootdam(anyvar f:fib; unum:unitnum; request:damrequesttype);
  procedure boottm(f:fibp; request: amrequesttype;
		      anyvar buffer: window; bufsize,position: integer);
  function srmnode(sc: shortint): string6;      {upgraded for LANSRM. SFB 1/19/89}
  function bootnode: string6;                   {upgraded for LANSRM. SFB 1/19/89}
  function bootname(fullname: string20; shortlen: shortint): string20;

implement

  type

    strptr = ^string255;
    lifname  = packed array[1..10] of char;
    word15   = 0..32767;
    bcd      = 0..15;
    tdate    = packed array[1..12] of bcd;
    direntryp= ^direntry;
    direntry = packed record
		 fname    : lifname;
		 ftype    : shortint;
		 fstart   : integer;
		 fsize    : integer;
		 fdate    : tdate;
		 lastvol  : boolean;
		 volnumber: word15;
		 extension: integer;
	       end;

    msustype = packed record
		 mtype : byte;
		 munit : byte;
		 mscode: byte;
		 maddr : byte;
	       end;
  var
    driverkey  [-293  {$FFFFFEDB}]: boolean;
    boot_msus  [-292  {$FFFFFEDC}]: msustype;
    boot_id    [16382 {$    3FFE}]: shortint;
    boot_flags [16380 {$    3FFC}]: packed array[0..7] of boolean;

    gread        : boolean;

    {  FUNCTIONS AND PROCEDURES USED FROM THE BOOT ROM  }
  procedure boot_lifhead(var dsize,dstart:integer); external;
  procedure boot_findfile(var entry:direntryp; var lname:lifname;
						    dl,ds : integer); external;
  function boot_minit(msus:msustype):boolean; external;
  function boot_mfopen(anyvar fname:string255; var xaddr,length:integer;
		       var ftype:shortint):boolean; external;
  procedure boot_mfclose; external;
  procedure boot_mread(sector,bytecount: integer;
		       anyvar buffer:window; media:boolean); external;

  function escio(escn:integer):iorsltwd;
  begin
    case escn of
    1,7 : escio:=znodevice;
    2   : escio:=znomedium;
    3   : escio:=znotready;
    4   : escio:=zbadblock;
    5   : escio:=zbadhardware;
    6   : escio:=zcatchall;
    otherwise  escape(escn);
    end; { case }
  end;

  procedure bootdam(anyvar f:fib; unum:unitnum; request:damrequesttype);
  var
    ftype       : shortint;
    fk          : filekind;
    dstart      : integer;
    dsize       : integer;
    dentry      : direntryp;
    i,j         : integer;

    procedure escesc(ecode:integer);
    var
      tempec      : integer;
    begin { convert mini driver escape code to general code}
      if ecode<=0 then escape(ecode);
      if ecode = 1 then ioresult := ord(ibadtitle);
      tempec:=ecode mod 1000;
      if tempec=80 then escape(2)     { no medium }
      else if tempec=90 then escape(6){ bad error state }
	   else escape(4);            { read error }
    end;

    function minit(msus:msustype):boolean;
    var
      tempec              : integer;
    begin
      if gread then minit:=boot_minit(msus)
      else
      begin
      try
	minit:=true;
	driverkey := false;
	boot_lifhead(dsize,dstart);
	driverkey := true;
      recover begin
	      driverkey := true;
	      if escapecode=-1 then minit:=false
			       else escesc(escapecode);
	      end;
      end;
    end;

    function mfopen(anyvar fname:string255; var xaddr,length:integer;
		    var ftype:shortint):boolean;
    var
      tfname      : lifname;
      i           : integer;
      fk, fkind   : filekind;
    begin
      if gread then
	if hfsbflg then
	  { booting from HFS }
	  mfopen:=hfsopen(fname,xaddr,length,ftype)
	else
	  { not HFS, so boot ROM can handle it }
	  mfopen:=boot_mfopen(fname,xaddr,length,ftype)
      else
      begin
      try
	mfopen:=true;
	if (strlen(fname)=0) or (strlen(fname)>10) then escape(1);
	for i:=1 to 10 do
	  if i>strlen(fname) then tfname[i]:=' ' else tfname[i]:=fname[i];

	driverkey := false;
	boot_findfile(dentry,tfname,dsize,dstart);
	driverkey := true;

	fkind:=datafile;  ftype:=dentry^.ftype;
	for fk:=lastfkind downto untypedfile do
	  if efttable^[fk]=ftype then fkind:=fk;
	if fkind=sysfile then xaddr:=dentry^.extension
			 else xaddr:=0;
	if fkind=datafile then length:=dentry^.extension
			  else length:=dentry^.fsize*256;
      recover
	begin
	  driverkey := true;
	  mfopen:=false;
	  if escapecode<>-1 then escesc(escapecode);
	end;
      end;
    end;

    procedure mfclose;
    begin
      if gread then boot_mfclose;
    end;

  begin { bootdam }
    ioresult:=ord(inoerror);
    case request of
    getvolumename:  strptr(addr(f))^ := '"BOOT_DEVICE"';
    openfile:
      try
	j := 0;
	for i := 1 to strlen(f.ftitle) do if f.ftitle[i] = '/' then j := i;
	if strlen(f.ftitle)-j>tidleng then f.ftid := ''
	else begin
	     setstrlen(f.ftid, strlen(f.ftitle)-j);
	     for i := 1 to strlen(f.ftid) do f.ftid[i] := f.ftitle[j+i];
	     end;
	if minit(boot_msus) then
	begin
	  ftype:=-1;
	  if mfopen(f.ftitle,f.fstartaddress,f.fpeof,ftype) then
	  begin
	    f.fkind:=datafile;
	    for fk:=lastfkind downto untypedfile do
		   if efttable^[fk]=ftype then f.fkind:=fk;
	    if gread then f.fileid := 0
		     else f.fileid := dentry^.fstart*256;
	    f.fleof:=f.fpeof;       f.fisnew:=false;
	    if not f.fbuffered then f.am:=amtable^[UNTYPEDFILE]
	    else f.am:=amtable^[f.fkind];
	  end
	  else ioresult:=ord(inofile);
	end
	else with boot_msus do
	  ioresult:=ord(inounit);
      recover ioresult:=ord(escio(escapecode));
    closefile:
      try
	mfclose;
      recover ioresult:=ord(escio(escapecode));
    otherwise
      ioresult:=ord(ibadrequest);
    end; {case request}
  end; { bootdam }

  procedure initbootdam;
  type
    lrec = packed record
	     pad   : packed array[0..15] of char;
	     mbptr : ^char;     { offset 16 }
	     mbsize: integer;   { offset 20 }
	   end;
  const
    remote_boot_mask = binary('11100000');      {for validating hfsbflg. SFB}
  var
    boot_space  [-300]:^lrec;
  begin
    {Added a check to see that hfsbflg is correct, and correct it if it is not.
     Note that the startup and relocation code sets hfsbflg if we had to
     relocate before kicking off the system. Actually relocating means we did
     not boot directly from the BOOTROM, not that we booted from HFS.
     Usually, relocating just means that we booted through HP-UX's secondary
     loader. This could happen either as an HFS boot, or as a HPUX bootserver
     load. To check this, check the boot_msus first byte. If the upper 3 bits
     are 111, we booted through a "special" interface, and could not have
     booted from HFS, so clear hfsbflg. SFB}

    if (iand(boot_msus.mtype, remote_boot_mask) = remote_boot_mask) then
      hfsbflg:=FALSE;

    if boot_id<3 then gread:=false
    else gread:=not boot_flags[7];

    if gread then newbytes(boot_space^.mbptr,boot_space^.mbsize );

  end; {initboot dam}

  procedure boottm(f:fibp; request: amrequesttype;
		   anyvar buffer: window; bufsize,position: integer);
  begin
    if gread then
    begin
      with f^ do
      begin
	ioresult:=ord(inoerror);
	if request=readbytes then
	begin
	  if ((position+bufsize)>fpeof) or
	     (position<0)   then ioresult:=ord(znoblock)
	  else
	  if (position mod 256)<>0 then  ioresult:=ord(zbadmode)
	  else
	  begin
	    try
	      if hfsbflg then
		hfsread(position div 256,bufsize,buffer,false)
	      else
		boot_mread(position div 256,bufsize,buffer,false);
	    recover ioresult:=ord(escio(escapecode));
	  end;
	end
	else ioresult:=ord(zbadmode);
      end;{ with }
    end
    else begin
	 driverkey := false;
	 miniio(f,request,buffer,bufsize,position);
	 driverkey := true;
	 end;
  end;  { boottm }

function srmnode(sc: shortint): string6;      {upgraded for LANSRM. SFB 1/19/89}
  const scsize =  hex(' 10000'); nodecom = chr(128+6);
	command = hex('4003'); data    = hex('4005');
	dio_base = hex('600000');
	dio_id  = hex('1');  { LAF 850619 }
	LANLINKADDR = hex('C000');        {SFB 1/19/89}
	LANID   = 21;   {98643A DIO reg 1 ID. SFB}
	lookup='0123456789ABCDEF';
  type charptr = ^char;
  var bnode: string6;   {upgraded for LANSRM. SFB 1/19/89}
      node, i: integer;
      cardptr, addrptr: charptr;
  begin
    try
    (* if wrong card, pretend no card *)                      { LAF 850619 }
    (* DEW 09/29/88 Bug fix for DTS # FSDlg00560
       System does not recognize SRM card with remote switch set *)
    (* DEW 10/04/88 Fix compile error at turn time. *)
    cardptr:=anyptr(ord(sc*scsize+dio_base));
    if ord(charptr(ord(cardptr)+dio_id)^) mod 128 = 52 then
      begin
	charptr(ord(cardptr)+command)^ := nodecom;
	repeat until charptr(ord(cardptr)+command)^ = chr(0);
	node := ord(charptr(ord(cardptr)+data)^);
	if node < 10 then bnode := '0' else bnode := '';
	strwrite(bnode, strlen(bnode)+1, i, node:1);
	srmnode := bnode;
      end
    else        {see if it's 98643A; if so, put LAST 6 hex digits of its link
		 address into srmnode. SFB/RDQ 1/19/89}
      if (ord(charptr(ord(cardptr)+dio_id)^) mod 128) = LANID then
	begin
	  setstrlen(bnode,6);
	  addrptr:=addr(cardptr^,LANLINKADDR+1);
	  if (ord(addrptr^) mod 16) + (ord(charptr(addr(addrptr^,2))^) mod 16) <> 0 then
	    addrptr:=addr(addrptr^, hex('40')); {second bank}
	  addrptr:=addr(addrptr^, 8 + 12 {skip longword + first 6 digits});
	  for i:=1 to 6 do
	    begin
	      bnode[i]:=lookup[(ord(addrptr^) mod 16)+1];
	      addrptr:=addr(addrptr^,2);
	    end;
	  srmnode := bnode;
	end
      else
	escape(-12);
    recover if escapecode = -12 then srmnode := '' else escape(escapecode);
  end;

  function bootnode: string6;      {upgraded for LANSRM. SFB 1/19/89}
  const srmtype = 7*32+1 {$E1};
	lantype = hex('E2');
  begin
  bootnode := '';
  if gread then with boot_msus do
    if (mtype = srmtype) or (mtype = lantype) then bootnode := srmnode(mscode);
  end;


  function bootname(fullname: string20; shortlen: shortint): string20;
  var
    shortversion: boolean;
    suffix: string20;
    ans: string20;
    i, j: shortint;
  {----------------}
  {
  { Find system suffix.
  { SYSTEM_P -> ''
  { SYSTEM_xxx -> 'xxx'
  { SYSxxxxxxx -> 'xxxxxxx'
  { anything else -> ''
  }
  procedure getsyssuffix;
  type stringsysp = packed array[1..10] of char;
  const sysp      = stringsysp['SYSTEM_P'];
  var
    i,j,k: shortint;
  begin
   { normalize sysname; HFS boot can put nulls in it }
   for i := 1 to 10 do if sysname[i] = #0 then sysname[i] := ' ';
   i := 0;
   { find first place where user sys name different from SYSTEM_P }
   repeat i := i + 1; until (i=10) or (sysname[i]<>sysp[i]);
   setstrlen(suffix, 0);
   shortversion := false;
   if (i = 10) or (i <= 3) then
     { user system name is SYSTEM_P, or something too strange }
     { suffix = '' }
   else begin
     shortversion := true;
     if i > 7 then
       { SYSTEM_xxx }
       i := 8
     else
       { SYSxxxxxxx }
       i := 4;
     k := 1;
     for j := i to 10 do
       if sysname[j] <> ' ' then begin
	 setstrlen(suffix, k);
	 suffix[k] := sysname[j];
	 k := k + 1;
       end;
   end;
  end;
  {----------------}
  begin
    ans := fullname;
    getsyssuffix;
    if shortversion then
      setstrlen(ans, shortlen);
    i := strlen(ans);
    for j := 1 to strlen(suffix) do
      begin i:=i+1; setstrlen(ans, i); ans[i]:=suffix[j]; end;
    bootname := ans;
  end;



end     { module }


@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 397
module bootdammodule;
import sysglobals,asm,mini,hfsboot;
export

  type string2=string[2];
       string6=string[6];       {added for LANSRM node lengths. SFB 1/19/89}
       string20=string[20];

  var nodestr: string[50];
      { hfsbflg tells whether we are booting from an HFS disc }
      hfsbflg['HFSBFLG']: boolean;

  procedure initbootdam;
  procedure bootdam(anyvar f:fib; unum:unitnum; request:damrequesttype);
  procedure boottm(f:fibp; request: amrequesttype;
		      anyvar buffer: window; bufsize,position: integer);
  function srmnode(sc: shortint): string6;      {upgraded for LANSRM. SFB 1/19/89}
  function bootnode: string6;                   {upgraded for LANSRM. SFB 1/19/89}
  function bootname(fullname: string20; shortlen: shortint): string20;

implement

  type

    strptr = ^string255;
    lifname  = packed array[1..10] of char;
    word15   = 0..32767;
    bcd      = 0..15;
    tdate    = packed array[1..12] of bcd;
    direntryp= ^direntry;
    direntry = packed record
		 fname    : lifname;
		 ftype    : shortint;
		 fstart   : integer;
		 fsize    : integer;
		 fdate    : tdate;
		 lastvol  : boolean;
		 volnumber: word15;
		 extension: integer;
	       end;

    msustype = packed record
		 mtype : byte;
		 munit : byte;
		 mscode: byte;
		 maddr : byte;
	       end;
  var
    driverkey  [-293  {$FFFFFEDB}]: boolean;
    boot_msus  [-292  {$FFFFFEDC}]: msustype;
    boot_id    [16382 {$    3FFE}]: shortint;
    boot_flags [16380 {$    3FFC}]: packed array[0..7] of boolean;

    gread        : boolean;

    {  FUNCTIONS AND PROCEDURES USED FROM THE BOOT ROM  }
  procedure boot_lifhead(var dsize,dstart:integer); external;
  procedure boot_findfile(var entry:direntryp; var lname:lifname;
						    dl,ds : integer); external;
  function boot_minit(msus:msustype):boolean; external;
  function boot_mfopen(anyvar fname:string255; var xaddr,length:integer;
		       var ftype:shortint):boolean; external;
  procedure boot_mfclose; external;
  procedure boot_mread(sector,bytecount: integer;
		       anyvar buffer:window; media:boolean); external;

  function escio(escn:integer):iorsltwd;
  begin
    case escn of
    1,7 : escio:=znodevice;
    2   : escio:=znomedium;
    3   : escio:=znotready;
    4   : escio:=zbadblock;
    5   : escio:=zbadhardware;
    6   : escio:=zcatchall;
    otherwise  escape(escn);
    end; { case }
  end;

  procedure bootdam(anyvar f:fib; unum:unitnum; request:damrequesttype);
  var
    ftype       : shortint;
    fk          : filekind;
    dstart      : integer;
    dsize       : integer;
    dentry      : direntryp;
    i,j         : integer;

    procedure escesc(ecode:integer);
    var
      tempec      : integer;
    begin { convert mini driver escape code to general code}
      if ecode<=0 then escape(ecode);
      if ecode = 1 then ioresult := ord(ibadtitle);
      tempec:=ecode mod 1000;
      if tempec=80 then escape(2)     { no medium }
      else if tempec=90 then escape(6){ bad error state }
	   else escape(4);            { read error }
    end;

    function minit(msus:msustype):boolean;
    var
      tempec              : integer;
    begin
      if gread then minit:=boot_minit(msus)
      else
      begin
      try
	minit:=true;
	driverkey := false;
	boot_lifhead(dsize,dstart);
	driverkey := true;
      recover begin
	      driverkey := true;
	      if escapecode=-1 then minit:=false
			       else escesc(escapecode);
	      end;
      end;
    end;

    function mfopen(anyvar fname:string255; var xaddr,length:integer;
		    var ftype:shortint):boolean;
    var
      tfname      : lifname;
      i           : integer;
      fk, fkind   : filekind;
    begin
      if gread then
	if hfsbflg then
	  { booting from HFS }
	  mfopen:=hfsopen(fname,xaddr,length,ftype)
	else
	  { not HFS, so boot ROM can handle it }
	  mfopen:=boot_mfopen(fname,xaddr,length,ftype)
      else
      begin
      try
	mfopen:=true;
	if (strlen(fname)=0) or (strlen(fname)>10) then escape(1);
	for i:=1 to 10 do
	  if i>strlen(fname) then tfname[i]:=' ' else tfname[i]:=fname[i];

	driverkey := false;
	boot_findfile(dentry,tfname,dsize,dstart);
	driverkey := true;

	fkind:=datafile;  ftype:=dentry^.ftype;
	for fk:=lastfkind downto untypedfile do
	  if efttable^[fk]=ftype then fkind:=fk;
	if fkind=sysfile then xaddr:=dentry^.extension
			 else xaddr:=0;
	if fkind=datafile then length:=dentry^.extension
			  else length:=dentry^.fsize*256;
      recover
	begin
	  driverkey := true;
	  mfopen:=false;
	  if escapecode<>-1 then escesc(escapecode);
	end;
      end;
    end;

    procedure mfclose;
    begin
      if gread then boot_mfclose;
    end;

  begin { bootdam }
    ioresult:=ord(inoerror);
    case request of
    getvolumename:  strptr(addr(f))^ := '"BOOT_DEVICE"';
    openfile:
      try
	j := 0;
	for i := 1 to strlen(f.ftitle) do if f.ftitle[i] = '/' then j := i;
	if strlen(f.ftitle)-j>tidleng then f.ftid := ''
	else begin
	     setstrlen(f.ftid, strlen(f.ftitle)-j);
	     for i := 1 to strlen(f.ftid) do f.ftid[i] := f.ftitle[j+i];
	     end;
	if minit(boot_msus) then
	begin
	  ftype:=-1;
	  if mfopen(f.ftitle,f.fstartaddress,f.fpeof,ftype) then
	  begin
	    f.fkind:=datafile;
	    for fk:=lastfkind downto untypedfile do
		   if efttable^[fk]=ftype then f.fkind:=fk;
	    if gread then f.fileid := 0
		     else f.fileid := dentry^.fstart*256;
	    f.fleof:=f.fpeof;       f.fisnew:=false;
	    if not f.fbuffered then f.am:=amtable^[UNTYPEDFILE]
	    else f.am:=amtable^[f.fkind];
	  end
	  else ioresult:=ord(inofile);
	end
	else with boot_msus do
	  ioresult:=ord(inounit);
      recover ioresult:=ord(escio(escapecode));
    closefile:
      try
	mfclose;
      recover ioresult:=ord(escio(escapecode));
    otherwise
      ioresult:=ord(ibadrequest);
    end; {case request}
  end; { bootdam }

  procedure initbootdam;
  type
    lrec = packed record
	     pad   : packed array[0..15] of char;
	     mbptr : ^char;     { offset 16 }
	     mbsize: integer;   { offset 20 }
	   end;
  const
    remote_boot_mask = binary('11100000');      {for validating hfsbflg. SFB}
  var
    boot_space  [-300]:^lrec;
  begin
    {Added a check to see that hfsbflg is correct, and correct it if it is not.
     Note that the startup and relocation code sets hfsbflg if we had to
     relocate before kicking off the system. Actually relocating means we did
     not boot directly from the BOOTROM, not that we booted from HFS.
     Usually, relocating just means that we booted through HP-UX's secondary
     loader. This could happen either as an HFS boot, or as a HPUX bootserver
     load. To check this, check the boot_msus first byte. If the upper 3 bits
     are 111, we booted through a "special" interface, and could not have
     booted from HFS, so clear hfsbflg. SFB}

    if (iand(boot_msus.mtype, remote_boot_mask) = remote_boot_mask) then
      hfsbflg:=FALSE;

    if boot_id<3 then gread:=false
    else gread:=not boot_flags[7];

    if gread then newbytes(boot_space^.mbptr,boot_space^.mbsize );

  end; {initboot dam}

  procedure boottm(f:fibp; request: amrequesttype;
		   anyvar buffer: window; bufsize,position: integer);
  begin
    if gread then
    begin
      with f^ do
      begin
	ioresult:=ord(inoerror);
	if request=readbytes then
	begin
	  if ((position+bufsize)>fpeof) or
	     (position<0)   then ioresult:=ord(znoblock)
	  else
	  if (position mod 256)<>0 then  ioresult:=ord(zbadmode)
	  else
	  begin
	    try
	      if hfsbflg then
		hfsread(position div 256,bufsize,buffer,false)
	      else
		boot_mread(position div 256,bufsize,buffer,false);
	    recover ioresult:=ord(escio(escapecode));
	  end;
	end
	else ioresult:=ord(zbadmode);
      end;{ with }
    end
    else begin
	 driverkey := false;
	 miniio(f,request,buffer,bufsize,position);
	 driverkey := true;
	 end;
  end;  { boottm }

function srmnode(sc: shortint): string6;      {upgraded for LANSRM. SFB 1/19/89}
  const scsize =  hex(' 10000'); nodecom = chr(128+6);
	command = hex('4003'); data    = hex('4005');
	dio_base = hex('600000');
	dio_id  = hex('1');  { LAF 850619 }
	LANLINKADDR = hex('C000');        {SFB 1/19/89}
	LANID   = 21;   {98643A DIO reg 1 ID. SFB}
	lookup='0123456789ABCDEF';
  type charptr = ^char;
  var bnode: string6;   {upgraded for LANSRM. SFB 1/19/89}
      node, i: integer;
      cardptr, addrptr: charptr;
  begin
    try
    (* if wrong card, pretend no card *)                      { LAF 850619 }
    (* DEW 09/29/88 Bug fix for DTS # FSDlg00560
       System does not recognize SRM card with remote switch set *)
    (* DEW 10/04/88 Fix compile error at turn time. *)
    cardptr:=anyptr(ord(sc*scsize+dio_base));
    if ord(charptr(ord(cardptr)+dio_id)^) mod 128 = 52 then
      begin
	charptr(ord(cardptr)+command)^ := nodecom;
	repeat until charptr(ord(cardptr)+command)^ = chr(0);
	node := ord(charptr(ord(cardptr)+data)^);
	if node < 10 then bnode := '0' else bnode := '';
	strwrite(bnode, strlen(bnode)+1, i, node:1);
	srmnode := bnode;
      end
    else        {see if it's 98643A; if so, put LAST 6 hex digits of its link
		 address into srmnode. SFB/RDQ 1/19/89}
      if (ord(charptr(ord(cardptr)+dio_id)^) mod 128) = LANID then
	begin
	  setstrlen(bnode,6);
	  addrptr:=addr(cardptr^,LANLINKADDR+1);
	  if (ord(addrptr^) mod 16) + (ord(charptr(addr(addrptr^,2))^) mod 16) <> 0 then
	    addrptr:=addr(addrptr^, hex('40')); {second bank}
	  addrptr:=addr(addrptr^, 8 + 12 {skip longword + first 6 digits});
	  for i:=1 to 6 do
	    begin
	      bnode[i]:=lookup[(ord(addrptr^) mod 16)+1];
	      addrptr:=addr(addrptr^,2);
	    end;
	  srmnode := bnode;
	end
      else
	escape(-12);
    recover if escapecode = -12 then srmnode := '' else escape(escapecode);
  end;

  function bootnode: string6;      {upgraded for LANSRM. SFB 1/19/89}
  const srmtype = 7*32+1 {$E1};
	lantype = hex('E2');
  begin
  bootnode := '';
  if gread then with boot_msus do
    if (mtype = srmtype) or (mtype = lantype) then bootnode := srmnode(mscode);
  end;


  function bootname(fullname: string20; shortlen: shortint): string20;
  var
    shortversion: boolean;
    suffix: string20;
    ans: string20;
    i, j: shortint;
  {----------------}
  {
  { Find system suffix.
  { SYSTEM_P -> ''
  { SYSTEM_xxx -> 'xxx'
  { SYSxxxxxxx -> 'xxxxxxx'
  { anything else -> ''
  }
  procedure getsyssuffix;
  type stringsysp = packed array[1..10] of char;
  const sysp      = stringsysp['SYSTEM_P'];
  var
    i,j,k: shortint;
  begin
   { normalize sysname; HFS boot can put nulls in it }
   for i := 1 to 10 do if sysname[i] = #0 then sysname[i] := ' ';
   i := 0;
   { find first place where user sys name different from SYSTEM_P }
   repeat i := i + 1; until (i=10) or (sysname[i]<>sysp[i]);
   setstrlen(suffix, 0);
   shortversion := false;
   if (i = 10) or (i <= 3) then
     { user system name is SYSTEM_P, or something too strange }
     { suffix = '' }
   else begin
     shortversion := true;
     if i > 7 then
       { SYSTEM_xxx }
       i := 8
     else
       { SYSxxxxxxx }
       i := 4;
     k := 1;
     for j := i to 10 do
       if sysname[j] <> ' ' then begin
	 setstrlen(suffix, k);
	 suffix[k] := sysname[j];
	 k := k + 1;
       end;
   end;
  end;
  {----------------}
  begin
    ans := fullname;
    getsyssuffix;
    if shortversion then
      setstrlen(ans, shortlen);
    i := strlen(ans);
    for j := 1 to strlen(suffix) do
      begin i:=i+1; setstrlen(ans, i); ans[i]:=suffix[j]; end;
    bootname := ans;
  end;



end     { module }


@


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 397
@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@a0 397
module bootdammodule;
import sysglobals,asm,mini,hfsboot;
export

  type string2=string[2];
       string6=string[6];       {added for LANSRM node lengths. SFB 1/19/89}
       string20=string[20];

  var nodestr: string[50];
      { hfsbflg tells whether we are booting from an HFS disc }
      hfsbflg['HFSBFLG']: boolean;

  procedure initbootdam;
  procedure bootdam(anyvar f:fib; unum:unitnum; request:damrequesttype);
  procedure boottm(f:fibp; request: amrequesttype;
		      anyvar buffer: window; bufsize,position: integer);
  function srmnode(sc: shortint): string6;      {upgraded for LANSRM. SFB 1/19/89}
  function bootnode: string6;                   {upgraded for LANSRM. SFB 1/19/89}
  function bootname(fullname: string20; shortlen: shortint): string20;

implement

  type

    strptr = ^string255;
    lifname  = packed array[1..10] of char;
    word15   = 0..32767;
    bcd      = 0..15;
    tdate    = packed array[1..12] of bcd;
    direntryp= ^direntry;
    direntry = packed record
		 fname    : lifname;
		 ftype    : shortint;
		 fstart   : integer;
		 fsize    : integer;
		 fdate    : tdate;
		 lastvol  : boolean;
		 volnumber: word15;
		 extension: integer;
	       end;

    msustype = packed record
		 mtype : byte;
		 munit : byte;
		 mscode: byte;
		 maddr : byte;
	       end;
  var
    driverkey  [-293  {$FFFFFEDB}]: boolean;
    boot_msus  [-292  {$FFFFFEDC}]: msustype;
    boot_id    [16382 {$    3FFE}]: shortint;
    boot_flags [16380 {$    3FFC}]: packed array[0..7] of boolean;

    gread        : boolean;

    {  FUNCTIONS AND PROCEDURES USED FROM THE BOOT ROM  }
  procedure boot_lifhead(var dsize,dstart:integer); external;
  procedure boot_findfile(var entry:direntryp; var lname:lifname;
						    dl,ds : integer); external;
  function boot_minit(msus:msustype):boolean; external;
  function boot_mfopen(anyvar fname:string255; var xaddr,length:integer;
		       var ftype:shortint):boolean; external;
  procedure boot_mfclose; external;
  procedure boot_mread(sector,bytecount: integer;
		       anyvar buffer:window; media:boolean); external;

  function escio(escn:integer):iorsltwd;
  begin
    case escn of
    1,7 : escio:=znodevice;
    2   : escio:=znomedium;
    3   : escio:=znotready;
    4   : escio:=zbadblock;
    5   : escio:=zbadhardware;
    6   : escio:=zcatchall;
    otherwise  escape(escn);
    end; { case }
  end;

  procedure bootdam(anyvar f:fib; unum:unitnum; request:damrequesttype);
  var
    ftype       : shortint;
    fk          : filekind;
    dstart      : integer;
    dsize       : integer;
    dentry      : direntryp;
    i,j         : integer;

    procedure escesc(ecode:integer);
    var
      tempec      : integer;
    begin { convert mini driver escape code to general code}
      if ecode<=0 then escape(ecode);
      if ecode = 1 then ioresult := ord(ibadtitle);
      tempec:=ecode mod 1000;
      if tempec=80 then escape(2)     { no medium }
      else if tempec=90 then escape(6){ bad error state }
	   else escape(4);            { read error }
    end;

    function minit(msus:msustype):boolean;
    var
      tempec              : integer;
    begin
      if gread then minit:=boot_minit(msus)
      else
      begin
      try
	minit:=true;
	driverkey := false;
	boot_lifhead(dsize,dstart);
	driverkey := true;
      recover begin
	      driverkey := true;
	      if escapecode=-1 then minit:=false
			       else escesc(escapecode);
	      end;
      end;
    end;

    function mfopen(anyvar fname:string255; var xaddr,length:integer;
		    var ftype:shortint):boolean;
    var
      tfname      : lifname;
      i           : integer;
      fk, fkind   : filekind;
    begin
      if gread then
	if hfsbflg then
	  { booting from HFS }
	  mfopen:=hfsopen(fname,xaddr,length,ftype)
	else
	  { not HFS, so boot ROM can handle it }
	  mfopen:=boot_mfopen(fname,xaddr,length,ftype)
      else
      begin
      try
	mfopen:=true;
	if (strlen(fname)=0) or (strlen(fname)>10) then escape(1);
	for i:=1 to 10 do
	  if i>strlen(fname) then tfname[i]:=' ' else tfname[i]:=fname[i];

	driverkey := false;
	boot_findfile(dentry,tfname,dsize,dstart);
	driverkey := true;

	fkind:=datafile;  ftype:=dentry^.ftype;
	for fk:=lastfkind downto untypedfile do
	  if efttable^[fk]=ftype then fkind:=fk;
	if fkind=sysfile then xaddr:=dentry^.extension
			 else xaddr:=0;
	if fkind=datafile then length:=dentry^.extension
			  else length:=dentry^.fsize*256;
      recover
	begin
	  driverkey := true;
	  mfopen:=false;
	  if escapecode<>-1 then escesc(escapecode);
	end;
      end;
    end;

    procedure mfclose;
    begin
      if gread then boot_mfclose;
    end;

  begin { bootdam }
    ioresult:=ord(inoerror);
    case request of
    getvolumename:  strptr(addr(f))^ := '"BOOT_DEVICE"';
    openfile:
      try
	j := 0;
	for i := 1 to strlen(f.ftitle) do if f.ftitle[i] = '/' then j := i;
	if strlen(f.ftitle)-j>tidleng then f.ftid := ''
	else begin
	     setstrlen(f.ftid, strlen(f.ftitle)-j);
	     for i := 1 to strlen(f.ftid) do f.ftid[i] := f.ftitle[j+i];
	     end;
	if minit(boot_msus) then
	begin
	  ftype:=-1;
	  if mfopen(f.ftitle,f.fstartaddress,f.fpeof,ftype) then
	  begin
	    f.fkind:=datafile;
	    for fk:=lastfkind downto untypedfile do
		   if efttable^[fk]=ftype then f.fkind:=fk;
	    if gread then f.fileid := 0
		     else f.fileid := dentry^.fstart*256;
	    f.fleof:=f.fpeof;       f.fisnew:=false;
	    if not f.fbuffered then f.am:=amtable^[UNTYPEDFILE]
	    else f.am:=amtable^[f.fkind];
	  end
	  else ioresult:=ord(inofile);
	end
	else with boot_msus do
	  ioresult:=ord(inounit);
      recover ioresult:=ord(escio(escapecode));
    closefile:
      try
	mfclose;
      recover ioresult:=ord(escio(escapecode));
    otherwise
      ioresult:=ord(ibadrequest);
    end; {case request}
  end; { bootdam }

  procedure initbootdam;
  type
    lrec = packed record
	     pad   : packed array[0..15] of char;
	     mbptr : ^char;     { offset 16 }
	     mbsize: integer;   { offset 20 }
	   end;
  const
    remote_boot_mask = binary('11100000');      {for validating hfsbflg. SFB}
  var
    boot_space  [-300]:^lrec;
  begin
    {Added a check to see that hfsbflg is correct, and correct it if it is not.
     Note that the startup and relocation code sets hfsbflg if we had to
     relocate before kicking off the system. Actually relocating means we did
     not boot directly from the BOOTROM, not that we booted from HFS.
     Usually, relocating just means that we booted through HP-UX's secondary
     loader. This could happen either as an HFS boot, or as a HPUX bootserver
     load. To check this, check the boot_msus first byte. If the upper 3 bits
     are 111, we booted through a "special" interface, and could not have
     booted from HFS, so clear hfsbflg. SFB}

    if (iand(boot_msus.mtype, remote_boot_mask) = remote_boot_mask) then
      hfsbflg:=FALSE;

    if boot_id<3 then gread:=false
    else gread:=not boot_flags[7];

    if gread then newbytes(boot_space^.mbptr,boot_space^.mbsize );

  end; {initboot dam}

  procedure boottm(f:fibp; request: amrequesttype;
		   anyvar buffer: window; bufsize,position: integer);
  begin
    if gread then
    begin
      with f^ do
      begin
	ioresult:=ord(inoerror);
	if request=readbytes then
	begin
	  if ((position+bufsize)>fpeof) or
	     (position<0)   then ioresult:=ord(znoblock)
	  else
	  if (position mod 256)<>0 then  ioresult:=ord(zbadmode)
	  else
	  begin
	    try
	      if hfsbflg then
		hfsread(position div 256,bufsize,buffer,false)
	      else
		boot_mread(position div 256,bufsize,buffer,false);
	    recover ioresult:=ord(escio(escapecode));
	  end;
	end
	else ioresult:=ord(zbadmode);
      end;{ with }
    end
    else begin
	 driverkey := false;
	 miniio(f,request,buffer,bufsize,position);
	 driverkey := true;
	 end;
  end;  { boottm }

function srmnode(sc: shortint): string6;      {upgraded for LANSRM. SFB 1/19/89}
  const scsize =  hex(' 10000'); nodecom = chr(128+6);
	command = hex('4003'); data    = hex('4005');
	dio_base = hex('600000');
	dio_id  = hex('1');  { LAF 850619 }
	LANLINKADDR = hex('C000');        {SFB 1/19/89}
	LANID   = 21;   {98643A DIO reg 1 ID. SFB}
	lookup='0123456789ABCDEF';
  type charptr = ^char;
  var bnode: string6;   {upgraded for LANSRM. SFB 1/19/89}
      node, i: integer;
      cardptr, addrptr: charptr;
  begin
    try
    (* if wrong card, pretend no card *)                      { LAF 850619 }
    (* DEW 09/29/88 Bug fix for DTS # FSDlg00560
       System does not recognize SRM card with remote switch set *)
    (* DEW 10/04/88 Fix compile error at turn time. *)
    cardptr:=anyptr(ord(sc*scsize+dio_base));
    if ord(charptr(ord(cardptr)+dio_id)^) mod 128 = 52 then
      begin
	charptr(ord(cardptr)+command)^ := nodecom;
	repeat until charptr(ord(cardptr)+command)^ = chr(0);
	node := ord(charptr(ord(cardptr)+data)^);
	if node < 10 then bnode := '0' else bnode := '';
	strwrite(bnode, strlen(bnode)+1, i, node:1);
	srmnode := bnode;
      end
    else        {see if it's 98643A; if so, put LAST 6 hex digits of its link
		 address into srmnode. SFB/RDQ 1/19/89}
      if (ord(charptr(ord(cardptr)+dio_id)^) mod 128) = LANID then
	begin
	  setstrlen(bnode,6);
	  addrptr:=addr(cardptr^,LANLINKADDR+1);
	  if (ord(addrptr^) mod 16) + (ord(charptr(addr(addrptr^,2))^) mod 16) <> 0 then
	    addrptr:=addr(addrptr^, hex('40')); {second bank}
	  addrptr:=addr(addrptr^, 8 + 12 {skip longword + first 6 digits});
	  for i:=1 to 6 do
	    begin
	      bnode[i]:=lookup[(ord(addrptr^) mod 16)+1];
	      addrptr:=addr(addrptr^,2);
	    end;
	  srmnode := bnode;
	end
      else
	escape(-12);
    recover if escapecode = -12 then srmnode := '' else escape(escapecode);
  end;

  function bootnode: string6;      {upgraded for LANSRM. SFB 1/19/89}
  const srmtype = 7*32+1 {$E1};
	lantype = hex('E2');
  begin
  bootnode := '';
  if gread then with boot_msus do
    if (mtype = srmtype) or (mtype = lantype) then bootnode := srmnode(mscode);
  end;


  function bootname(fullname: string20; shortlen: shortint): string20;
  var
    shortversion: boolean;
    suffix: string20;
    ans: string20;
    i, j: shortint;
  {----------------}
  {
  { Find system suffix.
  { SYSTEM_P -> ''
  { SYSTEM_xxx -> 'xxx'
  { SYSxxxxxxx -> 'xxxxxxx'
  { anything else -> ''
  }
  procedure getsyssuffix;
  type stringsysp = packed array[1..10] of char;
  const sysp      = stringsysp['SYSTEM_P'];
  var
    i,j,k: shortint;
  begin
   { normalize sysname; HFS boot can put nulls in it }
   for i := 1 to 10 do if sysname[i] = #0 then sysname[i] := ' ';
   i := 0;
   { find first place where user sys name different from SYSTEM_P }
   repeat i := i + 1; until (i=10) or (sysname[i]<>sysp[i]);
   setstrlen(suffix, 0);
   shortversion := false;
   if (i = 10) or (i <= 3) then
     { user system name is SYSTEM_P, or something too strange }
     { suffix = '' }
   else begin
     shortversion := true;
     if i > 7 then
       { SYSTEM_xxx }
       i := 8
     else
       { SYSxxxxxxx }
       i := 4;
     k := 1;
     for j := i to 10 do
       if sysname[j] <> ' ' then begin
	 setstrlen(suffix, k);
	 suffix[k] := sysname[j];
	 k := k + 1;
       end;
   end;
  end;
  {----------------}
  begin
    ans := fullname;
    getsyssuffix;
    if shortversion then
      setstrlen(ans, shortlen);
    i := strlen(ans);
    for j := 1 to strlen(suffix) do
      begin i:=i+1; setstrlen(ans, i); ans[i]:=suffix[j]; end;
    bootname := ans;
  end;



end     { module }


@


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.2
log
@changes made to support SRM-UX
RDQ 9 may 89

@
text
@@


36.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@d6 1
d17 2
a18 2
  function srmnode(sc: shortint): string2;
  function bootnode: string2;
d275 1
a275 1
  function srmnode(sc: shortint): string2;
d277 6
a282 2
	command = hex('604003'); data    = hex('604005');
	dio_id  = hex('600001');  { LAF 850619 }
d284 1
a284 1
  var bnode: string2;
d286 1
d293 28
a320 8
    if (ord(charptr(ord(sc*scsize+dio_id))^) mod 128) <> 52
       then escape(-12);  { LAF 850619 }
    charptr(ord(sc*scsize+command))^ := nodecom;
    repeat until charptr(ord(sc*scsize+command))^ = chr(0);
    node := ord(charptr(ord(sc*scsize+data))^);
    if node < 10 then bnode := '0' else bnode := '';
    strwrite(bnode, strlen(bnode)+1, i, node:1);
    srmnode := bnode;
d324 3
a326 2
  function bootnode: string2;
  const srmtype = 7*32+1;
d330 1
a330 1
    if mtype = srmtype then bootnode := srmnode(mscode);
@


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.3
log
@Quick fix at system turn time for compile error on remote SRM bit fix.
DEW 10/04/88
@
text
@@


27.2
log
@Fixed DTS bug #FSDlg00560.
Couldn't boot with remote SRM card.
@
text
@d286 2
a287 1
    if ((charptr(ord(sc*scsize+dio_id))^) mod 128) <> chr(52)
@


27.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@d283 5
a287 2
    (* if wrong card, pretend no card *)                             { LAF 850619 }
    if charptr(ord(sc*scsize+dio_id))^ <> chr(52) then escape(-12);  { LAF 850619 }
@


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.2
log
@Corrected hfsbflg for LAN bootserver support.
@
text
@@


15.1
log
@Automatic bump of revision number for PWS version 3.2H
@
text
@d215 2
d220 13
@


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.2
log
@Fixes for FSDat00599
@
text
@@


9.1
log
@Automatic bump of revision number for PWS version 3.2B
@
text
@d6 1
d18 1
d286 62
@


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.5
log
@Export hfsbflg.  Remove hfsversion, as there is now only one version.
Import HFSBOOT instead of decalring its routines external.
@
text
@@


2.4
log
@Die gracefully if try to boot non-HFS system from HFS disc.
@
text
@d2 1
a2 1
import sysglobals,asm,mini;
d8 2
a19 3
  const
    hfsversion = false;

a49 2
    { hfsbflg tells whether we are booting from an HFS disc }
    hfsbflg    ['HFSBFLG']:         shortint;
a63 8
$if hfsversion$
  { HFS boot routines, from module hfsboot }
  function hfsboot_hfsopen(anyvar fname:string255; var xaddr,length:integer;
		       var ftype:shortint):boolean; external;
  procedure hfsboot_hfsread(sector,bytecount: integer;
		       anyvar buffer:window; media:boolean); external;
$end$

d126 3
a128 9
	if hfsbflg <> 0 then
$if hfsversion$
	  { boot from HFS }
	  mfopen:=hfsboot_hfsopen(fname,xaddr,length,ftype)
$end$
$if not hfsversion$
	  { die gracefully }
	  noboot
$end$
d130 1
d240 2
a241 3
$if hfsversion$
	      if hfsbflg <> 0 then
		hfsboot_hfsread(position div 256,bufsize,buffer,false)
d243 1
a243 2
$end$
	      boot_mread(position div 256,bufsize,buffer,false);
@


2.3
log
@hfsbflg no longer a boolean, but a shortint which when non-zero
counts calls to hfsopen.
@
text
@a50 1
$if hfsversion$
a51 1
    { 0 -- not HFS; <> 0 -- counts calls to hfsopen         }
a52 1
$end$
d137 1
d139 1
a139 1
	if hfsbflg <> 0 then
d141 5
d147 1
a147 2
$end$
      mfopen:=boot_mfopen(fname,xaddr,length,ftype)
@


2.2
log
@Inserted hooks to hfs boot dam.  These are activated only when the
constant "hfsversion", default false, is set to true.
@
text
@d53 2
a54 1
    hfsbflg    ['HFSBFLG']:         boolean;
d141 1
a141 1
	if hfsbflg then
d255 1
a255 1
	      if hfsbflg then
@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@d17 4
d51 4
d69 8
d138 7
a144 1
      if gread then mfopen:=boot_mfopen(fname,xaddr,length,ftype)
d253 5
@


1.1
log
@Initial revision
@
text
@@
