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


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

55.1
date     91.08.25.10.15.24;  author jwh;  state Exp;
branches ;
next     54.1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

3.1
date     86.09.01.11.37.26;  author hal;  state Exp;
branches ;
next     1.1;

1.1
date     86.08.29.12.41.18;  author hal;  state tmp;
branches ;
next     ;


desc
@Base file for PWS 3.2 release.

@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@$modcal$
{
{ Read the hp-ux booter off a disk.
{ Write an assembler file with the boot image.
{ This assembler file is linked into MKHFS.
{ Names:
{       booter input: supplied by user when this prog is run
{       assembler output: BOOTASM
{       name of size: bootasm_size
{       name of data start: bootasm_start
}

program mkboot(input, output);

label
    555, 999;


{----------------------------------------------------------------}
module raw;
import sysglobals, fs;

export

function volopen(var volname: string255; mode: integer): integer;
function volread(f: integer; buf: windowp; count: integer): integer;
function volwrite(f: integer; buf: windowp; count: integer): integer;
function vollseek(f: integer; pos: integer; mode: integer): integer;

implement

var
  tempfib: fibp;
  dummywindow: shortint;
  position: array [unitnum] of integer;

{
{ read from the volume to buf
}
function volread(f: integer; buf: windowp; count: integer): integer;
var
  i: integer;
begin
  tempfib^.funit := f;
  call(unitable^[f].tm, tempfib, readbytes, buf^, count, position[f]);
  position[f] := position[f] + count;
  i := ioresult;
  if i <> 0 then begin
    writeln('readbytes ioresult ', i);
    volread := -1;
  end
  else volread := count;
end;

{
{ write from buf to the volume
}
function volwrite(f: integer; buf: windowp; count: integer): integer;
var
  i: integer;
begin
  tempfib^.funit := f;
  call(unitable^[f].tm, tempfib, writebytes, buf^, count, position[f]);
  position[f] := position[f] + count;
  i := ioresult;
  if i <> 0 then begin
    writeln('writebytes ioresult ', i);
    volwrite := -1;
  end
  else volwrite := count;
end;

{
{ open the volume
}
function volopen(var volname: string255; mode: integer): integer;
label
  999;
var
  i, volume, retval: integer;
  fvid: vid;
  ftitle: fid;
  fsegs: integer;
  fkind: filekind;
begin
  retval := -1;

  { legal file name? }
  if not scantitle(volname, fvid, ftitle, fsegs, fkind) then
    goto 999;

  { just a volume id? }
  if ftitle <> '' then goto 999;

  { get volume number }
  volume := findvolume(fvid, TRUE);
  if (volume = 0) then goto 999;

  { and set up the unit }
  new(tempfib);
  finitb(tempfib^, addr(dummywindow), 1);
  with tempfib^ do begin
      pathid := 0;
      funit  := volume;
      call(unitable^[volume].dam, tempfib^, volume, openunit);
      i := ioresult;
      freadable  := true;
      fwriteable := true;
      feof       := false;
      feoln      := false;
  end;
  if i <> 0 then writeln('finitb ioresult ', i);
  position[volume] := 0;
  retval := volume;
999:
  volopen := retval;
end;

function vollseek(f: integer; pos: integer; mode: integer): integer;
begin
  position[f] := pos;
  vollseek := pos;
end;

end; {module raw}

import sysglobals, raw;

type
    vname = packed array[1..6] of char;
    lifname = packed array[1..10] of char;
    bcd = 0..15;
    word = 0..65535;
    integer16 = -32768..32767;
    word15 = 0..32767;
    tdate = packed array[1..12] of bcd;
    lvhdr = packed record
	discid: word;
	volname: vname;
	dstart: integer;
	dummy1: integer16;
	dummy2: integer16;
	dsize: integer;
	version: integer16;
	dummy3: integer16;
	tps: integer;
	spm: integer;
	spt: integer;
	cdate: tdate;
	filler: packed array[21..123] of integer16;
	sdate: tdate;
	dummy4: integer16;
    end;
    direntry = packed record
	fname: lifname;
	ftype: integer16;
	fstart: integer;
	fsize: integer;
	fdate: tdate;
	lastvol: boolean;
	volnumber: word15;
	extension: integer;
    end;

const
    SECTORSIZE = 256;
    LIFDISCID = 32768;
    LIFDUMMY1 = 4096;
    DPB = SECTORSIZE div sizeof(direntry);    { dir entries per block }
    HPUX_BOOT = -5822;
    NUMCOLS = 1;
    NUMLINES = SECTORSIZE div (sizeof(integer) * NUMCOLS);

var
    inname: string255;
    infile: file of char;
    outfile: text;
    hdr: lvhdr;
    dirblk: array[1..DPB] of direntry;
    bootblk: array[1..SECTORSIZE div sizeof(integer)] of integer;
    inunit: integer;
    result: integer;
    i, j: integer;
    bootstart, bootsize: integer;

procedure puthex(var f: text; i: integer);
const
    NUMDIGS = 8;
type
    trick = record
    case integer of
	0: (int: integer);
	1: (digs: packed array[1..NUMDIGS] of 0..15);
    end;
var
    t: trick;
    chars: string[16];
    j: integer;
begin
    t.int := i;
    chars := '0123456789ABCDEF';
    write(f, '$');
    for j := 1 to NUMDIGS do
	write(f, chars[1+t.digs[j]]);
end;

begin
    { get volume name }
    writeln('Read HP-UX booter from disk and produce disassembly for MKHFS.');
    writeln;
    write('Name of HFS volume with boot file to be copied? ');
    readln(inname);

    { open volume }
    inunit := volopen(inname, 0);
    if inunit < 0 then begin
	writeln('cannot open ', inname);
	goto 999;
    end;

    { get the lif volume header }
    result := volread(inunit, addr(hdr), SECTORSIZE);
    if (result <> SECTORSIZE) or (hdr.discid <> LIFDISCID)
    or (hdr.dummy1 <> LIFDUMMY1) then begin
	writeln('cannot find LIF header');
	goto 999;
    end;

    { find a directory entry for the booter }
    result := vollseek(inunit, hdr.dstart*SECTORSIZE, 0);
    for i := 1 to hdr.dsize do begin
	result := volread(inunit, addr(dirblk), SECTORSIZE);
	if result <> SECTORSIZE then begin
	    writeln('cannot read directory entry');
	    goto 999;
	end;
	for j := 1 to DPB do begin
	    if dirblk[j].ftype = -1 then begin
		writeln('no boot file in directory');
		goto 999;
	    end;
	    if dirblk[j].ftype = HPUX_BOOT then begin
		bootstart := dirblk[j].fstart * SECTORSIZE;
		bootsize := dirblk[j].fsize * SECTORSIZE;
		goto 555;
	    end;
	end;
    end;
    writeln('no boot file in directory');
    goto 999;

555:
    { set up output assembler file }
    rewrite(outfile, 'BOOTASM.TEXT');
    writeln(outfile, '* BOOTASM.TEXT');
    writeln(outfile, '* output of mkboot');
    writeln(outfile, '* copy of hpux boot program for MKHFS');
    writeln(outfile, '* bootasm_start -- start address');
    writeln(outfile, '* bootasm_size -- size of program');
    writeln(outfile, '* bootasm_fstart -- starting location on disk');
    writeln(outfile, ' def bootasm_size');
    writeln(outfile, 'bootasm_size equ *');
    writeln(outfile, ' dc.l ', bootsize:1);
    writeln(outfile, ' def bootasm_fstart');
    writeln(outfile, 'bootasm_fstart equ *');
    writeln(outfile, ' dc.l 3');
    writeln(outfile, ' def bootasm_start');
    writeln(outfile, 'bootasm_start equ *');

    { go to beginning of boot block }
    result := vollseek(inunit, bootstart, 0);

    { and copy it through }
    while bootsize > 0 do begin
	result := volread(inunit, addr(bootblk), SECTORSIZE);
	if result < 0 then begin
	    writeln('read error on boot file');
	    goto 999;
	end;
	bootsize := bootsize - SECTORSIZE;
	for i := 1 to NUMLINES do begin
	    write(outfile, ' dc.l ');
	    for j := 1 to NUMCOLS do begin
		puthex(outfile, bootblk[(i-1)*NUMCOLS+j]);
		if j <> NUMCOLS then write(outfile, ', ');
	    end;
	    writeln(outfile);
	end;
    end;
    writeln(outfile, ' end');
    close(outfile, 'save');
    writeln('done');

999:
end.

@


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


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


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.2
log
@Fix for FSDat00597 -- add bootasm_fstart symbol handling
@
text
@@


9.1
log
@Automatic bump of revision number for PWS version 3.2B
@
text
@d260 1
d264 3
@


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


1.1
log
@Initial revision
@
text
@@
