Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50234/tmsr.pal
There are 2 other files named tmsr.pal in the archive. Click here to see a list.
/TMSR - TELETYPE MONITOR SERVICE ROUTINE
/PDP-8 - PDP-10 COMUNICATIONS MONITOR
/USING A PT08 LINK TO THE DC-10

	KSFPT=6401	/SKIP ON PT08 KEYBOARD FLAG
	KRBPT=6406	/READ IN A CHARACTER FROM PT08
	TSFPT=6411	/SKIP ON PT08 PRINTER FLAG
	TCFPT=6412	/CLEAR PT08 PRINTER FLAG
	TLSPT=6416	/TYPE OUT A CHARACTER ON PT08

*1
	JMP I 2
	CH0			/DISPATCH TO INTERRUPT CHAIN

*170
START,	RUN			/ADDRESS OF START OF USER PROGRAM
CHAIN,	RESTOR			/ADDRESS OF USER INTERRUPT SKIP CHAIN
DISMIS,	RESTOR			/ADDRESS OF INTERRUPT DISMISS ROUTINE
TYPE8,	STOTTO			/ADDRESS OF ROUTINE TO TYPE ON PDP-8 CTY
SEND10,	STOPTO			/ADDRESS OF ROUTINE TO SEND A CHAR TO THE PDP-10
CHAR,	0			/CHARACTER TO BE SENT BY SEND10 OR TYPE8
TTYINT,	0			/INTERCEPT FOR TTY CHARACTERS
PTYINT,	0			/INTERCEPT FOR PT08 CHARACTERS
*7000
INIT,	JMS CLRTTB		/CLEAR THE TTY BUFFER
	DCA TTOFLG		/CLEAR TTY FLAGS
	DCA TTYINT		/ALWAYS CLEAR TTY INTERCEPT
	JMP INIT1		/GO INIT PT08 VARIABLES

CLRTTB,	0			/RETURN ADDRESS
	CLA CLL			/INIT THE AC
	TAD TTOIPT		/MAKE INPUT AND OUTPUT POINTERS THE SAME
	DCA TTOOPT		/ ...
	DCA TTOCNT		/ZERO THE TTY CHARACTER COUNT
	DCA XFLAG		/XON-XOFF FLAG
	DCA OXFLAG		/PREVIOUSLY HONERED XFLAG
	JMP I CLRTTB		/RETURN TO CALLER
CH0,	DCA SAVAC		/SAV THE AC
	RAL
	DCA SAVLNK		/AND THE LINK
	KSFPT			/ANY CHARACTERS FROM PT08?
	JMP CHKTTI		/NO, GO CHECK TTY PRINTER
	KRBPT			/YES, READ IN CHARACTER
	DCA CHAR		/STORE CHARACTER AWAY
	TAD PTYINT		/IS THE CHARACTER INTERCEPT SET
	SZA CLA			/...
	JMP I PTYINT		/YES, GO TRAP TO USER PROG
	TAD CHAR		/GET CHARACTER AGAIN
	AND C177		/STRIP OFF PARITY BIT
	JMP PTCHK		/GO CHECK FOR XON AND STX
PTRET,	JMS STOTTO		/STORE CHARACTER IN TTY OUTPUT BUFFER
CHKTTI,	KSF			/TELETYPE INTERRUPT
	JMP CHKTTO		/NO, TRY PT08 RECEIVER
	KRB			/READ THE CHARACTER IN FROM TTY
	AND C177		/STRIP OFF PARITY BIT
	DCA CHAR		/STORE FOR LATER USE
	TAD TTYINT		/CHECK IF TTY INTERCEPT IS ENABLED
	SZA CLA			/ ...
	JMP I TTYINT		/YES, IT IS SO GO INTERCEPT CHAR
	TAD MCNTRO		/GET NEGATIVE CONTROL-O
	TAD CHAR
	SNA			/IS THIS CHAR A CONTROL-O
	JMS CLRTTB		/YES, GO CLEAR THE TTY OUTPUT BUFFER
	JMP READTT		/YES, GO READ IN THE CHARACTER
