Google
 

Trailing-Edge - PDP-10 Archives - -
There are no other files named in the archive.
/PDP-8 TELETYPE MONITOR SERVICE ROUTINE
/PDP-8 TO PDP-10 INTERFACE VIA A DA25
/PETER M. HURLEY   JULY 16,1969

/DA25 INSTRUCTION DEFINITIONS

	SDI=6601	/SKIP IF THIS DEVICE IS INTERRUPTING
	RWC=6602	/READ THE WORD COUNT
	LWC=6603	/LOAD THE WORD COUNT
	RMA=6604	/READ THE MEMORY ADDRESS BUFFER
	LMA=6605	/LOAD THE MEMORY ADDRESS BUFFER
	RDB=6606	/READ THE DATA BUFFER
	LDB=6607	/LOAD THE DATA BUFFER
	SDF=6611	/SKIP ON THE DONE FLAG
	SRF=6612	/SKIP ON THE REQUEST FLAG
	SEF=6613	/SKIP ON THE ERROR FLAG
	RCR=6614	/READ THE CONTROL REGISTER
	LCR=6615	/LOAD THE CONTROL REGISTER
	RER=6616	/READ THE EXTENSION REGISTER
	LER=6617	/LOAD THE EXTENSION REGISTER
*1
	JMP I 2
	TRAP
	USRINT		/CALLED BY JMS I 3  TO INTERUPT THE PDP-10
	0
	0

*170
START,	RUN
CHAIN,	EXIT
IRQFL,	0
KEYFL,	0
DONFL,	0
CHREC,	0
DISMIS,	EXIT
TSYNC,	UTYPE
*200
INIT,	KCC		/CLEAR KEYBOARD AND FLAGS
	TCF		/CLEAR TELEPRINTER FLAG
	DCA ECHO	/CLEAR OUT ECHO ADDRESS
	DCA REQWRD	/CLEAR FLAGS
	DCA DREQ3
	DCA IOREQ
	DCA SYNCW
	DCA I (INTFLG)
	DCA I (CHRFLG)
	JMS INITDA	/GO INITIALIZE THE DA-25
	JMP I (CARRET)	/TYPE OUT A CARRIAGE RETURN

INITDA,	0		/ROUTINE TO INITIALIZE THE DA25
	CLA		/ALLWAYS ASSUME THE AC IS NOT 0
	DCA DAFLG	/MARK THAT DA25 IS NOT IN USE
	LCR		/CLEAR THE CONTROL REGISTER
	TAD (-3)	/SET THE WORD COUNT TO -3
	LWC
	TAD (REQ3+3)	/GET THE STARTING ADDRESS
	LMA		/LOAD THE MEMORY ADDRESS BUFFER
	TAD (30-REQ3)	/SET UP EXTENSION REGISTER FOR ENABLE+FAST
	LER		/LOAD THE EXTENSION REGISTER
	CLA		/ALLWAYS RETURN WITH AC=0
	JMP I INITDA	/RETURN TO CALLER
TRAP,	DCA TAC		/SAVE THE AC
	RAL		/GET THE LINK
	DCA TLK		/SAVE LINK
	SDI		/IS THE DA25 INTERRUPTING
	JMP TTYI	/NO, TRY THE KEYBOARD
	SDF		/DONE FLAG UP
	JMP DAERR	/NO, IS THIS AN ERROR
DONE,	TAD IOREQ	/WAS THERE IO GOING ON
	TAD REQWRD	/OR A REQUEST GOING ON
	SZA CLA
	JMP IODONE	/YES, THEN WE ARE THROUGH
	TAD REQ3	/THIS MUST HAVE BEEN A PDP-10 REQUEST
	AND (7700)	/GET FLAG BITS
	RTR
	RTR
	RTR
	TAD (TABLE-1)	/CALCULATE WHICH REQUEST
	DCA ITEM
	JMP I ITEM	/DISPATCH TO ROUTINE

TRYREQ,	TAD SYNCW	/ARE WE OUT OF SYNC
	SZA
	HLT		/YES, HLT BEFORE PROGRAM IS WIPED OUT
	ISZ SYNCW	/MAKE SYNCW NOT BUSY
	TAD (4001)	/READ IN PDP-10 REQUEST
