$CONTROL USLINIT,MAP,CODE,MAIN=MPEV'CONVERSION                          00020000
$control segment=mpev'conversion                                        00030000
begin                                                                   00040000
   <<  this program will perform the mpev conversion  >>                00050000
                                                                        00060000
   <<  the parm parameter has the following meanings  >>                00070000
   <<       0 - convert all tables                    >>                00080000
   <<  bit 15 - convert i/o tables (dvr/lpdt/ldt/dct) >>                00090000
   <<  bit 14 - convert cold load info                >>                00100000
   <<  bit 13 - convert rin table                     >>                00110000
   <<  bit 12 - build initial/sysdump comm table      >>                00120000
   <<  bit 11 - purge system utilities                >>                00130000
                                                                        00140000
define heading =                                                        00150000
  "MPE V/E Conversion Program (June 5, 1984)"#;                <<a8781>>00160000
                                                                        00170000
   equate sysdisc = 1;                                                  00180000
   equate read = 0;                                                     00190000
   equate write = 1;                                                    00200000
   define abs = absolute#;                                     <<v8273>>00210000
   define official'vuuff = "G.00.00" #;                        <<07989>>00220000
   entry convert,forwd,backwd,verify,help;                              00230000
   logical parm;                                                        00240000
   integer termfnum;                                           <<v8273>>00250000
   integer option'taken;                                                00260000
   integer system'type;                                                 00270000
   integer tablenr;  << the table we are currently converting >>        00280000
   real pausetime := 5.0;                                               00290000
   integer stat = q-1;                                                  00300000
   logical forward' := false;                                           00310000
   logical successful := false;                                         00320000
   double capability;                                                   00330000
   integer cap1 = capability;                                           00340000
   byte array logon(0:23);                                              00350000
   byte array acctname(*) = logon(8);                                   00360000
   byte array username(*) = logon;                                      00370000
   byte array groupname(*) = logon(16);                                 00380000
   double discadr;                                                      00390000
   double devfileadr;                                                   00400000
   integer length;                                                      00410000
   integer discadr1 = discadr, discadr2 = discadr+1;                    00420000
   integer array info(0:255);                                           00430000
   integer array newinfo(0:383);                                        00440000
   array ctab0(0:127);                                                  00450000
   integer array devrec0(0:255);                                        00460000
   array oldtable(0:6143);                                              00470000
   array newtable(0:7167);                                              00480000
   array dvrtab(*) = newtable;                                          00490000
   array ldt(*) = newtable;                                             00500000
   array ldtx(*) = newtable;                                            00510000
   array lpdt(*) = newtable;                                            00520000
   array class(*) = newtable;                                           00530000
   array rin(*) = newtable;                                             00540000
   integer array rin'(*) = db+0;                                        00550000
   integer pointer                                                      00560000
      poldtable,                                                        00570000
      pclass;                                                           00580000
   byte pointer                                                         00590000
      bpoldtable;                                                       00600000
   integer nrofclassents;                                               00610000
   integer error;                                                       00620000
   integer highestldev;                                                 00630000
   integer highestdrt;                                                  00640000
   integer nrcsdvr; << nr. of cs add'l drivers >>                       00650000
   integer cnt;                                                         00660000
   integer index, index2, dvr'index;                                    00670000
   integer ldt'index;                                                   00680000
   byte array conffile(0:27) := "CONFDATA.PUB.SYS ";                    00690000
   byte array devfile(0:27) := "DEVDATA.PUB.SYS ";                      00700000
   byte array assocfile(0:27) := "ASOCIATE.PUB.SYS ";          <<a8781>>00710000
   array line(0:35);                                                    00720000
   byte array bline(*) = line;                                          00730000
   integer conffnum;                                                    00740000
   integer devfnum;                                                     00750000
   integer                                                              00760000
      nrrins,                                                           00770000
      dsegnr;                                                           00780000
   integer array                                               <<v8273>>00790000
      address(0:128) := 129(0);                                <<v8273>>00800000
   double                                                      <<v8273>>00810000
      bank0needed := 0d,                                       <<v8273>>00820000
      amtmemneeded := 0d;                                      <<v8273>>00830000
   integer                                                     <<v8273>>00840000
      bank0,                                                   <<v8273>>00850000
      num'banks;                                               <<v8273>>00860000
                                                                        00870000
   equate                                                               00880000
      ccg   = 0,                                                        00890000
      ccl   = 1,                                                        00900000
      cce   = 2;                                                        00910000
   define                                                               00920000
      cc    = stat.(6:2)#;                                              00930000
   equate                                                               00940000
      xx = 0; <<*********** missing msg ************>>                  00950000
   equate                                                               00960000
      infodvr        =  0,                                              00970000
      infoctab0      =  1,                                              00980000
      infoctab       =  2,                                              00990000
      infocsdvr      =  3,                                              01000000
      infocsdef      =  4,                                              01010000
      infocstab      =  5,                                              01020000
      infolpdt       =  6,                                              01030000
      infoldt        =  7,                                              01040000
      infoclass      =  8,                                              01050000
      infovtab       =  9,                                              01060000
      infoldtx       = 10,                                              01070000
      infostack      = 11,                                              01080000
      infodcth       = 12,                                              01090000
      infottdt       = 13,                                              01100000
      inforin        = 15; << this isn't an entry # >>                  01110000
   equate                                                               01120000
      devdvr         =  0,                                              01130000
      devlpdt        =  1,                                              01140000
      devldt         =  2,                                              01150000
      devldtx        =  3,                                              01160000
      devdcth        =  4,                                              01170000
      devclass       =  5,                                              01180000
      devttdt        =  6,                                              01190000
      devcsdvr       =  7,                                              01200000
      devcsdef       =  8,                                              01210000
      devcstab       =  9;                                              01220000
   equate                                                               01230000
      ctab0dctsize   =   20,                                            01240000
      ctab0id0       =   40,                                            01250000
      ctab0id1       =   41;                                            01260000
   equate                                                               01270000
      dvrtsize       = 1536,                                            01280000
      lpdttsize      =  512,                                            01290000
      ldttsize       = 1280,                                            01300000
      ldtxtsize      = 1280,                                            01310000
      dvcltsize      = 1536,                                            01320000
      dcthsize       =    6,                                            01330000
      ttdttsize      = 1536,                                            01340000
      csdvrtsize     =  128,                                            01350000
      cstabtsize     = 2048,                                            01360000
      csdeftsize     =  256;                                            01370000
   equate                                                               01380000
      dvrsect        =   12,                                            01390000
      lpdtsect       =    4,                                            01400000
      ldtsect        =   10,                                            01410000
      ldtxsect       =   10,                                            01420000
      dvclsect       =   12,                                            01430000
      dcthsect       =    1,                                            01440000
      ttdtsect       =   12,                                            01450000
      cstabsect      =   16,                                            01460000
      csdefsect      =    2;                                            01470000
   equate                                                               01480000
      nrtables   = 16;                                                  01490000
   equate                                                               01500000
      dvrtabnr    = 0,                                                  01510000
      lpdtnr      = 1,                                                  01520000
      ldtnr       = 2,                                                  01530000
      ldtxnr      = 3,                                                  01540000
      dcthnr      = 4,                                                  01550000
      classnr     = 5,                                                  01560000
      ttdtnr      = 6,                                                  01570000
      csnr        = 7,                                                  01580000
      csdefnr     = 8,                                                  01590000
      csdvrnr     = 9,                                                  01600000
      clinfonr    = 10,                                                 01610000
      rinnr       = 11;                                                 01620000
   equate                                                               01630000
      io'converted   =  0,                                              01640000
      cl'converted   =  1,                                              01650000
      rin'converted  =  2,                                              01660000
      comm'converted =  3;                                              01670000
   equate                                                               01680000
      attioerr       =  0,                                              01690000
      getdiscerr     =  1,                                              01700000
      getdsegerr     =  2,                                              01710000
      badlinkerr     =  3;                                              01720000
   define                                                               01730000
      ttdt'converted   = ctab0(40).(2:1)#;                              01740000
   define                                                               01750000
      devchecksum      = devrec0#,                                      01760000
      devversion       = devrec0(1)#,                                   01770000
      devnext          = devrec0(2)#,                                   01780000
      devhighestldev   = devrec0(3)#,                                   01790000
      devhighestdrt    = devrec0(4)#,                                   01800000
      devnrcsdvr       = devrec0(5)#;                                   01810000
   double array                                                         01820000
      olddiscadr(0:nrtables-1);                                         01830000
   integer array                                                        01840000
      oldtablen(0:nrtables-1);                                          01850000
   double array                                                         01860000
      newdiscadr(0:nrtables-1);                                         01870000
   integer array                                                        01880000
      newtablen(0:nrtables-1);                                          01890000
                                                                        01900000
   integer                                                              01910000
      x = x,                                                            01920000
      qm4 = q-4,                                                        01930000
      s0 = s-0;                                                         01940000
   byte pointer                                                         01950000
      bps0 = s-0;                                                       01960000
$include incldvr                                                        01970000
$include inclldt5                                                       01980000
$page "  V E R I F Y I N G  -  -  -  DEFINES"                           01990000
<<  define/equate include file >>                                       02000000
                                                                        02010000
    define                                                              02020000
                                                                        02030000
      verify'equates =                                                  02040000
        << equates >>                                                   02050000
        equate                                                          02060000
          num'drivers = 20,                                             02070000
          need'free'disc = 20,                                          02080000
           cst         =  0,                                            02090000
          pcb         = cst+1                                           02100000
      #,                                                                02110000
      mpev = system'type=0 or system'type=1#,                           02120000
      mpeiv= system'type = 2#;                                          02130000
                                                                        02140000
$page "  "                                                              02150000
                                                                        02160000
double procedure attachio(ldev,qmisc,dstx,buf,func,count,p1,p2,flags);  02170000
   value ldev,qmisc,dstx,buf,func,count,p1,p2,flags;                    02180000
   integer ldev,qmisc,dstx,buf,func,count,p1,p2,flags;                  02190000
   option external;                                                     02200000
                                                                        02210000