CHKTTO,	TSF			/TTY PRINTER INTERRUPT?
	JMP CHKPTO		/NO, TRY PT08 PRINTER
	TCF			/CLEAR FLAG
	CLA CLL
	DCA TTOFLG		/MARK TTY PRINTER FREE
	JMS STATTO		/GO SEND OUT MORE OUTPUT TO TTY
RESTOR,	CLA CLL			/RESTORE AC AND LINK
	TAD SAVLNK		/LINK
	RAR
	TAD SAVAC		/AND AC
	RMF			/RESTORE CORRECT DATA FIELD
	ION			/ENABLE INTERRUPTS AGAIN
	JMP I 0			/RETURN TO INTERRUPTED PROGRAM

MCNTRO,	-17			/NEGATIVE CONTROL-O
C177,	177
STOTTO,	0			/RETURN ADDR
	CLA CLL			/INIT
	TAD TTOCNT		/GET COUNT
	TAD MTOMAX		/SUBTRACT MAXIMUM COUNT VALUE
	SMA			/OVERFLOWED THE BUFFER?
	JMP I STOTTO		/YES, IGNORE THIS CHARACTER
	TAD XOFFCT		/NOW CHECK IF TIME TO SEND XOFF
	SMA CLA
	JMP SNDXOF		/YES, SEND A XOFF
RETXOF,	ISZ TTOIPT		/COUNT UP INPUT POINTER
	TAD TTOIPT		/GET INPUT POINTER
	TAD MTTOEN		/SUBTRACT END OF BUFFER POINTER
	SZA CLA			/IS THIS THE END OF THE BUFFER
	JMP .+3			/NO
	TAD TTOBEG		/YES, WRAP AROUND
	DCA TTOIPT		/STORE NEW POINTER
	TAD CHAR		/GET CHARACTER
	DCA I TTOIPT		/STORE IT IN BUFFER
	ISZ TTOCNT		/COUNT UP CHARACTERS IN BUFFER
	JMS STATTO		/START TTY GOING
	ISZ STOTTO		/SKIP RETURN MEANS CHARACTER IN BUFFER OK
	JMP I STOTTO		/RETURN
STATTO,	0			/RETURN ADDRESS
	CLA CLL			/INIT
	TAD TTOFLG		/TTY BUSY?
	SZA CLA
	JMP I STATTO		/YES, WAIT FOR TTY DONE INTERRUPT
	TAD TTOCNT		/GET COUNT OF CHAR IN BUFFER
	SPA SNA			/ANY THERE?
	JMP I STATTO		/NO, JUST RETURN
	TAD M1			/SUBTRACT 1
	DCA TTOCNT		/STORE NEW VALUE OF COUNT
	TAD MXONCT		/GET NEGATIVE CHAR LEFT BEFORE XON
	TAD TTOCNT		/IS BUFFER ALMOST EMPTY
	SPA SNA CLA
	JMP SNDXON		/YES, SEND AN XON (MAYBE)
RETXON,	ISZ TTOOPT		/COUNT UP OUTPUT POINTER
	TAD TTOOPT		/GET POINTER
	TAD MTTOEN		/WRAP AROUND NEEDED
	SZA CLA
	JMP .+3			/NO
	TAD TTOBEG		/YES, GET START OF BUFFER
	DCA TTOOPT		/STORE NEW POINTER
	TAD I TTOOPT		/GET CHARACTER TO TYPE
	TLS			/TYPE IT ON PRINTER
	ISZ TTOFLG		/SET TTY BUSY FLAG
	JMP I STATTO		/RETURN
SNDXOF,	CLA IAC			/LOAD 1
	DCA XFLAG		/MARK THAT A XOFF IS NEEDED
	JMS STAPTO		/START PT08 UP
	JMP RETXOF		/RETURN

SNDXON,	CLA CMA			/LOAD -1
	DCA XFLAG		/MARK THAT A XON IS NEEDED
	JMS STAPTO		/START UP PT08 TO SEND OUT XON
	JMP RETXON		/RETURN