TRANS,	LCR		/INITIATE THE TRANSFER
	DCA DAFLG	/MARK THAT DA25 IS IN USE
	JMP EXIT	/DISMISS
DAERR,	SEF		/ANY ERRORS
	JMP TRYREQ	/NO, TRY REQUEST
DELREQ,	TAD REQWRD	/WAS THERE A REQUEST GOING ON
	SNA CLA
	JMP IODONE	/NO, CLEAR ERRORS AND TRY AGAIN
	TAD REQ1	/GET THE REQUEST
	DCA DREQ1	/AND SAVE IT
	TAD REQ2
	DCA DREQ2
	TAD REQ3
	DCA DREQ3
	DCA REQWRD	/CLEAR REQUEST FLAG

EXIT1,	JMS INITDA	/GO INITIALIZE THE DA25
EXIT,	CLA CLL		/INITIALIZE LINK AND AC
EXIT2,	TAD I (CHAINF)	/IS THIS THE END OF A CHAINED INTERRUPT
	SZA CLA
	JMP I (INTCHK)	/YES, GO CHECK FOR INTERRUPTS TO PDP-10
	TAD TLK		/GET LINK
	CLL RAR		/RESTORE IT
	TAD TAC		/RESTORE AC
	JMP I (EXIT3)	/GO DISMISS
TTYI,	KSF		/IS THIS THE KEYBOARD
	JMP I (TTYO)	/NO, TRY THE TELEPRINTER
	KRB		/READ THE KEYBOARD
	DCA DREQ1	/STORE CHARACTER
	OSR		/READ THE SWITCHES
	SPA CLA		/I& THE CHAR FOR PDP-8 OR PDP-10
	JMP I (CFOR8)	/FOR THE 8
	TAD DAFLG	/IS THE DA25 BUSY
	SZA CLA
	JMP I (CDELAY)	/YES, DELAY THE CHARACTER
	TAD DREQ1	/NO, GET CHARACTER
	DCA REQ1	/STORE IN OUTPUT BLOCK
	IAC		/SET CHAR BIT
	DCA REQ3	/STORE IN REQUEST BLOCK
	ISZ REQWRD	/MAKE REQUEST FLAG NON ZERO
AGAIN,	TAD (4005)	/GET OUTPUT BITS
	JMP TRANS	/GO START TRANSFER

IODONE,	DCA REQWRD	/CLEAR FLAGS
	DCA SYNCW
	DCA IOREQ
DELYCK,	TAD DREQ3	/IS THERE A DELAYED REQUEST
	SNA
	JMP I (DELYC1)	/NO, DISMISS
	JMP I (DELYC2)	/YES, SEND IT OUT
ECHO,	0
ITEM,	0
TAC,	0
TLK,	0
REQ3,	0
REQ2,	0
REQ1,	0
SYNCW,	0
DREQ3,	0
DREQ2,	0
DREQ1,	0
REQWRD,	0
IOREQ,	0
DAFLG,	0

PAGE
*400
CHAR,	TAD I (ECHO)	/IS THERE AN ECHO GOING ON
	SNA CLA
	JMP TYOK1	/NO, GO TYPE THIS OUT
	TAD I (REQ1)	/YES, GET CHARACTER
	DCA SYNC	/STORE FOR LATER ECHO
	JMP I (IODONE)
TYOK1,	JMS I (INITDA)	/INITIALIZE THE DA25
TYOK,	TAD BTTM	/SETUP RETURN ROUTINE
	DCA I (ECHO)	/STORE IN ECHO
	TAD I (REQ1)	/GET CHARACTER
	TLS		/TYPE IT OUT
	CLA
	JMP I (IODONE)	/GO LOOK FOR MORE REQUESTS
INTREQ,	TAD 5		/IOR
	CMA		/ LOCATION 5 WITH
	AND I (REQ2)	/ LOCATION REQ2
	TAD 5		/ AND STORE RESULTS
	DCA 5		/ IN LOCATION 5
	JMS I (RQCHK)	/SET UP RETURN
	IRQFL
	JMP I (IODONE)

