perm filename MAKTAB.TNX[NEW,AIL] blob
sn#276230 filedate 1980-02-29 generic text, type T, neo UTF8
COMMENT RLS 2-23-74
THIS IS THE TENEX VERSION OF THE PROGRAM TO MAKE THE START!CODE
TABLE FOR SAIL ON TENEX.
THE BASIC IDEAS ARE:
(1) TO NOT ASSEMBLE ANY DEC OR STANFORD UUOS.
(2) TO ASSEMBLE ALL JSYS'ES BY USING THE FILE <SUBSYS>STENEX.MAC
OR EQUIVALENT, WHICH HAS THE DEFINITIONS OF THE JSYSES
(3) TO SSAVE ALL THIS IN A TWO-PAGE .SAV FILE, STARTING AT
STARTPAGE (CURRENTLY 610).
Moreover, instead of having the opcodes in a table that is
linearly searched (even when the search instructions are "set up
for a fast search in the ac's!!"), we have a buckets of link
lists, where the bucket is computed by the hashing function:
move ac, [sixbit of opcode]
lsh ac,-=12 ! to ignore last 2 chars
idivi ac,primeno
and the entries are stored thus:
sixbit/opcode/
opcode
ptr to link ! 0 if end of bucket list
end of remark;
BEGIN "MAKTAB"
DEFINE ! = "COMMENT";
! SETBREAK ASSIGNMENTS;
DEFINE CRLFTBL="1",SPACETBL="2",COMMATBL="3";
! LINK LIST, INSTRUCTION TABLE HANDLERS;
DEFINE BUCKETS="307";
DEFINE STARTPAGE="'600",
NEWEMIT(Y)="MEMORY[(INSTPTR←INSTPTR+1)]←Y",
BUCKETSTART="(STARTPAGE*'1000)",INSTSTART="((STARTPAGE*'1000)+BUCKETS)",
BUCKS(X)="MEMORY[(STARTPAGE*'1000)+X]";
INTEGER NUMPAGES;
INTEGER INSTPTR;
INTEGER ARRAY LAST,COUNT[0:BUCKETS-1];
SIMPLE PROCEDURE COLLA(REFERENCE STRING S);
BEGIN
INTEGER JUNK;
WHILE S=" " DO JUNK←LOP(S);
WHILE S[INF FOR 1]=" " DO S←S[1 TO INF-1];
END;
SIMPLE PROCEDURE EMITINST(INTEGER NAME,CODE);
BEGIN
INTEGER HASH;
HASH←ABS(NAME) MOD BUCKETS;
IF BUCKS(HASH) THEN
BEGIN"LIST STARTED"
NEWEMIT(NAME); ! PUT OUT THE SIXBIT;
MEMORY[LAST[HASH]]←INSTPTR; ! FIX UP THE LAST LINK;
NEWEMIT(CODE);
LAST[HASH]←(INSTPTR←INSTPTR+1); ! LEAVE A BLANK PTR, AND REMEMBER THE LAST;
END ELSE
BEGIN"FRESH LIST"
NEWEMIT(NAME);
BUCKS(HASH)←INSTPTR; ! INITIAL BUCKET POINTER;
NEWEMIT(CODE);
LAST[HASH]←(INSTPTR←INSTPTR+1); ! LEAVE A BLANK PTR, AND REMEMBER WHERE IT IS;
END;
COUNT[HASH]←COUNT[HASH]+1;
END;
INTEGER I,J,K,L;
COMMENT OPCODE TABLE FOR STANDARD PDP-10 USER INSTRUCTIONS, SANS UUOS AND
JSYSES;
PRELOAD_WITH
['104] NULL, "JSYS",
['23] NULL,
"UFA","DFN","FSC","IBP","ILDB","LDB","IDPB","DPB",
"FAD","FADL","FADM","FADB","FADR","FADRI","FADRM","FADRB",
"FSB","FSBL","FSBM","FSBB","FSBR","FSBRI","FSBRM","FSBRB",
"FMP","FMPL","FMPM","FMPB","FMPR","FMPRI","FMPRM","FMPRB",
"FDV","FDVL","FDVM","FDVB","FDVR","FDVRI","FDVRM","FDVRB",
"MOVE","MOVEI","MOVEM","MOVES","MOVS","MOVSI","MOVSM","MOVSS",
"MOVN","MOVNI","MOVNM","MOVNS","MOVM","MOVMI","MOVMM","MOVMS",
"IMUL","IMULI","IMULM","IMULB","MUL","MULI","MULM","MULB",
"IDIV","IDIVI","IDIVM","IDIVB","DIV","DIVI","DIVM","DIVB",
"ASH","ROT","LSH","JFFO","ASHC","ROTC","LSHC","",
"EXCH","BLT","AOBJP","AOBJN","JRST","JFCL","XCT","" ,
"PUSHJ","PUSH","POP","POPJ","JSR","JSP","JSA","JRA",
"ADD","ADDI","ADDM","ADDB","SUB","SUBI","SUBM","SUBB",
"CAI","CAIL","CAIE","CAILE","CAIA","CAIGE","CAIN","CAIG",
"CAM","CAML","CAME","CAMLE","CAMA","CAMGE","CAMN","CAMG",
"JUMP","JUMPL","JUMPE","JUMPLE","JUMPA","JUMPGE","JUMPN","JUMPG",
"SKIP","SKIPL","SKIPE","SKIPLE","SKIPA","SKIPGE","SKIPN","SKIPG",
"AOJ","AOJL","AOJE","AOJLE","AOJA","AOJGE","AOJN","AOJG",
"AOS","AOSL","AOSE","AOSLE","AOSA","AOSGE","AOSN","AOSG",
"SOJ","SOJL","SOJE","SOJLE","SOJA","SOJGE","SOJN","SOJG",
"SOS","SOSL","SOSE","SOSLE","SOSA","SOSGE","SOSN","SOSG",
"SETZ","SETZI","SETZM","SETZB","AND","ANDI","ANDM","ANDB",
"ANDCA","ANDCAI","ANDCAM","ANDCAB","SETM","SETMI","SETMM","SETMB",
"ANDCM","ANDCMI","ANDCMM","ANDCMB","SETA","SETAI","SETAM","SETAB",
"XOR","XORI","XORM","XORB","IOR","IORI","IORM","IORB",
"ANDCB","ANDCBI","ANDCBM","ANDCBB","EQV","EQVI","EQVM","EQVB",
"SETCA","SETCAI","SETCAM","SETCAB","ORCA","ORCAI","ORCAM","ORCAB",
"SETCM","SETCMI","SETCMM","SETCMB","ORCM","ORCMI","ORCMM","ORCMB",
"ORCB","ORCBI","ORCBM","ORCBB","SETO","SETOI","SETOM","SETOB",
"HLL","HLLI","HLLM","HLLS","HRL","HRLI","HRLM","HRLS",
"HLLZ","HLLZI","HLLZM","HLLZS","HRLZ","HRLZI","HRLZM","HRLZS",
"HLLO","HLLOI","HLLOM","HLLOS","HRLO","HRLOI","HRLOM","HRLOS",
"HLLE","HLLEI","HLLEM","HLLES","HRLE","HRLEI","HRLEM","HRLES",
"HRR","HRRI","HRRM","HRRS","HLR","HLRI","HLRM","HLRS",
"HRRZ","HRRZI","HRRZM","HRRZS","HLRZ","HLRZI","HLRZM","HLRZS",
"HRRO","HRROI","HRROM","HRROS","HLRO","HLROI","HLROM","HLROS",
"HRRE","HRREI","HRREM","HRRES","HLRE","HLREI","HLREM","HLRES",
"TRN","TLN","TRNE","TLNE","TRNA","TLNA","TRNN","TLNN",
"TDN","TSN","TDNE","TSNE","TDNA","TSNA","TDNN","TSNN",
"TRZ","TLZ","TRZE","TLZE","TRZA","TLZA","TRZN","TLZN",
"TDZ","TSZ","TDZE","TSZE","TDZA","TSZA","TDZN","TSZN",
"TRC","TLC","TRCE","TLCE","TRCA","TLCA","TRCN","TLCN",
"TDC","TSC","TDCE","TSCE","TDCA","TSCA","TDCN","TSCN",
"TRO","TLO","TROE","TLOE","TROA","TLOA","TRON","TLON",
"TDO","TSO","TDOE","TSOE","TDOA","TSOA","TDON","TSON";
STRING ARRAY INP[0:'1000];
INTEGER INJFN,OUTJFN;
INTEGER EOF;
INSTPTR←INSTSTART;
FOR I←0 STEP 1 UNTIL '1000 DO IF INP[I] THEN EMITINST(CVSIX(INP[I]),I LSH 27);
OUTSTR("INPUT FILE FOR JSYS'ES (<SUBSYS>STENEX.MAC) *");
SETINPUT(INJFN←OPENFILE(NULL,"RC"),200,0,EOF);
OUTSTR("OUTPUT FILE *");
OUTJFN←GTJFN(NULL,'400001000000);
SETBREAK(CRLFTBL,'12,'15&'14,"IN");
SETBREAK(SPACETBL," ",NULL,"IN");
SETBREAK(COMMATBL,",",NULL,"IN");
WHILE NOT EOF DO
BEGIN
STRING S;
STRING J;INTEGER WHICH,JUNK;
LABEL CONT;
S←INPUT(INJFN,CRLFTBL);
COLLA(S);
IF NOT S THEN GOTO CONT;
IF NOT EQU(S[1 FOR 5],"DEFJS") THEN GOTO CONT;
SCAN(S,2,JUNK);
J←SCAN(S,3,JUNK);
COLLA(J);
IF EQU(J,"JSYS") THEN GOTO CONT;
EMITINST(CVSIX(J),'104000000000 LOR CVO(S));
CONT:
END;
NUMPAGES←-(INSTPTR-(STARTPAGE*'1000)) % '1000;
START!CODE
DEFINE P="'17";
PUSH P,OUTJFN;
PUSHJ P,CVJFN; ! GET JFN NO. IN 1;
HRLI 1,'400000; ! THIS FORK;
HRL 2,NUMPAGES;
HRRI 2,STARTPAGE; ! XWD NO. OF PAGES, STARTING PAGE;
IORI 2,'520000; ! SHARED, COPY ON RIGHT;
SETZ 3,; ! SOME BBN DEFAULT;
SSAVE;
END;
CFILE(INJFN);
END "MAKTAB";