SAVAC,	0			/STORAGE PLACE FOR INTERRUPT AC
SAVLNK,	0			/STORAGE PLACE FOR LINK
TTOFLG,	0			/TTY PRINTER BUSY FLAG
TTOCNT,	0			/COUNT OF CHARACTERS IN TTY BUFFER
MTOMAX,	-TOBFLN			/NEGATIVE LENGTH OF TTY OUTPUT BUFFER
XOFFCT,	10			/WHEN BUFFER FILLS TO WITHIN 10 CHAR, SEND XOFF
TTOIPT,	TTOBUF-1		/TTY OUTPUT INGOING POINTER
MTTOEN,	-TTOBUF-TOBFLN		/MINUS END OF TTY BUFFER
TTOBEG,	TTOBUF			/START OF TTY BUFFER
M1,	-1			/MINUS 1 CONSTANT
MXONCT,	-10			/MINUS # OF CHAR LEFT BEFORE SENDING XON
TTOOPT,	TTOBUF-1		/POINTER FOR OUTGOING TTY CHARACTERS
XFLAG,	0			/1 = SEND XOFF,  -1 = SEND XON
OXFLAG,	0			/NEGATIVE OF LAST XFLAG HONERED

*7200
INIT1,	JMS CLRPTB		/CLEAR THE PT08 BUFFER
	DCA PTOFLG		/CLEAR THE PT08 BUSY FLAG
	DCA PTYINT		/CLEAR INTERCEPT FLAG
	ION			/INIT INTERRUPT SYSTEM
RUN,	JMP I START

CLRPTB,	0			/RETURN ADDRESS
	TAD PTOIPT		/GET INPUTER POINTER
	DCA PTOOPT		/STORE AS NEW OUTPUTER POINTER
	DCA PTOCNT		/ZERO PT08 CHARACTER COUNT
	DCA PTOSTP		/ALLOW CHARACTERS TO GO OVER PT08
	DCA LODFLG		/CLEAR LOAD IN PROGRESS FLAG
	DCA DMPFLG		/CLEAR DUMP IN PROGRESS FLAG
	JMP I CLRPTB		/RETURN TO CALLER

PTCHK,	DCA CHAR		/STORE THIS CHARACTER
	TAD CHAR		/IS THIS A XOFF
	TAD MXOFF		/SUBTRACT XOFF
	SNA			/IS THIS A XOFF?
	ISZ PTOSTP		/YES, STOP SENDING CHARACTERS TO PT08
	TAD MXNPXF		/AC = CHAR - XOFF - XON + XOFF
	SNA			/IS THIS A XON
	JMP STRTPT		/YES, START PT08 AGAIN
	TAD MCEPXN		/AC = CHAR - XON - CONTRL-E + XON
	JMP CHKLOD		/GO CHECK FOR LOAD OR DUMP COMMAND

STRTPT,	DCA PTOSTP		/CLEAR STOP FLAG
	JMS STAPTO		/START TYPING ON PT08 AGAIN
	JMP PTRET		/RETURN

MXNPXF,	-21+23			/MINUS XON PLUS XOFF
MXOFF,	-23			/MINUS XOFF
MCEPXN,	-5+21			/MINUS CONTRL-E PLUS XON
STOPTO,	0			/RETURN ADDR
	CLA CLL			/CLEAR AC
	TAD PTOCNT		/GET COUNT
	TAD MPTOMX		/SUB MAXIMUM COUNT
	SMA CLA			/DID COUNT OVERFLOW
	JMP I STOPTO		/YES, IGNORE THIS CHARACTER
	ISZ PTOIPT		/COUNT UP INPUT POINTER
	TAD PTOIPT		/GET COUNTER
	TAD MPTOEN		/HAS IT OVERFLOWED
	SZA CLA
	JMP .+3			/NO
	TAD PTOBEG		/YES, WRAP IT AROUND
	DCA PTOIPT
	TAD CHAR		/GET CHAR
	DCA I PTOIPT		/STORE IT IN BUFFER
	ISZ PTOCNT		/COUNT UP CHARACTER COUNT
	JMS STAPTO		/START CHAR TYPING
	ISZ STOPTO		/SKIP RETURN TO SIGNIFY ALL OK
	JMP I STOPTO		/RETURN