OUTREQ,	TAD (4005)	/GET CONTROL REGISTER BITS
INREQ,	DCA TEM		/STORE CONTROL REGISTER BITS
	LCR		/CLEAR FLAGS
	TAD I (REQ2)	/SET UP MEMORY ADDR
	LMA
	ISZ I (IOREQ)	/MARK THAT AN IO TRANSFER IS GOING ON
	CLA
	DCA I (SYNCW)
	TAD I (REQ1)	/GET WORD COUNT
	LWC		/LOAD WORD COUNT
	CLA
	TAD I (REQ3)
	LER		/LOAD THE EXTENSION REGISTER
	CLA
	TAD TEM		/GET TRANSFER CONTROL BITS
	SZA		/IN OR OUT?
	JMP I (TRANS)	/INITIATE TRANSFER
	JMP I (EXIT)	/WAIT FOR IO REQUEST TO INITIATE TRANSFER
CFOR8,	TAD I (DREQ1)	/GET CHARACTER
	TLS		/TYPE IT OUT
	DCA CHREC	/STORE IT FOR USER
	TAD I (ECHO)	/IS THERE A CHARACTER BEING TYPED
	SNA
	TAD BTTK	/NO, SET UP RETURN ADDRESS
	DCA I (ECHO)
	JMS I (RQCHK)	/GO SET UP TRAP RETURN
	KEYFL		/TO USER PROGRAM
	JMP I (EXIT)	

TTYO,	TSF		/IS IT THE PRINTER
	JMP CHAINI	/NO, CONTINUE ON IN CHAIN
	TCF		/CLEAR FLAG AND AC
	TAD I (ECHO)
	DCA TEM		/SETUP FOR DISPATCH
	DCA I (ECHO)	/CLEAR ECHO
	JMP I TEM	/DISPATCH

TTYA,	JMS I (RQCHK)	/SET UP FOR USER TRAP
	DONFL
TTYB,	TAD SYNC	/IS THERE A CHARACTER WAITING TO BE TYPED OUT
	SNA
	JMP I (EXIT)
	DCA I (REQ1)	/STORE CHARACTER
	DCA SYNC	/CLEAR SYNC CHARACTER
	JMP TYOK	/GO TYPE IT OUT

CHAINI,	ISZ I (CHAINF)	/MAKE CHAIN FLAG NON ZERO
	JMP I CHAIN	/CONTINUE ON IN CHAIN
INT6,	ISZ ECHFLG	/NOTE THAT ECHO IS TO BE DONE
	TAD I (DAFLG)	/IS THE DA25 BUSY
	SNA CLA
	JMP I (DELYCK)	/NO, CHECK FOR DELAYED REQUEST
	JMP I (EXIT)	/YES, DISMISS

CDELAY,	TAD I (DREQ1)	/GET CHARACTER
	DCA CHRFLG	/SAVE IT TO SEND OUT LATER
	JMP I (EXIT)	/DISMISS

RUN,	ISZ TEM
	JMP RUN
	IAC
	JMP RUN		/THIS ROUTINE CAN BE REPALCED BY "JMP ."
SYNC,	0
BTTM,	INT6
BTTK,	TTYB
TEM,	0
CHRFLG,	0
ECHFLG,	0
TABLE,	JMP CHAR
	JMP INTREQ
	JMP INREQ
	JMP OUTREQ

PAGE
UTYPE,	0
	DCA UTEM	/SAVE CHARACTER
UTST,	IOF
	TAD I PECHO	/IS THERE A CHARACTER BEING TYPED
	SZA CLA
	JMP WAIT	/YES, WAIT FOR IT TO FINISH
	TAD BTTU
	DCA I PECHO	/SETPECHOWITH PROPER RETURN ADDRESS
	TAD UTEM	/GET CHARACTER
	TLS		/TYPE IT OUT
	ION
	JMP I UTYPE	/RETURN TO USER

