$control uslinit, map, code, main=def'conversion                        00001000
$control privileged                                                     00002000
$control segment=def'conversion                                         00003000
begin                                                                   00004000
                                                                        00005000
     << ------------------------------------------------------>>        00006000
     <<  This program will initialize the conversion bit for  >>        00007000
     <<  MPEV-MM and MPEV-E to zero -- this means that it is  >>        00008000
     <<  an MPEV-E version.  It will also initialize the table>>        00009000
     <<  look-up buffer size to zero and the number of entries>>        00010000
     <<  in the table to zero.  This information is kept in   >>        00011000
     <<  the SYSDUMP/INITIAL communications sector of the     >>        00012000
     <<  system disc.The purpose is to allow an UPDATE        >>        00013000
     <<  to bring in DEFDATA.PUB.SYS, the default device      >>        00014000
     <<  specifications that is normally part of the I/O con- >>        00015000
     <<  figuration for a system.  This new feature is only   >>        00016000
     <<  allowable for the MIGHTY MOUSE MIT!!!                >>        00017000
     << ------------------------------------------------------>>        00018000
                                                                        00019000
                                                                        00020000
equate                                                                  00021000
   ccg          = 0,                                                    00022000
   ccl          = 1,                                                    00023000
   cce          = 2,                                                    00024000
   read         = 0,                                                    00025000
   write        = 1,                                                    00026000
   sysdisc      = 1,                                                    00027000
   id0          = 30,                                                   00028000
   tlbufsize    = 25,                                                   00029000
   tlbufentries = 26,                                                   00030000
   commsize     = 128;                                                  00031000
                                                                        00032000
array                                                                   00033000
   newtable(0:7167);                                                    00034000
                                                                        00035000
array                                                                   00036000
   line(0:35);                                                          00037000
                                                                        00038000
byte array                                                              00039000
   bline(*) = line;                                                     00040000
                                                                        00041000
byte pointer                                                            00042000
   bps0 = s - 0;                                                        00043000
                                                                        00044000
double                                                                  00045000
   commsector := 31D,                                                   00046000
   capability;                                                          00047000
                                                                        00048000
integer                                                                 00049000
   termfnum,                                                            00050000
   stat = q-1,                                                          00051000
   s0   = s-0,                                                          00052000
   cap1 = capability;                                                   00053000
                                                                        00054000
real                                                                    00055000
   pausetime := 5.0;                                                    00056000
                                                                        00057000
integer array                                                           00058000
   comm(0:commsize-1);                                                  00059000
                                                                        00060000
define                                                                  00061000
   cc         = stat.(6:2)#;                                            00062000
define                                                                  00063000
   mpeversion = (15:1)#;  << set if version = Mighty Mouse >>           00064000
define                                                                  00065000
      heading =                                                         00066000
      "MPEV-MM Update Program for new DEFDATA.PUB.SYS (6/13/84)"#;      00067000
                                                                        00068000
intrinsic                                                               00069000
   ascii,                                                               00070000
   fopen,                                                               00071000
   pause,                                                               00072000
   who,                                                                 00073000
   terminate,                                                           00074000
   print;                                                               00075000
                                                                        00076000
$page                                                                   00077000
double procedure attachio(ldev,qmisc,dstx,buf,func,count,p1,p2,flags);  00078000
   value ldev, qmisc, dstx, buf, func, count, p1, p2, flags;            00079000
   integer ldev, qmisc, dstx, buf, func, count, p1, p2, flags;          00080000
   option external;                                                     00081000
                                                                        00082000
procedure clearline;                                                    00083000
   begin                                                                00084000
   line := "  ";                                                        00085000
   move line(1) := line, (35);                                          00086000
   end;                                                                 00087000
                                                                        00088000
