/ 
	.TITLE	8TRAN V1A000
/
/COPYRIGHT (C) 1975
/DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
	.EJECT
/EDIT 001	EK	14-JUL-74	CHANGE SIGNON NUMBER
/EDIT 002	MJH	20-AUG-75	DISCLAIMER
/EDIT 003	GAR	21-OCT-75	CHANGE LABELS 'PUT', '.PUT' AND
/					'.GET'.  THESE ARE NOW RESERVED WORDS
/					AND THEY ARE NOT LEGAL LABELS.
/
/
/TO SEGMENT TO 5 PAPER TAPE SOURCES (USE PIP):
/S /TAP2,/TAP3,/TAP4,/TAP5
/T PP ,,,, (AY)_DTN 8TRAN
/
/2 PROGRAMS MAY BE ASSEMBLED FROM THE SOURCE FILE:
/NORMAL ASSEMBLY WILL PRODUCE (BASIC,ADVANCED,B/F). 15 VERSIONS
/DEFINE COMPCT=1 FOR COMPACT VERSION.
/	
/FILE 1 - 8TRAN1
	.DEFIN	S,A
	.SIXBT	'A
	.ENDM
/
IDX=ISZ
	.IFUND	COMPCT
/INPUT-OUTPUT
TT=-2
KEY=-3
	.IODEV	-2,-3
	.IFDEF	PTP
WR=5
RD=3
	.IODEV	5,3
	.ENDC
	.IFUND	PTP
WR=-14
RD=-15
	.IODEV	-14,-15
	.ENDC
SIZE=40
BUFF	.BLOCK	2*SIZE
BUFFA	.BLOCK	2*SIZE
/
BEG	LAC	ENDSW
	SNA
	JMP	BEGG
	.EXIT
BEGG	.INIT	TT,1,BEG
	.INIT	KEY,0,BEG
	.WRITE	TT,2,TITLA,0	/8TRAN VNN
	JMS	SYMSET		/SET UP SYMBOL TABLE
	DZM	SSW		/DEFAULT NO EXTERNAL SYMBOL TABLE
	JMS	FLAGI		/INITIALISE FLAGS
	DZM	FLSW		/ALL FLAGS