WAIT,	ION
	TAD I PECHO	/IS ECHO 0 YET
	SZA CLA
	JMP .-2		/NO, LOOP UNTIL 0
	JMP UTST	/YES, GO TYPE CHAR

RQCHK,	0
	TAD I RQCHK	/GET REQUEST
	DCA TEM3	/SAVE FOR LATER
	ISZ RQCHK	/INCREMENT RETURN
	CMA		/GET -1 IN AC
	TAD I TEM3	/DOES THE FLAG =1
	SNA
	JMP I RQCHK	/YES, JUST RETURN
	IAC		/RESTORE AC TO ORIGINAL STATE
	SNA		/WAS FLAG 0
	JMP RQCNG	/YES, MAKE IT A 1
	DCA TEM4	/STORE TRAP ADDRESS
	TAD 0
	DCA I TEM4	/PUT FINAL RETURN ADDR IN TRAP LOCATION
	TAD TEM4
	IAC		/INCREMENT TRAP ADDRESS
	DCA 0		/STORE IN 0 FO PROPER EXIT TO TRAP ROUTINE
	DCA I TEM3	/ZERO FLAG LOCATION
	JMP I RQCHK	/RETURN

RQCNG,	ISZ I TEM3	/MAKE FLAG = 1
	JMP I RQCHK	/ AND RETURN

ST0,	DCA 0		/FALL THROUGH TO DELYC1

DELYC1,	DCA I (REQ3)	/CLEAR REQ3 OF GARBAGE
	TAD I (INTFLG)	/IS THERE A USER INTERRUPT READY
	SNA CLA
	JMP DELYCC	/NO, GO CHECK FOR A CHARACTER
	TAD I (INTTAB)	/PICK UP USER BITS FOR INTERRUPT
	DCA I (DREQ2)	/STORE REQUEST
	CLA CLL IAC RTL	/LOAD IN INTERRUPT REQUEST #
	DCA I (REQ3)	/STORE IT FOR LATER
	CLA CMA		/SUBTRACT 1 FROM INTFLG
	TAD I (INTFLG)
	DCA I (INTFLG)
	TAD I (INTFLG)	/LOAD -INTFLG INTO COUNT
	CMA
	DCA COUNT
	TAD (INTTAB)	/GET ADDRESS OF FIRST LOC IN TABLE
	DCA TEM3
	TAD (INTWD1)	/GET ADDRESS OF NEXT LOC IN INTERRUPT TABLE
	DCA TEM4
BLT,	ISZ COUNT	/MOVE ENTRIES IN TABLE DOWN BY ONE LOC
	SKP CLA
	JMP DELYCC	/ALL DONE
	TAD I TEM4	/GET NEXT WORD
	DCA I TEM3	/STORE IN NEW LOC IN TABLE
	ISZ TEM3	/INCREMENT POINTER
	ISZ TEM4	/INCREMENT POINTER #2
	JMP BLT		/GO BACK FOR MORE

INTWRD=INTTAB
DELYCC,	TAD I (CHRFLG)	/IS THERE A CHARACTER TO GO OUT
	SNA
	JMP DELYCE	/NO, GO CHECK FOR ECHO
	DCA I (DREQ1)	/PUT IT IN DELAYED QUEUE
	DCA I (CHRFLG)	/ZERO CHARACTER FLAG
	CLA CLL IAC
	TAD I (REQ3)	/PICK UP OTHER REQUESTS
	DCA I (REQ3)	/STORE REQUEST FOR LATER
DELYCE,	TAD I (ECHFLG)	/IS THERE AN ECHO TO GO OUT
	SNA CLA
	JMP DELYCF	/NO
	DCA I (ECHFLG)	/CLEAR ECHO FLAG
	CLA CLL IAC RAL
	TAD I (REQ3)	/ADD ECHO REQUEST TO REQ3
	DCA I (REQ3)
DELYCF,	TAD I (REQ3)	/ARE THERE ANY REQUESTS TO GO OUT
	SNA
	JMP I (EXIT1)	/NO, WE ARE THROUGH
