perm filename TRITAP.SAI[1,LMM] blob
sn#107329 filedate 1974-06-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00012 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 BEGIN"TRITAP"
C00004 00003 ! BECAUSE R. SMITH FORGOT TO DEFINE JSYSES IN THE PARC-SUMEX VERSIONS,
C00005 00004 SIMPLE PROCEDURE LISTNAME
C00007 00005 SIMPLE PROCEDURE SUMEXCONVERT
C00008 00006 SIMPLE PROCEDURE IMSSSCONVERT
C00010 00007 SIMPLE PROCEDURE PARCCONVERT
C00011 00008 SIMPLE PROCEDURE CONVERT
C00012 00009 SIMPLE PROCEDURE BYTE4(INTEGER JFN)
C00013 00010 SIMPLE PROCEDURE INPUTGET
C00014 00011 BEGIN
C00016 00012 INPUTGET
C00017 ENDMK
C⊗;
BEGIN"TRITAP"
REQUIRE "<><>" DELIMITERS;
DEFINE ! = <COMMENT>;
! THIS PROGRAM IS DESIGNED TO COPY DUMPER FORMAT TAPES FROM ANY ONE
OF THREE FORMATS (IMSSS, PARC, SUMEX) TO ANY OTHER. THE PROGRAM IS
MEANT TO RUN ON ANY OF THOSE THREE MACHINES.
LATER, A MORE FLEXIBLE PROGRAM WILL BE WRITTEN TO CONVERT ANY
FORMAT OF TAPE BETWEEN THESE THREE, AND POSSIBLY MORE, INSTALLATIONS.
;
DEFINE ISSUMEX=<0>,ISIMSSS=<1>,ISPARC=<2>;
IFC NOT DECLARATION(SITE) THENC
DEFINE SITE=<ISPARC>; ! CHANGE THIS LINE TO CHANGE THE VERSION;
ENDC
! MACROS;
! DO THIS BECAUSE CASEC SEEMS TO HAVE A PROBLEM;
IFC SITE=ISSUMEX THENC DEFINE SITENAME=<"SUMEX">; ENDC
IFC SITE=ISIMSSS THENC DEFINE SITENAME=<"IMSSS">; ENDC
IFC SITE=ISPARC THENC DEFINE SITENAME=<"PARC">; ENDC
DEFINE SUMEXBUFSIZE=<648>;
DEFINE IMSSSBUFSIZE=<583>;
DEFINE PARCBUFSIZE=<777>;
DEFINE INBUFSIZE=<777>; ! THE BIGGEST OF THE THREE;
DEFINE OUTBUFSIZE=<'1006>; ! BECAUSE DUMPER WRITES A PAGE+6 WORDS
OF BOOK-KEEPING;
! BECAUSE R. SMITH FORGOT TO DEFINE JSYSES IN THE PARC-SUMEX VERSIONS,
THESE ARE TEMPORARILY INCLUDED;
DEFINE GDSTS=<'104000000145>,SDSTS=<'104000000146>;
DEFINE FORE(X,Y)=<FOR X←1 STEP 1 UNTIL Y DO>;
DEFINE CRLF=<"
">;
! PROGRAM VARIABLES;
INTEGER INJFN,OUTJFN,LSTJFN;
INTEGER LISTING;
INTEGER EOF;
INTEGER INFORMAT,OUTFORMAT;
INTEGER ARRAY INBUF[1:INBUFSIZE],OUTBUF[1:OUTBUFSIZE];
LABEL BEYOND;
SIMPLE PROCEDURE LISTNAME;
BEGIN
! PICK UP NAME FROM THE OUTBUF, WHICH IS NOW IN DUMPER FORMAT
WE REFER TO THE DUMPER LISTING, WHICH IS R. TOMLINSON'S
ONLY DOCUMENTATION.
THEREIN IT SEEMS TO BE TRUE THAT BLOCK TYPE -2
IS INDICATES THAT THE RECORD IS A HEADER, AND THAT THE
NAME OF THE FILE BEGINS AT THE FIRST DATA WORD -- I.E,
IN OUTBUF[7] IN THIS PROGRAM.;
IF OUTBUF[5]=-2 THEN
BEGIN
STRING S;
INTEGER C,BP;
! PICK UP THE STRING FROM THE BUFFER. THERE IS
AN INTERNAL SAIL FUNCTION THAT DOES THIS, BUT BETTER NOT
USE IT. SOMETHING LESS IMPLEMENTATION-DEPENDENT.;
S←NULL; BP←POINT(7,OUTBUF[7],-1);
WHILE (C←ILDB(BP)) DO S←S & C;
OUT(LSTJFN,S & CRLF);
END;
END;
SIMPLE PROCEDURE SUMEXCONVERT;
BEGIN
! SUMEX TAPES ARE WRITTEN IN THE STANDARD DEC FORMAT. THIS
IS PROBABLY THE MOST SENSIBLE THING THAT THEY COULD
HAVE DONE.;
INTEGER I; INTEGER IBP,OBP;
IBP←POINT(8,INBUF[1],-1);
OBP←POINT(8,OUTBUF[1],-1);
FORE(I,OUTBUFSIZE)
BEGIN
FORC V←1 STEPC 1 UNTILC 4 DOC <IDPB(ILDB(IBP),OBP);> ENDC
DPB(ILDB(IBP) LAND '17,POINT(4,OUTBUF[I],35));
END;
END;
SIMPLE PROCEDURE IMSSSCONVERT;
! IMSSS FORMAT PUTS 36 BITS OF DATA INTO 36 BITS ON THE TAPE!
THE FORMAT PUTS 2 PDP-10 WORDS INTO 9 TAPE FRAMES,
WHERE THE FRAMES ARE THE BYTES OF THE TWO WORDS AS
SHOWN IN THIS DIAGRAM:
------------------------
\ 1 \ 2 \ 3 \ 4 \5A\
------------------------
\ 6 \ 7 \ 8 \ 9 \5B\
------------------------
5A AND 5B TOGETHER FORM THE FIFTH FRAME ON THE TAPE.
;
BEGIN
INTEGER I; INTEGER IBP,OBP;
IBP←POINT(8,INBUF[1],-1);
OBP←POINT(8,OUTBUF[1],-1);
FORE(I,OUTBUFSIZE)
BEGIN
INTEGER FIFTHBYTE;
FORC V←1 STEPC 1 UNTILC 4 DOC <IDPB(ILDB(IBP),OBP);> ENDC
FIFTHBYTE←ILDB(IBP);
DPB(FIFTHBYTE LSH -4,POINT(4,OUTBUF[I],35));
I←I+1; ! NOW INTO NEXT WORD;
FORC V←1 STEPC 1 UNTILC 4 DOC <IDPB(ILDB(IBP),OBP);> ENDC
DPB(FIFTHBYTE LAND '17,POINT(4,OUTBUF[I],35));
END;
END;
SIMPLE PROCEDURE PARCCONVERT;
BEGIN
! PARC FORMAT TAPES ARE WRITTEN IN A 36-BITS-IN-48-BITBIT FORMAT,
OSTENSIBLY TO PLACATE THEIR NOVA.;
INTEGER I; INTEGER IBP,OBP;
IBP←POINT(8,INBUF[1],-1);
OBP←POINT(8,OUTBUF[1],-1);
FORE(I,OUTBUFSIZE)
BEGIN
INTEGER JUNK;
FORC V←1 STEPC 1 UNTILC 4 DOC <IDPB(ILDB(IBP),OBP);> ENDC
JUNK←ILDB(IBP);
DPB(ILDB(IBP) LSH -4,POINT(4,OUTBUF[I],35));
END;
END;
SIMPLE PROCEDURE CONVERT;
BEGIN
CASE INFORMAT OF
BEGIN
SUMEXCONVERT;
IMSSSCONVERT;
PARCCONVERT;
END;
END;
SIMPLE PROCEDURE READIN;
BEGIN
ARRYIN(INJFN,INBUF[1],(CASE INFORMAT OF (SUMEXBUFSIZE,IMSSSBUFSIZE,PARCBUFSIZE)));
END;
SIMPLE PROCEDURE READOUT;
BEGIN
ARRYOUT(OUTJFN,OUTBUF[1],'1006);
END;
DEFINE ENDOFTAPE=<(OUTBUF[5]=-4)>;
SIMPLE PROCEDURE BYTE4(INTEGER JFN);
! SET STATUS OF TAPE FOR 4-BYTE MODE AT IMSSS OR SUMEX.
SOMETHING LIKE THIS WINS AT PARC -- I THINK THIS IS IT,
BUT SOME CHECKING IS NEEDED;
START!CODE
DEFINE P=<'17>;
PUSH P,JFN;
PUSHJ P,CVJFN;
GDSTS;
TRO 2,'1000; ! TURN ON 4 BYTE MODE AT SUMEX OR IMSSS;
SDSTS;
END;
SIMPLE PROCEDURE INPUTGET;
BEGIN
OUTSTR(CASE INFORMAT OF ("SUMEX","IMSSS","PARC"));
OUTSTR(" INPUT TAPE *");
INJFN←OPENFILE(NULL,"RC");
MTAPE(INJFN,"W");
BYTE4(INJFN);
SETINPUT(INJFN,200,0,EOF);
END;
SIMPLE PROCEDURE OUTPUTGET;
BEGIN
OUTSTR(SITENAME);
OUTSTR(" OUTPUT TAPE *");
OUTJFN←OPENFILE(NULL,"WC");
MTAPE(OUTJFN,"W");
END;
BEGIN
STRING S;
DEFINE GETIT(MSG,RESULT)=<
BEGIN
LABEL LAB;
LAB:
OUTSTR(MSG & " TAPE FORMAT (S, I, P OR ?) *");
S←INCHWL;
IF S="?" THEN
BEGIN
OUTSTR("TYPE
S FOR SUMEX
I FOR IMSSS
P FOR PARC
");
GOTO LAB;
END ELSE
IF S="S" THEN
RESULT←ISSUMEX
ELSE
IF S="I" THEN
RESULT←ISIMSSS
ELSE
IF S="P" THEN
RESULT←ISPARC
ELSE
BEGIN
OUTSTR("ILLEGAL SITE!
");
GOTO LAB;
END;
END>;
GETIT("INPUT",INFORMAT);
OUTSTR("LISTING FILE NAME (CRLF FOR NONE) *");
S←INCHWL;
IF NOT S THEN LISTING←FALSE ELSE
BEGIN
LISTING←TRUE;
LSTJFN←OPENFILE(S,"W");
END;
OUTSTR("OUTPUT TAPE WILL BE IN " & SITENAME & " FORMAT.
");
END;
INPUTGET;
OUTPUTGET;
WHILE TRUE DO
BEGIN"FILES"
WHILE TRUE DO
BEGIN"COPY"
READIN;
IF EOF THEN DONE;
CONVERT;
READOUT;
IF LISTING THEN LISTNAME; ! IF NEEDED;
IF ENDOFTAPE THEN GOTO BEYOND;
END"COPY";
MTAPE(OUTJFN,"E");
END"FILES";
BEYOND:
CFILE(INJFN); CFILE(OUTJFN); IF LISTING THEN CFILE(LSTJFN);
END"TRITAP";