STAPTO,	0			/RETURN ADR
	CLA CLL			/INIT AC
	TAD PTOFLG		/GET OUTPUT FLAG
	SZA CLA			/IS IT SET  IE. TYPE OUT IN PROGRESS
	JMP I STAPTO		/YES, RETURN
	TAD XFLAG		/NEED AN XON OR XOFF
	TAD OXFLAG		/NEGATIVE OF LAST XFLAG HONERED
	SNA
	JMP STAPT1		/NO, CHECK IF TYPING IS STOPPED
	SPA CLA			/1=SEND XOFF, -1=SEND XON
	TAD XONMXF		/AC=XON-XOFF
	TAD XOFF		/GET XOFF
	JMP STAPT2		/GO SET BUSY FLAG

STAPT1,	TAD PTOSTP		/IS TYPING STOPPED
	SZA CLA
	JMP I STAPTO		/YES, WAIT FOR XON
	TAD DMPFLG		/DUMPING?
	SZA CLA
	JMP DUMP		/YES, GO SEND OUT NEXT ELEMENT
DMPRET,	TAD PTOCNT		/GET CHARACTER COUNT
	SPA SNA			/ANY THERE?
	JMP I STAPTO		/NO, RETURN
	TAD M1			/SUBTRACT 1
	DCA PTOCNT		/STORE NEW VALUE
	ISZ PTOOPT		/INCREMENT PT08 OUTPUTER POINTER
	TAD PTOOPT		/GET POINTER
	TAD MPTOEN		/WRAPPED AROUND?
	SZA CLA
	JMP .+3			/NO
	TAD PTOBEG		/YES, INITIALIZE IT
	DCA PTOOPT		/STORE NEW VALUE
	TAD I PTOOPT		/GET CHAR
STAPT2,	TLSPT			/TYPE IT OUT
	ISZ PTOFLG		/MARK THAT PT08 IS BUSY
	CLA CLL			/NEEDED FOR SNDXON AND SNDXOF
	TAD XFLAG		/GET XFLAG
	CMA IAC			/NEGATE IT
	DCA OXFLAG		/STORE FOR FUTURE REFERENCE
	JMP I STAPTO		/RETURN
/ROUTINE TO READ AND PROCESS CHARACTERS FROM THE TTY 

READTT,	TAD MCCPCO		/AC = CHAR - CONTROL-C
	SZA CLA			/IS THIS CHARACTER A CONTROL-C?
	JMP RTT1		/NO, GO PROCESS IT NORMALLY
	ISZ CCFLAG		/YES, IS THIS THE FIRST OR SECOND IN A ROW
	JMP RTT2		/FIRST, GO STORE IN PT08 BUFFER
	TAD PTOCNT		/ARE THERE CHARACTERS IN THE BUFFER
	SNA CLA			/IF NO, DONT CLEAR BUFFER OR SEND EXTRA CONTROL-C
	JMP RTT0		/NO, CONTROL-C IS IN PDP-10, SEND THIS ONE NORMALLY
	JMS CLRPTB		/CLEAR THE BUFFERS
	JMS I SEND10		/GO STORE CONTROL-C IN OUTPUT BUFFER
	NOP			/SHOULD NEVER GET HERE
RTT0,	JMS CLRTTB		/CLEAR THE TTY BUFFER
RTT1,	CLA CLL CMA RAL		/LOAD -2 INTO AC
	DCA CCFLAG		/INITIALIZE CONTROL-C COUNTER
	JMS I TYPE8		/THIS IS THE HALF DUPLEX CODE
	JMP I DISMIS		/CHARACTER BUFFER FULL DONT SEND CHAR TO PT08
RTT2,	JMS I SEND10		/NOW SEND CHAR OUT TO PT08
	NOP			/CHARACTER DIDNT GET INTO PT08 BUFFER
	JMP I DISMIS		/RETURN TO CALLER

MCCPCO,	-3+17			/MINUS CONTROL-C PLUS CONTROL-O
CCFLAG,	-2			/CONTROL-C COUNTER
XOFF,	23			/XOFF CHARACTER
PTOFLG,	0			/PT08 BUSY FLAG
PTOCNT,	0			/COUNT OF CHARACTERS IN PT08 BUFFER
PTOOPT,	PTOBUF-1		/POINTER FOR PT08 OUTGOING CHARACTERS
PTOIPT,	PTOBUF-1		/POINTER FOR INGOING PT08 CHARACTERS
MPTOEN,	-PTOBUF-POBFLN		/NEG END OF PT08 BUFFER
PTOBEG,	PTOBUF			/START OF PT08 BUFFER
MPTOMX,	-POBFLN			/NEG LENGTH OF PT08 BUFFER
PTOSTP,	0			/FLAG TO STOP OUTPUT TO PT08
XONMXF,	21-23			/XON MINUS XOFF