DELYC2,	DCA I (REQ3)	/SET UP REQUEST BITS
	TAD I (DREQ1)
	DCA I (REQ1)
	TAD I (DREQ2)
	DCA I (REQ2)
	DCA I (DREQ3)	/ZERO DELAYED REQUEST FLAG
	JMS I (INITDA)	/INITIALIZE DA25
	ISZ I (REQWRD)	/SET REQUEST FLAG NON-ZERO
	JMP I (AGAIN)	/GO OUTPUT REQUEST
INTCHK,	DCA I (CHAINF)	/CLEAR CHAIN FLAG
	TAD I (DAFLG)	/IS THE DA-25 BUSY
	SZA CLA
	JMP I (EXIT2)	/YES, WAIT FOR IT TO BECOME FREE
	TAD I (INTFLG)
	SZA CLA		/IS THERE AN INTERRUPT PENDING
	JMP DELYC1	/YES, GO SEND IT OUT
	JMP I (EXIT2)	/NO, JUST EXIT NORMALLY


COUNT,	0
UTEM,	0
BTTU,	TTYA
TEM3,	0
TEM4,	0
PECHO,	ECHO

PAGE
*1000
USRINT,	0
	IOF		/TURN OF THE INTERRUPT SYSTEM
	CLA
	TAD INTFLG	/CHECK IF TOO MANY INTERRUPTS STACKED UP
	TAD INTSIZ	/MINUS NUMBER OF STACK LOCATIONS
	SMA CLA
	HLT		/STACK IS FULL
	TAD INTFLG	/CALCULATE LOCATION FOR NEXT STACKED INTERRUPT
	TAD PINTAB	/TABLE ADDRESS
	DCA TEMP
	TAD 4		/PICK UP USER INTERRUPT BITS
	DCA I TEMP	/STORE IN TABLE
	DCA 4
	ISZ INTFLG	/INCREMENT STACK POINTER
	TAD CHAINF	/ARE WE AT INTERRUPT LEVEL
	SZA CLA
	JMP I USRINT	/YES, JUST RETURN TO THE USER
	TAD I PDAFLG	/OR IS THE DA-25 BUSY
	SZA CLA
	JMP RETURN	/YES, RETURN TO USER WITH ION ON
	TAD USRINT	/GET RETURN ADDRESS
	JMP I PST0	/GO SEND OUT THE INTERRUPT

RETURN,	ION
	JMP I USRINT	/RETURN
CARRET,	ISZ I PECHFL	/SEND OUT AN ECHO
	DCA CHAINF
	TAD CINIT	/CHANGE EXIT ROUTINE SO THAT AN RMF IS NOT -
	DCA EXIT3	/ EXECUTED DURING INITIALIZATION
	JMP I PDELC1	/GO SEND OUT ECHO

CINIT,	JMP ZEXIT
IRMF,	RMF
PTAC,	TAC

EXIT3,	RMF		/RESTORE DATA AND INSTRUCTION FIELDS
	ION		/TURN INTERRUPT SYSTEM BACK ON
	JMP I 0		/DISMISS

ZEXIT,	CLA
	TAD IRMF
	DCA EXIT3	/RESTORE RMF INSTRUCTION
	TAD I PTAC	/RESTORE AC
	ION
	JMP I START	/RETURN TO USER STARTING ADDRESS

PINTAB,	INTTAB
PST0,	ST0
PDAFLG,	DAFLG
PECHFL,	ECHFLG
PDELC1,	DELYC1
INTFLG,	0
TEMP,	0
CHAINF,	0
	INTWRD=INTTAB
INTTAB,	0
INTWD1,	0
	0
	0
	0
	0
	0
INTSIZ,	-7
	/BOOTSTRAP LOADER FOR TMSR

*1100
	CLL STA RTL
	JMS INIT25
	CLA
	LCR
	JMS INIT25
	JMP I ST

INIT25,	0
	LWC
	CLA
	LMA
	TAD THIRTY
	LER
	SRF
	JMP .-1
	TAD INPU
	LCR
	SDI
	JMP .-1
	JMP I INIT25
ST,	200
INPU,	4001-30
THIRTY,	30
PAGE
$