BEGR	.WRITE	TT,2,TITLB,0	/>
	.WAIT	TT
	.READ	KEY,2,BUFF,SIZE	/READ COMMAND STRING
	DZM	EOTSW	
	.WAIT	KEY
	LAC	(BUFF+2		/SET UP READ FROM BUFFER
	JMS	.GETI
	LAC	INB+1		/READ 1 LINE ONLY
	DAC	INR
BEGA	JMS	FETCH
	SAD	(106		/F?
	JMP	FSET		/FLAG OPTION
	SAD	(123		/S?
	JMP	SSET		/SYMBOL TABLE
	SAD	(137		/(LEFT ARROW)
	SKP
	JMP	QUES		/ILLEGAL CHAR
	DZM	INFL		/ZERO INPUT FILE NAME
	DZM	INFL+1
	LAC	OUTFL+2		/'SRC'
	DAC	INFL+2		/DEFAULT EXTENSION
	DZM	OUTFL		/ZERO OUTPUT FILE NAME
	DZM	OUTFL+1	
	JMS	FETCH		/NEXT CHARACTER
	JMS	TGO		/TEST GO
	JMS	CHECK		/AND FETCH WORD
	DAC	INFL		/STORE 1ST SYLLABLE
	DAC	OUTFL
	LAC	TCHAR		/LOAD TERMINATOR
	JMS	TGO		/GO?
	JMS	SEP		/NO,SEPARATOR?
	JMP	EXT		/YES, EXTENSION
	JMS	CHECK		/2ND SYLLABLE
	DAC	INFL+1		/STORE
	DAC	OUTFL+1
	LAC	TCHAR
	JMS	TGO		/GO?
	JMS	SEP		/NO,SEPARATOR?
	SKP			/YES,EXTENSION
	JMP	QUES		/NO
EXT	JMS	FETCH		/NEXT CHAR
	JMS	CHECK	
	DAC	INFL+2		/STORE
	LAC	TCHAR
	JMS	TGO		/GO?
	JMP	QUES		/NO
/
GO	LAC	FLSW
	SZA			/FLAGS?
	JMP	FLGSET		/YES
	LAC	(NOP
	DAC	INR		/CHANGE INPUT FROM TT
	.INIT	RD,0,BEG		/INITIALISE INPUT
	.FSTAT	RD,INFL		/FILE FOUND?
	SNA
	JMP	NFD		/NO
	.SEEK	RD,INFL		/YES, READ 1ST BLOCK
	.READ	RD,2,BUFF,SIZE
	LAC	SSW
	SZA			/SYMBOL TABLE?
	JMP	ST		/YES
	.INIT	WR,1,BEG		/NO,INITIALISE OUTPUT
	LAC	(OUTFL
	DAC	GOC-1		/CLEAR DIRECTORY BITS
	.FSTAT	WR,OUTFL		/TEST OUTPUT FILE
GOC	SZA!CLL
	STL			/SET LINK IF AC NOT 0
	LAC	GOC-1
	AND	(700000		/LOOK AT FILE BITS
	SNA			/FILE ORIENTED?
	JMP	GOA		/NO
	SZL			/YES,FILE FOUND?
	JMP	FND		/YES
GOA	.ENTER	WR,OUTFL	/NO,
	LAC	(GOB		/SET UP OUTPUT
	DAC	PUTX	/(GAR-003)
	JMP	PUTT
GOB	LAC	(BEG89T		/SET UP INPUT
	DAC	FETCH
	JMP	INA		/AND START
NFD	.WRITE	TT,2,MNFD,0	/NOT FOUND
	JMP	BEGR
MNFD	7002
PUTP	0			/TEMP STORAGE
	.ASCII	'INPUT FILE NOT ON DEVICE'<12><15>
ENDSW=.-1
/
FND	.INIT	TT,1,BEG	/CRLF
/
	.WRITE	TT,2,MFND,0	/FOUND
	.WRITE	TT,2,MFNDA,0	/OVERWRITE?
	.READ	KEY,2,BUFF,SIZE
	.WAIT	KEY
	JMP	GOA		/YES
MFND	10002
EOTSW	0
	.ASCII	'OUTPUT FILE ALREADY ON DEVICE'<12><15>
FLSW=.-1
MFNDA	11002
INHDR	0
	.ASCII	'TYPE ^P TO RESTART OR CR TO OVERWRITE'<12><15>
FSET	ISZ	FLSW
	JMP	BEGA
SSET	ISZ	SSW		/SET SYMBOL TABLE SWITCH
	JMP	BEGA		/NEXT CHAR
TGO	XX
	SAD	(15		/CR?
	JMP	TGOA		/YES
	SAD	(175		/ALTMODE?
	SKP			/YES
	JMP*	TGO		/NO, NOT GO
	ISZ	ENDSW		/SET FOR .EXIT
	JMP	GO
TGOA	DZM	ENDSW		/CLEAR FOR ANOTHER TRANSLATION
	JMP	GO
CHECK	XX
	JMS	ALPHNM
	SKP
	JMP	QUES		/NO
	JMS	SYLL		/FORM SYLLABLE
	LAC	SYLB		/PUT IT IN AC
	JMP*	CHECK
QUES	.WRITE	TT,2,QUERY,0
	JMP	BEGR
TITLA	4002			/(WAS 3002    EDIT 001  EK)
ISW	0
	.SYSID <	.ASCII /8TRAN >,<000/<15>>
SSW	0			/(WAS SSW=.-1   EDIT 001  EK)
TITLB	2002
OSW	0
	.ASCII	'>'<175>
SPAC=.-1
QUERY	2002
HEAD	0
	.ASCII	'??'<12><15>
INFL	.BLOCK	3
OUTFL	.BLOCK	2
	S	SRC
FETCH	XX
NEXT	LAC	EOTSW
	SNA			/END OF MEDIUM?
	JMP	.+3		/NO
	LAW	-1		/YES,PUT -1 IN AC
	JMP*	FETCH		/AND RETURN
	JMS	.GETX		/GET CHARACTER(GAR-003)
	SAD	(177		/RUBOUT?
	JMP	NEXT		/YES, IGNORE
	SAD	(12		/LINE-FEED?
	JMP	NEXT		/YES, IGNORE
	SAD	(40		/SPACE?
	JMP	SPACE		/YES
	DZM	SPAC		/NO, CLEAR SPACE INDICATOR
	JMP	INR		/CHECK FURTHER
/
SPACE	LAC	SPAC
	SZA			/INDICATOR SET?
	JMP	NEXT		/YES,IGNORE SPACE
	ISZ	SPAC		/NO, SET IT AND
	LAC	(40		/STORE SPACE
INR	NOP			/OR 'JMP* FETCH'
	SAD	(15		/TERMINATOR?
	SKP			/YES
	JMP*	FETCH		/NO, RETURN WITH CHAR IN AC
	ISZ	ISW		/SWITCH
	JMP	INA		/SECOND
	LAC	(BUFF+SIZE	/FIRST
	JMS	INCHK		/SET UP AND CHECK FOR EOT
	.READ	RD,2,BUFF,SIZE
	JMP	INB
INA	CLA!CMA
	DAC	ISW		/RESET SWITCH
	LAC	(BUFF
	JMS	INCHK		/SET UP AND CHECK FOR EOT
	.READ	RD,2,BUFF+SIZE,SIZE
INB	LAC	TCHAR
	JMP*	FETCH
/
INCHK	XX
	DAC	INHDR		/SAVE HEADER ADDR
	TAD	(2		/+2 IS FIRST DATA WORD ADDR
	JMS	.GETI		/SET UP GET ROUTINE
	LAC*	INHDR		/FETCH LEADER WORD
	AND	(4
	SZA			/BIT 15 SET?
	ISZ	EOTSW		/YES, SET EOT SWITCH
	JMP*	INCHK		/AND RETURN
/
PUTX	XX		/(GAR-003)
	NOP			/OR 'JMP* PUT' TO INHIBIT OUTPUT
	SAD	(15		/END OF LINE?
	JMP	PUTAA		/YES, OUTPUT THE LINE.
	JMS	.PUTX		/NO, STORE CHAR IN BUFFER(GAR-003)
	JMP*	PUTX	/(GAR-003)
/
PUTAA	JMS	.PUTX	/(GAR-003)
	LAC	CNTP		/WORD PAIRS
	CLL!RAL			/*1000
	JMS	R4L
	JMS	R4L
	TAD	(1002		/+1 PAIR & IOPS ASCII
	DAC*	HEAD		/TO HEADER
	ISZ	OSW		/WHICH BUFFER?
	JMP	PUTA		/SECOND
	.WRITE	WR,2,BUFFA,SIZE	/WRITE FIRST
	LAC	(BUFFA+SIZE	/SET-UP SECOND
PUTB	DAC	HEAD		/SAVE HEADER WORD ADDR
	TAD	(2
	JMS	.PUTI		/AND SET UP THE PACK ROUTINE
	JMP*	PUTX	/(GAR-003)
/
PUTA	.WRITE	WR,2,BUFFA+SIZE,SIZE	/WRITE SECOND
PUTT	CLA!CMA
	DAC	OSW		/RESET SWITCH
	LAC	(BUFFA		/SET-UP FIRST
	JMP	PUTB
/
.GETI	0			/POINTER IN AC
	DAC	GETP		/INIT POINTER
	LAW	-1
	DAC	GETC		/INIT COUNTER
	JMP*	.GETI
/UNPACK.
/
.GETX	0		/(GAR-003)
	ISZ	GETC
	JMP	GET4		/WORD PAIR STARTED
	LAC*	GETP		/NEED NEXT PAIR
	ISZ	GETP
	DAC	GET1		/FIRST PART
	LAC*	GETP
	ISZ	GETP
	DAC	GET2		/LAST PART
	LAW	-5		/RESET CHAR COUNT
	DAC	GETC
GET4	LAW	-10		/SHIFT LOOP 7 +1/2 TIMES
	DAC	GET3
GET5	LAC	GET2		/DOUBLE AC ROTATE LOOP
	RAL
	ISZ	GET3
	JMP	GET6		/KEEP LOOPING
	AND	(177		/GOT CHARACTER
	DAC	TCHAR		/SAVE IT
	JMP*	.GETX		/EXIT WITH CHARACTER IN AC (GAR-003)
GET6	DAC	GET2
	LAC	GET1
	RAL
	DAC	GET1
	JMP	GET5
/TEMPOPARY STORAGE
/
GETP	0			/ASCII STRING POINTER
GETC	0			/CHARACTER COUNTER
GET1	0			/TEMPORARY STORAGE
GET2	0			/TEMPORARY STORAGE
GET3	0			/TEMPORARY STORAGE
/
/PACK
/
.PUTI	0			/POINTER IN AC
	DAC	PUTP		/INIT POINTER
	DZM	PUTC		/INIT COUNTER
	DZM	CNTP	
	JMP*	.PUTI
.PUTX	0			/CHARACTER IN AC	(GAR-003)
	AND	(177
	DAC	PUT6		/SAVE CHARACTER
	CLL
	LAC	PUTC		/CHARACTER POSITION
	TAD	(JMP* PUT7	/BUILD DISPATCH
	DAC	.+2
	LAC	PUT6		/GET CHARACTER
	XX			/MODIFIED JMP* PUT7
PUT7	PUT1			/CHAR1
	PUT2			/CHAR2
	PUT3			/CHAR3
	PUT4			/CHAR4
	PUT5			/CHAR5
PUT1	ISZ	CNTP		/ONE MORE PAIR
	JMS	R4R		/8 RIGHT
	JMS	R4R
PUT8	DZM*	PUTP		/CLEAR DATA WORD
	JMP	PUT9
PUT2	JMS	R4L		/4 LEFT
	JMP	PUT9
PUT3	RTR			/3 RIGHT - 1ST HALF
	RAR
	AND	(17		/4 BITS ONLY
	XOR*	PUTP		/FINISH 1ST WORD OF PAIR
	DAC*	PUTP		
	ISZ	PUTP		/TO LAST WORD OF PAIR
	LAC	PUT6		/GET CHARACTER
	JMS	R4R		/4 RIGHT - 2ND HALF
	AND	(700000		/3 BITS ONLY
	JMP	PUT8
PUT4	JMS	R4L		/8 LEFT
	JMS	R4L
	JMP	PUT9
PUT5	DZM	PUTC		/RESET 5/7 COUNTER
	SKP!RAL			/1 LEFT
PUT9	ISZ	PUTC		/TO NEXT CHARACTER
	XOR*	PUTP
	DAC*	PUTP		/MERGE INTO WORD PAIR
	LAC	PUTC
	SNA
	ISZ	PUTP		/2ND WORD COMPLETE
	JMP*	.PUTX		/RETURN	(GAR-003)
/TEMPORARY STORAGE
/
CNTP
TCHAR;TEMA;TEMB;TEM1;TEM2;TEM3
	.ENDC
	.EJECT
	.IFDEF	COMPCT
AUTOA=11
AUTOB=12
AUTOX=13
AUTOY=14
SIZE=100
	.ABS	NLD
	.DEFIN S,A
	.SIXBT	'A
	.ENDM
	.LOC	1
	JMP	SERVE
	.LOC	21
	LAC	20
	HLT
/
SWA;CNTA;SWB;CNTB;SWX;CNTX;SWY;CNTY
IDV;IBF;ODV;OBF
TEM1;TEM2;TEM3
TCHAR;TEMA;TEMB;CNTS
/
	.LOC	67
IOERR	XX
	HLT			/HALT AT LOC. 70 ON IO ERROR
	JMP*	IOERR		/CONTINUE TO PROCEED
/
	.LOC	100
BEG	CAF
	JMS	SYMSET		/SET UP SYMBOL TABLE
	LAC	LOW
	DAC	PUTX+1		/INITIAL OUT PUT TO TT (GAR-003)
	CLA!CMA			/SET -1 IN PSW TO ACCEPT
	DAC	PSW		/COMMAND STRING
	LAC	(LOOP
	DAC	0		/SET WAIT
	JMS	CRLF
	LAC	MSG89T
	JMS	TRIO
	LAC	MSG89T+1		/8TRAN
	JMS	TRIO
	JMS	CRLF
	LAC	(KEYCHK
	DAC	KEY		/LISTEN
	JMP	QA		/TYPE OPTIONS
MSG89T	S	8TRAN
CP	S	^P
PSW;TTSW;SSW
QA	JMS	ASK		/OUTPUT '*IN-'
	S	IN
	SAD	(110		/H?
	JMP	QAH		/YES
	SAD	(114		/L?
	SKP			/YES
	JMP	QA		/NEITHER, TRY AGAIN
	LAC	LO		/'JMS KEY'
	SKP
QAH	LAC	HI		/'JMS RD'
	DAC	NEXT		/DEPOSIT IN FETCH ROUTINE
QB	JMS	ASK		/OUTPUT '*OUT-'
	S	OUT
	SAD	(110		/H?
	JMP	QBH		/YES
	SAD	(114		/L?
	SKP			/YES
	JMP	QB		/NEITHER, TRY AGAIN
	ISZ	TTSW		/SET TT SWITCH
	LAC	LOW		/'JMS TT'
	JMP	QBL
QBH	DZM	TTSW		/CLEAR TT SWITCH
	LAC	HIGH		/'JMS PUN'
QBL	DAC	OUTDEV+1		/IN OUTPUT ROUTINE
QC	JMS	ASK		/OUTPUT '*SYM'
	S	SYM
	SAD	(131		/Y?
	JMP	ST		/YES, LOAD SYMBOL TABLE
	SAD	(116		/N?
	SKP			/YES
	JMP	QC		/NEITHER, TRY AGAIN
QD	JMS	ASK		/OUTPUT '*FLG-'
	S	FLG
	SAD	(131		/Y?
	JMP	FLAGY		/YES, SET FLAG OPTION
	SAD	(116		/N?
	JMP	FLAGN		/YES, CLEAR FLAG OPTION
	JMP	QD
/
ASK	XX			/OUTPUT SYLLABLE IN LOC+1
	JMS	CRLF
	LAW	52
	JMS	PUTX		/*	(GAR-003)
	LAC*	ASK
	ISZ	ASK		/SKIP ARGUMENT FOR RETURN
	JMS	TRIO		/OUTPUT ARGUMENT
	LAW	55
	JMS	PUTX		/-	(GAR-003)
	ION
LOOP	JMP	.		/WAIT FOR CHARACTER
/
KEYCHK	AND	(177
	DAC	TEMA
	SAD	(20		/^P?
	JMP	CPCHK		/YES
	LAC	PSW		/NO
	SMA			/COMMAND STRING?
	JMP	DIS		/NO, IGNORE
	LAC	TEMA		/YES
	JMP*	ASK		/RETURN WITH CHAR IN AC
KEYWT	XX
	LAC	(LOOP
	DAC	0		/SET RETURN TO WAIT LOOP
	LAC	LOW
	DAC	PUTX+1		/OUTPUT TO IT (GAR-003)
	JMS	CRLF
	LAC*	KEYWT		/MESSAGE
	JMS	TRIO
	ISZ	KEYWT
	LAC*	KEYWT
	JMS	TRIO
	JMS	CRLF
	LAC	(KEYCHK
	DAC	KEY		/WAIT FOR COMMAND
	JMP*	KEYWT
/
CPCHK	LAC	PAUSW
	SNA			/PAUSE?
	JMP	BEG		/NO,START AGAIN
/
BEGA	LAC	CP		/^P ECHO
	JMS	TRIO
BEGAA	DZM	EOTSW		/CLEAR END SWITCH
	LAC	(SKP
	DAC	PUTX+1		/RESTORE PUNCH (GAR-003)
	JMS	INIT
	CAF
	LAC	(START		/RETURN
	DAC	0		/TO START
	JMS	LT		/OUTPUT LEADER
	ISZ	ODV		/DEVICE SWITCH
	JMP	DIS		/AND DISMIS
/
START	IOF
	LAC	(BEG89T		/SET RETURN TO TRANSLATOR
	DAC	0
	JMP	NEXT
	.ENDC
	.EJECT
/TAP2 OF 5: 8TRAN
/PDP 8-15 TRANSLATOR
/
/COPYRIGHT 1968,1969, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
BEG89T	JMS	CRLF
	LAC	PAUSW
	SZA			/PAUSE?
	JMP	RPT89T		/YES, SKIP .LOC 100
	JMS	PSEU		/NO, 1ST TAPE
	LAC	ABS		/.ABS
	JMS	CRLF
	JMS	PSEU		/.LOC 100
	LAC	LOC
	JMS	TTAB
	LAC	ORIG
	JMS	TRIO
	JMS	CRLF
RPT89T	DZM	PAUSW		/CLEAR SWITCH
	DZM	RELSW		/CLEAR 'REL' SWITCH
/
/TRANSLATOR - CHECK FORMAT
/
FORM	DZM	LITSW		/NOT A LITERAL
	DZM	PARSW		/NOR A PARAMETER
	LAC	ENDMSW
	SZA			/END OF MACRO?
	JMS	ENDM		/YES, OUTPUT '.ENDM'
FORMA	JMS	FETCH		/NEXT CHAR
FORMB	JMS	SEP		/SEPARATOR
	JMP	FORM		/YES, IGNORE IT
FORMC	SAD	(15		/CR
	JMP	OUTB
	SAD	(57		/COMMENT
	JMP	TBLK
	SAD	(14		/FORM FEED
	JMP	TBLK
	SAD	(44		/DOLLAR
	JMP	FIN
	SAD	(52		/ORIGIN
	JMP	STAR
	SAD	(53		/PLUS
	JMP	SIGN
	SAD	(55		/MINUS
	JMP	SIGN
	SAD	(56		/DOT
	JMP	OUT
	JMS	NUM		/NUMBER
	JMP	SIGN
	JMS	LET		/LETTER
	JMP	PLET
	SAD	(-1		/EOT
	JMP	FINA
	SAD	(42		/QUOTE
	JMP	QUOTE
	JMP	ERROR
/
PLET	DZM	SMISW		/CLEAR SMI SWITCH
	DZM	SIGNSW		/CLEAR SIGN SWITCH
	LAC	SKPSW		/CHECK SKP SWITCH
	SNA			/SET?
	JMP	PLETA		/NO
	DZM	SKPSW		/YES, CLEAR SWITCH
	ISZ	SMISW		/SET TO CHECK SMI
PLETA	LAC	TCHAR		/RE-LOAD
	JMS	WORD		/FORM WORD, TERMINATOR IN AC
	SAD	(54		/COMMA?
	JMP	PSYM		/YES, TAG
PLETB	SAD	(75		/EQUALS?
	JMP	PARAM		/YES, PARAMETER
	LAC	TCHAR		/CHECK TERMINATOR
	JMS	SEP		/SEPARATOR
	JMP	TRANS
	SAD	(15		/CR
	JMP	TRANS
	SAD	(73		/SEMI-COLON
	JMP	TRANS
	SAD	(51		/CLOSE BRACKET
	JMP	TRANS
	SAD	(53		/PLUS
	JMP	ENDST
	SAD	(55		/MINUS
	JMP	ENDST
	SAD	(76		/END OF MACRO
	JMP	TRANS
	JMP	ERROR
/
STAR	JMS	FLAG		/ORIGIN
	JMP	.+1
	LAC	LOC		/OUTPUT '/**-LOC'
	JMS	TRIO
	JMP	OUT		/AND REST OF LINE
/
TBLK	JMS	PUTX		/OUTPUT CHAR	(GAR-003)
	JMS	FETCH		/AND REST OF LINE
	SAD	(15		/TEST FOR END
	JMP	OUTB		/OUTPUT CRLF
	JMP	TBLK		/ELSE CONTINUE
/
SIGN	ISZ	SIGNSW		/SET SIGN SWITCH
OUT	JMS	TTAB		/OUTPUT TAB
OUTA	LAC	TCHAR		/CHAR
OUTB	JMS	STATE		/REST OF STATEMENT
	JMP	FORM		/NEXT
/
PSYM	JMS	SYMST		/STORE NEW SYMBOL
	JMS	SYMPR		/AND PRINT IT
	JMP	FORM		/LOOK AT NEXT CHAR
/
PARAM	JMS	SYMST		/STORE SYMBOL
	ISZ	PARSW		/SET PARAMETER SWITCH
	ISZ	NOTAB		/SET NO-TAB SWITCH
	JMS	SYMPR
	LAC	(75		/=
	JMS	PUTX	/(GAR-003)
	JMP	FORMA		/CHECK REST
/
PARSW	0
/
ENDST	JMS	TTAB
ENDSTA	JMS	SYMPR		/ PRINT SYMBOL
	JMP	OUTB		/OUTPUT REST OF STATEMENT
/
AUTOS=17
	.DEFIN	SET
	DAC*	(AUTOS		/SET AUTO
	LAC*	AUTOS
	DAC	CNTS		/AND COUNTER
	LAC	SYLA		/FETCH SYMBOL
	SAD*	AUTOS		/TABLE COMPARE
	.ENDM
TRANS	LAC	SYLA		/LOAD SYMBOL
	SPA			/MARKER?
	JMP	TRANPS		/YES, 2 SYLLABLE SYMBOL
	AND	(77		/NO, GET 3RD CHAR
	SNA			/ZERO?
	JMP	ENDST		/YES, NOT AN INSTRUCTION
	JMS	TTAB
	DZM	NOTAB		/RESTORE TABS
	LAC	MOD		/CHECK MODIFICATIONS
	SET			/SET UP
	XCT*	AUTOS		/MATCH,SO DESPATCH
	ISZ*	(AUTOS		/SKIP JMP ADDRESS
	ISZ	CNTS		/DONE?
	JMP	.-4		/NO
	LAC	MRI		/YES, CHECK MRI
	SET			/SET UP
	JMP	YMRI		/MATCH FOUND
	ISZ	CNTS		/DONE?
	JMP	.-3		/NO
	LAC	IOT		/YES, CHECK IOT
	SET			/SET UP
	JMP	ENDSTA		/MATCH FOUND
	ISZ	CNTS		/DONE?
	JMP	.-3		/NO
	DZM	RSW		/YES: CLEAR OPR1 SWITCHES - ROTATE.
	DZM	RTSW		/ROTATE TWICE
	DZM	EV3SW		/EVENT TIME 3
	DZM	FSW		/FIRST INST.
	LAC	OPR1		/CHECK OPR1
	SET			/SET UP
	XCT*	AUTOS		/MATCH, SO DESPATCH
	ISZ*	(AUTOS		/SKIP JMP ADDRESS
	ISZ	CNTS		/DONE?
	JMP	.-4		/NO
	LAC	OPR2		/YES, CHECK OPR2
	SET
	JMP	MICRO2		/YES, DESPATCH
	ISZ	CNTS
	JMP	.-3
SYMUSR	JMS	SEARCH		/SYMBOL DEFINED?
	JMP	ENDSTA		/YES,DONE
	JMS	SYMPR		/NO,PRINT IT
	JMS	STATE		/REST OF STATEMENT
	JMS	FLAG		/AND FLAG IT WITH /** - US
	LAC	US
	JMP	FORM		/NEXT
/
TRANPS	LAC	PSEUDO		/CHECK PSEUDO
	SET			/INSTRUCTIONS
PSB	JMP	PSC		/1ST SMATCH FOUND
	ISZ*	(AUTOS		/NO, SKIP 2ND SYLLABLE
PSD	ISZ*	(AUTOS		/SKIP DESPATCH WORD
	ISZ	CNTS		/DONE?
	JMP	PSB-1		/NO
	JMP	FPA
/
PSC	LAC	SYLB		/2ND SYLLABLE
	SAD*	AUTOS		/MATCH?
	XCT*	AUTOS		/YES, DESPATCH
	LAC	SYLA		/RELOAD 1ST SYLLABLE
	JMP	PSD		/NO, CONTINUE
/
FPA	LAC	FP		/CHECK FLOATING POINT
	SET
FPC	JMP	FPB		/1ST SYLLABLE MATCH
	ISZ*	(AUTOS		/SKIP 2ND SYLLABLE
FPD	ISZ*	(AUTOS		/SKIP DESPATCH WORD
	ISZ	CNTS		/DONE?
	JMP	FPC-1		/NO, NEXT
	JMS	TTAB		/YES, NOT PS OR FP
	JMP	SYMUSR
/
FPB	LAC	SYLB
	SAD*	AUTOS		/2ND SYLLABLE
	JMP	FPF		/MATCH
	LAC	SYLA		/RELOAD 1ST SYLLABLE
	JMP	FPD		/NO MATCH,CONTINUE
FPF	XCT*	AUTOS		/EXECUTE JMP OR LAC
	DAC	TEMA		/STORE FUNCTION
	JMS	TTAB		/OUTPUT
	LAC	JMS
	JMS	TRIO		/ 'JMS
	JMS	TTAB
	LAW	106
	JMS	PUTX		/	F	(GAR-003)
	LAC	TEMA
	JMS	TRIO		/	*** (FUNCTION)
	JMS	CRLF
FPE	JMS	TTAB
	JMS	FWORD		/FETCH AND TEST FOR WORD
	SKP			/YES
	JMP	OUTA		/NO, OUTPUT REST OF LINE
	JMS	IZ		/TEST FOR I AND Z
	JMP	ENDSTA		/NOT I, OUTPUT SYMBOL AND REST
	NOP			/INDIRECT, THIS EXIT
	LAC	XCT		/AND THIS ONE. TAG ADDR. (BIT 0)
	JMS	TRIO		/I.E. ADD 400000 (XCT)
	JMS	TTAB
	JMP	ENDSTA		/OUTPUT ADDRESS AND REST
XCT	S	XCT
	S	%FNOR
FNOR	JMS	TTAB		/NON-STANDARD FP TREATMENT
	LAC	JMS
	JMS	TRIO
	JMS	TTAB
	LAC	FNOR-2
	JMS	TRIO
	LAC	FNOR-1
	JMS	TRIO		/OUTPUT 'JMS %FNOR'
	JMS	CRLF
	JMP	FPE		/AND CHECK REMAINDER
/
OCTAL	JMS	PSEU
	LAC	OCT		/.OCT
	JMP	OUTA
/
DECIMA	JMS	PSEU
	LAC	DEC		/.DEC
	JMP	OUTA
/
PAUSE	JMS	PSEU
	LAC	EOT		/.EOT
	JMS	CRLF
	ISZ	PAUSW		/SET SWITCH
	.IFUND COMPCT
	.CLOSE	RD
	.CLOSE	WR
	.WRITE	TT,2,PMSG,0
	JMP	BEGR
PMSG	3002
PUT6	0			/TEMP. STORAGE
	.ASCII	'PAUSE'<12><15>
CNTS=.-1				/TEMP. STORAGE
	.ENDC
	.IFDEF	COMPCT
	JMP	FINA
	.ENDC
PAUSW	0
/
PAGE	JMS	FLAG		/OUTPUT /** - LOC
	JMP	.+1
	LAC	LOC
PAGEA	JMS	TRIO
	JMS	TTAB
	JMS	SYMPR		/'PAGE'
	JMP	OUTA		/AND REST OF LINE
/
TEXT	JMS	PSEU		/OUTPUT .SIXBT
	LAC	SIXBT
	LAC	SIXBT+1
	JMS	TRIO
	JMS	TTAB
	JMS	FETCH
	JMP	OUTB		/AND REST OF LINE
SIXBT	S	SIXBT
	S	MPC
MPC	JMS	FLAG		/MULTIPLE PRECISION CONSTANT
	JMP	.+1
	LAC	MPC-1		/FLAG WITH 'MPC'
	ISZ	SIGNSW		/SET SIGN SWITCH
	JMP	PAGEA		/AND OUTPUT REST OF LINE
	S	DEFIN
DEFINE	JMS	PSEU		/OUTPUT '.DEFIN'
	LAC	DEFINE-2
	LAC	DEFINE-1
	JMS	TRIO
	JMS	TTAB
	JMS	FWORD		/WORD?
	JMP	DEFA		/YES
DEFB	JMS	STATE		/NO, REST OF STATEMENT
	JMS	FETCH		/NEXT
	SAD	(74		/<?
	JMP	FORM		/YES, IGNORE AND PROCEED
	JMP	.-3		/NO, LOOK AGAIN
/
DEFA	JMS	SYMPR		/OUTPUT SYMBOL
	JMS	SYMST		/AND STORE IT
	LAC	TCHAR		/LOAD TERMINATOR
	JMS	SEP		/SEPARATOR?
	SKP			/YES
	JMP	DEFB		/NO, LINE DONE
	JMS	FWORD		/WORD?
	JMP	DEFC		/YES
	JMS	TTAB		/NO, OUTPUT TAB
	LAC	TCHAR		/RE-LOAD
	JMP	DEFB		/LINE DONE
/
DEFC	LAC	(54		/COMMA
	JMS	PUTX		/OUTPUT	(GAR-003)
	JMP	DEFA		/AND SYMBOL
/
YMRI	JMS	SYMPR
	LAC	TCHAR
	SAD	(15		/CR
	JMP	OUTB
	SAD	(73		/;
	JMP	OUTB
	JMS	FWORD		/FETCH, TEST WORD
	SKP			/YES
	JMP	OUT		/NO,REST OF LINE
	JMS	IZ		/INDIRECT?
	JMP	ENDST		/NO, SYMBOL
	JMP	YMRIA		/YES, NO SYMBOL
	JMS	OUTI		/YES, OUTPUT '*'
	JMP	ENDST		/SYMBOL AND REST OF LINE
/
YMRIA	JMS	OUTI		/OUTPUT '*'
	JMP	OUT		/AND REST OF LINE
/
IZ	XX	
IZA	LAC	SYLA
	SAD	(110000		/INDIRECT
	JMP	IND		/PERHAPS
	SAD	(320000		/PAGE ZERO?
	JMP	ZED		/PERHAPS
	JMP*	IZ
/
IND	ISZ	IZ		/INDIRECT, SKIP 1ST EXIT
INDA	JMS	FWORD		/FETCH, TEST WORD
	SKP			/YES
	JMP*	IZ		/NO, EXIT TO LOC+2
	LAC	SYLA		/LOAD SYLLABLE
	SAD	(320000		/Z?
	JMP	INDA		/YES, IGNORE
	ISZ	IZ		/NO, SYMBOL, SKIP 2ND EXIT
	JMP*	IZ		/EXIT TO LOC+3
/
ZED	JMS	FWORD		/FETCH, TEST WORD
	JMP	IZA		/YES, CHECK IT
	JMP*	IZ		/NO, RETURN
/
DCA	LAC	LITSW
	SZA
	JMP	LITERR
	LAC	DAC
	JMS	TRIO		/OUTPUT 'DAC'
	DZM	INDSW		/CLEAR INDIRECT SWITCH
	JMS	FWORD		/FETCH, TEST WORD
	SKP			/YES
	JMP	DCAA		/NO, OUTPUT
	JMS	IZ		/INDIRECT?
	JMP	DCAB		/NO
	JMP	DCAE		/YES, NO SYMBOL
	ISZ	INDSW		/YES, SYMBOL
DCAB	DAC	DSAVA		/SAVE 1ST
	LAC	SYLB
	DAC	DSAVB		/AND 2ND SYLLABLES
	LAC	INDSW
	SZA			/INDIRECT?
	JMS	OUTI		/YES, OUTPUT '*'
	JMS	TTAB	
	JMS	SYMPR		/OUTPUT SYMBOL
DCAC	JMS	STATE		/OUTPUT REST OF LINE
	LAC	SMISW		/WAS PREVIOUS INST.
	SZA			/A SKIP?
	JMP	DCAG		/YES, FLAG IT
DCAM	JMS	FLAG		/FLAG 'DCA'
	LAC	CDCA
	LAC	ENDMSW
	SZA			/END OF MACRO?
	JMP	DCAF		/YES, DONE
DCAD	JMS	FWORD		/WORD?
	JMP	DCHK		/YES
	JMS	SEP		/NO, SEPARATOR?
	JMP	DCAD		/YES, IGNORE IT
	JMS	DCLA		/NO, OUTPUT 'CLA'
	LAC	TCHAR		/RELOAD CHAR
	JMP	FORMC		/AND PROCESS
/
DCAE	JMS	OUTI		/OUTPUT 1*1
DCAA	DZM	DSAVA		/NO SYMBOL
	JMS	TTAB
	LAC	TCHAR		/RE-LOAD CHAR
	JMP	DCAC		/OUTPUT REST AND FLAG
/
DCAF	JMS	DCLA		/OUTPUT 'CLA'
	JMP	FORM		/AND 'ENDM'
/
DCAG	JMS	FLAG		/OUTPUT '**-SKP'
	LAC	SKP
	JMP	DCAM		/CONTINUE
DCHK	SAD	(54		/TERMINATOR A COMMA?
	JMP	DCHKA		/YES, CHECK FINISHED
	JMS	SEP		/NO, SEPARATOR?
	SKP			/YES
	JMP	DCHKB		/NO, CHECK FINISHED
	LAC	SYLA		/LOAD 1ST SYLLABLE
	SAD	TAD		/IS IT 'TAD'?
	JMP	DCAN		/YES
	SAD	FLGR+1		/'DCA'?
	SKP			/YES
	JMP	DCHKC		/NO, CHECK FINISHED
	JMS	TTAB		/OUTPUT TAB
	LAC	DZM		/AND 'DZM'
	JMS	TRIO
	JMS	FWORD		/NEXT WORD
	SKP			/YES
	JMP	DCAP		/NOT A WORD
	JMS	IZ		/CHECK 'I' AND 'Z'
	JMP	.+3		/NOT 'I'
	DZM	SYLA		/'I', NO SYMBOL
	JMS	OUTI		/NORMAL 'I' EXIT
	JMS	TTAB		/I.E. OUTPUT '*' AND TAB
	JMS	SYMPR		/ALSO SYMBOL
	SKP
DCAP	JMS	TTAB		/OUTPUT TAB 
	LAC	TCHAR		/RE-LOAD
	JMS	STATE		/REST OF LINE
	JMP	DCAD		/LOOK AT NEXT INST/
/
DCAN	JMS	FWORD		/FETCH, TEST WORD
	SKP			/YES
	JMP	DCHKD	
	JMS	IZ		/INDIRECT
	JMP	DCAH		/NO, CLEAR LINK
	JMP	DCHKE		/YES, BUT NO SYMBOL
	SKP!CLA!CMA		/YES, SET AC=-1
DCAH	CLA
	TAD	INDSW
	SZA			/INDIRECTS MATCH?
	JMP	DCAJ		/NO, OUTPUT 'LAC'
	LAC	SYLA		/LOAD 1ST SYLLABLE
	SAD	DSAVA		/1ST SYLLABLE MATCH?
	SKP			/YES
	JMP	DCAL		/NO, OUTPUT 'LAC'
	LAC	SYLB
	SAD	DSAVB
	JMP	OUTA		/YES, INSTR. MATCHES
DCAL	JMS	OUTLAC		/NO, OUTPUT 'LAC'
	SNA			/CHECK INDIRECT
DCAK	JMS	SYMPR		/SYMBOL
	JMP	OUTB		/REST OF LINE
/
DCAJ	JMS	OUTLAC	
	SZA			/CHECK INDIRECT (INVERSE)
	JMP	DCAK		/REST OF LINE
DZM	S	DZM
OUTLAC	XX
	JMS	TTAB
	LAC	LAC
	JMS	TRIO		/LAC
	LAC	INDSW
	XCT*	OUTLAC		/'SZA' OR 'SNA' - INDIRECT?
	JMP	.+3		/NO
	LAC	(52		/YES
	JMS	PUTX		/*	(GAR-003)
	JMS	TTAB	
	ISZ	OUTLAC		/SKIP THE 'SKIPS'
	JMP*	OUTLAC
DSAVA;DSAVB;INDSW
DCHKA	JMS	DCLA		/OUTPUT 'CLA'
	JMP	PSYM		/PROCESS A SYMBOL
/
DCHKB	JMS	DCLA		/OUTPUT 'CLA'
	JMP	PLETB		/PROCESS INSTR.
/
DCHKC	JMS	DCLA		/'CLA'
	JMP	TRANS		/PROCESS INSTR
/
DCHKD	JMS	OUTLAC		/OUTPUT 'LAC'
	NOP
	JMP	OUTA		/AND REST OF LINE
/
DCHKE	JMS	OUTLAC		/OUTPUT 'LAC*'
	SKP
	JMP	OUTA		/AND REST OF LINE
/
OUTI
	LAC	(52
	JMS	PUTX		/OUTPUT '*'	(GAR-003)
	JMP*	OUTI	
/
DCLA	XX			/OUTPUT 'CLA'
	JMS	TTAB		/TAB
	LAC	CCLA	
	JMS	TRIO		/CLA
	JMS	CRLF		
	JMP*	DCLA
/
JJMS	JMS	FWORD		/FETCH, TEST FOR WORD
	JMP	JMSA		/YES
	JMS	OUTJMS		/NO, OUTPUT 'JMS'
	JMP	OUT		/AND REST OF LINE.
/
JMSA	JMS	IZ		/INDIRECT?
	JMP	JMSB		/NO
	JMP	JMSC		/YES, NOT SYMBOL
	JMS	OUTJMS		/YES, SYMBOL, OUTPUT 'JMS',
	JMS	OUTI		/*
	JMP	ENDST		/SYMBOL AND REST OF LINE
/
JMSB	JMS	OUTJMS		/OUTPUT 'JMS'
	JMP	ENDST		/SYMBOL AND REST OF LINE
/
JMSC	SAD	(67		/JMS I 7?
	JMP	INTERP		/MAYBE
	SAD	(66		/JMS I 6?
	JMP	FOUT		/MAYBE
	SAD	(65		/JMS I 5?
	JMP	FINP		/MAYBE
	JMS	OUTJMS		/NO, OUTPUT 'JMS'
	JMS	OUTI		/*
	JMP	OUT		/AND REST OF LINE
/
INTERP	JMS	JMSD		/JMS I 7
	LAC	PARSW
	SNA			/PARAMETER?
	JMP	OUTA		/NO, IGNORE JMS I 7
	LAC	NOP		/YES, REPLACE WITH 'NOP'
	JMS	TRIO
	JMP	OUTA		/REST OF LINE
/
FOUT	JMS	JMSE		/OUTPUT JMS FLOP OR JMS I 6+
	S	FLO
	JMS	CRLF
	JMS	TTAB
	LAW	66		/AND '6' ON NEXT LINE
	JMS	PUTX	/(GAR-003)
	JMP	OUTA		/REST OF LINE
/
FINP	JMS	JMSE		/OUTPUT JMS FLIP OR JMS I 5+
	S	FLI
	JMS	CRLF
	JMS	TTAB
	LAW	60		/AND '0' ON NEXT LINE
	JMS	PUTX	/(GAR-003)
	JMP	OUTA		/REST OF LNE
/
JMSD
	DAC	TEMA		/SAVE 5,6 OR 7
	JMS	FETCH		/NEXT CHAR
	JMS	NUM		/NUMBER ?
	SKP			/YES
	JMP*	JMSD		/NO, RETURN
	JMS	OUTJMS		/OUTPUT 'JMS'
	JMS	OUTI		/*
	JMS	TTAB
	LAC	TEMA		/NUMBER
	JMS	PUTX	/(GAR-003)
	JMP	OUTA		/AND REST OF LINE
/
JMSE
	JMS	JMSD		/CHECK FOR MORE NUMBERS
	JMS	OUTJMS		/NO, OUTPUT 'JMS'
	JMS	TTAB
	LAC*	JMSE		/OUTPUT 'FLI' OR 'FLO'
	JMS	TRIO
	ISZ	JMSE
	LAW	120		/'P'
	JMS	PUTX	/(GAR-003)
	LAC	PARSW
	SZA			/PARAMETER?
	JMP	OUTA		/YES, DONE
	JMP*	JMSE		/NO, RETURN
/
OUTJMS
	LAC	JMS
	JMS	TRIO		/OUTPUT 'JMS'
	JMP*	OUTJMS
/
	S	PSA
PLS	LAC	.-1		/'PLS' TO 'PSA'
	JMP	TDONE
	S	RSA
RFC	LAC	.-1		/'RFC' TO 'RSA'
TDONE	JMS	TRIO
	JMP	OUTB
/TAP3 OF 5: 8TRAN
/PDP 8-15 TRANSLATOR
/
/COPYRIGHT 1968,1969, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS
/
	/OPERATE GROUP 1
/
MICRO1	LAC	FSW		/FIRST INSTRUCTION
	SNA			/CHECK
	JMP	MICRG		/YES
MICRF	LAC	(41		/NO, OUTPUT IOR (!)
	JMS	PUTX	/(GAR-003)
MICRG	JMS	SYMPR		/OUTPUT INSTR.
	IDX	FSW		/SET, AFTER ANY INSTRUCTION
MICRH	LAC	TCHAR		/LOAD TERMINATOR
	JMS	SEP		/SEPARATOR?
	SKP			/YES, CHECK NEXT
	JMP	MTST		/NO, FINISHED
	JMS	FWORD		/ANOTHER MICRO?
	SKP			/YES
	JMP	MTST		/NO, FINISHED
MICRB	LAC	OPR1		/CHECK
	SET			/INSTRUCTIONS
	XCT*	AUTOS		/MATCH, SO DESPATCH
	IDX*	(AUTOS		/SKIP OVER 'JMP'
	ISZ	CNTS		/DONE?
	JMP	.-4		/NO
	JMP	MICRX		/YES, MAY BE GROUP 2
/
CLA	LAC	FSW		/1ST INST
	SZA
	JMP	MICRF		/NO, OUTPUT IT
	IDX	FSW		/YES, SET SWITCH
	LAC	TCHAR		/NEXT
	JMS	SEP		/SEPARATOR?
	JMP	.+3		/YES
CLAB	JMS	SYMPR		/NO, OUTPUT 'CLA'
	JMP	MTST		/DONE
/
CLAC	JMS	FWORD		/TEST FOR WORD
	SKP			/YES
	JMP	CLAB		/NO
	LAC	SYLA		/LOAD SYLLABLE
	SAD	CIAC		/IAC?
	JMP	LAC1		/YES,'CLA IAC'=CLA!IAC
	SAD	COSR		/OSR?
	JMP	CLAA		/YES,'CLA OSR'=LAS
	LAC	CCLA
	JMS	TRIO		/NEITHER, OUTPUT 'CLA'
	JMP	MICRB
CLAA	LAC	CLAS		/OUTPUT 'LAS'
	JMP	MICROY
/
CIA	LAC	LITSW		/'CIA' FOUND
	SZA			/IN LITERAL?
	JMP	LITERR		/YES, ERROR
	LAC FSW			/IF NOT FIRST INSTRUCTION,
	SNA			/OUTPUT '!'.
	JMP .+3
	LAC (41
	JMS	PUTX	/(GAR-003)
	LAC CMA			/REPLACE 'CIA' 
	JMS TRIO
	IDX FSW
	LAC CIAC
	DAC	SYLA		/WITH CMA!IAC
	JMP	MICRO1		/AND OUTPUT
/
EV3	IDX	EV3SW		/SET EVENT TIME 3 SWITCH
	JMP	MICRO1		/AND OUTPUT INST.
/
R1	IDX	RSW		/SET ROTATE SWITCH
	SKP
R2	IDX	RTSW		/SET DOUBLE ROTATE SWITCH
	LAC	SYLA		/STORE INST.
	DAC	TEMA		/FOR LATER OUTPUT
	JMP	MICRH		/CHECK NEXT
	S	CLC
JSTA	LAC	.-1
	DAC	SYLA		/REPLACE 'STA' WITH 'CLC'
	JMP	EV3		/AND SET EVENT TIME 3
ONE	S	(1
RSW;RTSW;EV3SW;FSW;SKPSW;SMISW
LAC1	LAC	TCHAR		/CLA!IAC
	JMS	SEP		/SEPARATOR?
	SKP			/YES
	JMP	LAC2		/NO, DONE
	JMS	FETCH		/FETCH NEXT
	JMS	TWORD		/TEST FOR WORD
	JMP	LAC3		/YES
	JMS	LACONE		/NO, OUTPUT CLA!IAC
	JMS	IACS
	JMP	OUT		/AND REST OF LINE (INCLUDE TAB).
/
LAC2	JMS	LACONE		/OUTPUT CLA!IAC
	JMS	IACS		/AND REST OF LINE.
	JMP	OUTA
/
LAC3	JMS	LACONE		/OUTPUT 'CLA'.
	JMS IACS
	IDX	FSW		/SET FIRST SWITCH.
	JMP	MICRB	
/
LACONE	XX			/OUTPUT CLA!
	LAC	CCLA
	JMS	TRIO
	LAC	(41
	JMS	PUTX	/(GAR-003)
	JMP*	LACONE
/
IACS	XX			/OUTPUT IAC
	LAC	CIAC
	JMS	TRIO
	JMP*	IACS
/TEST FOR OUTPUT OF FLAGS AND GENERATED CODE
/
MTST	DAC	TEMB		/SAVE AC FOR LATER OUTPUT
	LAC	RTSW
	SNA			/ROTATE TWICE SET?
	JMP	MTSTA		/NO
MTSTD	JMS	FLGSMI		/YES,OUTPUT '/**-SMI' OR 'SKP'
MTSTE	LAC	TEMA		/LOAD INST.
	JMS	TRIO		/AND OUTPUT
	LAC	TEMB		/OUTPUT
	JMS	STATE		/REST OF LINE
MTSTC	JMS	FLAG		/OUTPUT '/**-ROT'
	LAC	ROT
	JMP	FORM
/
MTSTA	LAC	RSW		/
	SNA			/ROTATE SET?
	JMP	MTSTF		/NO
	LAC	EV3SW		/YES
	SZA			/EVENT TIME 3 USED?
	JMP	MTSTD		/YES, OUTPUT '/**-SMI' OR 'SKP'
	LAC	FSW		/NO
	SNA			/OTHER INST.?
	JMP	MTSTE		/NO, OUTPUT INST.
	LAC	(41		/YES
	JMS	PUTX		/OUTPUT '!'	(GAR-003)
	JMP	MTSTE		/THEN INST.
/
MTSTF	LAC	TEMB
	JMS	STATE		/REST OF LINE
	JMP	FORM		/DONE
/
FLGSMI	XX
	LAC	FSW		/CHECK FIRST INST. SWITCH
	SNA			/ONLY INST.?
	JMP*	FLGSMI		/YES, NO FLAGS
	JMS	CRLF		/NO-OUTPUT CR-LF		
	LAC	LITSW		/
	SZA			/LITERAL?
	JMP	FLGC		/YES, ILLEGAL
	LAC	SMISW		/NO
	SNA			/SEGMENTED?
	JMP	FLGA		/NO, 'SMI' FLAG
	JMS	FLAG		/YES, ILLEGAL SEGMENTING
	LAC	SKP		/OUTPUT '/**-SKP'
FLGB	JMS	TTAB
	JMP*	FLGSMI
/
FLGA	JMS	FLAG		/OUTPUT '/**-SMI'
	LAC	SMI
	JMP	FLGB
/
FLGC	JMS	FLAG		/FLAG LITERAL
	LAC	LIT
	JMP	FORM		/IGNORE INST.
/
MICRO2	SAD	COSR		/OSR?
	LAC	OAS		/YES, LOAD OAS
MICROY	JMS	TRIO		/PRINT SYMBOL
	LAC	SYLA
	TAD	(-230000		/TEST FOR ANY SKIP
	SMA	
	ISZ	SKPSW		/YES, SET SWITCH
	LAC	TCHAR	
	JMS	SEP		/TERMINATOR?
	SKP			/SEPARATOR
	JMP	OUTB		/STATEMENT DONE
	JMS	FWORD		/2ND MICRO?
	SKP			/YES
	JMP	OUT		/NO, TAB AND STATEMENT DONE
MICRX	LAC	OPR2		/GROUP 2?
	SET
	JMP	MICROZ		/YES
	ISZ	CNTS
	JMP	.-3
	JMP	ERROR		/NO
/
MICROZ	LAC	(41		/OUTPUT! (IOR)
	JMS	PUTX	/(GAR-003)
	LAC	SYLA		/RELOAD
	JMP	MICRO2
OAS	S	OAS
STATE	XX			/OUTPUT REST OF STATEMENT
	DZM	NOTAB
STATF	SAD	(15		/CR
	JMP	STATA
	SAD	(73		/;
	JMP	STATB
	SAD	(57		/SLASH
	JMP	STATC	
	SAD	(11		/TAB?
	JMP	STATG
	SAD	(76		/>
	.IFUND	COMPCT
	JMP	STATX		/END OF MACRO - TRANSLATE IT
	.ENDC
	.IFDEF	COMPCT
	JMP	ERROR		/NOT VALID
	.ENDC
	SAD	(53		/+
	JMP	RELA
	SAD	(55		/-
	JMP	RELA	
	SAD	(133		/REPLACE [
	LAC	(50		/WITH (
	SAD	(135		/AND ]
	LAC	(51		/WITH )
	SAD	(50		/LITERAL?
	JMP	LITCHK		/TRANSLATE IT
STATD	JMS	PUTX		/OUTPUT	(GAR-003)
STATH	JMS	FETCH		/NEXT
	JMP	STATF		/CHECK AGAIN
STATA	JMS	CRLF		/LINE END
	LAC	SIGNSW		/SIGN SWITCH
	SNA			/SET?
	JMP	STATJ		/NO
	DZM	RELSW		/YES, CLEAR REL FLAG
	JMP*	STATE		/AND RETURN
STATJ	LAC	RELSW		/CHECK REL SWITCH
	SNA			/SET?
	JMP*	STATE		/NO, RETURN
	DZM	RELSW		/YES, CLEAR SWITCH
	JMS	FLAG		/OUTPUT '/**-REL'
	LAC	REL
	JMP*	STATE		/TERMINATE
STATB	JMS	PUTX		/;	(GAR-003)
	JMP*	STATE		/TERMINATE
/
STATG	JMS	TTAB		/TAB
	JMP	STATH		/AND NEXT
STATX	ISZ	ENDMSW		/SET ENDM SWITCH
	JMP	STATH		/REST OF LINE
ENDMSW;SIGNSW
STATC	LAW	-4
	TAD	TABCNT
	SMA			/4 TABS?
	JMP	STATZ		/YES
	DAC	TABCNT		/NO, ALIGN COMMENTS
	JMS	TTAB
	JMP	.-1
STATZ	DZM	TABCNT
	LAW	57
STATY	JMS	PUTX		/COMMENT	(GAR-003)
	JMS	FETCH		/NEXT
	SAD	(15		/TEST CR ONLY
	JMP	STATA		/TERMINATE
	JMP	STATY		/MORE COMMENT
/
RELA	JMS	PUTX		/SIGN FOUND, OUTPUT IT  (GAR-003)
	JMS	FETCH		/NEXT CHAR
	JMS	NUM		/NUMBER?
	ISZ	RELSW		/YES, SET RELATIVE SWITCH
	JMP	STATD		/NO, OUTPUT AND NEXT
RELSW	0
	S	ENDM
ENDM	XX
	JMS	PSEU		/OUTPUT '.ENDM'
	LAC	ENDM-2
	LAC	ENDM-1
	JMS	TRIO
	JMS	CRLF
	DZM	ENDMSW		/CLEAR SWITCH
	JMP*	ENDM		/AND RETURN
/
LITCHK	JMS	PUTX		/OUTPUT '('   (GAR-003)
	LAC	LITSW
	SZA			/SET?
	JMP	LITLIT		/YES, NESTED LITERAL
	ISZ	LITSW		/NO, SET SWITCH
	ISZ	SIGNSW		/AND SIGN SWITCH
	ISZ	NOTAB		/SUPPRESS TABS
	JMP	FORMA		/PROCESS LITERAL
/
LITLIT	JMS	FETCH		/GET NEXT
	JMP	LITERA		/AND OUTPUT
/
LITERR	JMS	SYMPR		/OUTPUT 'DCA' OR 'CLA'
LITERA	JMS	STATE		/REST OF LINE
	JMS	FLAG	
	LAC	LIT		/FLAG - LITERAL NOT TRANSLATED
	JMP	FORM
LITSW	0
LIT	S	LIT
/
QUOTE	LAC	LITSW
	SNA			/SET?
	JMP	ERROR		/NO, ILLEGAL CHARACTER
	JMS	FETCH		/YES, FETCH CHAR
	JMS	OCT3		/OUTPUT OCTAL VALUE
	JMS	FETCH		/NEXT CHAR
	JMP	OUTB		/TEST REST OF STATEMENT
	.EJECT
/TAP4 OF 5: 8TRAN
/PDP 8-15 TRANSLATOR
/
/COPYRIGHT 1968, 1969 DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
FLAG	XX			/FLAG INSTRUCTION
	LAC*	FLAG		/FETCH NEXT INSTRUCTION
	AND	(OPR		/LOOK AT INSTRUCTION BITS
	XOR	(LAC
	SZA			/IS IT 'LAC'?
	JMP	FLAGA		/NO, OUTPUT FLAG
	XCT*	FLAG		/YES, CHECK BIT 0 OF FLAG
	SPA			/OUTPUT?
	JMP	NOFLAG		/NO
FLAGA	LAC	FLG		/OUTPUT
	JMS	TRIO		/**-
	LAC	FLG+1	
	JMS	TRIO
	XCT*	FLAG		/'LAC' OR 'JMP'
	JMS	TRIO		/OUTPUT FLAG
	JMS	CRLF
NOFLAG	ISZ	FLAG		/SKIP 'LAC'
	JMP*	FLAG		/AND RETURN
/
FLG	.SIXBT	'/** -
IC	.SIXBT	'IC '
/
ERROR	JMS	CRLF		/CHAR NOT VALID
	JMS	FLAG
	JMP	.+1
	LAC	IC		/ILLEGAL CHARACTER
	JMS	TRIO
	LAC	TCHAR
	JMS	OCT3		/OUTPUT OCTAL VALUE
	JMS	CRLF
	JMP	FORM
/
OCT3	XX
	RTR
	JMS	R4R		/1ST OCTAL DIGIT
	JMS	DIGIT		/TYPE IT
	RTR;	RAR		/2ND
	JMS	DIGIT
	JMS	DIGIT		/AND 3RD
	JMP*	OCT3
/
DIGIT	XX
	AND	(7
	TAD	(60		/INTO ASCII
	JMS	PUTX		/AND OUTPUT (GAR-003)
	LAC	TCHAR		/RELOAD CHAR
	JMP*	DIGIT
	.IFUND	COMPCT
FLGSET	DZM	FLSW		/ENABLE GO
	JMS	FLAGI		/INITIALISE FLAGS
	.WRITE	TT,2,FMSG,0	/>FLAGS
	.READ	KEY,2,BUFF,SIZE	/FLAG MNEMONICS
	.WAIT	KEY
	LAC	(BUFF+2
	JMS	.GETI		/SET-UP INPUT
FLGSA	JMS	.GETX		/1ST CHAR  (GAR-003)
	JMS	TWORD		/WORD?
	JMP	FLGCHK		/YES
	JMS	TGO		/NO TERMINATOR?
FLGQ	.WRITE	TT,2,QUERY,0	/QUERY
	JMP	FLGSET		/TRY AGAIN
/
FLGCHK	LAC	FLGTAB
	SET			/SET UP TABLE SEARCH
	JMP	FMATCH		/MATCH
	ISZ	CNTS		/DONE?
	JMP	.-3		/NO, NEXT
	JMP	FLGQ		/YES, NO MATCH
/
FMATCH	LAC*	(AUTOS
	DAC	FADDR		/SAVE ADDRESS
	LAC	SYLA
	TAD	(400000		/TAG THE FLAG
	DAC*	FADDR		/AND STORE IT
	LAC	TCHAR		/RE-LOAD TERMINATOR
	JMS	TGO		/GO?
	JMP	FLGSA		/NO, NEXT FLAG
FADDR	0
FMSG	3002
PUTC	0			/TEMP. STORAGE
	.ASCII	'>FLAGS-'<175>
FLAGI	XX			/FLAG INITIALIZATION
	.ENDC
	.IFDEF	COMPCT
FLAGY	ISZ	FLSW		/SET FLAG SWITCH
	SKP
FLAGN	DZM	FLSW		/DEAR FLAG SWITCH
	.ENDC
AUTOF=15
AUTOG=16
	LAC	FLGR
	DAC*	(AUTOF		/SET-UP RESET - FLAGS
	LAC	FLGTAB
	DAC*	(AUTOG		/AND FLAG TABLE
	LAC*	AUTOG
	DAC	FCNT
FLAGJ	LAC*	AUTOF
	.IFDEF	COMPCT
	DAC	FLGTEM		/STORE IT
	LAC	FLSW		/FLAG SWITCH
	SNA			/SET?
	JMP	FLAGZ		/NO, STORE UNCHANGED
FLAGK	JMS	ASK		/YES, OUTPUT
FLGTEM	0			/SUCCESSIVE FLAG NAMES.
	SAD	(131		/Y?
	JMP	FLAGL		/YES
	SAD	(116		/N?
	SKP			/YES
	JMP	FLAGK		/NEITHER, TRY AGAIN
	CLA!SKP			/STORE FLAG UNCHANGED
FLAGL	LAC	(400000		/ADD BIT 0
FLAGZ	TAD	FLGTEM
	.ENDC
	DAC*	AUTOG		/RESET THEM
	ISZ	FCNT		/DONE?
	JMP	FLAGJ		/NO, NEXT
	.IFDEF	COMPCT
	JMS	CRLF		/FLAG SETTING DONE
	JMP	BEGAA		/BEGIN TRANSLATION
/
FLSW	0
	.ENDC
	.IFUND	COMPCT
	JMP*	FLAGI
	.ENDC
/
FLGR	.DSA	FLGR		/UNMODIFIED FLAGS
	S	DCA
	S	REL
	S	ROT
	S	SMI
	S	US
FLGTAB	.DSA	FLGTAB;	-5	/MODIFIED FLAGS (BIT 0 ADDED FOR SUPPRESSION)
CDCA	0
REL	0
ROT	0
SMI	0
US	0
FCNT	0
/
FIN	JMS	PSEU
	LAC	END
FINA	JMS	CRLF
	.IFDEF	COMPCT
	CLA!CMA
	JMS	PUTX		/-1 INTO OUTPUT BUFFER (GAR-003)
	JMP	FORM		/MORE (DUMMY) INPUT
	.ENDC
	.IFUND	COMPCT
	.CLOSE	RD
	.CLOSE	WR
	JMP	BEG
	.ENDC
TTAB	XX			/OUTPUT TAB
	LAC	NOTAB
	SZA			/SET?
	JMP*	TTAB		/YES, NO TAB
	.IFDEF	COMPCT
	LAC	TTSW		/TELETYPE SWITCH
	SNA			/SET FOR OUTPUT
	JMP	TTABA		/NO, OUTPUT TAB
	LAW	-12		/YES, REPLACE TAB WITH SPACES
	TAD	CHRCNT		/CHAR COUNT -10
	SMA			/SPACES REQUIRED?
	JMP	TTABB		/YES,NEXT TAB POSITION
TTABD	DAC	SPCNT		/SET UP SPACE COUNT
	LAW	40
	JMS	PUTX	/(GAR-003)
	ISZ	SPCNT		/SPACES DONE?
	JMP	.-3
	DZM	CHRCNT
	JMP	TTABC
TTABB	ISZ	TABCNT		/COUNT 1 TAB
	TAD	(-12		/SET COUNT FOR NEXT TAB
	JMP	TTABD		/AND OUTPUT SPACES
CHRCNT;SPCNT
	.ENDC
TTABA	LAC	(11
	JMS	PUTX	/(GAR-003)
TTABC	ISZ	TABCNT		/COUNT TABS FOR COMMENT FIELD
	JMP*	TTAB
	ISZ	TTAB		/DONE
	JMP*	TTAB		/RETURN TO OUTPUT COMMENT
/
NOTAB;TABCNT
CRLF	XX
	DZM	TABCNT		/CLEAR TAB COUNT (FOR COMMENT FIELD ALIGNMENT)
	LAC	(15		/CR
	JMS	PUTX	/(GAR-003)
	.IFDEF	COMPCT
	LAC	(12		/LF IN 9/L VERSION
	JMS	PUTX	/(GAR-003)
	DZM	CHRCNT		/CLEAR CHAR COUNT FOR TAB SIMULATOR
	.ENDC
	JMP*	CRLF
/
PSEU	XX
	JMS	TTAB
	LAC	(56
	JMS	PUTX		/DOT   (GAR-003)
	XCT*	PSEU		/'LAC OR JMP'
	ISZ	PSEU		/SKIP 'LAC'
	JMS	TRIO		/PSEUDO
	JMP*	PSEU
/
/NUMBER AND LETTER CHECKS - 7 BIT CHAR IN AC
/RETURN (CHAR IN AC) TO LOC+1 IF YES, LOC+2 IF NO.
/
NUM	XX
	TAD	(-60
	SPA			/NUMBER (LOWER CHECK)?
	JMP	NUMA		/NO
	TAD	(-12		/MAYBE
	SMA			/UPPER CHECK
NUMA	ISZ	NUM		/NO - GO TO LOC+2
	LAC	TCHAR		/RELOAD
	JMP*	NUM		/AND RETURN
/
LET	XX
	TAD	(-101		/LOWER
	SPA
	JMP	LETA
	TAD	(-32		/UPPER
	SMA
LETA	ISZ	LET		/LOC+2
	LAC	TCHAR
	JMP*	LET
/CHECK FOR ALPHANUMERIC CHARACTER
/RETURN TO LOC+1 IF YES, LOC+2 IF NO
/
ALPHNM	XX
	LAC	TCHAR		/CHARACTER IN PROCESS
	JMS	NUM		/NUMBER?
	SKP			/YES
	JMS	LET		/NO, LETTER?
	SKP			/YES, GO TO LOC+1
	ISZ	ALPHNM		/NEITHER, RETURN TO LOC+2
	JMP*	ALPHNM
/
SEP	XX
	SAD	(11		/TAB
	SKP
	SAD	(40		/SPACE
	SKP
	ISZ	SEP		/NEITHER, SKIP 1ST EXIT
	JMP*	SEP
/FETCH CHAR AND TEST FOR WORD
/RETURN AS FOR TWORD (BELOW)
/
FWORD
	JMS	FETCH		/NEXT CHAR
	JMS	TWORD		/TEST FOR WORD
	SKP			/YES, RETURN TO LOC+1
	ISZ	FWORD		/NO, RETURN TO LOC+2
	JMP*	FWORD
/TEST FOR WORD - CHAR IN AC
/RETURN TO LOC+1 IF WORD (IN SYLA & SYLB), WITH TERMINATOR IN AC
/RETURN TO LOC+2 IF NOT, WITH ENTRY CHAR IN AC
/
TWORD
	JMS	LET		/LETTER?
	JMP	.+3		/YES
	ISZ	TWORD		/NO, SKIP 1ST EXIT
	JMP*	TWORD			/AND RETURN TO LOC+2
	JMS	WORD		/FORM WORD
	JMP*	TWORD		/AND RETURN TO LOC+1
/PACK 3 6-BIT CHARS IN TEM1,TEM2, AND TEM3
/
PACK	XX
	LAC	TEM1		/1ST CHAR
	CLL
	RTL
	JMS	R4L		/BITS 0-5
	DAC	TEM1		/STORE TEM
	LAC	TEM2		/2ND CHAR
	TAD	TEM1
	RTL
	JMS	R4L		/BITS 6-11
	DAC	TEM1
	LAC	TEM3		/3RD CHAR - BITS 12-17
	TAD	TEM1
	JMP*	PACK		/PACKED CHARS IN AC
/OUTPUT CHARS PACKED BY 'PACK'
/
TRIO	XX
	DAC	TEM3		/STORE TEM
	LAW	-3
	DAC	CNTS		/3 CHARS
TRIOA	LAC	TEM3
	SMA!CLL			/6-BITS<40?
	CML			/YES, ADD 100
	RTL
	JMS R4L
	DAC	TEM3		/STORE FOR NEXT TIME
	RAL
	AND	(177
	SAD	(100		/FILLER?
	JMP	.+4		/YES,EXIT
	JMS	PUTX		/NO, OUTPUT   (GAR-003)
	ISZ	CNTS		/ALL DONE?
	JMP	TRIOA		/NO
	LAC	TCHAR		/LOAD TERMINATOR
	JMP*	TRIO		/YES, EXIT
/
SYMPR	XX			/PRINT SYMBOL
	LAC	SYLA		/LOAD 1ST SYLLABLE
	SNA			/EMPTY?
	JMP*	SYMPR		/YES, RETURN
	SMA			/2 SYLLABLES?
	JMP	.+4		/NO
	TAD	(400000		/YES, DROP MARKER
	JMS	TRIO		/OUTPUT
	LAC	SYLB		/2ND SYLLABLE
	JMS	TRIO		/OUTPUT
	JMP*	SYMPR		/RETURN
/FORM A 3 CHAR SYLLABLE
/
SYLL	XX
	AND	(77
	DAC	TEM1		/STORE 1ST
	JMS	FETCH	
	JMS	ALPHNM		/ALPHANUMERIC?
	SKP
	JMP	SYLLA		/NO, TERMINATOR IN TCHAR
	AND	(77
	DAC	TEM2		/YES, SECOND
	JMS	FETCH
	JMS	ALPHNM
	SKP	
	JMP	SYLLB		/NO, TERMINATOR INTCHAR
	AND	(77
	DAC	TEM3		/YES, THIRD
	JMS	FETCH		/NEXT CHAR IN TCHAR
	JMP	.+3
SYLLA	DZM	TEM2		/CLEAR SECOND WORD
SYLLB	DZM	TEM3		/CLEAR THIRD WORD
	JMS	PACK		/PACK THEM
	DAC	SYLB		/AND STORE
	JMP*	SYLL
SYLA;SYLB
/FORM A WORD (LETTER IN AC) AND RETURN
/WITH TERMINATOR IN AC
/
WORD	XX
	JMS	SYLL		/FORM SYLLABLE
	LAC	TCHAR		/NEXT CHAR
	JMS	ALPHNM		/ALPHANUMERIC?
	JMP	SYLTWO		/YES 2 SYLLABLE WORD
	LAC	SYLB		/NO
	DAC	SYLA		/STORE 1ST SYLLABLE
	LAC	TCHAR		/FETCH TERMINATOR
	JMP*	WORD		/RETURN
/
SYLTWO	LAC	SYLB		/FETCH 1ST SYLLABLE
	TAD	(400000		/ADD BIT 0 AS MARKER
	DAC	SYLA		/AND STORE
	LAC	TCHAR		/RELOAD ALPHANUMERIC
	JMS	SYLL		/AND FORM 2ND SYLLABLE
	LAC	TCHAR		/LOAD TERMINATOR
	JMS	ALPHNM		/ALPHANUMERIC?
	SKP			/YES, IGNORE IT
	JMP*	WORD		/NO, RETURN
	JMS	FETCH		/FETCH NEXT
	JMP	.-4		/AND TEST
/
R4R	0			/ROTATE 4 RIGHT.
	RTR;	RTR
	JMP*	R4R
/
R4L	0			/ROTATE 4 LEFT.
	RTL;	RTL
	JMP*	R4L
/SYMBOL MANIPULATION
/
AUTO=10
SYMNUM;SYMCNT;SYMSW
	.IFDEF	COMPCT
SYMBLK=1000
/
SYMSET	XX			/SET UP SYMBOL TABLE
	LAW	-SYMBLK		/BLOCK
	DAC	SYMCNT		/TO COUNTER
	LAC	SYMTAB		/TABLE START
	DAC*	(AUTO		/TO AUTO-INDEX
	.ENDC
	.IFUND	COMPCT
SYMTAB	0
/
SYMSET	0
	CLA!CMA
	TAD*	(102		/BOTTOM-1
	DAC*	(AUTO		/TO AUTO-INDEX
	DAC	SYMTAB		/AND TO SYMTAB
	LAC*	(103		/TOP
	CLL!CML!CMA		/-TOP
	TAD*	(102		/+BOTTOM
	RAR			/HALVED
	DAC	SYMCNT		/-NO. OF SYMBOLS
	.ENDC
	ISZ	SYMSW		/ENABLE SYMBOL STORE
	DZM	SYMNUM		/ZERO SYMBOL COUNT
	JMP*	SYMSET		/RETURN
/
SYMST	XX			/STORE SYMBOL IN TABLE
	LAC	SYMSW
	SNA
	JMP*	SYMST
	LAC	SYLA		/LOAD 1ST SYLLABLE
	DAC*	AUTO		/AND STORE
	LAC	SYLB		/2ND SYLLABLE
	DAC*	AUTO		/IN TABLE
	ISZ	SYMNUM		/ADD TO SYMBOL COUNT
	ISZ	SYMCNT		/TABLE FULL?
	JMP*	SYMST		/NO, RETURN
	JMS	CRLF		/YES
	JMS	FLAG		/FLAG IT
	LAC	SE		/SYMBOL TABLE EXCEEDED
	DZM	SYMSW		/IGNORE FURTHER SYMBOLS
	JMP*	SYMST
/
SE	S	SE
SEARCH	XX
	LAC	SYMTAB		/TABLE START
	DAC*	(AUTOS
	LAC	SYMNUM		/ NUMBER OF SYMBOLS
	CMA
	DAC	CNTS		/TO COUNTER
	LAC	SYLA		/LOAD 1ST SYLLABLE
SRTN	ISZ	CNTS		/DONE
	JMP	.+3
	ISZ	SEARCH		/YES, NOT FOUND
	JMP*	SEARCH		/SKIP 1ST EXIT
	SAD*	AUTOS		/CF 1ST SYLLABLE
	JMP	.+3		/MATCH FOUND
	ISZ*	(AUTOS		/NO MATCH, SKIP 2ND
	JMP	SRTN		/SYLLABLE, TRY AGAIN
	SMA			/TWO SYLLABLES?
	JMP*	SEARCH		/NO, SYMBOL FOUND
	LAC	SYLB		/YES, LOAD 2ND
	SAD*	AUTOS		/AND COMPARE
	JMP*	SEARCH		/FOUND, SO RETURN
	LAC	SYLA		/NO, RELOAD 1ST
	JMP	SRTN		/AND TRY AGAIN
/
	.IFUND	COMPCT
ST	LAC	(STA+1
	DAC	FETCH		/SET UP INPUT
	JMP	INA		/AND START
/
STB	.CLOSE	RD
	.WRITE	TT,2,STR,0
	DZM	SSW		/SYMBOL TABLE READ
	JMP	BEGR
/
STR	5002
	0
	.ASCII	'SYMBOL TABLE READ'<12><15>
	.ENDC
STA	JMS	FETCH
	SAD	(-1		/-1?
	JMP	STB		/END
	JMS	LET		/LETTER
	SKP			/YES
	JMP	STA		/NO, IGNORE
	JMS	WORD		/FORM WORD
	JMS	SYMST		/AND STORE IT
	JMP	STA		/NEXT
/
	.IFDEF	COMPCT
ST	JMS	INIT		/SET UP BUFFERS
	LAC	(STA		/RETURN TO STA
	DAC	0		/AFTER START
	JMP	NEXT		/START INPUT
/
STB	JMS	KEYWT		/TYPE 'SYMTAB'
	S	SYMTAB
	JMP	QD		/ASK ABOUT FLAGS
	.ENDC
	.EJECT
/TAP5 OF 5: 8TRAN.
/PDP 8-15 TRANSLATOR
/
/COPYRIGHT 1968, 1969 DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/TABLES (2 TYPES)
/TYPE 1 - COMMON DESPATCH
/TYPE 2 - SEPARATE DESPATCH FOR EACH ENTRY
/
/MODIFIED INSTRUCTIONS - TYPE 2
/
MOD	.DSA	MOD;	-4
	S	DCA
	JMP	DCA
JMS	S	JMS
	JMP	JJMS
	S	PLS
	JMP	PLS
	S	RFC
	JMP	RFC
/
/MEMORY REFERENCE - TYPE 1 - DESPATCH TO YMRI
/
MRI	.DSA	MRI;	-4
	S	AND
TAD	S	TAD
	S	ISZ
	S	JMP
	.EJECT
/
/INPUT-OUTPUT - TYPE 1 - DESPATCH TO ENDSTA
/
IOT	.DSA	IOT;	-14
	S	IOF
	S	ION
	S	IOT
	S	KRB
	S	KSF
	S	TLS
	S	TSF
	S	TCF
	S	RRB
	S	RSF
	S	PSF
	S	PCF
	.EJECT
/OPERATE-GROUP 1 - TYPE 2
/
OPR1	.DSA	OPR1;	-17
CCIA	S	CIA
	JMP	CIA
CCLA	S	CLA
	JMP	CLA
	S	CLL
	JMP	MICRO1
CMA	S	CMA
	JMP	EV3
	S	CML
	JMP	EV3
	S	GLK
	JMP	EV3
CIAC	S	IAC
	JMP	MICRO1
NOP	S	NOP
	JMP	MICRO1
	S	OPR
	JMP	MICRO1
	S	RAL
	JMP	R1
	S	RAR
	JMP	R1
CRTL	S	RTL
	JMP	R2
CRTR	S	RTR
	JMP	R2
	S	STA
	JMP	JSTA
	S	STL
	JMP	EV3
	.EJECT
/
/OPERATE-GROUP 2 - TYPE 1 - DESPATCH TO MICRO2
/
OPR2	.DSA	OPR2;	-13
	S	CLA
	S	HLT
CLAS	S	LAS
COSR	S	OSR
SKP	S	SKP
	S	SMA
	S	SNA
	S	SNL
	S	SPA
	S	SZA
	S	SZL
	.EJECT
/PSEUDO-OPERATIONS - TYPE 2
/
PSEUDO	.DSA	PSEUDO;	-14
	S	/CTAL		/OCTAL
	JMP	OCTAL
	.SIXBT	'$ECIMA'		/DECIMAL
	JMP	DECIMA
	S	0AUSE		/PAUSE
	JMP	PAUSE
	S	0AGE		/PAGE
	JMP	PAGE
	S	&IELD		/FIELD
	JMP	PAGE		/OUTPUT '/** - LOC' ETC.
	.SIXBT	'$UBL
	JMP	MPC		/OUTPUT '/** - MPC' ETC.
	S	&LTG
	JMP	MPC		/OUTPUT '/** - MPC' ETC.
	.SIXBT	'$EFINE'		/DEFINE
	.IFUND	COMPCT
	JMP	DEFINE		/RECOGNISED IF BASIC OR ADVANCED SYSTEM.
	.ENDC
	.IFDEF	COMPCT
	JMP	SYMUSR		/IGNORED IF COMPACT SYSTEM.
	.ENDC
	S	4EXT		/TEXT
	JMP	TEXT
	S	%XPUNG		/EXPUNGE
	JMP	FORM		/IGNORE
	S	&IXMRI		/FIXMRI
	JMP	FORM		/IGNORE
	S	&IXTAB		/FIXTAB
	JMP	FORM		/IGNORE
/
/PSEUDOS OUT
/
ABS	S	ABS
DEC	S	DEC
END	S	END
EOT	S	EOT
LOC	S	LOC
OCT	S	OCT
ORIG	S	100
	.EJECT
/FLOATING POINT - TYPE 2
/
FP	.DSA	FP;	-10
	S	&EXT		/FEXT
	JMP	FORM		/IGNORE
	S	&ADD		/FADD
	LAC	FTAB
	S	&SUB		/FSUB
	LAC	FTAB+1
	S	&MPY		/FMPY
	LAC	FTAB+2
	S	&DIV		/FDIV
	LAC	FTAB+3
	S	&GET		/FGET
	LAC	FTAB+4
	S	&PUT		/FPUT
	LAC	FTAB+5
	S	&NOR		/FNOR
	JMP	FNOR		/OUTPUT 'JMS %FNOR'
/
/INSTRUCTION REPLACEMENT
/
FTAB	S	AD
	S	SUB
	S	MPY
	S	DVD
LAC	S	LAC
DAC	S	DAC
/
	.EJECT
	.IFDEF	COMPCT
TWAIT	XX			/RETURN ADDRESS
WAIT	LAC	IDV		/INPUT?
	AND	IBF
	SZA			/BOTH SWITCHES SET?
	JMP	INPUT		/YES
	LAC	IBF		/NO, TRY TRANSLATION
	XOR	OBF
	SZA			/ONE BUFFER WAITING?
	JMP	WAITA		/YES
	LAC	IBF
	AND	OBF
	SNA			/BOTH BUFFERS READY?
	JMP*	TWAIT		/YES
WAITA	LAC	ODV		/NO, TRY OUTPUT
	AND	OBF
	SNA			/BOTH SWITCHES SET?
	JMP	WAIT		/NO, LOOP AGAIN
/
OUTPUT	DZM	ODV		/YES
	DZM	OBF		/CLEAR SWITCHES
	IOF
	LAC	(WAIT
	DAC	0
OUTPA	LAC*	AUTOB		/OUTPUT FROM BUFFER
	SAD	(-1		/LAST CHAR?
	JMP	TERM		/YES
	JMS	OUTDEV		/NO,OUTPUT TO DEVICE
	ISZ	CNTB		/EMPTY?
	JMP	OUTPA		/NO,OUTPUT NEXT
	JMS	BB		/YES, RESET BUFFER
	LAC	EOTSW
	SZA			/END OF MEDIUM?
	ISZ	IDV		/YES, SIMULATE MORE INPUT
	ISZ	ODV		/OUTPUT READY
	JMP	DIS		/AND DISMIS
/
OUTDEV	XX
	XX			/'JMS PUN' OR 'JMS TT'
	JMP*	OUTDEV
/
HIGH	JMS	PUN
LOW	JMS	TT
/
INPUT	DZM	IDV		/CLEAR DEVICE
	DZM	IBF		/& BUFFER FLAGS
INPUTA	IOF
	LAC	(WAIT		/SET RETURN
	DAC	0		/TO WAIT ROUTINE
NEXT	JMS	RD
	AND	(177		/7 BITS ONLY
	SNA
	JMP	NEXT		/IGNORE BLANK AND LEADER
	SAD	(177
	JMP	NEXT		/IGNORE RUB-OUT
	SAD	(40
	JMP	SPACE		/CHECK MULTIPLE SPACES
	SAD	(12
	JMP	NEXT		/IGNORE LINE-FEED
	SAD	(4		/EOT?
	JMP	ENDIN		/YES, END OF INPUT
	DZM	SPAC		/NO, CLEAR INDICATOR
STORE	DAC*	AUTOA		/STORE
	ISZ	CNTA		/BUFFER FULL?
	JMP	NEXT		/NO, FETCH NEXT
	JMS	BA		/YES, RESET BUFFER
	ISZ	IDV		/INPUT READY
	JMP	DIS		/AND DISMIS
/
HI	JMS	RD
LO	JMS	KEY
SPAC	0
/
SPACE	LAC	SPAC
	SZA			/SPAC SET?
	JMP	NEXT		/YES, SO IGNORE
	ISZ	SPAC		/NO, SET SPAC
	LAC	(40		/LOAD SPACE
	JMP	STORE		/AND STORE IT
/
ENDIN	ISZ	EOTSW		/SET EOT SWITCH
	ISZ	IDV		/SIMULATE FULL BUFFER
	CLA!CMA			/-1 TO AC
	JMP	STORE
EOTSW	0
/
PUTX	XX		/(GAR-003)
	SKP
	JMP*	PUTX	/(GAR-003)
	JMS	PARITY		/ADD PARITY BIT
	DAC*	AUTOY		/PUT CHAR FOR OUTPUT
	ISZ	CHRCNT
	ISZ	CNTY		/BUFFER FULL?
	JMP*	PUTX		/NO (GAR-003)
	JMS	BY		/YES, RESET BUFFER
	ISZ	OBF		/AND SWITCH
	JMS	TWAIT		/WAIT FOR BUFFER RELEASE
	JMP*	PUTX		/AND CONTINUE  (GAR-003)
/
FETCH	XX
	JMS	TWAIT		/BUFFER READY?
	LAC*	AUTOX		/FETCH CHAR
	DAC	TCHAR		/STORE TEMP
	ISZ	CNTX		/BUFFER EMPTY?
	JMP*	FETCH		/NO, PROCESS
	JMS	BX		/YES, RESET BUFFER
	ISZ	IBF		/AND SWITCH
	LAC	TCHAR
	JMP*	FETCH		/PROCESS
/
TERM	JMS	LT		/TRAILER
	LAC	PAUSW		/PAUSE FOUND?
	SNA
	JMP	TERMA		/NO,TRAILER AND RE-START
	LAC	(DIS		/YES,CLEAR READER
	DAC	RD
	JMS	KEYWT		/TYPE 'PAUSE'
	S	PAUSE
	LAC	CP
	JMS	TRIO		/AND '^P'
	JMP	LOOP-1		/ION AND WAIT FOR ^P
/
TERMA	JMS	LT		/OUTPUT TRAILER AGAIN
	JMP	BEG		/AND START AGAIN
/
LT	XX			/L/T
	LAC	TTSW
	SNA!CLA			/TT OUTPUT?
	LAW	-140		/NO,96
	TAD	(-40		/PLUS 32
	DAC	CNTT		/FRAMES
	CLA
	JMS	OUTDEV		/OF BLANK TAPE
	ISZ	CNTT
	JMP	.-3
	JMP*	LT
CNTT	0
/
PARITY	XX
	DAC	TEM1		/SAVE CHAR
	RTR;	RTR		/BITS 10 TO 13
	XOR	TEM1		/XOR WITH BITS 14 TO 17
	DAC	TEM2
	RTR			/BITS 14 TO 15
	XOR	TEM2		/XOR WITH BITS 16 TO 17
	DAC	TEM2
	RAR			/BIT 16
	XOR	TEM2		/XOR WITH BIT 17
	RAR			/INTO LINK
	LAC	TEM1		/RELOAD
	SZL			/ODD PARITY?
	TAD	(200		/YES, ADD CHANNEL 8
	JMP*	PARITY		/RETUR
/
INIT	XX
	CLA!CMA			/SET BUFFER SWITCHES TO -1
	DAC	SWA
	DAC	SWB
	DAC	SWX
	DAC	SWY
	JMS	BA		/INITIALIZE ALL BUFFERS
	JMS	BB
	JMS	BX
	JMS	BY
	DZM	IDV		/CLEAR INPUT DEVICE FLAG
	DZM	IBF		/AND INPUT BUFFER FLAG
	DZM	ODV		/CLEAR OUTPUT DEVICE FLAG
	DZM	OBF		/AND OUTPUT BUFFER FLAG
	ISZ	IBF		/ENABLE INPUT (2 BUFFERS)
	JMP*	INIT
RSA=700104
RRB=700112
PCF=700202
PSA=700204
KRS=700322
KRB=700312
TCF=700402
TLS=700406
/
SERVE	DAC	AC		/STORE AC
	IORS
	DAC	IO		/STORE STATUS
	RTL
	SNL			/READER? BIT1
	JMP	.+6
	AND	(4000		/END TAPE?
	SZA
	JMP	ENDT
	RRB
	JMP*	RD
	SMA			/PUNCH? BIT2
	JMP	.+6
	AND	(2000		/OUT OF TAPE?
	SZA!CLA!CMA		/-1 TO AC
	JMS	IOERR		/YES, HLT AT LOC. 70
	PCF
	JMP*	PUN
	RTL
	SNL			/KEYBOARD? BIT3
	JMP	.+3
	KRB
	JMP*	KEY
	SMA			/TELETYPE? BIT 4
	JMP	.+3
	TCF
	JMP*	TT
	LAC	IO		/SPURIOUS
	JMS	IOERR		/HLT AT 70, STATUS IN AC
	CAF			/CONTINUE
DIS	LAC	0		/RESTORE
	RAL			/LINK
	LAC	AC		/AND AC
	ION			/AND RESUME
	JMP*	0
AC;IO
ENDT	RRB			/CLEAR FLAG
	CLA!CMA
	DAC*	AUTOA
	ISZ	EOTSW		/SET END SWITCH
	JMP	DIS
/
/I-O SUBROUTINES
/
RD	DIS			/CLEAR INITIAL OR SPURIOUS INTERRUPT
	RSA			/FETCH CHAR
	JMP	DIS
/
KEY	DIS
	KRS
	JMP	DIS		/WAIT FOR KEYBOARD
/
PUN	DIS
	PSA			/PUNCH
	JMP	DIS
/
TT	DIS
	TLS			/TYPE
	JMP	DIS
/BUFFER CHANGES
	.DEFIN	BUFF,B,SW,ST,AUTO,CNT
B	XX
	ISZ	SW		/WHICH WAY?
	JMP	.+6		/EVEN
	LAC	ST		/ODD, BUFFER START
	DAC	AUTO		/TO AUTO-INDEX
	LAW	-SIZE
	DAC	CNT		/SET COUNTER
	JMP*	B		/AND EXIT
	CLA!CMA
	DAC	SW		/RESET SWITCH
	JMP	.-5		/AND COUNTER
	.ENDM
/
	BUFF	BA,SWA,BUFFA,AUTOA,CNTA
	BUFF	BB,SWB,BUFFB,AUTOB,CNTB
	BUFF	BX,SWX,BUFFA,AUTOX,CNTX
	BUFF	BY,SWY,BUFFB,AUTOY,CNTY
BUFFA	.DSA	BUFFA
	.BLOCK	2*SIZE
BUFFB	.DSA	BUFFB
	.BLOCK	2*SIZE
SYMTAB	.DSA	SYMTAB
	.BLOCK	2*SYMBLK
	.ENDC
	.END	BEG
	.EJECT