*7400
/LOADER ROUTINES

DFIELD,	0			/DUMP ROUTINE FIELD POINTER
DORG,	0			/DUMP ORIGIN
DCOUNT,	0			/NEGATIVE COUNT OF WORDS TO BE DUMPED

WORD1,	0
M40,	-40


CHKLOD,	SNA			/IS THIS A DUMP COMMAND?
	JMP DUMPI		/YES, GO START DUMPING
	TAD MCBPCE		/AC = CHAR - CONTRL-E - CONTRL-B + CONTRL-E
	SNA CLA			/IS THIS A TAPE COMMAND
	JMP LOADI		/YES, MARK THAT LOADING IS NOW IN PROGRESS
	TAD LODFLG		/GET LOAD FLAG
M140,	SZA CLA			/IS LOADING IN PROGRESS? (OPCODE = -140)
	JMP LOAD		/YES, GO TO LOADER
	JMP PTRET		/NO, RETURN

MCBPCE,	-2+5			/MINUS CONTRL-B PLUS CONTRL-E

CHKPTO,	TSFPT			/PT08 PRINTER DONE
	JMP I CHAIN		/NO, DISMISS THIS INTERRUPT
	TCFPT			/YES, CLEAR THE FLAG
	CLA CLL
	DCA PTOFLG		/MAR PT08 PRINTER AS FREE
	JMS STAPTO		/SEND NEXT CHAR OUT OVER PT08
	JMP I DISMIS		/GO DISMIS THE INTERRUPT
LOADI,	ISZ LODFLG		/COUNT UP LOADER FLAG
	JMP LOADI1		/START OF A LOAD
	DCA LODFLG		/ZERO THE LOAD FLAG
	JMP I DISMIS		/END OF LOADING

LOADI1,	CLA CMA			/GET A -1
	DCA LODFLG		/STORE NEW VALUE
	TAD CHANGE		/ASSUME PAGE 0 UNLESS TOLD OTHERWISE
	DCA MEMFLD		/STORE IN CODE
	DCA CHKSUM		/STORE CURRENT CHKSUM
LOAD1,	JMS READCH		/GO GET NEXT DATA ELEMENT
	TAD CHAR		/GET DATA ELEMENT
	TAD M140		/SUBTRACT 140
	SPA SNA			/CHANGE OF MEMORY INSTRUCTION
	JMP LOAD2		/NO, MUST BE DATA OR ORIGIN
	AND FMASK		/CLEAR UNWANTED BITS
	RTL			/SHIFT DATA TO CORRECT POSITION
	RAL
	TAD CHANGE		/MAKE NEW CDF INSTRUCTION
	DCA MEMFLD		/STORE
	JMP LOAD1		/GO GET NEXT DATA WORD

LOAD2,	SZA CLA			/IS THIS THE ORIGIN?
	JMP LOAD3		/NO
	JMS READCH		/YES, GO GET ANOTHER WORD
	TAD C100
LOAD3,	TAD CHAR		/GET THIS DATA ELEMENT
	TAD M40			/SUBTRACT 40 TO NORMALIZE
	DCA WORD1		/STORE FOR LATER
	JMS READCH		/GET NEXT DATA WORD
	TAD WORD1		/GET FIRST WORD
	CLL RTL			/SHIFT IT 6 PLACES
	RTL
	RTL
	TAD CHAR		/GET SECOND WORD
	TAD M40			/SUBTRACT 40 TO NORMALIZE
	SZL			/IS THIS AN ORIGIN WORD
	JMP MEMFLD		/NO, GO STORE THIS WORD
	DCA ORIGIN		/YES, STORE NEW ORIGIN WORD
	JMP LOAD1		/GO GET NEXT CHAR