procedure printline(carr'control);                                      00089000
value carr'control;                                                     00090000
integer carr'control;                                                   00091000
option variable;                                                        00092000
begin << prints the list buffer >>                                      00093000
                                                                        00094000
integer qm4=q-4;                                                        00095000
                                                                        00096000
if qm4=0 then                                                           00097000
  carr'control:=0;                                                      00098000
   tos := @line;                                                        00099000
   tos := @bline(71);  << pointer to last char >>                       00100000
   if bps0 = " " then                                                   00101000
      begin                                                             00102000
      assemble( dup, decb);                                             00103000
      tos := -71;                                                       00104000
      assemble( cmpb 2 );                                               00105000
      end;                                                              00106000
   tos := -(tos-@bline+1); << neg. nr. char's >>                        00107000
   print( *, *, carr'control);                                          00108000
   clearline;                                                           00109000
end;                                                                    00110000
                                                                        00111000
procedure mfds( buffer, dst, offset, count);                            00112000
   value dst, offset, count;                                            00113000
   array buffer;                                                        00114000
   integer dst, offset, count;                                          00115000
   option privileged;                                                   00116000
begin                                                                   00117000
   tos := @buffer;                                                      00118000
   tos := dst;                                                          00119000
   tos := offset;                                                       00120000
   tos := count;                                                        00121000
   assemble( mfds );                                                    00122000
end;                                                                    00123000
                                                                        00124000
procedure ioerrcheck( b, a);                                            00125000
   value b, a;                                                          00126000
   integer b, a;                                                        00127000
begin                                                                   00128000
                                                                        00129000
   integer error;                                                       00130000
                                                                        00131000
   cc := cce;                                                           00132000
   tos := b.(8:8);                                                      00133000
   if s0 <> 1 then                                                      00134000
      begin  << i/o error >>                                            00135000
      cc := ccl;                                                        00136000
      error := tos;                                                     00137000
      move bline := "ATTACHIO ERROR WHILE ACCESSING SYSTEM DISC: # ", 2;00138000
      if error <> -1 then                                               00139000
         ascii( error, 10, bps0);                                       00140000
      printline;                                                        00141000
      end;                                                              00142000
end;                                                                    00143000
                                                                        00144000
$page                                                                   00145000
procedure disc( ldev, func, buffer, discadr, count);                    00146000
   value ldev, func, discadr, count;                                    00147000
   integer ldev, func, count;                                           00148000
   array buffer;                                                        00149000
   double discadr;                                                      00150000
   option privileged;                                                   00151000
begin                                                                   00152000
   integer                                                              00153000
      discadr1 = discadr,                                               00154000
      discadr2 = discadr+1;                                             00155000
                                                                        00156000
   tos := attachio( ldev, 0, 0, @buffer, func, count,                   00157000
      discadr1, discadr2, 1);                                           00158000
   ioerrcheck(*,*);                                                     00159000
   if <> then cc := ccl else cc := cce;                                 00160000
end;                                                                    00161000
                                                                        00162000
                                                                        00163000
procedure check'access;                                                 00164000
begin                                                                   00165000
<<   check for proper program access   >>                               00166000
who( , capability);                                                     00167000
if cap1.(5:1) = 0 then                                                  00168000
   begin                                                                00169000
   move bline := "THIS PROGRAM REQUIRES SYSTEM SUPERVISOR ";            00170000
   printline;                                                           00171000
   move bline := "           (OP) CAPABILITY";                          00172000
   printline;                                                           00173000
   terminate;                                                           00174000
   end;                                                                 00175000
end; <<check'access>>                                                   00176000
                                                                        00177000
                                                                        00178000
procedure check'system;                                                 00179000
   begin                                                                00180000
                                                                        00181000
   <<-------------------------------------------------------------->>   00182000
   << This procedure verifies that the user is currently on MPEV-E >>   00183000
   << system.  Note that it does not have to be the MIGHTY MOUSE   >>   00184000
   << MIT -- running this program on MPEV-E systems will have no   >>   00185000
   << effect.  It also ensures that no other jobs or sessions are  >>   00186000
   << logged on.                                                   >>   00187000
   <<-------------------------------------------------------------->>   00188000
                                                                        00189000
   integer pointer pcb = 3;                                             00190000
   integer size;                                                        00191000
                                                                        00192000
   size := pcb(1); << entry size cell of pcb header >>                  00193000
   if size <> 21 then                                                   00194000
      begin                                                             00195000
      move bline := "*SYSTEM TYPE IS NOT MPEV - E ";                    00196000
      printline;                                                        00197000
      move bline := " -- conversion attempt terminated";                00198000
      printline;                                                        00199000
      terminate;                                                        00200000
      end;                                                              00201000
                                                                        00202000
   mfds( newtable, 25, 0, 20);                                          00203000
   if newtable(11) <> 1 or newtable(13) <> 0 then                       00204000
      begin                                                             00205000
      move bline := "ALL OTHER JOBS AND SESSIONS MUST BE LOGGED OFF";   00206000
      printline;                                                        00207000
      terminate;                                                        00208000
      end;                                                              00209000
                                                                        00210000
  end; <<check'system>>                                                 00211000
                                                                        00212000
                                                                        00213000
$page                                                                   00214000
$control segment=def'conversion                                         00215000
                                                                        00216000
     push(status); tos.(2:1) := 0; set(status); <<disable traps>>       00217000
                                                                        00218000
     clearline;                                                         00219000
     move bline := heading;                                             00220000
     printline;                                                         00221000
     printline;                                                         00222000
                                                                        00223000
     termfnum := fopen(,%54); << open $stdinx >>                        00224000
     if <> then                                                         00225000
        begin                                                           00226000
        move bline := "FAILURE TO OPEN $STDINX";                        00227000
        printline;                                                      00228000
        terminate;                                                      00229000
        end;                                                            00230000
                                                                        00231000
     check'access;                                                      00232000
     check'system;                                                      00233000
                                                                        00234000
     disc( sysdisc , read, comm, commsector, commsize);                 00235000
     if <> then                                                         00236000
        terminate;                                                      00237000
     if comm(id0).mpeversion = 1 then                                   00238000
        begin                                                           00239000
        comm(id0).mpeversion := 0;                                      00240000
        comm(tlbufentries) := 0;                                        00241000
        comm(tlbufsize) := 0;                                           00242000
        end;                                                            00243000
                                                                        00244000
     disc( sysdisc , write, comm, commsector, commsize);                00245000
     if <> then                                                         00246000
        terminate;                                                      00247000
                                                                        00248000
     move bline := "SUCCESSFUL COMPLETION OF THE PROGRAM -- ";          00249000
     printline;                                                         00250000
     move bline := "--SHUTDOWN THE SYSTEM AND UPDATE WITH A ";          00251000
     printline;                                                         00252000
     move bline := "NEW MIGHTY MOUSE PASS TO BRING IN       ";          00253000
     printline;                                                         00254000
     move bline := "DEFDATA.PUB.SYS.                        ";          00255000
     printline;                                                         00256000
                                                                        00257000
end.                                                                    00258000