integer procedure get'disc'space( ldev, num'sectors, discadr);          02220000
   value ldev, num'sectors;                                             02230000
   integer ldev;                                                        02240000
   double num'sectors, discadr;                                         02250000
   option external;                                                     02260000
                                                                        02270000
procedure return'disc'space( ldev, discadr, num'sectors);               02280000
   value ldev, discadr, num'sectors;                                    02290000
   integer ldev;                                                        02300000
   double discadr, num'sectors;                                         02310000
   option external;                                                     02320000
                                                                        02330000
integer procedure getdatasegc( memsize, vdsize);                        02340000
   value memsize, vdsize;                                               02350000
   integer memsize, vdsize;                                             02360000
   option external;                                                     02370000
                                                                        02380000
procedure reldataseg( dsegnr );                                         02390000
   value dsegnr;                                                        02400000
   integer dsegnr;                                                      02410000
   option external;                                                     02420000
                                                                        02430000
integer procedure exchangedb( datasegnr);                               02440000
   value datasegnr;                                                     02450000
   integer datasegnr;                                                   02460000
   option external;                                                     02470000
                                                                        02480000
intrinsic fopen, fread, freaddir, fwrite, fwritedir, quit, debug,       02490000
          readx, fpoint, fgetinfo, fclose, print, ascii, who,           02500000
          pause, printfileinfo, getdseg, command, dascii,      <<v8273>>02510000
          fcontrol,fcheck,terminate;                           <<a8781>>02520000
                                                                        02530000
procedure clearline;                                                    02540000
begin << clears the list buffer >>                                      02550000
   line := "  ";                                                        02560000
   move line(1) := line,(35);                                           02570000
end;                                                                    02580000
procedure printline(carr'control);                                      02590000
value carr'control;                                                     02600000
integer carr'control;                                                   02610000
option variable;                                                        02620000
begin << prints the list buffer >>                                      02630000
integer qm4=q-4;                                                        02640000
                                                                        02650000
if qm4=0 then                                                           02660000
  carr'control:=0;                                                      02670000
   tos := @line;                                                        02680000
   tos := @bline(71);  << pointer to last char >>                       02690000
   if bps0 = " " then                                                   02700000
      begin                                                             02710000
      assemble( dup, decb);                                             02720000
      tos := -71;                                                       02730000
      assemble( cmpb 2 );                                               02740000
      end;                                                              02750000
   tos := -(tos-@bline+1); << neg. nr. char's >>                        02760000
   print( *, *, carr'control);                                          02770000
   clearline;                                                           02780000
end;                                                                    02790000
procedure message( tablenr, stepnr, errornr);                           02800000
   value tablenr, stepnr, errornr;                                      02810000
   integer tablenr, stepnr, errornr;                                    02820000
begin                                                                   02830000
   move bline := "ERROR CONVERTING ",2;                                 02840000
   case tablenr of                                                      02850000
      begin                                                             02860000
      move * := "DRIVER TABLE ",2;                                      02870000
      move * := "LPDT ",2;                                              02880000
      move * := "LDT ",2;                                               02890000
      move * := "LDTX ",2;                                              02900000
      move * := "CLASS TABLE HEADER ",2;                                02910000
      move * := "CLASS TABLE ",2;                                       02920000
      move * := "TTDT TABLE",2;                                         02930000
      move * := "CS TABLE",2;                                           02940000
      move * := "CS DEF TABLE",2;                                       02950000
      move * := "CS DRIVER TABLE",2;                                    02960000
      move * := "COLD LOAD INFO TABLE ",2;                              02970000
      move * := "RIN TABLE ",2;                                         02980000
      end;                                                              02990000
   case stepnr of                                                       03000000
      begin                                                             03010000
      move * := ", ATTACHIO",2;                                         03020000
      move * := ", GET'DISC'SPACE",2;                                   03030000
      move * := ", GETDSEG",2;                                          03040000
      move * := ", BAD LINK",2;                                         03050000
      end;                                                              03060000
   if errornr <> -1 then                                                03070000
      begin                                                             03080000
      move * := ", ERROR NUMBER ",2;                                    03090000
      ascii( errornr, 10, bps0);                                        03100000
      end;                                                              03110000
   printline;                                                           03120000
end;  << message >>                                                     03130000
procedure verify'intent;                                                03140000
begin                                                                   03150000
   if forward' then                                                     03160000
      begin                                                             03170000
      move bline :=                                            <<*8066>>03180000
         "Converting from PRE-MPEV/E(G.00.00) to MPEV/E";      <<*8066>>03190000
      printline;                                                        03200000
      end                                                               03210000
   else                                                                 03220000
      begin                                                             03230000
      move bline :=                                            <<*8066>>03240000
         "Converting from MPEV/E(G.00.00) to PRE-MPEV/E";      <<*8066>>03250000
      printline;                                                        03260000
      end;                                                              03270000
                                                                        03280000
   if parm <> -1 then                                                   03290000
      begin                                                             03300000
      move bline := "You want to convert ONLY - ",2;                    03310000
      if parm.(15:1) then move * := "I/O,",2;                           03320000
      if parm.(13:1) then move * := "RIN,",2;                           03330000
      if parm.(14:1) then move * := "COLD LOAD INFO,",2;                03340000
      if parm.(12:1) then move * := "COMMUNICATION TABLE,",2;           03350000
      if parm.(11:1) then move * := "DEL SYSTEM FILES,",2;              03360000
      tos := tos-1;                                                     03370000
      move * := " ";                                                    03380000
      printline;                                                        03390000
      end;                                                              03400000
                                                                        03410000
   do begin                                                             03420000
      move bline := "OK TO PROCEED (Y/N)? ";                            03430000
      print( line, -21, %320);                                          03440000
      clearline;                                                        03450000
      readx( line, -72);                                                03460000
      if <> then bline := "N";                                          03470000
      move bline := bline while as;                                     03480000
      end                                                               03490000
   until bline = "N" or bline = "Y";                                    03500000
   if bline = "N" then begin                                            03510000
     terminate;                                                         03520000
     end;                                                               03530000
   clearline;                                                           03540000
                                                                        03550000
end;                                                                    03560000
procedure ioerrcheck( b, a);                                            03570000
   value b, a;                                                          03580000
   integer b, a;                                                        03590000
begin                                                                   03600000
   cc := cce;                                                           03610000
   tos := b.(8:8);                                                      03620000
   if s0 <> 1 then                                                      03630000
      begin  << i/o error >>                                            03640000
      cc := ccl;                                                        03650000
      error := tos;                                                     03660000
      message( tablenr, attioerr, error);                               03670000
      end;                                                              03680000
end;                                                                    03690000
$page "CHECK'ACCESS"                                                    03700000
procedure check'access;                                                 03710000
begin                                                                   03720000
<<   check for proper program access   >>                               03730000
who( , capability, , username, groupname, acctname);                    03740000
if cap1.(0:1) = 0 then                                                  03750000
   begin                                                                03760000
   move bline := "THIS PROGRAM REQUIRES SM CAPABILITY";                 03770000
   printline;                                                           03780000
   terminate;                                                           03790000
   end;                                                                 03800000
if logon <> "MANAGER SYS     PUB " then                                 03810000
   begin                                                                03820000
   move bline := "LOGON MUST BE  -  MANAGER.SYS,PUB";                   03830000
   printline;                                                           03840000
   terminate;                                                           03850000
   end;                                                                 03860000
end; <<check'access>>                                                   03870000
procedure disc( ldev, func, buffer, discadr, count);                    03880000
   value ldev, func, discadr, count;                                    03890000
   integer ldev, func, count;                                           03900000
   array buffer;                                                        03910000
   double discadr;                                                      03920000
   option privileged;                                                   03930000
begin                                                                   03940000
   integer                                                              03950000
      discadr1 = discadr,                                               03960000
      discadr2 = discadr+1;                                             03970000
                                                                        03980000
   tos := attachio( ldev, 0, 0, @buffer, func, count,                   03990000
      discadr1, discadr2, 1);                                           04000000
   ioerrcheck(*,*);                                                     04010000
   if <> then cc := ccl else cc := cce;                                 04020000
end;                                                                    04030000
procedure mfds( buffer, dst, offset, count);                            04040000
   value dst, offset, count;                                            04050000
   array buffer;                                                        04060000
   integer dst, offset, count;                                          04070000
begin                                                                   04080000
   tos := @buffer;                                                      04090000
   tos := dst;                                                          04100000
   tos := offset;                                                       04110000
   tos := count;                                                        04120000
   assemble( mfds );                                                    04130000
end;                                                                    04140000
procedure mtds( dst, offset, buffer, count);                            04150000
   value dst, offset, count;                                            04160000
   array buffer;                                                        04170000
   integer dst, offset, count;                                          04180000
begin                                                                   04190000
   tos := dst;                                                          04200000
   tos := offset;                                                       04210000
   tos := @buffer;                                                      04220000
   tos := count;                                                        04230000
   assemble( mtds );                                                    04240000
end;                                                                    04250000
procedure mds( targetdst, targetoffset, sourcedst, sourceoffset, count);04260000
   value targetdst, targetoffset, sourcedst, sourceoffset, count;       04270000
   integer targetdst, targetoffset, sourcedst, sourceoffset, count;     04280000
begin                                                                   04290000
   tos := targetdst;                                                    04300000
   tos := targetoffset;                                                 04310000
   tos := sourcedst;                                                    04320000
   tos := sourceoffset;                                                 04330000
   tos := count;                                                        04340000
   assemble( mds );                                                     04350000
end;                                                                    04360000
procedure setbit( table, bit);                                 <<v8273>>04370000
   value bit;                                                  <<v8273>>04380000
   array table;                                                <<v8273>>04390000
   integer bit;                                                <<v8273>>04400000
begin                                                          <<v8273>>04410000
   integer                                                     <<v8273>>04420000
      inx     = q+1,                                           <<v8273>>04430000
      bitpos  = q+2;                                           <<v8273>>04440000
                                                               <<v8273>>04450000
   tos := bit;                                                 <<v8273>>04460000
   tos := 16;                                                  <<v8273>>04470000
   assemble( div, stbx );                                      <<v8273>>04480000
                                                               <<v8273>>04490000
   tos := table( x );                                          <<v8273>>04500000
   x := bitpos;                                                <<v8273>>04510000
   assemble( tsbc 0,x );                                       <<v8273>>04520000
   table( inx ) := tos;                                        <<v8273>>04530000
end;                                                           <<v8273>>04540000
procedure resetbit( table, bit);                               <<v8273>>04550000
   value bit;                                                  <<v8273>>04560000
   array table;                                                <<v8273>>04570000
   integer bit;                                                <<v8273>>04580000
begin                                                          <<v8273>>04590000
   integer                                                     <<v8273>>04600000
      inx     = q+1,                                           <<v8273>>04610000
      bitpos  = q+2;                                           <<v8273>>04620000
                                                               <<v8273>>04630000
   tos := bit;                                                 <<v8273>>04640000
   tos := 16;                                                  <<v8273>>04650000
   assemble( div, stbx );                                      <<v8273>>04660000
                                                               <<v8273>>04670000
   tos := table( x );                                          <<v8273>>04680000
   x := bitpos;                                                <<v8273>>04690000
   assemble( trbc 0,x );                                       <<v8273>>04700000
   table( inx ) := tos;                                        <<v8273>>04710000
end;                                                           <<v8273>>04720000
logical procedure testbit( table, bit);                        <<v8273>>04730000
   value bit;                                                  <<v8273>>04740000
   array table;                                                <<v8273>>04750000
   integer bit;                                                <<v8273>>04760000
begin                                                          <<v8273>>04770000
   integer                                                     <<v8273>>04780000
      inx    = q+1,                                            <<v8273>>04790000
      bitpos = q+2;                                            <<v8273>>04800000
                                                               <<v8273>>04810000
   tos := bit;                                                 <<v8273>>04820000
   tos := 16;                                                  <<v8273>>04830000
   assemble( div, stbx );                                      <<v8273>>04840000
                                                               <<v8273>>04850000
   tos := table( x );                                          <<v8273>>04860000
   x := bitpos;                                                <<v8273>>04870000
   assemble( tsbc 0,x );                                       <<v8273>>04880000
   if <> then testbit := true;                                 <<v8273>>04890000
end;                                                           <<v8273>>04900000
integer procedure type( ldev);                                          04910000
   value ldev;                                                          04920000
   integer ldev;                                                        04930000
begin                                                                   04940000
   integer word;                                                        04950000
                                                                        04960000
   if ctab0(41).(io'converted:1) then                                   04970000
      mfds( word, %16, ldev*7+2, 1)                                     04980000
   else                                                                 04990000
      mfds( word, %16, ldev*5+2, 1);                                    05000000
   type := word.(10:6);                                                 05010000
end;                                                                    05020000
integer procedure subtype( ldev);                                       05030000
   value ldev;                                                          05040000
   integer ldev;                                                        05050000
begin                                                                   05060000
   integer word;                                                        05070000
                                                                        05080000
   if ctab0(41).(io'converted:1) then                                   05090000
      mfds( word, 13, ldev*4+1, 1)                                      05100000
   else                                                                 05110000
      mfds( word, 13, ldev*2+1, 1);                                     05120000
   subtype := word.(12:4);                                              05130000
end;                                                                    05140000
integer procedure ldevtovtab( ldev );                          <<v8616>>05150000
   value ldev;                                                 <<v8616>>05160000
   integer ldev;                                               <<v8616>>05170000
begin                                                          <<v8616>>05180000
   integer vol = ldevtovtab;                                   <<v8616>>05190000
                                                               <<v8616>>05200000
   if system'type = 2 then                                     <<v8616>>05210000
      begin  << mpe v >>                                       <<v8616>>05220000
      mfds( vol, 14, ldev*7+1, 1);                             <<v8616>>05230000
      end                                                      <<v8616>>05240000
   else                                                        <<v8616>>05250000
      begin  << mpe iv >>                                      <<v8616>>05260000
      mfds( vol, 14, ldev*5+1, 1);                             <<v8616>>05270000
      vol := vol.(0:8);                                        <<v8616>>05280000
      end;                                                     <<v8616>>05290000
end;                                                           <<v8616>>05300000
integer procedure checksum(target,targetlen,oldchecksum);               05310000
   value targetlen, oldchecksum;                                        05320000
   array target;                                                        05330000
   integer targetlen;                                                   05340000
   logical oldchecksum;                                                 05350000
comment:                                                                05360000
   using the value of oldchecksum as a base, the checksum               05370000
   of the target array is calculated and returned as the                05380000
   value of the procedure.                                              05390000
end of comment;                                                         05400000
                                                                        05410000
begin                                                                   05420000
   integer i;                                                           05430000
   i := 0;                                                              05440000
   do                                                                   05450000
      oldchecksum:=oldchecksum+target(i)                                05460000
   until (i:=i+1) = targetlen;                                          05470000
   checksum := oldchecksum;                                             05480000
end;  <<checksum>>                                                      05490000
procedure zerobuf( buf, length);                                        05500000
   value length;                                                        05510000
   array buf;                                                           05520000
   integer length;                                                      05530000
begin                                                                   05540000
   buf := 0;                                                            05550000
   move buf(1) := buf,(length-1);                                       05560000
end;                                                                    05570000
procedure ferror( filenum, filename);                                   05580000
   value filenum;                                                       05590000
   integer filenum;                                                     05600000
   byte array filename;                                                 05610000
begin                                                                   05620000
   integer len;                                                         05630000
                                                                        05640000
   scan filename until [8/13,8/%40],1;                                  05650000
   len := tos - @filename;                                              05660000
   move bline := "**** FILE ERROR ON ",2;                               05670000
   move * := filename,(len);                                            05680000
   printline;                                                           05690000
   printfileinfo( filenum);                                             05700000
end;                                                                    05710000
procedure get'table'discadr( tablenr, discadr, length);                 05720000
   value tablenr;                                                       05730000
   integer tablenr, length;                                             05740000
   double discadr;                                                      05750000
begin                                                                   05760000
                                                                        05770000
   if logical(ctab0(41).(cl'converted:1)) then                          05780000
      begin   << cold load info table converted >>                      05790000
      length := info( info + tablenr*5);                                05800000
      tos := info( x:=x+3);                                             05810000
      tos := info( x:=x+1);                                             05820000
      discadr := tos;                                                   05830000
      end                                                               05840000
   else                                                                 05850000
      begin   << cold load info in old format >>                        05860000
      length := info( info + tablenr*4);                                05870000
      tos := info( x:=x+2);                                             05880000
      tos := info( x:=x+1);                                             05890000
      discadr := tos;                                                   05900000
      end;                                                              05910000
end;                                                                    05920000
procedure store'table'discadr( tablenr, discadr, length);               05930000
   value tablenr, discadr, length;                                      05940000
   integer tablenr, length;                                             05950000
   double discadr;                                                      05960000
begin                                                                   05970000
                                                                        05980000
   if logical(ctab0(41).(cl'converted:1)) then                          05990000
      begin   << cold load info table converted >>                      06000000
      info( info + tablenr*5) := length;                                06010000
      tos := discadr;                                                   06020000
      info( x:=x+4) := tos;                                             06030000
      info( x:=x-1) := tos;                                             06040000
      end                                                               06050000
   else                                                                 06060000
      begin   << cold load info table in old format >>                  06070000
      info( info + tablenr*4) := length;                                06080000
      tos := discadr;                                                   06090000
      info( x:=x+3) := tos;                                             06100000
      info( x:=x-1) := tos;                                             06110000
      end;                                                              06120000
end;                                                                    06130000
procedure init'devdata;                                                 06140000
begin                                                                   06150000
   integer array flab(0:127);                                           06160000
   byte array device(0:7);                                              06170000
   double fileadr;                                                      06180000
   byte fileldev = fileadr;                                             06190000
   define disptodata = flab(%47).(0:8)#;                                06200000
   define fileerror =                                                   06210000
      begin                                                             06220000
      ferror( devfnum, devfile);                                        06230000
      go failure;                                                       06240000
      end#;                                                             06250000
                                                                        06260000
   move device := "1 ";                                                 06270000
   zerobuf( devrec0, 128);                                              06280000
                                                                        06290000
   <<   check if devdata file already exists,      >>                   06300000
   <<   if it does, ask for verification before    >>                   06310000
   <<   purging                                    >>                   06320000
                                                                        06330000
   devfnum := fopen( devfile, 3);                                       06340000
   if = then                                                            06350000
      begin  << trouble!!! - file already exists >>                     06360000
      do begin                                                          06370000
         move line := "OK TO PURGE FILE DEVDATA.PUB.SYS (Y/N)? ";       06380000
         print( line, -40, %320);                                       06390000
         clearline;                                                     06400000
         readx( line, -72);                                             06410000
         if <> then fileerror;                                          06420000
         move bline := bline while as;                                  06430000
         end                                                            06440000
      until bline="N" or bline="Y";                                     06450000
      if bline = "N" then go failure;                                   06460000
      clearline;                                                        06470000
      fclose( devfnum, 4, 0);                                           06480000
      if <> then fileerror;                                             06490000
      end;                                                              06500000
   devfnum := fopen( devfile, 0, %24,,device,,,,,350d,1);               06510000
   if <> then fileerror;                                                06520000
   fwritedir( devfnum, devrec0, 128, 349d); <<set eof>>                 06530000
   if <> then fileerror;                                                06540000
   fclose( devfnum, 1, 0);                                              06550000
   if <> then fileerror;                                                06560000
   devfnum := fopen( devfile, 1, %24);                                  06570000
   if <> then fileerror;                                                06580000
   fgetinfo( devfnum,,,,,,,,,,,,,,,,,,,fileadr);                        06590000
   if fileldev <> 1 then fileerror;                                     06600000
   fileldev := 0;                                                       06610000
   disc( sysdisc, read, flab, fileadr, 128);                            06620000
   if <> then go failure;                                               06630000
   devfileadr := fileadr+double(disptodata);                            06640000
                                                                        06650000
   devversion := 1;                                                     06660000
   devnext := 2;                                                        06670000
   devhighestldev := highestldev;                                       06680000
   devhighestdrt := highestdrt;                                         06690000
   devnrcsdvr := nrcsdvr;                                               06700000
   fwritedir( devfnum, devrec0, 256, 0d);                               06710000
   if <> then fileerror;                                                06720000
                                                                        06730000
   cc := cce;                                                           06740000
   return;                                                              06750000
                                                                        06760000
failure:                                                                06770000
   cc := ccl;                                                           06780000
end;                                                                    06790000
procedure writedevfile( tablenr, buf, length);                          06800000
   value tablenr, length;                                               06810000
   integer tablenr, length;                                             06820000
   integer array buf;                                                   06830000
begin                                                                   06840000
   integer inx;                                                         06850000
                                                                        06860000
   inx := 64 + tablenr*2;                                               06870000
   devrec0(inx) := devnext;                                             06880000
   devrec0(inx+1) := length;                                            06890000
   fwritedir( devfnum, buf, length, double(devnext));                   06900000
   if <> then                                                           06910000
      begin                                                             06920000
      ferror( devfnum, devfile);                                        06930000
      go failure;                                                       06940000
      end;                                                              06950000
   devnext := devnext + (length+127)/128;                               06960000
   fwritedir( devfnum, devrec0, 128, 0d);                               06970000
   if <> then                                                           06980000
      begin                                                             06990000
      ferror( devfnum, devfile);                                        07000000
      go failure;                                                       07010000
      end;                                                              07020000
                                                                        07030000
   cc := cce;                                                           07040000
   return;                                                              07050000
                                                                        07060000
failure:                                                                07070000
   cc := ccl;                                                           07080000
end;                                                                    07090000
procedure readdevfile( tablenr, buf, length);                           07100000
   value tablenr;                                                       07110000
   integer tablenr, length;                                             07120000
   integer array buf;                                                   07130000
begin                                                                   07140000
   integer inx;                                                         07150000
                                                                        07160000
   inx := 64 + tablenr*2;                                               07170000
   length := devrec0(inx+1);                                            07180000
   freaddir( devfnum, buf, length, double(devrec0(inx)));               07190000
   if <> then cc := ccl else cc := cce;                                 07200000
end;                                                                    07210000
procedure build'devdata;                                                07220000
begin                                                                   07230000
   integer array infotodev(*) = pb :=                                   07240000
     << info table nr    devdata nr     nr sect alloc >>                07250000
        infodvr      ,   devdvr     ,   0          ,                    07260000
        infocsdvr    ,   devcsdvr   ,   0          ,                    07270000
        infocsdef    ,   devcsdef   ,   0          ,                    07280000
        infocstab    ,   devcstab   ,   cstabsect  ,                    07290000
        infolpdt     ,   devlpdt    ,   lpdtsect   ,                    07300000
        infoldt      ,   devldt     ,   ldtsect    ,                    07310000
        infoclass    ,   devclass   ,   dvclsect   ,                    07320000
        infoldtx     ,   devldtx    ,   ldtxsect   ,                    07330000
        infodcth     ,   devdcth    ,   dcthsect   ,                    07340000
        infottdt     ,   devttdt    ,   ttdtsect   ,                    07350000
        -1;  << terminator >>                                           07360000
   equate seed = %123456; << for starting checksum >>                   07370000
   integer inx;                                                         07380000
   integer i;                                                           07390000
   define fileerror =                                                   07400000
      begin                                                             07410000
      ferror( devfnum, devfile);                                        07420000
      go failure;                                                       07430000
      end#;                                                             07440000
                                                                        07450000
   i := 0;                                                              07460000
   while infotodev(i) <> -1 do                                          07470000
      begin                                                             07480000
      inx := 64 + infotodev(i+1)*2;                                     07490000
      if devrec0(inx) = 0 then                                          07500000
         begin   << table not writtern yet - so doit >>                 07510000
         get'table'discadr( infotodev(i), discadr, length);             07520000
         olddiscadr( infotodev(i)) := discadr;                          07530000
         oldtablen( infotodev(i)) := infotodev(i+2);                    07540000
         disc( sysdisc, read, newtable, discadr, length);               07550000
         if <> then go failure;                                         07560000
         writedevfile( infotodev(i+1), newtable, length);               07570000
         if <> then go failure;                                         07580000
         end;                                                           07590000
      store'table'discadr( infotodev(i),                                07600000
         devfileadr+double(devrec0(inx)), devrec0(inx+1));              07610000
      i := i+3;                                                         07620000
      end;                                                              07630000
                                                                        07640000
   devrec0 := checksum( devrec0(1), 127, seed);                         07650000
   fwritedir( devfnum, devrec0, 128, 0d);                               07660000
   if <> then fileerror;                                                07670000
                                                                        07680000
   cc := cce;                                                           07690000
   return;                                                              07700000
                                                                        07710000
failure:                                                                07720000
   cc := ccl;                                                           07730000
end;                                                                    07740000
procedure fixclinfo;                                                    07750000
begin                                                                   07760000
   equate                                                               07770000
      cstptr      = 1, << pointer to cst info >>                        07780000
      nrents      = 2, << total cl info entries >>                      07790000
      nrcsts      = 3; << nr. of initial segments >>                    07800000
   integer                                                              07810000
      entsize,    << cold load info entry size >>                       07820000
      len,                                                              07830000
      start,                                                            07840000
      last;                                                             07850000
                                                                        07860000
   tablenr := clinfonr;                                                 07870000
   if not ttdt'converted then                                           07880000
      begin                                                             07890000
      error := get'disc'space( sysdisc, 1d, discadr);                   07900000
      if error <> 0 then                                                07910000
         begin                                                          07920000
         message( clinfonr, getdiscerr, error);                         07930000
         go failure;                                                    07940000
         end;                                                           07950000
      << build device class table header >>                             07960000
      zerobuf( newtable, 20);                                           07970000
      newtable    := dcthsize;  << total table size   >>                07980000
      newtable(1) := 1;         << entry size         >>                07990000
      newtable(2) := 0;         << # of class entries >>                08000000
      newtable(3) := dcthsize;  << ptr to class table >>                08010000
      newtable(4) := 0;         << # of ttdt entries  >>                08020000
      newtable(5) := dcthsize;  << ptr to ttdt table  >>                08030000
      disc( sysdisc, write, newtable, discadr, dcthsize);               08040000
      if <> then go failure;                                            08050000
                                                                        08060000
      << insert dcth and ttdt entries in cl info tab >>                 08070000
      entsize := if logical(ctab0(41).(cl'converted:1)) then            08080000
         5 else 4;                                                      08090000
      len := info(cstptr);                                              08100000
      last := info(cstptr) + info(nrcsts) * entsize;                    08110000
      zerobuf( newinfo, 256);                                           08120000
      move newinfo := info,(len);                                       08130000
      start := len + entsize * 2;                                       08140000
      newinfo(cstptr) := start;                                         08150000
      newinfo(nrents) := newinfo(nrents) + 2;                           08160000
      move newinfo(start) := info(len),(last-len);                      08170000
      move info := newinfo,(256);                                       08180000
      store'table'discadr( infodcth, discadr, dcthsize);                08190000
      end;                                                              08200000
                                                                        08210000
   cc := cce;                                                           08220000
   return;                                                              08230000
                                                                        08240000
failure:                                                                08250000
   cc := ccl;                                                           08260000
end;                                                                    08270000
procedure build'commrec;                                                08280000
begin                                                                   08290000
   integer array ctab0tocomm(*) = pb :=                                 08300000
     << ctab0 >> << comm >>                                             08310000
           3,          7,   << hi drt            >>                     08320000
          10,         40,   << log file number   >>                     08330000
          17,         12,   << files dumped      >>                     08340000
          18,          8,   << hi ldev           >>                     08350000
          19,          9,   << hvol/#vol         >>                     08360000
          20,         20,   << class size        >>                     08370000
          21,          5,   << fix               >>                     08380000
          22,         11,   << cl id             >>                     08390000
          23,         16,   << max init seg      >>                     08400000
          24,         15,   << disc load entry   >>                     08410000
          25,         22,   << vtab size         >>                     08420000
          26,         23,   << info size         >>                     08430000
          29,         24,   << cstab size        >>                     08440000
          32,         10,   << add'l dvrs        >>                     08450000
          34,          4,   << update            >>                     08460000
          35,          3,   << version           >>                     08470000
          36,         13,   << serial load       >>                     08480000
          37,          0,   << mit version       >>                     08490000
          38,          1,   << mit update        >>                     08500000
          39,          2,   << mit fix           >>                     08510000
          40,         30,   << id 0              >>                     08520000
          41,         31,   << id 1              >>                     08530000
          42,         32,   << id 2              >>                     08540000
          43,         33,   << id 3              >>                     08550000
          44,         14,   << tape rec size     >>                     08560000
          45,         21,   << ttdt size         >>                     08570000
          46,          6,   << exp system #      >>                     08580000
          -1,         -1;   << terminator        >>                     08590000
                                                                        08600000
   entry build'ctab0;                                                   08610000
   equate seed = %123456;                                               08620000
   integer corex;                                                       08630000
   integer i;                                                           08640000
   integer oldctab041;                                                  08650000
   define memsize = ctab0#;                                             08660000
   integer array comm(0:127);                                           08670000
   define fileerror =                                                   08680000
      begin                                                             08690000
      ferror( conffnum, conffile);                                      08700000
      goto failure;                                                     08710000
      end#;                                                             08720000
                                                                        08730000
   if ctab0(41).(comm'converted:1) then                                 08740000
      begin                                                             08750000
      move bline := "COMMUNCIATION TABLE - already converted";          08760000
      printline;                                                        08770000
      cc := cce;                                                        08780000
      return;                                                           08790000
      end;                                                              08800000
   ctab0(41).(comm'converted:1) := 1;                                   08810000
   freaddir( conffnum, newtable, 128, double(1+ctab0(1)));              08820000
   if <> then fileerror;                                                08830000
   newtable(14) := 16384; << loader segment table >>                    08840000
   fwritedir( conffnum, newtable, 128, 1d);                             08850000
   if <> then fileerror;                                                08860000
   oldctab041 := ctab0(41);                                             08870000
                                                                        08880000
   zerobuf( comm, 128);                                                 08890000
                                                                        08900000
   i := 0;                                                              08910000
   while ctab0tocomm(i) <> -1 do                                        08920000
      begin                                                             08930000
      comm(ctab0tocomm(i+1)) := ctab0(ctab0tocomm(i));                  08940000
      ctab0(ctab0tocomm(i)) := 0;                                       08950000
      i := i+2;                                                         08960000
      end;                                                              08970000
                                                                        08980000
   ctab0(41) := oldctab041;                                             08990000
   ctab0(3) := ctab0; << memory size in k words >>                      09000000
   ctab0(1) := 1; << version >>                                         09010000
   ctab0 := checksum( ctab0(1), 127, not(seed));                        09020000
                                                                        09030000
   disc( sysdisc, write, comm, 31d, 128);                               09040000
   if <> then go failure2;                                              09050000
                                                                        09060000
   zerobuf( newtable, 256);                                             09070000
   newtable(21) := info(11);                                            09080000
   info(11) := 0;                                                       09090000
   disc( sysdisc, write, newtable, 32d, 256);                           09100000
   if <> then go failure2;                                              09110000
                                                                        09120000
   cc := cce;                                                           09130000
   return;                                                              09140000
                                                                        09150000
build'ctab0:                                                            09160000
                                                                        09170000
   if not ctab0(41).(comm'converted:1) then                             09180000
      begin                                                             09190000
      move bline := "COMMUNCIATION TABLE - already converted";          09200000
      printline;                                                        09210000
      cc := cce;                                                        09220000
      return;                                                           09230000
      end;                                                              09240000
   oldctab041 := ctab0(41);                                             09250000
   disc( sysdisc, read, comm, 31d, 128);                                09260000
   if <> then goto failure;                                             09270000
   ctab0 := ctab0(3);  << memory size in k words >>                     09280000
                                                                        09290000
   i := 0;                                                              09300000
   while ctab0tocomm(i) <> -1 do                                        09310000
      begin                                                             09320000
      ctab0(ctab0tocomm(i)) := comm(ctab0tocomm(i+1));                  09330000
      i := i+2;                                                         09340000
      end;                                                              09350000
                                                                        09360000
   oldctab041.(comm'converted:1) := 0;                                  09370000
   ctab0(41) := oldctab041;                                             09380000
   ctab0(40) := %140000;                                                09390000
   corex := 0;                                                          09400000
   if memsize >=  80 then corex := 1;                                   09410000
   if memsize >=  96 then corex := 2;                                   09420000
   if memsize >= 128 then corex := 3;                                   09430000
   if memsize >= 160 then corex := 4;                                   09440000
   if memsize >= 192 then corex := 5;                                   09450000
   if memsize >= 224 then corex := 6;                                   09460000
   if memsize >= 256 then corex := 7;                                   09470000
   ctab0(1) := corex;                                                   09480000
                                                                        09490000
   freaddir( conffnum, newtable, 128, 1d);                              09500000
   if <> then fileerror;                                                09510000
   fwritedir( conffnum, newtable, 128, double(1+corex));                09520000
   if <> then fileerror;                                                09530000
                                                                        09540000
   disc( sysdisc, read, newtable, 32d, 256);                            09550000
   if <> then goto failure;                                             09560000
   info(11) := newtable(21);                                            09570000
                                                                        09580000
   cc := cce;                                                           09590000
   return;                                                              09600000
                                                                        09610000
failure:                                                                09620000
   cc := ccg;                                                           09630000
   return;                                                              09640000
failure2:                                                               09650000
   cc := ccl;                                                           09660000
end;                                                                    09670000
procedure return'space( discadr, length);                               09680000
   double array discadr;                                                09690000
   logical array length;                                                09700000
begin                                                                   09710000
   integer cnt := 0;                                                    09720000
                                                                        09730000
   while cnt < nrtables do                                              09740000
      begin                                                             09750000
      if discadr(cnt) <> 0d and length(cnt) <> 0 then                   09760000
         return'disc'space( sysdisc, discadr(cnt),                      09770000
            double( length(cnt)));                                      09780000
      cnt := cnt+1;                                                     09790000
      end;                                                              09800000
end;                                                                    09810000
procedure purge'util'mpeiv;                                             09820000
begin                                                                   09830000
   byte array utilities(*) = pb :=                                      09840000
      8,"RECOVER2",                                            <<f8714>>09850000
      5,"DPAN4",                                                        09860000
      8,"LISTLOG2",                                                     09870000
      7,"LISTEQ2",                                                      09880000
      7,"DISKED2",                                                      09890000
      8,"LISTDIR2",                                                     09900000
      5,"SPOOK",                                                        09910000
      8,"ASOCTABL",                                                     09920000
      5,"FREE2",                                                        09930000
      6,"ATPDSM",                                              <<f8714>>09940000
      0;  << terminator >>                                              09950000
                                                                        09960000
   integer                                                              09970000
      disp,      << displacement in utilities >>                        09980000
      err,       << return from command >>                              09990000
      parm,      << return from command >>                              10000000
      len,       << length of filename >>                               10010000
      fnum;      << return from fopen >>                                10020000
   byte array                                                           10030000
      filename(0:29),                                                   10040000
      buf(0:39),                                                        10050000
      temp(0:1);                                                        10060000
   integer array                                                        10070000
      nrchars(*) = temp;                                                10080000
   define nrchars' = temp(1)#;                                          10090000
                                                                        10100000
   temp := 0;                                                           10110000
   disp := 1;                                                           10120000
   move nrchars' := utilities,(1);                                      10130000
   while nrchars <> 0 do                                                10140000
      begin                                                             10150000
      move filename := utilities(disp),(nrchars),2;                     10160000
      move * := ".PUB.SYS",2;                                           10170000
      len := tos-@filename;                                             10180000
      move buf := "PURGE ",2;                                           10190000
      move * := filename,(len),2;                                       10200000
      move * := (13);                                                   10210000
      command( buf, err, parm);                                         10220000
      if <> then                                                        10230000
         begin                                                          10240000
         move bline := "UNABLE TO PURGE ",2;                            10250000
         move * := filename,(len),2;                                    10260000
         move * := "  --  ERROR ",2;                                    10270000
         ascii( err, 10, bps0);                                         10280000
         printline;                                                     10290000
         end                                                   <<v8273>>10300000
      else                                                     <<v8273>>10310000
         begin                                                 <<v8273>>10320000
         move bline := filename,(len);                         <<v8273>>10330000
         move bline(17) := "PURGED!";                          <<v8273>>10340000
         printline;                                            <<v8273>>10350000
         end;                                                  <<v8273>>10360000
      disp := disp+nrchars;                                             10370000
      move nrchars' := utilities(disp),(1);                             10380000
      disp := disp+1;                                                   10390000
      end;                                                              10400000
end;                                                                    10410000
$control segment=backward'convert                                       10420000
procedure purge'util'mpev;                                              10430000
begin                                                                   10440000
   byte array utilities(*) = pb :=                                      10450000
      8,"RECOVER5",                                                     10460000
      5,"DPAN5",                                                        10470000
      8,"LISTLOG5",                                                     10480000
      7,"LISTEQ5",                                                      10490000
      7,"DISKED5",                                                      10500000
      8,"LISTDIR5",                                                     10510000
      6,"SPOOK5",                                                       10520000
      8,"ASOCTBL5",                                                     10530000
      5,"FREE5",                                                        10540000
      7,"TERMDSM",                                             <<f8714>>10550000
      0;  << terminator >>                                              10560000
                                                                        10570000
   integer                                                              10580000
      disp,      << displacement in utilities >>                        10590000
      err,       << return from command >>                              10600000
      parm,      << return form command >>                              10610000
      len,       << length of filename >>                               10620000
      fnum;      << return from fopen >>                                10630000
   byte array                                                           10640000
      filename(0:29),                                                   10650000
      buf(0:39),                                                        10660000
      temp(0:1);                                                        10670000
   integer array                                                        10680000
      nrchars(*) = temp;                                                10690000
   define nrchars' = temp(1)#;                                          10700000
                                                                        10710000
   temp := 0;                                                           10720000
   disp := 1;                                                           10730000
   move nrchars' := utilities,(1);                                      10740000
   while nrchars <> 0 do                                                10750000
      begin                                                             10760000
      move filename := utilities(disp),(nrchars),2;                     10770000
      move * := ".PUB.SYS",2;                                           10780000
      len := tos-@filename;                                             10790000
      move buf := "PURGE ",2;                                           10800000
      move * := filename,(len),2;                                       10810000
      move * := (13);                                                   10820000
      command( buf, err, parm);                                         10830000
      if <> then                                                        10840000
         begin                                                          10850000
         move bline := "UNABLE TO PURGE ",2;                            10860000
         move * := filename,(len),2;                                    10870000
         move * := "  --  ERROR ",2;                                    10880000
         ascii( err, 10, bps0);                                         10890000
         printline;                                                     10900000
         end                                                   <<v8273>>10910000
      else                                                     <<v8273>>10920000
         begin                                                 <<v8273>>10930000
         move bline := filename,(len);                         <<v8273>>10940000
         move bline(17) := "PURGED!";                          <<v8273>>10950000
         printline;                                            <<v8273>>10960000
         end;                                                  <<v8273>>10970000
      disp := disp+nrchars;                                             10980000
      move nrchars' := utilities(disp),(1);                             10990000
      disp := disp+1;                                                   11000000
      end;                                                              11010000
end;                                                                    11020000
$page "     F O R W A R D     C O N V E R S I O N"                      11030000
$control segment=mpev'conversion                               <<a8781>>11040000
procedure convert'assoc;                                       <<a8781>>11050000
begin                                                          <<a8781>>11060000
   integer                                                     <<a8781>>11070000
      oldrec,                                                  <<a8781>>11080000
      newrec,                                                  <<a8781>>11090000
      next'ext,                                                <<a8781>>11100000
      ldev,                                                    <<a8781>>11110000
      newfile,                                                 <<a8781>>11120000
      oldfile,                                                 <<a8781>>11130000
      errnr;                                                   <<a8781>>11140000
   double                                                      <<a8781>>11150000
      filesize;                                                <<a8781>>11160000
   integer array                                               <<a8781>>11170000
      buf(0:12);                                               <<a8781>>11180000
   define                                                      <<a8781>>11190000
      error'on'new =                                           <<a8781>>11200000
         begin                                                 <<a8781>>11210000
         ferror( newfile, assocfile);                          <<a8781>>11220000
         go failure;                                           <<a8781>>11230000
         end#,                                                 <<a8781>>11240000
      error'on'old =                                           <<a8781>>11250000
         begin                                                 <<a8781>>11260000
         ferror( oldfile, assocfile);                          <<a8781>>11270000
         go failure;                                           <<a8781>>11280000
         end#;                                                 <<a8781>>11290000
                                                               <<a8781>>11300000
   cc := cce;                                                  <<a8781>>11310000
                                                               <<a8781>>11320000
   filesize := if forward' then 2048d else 1304d;              <<a8781>>11330000
   oldfile := fopen( assocfile, %2001, %100);                  <<a8781>>11340000
   if <> then                                                  <<a8781>>11350000
      begin                                                    <<a8781>>11360000
      fcheck( oldfile, errnr);                                 <<a8781>>11370000
      if errnr = 52 then                                       <<a8781>>11380000
         return                                                <<a8781>>11390000
      else                                                     <<a8781>>11400000
         error'on'old;                                         <<a8781>>11410000
      end;                                                     <<a8781>>11420000
   newfile := fopen( assocfile, %2000, 4, 13,,,,,,filesize);   <<a8781>>11430000
   if <> then error'on'new;                                    <<a8781>>11440000
                                                               <<a8781>>11450000
   next'ext := if forward' then 1000 else 256;                 <<a8781>>11460000
                                                               <<a8781>>11470000
   for ldev := 1 until 255 do                                  <<a8781>>11480000
      begin                                                    <<a8781>>11490000
      oldrec := ldev;                                          <<a8781>>11500000
      newrec := ldev;                                          <<a8781>>11510000
      freaddir( oldfile, buf, 13, double(oldrec));             <<a8781>>11520000
      if <> then error'on'old;                                 <<a8781>>11530000
      while buf(12) <> 0 do                                    <<a8781>>11540000
         begin                                                 <<a8781>>11550000
         oldrec := buf(12);                                    <<a8781>>11560000
         buf(12) := next'ext;                                  <<a8781>>11570000
         fwritedir( newfile, buf, 13, double(newrec));         <<a8781>>11580000
         if <> then error'on'new;                              <<a8781>>11590000
         newrec := next'ext;                                   <<a8781>>11600000
         freaddir( oldfile, buf, 13, double(oldrec));          <<a8781>>11610000
         if <> then error'on'old;                              <<a8781>>11620000
         next'ext := next'ext+1;                               <<a8781>>11630000
         end;                                                  <<a8781>>11640000
      fwritedir( newfile, buf, 13, double(newrec));            <<a8781>>11650000
      if <> then error'on'new;                                 <<a8781>>11660000
      end;                                                     <<a8781>>11670000
                                                               <<a8781>>11680000
   << build header record >>                                   <<a8781>>11690000
   zerobuf( buf, 13);                                          <<a8781>>11700000
   buf := next'ext;                                            <<a8781>>11710000
   fwritedir( newfile, buf, 13, 0d);                           <<a8781>>11720000
   if <> then error'on'new;                                    <<a8781>>11730000
                                                               <<a8781>>11740000
   << zero future entries going forward >>                     <<a8781>>11750000
   if forward' then                                            <<a8781>>11760000
      begin                                                    <<a8781>>11770000
      zerobuf( buf, 13);                                       <<a8781>>11780000
      for ldev := 256 until 999 do                             <<a8781>>11790000
         begin                                                 <<a8781>>11800000
         fwritedir( newfile, buf, 13, double(ldev));           <<a8781>>11810000
         if <> then error'on'new;                              <<a8781>>11820000
         end;                                                  <<a8781>>11830000
      end;                                                     <<a8781>>11840000
                                                               <<a8781>>11850000
   fclose( oldfile, 4, 0); << purge old file >>                <<a8781>>11860000
   if <> then error'on'old;                                    <<a8781>>11870000
   fclose( newfile, 1, 0); << save new file >>                 <<a8781>>11880000
   if <> then error'on'new;  << *bad* *bad* news >>            <<a8781>>11890000
                                                               <<a8781>>11900000
   return;                                                     <<a8781>>11910000
                                                               <<a8781>>11920000
failure:                                                       <<a8781>>11930000
   cc := ccl;                                                  <<a8781>>11940000
end;                                                           <<a8781>>11950000
$control segment=mpev'conversion                                        11960000
procedure forward'convert;                                              11970000
begin                                                                   11980000
   integer                                                              11990000
      classtabsize,                                                     12000000
      ttdttabsize,                                                      12010000
      secondarylen,                                                     12020000
      len,                                                              12030000
      i,                                                                12040000
      j,                                                                12050000
      cnt;                                                              12060000
   byte array                                                           12070000
      devexists(0:255);                                                 12080000
   byte pointer                                                         12090000
      bpntr;                                                            12100000
   integer array                                                        12110000
      glptr(@) = db+1;                                                  12120000
                                                                        12130000
   highestldev := ctab0( 18);                                           12140000
   highestdrt := ctab0( 3);                                             12150000
   nrcsdvr := ctab0( 32);                                               12160000
                                                                        12170000
   devexists := 0;                                                      12180000
   move devexists(1) := devexists,(255);                                12190000
                                                                        12200000
   <<*********************>>                                   <<v8273>>12210000
   <<   purge utilities   >>                                   <<v8273>>12220000
   <<*********************>>                                   <<v8273>>12230000
                                                               <<v8273>>12240000
   if parm.(11:1) then                                         <<v8273>>12250000
      purge'util'mpeiv;                                        <<v8273>>12260000
                                                               <<v8273>>12270000
   fcontrol( termfnum, 14, i); << disable break !!! >>         <<v8273>>12280000
                                                               <<v8273>>12290000
   fixclinfo; << do ttdt convertion if not already done >>              12300000
   if <> then go failure;                                               12310000
                                                                        12320000
   <<*************************>>                                        12330000
   <<    convert i/o tables   >>                                        12340000
   <<*************************>>                                        12350000
                                                                        12360000
   if parm.(15:1) then                                                  12370000
      begin                                                             12380000
      if logical(ctab0(41).(io'converted:1)) then                       12390000
         begin                                                          12400000
         move bline := "I/O TABLES - already converted";                12410000
         printline;                                                     12420000
         end                                                            12430000
      else                                                              12440000
         begin                                                          12450000
                                                                        12460000
         init'devdata; << build and initialize devdata file >>          12470000
         if <> then go failure;                                         12480000
                                                                        12490000
         <<**************>>                                             12500000
         <<   cs table   >>                                             12510000
         <<**************>>                                             12520000
                                                                        12530000
         tablenr := csnr;                                               12540000
         get'table'discadr( infocstab, discadr, length);                12550000
         olddiscadr( infocstab) := discadr;                             12560000
         oldtablen( infocstab) := cstabsect;                            12570000
         disc( sysdisc, read, oldtable, discadr, length);               12580000
         if <> then goto failure;                                       12590000
         zerobuf( newtable, 7168);                                      12600000
                                                                        12610000
         << move in header entry >>                                     12620000
         move newtable := oldtable,(7);                                 12630000
         << build new cs ldtx >>                                        12640000
         index := 7;                                                    12650000
         index2 := 7;                                                   12660000
         i := 0;                                                        12670000
         while i < integer(oldtable( 1)) do                             12680000
            begin                                                       12690000
            len := oldtable( index);                                    12700000
            move newtable( index2) := oldtable( index),(4);             12710000
            newtable( index2+4) := oldtable( index+3).(8:8);            12720000
            newtable( index2+3).(8:8) := 0;                             12730000
            move newtable( index2+5) := oldtable( index+4),(9);         12740000
            newtable( index2+14) := oldtable( index+13).(0:8);          12750000
            newtable( index2+15) := oldtable( index+13).(8:8);          12760000
            move newtable( index2+16) := oldtable( index+14),(len-14);  12770000
            << fix control section pointer >>                           12780000
            if newtable( index2+16) <> 0 then                  <<c8107>>12790000
               newtable( index2+16) := newtable( index2+16)+2; <<c8107>>12800000
            << fix id list section pointer >>                           12810000
            if newtable( index2+17) <> 0 then                  <<c8107>>12820000
               newtable( index2+17) := newtable( index2+17)+2; <<c8107>>12830000
            << fix phone list section pointer >>                        12840000
            if newtable( index2+18) <> 0 then                  <<c8107>>12850000
               newtable( index2+18) := newtable( index2+18)+2; <<c8107>>12860000
            newtable( index2) := newtable( index2)+2;                   12870000
            newtable := newtable+2;                                     12880000
            index2 := index2+integer(newtable(index2));                 12890000
            i := i+1;                                                   12900000
            index := index+integer(oldtable(index));                    12910000
            end;                                                        12920000
         << build new cs driver entries >>                              12930000
         newtable(6) := index2;                                         12940000
         move newtable( index2) := oldtable( index),                    12950000
            (oldtable-oldtable(6));                                     12960000
         writedevfile( devcstab, newtable, newtable);                   12970000
         if <> then goto failure;                                       12980000
         ctab0(29) := newtable;                                         12990000
                                                                        13000000
         <<******************>>                                         13010000
         <<   driver table   >>                                         13020000
         <<******************>>                                         13030000
                                                                        13040000
         tablenr := dvrtabnr;                                           13050000
         freaddir( conffnum, oldtable, (highestldev+1)*6, 9d);          13060000
         if <> then                                                     13070000
            begin                                                       13080000
            ferror( conffnum, conffile);                                13090000
            go failure;                                                 13100000
            end;                                                        13110000
         zerobuf( dvrtab, 7168);                                        13120000
         cnt := 1;                                                      13130000
         while cnt <= highestldev do                                    13140000
            begin                                                       13150000
            dvr'index := cnt*7;                                         13160000
            index := cnt*6;                                             13170000
            dvrdrtnum := oldtable(index).(0:9);                         13180000
            dvrunitnum := oldtable(index).(9:7);                        13190000
            dvrcoreres := oldtable(index+1).(0:1);                      13200000
            dvrchannum := oldtable(index+1).(1:3);                      13210000
            dvrdsbit := oldtable(index+1).(7:1);                        13220000
            dvrmasterldev := oldtable(index+1).(8:8);                   13230000
            @bpntr := @oldtable(index+2) &lsl(1);                       13240000
            if bpntr = "HIOTERM0" then                                  13250000
               begin                                                    13260000
               if type(cnt) = 16 then                                   13270000
                  move dvrname := "HIOTERM2"                            13280000
               else                                                     13290000
                  if type(cnt) = 32 then                                13300000
                     move dvrname := "HIOASLP2";                        13310000
               end                                                      13320000
            else                                                        13330000
               move dvrname := oldtable(index+2),(4);                   13340000
            if dvrdrtnum <> 0 or dvrdsbit <> 0 then                     13350000
               devexists(cnt) := 1;                                     13360000
            cnt := cnt+1;                                               13370000
            end;                                                        13380000
         length := (highestldev+1) * 7;                                 13390000
         writedevfile( devdvr, dvrtab, length);                         13400000
         if <> then go failure;                                         13410000
                                                                        13420000
         <<************************>>                                   13430000
         <<   device class table   >>                                   13440000
         <<************************>>                                   13450000
                                                                        13460000
         tablenr := classnr;                                            13470000
         get'table'discadr( infoclass, discadr, length);                13480000
         olddiscadr( infoclass) := discadr;                             13490000
         oldtablen( infoclass) := dvclsect;                             13500000
         if length > 6144 then                                          13510000
            begin                                                       13520000
            move bline := "DEVICE CLASS TABLE TOO LARGE TO CONVERT";    13530000
            printline;                                                  13540000
            goto failure;                                               13550000
            end;                                                        13560000
         disc( sysdisc, read, oldtable, discadr, length);               13570000
         if <> then goto failure;                                       13580000
         zerobuf( class, 7167);                                         13590000
         mfds( nrofclassents, 14, 2, 1);                                13600000
         @pclass := @class;                                             13610000
         @poldtable := @oldtable;                                       13620000
         cnt := 0;                                                      13630000
         while cnt < nrofclassents do                                   13640000
            begin                                                       13650000
            move pclass := poldtable,(5),1;                             13660000
            @poldtable := tos;                                          13670000
            @pclass := tos;                                             13680000
            @bpoldtable := @poldtable &lsl(1);                          13690000
            i := bpoldtable;  << nr. of ldev's >>                       13700000
            pclass := i;                                                13710000
            j := 1;                                                     13720000
            while j <= i do                                             13730000
               begin                                                    13740000
               pclass(j) := bpoldtable(j);                              13750000
               j := j+1;                                                13760000
               end;                                                     13770000
            @pclass := @pclass(j);                                      13780000
            @poldtable := @bpoldtable(j+1) &lsr(1);                     13790000
            cnt := cnt+1;                                               13800000
            end;                                                        13810000
         classtabsize := @pclass-@class;                                13820000
         ctab0(ctab0dctsize) := classtabsize;                           13830000
         writedevfile( devclass, class, classtabsize);                  13840000
         if <> then go failure;                                         13850000
                                                                        13860000
         <<****************>>                                           13870000
         <<   lpdt table   >>                                           13880000
         <<****************>>                                           13890000
                                                                        13900000
         tablenr := lpdtnr;                                             13910000
         get'table'discadr( infolpdt, discadr, length);                 13920000
         olddiscadr( infolpdt) := discadr;                              13930000
         oldtablen( infolpdt) := lpdtsect;                              13940000
         disc( sysdisc, read, oldtable, discadr, length);               13950000
         if <> then goto failure;                                       13960000
         zerobuf( lpdt, 4096);                                          13970000
         <<    format header    >>                                      13980000
         lpdt := oldtable.(0:8);                                        13990000
         lpdt(1) := 4;                                                  14000000
         <<    format table    >>                                       14010000
         cnt := 1;                                                      14020000
         while cnt <= highestldev do                                    14030000
            begin                                                       14040000
            index := cnt*2;                                             14050000
            index2 := cnt*4;                                            14060000
            lpdt(index2) := oldtable(index) land %100000;               14070000
            lpdt(index2+1) := oldtable(index+1);                        14080000
            cnt := cnt+1;                                               14090000
            end;                                                        14100000
         length := (highestldev+1) * 4; << caluate new length >>        14110000
         writedevfile( devlpdt, lpdt, length);                          14120000
         if <> then go failure;                                         14130000
                                                                        14140000
         <<***************>>                                            14150000
         <<   ldt table   >>                                            14160000
         <<***************>>                                            14170000
                                                                        14180000
         tablenr := ldtnr;                                              14190000
         get'table'discadr( infoldt, discadr, length);                  14200000
         olddiscadr( infoldt) := discadr;                               14210000
         oldtablen( infoldt) := ldtsect;                                14220000
         disc( sysdisc, read, oldtable, discadr, length);               14230000
         if <> then goto failure;                                       14240000
         zerobuf( ldt, 7167);                                           14250000
         <<    format header    >>                                      14260000
         ldt'num'entries := highestldev;                                14270000
         ldt'entry'size := 7;                                           14280000
         <<    format table    >>                                       14290000
         cnt := 1;                                                      14300000
         while cnt <= highestldev do                                    14310000
            begin                                                       14320000
            ldt'index := cnt*7;                                         14330000
            index := cnt*5;                                             14340000
            ldt(ldt'index+2) := oldtable(index+2);                      14350000
            ldt(ldt'index+3).(0:8) := oldtable(index+3).(0:8);          14360000
            ldt'spool'queues := oldtable(index+4).(7:1);       <<*8428>>14370000
            ldt'dflt'term'type := oldtable(index+4).(0:7);     <<*8428>>14380000
            ldt'dflt'out'dev := oldtable(index+3).(8:8);                14390000
            cnt := cnt+1;                                               14400000
            end;                                                        14410000
         length := (highestldev+1) * 7; << caluate new length >>        14420000
         writedevfile( devldt, ldt, length);                            14430000
         if <> then go failure;                                         14440000
                                                                        14450000
         <<****************>>                                           14460000
         <<   ldtx table   >>                                           14470000
         <<****************>>                                           14480000
                                                                        14490000
         tablenr := ldtxnr;                                             14500000
         get'table'discadr( infoldtx, discadr, length);                 14510000
         olddiscadr( infoldtx) := discadr;                              14520000
         oldtablen( infoldtx) := ldtxsect;                              14530000
         disc( sysdisc, read, oldtable, discadr, length);               14540000
         if <> then go failure;                                         14550000
         <<   build new header   >>                                     14560000
         oldtable := highestldev;                                       14570000
         oldtable(1) := 5;                                              14580000
         <<   fixup old table   >>                                      14590000
         cnt := 1;                                                      14600000
         while cnt <= highestldev do                                    14610000
            begin                                                       14620000
            if devexists(cnt) <> 0 then                                 14630000
               begin                                                    14640000
               if type(cnt) = 16 or                                     14650000
                  type(cnt) = 32 and                                    14660000
                  (subtype(cnt)=14 or subtype(cnt)=15) then             14670000
                  begin                                                 14680000
                  if not ttdt'converted then                            14690000
                     oldtable(cnt*5+1) := -1;                           14700000
                  end                                                   14710000
               else                                                     14720000
                  oldtable(cnt*5+1) := 0;                               14730000
               end;                                                     14740000
            cnt := cnt+1;                                               14750000
            end;                                                        14760000
         length := (highestldev+1) * 5;                                 14770000
         writedevfile( devldtx, oldtable, length);                      14780000
         if <> then go failure;                                         14790000
                                                                        14800000
         <<*******************************>>                            14810000
         <<   device class table header   >>                            14820000
         <<*******************************>>                            14830000
                                                                        14840000
         tablenr := dcthnr;                                             14850000
         get'table'discadr( infodcth, discadr, length);                 14860000
         olddiscadr(infodcth) := discadr;                               14870000
         oldtablen(infodcth) := dcthsect;                               14880000
         disc( sysdisc, read, oldtable, discadr, length);               14890000
         if <> then go failure;                                         14900000
         ttdttabsize := oldtable - dcthsize;                            14910000
         oldtable    := dcthsize+classtabsize+ttdttabsize;              14920000
         oldtable(1) := 1;  << entry size >>                            14930000
         oldtable(2) := nrofclassents; << # of class ents >>            14940000
         oldtable(3) := dcthsize;      << ptr to class tab >>           14950000
         oldtable(5) := dcthsize+classtabsize; <<ptr to ttdt>>          14960000
         writedevfile( devdcth, oldtable, dcthsize);                    14970000
         if <> then go failure;                                         14980000
                                                                        14990000
         build'devdata;                                                 15000000
         if <> then go failure;                                         15010000
                                                                        15020000
         ctab0(41).(io'converted:1) := 1;                               15030000
         end;                                                           15040000
      end;                                                              15050000
                                                                        15060000
   <<**********************>>                                           15070000
   <<   covert rin table   >>                                           15080000
   <<**********************>>                                           15090000
                                                                        15100000
   if parm.(13:1) then                                                  15110000
      begin                                                             15120000
      tablenr := rinnr;                                                 15130000
      if logical(ctab0(41).(rin'converted:1)) then                      15140000
         begin                                                          15150000
         move bline := "RIN TABLE - already converted";                 15160000
         printline;                                                     15170000
         end                                                            15180000
      else                                                              15190000
         begin                                                          15200000
         oldtablen( inforin) := info(23);                      <<c8456>>15210000
         discadr1 := info(18);                                          15220000
         discadr2 := info(19);                                          15230000
         olddiscadr( inforin) := discadr;                               15240000
         mfds( length, 22, 1, 1);                                       15250000
         mfds( oldtable, 22, 0, length+4);                              15260000
         nrrins := oldtable(1) / 2 -1;                                  15270000
         zerobuf( rin, 6144);                                           15280000
         <<    format header    >>                                      15290000
         rin := oldtable + oldtable/2;                                  15300000
         rin(1) := oldtable(1) + oldtable(1)/2;                         15310000
         <<    format table    >>                                       15320000
         cnt := 1;                                                      15330000
         while cnt <= nrrins do                                         15340000
            begin                                                       15350000
            index := cnt*2;                                             15360000
            index2 := cnt*3;                                            15370000
            rin( index2).(0:2) := oldtable(index).(0:2);                15380000
            case rin(index2).(0:2) of                                   15390000
               begin                                                    15400000
               rin(index2).(2:14) := oldtable(index).(2:14)+            15410000
                  oldtable(index).(2:14)/2;                             15420000
               ;                                                        15430000
               rin(index2).(2:14) := oldtable(index).(2:14)             15440000
                  - oldtable(1);                                        15450000
               ;                                                        15460000
               end;                                                     15470000
            cnt := cnt+1;                                               15480000
            end;                                                        15490000
         secondarylen := oldtable(oldtable(1)+1) * 12 +4;               15500000
         length := secondarylen + integer(rin(1)) + 4;                  15510000
         dsegnr := getdatasegc( length, 0);                             15520000
         if <> then                                                     15530000
            begin                                                       15540000
            message( rinnr, getdsegerr, dsegnr);                        15550000
            go failure;                                                 15560000
            end;                                                        15570000
         mtds( dsegnr, 0, rin, rin(1));                                 15580000
         mds( dsegnr, rin(1), 22, oldtable(1), secondarylen);           15590000
         <<   fixup free list for secondary table   >>                  15600000
         j := oldtable(1);  << new disp >>                              15610000
         exchangedb( dsegnr );                                          15620000
         i := 0;                                                        15630000
         while glptr(i) <> 0 do                                         15640000
            begin                                                       15650000
            glptr(i) := glptr(i) - j;                                   15660000
            i := glptr(i);                                              15670000
            if not(4 <= i <= secondarylen) then                         15680000
               begin                                                    15690000
               exchangedb( 0 );                                         15700000
               message( rinnr, badlinkerr, -1);                         15710000
               goto failure;                                            15720000
               end;                                                     15730000
            end;                                                        15740000
         exchangedb( 0 );  << xch db back to stk >>                     15750000
         error := get'disc'space( sysdisc, double((length+127)/128),    15760000
            discadr);                                                   15770000
         if error <> 0 then                                             15780000
            begin                                                       15790000
            message( rinnr, getdiscerr, error);                         15800000
            goto failure;                                               15810000
            end;                                                        15820000
         newdiscadr(inforin) := discadr;                                15830000
         newtablen(inforin) := length;                                  15840000
         tos := attachio( sysdisc, 0, dsegnr, 0, write,                 15850000
            length, discadr1, discadr2, 1);                             15860000
         ioerrcheck( *, *);                                             15870000
         reldataseg( dsegnr);                                           15880000
         info(18) := discadr1;                                          15890000
         info(19) := discadr2;                                          15900000
         info(23) := (length+127)/128;                                  15910000
         ctab0(41).(rin'converted:1) := 1;                              15920000
         end;                                                           15930000
      end;                                                              15940000
                                                                        15950000
   <<**********************************>>                               15960000
   <<   convert cold load info table   >>                               15970000
   <<**********************************>>                               15980000
                                                                        15990000
   ttdt'converted := 1;                                                 16000000
   zerobuf( newinfo, 384);                                              16010000
   move newinfo := info,(256);                                          16020000
   if parm.(14:1) then                                                  16030000
      begin                                                             16040000
      tablenr := clinfonr;                                              16050000
      if logical(ctab0(41).(cl'converted:1)) then                       16060000
         begin                                                          16070000
         move bline := "COLD LOAD INFO TABLE - already converted";      16080000
         printline;                                                     16090000
         end                                                            16100000
      else                                                              16110000
         begin                                                          16120000
         zerobuf( newinfo, 384);                                        16130000
         move newinfo := info,(info);                                   16140000
         cnt := 0;                                                      16150000
         while cnt < info(2) do                                         16160000
            begin                                                       16170000
            index := info + cnt*4;                                      16180000
            index2 := info + cnt*5;                                     16190000
            newinfo(index2) := info(index);                             16200000
            newinfo(index2+1) := if index >= info(1) then 1 else 0;     16210000
            newinfo(index2+2) := info(index+1);                         16220000
            newinfo(index2+3) := info(index+2);                         16230000
            newinfo(index2+4) := info(index+3);                         16240000
            cnt := cnt+1;                                               16250000
            end;                                                        16260000
         << adjust cst info pointer >>                                  16270000
         newinfo(1) := info + ((info(1)-info)/4*5);                     16280000
         ctab0(41).(cl'converted:1) := 1;                               16290000
         end;                                                           16300000
      end;                                                              16310000
                                                                        16320000
   <<***************************>>                             <<a8781>>16330000
   <<   convert asociate file   >>                             <<a8781>>16340000
   <<***************************>>                             <<a8781>>16350000
                                                               <<a8781>>16360000
   convert'assoc;                                              <<a8781>>16370000
   if <> then go failure;                                      <<a8781>>16380000
                                                               <<a8781>>16390000
   <<***********************************************>>                  16400000
   <<   build initial/sysdump communication table   >>                  16410000
   <<***********************************************>>                  16420000
                                                                        16430000
   if parm.(12:1) then                                                  16440000
      begin                                                             16450000
      build'commrec;                                                    16460000
      if > then goto failure;                                           16470000
      if < then goto failure2;                                          16480000
      end;                                                              16490000
                                                                        16500000
   fwritedir( conffnum, ctab0, 128, 0d);                                16510000
   if <> then goto failure2;                                            16520000
   disc( sysdisc, write, newinfo, 28d, 384);                            16530000
   if <> then goto failure2;                                            16540000
                                                                        16550000
                                                                        16560000
   <<   cold load info updated and writtern it is now safe   >>         16570000
   <<   to release the disc space for the old tables.        >>         16580000
                                                                        16590000
   return'space( olddiscadr, oldtablen);                                16600000
                                                                        16610000
   successful := true;                                                  16620000
   move bline := ("SUCCESSFUL CONVERSION -- UPDATE WITH ",     <<*8066>>16630000
                  "MPEV/E (G.00.00)");                         <<*8066>>16640000
   printline;                                                           16650000
                                                                        16660000
   return;                                                              16670000
failure:                                                                16680000
   <<   conversion failed! --- restore system to orginal condition    >>16690000
                                                                        16700000
   return'space( newdiscadr, newtablen);                                16710000
                                                                        16720000
   move bline := "CONVERSION FAILED.....NO MODIFITIONS DONE";           16730000
   printline;                                                           16740000
   return;                                                              16750000
                                                                        16760000
failure2:                                                               16770000
   <<   conversion failed! --- in a *bad* way >>                        16780000
                                                                        16790000
   return'space( newdiscadr, newtablen);                                16800000
                                                                        16810000
   move bline := "CONVERSION FAILED.....DISC BOOT MAY BE DAMAGED";      16820000
   printline;                                                           16830000
   move bline := "BE SURE YOUR SYSTEM IS BACKED UP!";                   16840000
   printline;                                                           16850000
   move bline := "SHUTDOWN";                                            16860000
   printline;                                                           16870000
   move bline := "COLDLOAD  WITH   PRE-MPEV/E(G.00.00)";       <<*8066>>16880000
   printline;                                                           16890000
end;  << forward'convert >>                                             16900000
$control segment=backward'convert                                       16910000
$page "     B A C K W A R D     C O N V E R S I O N"                    16920000
procedure backward'convert;                                             16930000
begin                                                                   16940000
   double                                                               16950000
      conffileadr;  << discadr of first record of confdata >>           16960000
   byte                                                                 16970000
      confldev = conffileadr;                                           16980000
   array                                                                16990000
      flab(0:127);                                                      17000000
   define disptodata = flab(%47).(0:8)#;                                17010000
   byte pointer                                                         17020000
      bpntr;                                                            17030000
   integer                                                              17040000
      classtabsize,                                                     17050000
      nrents,                                                           17060000
      entsize,                                                          17070000
      secondarylen,                                                     17080000
      length,                                                           17090000
      len,                                                              17100000
      i,                                                                17110000
      j,                                                                17120000
      cnt;                                                              17130000
                                                                        17140000
                                                                        17150000
   fgetinfo( conffnum,,,,,,,,,,,,,,,,,,,conffileadr);                   17160000
   if confldev <> 1 then go failure;                                    17170000
   confldev := 0;                                                       17180000
   disc( sysdisc, read, flab, conffileadr, 128);                        17190000
   if <> then go failure;                                               17200000
   conffileadr := conffileadr+double(disptodata);                       17210000
                                                                        17220000
   devfnum := fopen( devfile, 1, %324);                                 17230000
   if <> then                                                           17240000
      begin                                                             17250000
      ferror( devfnum, devfile);                                        17260000
      go failure;                                                       17270000
      end;                                                              17280000
                                                                        17290000
   freaddir( devfnum, devrec0, 128, 0d);                                17300000
   if <> then                                                           17310000
      begin                                                             17320000
      ferror( devfnum, devfile);                                        17330000
      go failure;                                                       17340000
      end;                                                              17350000
                                                                        17360000
   <<*********************>>                                   <<v8273>>17370000
   <<   purge utilities   >>                                   <<v8273>>17380000
   <<*********************>>                                   <<v8273>>17390000
                                                               <<v8273>>17400000
   if parm.(11:1) then                                         <<v8273>>17410000
      purge'util'mpev;                                         <<v8273>>17420000
                                                               <<v8273>>17430000
   fcontrol( termfnum, 14, i); << disable break!!! >>          <<v8273>>17440000
                                                               <<v8273>>17450000
   <<***************************>>                                      17460000
   <<   convert back to ctab0   >>                                      17470000
   <<***************************>>                                      17480000
                                                                        17490000
   if parm.(12:1) then                                                  17500000
      begin                                                             17510000
      build'ctab0;                                                      17520000
      if > then goto failure;                                           17530000
      if < then goto failure2;                                          17540000
      end;                                                              17550000
                                                                        17560000
   highestldev := ctab0( 18);                                           17570000
   highestdrt := ctab0( 3);                                             17580000
   nrcsdvr := ctab0( 32);                                               17590000
                                                                        17600000
   <<***********************>>                                          17610000
   <<   covert i/o tables   >>                                          17620000
   <<***********************>>                                          17630000
                                                                        17640000
   if parm.(15:1) then                                                  17650000
      begin                                                             17660000
      tablenr := dvrtabnr;                                              17670000
      if not logical(ctab0(41).(io'converted:1)) then                   17680000
         begin                                                          17690000
         move bline := "I/O TABLES - already converted";                17700000
         printline;                                                     17710000
         end                                                            17720000
      else                                                              17730000
         begin                                                          17740000
                                                                        17750000
         <<******************>>                                         17760000
         <<   driver table   >>                                         17770000
         <<******************>>                                         17780000
                                                                        17790000
         tablenr := dvrtabnr;                                           17800000
         readdevfile( devdvr, dvrtab, length);                          17810000
         if <> then go failure;                                         17820000
         zerobuf( oldtable, 6144);                                      17830000
         cnt := 1;                                                      17840000
         while cnt <= highestldev do                                    17850000
            begin                                                       17860000
            dvr'index := cnt*7;                                         17870000
            index := cnt*6;                                             17880000
            oldtable(index).(0:9) := dvrdrtnum;                         17890000
            oldtable(index).(9:7) := dvrunitnum;                        17900000
            oldtable(index+1).(0:1) := dvrcoreres;                      17910000
            oldtable(index+1).(1:3) := dvrchannum;                      17920000
            oldtable(index+1).(7:1) := dvrdsbit;                        17930000
            oldtable(index+1).(8:8) := dvrmasterldev;                   17940000
            @bpntr := @dvrname &lsl(1);                                 17950000
            if bpntr = "HIOTERM2" or bpntr = "HIOASLP2" then            17960000
               move oldtable(index+2) := "HIOTERM0"                     17970000
            else                                                        17980000
               move oldtable(index+2) := dvrname,(4);                   17990000
            cnt := cnt+1;                                               18000000
            end;                                                        18010000
         fwritedir( conffnum, oldtable, dvrtsize, 9d);                  18020000
         if <> then                                                     18030000
            begin                                                       18040000
            ferror( conffnum, conffile);                                18050000
            go failure;                                                 18060000
            end;                                                        18070000
         length := (highestldev+1) * 6;                                 18080000
         store'table'discadr( infodvr, conffileadr + 9d,                18090000
            length);                                                    18100000
                                                                        18110000
         <<*************************>>                                  18120000
         <<   cs defination table   >>                                  18130000
         <<*************************>>                                  18140000
                                                                        18150000
         readdevfile( devcsdef, newtable, length);                      18160000
         if <> then go failure;                                         18170000
         fwritedir( conffnum, newtable, csdeftsize, 22d);               18180000
         if <> then                                                     18190000
            begin                                                       18200000
            ferror( conffnum, conffile);                                18210000
            go failure;                                                 18220000
            end;                                                        18230000
         store'table'discadr( infocsdef, conffileadr + 22d,             18240000
            csdeftsize);                                                18250000
                                                                        18260000
         <<********************************>>                           18270000
         <<   cs additional driver table   >>                           18280000
         <<********************************>>                           18290000
                                                                        18300000
         readdevfile( devcsdvr, newtable, length);                      18310000
         if <> then go failure;                                         18320000
         fwritedir( conffnum, newtable, csdvrtsize, 21d);               18330000
         if <> then                                                     18340000
            begin                                                       18350000
            ferror( conffnum, conffnum);                                18360000
            go failure;                                                 18370000
            end;                                                        18380000
         store'table'discadr( infocsdvr, conffileadr + 21d,             18390000
            csdvrtsize);                                                18400000
                                                                        18410000
         <<**************>>                                             18420000
         <<   cs table   >>                                             18430000
         <<**************>>                                             18440000
                                                                        18450000
         tablenr := csnr;                                               18460000
         zerobuf( oldtable, cstabtsize);                                18470000
         readdevfile( devcstab, newtable, length);                      18480000
         if <> then go failure;                                         18490000
                                                                        18500000
         << build header entry >>                                       18510000
         move oldtable := newtable,(7);                                 18520000
         << build new ldtx area >>                                      18530000
         index := 7;                                                    18540000
         index2 := 7;                                                   18550000
         i := 0;                                                        18560000
         while i < integer(newtable( 1)) do                             18570000
            begin                                                       18580000
            len := newtable( index2);                                   18590000
            move oldtable( index) := newtable( index2),(4);             18600000
            oldtable( index+3).(8:8) := newtable( index2+4);   <<c8456>>18610000
            move oldtable( index+4) := newtable( index2+5),(9);         18620000
            oldtable( index+13).(0:8) := newtable( index2+14);          18630000
            oldtable( index+13).(8:8) := newtable( index2+15).(8:8);    18640000
            move oldtable( index+14) := newtable(index2+16),(len-16);   18650000
            << update csldtx pointer >>                                 18660000
            if oldtable( index+14) <> 0 then                            18670000
               oldtable( index+14) := oldtable( index+14)-2;            18680000
            << update id list pointer >>                                18690000
            if oldtable( index+15) <> 0 then                            18700000
               oldtable( index+15) := oldtable( index+15)-2;            18710000
            << update phone list pointer >>                             18720000
            if oldtable( index+16) <> 0 then                            18730000
               oldtable( index+16) := oldtable( index+16)-2;            18740000
            oldtable( index) := oldtable( index)-2;                     18750000
            oldtable := oldtable-2;                                     18760000
            index2 := index2+integer(newtable( index2));                18770000
            index := index+integer(oldtable( index));                   18780000
            i := i+1;                                                   18790000
            end;                                                        18800000
         << build new cs driver entries >>                              18810000
         oldtable(6) := index;                                          18820000
         move oldtable( index) := newtable( index2),                    18830000
            (newtable-newtable(6));                                     18840000
         << check if cs data segment is too big to fit in confdata >>   18850000
         if oldtable > cstabtsize then                         <<c8456>>18860000
            begin                                                       18870000
            move bline := "CS DATA SEGMENT TOO LARGE TO CONVERT";       18880000
            printline;                                                  18890000
            goto failure;                                               18900000
            end;                                                        18910000
         error := get'disc'space( sysdisc, double(cstabsect),           18920000
            discadr);                                                   18930000
         if error <> 0 then                                             18940000
            begin                                                       18950000
            message( csnr, getdiscerr, error);                          18960000
            goto failure;                                               18970000
            end;                                                        18980000
         newdiscadr( infocstab) := discadr;                             18990000
         newtablen( infocstab) := cstabsect;                            19000000
         disc( sysdisc, write, oldtable, discadr, cstabtsize);          19010000
         if <> then go failure;                                         19020000
         store'table'discadr( infocstab, discadr, oldtable);            19030000
         ctab0( 29) := oldtable;                                        19040000
                                                                        19050000
         <<************************>>                                   19060000
         <<   device class table   >>                                   19070000
         <<************************>>                                   19080000
                                                                        19090000
         tablenr := classnr;                                            19100000
         readdevfile( devclass, class, length);                         19110000
         if length > 6144 then                                          19120000
            begin                                                       19130000
            move bline := "DEVICE CLASS TABLE TOO LARGE TO CONVERT";    19140000
            printline;                                                  19150000
            goto failure;                                               19160000
            end;                                                        19170000
         zerobuf( oldtable, 6144);                                      19180000
         mfds( nrofclassents, 40, 2, 1);                                19190000
         @pclass := @class;                                             19200000
         @poldtable := @oldtable;                                       19210000
         cnt := 0;                                                      19220000
         while cnt < nrofclassents do                                   19230000
            begin                                                       19240000
            move poldtable := pclass,(5),1;                             19250000
            @pclass := tos;                                             19260000
            @poldtable := tos;                                          19270000
            @bpoldtable := @poldtable &lsl(1);                          19280000
            i := pclass;  << nr. of ldev's >>                           19290000
            bpoldtable := i;                                            19300000
            j := 1;                                                     19310000
            while j <= i do                                             19320000
               begin                                                    19330000
               bpoldtable(j) := pclass(j);                              19340000
               j := j+1;                                                19350000
               end;                                                     19360000
            @pclass := @pclass(j);                                      19370000
            @poldtable := @bpoldtable(j+1) &lsr(1);                     19380000
            cnt := cnt+1;                                               19390000
            end;                                                        19400000
         classtabsize := @poldtable-@oldtable;                          19410000
         if classtabsize > dvcltsize then                               19420000
            begin                                                       19430000
            move bline := "DEVICE CLASS TABLE TOO LARGE TO CONVERT";    19440000
            printline;                                                  19450000
            go failure;                                                 19460000
            end;                                                        19470000
         error := get'disc'space( sysdisc, double(dvclsect),            19480000
            discadr);                                                   19490000
         if error <> 0 then                                             19500000
            begin                                                       19510000
            message( classnr, getdiscerr, error);                       19520000
            goto failure;                                               19530000
            end;                                                        19540000
         newdiscadr(classnr) := discadr;                                19550000
         newtablen(classnr) := dvclsect;                                19560000
         disc( sysdisc, write, oldtable, discadr, dvcltsize);           19570000
         if <> then goto failure;                                       19580000
         ctab0(ctab0dctsize) := classtabsize;                           19590000
         store'table'discadr( infoclass, discadr, classtabsize);        19600000
                                                                        19610000
         <<****************>>                                           19620000
         <<   lpdt table   >>                                           19630000
         <<****************>>                                           19640000
                                                                        19650000
         tablenr := lpdtnr;                                             19660000
         readdevfile( devlpdt, lpdt, length);                           19670000
         if <> then goto failure;                                       19680000
         zerobuf( oldtable, 2048);                                      19690000
         <<    format header    >>                                      19700000
         oldtable := 2;                                                 19710000
         oldtable.(0:8) := lpdt;                                        19720000
         <<    format table    >>                                       19730000
         cnt := 1;                                                      19740000
         while cnt <= highestldev do                                    19750000
            begin                                                       19760000
            index := cnt*2;                                             19770000
            index2 := cnt*4;                                            19780000
            oldtable(index) := lpdt(index2) land %100000;               19790000
            oldtable(index+1) := lpdt(index2+1);                        19800000
            cnt := cnt+1;                                               19810000
            end;                                                        19820000
         length := (highestldev+1) * 2; << caluate new length >>        19830000
         error := get'disc'space( sysdisc, double(lpdtsect),            19840000
            discadr);                                                   19850000
         if error <> 0 then                                             19860000
            begin                                                       19870000
            message( lpdtnr, getdiscerr, error);                        19880000
            goto failure;                                               19890000
            end;                                                        19900000
         newdiscadr( infolpdt) := discadr;                              19910000
         newtablen( infolpdt) := lpdtsect;                              19920000
         disc( sysdisc, write, oldtable, discadr, lpdttsize);  <<c8456>>19930000
         if <> then goto failure;                                       19940000
         length := (highestldev+1) * 2;                                 19950000
         store'table'discadr( infolpdt, discadr, length);               19960000
                                                                        19970000
         <<***************>>                                            19980000
         <<   ldt table   >>                                            19990000
         <<***************>>                                            20000000
                                                                        20010000
         tablenr := ldtnr;                                              20020000
         readdevfile( devldt, ldt, length);                             20030000
         if <> then goto failure;                                       20040000
         zerobuf( oldtable, 5120);                                      20050000
         <<    format header    >>                                      20060000
         oldtable := 5;                                                 20070000
         oldtable.(0:8) := ldt'num'entries;                             20080000
         oldtable(1) := (highestldev+1) * 5; << class tab ptr >>        20090000
         oldtable(2) := nrofclassents;                                  20100000
         oldtable(3) := classtabsize;                                   20110000
         <<    format table    >>                                       20120000
         cnt := 1;                                                      20130000
         while cnt <= highestldev do                                    20140000
            begin                                                       20150000
            ldt'index := cnt*7;                                         20160000
            index := cnt*5;                                             20170000
            oldtable(index+1).(0:8) := ldt'spooler'pin;                 20180000
            oldtable(index+1).(8:8) := ldt'control'y'pin;               20190000
            oldtable(index+2) := ldt(ldt'index+2);                      20200000
            oldtable(index+3).(0:8) := ldt(ldt'index+3).(0:8);          20210000
            oldtable(index+3).(8:8) := ldt'dflt'out'dev;                20220000
            oldtable(index+4).(7:1) := ldt'spool'queues;       <<*8428>>20230000
            oldtable(index+4).(0:7) := ldt'dflt'term'type;     <<*8428>>20240000
            cnt := cnt+1;                                               20250000
            end;                                                        20260000
         length := (highestldev+1) * 5; << caluate new length >>        20270000
         error := get'disc'space( sysdisc, double(ldtsect),             20280000
            discadr);                                                   20290000
         if error <> 0 then                                             20300000
            begin                                                       20310000
            message( ldtnr, getdiscerr, error);                         20320000
            goto failure;                                               20330000
            end;                                                        20340000
         newdiscadr( infoldt) := discadr;                               20350000
         newtablen( infoldt) := ldtsect;                                20360000
         disc( sysdisc, write, oldtable, discadr, ldttsize);   <<c8456>>20370000
         if <> then goto failure;                                       20380000
         length := (highestldev+1) * 5;                                 20390000
         store'table'discadr( infoldt, discadr, length);                20400000
                                                                        20410000
         <<****************>>                                           20420000
         <<   ldtx table   >>                                           20430000
         <<****************>>                                           20440000
                                                                        20450000
         tablenr := ldtxnr;                                             20460000
         zerobuf( newtable, ldtxtsize);                                 20470000
         readdevfile( devldtx, newtable, length);                       20480000
         if <> then go failure;                                         20490000
         newtable := 5;                                                 20500000
         newtable.(0:8) := highestldev;                                 20510000
         newtable(1) := 0;                                              20520000
         error := get'disc'space( sysdisc, double(ldtxsect),            20530000
            discadr);                                                   20540000
         if error <> 0 then                                             20550000
            begin                                                       20560000
            message( ldtxnr, getdiscerr, error);                        20570000
            go failure;                                                 20580000
            end;                                                        20590000
         newdiscadr( infoldtx) := discadr;                              20600000
         newtablen( infoldtx) := ldtxsect;                              20610000
         disc( sysdisc, write, newtable, discadr, ldtxtsize);           20620000
         if <> then goto failure;                                       20630000
         length := (highestldev+1) * 5;                                 20640000
         store'table'discadr( infoldtx, discadr, length);               20650000
                                                                        20660000
         ctab0(41).(io'converted:1) := 0;                               20670000
         end;                                                           20680000
      end;                                                              20690000
                                                                        20700000
   <<***********************>>                                          20710000
   <<   convert rin table   >>                                          20720000
   <<***********************>>                                          20730000
                                                                        20740000
   if parm.(13:1) then                                                  20750000
      begin                                                             20760000
      tablenr := rinnr;                                                 20770000
      if not logical(ctab0(41).(rin'converted:1)) then                  20780000
         begin                                                          20790000
         move bline := "RIN TABLE - already converted";                 20800000
         printline;                                                     20810000
         end                                                            20820000
      else                                                              20830000
         begin                                                          20840000
         oldtablen( inforin) := info(23);                      <<c8456>>20850000
         discadr1 := info(18);                                          20860000
         discadr2 := info(19);                                          20870000
         olddiscadr( inforin) := discadr;                               20880000
         mfds( length, 22, 1, 1);                                       20890000
         mfds( rin, 22, 0, length+4);                                   20900000
         nrrins := rin(1) / 3 -1;                                       20910000
         zerobuf( oldtable, 4096);                                      20920000
         <<    format header    >>                                      20930000
         oldtable := rin / 3 *2;                                        20940000
         oldtable(1) := rin(1) / 3 *2;                                  20950000
         <<    format table    >>                                       20960000
         cnt := 1;                                                      20970000
         while cnt <= nrrins do                                         20980000
            begin                                                       20990000
            index := cnt*2;                                             21000000
            index2 := cnt*3;                                            21010000
            oldtable(index).(0:2) := rin( index2).(0:2);                21020000
            case oldtable(index).(0:2) of                               21030000
               begin                                                    21040000
               oldtable(index).(2:14) := rin(index2).(2:14) / 3 *2;     21050000
               ;                                                        21060000
               oldtable(index).(2:14) := rin(index2).(2:14)             21070000
                  + oldtable(1);                                        21080000
               ;                                                        21090000
               end;                                                     21100000
            cnt := cnt+1;                                               21110000
            end;                                                        21120000
         secondarylen := rin(rin(1)+1) * 12 +4;                         21130000
         length := secondarylen + integer(oldtable(1)) + 4;             21140000
         dsegnr := getdatasegc( length, 0);                             21150000
         if <> then                                                     21160000
            begin                                                       21170000
            message( rinnr, getdsegerr, dsegnr);                        21180000
            go failure;                                                 21190000
            end;                                                        21200000
         mtds( dsegnr, 0, oldtable, oldtable(1));                       21210000
         mds( dsegnr, oldtable(1), 22, rin(1), secondarylen);           21220000
         <<   fixup free list for secondary table   >>                  21230000
         j := oldtable(1);  << new disp >>                              21240000
         exchangedb( dsegnr );                                          21250000
         i := rin'(1);                                                  21260000
         while rin'(i) <> 0 do                                          21270000
            begin                                                       21280000
            rin'(i) := rin'(i) + j;                                     21290000
            i := rin'(i);                                               21300000
            if not(rin'(1) <= i <= length) then                         21310000
               begin                                                    21320000
               exchangedb( 0 ); << back to stack >>                     21330000
               message( rinnr, badlinkerr, -1);                         21340000
               goto failure;                                            21350000
               end;                                                     21360000
            end;                                                        21370000
         exchangedb( 0 );  << xch db back to stk >>                     21380000
         error := get'disc'space( sysdisc, double((length+127)/128),    21390000
            discadr);                                                   21400000
         if error <> 0 then                                             21410000
            begin                                                       21420000
            message( rinnr, getdiscerr, error);                         21430000
            goto failure;                                               21440000
            end;                                                        21450000
         newdiscadr( inforin) := discadr;                               21460000
         newtablen( inforin) := (length+127)/128;                       21470000
         tos := attachio( sysdisc, 0, dsegnr, 0, write,                 21480000
            length, discadr1, discadr2, 1);                             21490000
         ioerrcheck( *, *);                                             21500000
         reldataseg( dsegnr);                                           21510000
         info(18) := discadr1;                                          21520000
         info(19) := discadr2;                                          21530000
         info(23) := (length+127)/128;                                  21540000
         ctab0(41).(rin'converted:1) := 0;                              21550000
         end;                                                           21560000
      end;                                                              21570000
                                                                        21580000
   <<**********************************>>                               21590000
   <<   convert cold load info table   >>                               21600000
   <<**********************************>>                               21610000
                                                                        21620000
   <<   if the i/o tables have been backward converted   >>             21630000
   <<   then the cold load info table will be converted  >>             21640000
   <<   to q-mit format(the ttdt and fdcthdr entries     >>             21650000
   <<   will be deleted).                                >>             21660000
   if not ctab0(41).(io'converted:1) then                               21670000
      begin                                                             21680000
      entsize := if ctab0(41).(cl'converted:1) then 5 else 4;           21690000
      move newinfo := info,(info(1) - entsize*2),2;                     21700000
      move * := info(info(1)),(info(2)*entsize);                        21710000
      newinfo(1) := newinfo(1) - entsize*2;                             21720000
      ttdt'converted := 0;                                              21730000
      end                                                               21740000
   else                                                                 21750000
      move newinfo := info,(256);                                       21760000
                                                                        21770000
   if parm.(14:1) then                                                  21780000
      begin                                                             21790000
      tablenr := clinfonr;                                              21800000
      if not logical(ctab0(41).(cl'converted:1)) then                   21810000
         begin                                                          21820000
         move bline := "COLD LOAD INFO TABLE - already converted";      21830000
         printline;                                                     21840000
         end                                                            21850000
      else                                                              21860000
         begin                                                          21870000
         zerobuf( newinfo, 256);                                        21880000
         move newinfo := info,(info);                                   21890000
         << copy data entries >>                               <<c8456>>21900000
         cnt := 0;                                             <<c8456>>21910000
         while cnt < 12 do                                     <<c8456>>21920000
            begin                                              <<c8456>>21930000
            index := info + cnt*4;                             <<c8456>>21940000
            index2 := info + cnt*5;                            <<c8456>>21950000
            newinfo(index) := info(index2);                    <<c8456>>21960000
            newinfo(index+1) := info(index2+2);                <<c8456>>21970000
            newinfo(index+2) := info(index2+3);                <<c8456>>21980000
            newinfo(index+3) := info(index2+4);                <<c8456>>21990000
            cnt := cnt+1;                                      <<c8456>>22000000
            end;                                               <<c8456>>22010000
         << copy code entries >>                               <<c8456>>22020000
         index := index+4;                                     <<c8456>>22030000
         index2 := info(1);                                    <<c8456>>22040000
         newinfo(1) := index;  << code pointer >>              <<c8456>>22050000
         cnt := 0;                                             <<c8456>>22060000
         while cnt < info(3) do                                <<c8456>>22070000
            begin                                              <<c8456>>22080000
            newinfo(index) := info(index2);                    <<c8456>>22090000
            newinfo(index+1) := info(index2+2);                <<c8456>>22100000
            newinfo(index+2) := info(index2+3);                <<c8456>>22110000
            newinfo(index+3) := info(index2+4);                <<c8456>>22120000
            index := index+4;                                  <<c8456>>22130000
            index2 := index2+5;                                <<c8456>>22140000
            cnt := cnt+1;                                      <<c8456>>22150000
            end;                                               <<c8456>>22160000
         ctab0(41).(cl'converted:1) := 0;                               22170000
         end;                                                           22180000
      end;                                                              22190000
                                                                        22200000
   <<***************************>>                             <<a8781>>22210000
   <<   convert asociate file   >>                             <<a8781>>22220000
   <<***************************>>                             <<a8781>>22230000
                                                               <<a8781>>22240000
   convert'assoc;                                              <<a8781>>22250000
   if <> then go failure;                                      <<a8781>>22260000
                                                               <<a8781>>22270000
   fwritedir( conffnum, ctab0, 128, 0d);                                22280000
   if <> then goto failure2;                                            22290000
   disc( sysdisc, write, newinfo, 28d, 256);                            22300000
   if <> then goto failure2;                                            22310000
                                                                        22320000
                                                                        22330000
   <<   cold load info updated and writtern it is now safe   >>         22340000
   <<   to release the disc space for the old tables.        >>         22350000
                                                                        22360000
   return'space( olddiscadr, oldtablen);                                22370000
                                                                        22380000
   successful := true;                                                  22390000
   move bline:=                                                         22400000
       ("SUCCESSFUL CONVERSION -- UPDATE/COLDLOAD WITH ",      <<*8066>>22410000
        "PRE-MPEV/E(G.00.00)");                                <<*8066>>22420000
   printline;                                                           22430000
                                                                        22440000
   return;                                                              22450000
failure:                                                                22460000
   <<   conversion failed! --- restore system to orginal condition    >>22470000
                                                                        22480000
   return'space( newdiscadr, newtablen);                                22490000
                                                                        22500000
   move bline := "CONVERSION FAILED.....NO MODIFITIONS DONE";           22510000
   printline;                                                           22520000
   return;                                                              22530000
                                                                        22540000
failure2:                                                               22550000
   <<   conversion failed! --- in a *bad* way >>                        22560000
                                                                        22570000
   return'space( newdiscadr, newtablen);                                22580000
                                                                        22590000
   move bline := "CONVERSION FAILED.....DISC BOOT MAY BE DAMAGED";      22600000
   printline;                                                           22610000
   move bline := "BE SURE YOUR SYSTEM IS BACKED UP!";                   22620000
   printline;                                                           22630000
   move bline := "SHUTDOWN";                                            22640000
   printline;                                                           22650000
   move bline := "COLDLOAD  WITH   MPEV/E(G.00.00)";           <<*8066>>22660000
   printline;                                                           22670000
end;   << backward'convert >>                                           22680000
$control segment=mpev'conversion                                        22690000
procedure converting;                                                   22700000
   begin                                                                22710000
   mfds( newtable, 25, 0, 20);                                          22720000
   if newtable(1).(8:8) = %32 then                                      22730000
      begin << jmat in mpe iv format >>                                 22740000
      if newtable(9) <> 1 or newtable(11) <> 0 then                     22750000
         begin                                                          22760000
         move bline := "ALL OTHER JOBS AND SESSIONS MUST BE LOGGED OFF";22770000
         printline;                                                     22780000
         terminate;                                                     22790000
         end;                                                           22800000
      end                                                               22810000
   else                                                                 22820000
      begin << jmat in mpe v format >>                                  22830000
      if newtable(11) <> 1 or newtable(13) <> 0 then                    22840000
         begin                                                          22850000
         move bline := "ALL OTHER JOBS AND SESSIONS MUST BE LOGGED OFF";22860000
         printline;                                                     22870000
         terminate;                                                     22880000
         end;                                                           22890000
      end;                                                              22900000
                                                                        22910000
                                                                        22920000
   <<    initialize tables and variables    >>                          22930000
   tablenr := -1;                                                       22940000
                                                                        22950000
   cnt := 0;                                                            22960000
   while cnt < nrtables do                                              22970000
      begin                                                             22980000
      olddiscadr(cnt) := 0d;                                            22990000
      oldtablen(cnt) := 0;                                              23000000
      newdiscadr(cnt) := 0d;                                            23010000
      newtablen(cnt) := 0;                                              23020000
      cnt := cnt+1;                                                     23030000
      end;                                                              23040000
                                                                        23050000
    case system'type of begin                                           23060000
      forward':=true;   << mpe iv ==> mpe v/e >>                        23070000
      forward':=true;                                                   23080000
      forward':=false;  << mpe v/e ==> mpe iv >>                        23090000
      end;                                                              23100000
                                                                        23110000
   verify'intent;                                                       23120000
                                                                        23130000
                                                                        23140000
   <<    read cold load info table   >>                                 23150000
   disc( sysdisc, read, info, 28d, 256);                                23160000
   if <> then terminate;                                                23170000
                                                                        23180000
                                                                        23190000
   conffnum := fopen( conffile, 1, %324); << open confdata >>           23200000
   if <> then                                                           23210000
      begin                                                             23220000
      ferror( conffnum, conffile);                                      23230000
      terminate;                                                        23240000
      end;                                                              23250000
   freaddir( conffnum, ctab0, 128, 0d);                                 23260000
   if <> then                                                           23270000
      begin                                                             23280000
      ferror( conffnum, conffile);                                      23290000
      terminate;                                                        23300000
      end;                                                              23310000
                                                                        23320000
   if forward' then                                                     23330000
      forward'convert                                                   23340000
   else                                                                 23350000
      backward'convert;                                                 23360000
                                                                        23370000
   fclose( conffnum, 0, 0);                                             23380000
   fclose( devfnum, 0, 0);                                              23390000
                                                                        23400000
   if successful then                                                   23410000
      begin                                                             23420000
      pause( pausetime); << wait for terminal i/o to complete >>        23430000
      assemble( halt 15 );                                              23440000
      end;                                                              23450000
  end;  << converting >>                                                23460000
$control segment=verify'conversion                                      23470000
integer procedure thiscpu;                                              23480000
option external;                                                        23490000
$page "  V E R I F Y I N G  -  -  -  GET'SYTEM'TYPE"                    23500000
integer procedure get'system'type;                                      23510000
comment                                                                 23520000
                                                                        23530000
  this procedure will return the type of conversion we are              23540000
verifying for.                                                          23550000
                                                                        23560000
returns:                                                                23570000
                                                                        23580000
  0 --  converting from mpe iv to mpe v (new microcode)                 23590000
  1 --  converting from mpe iv to mpe v (old microcode)                 23600000
  2 --  converting from mpe v to mpe iv                                 23610000
                                                                        23620000
                                                                        23630000
endcomment;                                                             23640000
begin                                                                   23650000
integer pointer pcb = 3;                                                23660000
integer size,cpu;                                                       23670000
                                                                        23680000
size := pcb(1);  << entry size cell of pcb header >>                    23690000
if size = 16 then                                                       23700000
  begin                                                                 23710000
  cpu:=thiscpu;                                                         23720000
  if 0<=cpu<=3 then                                                     23730000
    begin                                                               23740000
    move bline:="*WARNING This CPU is not supported by";               23750000
    printline;                                                          23760000
    move bline:="         by MPE V.  Contact your SE  ";                23770000
    printline;                                                          23780000
    get'system'type:=-1;                                                23790000
    end                                                                 23800000
  else if cpu=4                                                         23810000
    then get'system'type:=1                                             23820000
  else get'system'type:=0;                                              23830000
  end                                                                   23840000
else if size = 21                                                       23850000
  then get'system'type := 2                                             23860000
else begin                                                              23870000
  move bline := "System Type not recognized";                           23880000
  printline;                                                            23890000
  move bline := "Contact your SE";                                      23900000
  printline;                                                            23910000
  printline;                                                            23920000
  terminate;                                                            23930000
  end;                                                                  23940000
end;  << get'system'type >>                                             23950000
$page "  V E R I F Y I N G  -  -  -  GETSPACE"                          23960000
logical procedure getspace(nrentries, entrysize, where, b32);  <<v8273>>23970000
   value nrentries,entrysize,where,b32;                        <<v8273>>23980000
   integer nrentries, entrysize, where;                        <<v8273>>23990000
   logical b32;                                                <<v8273>>24000000
begin  comment                                                          24010000
                                                                        24020000
      where                                                             24030000
        0    - anywhere                                                 24040000
        1    - bank 0 only                                              24050000
        2    - bank 0 above sysglob                                     24060000
        3    - not bank 0                                               24070000
        4    - temporary storage                                        24080000
      b32                                                               24090000
        align on a 32 word boundary                                     24100000
                                                                        24110000
comment:  each cell of the array address points to the first            24120000
available word in its associated bank.  thus, the memory                24130000
addresses that are less than address(bank#) are in use  and             24140000
the higher ones are free.  note that address(bank#) is the              24150000
amount of the bank in use while -address(bank#) is the                  24160000
amount of free space in that bank.                                      24170000
;                                                                       24180000
                                                                        24190000
   double  inittable,                                                   24200000
           memadr = inittable;                                          24210000
   integer lowlimit,                                                    24220000
           highlimit;                                                   24230000
   logical done,                                                        24240000
           i,                                                           24250000
           tabsize,                                                     24260000
           bank     = inittable,                                        24270000
           coreaddr = inittable+1,                                      24280000
           hclimit,                                                     24290000
           lclimit;                                                     24300000
   define temporary = (where=4)#;                                       24310000
                                                                        24320000
   define lcmemloc = address(num'banks+1)#;                             24330000
                                                                        24340000
   equate sysbase = %1000;                                              24350000
                                                                        24360000
getspace:=true;                                                         24370000
   tabsize := ((nrentries*entrysize+3)/4)*4;                            24380000
   lowlimit := if where = 3 then 1 else 0;                              24390000
   hclimit := 65530; << 65536-amount initial needs >>                   24400000
   highlimit := if where = 1 or where = 2 then 1                        24410000
                                          else num'banks;               24420000
   lclimit := sysbase;                                                  24430000
                                                                        24440000
   done := false;                                                       24450000
                                                                        24460000
   if not ( 2 <= where <= 3 ) then                                      24470000
      begin  << search area between 0 and sysbase >>                    24480000
      bank := 0;                                                        24490000
      coreaddr := if b32 then (lcmemloc+31)/32*32 else                  24500000
         lcmemloc;                                                      24510000
      if coreaddr+tabsize <= lclimit then                               24520000
         begin                                                          24530000
         if not temporary then                                          24540000
            lcmemloc := coreaddr + tabsize;                             24550000
         done := true;                                                  24560000
         end;                                                           24570000
      end;                                                              24580000
                                                                        24590000
   i := lowlimit;                                                       24600000
   while (i <> logical(highlimit)) and not done do                      24610000
      begin                                                             24620000
      bank := i;                                                        24630000
      coreaddr := if b32 then (address(bank)+31)/32*32                  24640000
         else address(bank);                                            24650000
      if tabsize <= -(coreaddr+5) then                                  24660000
         begin                 <<^insure 3 wds for trailer>>            24670000
         if bank=0 and (coreaddr+tabsize < hclimit) or                  24680000
            bank <> 0 then                                              24690000
            begin                                                       24700000
            done := true;                                               24710000
            if not temporary then                                       24720000
               address(bank) := coreaddr + tabsize;                     24730000
            end;                                                        24740000
         end;                                                           24750000
      i := i+1;                                                         24760000
      end;                                                              24770000
                                                                        24780000
   if not done then  << out of memory >>                                24790000
     begin                                                              24800000
      amtmemneeded := amtmemneeded+double(tabsize);            <<v8273>>24810000
      if where=1 or where=2 then                               <<v8273>>24820000
         bank0needed := bank0needed+double(tabsize);           <<v8273>>24830000
      getspace := false;                                       <<v8273>>24840000
     end;                                                               24850000
                                                                        24860000
   if where=1 or where=2 then                                           24870000
      begin                                                             24880000
      tos := hclimit;                                                   24890000
      assemble(neg);                                                    24900000
      bank0 := address(bank) + tos;                                     24910000
      end;                                                              24920000
end;  << getspace >>                                                    24930000
$page "  V E R I F Y I N G  -  -  -  INIT'TABLES"                       24940000
logical procedure chkmemsize;                                  <<v8273>>24950000
comment                                                                 24960000
                                                                        24970000
   this procedure will 1) input the first record of confdata an         24980000
2) make sure that enough memory is configured on a conversion f         24990000
mpe v to mpe iv.                                                        25000000
                                                                        25010000
inputs:                                                                 25020000
                                                                        25030000
  system'type  -- the type of system conversion (0 is iv to v (new),    25040000
                  1 is iv to v (old), 2 is v to iv)                     25050000
                                                                        25060000
outputs:                                                                25070000
                                                                        25080000
  conffnum     -- the confdata file number                              25090000
                                                                        25100000
  ctab0        -- record 0 of the confdata file.                        25110000
                                                                        25120000
  memsize      -- configured size (in banks) of the system.             25130000
                                                                        25140000
globals used:                                                           25150000
                                                                        25160000
  conffile     -- array containing the name "CONFDATA"                  25170000
                                                                        25180000
endcomment;                                                             25190000
begin                                                                   25200000
array                                                          <<v8273>>25210000
   ctab0(0:127);                                               <<v8273>>25220000
integer                                                        <<v8273>>25230000
   memsize;                                                    <<v8273>>25240000
                                                               <<v8273>>25250000
                                                                        25260000
freaddir( conffnum,ctab0,128,0d);                                       25270000
if <> then                                                              25280000
  begin                                                                 25290000
  ferror( conffnum,conffile);                                           25300000
  terminate;                                                            25310000
  end;                                                                  25320000
if mpeiv then                                                           25330000
  memsize := ctab0(3) / 64                                              25340000
else memsize := ctab0(0) /64;                                           25350000
if mpev then                                                            25360000
  begin                                                                 25370000
  if memsize < 4 then                                                   25380000
    begin                                                               25390000
    move bline:="*WARNING  MPEV systems must have at";                 25400000
    printline;                                                          25410000
    move bline:="least 512 K bytes (256 K words) of main ";             25420000
    printline;                                                          25430000
    move bline:="memory configured on the system before ";              25440000
    printline;                                                          25450000
    move bline:="conversion is attempted";                              25460000
    printline;                                                          25470000
    printline;                                                          25480000
    chkmemsize := true;                                        <<v8273>>25490000
    end;                                                                25500000
  end;                                                                  25510000
end;                                                                    25520000
$page "  V E R I F Y I N G  -  -  -  DISC'SPACE'RETURN"                 25530000
$control segment=help                                          <<v8273>>25540000
procedure help'facility;                                       <<v8273>>25550000
begin                                                          <<v8273>>25560000
   byte array msg(*) = pb :=                                   <<v8273>>25570000
"   This program must be run BEFORE updating a system from",0, <<v8273>>25580000
"Ciper (C/D.00.20), Q-mit (C/D.01.00), Q-delta1 (C/D.01.01)",0,<<v8273>>25590000
"Q-delta2 (C/D.01.02), or MPEV/P (E/F.00.00), to MPEV/E.",0,   <<v8273>>25600000
"This program must be run again on MPE V/E, if you wish to",0, <<v8273>>25610000
"return to one of the above MPE IV systems.  The following",0, <<v8273>>25620000
"tables will be converted to MPE V/E format",0,0,              <<v8273>>25630000
"I/O TABLES",0,0,                                              <<v8273>>25640000
"CS Table",0,"CS Def Table",0,"CS additional driver table",0,  <<v8273>>25650000
"Driver Table",0,"Terminal Type Descriptor Table",0,           <<v8273>>25660000
"Device Class Table",0,"LPDT",0,"LDT",0,"LDTX",0,              <<v8273>>25670000
"Device Class Table Header",0,0,                               <<v8273>>25680000
"OTHER TABLES",0,0,                                            <<v8273>>25690000
"RIN Table",0,"Cold Load Information Table",0,                 <<v8273>>25700000
"CONFDATA FILE",0,"Sysdump/Initial Communication Table",0,0,   <<v8273>>25710000
"DRIVER REPLACEMENT",0,0,                                      <<v8273>>25720000
"MPE V    HIOTERM0  TYPE 16  -->  HIOTERM2",0,                 <<v8273>>25730000
"         HIOTERM0  TYPE 32  -->  HIOASLP2",0,                 <<v8273>>25740000
"MPE IV   HIOTERM2           -->  HIOTERM0",0,                 <<v8273>>25750000
"         HIOASLP2           -->  HIOTERM0",0,0,               <<v8273>>25760000
"PURGED UTILITIES",0,0,                                        <<v8273>>25770000
"      CONVERSION TO",0,                                       <<v8273>>25780000
"    MPE V      MPE IV",0,0,                                   <<v8273>>25790000
"  RECOVER2   RECOVER5",0,                                     <<a8781>>25800000
"  DPAN4      DPAN5",0,                                        <<v8273>>25810000
"  LISTLOG2   LISTLOG5",0,                                     <<v8273>>25820000
"  LISTEQ2    LISTEQ5",0,                                      <<v8273>>25830000
"  DISKED2    DISKED5",0,                                      <<v8273>>25840000
"  LISTDIR2   LISTDIR5",0,                                     <<v8273>>25850000
"  SPOOK      SPOOK5",0,                                       <<v8273>>25860000
"  ASOCTABL   ASOCTBL5",0,                                     <<v8273>>25870000
"  ATPDSM     TERMDSM",0,                                      <<a8781>>25880000
"  FREE2      FREE5",0,0,                                      <<v8273>>25890000
"The PCONVERT program requires SM capability, and the logon",0,<<v8273>>25900000
"must be MANAGER.SYS,PUB.  No other users are allowed to be",0,<<v8273>>25910000
"logged on during the conversion.   Upon successful",0,        <<v8273>>25920000
"conversion the system will HALT and an update to the",0,      <<v8273>>25930000
"new/old system MUST be performed.  The syntax is as follows:",<<v8273>>25940000
0,0,                                                           <<v8273>>25950000
":RUN PCONVERT",0,0,                                           <<v8273>>25960000
"PCONVERT will automaticly determine whether a forward or",0,  <<v8273>>25970000
"backward conversion is required.  PCONVERT executed on a",0,  <<v8273>>25980000
"MPE IV or MPE V/P system will convert the table structures",0,<<v8273>>25990000
"to MPE V/E format.  PCONVERT executed on a MPE V/E system",0, <<v8273>>26000000
"will convert the table structures to MPE IV format.",0,0,     <<v8273>>26010000
"VERIFICATION",0,0,                                            <<v8273>>26020000
"(1)  Will check if this CPU model will support MPE V/E.",0,0, <<v8273>>26030000
"(2)  Will check if there is enough main memory to support",0, <<v8273>>26040000
"     MPE V/E.",0,0,                                           <<v8273>>26050000
"(3)  Will check if there is enough disc space to update to",0,<<v8273>>26060000
"     MPE V/E.",0,0,                                           <<v8273>>26070000
"(4)  Will check if any non-standard drivers are configured.", <<v8273>>26080000
0,"     These devices should be deleted from the",             <<v8273>>26090000
" configuration",0,"     before the update.",0,0,              <<v8273>>26100000
"(5)  Will check if core resident tables will fit in main",0,  <<v8273>>26110000
"     memory.",0,0,                                            <<v8426>>26120000
"(6)  On backward conversion, will check if any tables are",0, <<v8273>>26130000
"     over MPE IV maximums.",0,0,                              <<v8273>>26140000
"(7)  On backward conversion, will check if directory was",0,  <<v8273>>26150000
"     expanded, if so an update must be done to a MIT",0,      <<v8273>>26160000
"     that has the directory patches installed.",0,0,          <<v8273>>26170000
"Running PCONVERT will do two things:",0,0,                    <<v8273>>26180000
"(1)  It will first go through a verification process,",0,     <<v8273>>26190000
"     checking to see if the table conversion can be done;",0, <<v8273>>26200000
"(2)  and it will then perform the actual table conversion.",0,<<v8273>>26210000
0,                                                             <<v8273>>26220000
"There are five different options that can be specified on",0, <<v8273>>26230000
"the run of PCONVERT.",0,0,                                    <<v8273>>26240000
"(1)  :RUN PCONVERT,VERIFY",0,                                 <<v8273>>26250000
"     This option forces a VERIFY only.  The normal",0,        <<v8273>>26260000
"     security checking does not apply to this option.",0,0,   <<v8273>>26270000
"(2)  :RUN PCONVERT,CONVERT",0,                                <<v8273>>26280000
"     This option forces a conversion without verification.",0,<<v8273>>26290000
"     This may used when your tables are over MPE IV",0,       <<v8273>>26300000
"     maximums during a conversion backwards and you plan",0,  <<v8273>>26310000
"     to do a COLDLOAD for example.",0,0,                      <<v8273>>26320000
"(3)  :RUN PCONVERT,FORWD",0,                                  <<v8273>>26330000
"     This option forces a forward conversion without",0,      <<v8426>>26340000
"     verification.",0,0,                                      <<v8426>>26350000
"(4)  :RUN PCONVERT,BACKWD",0,                                 <<v8273>>26360000
"     This option forces a backward conversion without",0,     <<v8426>>26370000
"     verification.",0,0,                                      <<v8426>>26380000
"(5)  :RUN PCONVERT,HELP",0,                                   <<v8273>>26390000
"     This help facility.",0,                                  <<v8273>>26400000
   0,255; << terminator >>                                     <<v8273>>26410000
                                                               <<v8273>>26420000
   integer                                                     <<v8273>>26430000
      cnt   := 0,                                              <<v8273>>26440000
      col   := 0;                                              <<v8273>>26450000
   byte array                                                  <<v8273>>26460000
      char(0:1) = q;                                           <<v8273>>26470000
                                                               <<v8273>>26480000
   subroutine nextchar;                                        <<v8273>>26490000
   begin                                                       <<v8273>>26500000
      move char := msg(cnt),(1);                               <<v8273>>26510000
      cnt := cnt+1;                                            <<v8273>>26520000
   end;                                                        <<v8273>>26530000
                                                               <<v8273>>26540000
   nextchar;                                                   <<v8273>>26550000
   while char <> 255 do                                        <<v8273>>26560000
      begin                                                    <<v8273>>26570000
      col := 0;                                                <<v8273>>26580000
      while char <> 0 do                                       <<v8273>>26590000
         begin                                                 <<v8273>>26600000
         bline(col) := char;                                   <<v8273>>26610000
         col := col+1;                                         <<v8273>>26620000
         nextchar;                                             <<v8273>>26630000
         end;                                                  <<v8273>>26640000
      printline;                                               <<v8273>>26650000
      nextchar;                                                <<v8273>>26660000
      end;                                                     <<v8273>>26670000
end;                                                           <<v8273>>26680000
$control segment=verify'conversion                             <<v8273>>26690000
logical procedure chkmpe4max;                                  <<v8273>>26700000
begin                                                          <<v8273>>26710000
   array tables(*) = pb :=                                     <<v8273>>26720000
   << table name                 confwd   mpe4     mpe5 >>     <<v8273>>26730000
      "LOGICAL DEVICES       ",   127,     255,     999,       <<v8273>>26740000
      "CST                   ",     0,     192,    2048,       <<v8273>>26750000
      "CSTX                  ",     5,    8191,    8191,       <<v8273>>26760000
      "DST                   ",     1,    1024,    4096,       <<v8273>>26770000
      "PCB                   ",     2,     256,    1024,       <<v8273>>26780000
      "I/O QUEUE             ",     3,     255,    1300,       <<v8273>>26790000
      "DISC REQUEST QUEUE    ",    44,     255,     900,       <<v8273>>26800000
      "TBUF                  ",     4,      99,      99,       <<v8273>>26810000
      "SBUF                  ",    12,     253,     253,       <<v8273>>26820000
      "SWAP                  ",    47,    2048,    5400,       <<v8273>>26830000
      "PRIMARY MESSAGE       ",    46,     255,    1023,       <<v8273>>26840000
      "SECONDARY MESSAGE     ",    48,     255,    1023,       <<v8273>>26850000
      "SPECIAL REQUEST       ",    45,     255,    2048,       <<v8273>>26860000
      "ICS                   ",     6,    2048,    4096,       <<v8273>>26870000
      "UCOP                  ",     7,     256,    1024,       <<v8273>>26880000
      "TIMER REQUEST LIST    ",     9,     255,    1023,       <<v8273>>26890000
      "BREAKPOINT            ",     8,     255,    1024,       <<v8273>>26900000
      "USERS PER LOG PROCESS ",    43,     128,     256,       <<v8273>>26910000
      "MAX SESSIONS          ",    40,     255,     500,       <<v8273>>26920000
      "MAX JOBS              ",    41,     255,     500,       <<v8273>>26930000
      "MAX CONCURRENT PGMS   ",    13,     127,     511,       <<v8273>>26940000
      "MAX CODE SEGS/PROCESS ",    31,      63,     255,       <<v8273>>26950000
      0;                                                       <<v8273>>26960000
   equate                                                      <<v8273>>26970000
      name       = 0,                                          <<v8273>>26980000
      namesize   = 11,                                         <<v8273>>26990000
      confwd     = namesize,                                   <<v8273>>27000000
      mpe4       = confwd+1,                                   <<v8273>>27010000
      mpe5       = mpe4+1,                                     <<v8273>>27020000
      entrysize  = mpe5+1;                                     <<v8273>>27030000
   integer                                                     <<v8273>>27040000
      inx    := 0;                                             <<v8273>>27050000
   logical                                                     <<v8273>>27060000
      nohdr  := true;                                          <<v8273>>27070000
   logical                                                     <<v8273>>27080000
      failed = chkmpe4max;                                     <<v8273>>27090000
   array                                                       <<v8273>>27100000
      comm(0:127),                                             <<v8273>>27110000
      ctab(0:127);                                             <<v8273>>27120000
                                                               <<v8273>>27130000
   disc( sysdisc, read, comm, 31d, 128);                       <<v8273>>27140000
   if <> then terminate;                                       <<v8273>>27150000
                                                               <<v8273>>27160000
   freaddir( conffnum, ctab, 128, 1d);                         <<v8273>>27170000
   if <> then                                                  <<v8273>>27180000
      begin                                                    <<v8273>>27190000
      ferror( conffnum, conffile);                             <<v8273>>27200000
      terminate;                                               <<v8273>>27210000
      end;                                                     <<v8273>>27220000
                                                               <<v8273>>27230000
   if ctab(21) > 6112 then                                     <<v8273>>27240000
      begin                                                    <<v8273>>27250000
      move bline := ("*WARNING -- DIRECTORY IS GREATER",      <<v8273>>27260000
         " THAN 6112 SECTORS");                                <<v8273>>27270000
      printline;                                               <<v8273>>27280000
      move bline := ("   You must UPDATE with one",            <<v8273>>27290000
         " of the following MITS");                            <<v8273>>27300000
      printline;                                               <<v8273>>27310000
      move bline := "      MPEV/P (E.B0.00)";                  <<v8273>>27320000
      printline;                                               <<v8273>>27330000
      move bline := "      MPEV/P WITH DIRECTORY PATCHES";     <<v8273>>27340000
      printline;                                               <<v8273>>27350000
      move bline := "      Q-MIT WITH DIRECTORY PATCHES";      <<v8273>>27360000
      printline;                                               <<v8273>>27370000
      move bline := "      CONSULT WITH YOUR LOCAL SE";        <<v8273>>27380000
      printline;                                               <<v8273>>27390000
      printline;                                               <<v8273>>27400000
      end;                                                     <<v8273>>27410000
                                                               <<v8273>>27420000
   << kludge to check for highest ldev >>                      <<v8273>>27430000
   ctab(127) := comm(8); << highest ldev >>                    <<v8273>>27440000
                                                               <<v8273>>27450000
   inx := 0;                                                   <<v8273>>27460000
   while tables(inx+name) <> 0 do                              <<v8273>>27470000
      begin                                                    <<v8273>>27480000
      if ctab( tables(inx+confwd)) > tables(inx+mpe4) then     <<v8273>>27490000
         begin                                                 <<v8273>>27500000
         if nohdr then                                         <<v8273>>27510000
            begin                                              <<v8273>>27520000
            failed := true;                                    <<v8273>>27530000
            nohdr := false;                                    <<v8273>>27540000
            move bline := ("*WARNING -- THE FOLLOWING TABLES",<<v8273>>27550000
               " ARE OVER PRE-MPEV/E MAXIMUMS");               <<v8273>>27560000
            printline;                                         <<v8273>>27570000
            printline;                                         <<v8273>>27580000
            move bline := ("TABLE NAME             CURRENT",   <<v8273>>27590000
               " SIZE   PRE-MPEV/E MAX");                      <<v8273>>27600000
            printline;                                         <<v8273>>27610000
            end;                                               <<v8273>>27620000
         move line := tables(inx+name),(namesize);             <<v8273>>27630000
         ascii( ctab(tables(inx+confwd)),-10,bline(31));       <<v8273>>27640000
         ascii( tables(inx+mpe4),-10,bline(47));               <<v8273>>27650000
         printline;                                            <<v8273>>27660000
         end;                                                  <<v8273>>27670000
      inx := inx+entrysize;                                    <<v8273>>27680000
      end;                                                     <<v8273>>27690000
                                                               <<v8273>>27700000
   if failed then printline;                                   <<v8273>>27710000
                                                               <<v8273>>27720000
end; <<chkmpe4max>>                                            <<v8273>>27730000
                                                               <<v8273>>27740000
logical procedure chkdiscutil;                                 <<v8273>>27750000
begin                                                          <<v8273>>27760000
   double array sizes(*) = pb :=                               <<v8273>>27770000
      14000d,      << system sl            >>                  <<v8273>>27780000
       2000d,      << system programs      >>                  <<v8273>>27790000
       1000d,      << new converted tables >>                  <<v8273>>27800000
          0d;      << terminator           >>                  <<v8273>>27810000
   double array                                                <<v8273>>27820000
      discadr(0:19); << holds disc addresses of aquired space>><<v8273>>27830000
   double                                                      <<v8273>>27840000
      amtneeded;                                               <<v8273>>27850000
   integer                                                     <<v8273>>27860000
      failed = chkdiscutil,                                    <<v8273>>27870000
      status,                                                  <<v8273>>27880000
      cnt;                                                     <<v8273>>27890000
                                                               <<v8273>>27900000
   zerobuf( discadr, 40);                                      <<v8273>>27910000
                                                               <<v8273>>27920000
   << get disc space >>                                        <<v8273>>27930000
   cnt := 0;                                                   <<v8273>>27940000
   while sizes(cnt) <> 0d do                                   <<v8273>>27950000
      begin                                                    <<v8273>>27960000
      status :=get'disc'space(sysdisc,sizes(cnt),discadr(cnt));<<v8273>>27970000
      if status <> 0 then discadr(cnt) := 0d;                  <<v8273>>27980000
      cnt := cnt+1;                                            <<v8273>>27990000
      end;                                                     <<v8273>>28000000
                                                               <<v8273>>28010000
   << return disc space, compute amount needed >>              <<v8273>>28020000
   amtneeded := 0d;                                            <<v8273>>28030000
   cnt := 0;                                                   <<v8273>>28040000
   while sizes(cnt) <> 0d do                                   <<v8273>>28050000
      begin                                                    <<v8273>>28060000
      if discadr(cnt) <> 0d then                               <<v8273>>28070000
         return'disc'space(sysdisc,discadr(cnt),sizes(cnt))    <<v8273>>28080000
      else                                                     <<v8273>>28090000
         amtneeded := amtneeded + sizes(cnt);                  <<v8273>>28100000
      cnt := cnt+1;                                            <<v8273>>28110000
      end;                                                     <<v8273>>28120000
                                                               <<v8273>>28130000
   if amtneeded > 0d then                                      <<v8273>>28140000
      begin                                                    <<v8273>>28150000
      failed := true;                                          <<v8273>>28160000
      move bline := ("*WARNING -- This system does not have", <<v8273>>28170000
         " enough disc space");                                <<v8273>>28180000
      printline;                                               <<v8273>>28190000
      move bline := "   on LDEV 1 to convert to MPE V/E";      <<v8273>>28200000
      printline;                                               <<v8273>>28210000
      move bline := "   You need an additional ",2;            <<v8273>>28220000
      tos := tos + dascii( amtneeded, 10, bps0);               <<v8273>>28230000
      move * := " sectors of contiguous disc space";           <<v8273>>28240000
      printline;                                               <<v8273>>28250000
      printline;                                               <<v8273>>28260000
      end;                                                     <<v8273>>28270000
                                                               <<v8273>>28280000
end; <<chkdiscutil>>                                           <<v8273>>28290000
integer procedure dstsize( dstn);                              <<v8273>>28300000
   value dstn;                                                 <<v8273>>28310000
   integer dstn;                                               <<v8273>>28320000
begin                                                          <<v8273>>28330000
   dstsize := abs(abs(2)+dstn*4).(3:13)*4;                     <<v8273>>28340000
end;                                                           <<v8273>>28350000
logical procedure ckiotables( hldev, hdrt, nrterms);           <<v8273>>28360000
   value hldev, hdrt;                                          <<v8273>>28370000
   integer hldev, hdrt, nrterms;                               <<v8273>>28380000
begin                                                          <<v8273>>28390000
   integer array drivers(*) = pb :=                            <<v8273>>28400000
    << dvr name    ilt 4   dit 4   ilt 5   dit 5 >>            <<v8273>>28410000
                                                               <<v8273>>28420000
      "HIOASLP0",     20,     16,     26,     17,              <<v8426>>28430000
      "HIOASLP2",    298,     37,    220,     17,              <<v8426>>28440000
      "HIOCDRD0",    100,     12,    187,     13,              <<v8426>>28450000
      "HIOCIPR0",     62,     13,     63,     13,              <<v8426>>28460000
      "HIOCTAP0",    166,     27,    166,     28,              <<v8426>>28470000
      "HIOFLOP0",    266,     25,    266,     27,              <<v8426>>28480000
      "HIOLPRT0",     90,     11,     91,     14,              <<v8426>>28490000
      "HIOLPRT1",    112,     11,    113,     12,              <<v8426>>28500000
      "HIOLPRT2",    142,     11,    143,     14,              <<v8426>>28510000
      "HIOMDSC1",    194,     37,    194,     38,              <<v8426>>28520000
      "HIOMDSC2",    162,     27,    162,     30,              <<v8426>>28530000
      "HIOPPRT0",     54,     33,     55,     34,              <<v8426>>28540000
      "HIOTAPE0",    122,     13,    122,     14,              <<v8426>>28550000
      "HIOTAPE1",    145,     14,    145,     15,              <<v8426>>28560000
      "HIOTAPE2",    171,     14,    171,     14,              <<v8426>>28570000
      "HIOTEPE0",    246,     51,    246,     51,              <<v8426>>28580000
      "HIOTERM0",    298,     37,    220,     21,              <<v8426>>28590000
      "HIOTERM1",     20,     20,     26,     21,              <<v8426>>28600000
      "HIOTERM2",    298,     37,    220,     21,              <<v8426>>28610000
      "IODS0   ",      0,     23,      0,     30,              <<v8426>>28620000
      "IODSTRM0",      0,     18,      0,     24,              <<v8426>>28630000
      "IODSTRMX",      0,     21,      0,     27,              <<v8426>>28640000
      "IODSX   ",      0,     45,      0,     50,              <<v8426>>28650000
      "IOINP0  ",     14,    216,     14,    219,              <<v8426>>28660000
      "IOM3270 ",      0,     18,      0,     21,              <<v8426>>28670000
      "IOMCONS0",      0,     14,      0,     16,              <<v8426>>28680000
      "IOMPLP0 ",      0,     14,      0,     14,              <<v8426>>28690000
      "IOMPNLP0",      0,     14,      0,     16,              <<v8426>>28700000
      "IOMPS0  ",      0,     22,      0,     22,              <<v8426>>28710000
      "IOMPTRM0",      0,     14,      0,     14,              <<v8426>>28720000
      "IOMRDR0 ",      0,     14,      0,     16,              <<v8426>>28730000
      "IOMRJE0 ",      0,     26,      0,     41,              <<v8426>>28740000
      "IOMRJE1 ",      0,     15,      0,     16,              <<v8426>>28750000
      "IONRDR0 ",      0,     11,      0,     13,              <<a8600>>28760000
      "IOPAD0  ",      0,     63,      0,     66,              <<v8426>>28770000
      "IOPAD1  ",      0,     63,      0,     66,              <<a8600>>28780000
      "ZZ"; << terminator >>                                   <<v8273>>28790000
   byte array                                                  <<v8273>>28800000
      bdrivers(*) = drivers;                                   <<v8273>>28810000
   equate                                                      <<v8273>>28820000
      iltsize4   = 4,                                          <<v8273>>28830000
      ditsize4   = iltsize4+1,                                 <<v8273>>28840000
      iltsize5   = ditsize4+1,                                 <<v8273>>28850000
      ditsize5   = iltsize5+1,                                 <<v8273>>28860000
      entrysize  = ditsize5+1;                                 <<v8273>>28870000
   equate                                                      <<v8273>>28880000
      anywhere   = 0,                                          <<v8273>>28890000
      inbank0    = 1,                                          <<v8273>>28900000
      above      = 2,  << bank0 above sysglob >>               <<v8273>>28910000
      notbank0   = 3,                                          <<v8273>>28920000
      temporary  = 4,                                          <<v8273>>28930000
      b32        = true, << align on 32 word bnd >>            <<v8273>>28940000
      notb32     = false;                                      <<v8273>>28950000
   integer                                                     <<v8273>>28960000
      drt,                                                     <<v8273>>28970000
      unit,                                                    <<v8273>>28980000
      ldev,                                                    <<v8273>>28990000
      col,                                                     <<v8273>>29000000
      iltsize,                                                 <<v8273>>29010000
      ditsize,                                                 <<v8273>>29020000
      units,                                                   <<v8273>>29030000
      inx,                                                     <<v8273>>29040000
      dvr'index;                                               <<v8273>>29050000
   array                                                       <<v8273>>29060000
      badldevs(0:63), << bit map - 1024 bits >>                <<v8273>>29070000
      namew(0:3);                                              <<v8273>>29080000
   byte array                                                  <<v8273>>29090000
      name(*) = namew;                                         <<v8273>>29100000
   logical                                                     <<v8273>>29110000
      done,                                                    <<v8273>>29120000
      pseudodvr,                                               <<v8273>>29130000
      failed = ckiotables;                                     <<v8273>>29140000
   integer                                                     <<v8273>>29150000
      dvrdrt,                                                  <<v8273>>29160000
      dvrunit;                                                 <<v8273>>29170000
                                                               <<v8273>>29180000
   subroutine setdvrvalues;                                    <<v8273>>29190000
   begin                                                       <<v8273>>29200000
      if system'type = 2 then                                  <<v8273>>29210000
         begin                                                 <<v8273>>29220000
         dvr'index := ldev*7;                                  <<v8273>>29230000
         dvrdrt := dvrdrtnum;                                  <<v8273>>29240000
         dvrunit := dvrunitnum;                                <<v8273>>29250000
         pseudodvr := dvrdsbit;                                <<v8273>>29260000
         move namew := dvrname,(4);                            <<v8273>>29270000
         end                                                   <<v8273>>29280000
      else                                                     <<v8273>>29290000
         begin                                                 <<v8273>>29300000
         dvr'index := ldev*6;                                  <<v8273>>29310000
         dvrdrt := dvrtab(dvr'index).(0:9);                    <<v8273>>29320000
         dvrunit := dvrtab(dvr'index).(9:7);                   <<v8273>>29330000
         pseudodvr := dvrtab(dvr'index+1).(7:1);               <<v8273>>29340000
         move namew := dvrtab(dvr'index+2),(4);                <<v8273>>29350000
         end;                                                  <<v8273>>29360000
   end;                                                        <<v8273>>29370000
                                                               <<v8273>>29380000
   logical subroutine search;                                  <<v8273>>29390000
   begin                                                       <<v8273>>29400000
      inx := 0;                                                <<v8273>>29410000
      done := false;                                           <<v8273>>29420000
                                                               <<v8273>>29430000
      do begin                                                 <<v8273>>29440000
         if name = bdrivers(inx*2),(8) then                    <<v8273>>29450000
            begin                                              <<v8273>>29460000
            if system'type = 2 then                            <<v8273>>29470000
               begin                                           <<v8273>>29480000
               iltsize := drivers(inx+iltsize4);               <<v8273>>29490000
               ditsize := drivers(inx+ditsize4);               <<v8273>>29500000
               end                                             <<v8273>>29510000
            else                                               <<v8273>>29520000
               begin                                           <<v8273>>29530000
               iltsize := drivers(inx+iltsize5);               <<v8273>>29540000
               ditsize := drivers(inx+ditsize5);               <<v8273>>29550000
               end;                                            <<v8273>>29560000
            search := true;                                    <<v8273>>29570000
            done := true;                                      <<v8273>>29580000
            end                                                <<v8273>>29590000
         else                                                  <<v8273>>29600000
            if < then                                          <<v8273>>29610000
               done := true;                                   <<v8273>>29620000
         inx := inx+entrysize;                                 <<v8273>>29630000
         end until done;                                       <<v8273>>29640000
   end;                                                        <<v8273>>29650000
                                                               <<v8273>>29660000
   subroutine printlist;                                       <<v8273>>29670000
   begin                                                       <<v8273>>29680000
      col := 0;                                                <<v8273>>29690000
                                                               <<v8273>>29700000
      for ldev := 1 until hldev do                             <<v8273>>29710000
         begin                                                 <<v8273>>29720000
         if testbit( badldevs, ldev) then                      <<v8273>>29730000
            begin                                              <<v8273>>29740000
            if col >= 68 then                                  <<v8273>>29750000
               begin                                           <<v8273>>29760000
               printline;                                      <<v8273>>29770000
               col := 0;                                       <<v8273>>29780000
               end;                                            <<v8273>>29790000
            col := col+ascii( ldev,10,bline(col))+1;           <<v8273>>29800000
            end;                                               <<v8273>>29810000
         end;                                                  <<v8273>>29820000
      printline;                                               <<v8273>>29830000
   end;                                                        <<v8273>>29840000
                                                               <<v8273>>29850000
   zerobuf( badldevs, 64);                                     <<v8273>>29860000
                                                               <<v8273>>29870000
   if system'type <> 2 then                                    <<v8273>>29880000
      begin                                                    <<v8273>>29890000
      freaddir( conffnum, dvrtab, (hldev+1)*6, 9d);            <<v8273>>29900000
      if <> then                                               <<v8273>>29910000
         begin                                                 <<v8273>>29920000
         ferror( conffnum, conffile);                          <<v8273>>29930000
         terminate;                                            <<v8273>>29940000
         end;                                                  <<v8273>>29950000
      end                                                      <<v8273>>29960000
   else                                                        <<v8273>>29970000
      begin                                                    <<v8273>>29980000
      devfnum := fopen( devfile, 1, %324);                     <<v8273>>29990000
      if <> then                                               <<v8273>>30000000
         begin                                                 <<v8273>>30010000
         ferror( devfnum, devfile);                            <<v8273>>30020000
         terminate;                                            <<v8273>>30030000
         end;                                                  <<v8273>>30040000
      freaddir( devfnum, devrec0, 128, 0d);                    <<v8273>>30050000
      if <> then                                               <<v8273>>30060000
         begin                                                 <<v8273>>30070000
         ferror( devfnum, devfile);                            <<v8273>>30080000
         terminate;                                            <<v8273>>30090000
         end;                                                  <<v8273>>30100000
      readdevfile( devdvr, dvrtab, length);                    <<v8273>>30110000
      if <> then terminate;                                    <<v8273>>30120000
      fclose( devfnum, 0, 0);                                  <<v8273>>30130000
      end;                                                     <<v8273>>30140000
                                                               <<v8273>>30150000
      <<  process real devices >>                              <<v8273>>30160000
                                                               <<v8273>>30170000
   for drt := 8 until hdrt do                                  <<v8273>>30180000
      begin                                                    <<v8273>>30190000
      units := 0;                                              <<v8273>>30200000
      iltsize := 0;                                            <<v8426>>30210000
      for ldev := 1 until hldev do                             <<v8273>>30220000
         begin                                                 <<v8273>>30230000
         setdvrvalues;                                         <<v8273>>30240000
         if dvrdrt = drt and not pseudodvr then                <<v8273>>30250000
            begin                                              <<v8273>>30260000
            if search then                                     <<v8273>>30270000
               begin                                           <<v8273>>30280000
               getspace( ditsize,1,inbank0,notb32);            <<v8273>>30290000
               units := units+1;                               <<v8273>>30300000
               end                                             <<v8273>>30310000
            else                                               <<v8273>>30320000
               begin                                           <<v8273>>30330000
               setbit( badldevs, ldev);                        <<v8273>>30340000
               failed := true;                                 <<v8273>>30350000
               end;                                            <<v8273>>30360000
            end;                                               <<v8273>>30370000
         end;                                                  <<v8273>>30380000
      getspace( iltsize+units,1,inbank0,notb32);               <<v8426>>30390000
      end;                                                     <<v8273>>30400000
                                                               <<v8273>>30410000
      <<  process pseudo drivers  >>                           <<v8273>>30420000
                                                               <<v8273>>30430000
   for ldev := 2 until hldev do                                <<v8273>>30440000
      begin                                                    <<v8273>>30450000
      setdvrvalues;                                            <<v8273>>30460000
      if pseudodvr then                                        <<v8273>>30470000
         begin                                                 <<v8273>>30480000
         if search then                                        <<v8273>>30490000
            getspace( ditsize, 1, inbank0, notb32)             <<v8273>>30500000
         else                                                  <<v8273>>30510000
            begin                                              <<v8273>>30520000
            setbit( badldevs, ldev);                           <<v8273>>30530000
            failed := true;                                    <<v8273>>30540000
            end;                                               <<v8273>>30550000
         end;                                                  <<v8273>>30560000
      end;                                                     <<v8273>>30570000
                                                               <<v8273>>30580000
   <<  count configured adcc terminals  >>                     <<v8273>>30590000
                                                               <<v8273>>30600000
   nrterms := 0;                                               <<v8273>>30610000
   for ldev := 2 until hldev do                                <<v8273>>30620000
      begin                                                    <<v8273>>30630000
      setdvrvalues;                                            <<v8273>>30640000
      if dvrdrt <> 0 then                                      <<v8273>>30650000
         if name = "HIOTERM2" or name = "HIOASLP2" or          <<v8426>>30660000
            name = "HIOTERM0" then                             <<v8426>>30670000
            nrterms := nrterms+1;                              <<v8273>>30680000
      end;                                                     <<v8273>>30690000
                                                               <<v8273>>30700000
   << print message about any bad drivers >>                   <<v8273>>30710000
                                                               <<v8273>>30720000
   if failed then                                              <<v8273>>30730000
      begin                                                    <<v8273>>30740000
      move bline := ("*WARNING -- NON-STANDARD DRIVER ON",    <<v8273>>30750000
         " THE FOLLOWING LDEV(S)");                            <<v8273>>30760000
      printline;                                               <<v8273>>30770000
      printlist;                                               <<v8273>>30780000
      move bline := ("   I/O table use not caluated for ",     <<v8273>>30790000
         "the above ldev(s)");                                 <<v8273>>30800000
      printline;                                               <<v8273>>30810000
      move bline := ("   Non-standard drivers should be",      <<v8273>>30820000
         " deconfigured before");                              <<v8273>>30830000
      printline;                                               <<v8273>>30840000
      move bline := "   an UPDATE is attemped";                <<v8273>>30850000
      printline;                                               <<v8273>>30860000
      printline;                                               <<v8273>>30870000
      end;                                                     <<v8273>>30880000
                                                               <<v8273>>30890000
end;                                                           <<v8273>>30900000
logical procedure chkmemutil;                                  <<v8273>>30910000
begin                                                          <<v8273>>30920000
   integer                                                     <<v8273>>30930000
      nrports,                                                 <<v8273>>30940000
      prisize,                                                 <<v8273>>30950000
      secsize,                                                 <<v8273>>30960000
      minpri,                                                  <<v8273>>30970000
      minsec,                                                  <<v8273>>30980000
      entries,                                                 <<v8273>>30990000
      size,                                                    <<v8273>>31000000
      vol,                                                     <<v8616>>31010000
      hldev,                                                   <<v8273>>31020000
      hdrt,                                                    <<v8273>>31030000
      nrterms,                                                 <<v8273>>31040000
      coreloc;                                                 <<v8273>>31050000
   double                                                      <<v8273>>31060000
      vmsize,                                                  <<v8616>>31070000
      rec;                                                     <<v8273>>31080000
   logical                                                     <<v8273>>31090000
      failed   = chkmemutil;                                   <<v8273>>31100000
   integer array                                               <<v8273>>31110000
      comm(0:127),                                             <<v8273>>31120000
      ctab0(0:127),                                            <<v8273>>31130000
      ctab(0:127);                                             <<v8273>>31140000
   equate                                                      <<v8273>>31150000
      anywhere   = 0,                                          <<v8273>>31160000
      inbank0    = 1,                                          <<v8273>>31170000
      above      = 2,  << bank0 above sysglob >>               <<v8273>>31180000
      notbank0   = 3,                                          <<v8273>>31190000
      temporary  = 4,                                          <<v8273>>31200000
      b32        = true, << align on 32 word bnd >>            <<v8273>>31210000
      notb32     = false;                                      <<v8273>>31220000
   equate                                                      <<v8273>>31230000
      vdsmdst    = 39,                                         <<v8273>>31240000
      dltdst     = 15,                                         <<v8273>>31250000
      ioresdst   = 16;                                         <<v8273>>31260000
                                                               <<v8273>>31270000
   integer subroutine portsize;                                <<v8273>>31280000
   begin                                                       <<v8273>>31290000
      nrports := ctab(2)+1;                                    <<v8273>>31300000
      prisize := ctab(46);                                     <<v8273>>31310000
      secsize := ctab(48);                                     <<v8273>>31320000
                                                               <<v8273>>31330000
      minpri := (nrports+1) &lsr(1);                           <<v8273>>31340000
      if prisize < minpri then                                 <<v8273>>31350000
         prisize := minpri;                                    <<v8273>>31360000
      if prisize > 1023 then                                   <<v8273>>31370000
         prisize := 1023;                                      <<v8273>>31380000
                                                               <<v8273>>31390000
      minsec := (nrports+7) &lsr(3);                           <<v8273>>31400000
      if secsize < minsec then                                 <<v8273>>31410000
         secsize := minsec;                                    <<v8273>>31420000
      if minsec > 1023 then                                    <<v8273>>31430000
         minsec := 1023;                                       <<v8273>>31440000
      portsize := 13 + nrports*16 + (prisize+secsize)*6;       <<v8273>>31450000
   end;                                                        <<v8273>>31460000
                                                               <<v8273>>31470000
   bank0needed := 0d;                                          <<v8273>>31480000
   amtmemneeded := 0d;                                         <<v8273>>31490000
                                                               <<v8273>>31500000
   freaddir( conffnum, ctab0, 128, 0d);                        <<v8273>>31510000
   if <> then                                                  <<v8273>>31520000
      begin                                                    <<v8273>>31530000
      ferror( conffnum, conffile);                             <<v8273>>31540000
      terminate                                                <<v8273>>31550000
      end;                                                     <<v8273>>31560000
   rec := if system'type = 2 then                              <<v8273>>31570000
      1d else double(ctab0(1)+1);                              <<v8273>>31580000
   freaddir( conffnum, ctab, 128, rec);                        <<v8273>>31590000
   if <> then                                                  <<v8273>>31600000
      begin                                                    <<v8273>>31610000
      ferror( conffnum, conffile);                             <<v8273>>31620000
      terminate;                                               <<v8273>>31630000
      end;                                                     <<v8273>>31640000
   num'banks := if system'type=2 then ctab0(3)/64 else         <<v8273>>31650000
      ctab0/64;                                                <<v8273>>31660000
   if system'type=2 then                                       <<v8273>>31670000
      begin                                                    <<v8273>>31680000
      disc( sysdisc, read, comm, 31d, 128);                    <<v8273>>31690000
      if <> then terminate;                                    <<v8273>>31700000
      hldev := comm(8);                                        <<v8273>>31710000
      hdrt := comm(7);                                         <<v8273>>31720000
      end                                                      <<v8273>>31730000
   else                                                        <<v8273>>31740000
      begin                                                    <<v8273>>31750000
      hldev := ctab0(18);                                      <<v8273>>31760000
      hdrt := ctab0(3);                                        <<v8273>>31770000
      end;                                                     <<v8273>>31780000
                                                               <<v8273>>31790000
                                                               <<v8273>>31800000
                                                               <<v8273>>31810000
   if system'type <> 2 then                                    <<v8273>>31820000
      begin     << mpe 4 to mpe 5 >>                           <<v8273>>31830000
                                                               <<v8273>>31840000
      vol := ldevtovtab( 1 ); << vtab inx of ldev 1 >>         <<v8616>>31850000
      mfds( vmsize, 29, vol*14+10, 2);                         <<v8616>>31860000
      if vmsize < 4096d then                                   <<v8616>>31870000
         begin                                                 <<v8616>>31880000
         move bline := ("*WARNING -- MPE V REQUIRES AT ",     <<v8616>>31890000
            "LEAST 4 KILOSECTORS OF VIRTUAL MEMORY");          <<v8616>>31900000
         printline;                                            <<v8616>>31910000
         move bline := "   ON LDEV 1";                         <<v8616>>31920000
         printline;                                            <<v8616>>31930000
         printline;                                            <<v8616>>31940000
         failed := true;                                       <<v8616>>31950000
         end;                                                  <<v8616>>31960000
                                                               <<v8616>>31970000
      <<  if series/44 we assume at the customer >>            <<v8273>>31980000
      <<  doesn't have cst expansion firmware    >>            <<v8273>>31990000
                                                               <<v8273>>32000000
      coreloc := if thiscpu <= 4 then                          <<v8273>>32010000
         inbank0  << must be in bank 0 >>                      <<v8273>>32020000
      else                                                     <<v8273>>32030000
         anywhere; << table may be placed anywhere >>          <<v8273>>32040000
                                                               <<v8273>>32050000
      getspace(32,1,inbank0,notb32);          << low core >>   <<v8273>>32060000
      getspace(hdrt/8*8,4,inbank0,notb32);       << drt >>     <<v8426>>32070000
         << firmware, sysglob, sysglob ext >>                  <<v8273>>32080000
      getspace(%340+256+128,1,above,b32);                      <<v8273>>32090000
      getspace(ctab(1),4,above,b32);             << dst >>     <<v8273>>32100000
      entries := if system'type=0 then ctab(0)+192             <<v8426>>32110000
         else ctab(0);                                         <<v8426>>32120000
      getspace(entries,4,above,b32);             << cst >>     <<v8426>>32130000
      getspace(ctab(5),4,above,b32);             << cstx >>    <<v8273>>32140000
      getspace(ctab(6)+64,1,above,b32);          << ics >>     <<v8273>>32150000
      if ckiotables( hldev, hdrt, nrterms) then << iotab >>    <<v8273>>32160000
         failed := true;                                       <<v8273>>32170000
      if nrterms > 0 then                                      <<v8426>>32180000
         begin                                                 <<v8426>>32190000
         << hardres - readchar/writechar buffer >>             <<v8426>>32200000
         getspace(%56,1,above,notb32);                         <<v8426>>32210000
         << initialization channel pgm for adcc >>             <<v8426>>32220000
         getspace(%264,1,above,notb32);                        <<v8426>>32230000
         end;                                                  <<v8426>>32240000
      getspace(dstsize(dltdst),1,inbank0,b32);   << dlt >>     <<v8273>>32250000
      getspace(dstsize(ioresdst),1,inbank0,notb32);<<iores>>   <<v8273>>32260000
      getspace(ctab(13)+11+ctab(13)/16,1,inbank0,b32);<<cstbk>><<v8273>>32270000
      getspace(1,80,inbank0,b32);                <<measinfo>>  <<v8273>>32280000
      getspace(dstsize(vdsmdst),1,inbank0,b32);   << vdsm >>   <<v8273>>32290000
      size := (ctab(40)+ctab(41)+15)/16+4;                     <<v8273>>32300000
      getspace(size,1,inbank0,b32);              << jpcnt >>   <<v8273>>32310000
      getspace(portsize,1,coreloc,notb32);      << ports >>    <<v8273>>32320000
      getspace(ctab(2)+1,21,coreloc,b32);       << pcb >>      <<v8273>>32330000
      entries := if ctab(47) < ctab(2)*2 then                  <<c8456>>32340000
         ctab(2)*2 else ctab(47);                              <<c8456>>32350000
      getspace(entries+3,6,coreloc,b32);        << swap >>     <<c8456>>32360000
      entries := if ctab(45) < hldev+ctab(2) then              <<v8273>>32370000
         ctab(2)+hldev else ctab(45);                          <<c8456>>32380000
      getspace(entries+3,6,coreloc,b32);        << spec req >><<<v8273>>32390000
      entries := ctab(40)+ctab(41);                            <<v8273>>32400000
      getspace(entries+2,3,coreloc,b32);        << jcut >>     <<v8273>>32410000
      getspace(ctab(9)+1,4,coreloc,b32);        << trl >>      <<v8273>>32420000
      getspace(ctab(12)*129+12,1,coreloc,b32);  << sbuf >>     <<v8273>>32430000
         << no tbuf's in mpe v >>                              <<v8273>>32440000
      getspace(hldev+1,4,coreloc,b32);          << lpdt >>     <<v8273>>32450000
      getspace(ctab(3)*12+12,1,coreloc,b32);    << ioq >>      <<v8273>>32460000
      getspace(ctab(44)+1,17,coreloc,b32);      << drq >>      <<v8273>>32470000
      entries := ctab(40) + ctab(41);                          <<v8273>>32480000
      getspace(entries+43,4,coreloc,b32);       << sir >>      <<v8273>>32490000
      getspace(1024,1,coreloc,b32);             << mon buf >>  <<v8273>>32500000
      end                                                      <<v8273>>32510000
   else                                                        <<v8273>>32520000
      begin    << mpe 5 to mpe 4 >>                            <<v8273>>32530000
      getspace(32,1,inbank0,notb32);          << low core >>   <<v8273>>32540000
      getspace(hdrt/8*8,4,inbank0,notb32);       << drt >>     <<v8426>>32550000
         << firmware, sysglob, sysglob ext >>                  <<v8273>>32560000
      getspace(%340+256+128,1,above,notb32);                   <<v8273>>32570000
      getspace(ctab(1),4,above,notb32);          << dst >>     <<v8273>>32580000
      getspace(ctab(0),4,above,notb32);          << cst >>     <<v8273>>32590000
      getspace(ctab(5),4,above,notb32);          << cstx >>    <<v8273>>32600000
      getspace(ctab(6)+64,1,above,notb32);       << ics >>     <<v8273>>32610000
      if ckiotables( hldev, hdrt, nrterms) then << iotab >>    <<v8273>>32620000
         failed := true;                                       <<v8273>>32630000
      if nrterms > 0 then                                      <<v8426>>32640000
         begin                                                 <<v8426>>32650000
         << hardres - readchar/writechar buffer >>             <<v8426>>32660000
         getspace(%56,1,above,notb32);                         <<v8426>>32670000
         << initialization channel pgm for adcc >>             <<v8426>>32680000
         getspace(%325,1,above,notb32);                        <<v8426>>32690000
         end;                                                  <<v8426>>32700000
      getspace(dstsize(dltdst),1,inbank0,notb32);   << dlt >>  <<v8273>>32710000
      getspace(dstsize(ioresdst),1,inbank0,notb32);<<iores>>   <<v8273>>32720000
      getspace(ctab(13)+11+ctab(13)/16,1,inbank0,notb32);<<cstb<<v8273>>32730000
      getspace(1,80,inbank0,notb32);             <<measinfo>>  <<v8273>>32740000
      getspace(dstsize(vdsmdst),1,inbank0,notb32);<< vdsm >>   <<v8273>>32750000
      size := (ctab(40)+ctab(41)+15)/16+4;                     <<v8273>>32760000
      getspace(size,1,inbank0,notb32);           << jpcnt >>   <<v8273>>32770000
      getspace(ctab(2)+1,16,inbank0,notb32);    << pcb >>      <<v8273>>32780000
      getspace(ctab(47)+3,5,inbank0,notb32);    << swap >>     <<v8273>>32790000
      getspace(ctab(45)+3,5,inbank0,notb32);     << spec req >><<v8273>>32800000
      getspace(ctab(2),5,inbank0,notb32);       << msg hbr >>  <<v8273>>32810000
      getspace(ctab(46),5,inbank0,notb32);      << pri msg >>  <<v8273>>32820000
      getspace(ctab(48),5,inbank0,notb32);      << sec msg >>  <<v8273>>32830000
      entries := ctab(40)+ctab(41);                            <<v8273>>32840000
      getspace(entries+2,3,inbank0,notb32);     << jcut >>     <<v8273>>32850000
      getspace(ctab(9)+1,4,inbank0,notb32);     << trl >>      <<v8273>>32860000
      getspace(ctab(12)*129+8,1,inbank0,notb32);<< sbuf >>     <<v8273>>32870000
      entries := nrterms * ctab(4);                            <<v8273>>32880000
      if entries > 255 then                                    <<v8273>>32890000
         entries := 255;                                       <<v8273>>32900000
      if entries < 10 then                                     <<c8456>>32910000
         entries := 10;                                        <<c8456>>32920000
      getspace(entries,32,inbank0,notb32);                     <<c8456>>32930000
      getspace(33,1,inbank0,notb32);            << arsbm >>    <<v8273>>32940000
      getspace(1026,1,inbank0,notb32);          << arld >>     <<v8273>>32950000
      getspace(hldev+1,2,inbank0,notb32);       << lpdt >>     <<v8273>>32960000
      getspace(ctab(3)*11+8,1,inbank0,notb32);  << ioq >>      <<v8273>>32970000
      getspace(ctab(44)+1,16,inbank0,notb32);   << drq >>      <<v8273>>32980000
      entries := ctab(40) + ctab(41);                          <<v8273>>32990000
      getspace(entries+43,2,inbank0,notb32);    << sir >>      <<v8273>>33000000
      getspace(1024,1,inbank0,notb32);          << mon buf >>  <<v8273>>33010000
      end;                                                     <<v8273>>33020000
                                                               <<v8273>>33030000
   if amtmemneeded <> 0d then                                  <<v8273>>33040000
      begin                                                    <<v8273>>33050000
      move bline := ("*WARNING -- NOT ENOUGH MEMORY TO",      <<v8273>>33060000
         " PERFORM AN UPDATE");                                <<v8273>>33070000
      printline;                                               <<v8273>>33080000
      size := dascii( amtmemneeded, 10, bline(3));             <<v8273>>33090000
      move bline(size+4) := ("TOTAL ADDITIONAL",               <<v8273>>33100000
         " WORDS NEEDED");                                     <<v8273>>33110000
      printline;                                               <<v8273>>33120000
      size := dascii( bank0needed, 10, bline(3));              <<v8273>>33130000
      move bline(size+4) := ("ADDITIONAL WORDS ",              <<v8273>>33140000
         "OF BANK0 REQUIRED");                                 <<v8273>>33150000
      printline;                                               <<v8273>>33160000
      printline;                                               <<v8273>>33170000
      failed := true;                                          <<v8273>>33180000
      end;                                                     <<v8273>>33190000
end;                                                           <<v8273>>33200000
logical procedure verifying;                                   <<v8273>>33210000
begin                                                          <<v8273>>33220000
   logical                                                     <<v8426>>33230000
      failed = verifying;                                      <<v8273>>33240000
                                                               <<v8273>>33250000
   conffnum := fopen( conffile, 1, %324); << open confdata >>  <<v8273>>33260000
   if <> then                                                  <<v8273>>33270000
      begin                                                    <<v8273>>33280000
      ferror( conffnum, conffile);                             <<v8273>>33290000
      terminate;                                               <<v8273>>33300000
      end;                                                     <<v8273>>33310000
                                                               <<v8273>>33320000
   if system'type <> 2 then                                    <<v8273>>33330000
      if chkmemsize then failed := true;                       <<v8273>>33340000
                                                               <<v8273>>33350000
   if system'type = 2 then                                     <<v8273>>33360000
      if chkmpe4max then failed := true;                       <<v8273>>33370000
                                                               <<v8273>>33380000
   if system'type <> 2 then                                    <<v8273>>33390000
      if chkdiscutil then failed := true;                      <<v8273>>33400000
                                                               <<v8273>>33410000
   if chkmemutil then failed := true;                          <<v8273>>33420000
                                                               <<v8273>>33430000
   if not failed then                                          <<v8426>>33440000
      begin                                                    <<v8426>>33450000
      move bline := "SUCCESSFUL VERIFICATION";                 <<v8426>>33460000
      printline;                                               <<v8426>>33470000
      printline;                                               <<v8426>>33480000
      end;                                                     <<v8426>>33490000
                                                               <<v8426>>33500000
   fclose( conffnum, 0, 0);                                    <<v8273>>33510000
end;                                                           <<v8273>>33520000
$control segment=mpev'conversion                                        33530000
                                                                        33540000
$page "     M A I N    P R O G R A M"                                   33550000
   <<    m a i n    p r o g r a m     >>                                33560000
                                                                        33570000
           << default entry point >>                                    33580000
                                                                        33590000
   option'taken:=0;                                                     33600000
                                                                        33610000
   if false then                                                        33620000
                                                                        33630000
verify:                                                                 33640000
                                                                        33650000
      option'taken:=1;                                                  33660000
                                                                        33670000
   if false then                                                        33680000
                                                                        33690000
convert:                                                                33700000
                                                                        33710000
     option'taken:=2;                                                   33720000
                                                                        33730000
   if false then                                                        33740000
                                                                        33750000
forwd:                                                                  33760000
                                                                        33770000
      option'taken:=3;                                                  33780000
                                                                        33790000
   if false then                                                        33800000
                                                                        33810000
backwd:                                                                 33820000
                                                                        33830000
                                                                        33840000
      option'taken:=4;                                                  33850000
                                                                        33860000
   if false then                                                        33870000
                                                                        33880000
help:                                                                   33890000
                                                                        33900000
      option'taken:=5;                                                  33910000
                                                                        33920000
                                                                        33930000
   push(status); tos.(2:1):=0; set(status); << disable traps >><<v8273>>33940000
                                                               <<v8273>>33950000
   clearline;  << initialize print buffer >>                            33960000
                                                                        33970000
   move bline := heading;                                               33980000
   printline;                                                           33990000
   printline;                                                           34000000
                                                                        34010000
  << put away the ;parm= for later use >>                               34020000
                                                                        34030000
   parm := if qm4 = 0 then -1 else qm4;                                 34040000
                                                                        34050000
   termfnum := fopen(,%54); << open $stdinx >>                 <<v8273>>34060000
   if <> then                                                  <<v8273>>34070000
      begin                                                    <<v8273>>34080000
      move bline := "FAILURE TO OPEN $STDINX";                 <<v8273>>34090000
      printline;                                               <<v8273>>34100000
      terminate;                                               <<v8273>>34110000
      end;                                                     <<v8273>>34120000
                                                               <<v8273>>34130000
  <<  call the "MAIN" routines >>                                       34140000
                                                                        34150000
  case option'taken of                                                  34160000
    begin                                                               34170000
                                                                        34180000
<<0>> begin   << verify then convert >>                                 34190000
      check'access;                                                     34200000
      system'type:=get'system'type;                                     34210000
      if system'type<0 then                                             34220000
        begin                                                           34230000
        move bline:="THIS CONVERSION IS TERMINATED";                    34240000
        printline;                                                      34250000
        terminate;                                                      34260000
        end;                                                            34270000
      if verifying then                                        <<v8273>>34280000
         begin                                                 <<v8273>>34290000
         move bline :="The verification of your system failed";<<v8273>>34300000
         printline;                                            <<v8273>>34310000
         move bline := (" thus the conversion will not be",    <<v8273>>34320000
            " attempted.");                                    <<v8273>>34330000
         printline;                                            <<v8273>>34340000
         end                                                   <<v8273>>34350000
      else                                                     <<v8273>>34360000
         converting;                                           <<v8273>>34370000
      end;                                                              34380000
                                                                        34390000
<<1>> begin       << just verifying >>                                  34400000
      system'type:=get'system'type;                                     34410000
      verifying;                                               <<v8273>>34420000
      end;                                                              34430000
                                                                        34440000
<<2>> begin       << just converting >>                                 34450000
      check'access;                                                     34460000
      system'type:=get'system'type;                                     34470000
      if system'type<0 then                                             34480000
        begin                                                           34490000
        move bline:="THIS CONVERSION IS TERMINATED";                    34500000
        printline;                                                      34510000
        terminate;                                                      34520000
        end;                                                            34530000
      converting;                                                       34540000
      end;                                                              34550000
                                                                        34560000
<<3>> begin       << force convert forward >>                           34570000
      check'access;                                                     34580000
      system'type:=if get'system'type=0 then 0 else 1;                  34590000
      converting;                                                       34600000
      end;                                                              34610000
                                                                        34620000
<<4>> begin       << force convert backward >>                          34630000
      check'access;                                                     34640000
      system'type:=2;                                                   34650000
      converting;                                                       34660000
      end;                                                              34670000
                                                                        34680000
<<5>> help'facility;  << just help >>                          <<v8273>>34690000
                                                                        34700000
    end;                                                                34710000
                                                                        34720000
                                                                        34730000
                                                                        34740000
end.                                                                    34750000