MEMFLD,	0			/CURRENT MEMORY FIELD BEING LOADED
	DCA I ORIGIN		/STORE THIS WORD
CHANGE,	CDF			/GET BACK TO THIS MEMORY FIELD
	ISZ ORIGIN		/COUNT UP POINTER
	CLA			/COULD OVERFLOW
	JMP LOAD1		/GO GET NEXT CHAR

LODFLG,	0			/LOADING FLAG
FMASK,	7
C100,	100
ORIGIN,	0
/ROUTINES TO DUMP CORE

DUMPI,	ISZ DMPFLG		/MARK THAT A DUMP IS IN PROGRESS
	TAD CDMP1		/DUMMY UP THE PIVOT POINTER
	DCA DPIVOT
	DCA DCHKSM		/INITIALIZE CHKSUM FOR DUMP
	JMS STAPTO		/START DUMP GOING
	JMP I DISMIS		/RETURN

DUMP,	JMP I DPIVOT		/ENTER CORRECT PART OF DUMP CODE
DPIVOT,	0			/DUMP PIVOT
	AND C77			/STRIP OFF ALL BUT 6 BITS
	TAD C40			/ENTER HERE WITH DATA TO BE SENT
	DCA TEMP		/STORE THIS DATA ELEMENT
	TAD DCHKSM		/CALCULATE NEW CHKSUM
	TAD TEMP
	DCA DCHKSM
	TAD TEMP		/GET CHAR AGAIN
	JMP STAPT2		/GO TYPE IT OUT

DUMP1,	TAD DFIELD		/GET DATA FIELD
	AND FMASK		/MASK OUT UNWANTED BITS
	RTL			/SHIFT 3 LEFT
	RAL
	TAD CHANGE		/BUILD THE CDF INSTRUCTION
	DCA .+1
TEMP,	CDF			/CHANGE DATA FIELD
	TAD I DORG		/GET DATA WORD
	CDF			/GET BACK TO THIS FIELD
	JMS DMPWRD		/GO DUMP THIS WORD
	ISZ DORG		/INCREMENT ORIGIN POINTER
	CLA CLL			/COULD WRAP AROUND AND SKIP
	ISZ DCOUNT		/COUNT UP DUMP COUNTER
	JMP DUMP1		/GO SEND OUT NEXT ELEMENT
	TAD DCHKSM		/GET CHECK SUM
	JMS DMPWRD		/SEND IT OUT TO PDP-10
	DCA DMPFLG		/CLEAR DUMP IN PROGRESS FLAG
	JMP DMPRET		/RETURN TO STAPTO ROUTINE

DMPWRD,	0			/ROUTINE TO DUMP ONE WORD
	DCA WORD2		/SAVE WORD
	TAD WORD2		/GET WORD
	RTR
	RTR
	RTR			/GET LEFT MOST 6 BITS
	JMS DPIVOT		/GO SEND IT OUT
	TAD WORD2		/GET SECOND CHARACTER
	JMS DPIVOT		/SEND IT OUT
	JMP I DMPWRD		/RETURN

WORD2,	0
C77,	77
C40,	40
CDMP1,	DUMP1
DMPFLG,	0
DCHKSM,	0

*7600
CHKSUM,	0			/LOADER CHECKSUM VALUE

LOAD,	JMP I PIVOT		/LOAD THIS DATA WORD
PIVOT,	0			/JMS PIVOT CAUSES A WAIT FOR NEXT DATA ELEMENT
	JMP I DISMIS		/RETURN

READCH,	0			/READ IN NEXT DATA ELEMENT
	JMS PIVOT		/WAIT FOR NEXT CHARACTER
	TAD CHAR		/GET THE DATA ELEMENT
	TAD CHKSUM		/COMPUTE NEW CHECK SUM
	DCA CHKSUM
	JMP I READCH		/RETURN TO CALLER
TTOBUF=.			/TTY OUTPUT BUFFER
TOBFLN=100			/LENGTH OF TTY OUTPUT BUFFER

*TTOBUF+TOBFLN
PTOBUF=TTOBUF+TOBFLN		/PT08 OUTPUT BUFFER
POBFLN=40			/LENGTH OF PT08 BUFFER
$