Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0002/maktab.tnx
There is 1 other file named maktab.tnx in the archive. Click here to see a list.
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 <SYSTEM>STENEX.FAI
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;
 PRELOADWITH 
  NULL, 
comment The followng are subcodes for EXTEND, though they are stuck in
	the normal opcode table, since there are no opcodes this low;
  "CMPSL","CMPSE","CMPSLE","EDIT","CMPSGE","CMPSN","CMPSG",
  "CVTDBO","CVTDBT","CVTBDO","CVTBDT","MOVSO","MOVST","MOVSLJ","MOVSRJ",
  "XBLT",
comment here are the real opcodes;
  ['63] NULL,
  "JSYS","ADJSP",['2]NULL,
  "DFAD","DFSB","DFMP","DFDV","DADD","DSUB","DMUL","DDIV",
  "DMOVE","DMOVN","FIX","EXTEND","DMOVEM","DMOVNM","FIXR","FLTR",
  "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","MAP",
  "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);
Comment now instructions that don't fit in the table:;
EMITINST(CVSIX("ADJBP"),'133 LSH 27);  
EMITINST(CVSIX("PORTAL"), '254040 LSH 18);
EMITINST(CVSIX("JRSTF"), '254100 LSH 18);
EMITINST(CVSIX("HALT"), '254200 LSH 18);
EMITINST(CVSIX("XJRSTF"), '254240 LSH 18);
EMITINST(CVSIX("XJEN"), '254300 LSH 18);
EMITINST(CVSIX("XPCW"), '254340 LSH 18);
EMITINST(CVSIX("JEN"), '254500 LSH 18);
EMITINST(CVSIX("SFM"), '254600 LSH 18);
EMITINST(CVSIX("JFOV"), '255040 LSH 18);
EMITINST(CVSIX("JCRY1"), '255100 LSH 18);
EMITINST(CVSIX("JCRY0"), '255200 LSH 18);
EMITINST(CVSIX("JCRY"), '255300 LSH 18);
EMITINST(CVSIX("JOV"), '255400 LSH 18);
EMITINST(CVSIX("XMOVEI"), '415 LSH 27);
EMITINST(CVSIX("XHLLI"), '501 LSH 27);
EMITINST(CVSIX("BLKI"), '700000 LSH 18);
EMITINST(CVSIX("DATAI"), '700040 LSH 18);
EMITINST(CVSIX("BLKO"), '700100 LSH 18);
EMITINST(CVSIX("DATAO"), '700140 LSH 18);
EMITINST(CVSIX("CONO"), '700200 LSH 18);
EMITINST(CVSIX("CONI"), '700240 LSH 18);
EMITINST(CVSIX("CONSZ"), '700300 LSH 18);
EMITINST(CVSIX("CONSO"), '700340 LSH 18);

OUTSTR("INPUT FILE FOR JSYS'ES (STENEX.FAI)  *");
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";