Google
 

Trailing-Edge - PDP-10 Archives - BB-F494Z-DD_1986 - 10,7/p680.pal
There are 8 other files named p680.pal in the archive. Click here to see a list.
/P680-----X680 SYSTEM  V.0D  DEC-3-70-----
/USE WITH M680.MAC VERSIONS 0A OR LATER
VERZUN=400		/VERSION NUMBER (LOC 137)
/R.KRASIN

/-----CONDIT.ASSEMBLY SWITCHES--------------------
IFNDEF FTSIM<FTSIM=0>	/1: ...DA-10 SIMULATION
IFNDEF FTCKOV<FTCKOV=1>	/1: ASSEMBLE CODE FOR CHECKING CLOCK-OVERRUN

/-----PARAMETERS--------------------
IFNDEF CONX<CONX=030>	/'CONTROL-C' FOR X680 (030=^X)
IFNDEF SWIT0<SWIT0=0000>	/SWITCH-BITS TO BE FORCED TO 0
IFNDEF SWIT1<SWIT1=0000>	/SWITCH-BITS TO BE FORCED TO 1
IFNDEF OPLINE<OPLINE=CTYLIN>	/ OPERATOR LINE
IFNDEF HICORE<HICORE=7600>	/'TOP OF CORE' FOR X680 TABLES
IFNDEF MONQL<MONQL=10>	/LENGTH OF MONQ
IFNDEF MODQL<MODQL=20>	/LENGTH OF MODQ
IFNDEF MAPQL<MAPQL=10>	/LENGTH OF MAPQ
IFNDEF ERRQL<ERRQL=10>	/LENGTH OF ERRQ

/-----CONSTANTS
CCIPOL=4400	/TO-10 CODE FOR 'ARE YOU THERE?'
CCICOF=4401	/... 'CARRIER OFF' (MUST = CCICON-1)
CCICON=4402	/... 'CARRIER ON'
CCIRNG=4403	/... 'RINGING'
CCINIT=4404	/... '680 RESTART'
/-----IOTS-------------------------------------

		/-----CTY-----
CTISKP=6031	/SKIP IF INPUT (KEY-BOARD)
CTICLR=6032	/CLEAR IRP
CTRED=6034	/READ (OR) CTY INTO AC
CTOSKP=6041	/SKIP IF OUTPUT (PRINTER)
CTOCLR=6042	/CLEAR IRP
CTLOD=6044	/LOAD CTY BUFFER FROM AC

		/-----DA-10-----
DAISKP=6371	/SKIP IF INPUT (FM10 FULL)
DARED1=6352	/READ (OR) BITS 0-11 INTO AC
DARED2=6362	/...12-23...
DARED3=6372	/...34-35..., CLEAR 8I IRP. (FM10 FULL), & IRP. PDP-10 (FM10 EMPTY)
DAOSKP=6361	/SKIP IF OUTPUT (TO10 EMPTY)
DAOCLR=6351	/CLEAR OUTPUT BUFFER AND IRP. (TO10 EMPTY)
DALOD1=6354	/LOAD (OR) BITS 0-11 FROM AC
DALOD2=6364	/...12-23...
DALOD3=6374	/...24-35..., & IRP. PDP-10 (TO10 FULL)

		/-----DC08A-----
TTI=6402	/SCAN INPUT
TTO=6404	/SCAN OUTPUT
LSRINC=6401	/INCREMENT LSR (LINE SELECT REGISTER)
LSRCLR=6411	/CLEAR LSR
LSRLOD=6412	/LOAD (OR) LSR FROM AC(5-11)
LSRRED=6414	/READ (OR) LSR INTO AC(5-11)
LCCINC=6461	/INCREMENT LCC (LOADING CONTROL RCOUNTER
LCCCLR=6471	/CLEAR LCC
LCCLOD=6472	/LOAD (OR) LCC FROM AC(7-11)
LCCRED=6464	/READ (OR) LCC INTO AC(7-11)
CK1SKP=6421	/SKIP IF CLOCK-1
CK1OFF=6422	/CLEAR IRP. & TURN CLOCK-1 OFF
CK1ON=6424	/...ON
CK2SKP=6431	/CLOCK-2
CK2OFF=6432
CK2ON=6434
CK3SKP=6441	/CLOCK-3
CK3OFF=6442
CK3ON=6444
CK4SKP=6451	/CLOCK-4
CK4OFF=6452
CK4ON=6454

		/-----MISC.
PTPSKP=6021	/SKIP IF IH.SPEED PAPER TAPE PUNCH
PTPCLR=6022	/CLEAR IRP. FOR HI.SPEED PAPER TAPE PUNCH
PTRSKP=6011	/SKIP IF HI.SPEED PAPER TAPE READER
PTRRED=6012	/CLEAR IRP. & READ HI.SPEED PAPER TAPE READER
PARNOP=6101	/DONT SKIP IF MEM.PARITY ERROR
PARCLR=6104	/CLEAR IRP.
POWSKP=6102	/SKIP IF PLUG PULLED
IFZERO FT689<	/-----DC08F-----
MODCLR=6712	/CLEAR INTERRUPT ENABLE (PREVENT DC08F IRPS.)
MODLOD=6704	/LOAD...(ALLOW...)
RNGSKP=6701	/SKIP IF RING FLAG
RNGCLR=6734	/CLEAR IRP., INC. AND RESTART RING-SCANNER
RNGRED=6702	/READ (OR?) RING-SCANNER INTO AC(5-11)
CARSKP=6711	/SKIP IF CARRIER FLAG
CARCLR=6724	/CLEAR IRP., INC. AND RESTART CARRIER-SCANNER
CARRED=6714	/READ (OR?) CARRIER-SCANNER INTO AC(5-119
DTRCLR=6721	/CLEAR DATA-TERM.-READY FOR SELECTED LINE (AC(5-11))
DTRLOD=6731	/LOAD (SET)...
RTSCLR=6722	/CLEAR REQ.-TO-SEND FOR SELECTED LINE (AC(5-11))
RTSLOD=6732	/LOAD (SET)...
> /IFZERO FT689

IFNZRO FT689<	/-----689AG-----
MODCLR=6714	/CLEAR INTERRUPT ENABLE (PREVENT 689AG IRPS.)
MODLOD=6704	/LOAD...(ALLOW...)
GRPCLR=6721	/CLEAR GROUP COUNTER
GRPINC=6731	/INCREMENT...
RNGSKP=6701	/SKIP IF RING
RNGCLR=6742	/CLEAR IRP.
RNGRED=6702	/READ (OR) THIS GROUP'S RING BITS INTO AC
CARSKP=6711	/SKIP IF CARRIER
CARCLR=6741	/CLEAR IRP.
CARRED=6712	/READ (OR) THIS GROUP'S CARRIER BITS INTO AC
DTRCLR=6724	/CLEAR DATA-TERM.-READY FOR THIS GROUP IF AC-BIT=1
DTRLOD=6722	/LOAD (SET)...
RTSCLR=6734	/CLEAR REQ.-TO-SEND FOR THIS GROUP IF AC-BIT=1
RTSLOD=6732	/LOAD (SET)...

> /IFNZRO FT689
/-----OP-CODES & MACROS-----

FIXMRI INC=2000

DEFINE CALL NAME<
	JMS I	[NAME]>

SKPE=	SZA
SKPNE=	SNA
SKPL=	SMA
SKPLE=	SMA SZA
SKPG=	SPA SNA
SKPGE=	SPA

LAC1=	CLA IAC
LAC2=	CLA CLL IAC RAL
LAC3=	CLA STL IAC RAL
LAC4=	CLA CLL IAC RTL
LAC6=	CLA STL IAC RTL
LACM1=	STA
LACM2=	STA CLL RAL
LACM3=	STA CLL RTL
/-----I-ROUTINE MACROS-----

	DEFINE	IROT	XXX NEXXXX
<	XLIST

/XXX    I-ROUTINE NAME (ENTRY ADDRESS)
/NEXXXX JUMP ADDRESS OF NEXT ROUTINE

NEXXXX=	PSNEXT
PSNEXT=	XXX
	XLIST>
/-----N-ROUTINE MACROS-----

	DEFINE	NLEVEL	FSTROT
<	XLIST

/FSTROT--HIGHEST PRIORITY N-ROUTINE OF THIS LEVEL
/NLEVEL MACROS MUST BE LISTED IN ORDER OF DECREASING PRIORITY
/NROT MACROS MUST FOLLOW EACH NLEVEL MACRO IN ORDER OF INCREASING PRIORITY

LEVNUM=	LEVNUM+1		/COUNT NO. OF LEVELS
PSEXIT=	JMP I [FSTROT]
LEVPC=	.
LEVLEN=	.
PSREQ=	DCA I [.]

	JMP	.+21	/MODIFIED TO 0 IF THIS LEVEL NOT IDLE
	TAD	.+10	/GET SAVED PC
	SKPNE		/0?
	JMP	.+10	/YES--ENTER 1ST ROUTINE
	DCA	PSPC	/NO---RESUME WHERE INTERRUPTED
	TAD	.+3	/GET SAVED AC
	JMS	PSAVE	/SETUP PSAVE
	.		/THIS ADDRESS
	0		/AC SAVE FOR THIS LEVEL
PSIRP=	JMS I [.]
LEVPC=	.-LEVPC	/DISPLACEMENT OF PC-SAVE FROM BEG. OF NLEVEL MACRO
	0		/PC SAVE FOR THIS LEVEL
	JMP	PSCAN	/USED ON PROG. IRP. (IRPXXX)
	TAD	.-4	/SETUP PSAVE
	DCA	PSAVE
	PSEXIT
PSNEXT=	.
	TAD	(JMP .+3)/HERE TO EXIT FROM LEVEL
	DCA	.-17	/SET LEVEL IDLE
	DCA	.-7

LEVLEN=	.-LEVLEN	/LENGTH OF NLEVEL MACRO
	XLIST
>



	DEFINE	NROT	XXX NEXXXX XITXXX IRPXXX REQXXX
<	XLIST

/XXX    N-ROUTINE NAME (ENTRY ADDRESS)
/NEXXXX JUMP ADDRESS FOR NEXT ROUTINE (PRIORITY CHAINING)
/XITXXX THE EXIT OP-CODE
/IRPXXX THE PSUDO-INTERRUPT OP-CODE
/REQXXX THE REQUEST-TO-SCHEDULE OP-CODE

NEXXXX=	PSNEXT
PSNEXT=	XXX
XITXXX=	PSEXIT
IRPXXX=	PSIRP
REQXXX=	PSREQ
	XLIST
>
/-----QUEUE MACROS-----

	DEFINE	QHEAD	XXXQA XXXQL
<	XXXQA		/QUEUE ADDRESS
	XLIST
	-XXXQL		/QUEUE LENGTH
	XXXQA		/PUT POINTER
	-XXXQL		/PUT RECYCLE COUNTER
	XXXQA		/GET POINTER
	-1		/GET RECYCLE COUNTER
	-XXXQL-1	/INPUT FREE COUNTER
	XLIST
>

	DEFINE	GET	XXXQ
/AC MUST = 0
<	XLIST
	ISZ	XXXQ+5
	JMP	.+5
	TAD	XXXQ+0	/RECYCLE
	DCA	XXXQ+4
	TAD	XXXQ+1
	DCA	XXXQ+5
	LACM1
	TAD	XXXQ+6
	DCA	XXXQ+6
	TAD I	XXXQ+4
	INC	XXXQ+4
	XLIST
>

	DEFINE	PUT	XXXQ XXXFUL
/AC RETURNED 0
<	XLIST
	ISZ	XXXQ+6
	JMP	.+4
	JMS I	[QOFLOW]
	DCA	XXXQ+6
	JMP	XXXFUL	/QUEUE OVERFLOW
	DCA I	XXXQ+2
	INC	XXXQ+2
	ISZ	XXXQ+3
	JMP	.+5
	TAD	XXXQ+0	/RECYCLE
	DCA	XXXQ+2
	TAD	XXXQ+1
	DCA	XXXQ+3
	XLIST
>
	DEFINE	GET1	XXXQ
/AC MUST = 0
<	XLIST
	ISZ	XXXQ+5
	JMP	.+5
	TAD	XXXQ+0	/RECYCLE
	DCA	XXXQ+4
	TAD	XXXQ+1
	DCA	XXXQ+5
	TAD I	XXXQ+4
	INC	XXXQ+4
	XLIST
>
	DEFINE	GET2	XXXQ
/AC NEED NOT = 0
<	XLIST
	LACM1
	TAD	XXXQ+6
	DCA	XXXQ+6
	TAD I	XXXQ+4
	INC	XXXQ+4
	XLIST
>
	DEFINE	PUT1	XXXQ XXXFUL
/AC RETURNED 0
<	XLIST
	ISZ	XXXQ+6
	JMP	.+4
	JMS I	[QOFLOW]
	DCA	XXXQ+6
	JMP	XXXFUL	/QUEUE OVERFLOW
	DCA I	XXXQ+2
	INC	XXXQ+2
	XLIST
>
	DEFINE	PUT2	XXXQ
/AC RETURNED 0
<	XLIST
	DCA I	XXXQ+2
	INC	XXXQ+2
	ISZ	XXXQ+3
	JMP	.+5
	TAD	XXXQ+0	/RECYCLE
	DCA	XXXQ+2
	TAD	XXXQ+1
	DCA	XXXQ+3
	XLIST
>
	DEFINE	SKPQE	XXXQ
/SKIP IF QUEUE EMPTY
/AC MUST = 0
/AC RETURNED 0
<	XLIST
	TAD	XXXQ+6
	CMA
	TAD	XXXQ+1
	SKPE CLA
	XLIST
>
	DEFINE	SKPQNE	XXXQ
/SKIP IF QUEUE NOT EMPTY
/AC MUST = 0
/AC RETURNED 0
<	XLIST
	TAD	XXXQ+6
	CMA
	TAD	XXXQ+1
	SKPNE CLA
	XLIST
>

	DEFINE	SKPQNF	XXXQ
/SKIP IF QUEUE NOT FULL
/RETURN AC=0
<	XLIST
	LAC1
	TAD	XXXQ+6
	SKPL CLA
	XLIST
>
/-----PAGE ZERO CODE

*0		/-----INTERRUPT SERVICE
	0
	DCA I	PSAVE	/MODIFIED BY THE ILEVEL MACRO
	TAD	0
IRPJ1,	DCA I	PSAVE
IRPJ2,	JMP I	[CLK]

*5
	START	/USED FOR RESTART


*10		/-----AUTO INDEX REGISTERS
AX0,	0	/GENERAL PURPOSE (IOF)
AX1,	0	/QFLUSH
AX2,	0	/QFLUSH
AX3,	0
AX4,	0
AX5,	0
AX6,	0
/AX7,	0	/USED BY NLEVEL MACRO


*17		/-----N-ROUTINE SERVICE
PSAVE,	0		/PTR. TO AC & PC SAVE AREA (SET WITH A JMS)
	ION
	JMP I	PSPC
PSPC,	0

		/-----MORE INTERRUPT SERVICE
IRPNOT,	ISZ	BADIRP	/HERE IF CANT FIND IRP
	JMP	PSCAN0
HLTIRP,	HLT		/4096 MYSTERIOUS IRPS
	JMP	PSCAN0

		/-----CLOCK DISPATCH
CK0ION,	CK01
IFNZRO CNUM-1<
CK1ION,	CK11
	JMP	CKION
IFNZRO CNUM-2<
CK2ION,	CK21
	JMP	CKION
IFNZRO CNUM-3<
CK3ION,	CK31
	JMP	CKION
>>> /IFNZRO CNUM-1 ... CNUM-3
/-----PAGE ZERO VARIABLES

ZCORE=.		/-----CORE TO BE CLEARED ON START
PDP10F,	0	/USED FOR TESTING PDP-10 PRESENCE
PDP10D,	0	/1 IF PDP-10 THOUGHT DOWN
PDP10I,	0	/-1: INHIBIT/IGNORE PDP-10 INTERRUPTS
DAOBZ,	0	/DA-10 OUTPUT BUSY FLAG
CTOBZ,	0	/CTY OUTPUT BUSY FLAG
CTOBUF,	0	/CTY OUTPUT BUFFER
MONACK,	0	/SET 1 TO ACK MON
ZCORK=.-ZCORE	/-----END OF START CLEAR

CHARAC,	0	/CHARACTER ON SUBROUTINE CALLS
TTCHAR,	0	/...
LINUMB,	0	/LINE NUMBER...

MAPL,	0	/STUFF FOR MAP
MAPC,	0	/...
MAPT,	0	/...
IFNZRO FTMOD<
MODL,	0	/STUFF FOR MOD
MODC,	0	/...
MODMLT,	0	/...
MODFLG,	0	/1: DISABLE MODEM CONTROL
IFNZRO FT689<
M689M,	0
> /IFNZRO FT689
> /IFNZRO FTMOD
MONSLF,	0	/STUFF FOR MON
MONLOC,	0	/...
MONNUM,	0	/...
MONNUF,	0	/...
MONTEM,	0	/...
OPRLIN,	-1	/OPERATOR LINE NUM. (-1 IF NONE)
SPYLIN,	-1	/CURRENT 'TALK' OR 'SPY' LINE NUM. (-1 IF NONE)
SPYACK,	0	/COUNT ACK'S FOR SPY LINE
SWITCH,	0	/CONSOLE SWITCHES
TEMP,	0	/GLOBAL TEMPORARY
TEMP1,	0	/...
TIKTIK,	-BAUD	/COUNT TICKS
NULDIS,	0	/FOR NULL DISPLAY
NULCTR,	-310	/...

DAOPUJ,	DAOPUT	/JMS ADDRESSES FOR DA-10 ROUTINES
DAOQUJ,	DAOQUE	/   MODIFIED TO NILROT WHEN
DAOUTJ,	DAOUT	/   PDP10I=-1


*100		/-----FIXED LOCATIONS
DAY,	0	/(100)--OCTAL DAY
TIME,	0	/(101)--LH=OCTAL HOUR, RH=OCTAL MIN.
BADIRP,	0	/(102)--NUMBER OF UNIDENTIFIED INTERRUPTS
BADQUE,	0	/(103)--NUMBER OF QUEUE OVERFLOWS
	0	/(104)--UNUSED
CK1OVR,	0	/(105)--NUMBER OF TIMES OVERAN CLOCK-1 INTERRUPT
CK2OVR,	0	/(106)--...CLOCK-2...
CK3OVR,	0	/(107)--...CLOCK-3...
CK4OVR,	0	/(110)--...CLOCK-4...


*137		/(137)-----VERSION NUMBER
VERZUN

IFNZRO FTSIM<
SIMAD1,	0	/STUFF FOR SIMCK
SIMAD2,	NUMLIN-1
SIMFLG,	-1
> /IFNZRO FTSIM
/-----STARTING ADDRESSES

*200

START,	IOF	/200-217 ALL VALID STARTING ADDRESSES
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF
	IOF	/ONE EXTRA SINCE 8/I RESTARTS WITH LOAD ADDR.,EXAMINE,CONT.

	CLA
	TAD	(-ZCORK)/CLEAR SOME CORE
	DCA	TEMP
	TAD	(ZCORE-1)
	DCA	AX0
START1,	DCA I	AX0
	ISZ	TEMP
	JMP 	START1

	CALL	QFLUSH	/FLUSH ALL QUEUES
	DAOQ
	CALL	QFLUSH
	MAPQ
	CALL	QFLUSH
	ERRQ
	JMP	CLKINI	/INIT THE CLOCKS
CLKINX,			/RETURN FROM CLKINI
IFNZRO FTMOD<
	JMS	MODINI	/INIT THE MODEMS
> /IFNZRO FTMOD

IFZERO FTMOD<
	MODCLR		/IF NO MODEM CONTROL, DISABLE IRPS
> /IFZERO FTMOD
	LACM1		/READ & OBEY SWITCHES
	JMS	SWICH

IFNZRO FTSIM <
	LACM1
	DCA	SIMFLG
> /IFNZRO FTSIM

	DCA	PSCAN	/INIT ALL N-LEVELS
	DCA	PSCAN+LEVPC
	DCA	PSCAN+LEVLEN
	DCA	PSCAN+LEVLEN+LEVPC

	TAD	(CCINIT)/TELL THE PDP-10 WEVE RESTARTED
	DCA	CHARAC
	JMS I	DAOPUJ
	JMP	PSCAN0
/-----I-LEVEL PRIORITY AND LINKAGE-----

IRPXIT,	CLA		/HERE ON EXIT FROM I-ROUTINE
	TAD	IRPJ2	/TAKE ANY WAITING IRPS
	ION
	DCA	1
	IOF
PSCAN0,	TAD	IRPJ1
	DCA	1

XITIRP=	JMP I [IRPXIT]
PSNEXT=	IRPNOT
LEVNUM=	0

/IROT MACROS MUST FOLLOW IN ORDER OF INCREASING PRIORITY

IROT	UNS,NEXUNS/UNSUPPORTED & SPECIAL HARDWARE
IFNZRO FTMOD<
IROT	DSC,NEXDSC/DATA-SET CONTROL
> /IFNZRO FTMOD
IROT	CTY,NEXCTY/CONSOLE TTY
IROT	DAI,NEXDAI/DA-10 INPUT (FROM-10)
IROT	DAO,NEXDAO/DA-10 OUTPUT (TO-10)
IROT	CLK,NEXCLK/THE CLOCKS

PSCAN,			/N-ROUTINE SERVICE BEGINS HERE

/NLEVEL MACROS MUST FOLLOW
/-----N-LEVEL PRIORITY AND LINKAGE-----



		/-----LEVEL-1
IFZERO	FTSIM <
NLEVEL	MAP
NROT	MAP,NEXMAP,XITMAP,IRPMAP,REQMAP
> /FTZERO FTSIM

IFNZRO	FTSIM <
NLEVEL	SIM
NROT	MAP,NEXMAP,XITMAP,IRPMAP,REQMAP
NROT	SIM,NEXSIM,XITSIM,IRPSIM,REQSIM
> /IFNZRO FTSIM

NLEVEL	MON	/-----LEVEL-2

NROT	TIK,NEXTIK,XITTIK,IRPTIK,REQTIK
IFNZRO FTMOD<
NROT	MOD,NEXMOD,XITMOD,IRPMOD,REQMOD
> /IFNZRO FTMOD
NROT	MON,NEXMON,XITMON,IRPMON,REQMON
/NULL JOB
/--------
/ MUST IMMEDIATELY FOLLOW LAST NROT MACRO

NULJB0,	TAD	NULJPC
NULJB1,	DCA	PSPC
	TAD	NULJAC
	JMS	PSAVE
NULJSA,	NULJOB		/NULL JOB SA
NULJAC,	0		/NULL JOB AC
NULJPC,	NULJOB		/NULL JOB PC
NULJOB,	ISZ	NULK	/COMPUTE NULL DISPLAY
	JMP	NULJOB
	IOF		/HERE EVERY MILLISECOND OF NULL TIME
	CLA
	TAD	(-336)
	DCA	NULK
	ISZ	NULCTR
	JMP	NULJO2
	TAD	NULDIS	/HERE EVERY 20 MILLISECONDS OF NULL TIME
	STL RAL
	DCA	NULDIS
	TAD	(-24)
	DCA	NULCTR
NULJO2,	TAD	NULJAC
	ION
	JMP	NULJOB

NULK,	-336


/NILL ROUTINE
/------------

NILROT,	0
	CLA
	JMP I	NILROT


	PAGE
/-----DA-10 OUTPUT INTERRUPT SERVICE

IFZERO FTSIM <
DAO,	DAOSKP		/OUR INTERRUPT?
	JMP	NEXDAO	/NO
	DAOCLR		/YES-CLEAR IRP. AND BUFFER

	DCA	PDP10F	/THE PDP-10 IS STILL THERE!
	DCA	DAOBZ	/CLEAR BUSY FLAG
	JMS I	DAOUTJ
	XITIRP


/-----SUBROUTINE TO OUTPUT NEXT THING IN QUEUE IF ANY

DAOUT,	0
	SKPQNE	DAOQ	/ANYTHING IN THE QUEUE?
	JMP I	DAOUT	/NO--EXIT

	DAOCLR		/YES-OUTPUT IT
	GET1	DAOQ
	DALOD2
	GET2	DAOQ
	DALOD3
	CLA
	INC	DAOBZ	/SET BUSY FLAG
	JMP I	DAOUT	/   AND EXIT
> /IFZERO FTSIM

IFNZRO FTSIM <
DAO,	DAOSKP
	JMP	NEXDAO
	DAOCLR
	XITIRP

DAOUT,	0
	SKPQNE	DAOQ
	JMP I	DAOUT
	GET1	DAOQ
	DCA	LINUMB	/LINE NUM.
	GET2	DAOQ
	DCA	CHARAC	/   AND CHARACTER
	CALL	PDP10	/CALL PDP-10 SIMULATOR
	JMP I	DAOUT


> /IFNZRO FTSIM
/-----SUBROUTINE TO OUTPUT (OR QUEUE) TO THE DA-10
/
/ CHARAC=CHARACTER
/ LINUMB=LINE NUMBER

IFZERO FTSIM <
DAOPUT,	0
	TAD	DAOBZ	/IS DA-10 BUSY?
	SKPNE CLA
	JMP	DAOPU1	/NO
	TAD	LINUMB	/YES-QUEUE IT
	JMS I	DAOQUJ
	JMP I	DAOPUT


DAOPU1,	DAOCLR		/CLEAR BUFFER
	TAD	LINUMB	/   OUTPUT IT
	DALOD2
	CLA
	TAD	CHARAC
	DALOD3
	CLA
	INC	DAOBZ	/   AND SET BUSY FLAG
	JMP I	DAOPUT

> /IFZERO FTSIM

IFNZRO FTSIM <
DAOPUT,	0
	TAD	DAOBZ	/BUSY? (I.E. IS SIM RUNNING?)
	SKPNE CLA
	JMP DAOPU1	/NO
	TAD	LINUMB	/YES-QUEUE IT
	JMS I	DAOQUJ
	JMP I	DAOPUT

DAOPU1,	CALL	PDP10	/MAKE LIKE A PDP-10
	JMP I	DAOPUT

> /IFNZRO FTSIM


/-----SUBROUTINE TO QUEUE FOR THE DA-10
/ CALLED FROM TTIX & TTOX SO MUST BE FAST
/
/ CHARAC=CHARACTER
/ AC=LINE NUMBER

DAOQUE,	0
	PUT1	DAOQ,DAOQUF
	TAD	CHARAC
	PUT2	DAOQ
DAOQUF,	JMP I	DAOQUE

DAOQ,	QHEAD	DAOQA,DAOQL	/QUEUE HEADER
/-----DA-10 INPUT INTERRUPT SERVICE

IFZERO FTSIM <
DAI,	DAISKP		/FOR US?
	JMP	NEXDAI	/NO

	DCA	PDP10F	/RESET QUERY FLAG
	TAD	PDP10I	/LISTENING TO THE 10?
	SKPNE CLA
	JMP	DAI2	/YES
	DARED3		/NO--JUST CLEAR THE IRP
	CLA
	XITIRP

DAI2,	DARED2		/GET LINE NUM.
	DCA	LINUMB
	DARED3		/GET CHAR. AND CLEAR IRP.
	SKPGE		/MODEM CONTROL?
	JMP	DAI6	/YES

	DCA	TTCHAR	/NO--SAVE CHAR.
	TAD	LINUMB
	TAD	[LPTABB]
	DCA	TEMP
	TAD I	TEMP	/GET LPTAB ENTRY
	SKPGE		/SPECIAL PROCESSING?
	JMP	DAI3	/YES
	CALL	TTOPUT	/NO--TRANSFER TO ONE OF THE TTO BUFFERS
	XITIRP


DAI3,	CLA		/CALL MAP FOR OUTPUT
	TAD	TTCHAR
	DCA	CHARAC
	TAD	LINUMB
	CMA
	CALL	MAPPUT
	XITIRP


DAI6,
IFNZRO FTMOD<
	CALL	MODPUT
	XITIRP
> /IFNZRO FTMOD
IFZERO FTMOD<
	CLA
	XITIRP
> /IFZERO FTMOD


> /IFZERO FTSIM


IFNZRO FTSIM <
DAI,	DAISKP
	JMP	NEXDAI
	DARED3
	CLA
	XITIRP
> /IFNZRO FTSIM


	PAGE
/-----SUBROUTINE TO DO SOMETHING WITH SOMETHING GOING TO THE PDP-10
/ CHARAC=CHARACTER
/ LINUMB=LINE NUM.

IFNZRO FTSIM <
PDP10,	0
	LAC1		/SET BUSY FLAG
	DCA	DAOBZ
	REQSIM		/AND REQUEST SIM
	TAD	CHARAC	/IS IT MODEM CONTROL?
	SKPGE CLA
	JMP I	PDP10	/YES--IGNORE
	TAD	LINUMB	/GET LINE NUM.
	TAD	[LINTAB]
	DCA	TEMP
	TAD I	TEMP	/LOOK AT BITS 0-1
	RAL
	SZL
	JMP	PDP103
	SKPL CLA
	JMP I	PDP10	/(0)-IGNORE
PDP100,	TAD	(052)	/(1)-SUSTAINED OUTPUT
PDP101,	AND	[177]
	DCA	TTCHAR
	TAD	LINUMB	/    ADDRESS LPTAB
	TAD	[LPTABB]
	DCA	TEMP
	TAD I	TEMP	/    TO THE SCANNER OR MAP?
	SKPGE
	JMP	PDP102	/    MAP
	CALL	TTOPUT	/    SCANNER
	JMP I	PDP10
PDP102,	CLA
	TAD	TTCHAR
	DCA	CHARAC
	TAD	LINUMB
	CMA
	CALL	MAPPUT
	JMP I	PDP10

PDP103,	RAL		/SAVE SIGN IN LINK
	CLA		/IS IT AN ACK?
	TAD	CHARAC
	SKPNE
	JMP I	PDP10	/YES-IGNORE IT
	SNL		/NO--WHAT CODE?
	JMP	PDP101	/(2)-ECHO INPUT
	CLA		/(3)-SUSTAINED INPUT & ECHO
	TAD	TEMP
	TAD	(SIMTAB-LINTAB)/ADDRESS SIMTAB
	DCA	TEMP
	TAD I	TEMP
	SKPNE
	JMP I	PDP10	/ITS 0 SO IGNORE IT
	DCA	TEMP
	TAD I	TEMP	/ZAP THE TTI INSTRUCTION
	AND	(1770)
	TAD	(4000)
	DCA I	TEMP
	INC	TEMP
	TAD I	TEMP
	CLL RAR
	DCA I	TEMP
	JMP 	PDP100	/AND ECHO SOMETHING OUT
/-----ROUTINE TO KEEP PDP10 GOING ONCE ITS STARTED

SIM,	TAD	DAOBZ	/BUSY FLSG?
	SKPNE CLA
	JMP	NEXSIM	/NO--NOT FOR US
SIM0,	ION		/YES-CALL DAOUT LIKE DA-10 IRP WOULD
	CLA
	IOF
	DCA	DAOBZ
	JMS I	DAOUTJ
	ION
	NOP
	IOF
	TAD	DAOBZ	/MORE?
	SKPE CLA
	JMP	SIM0	/YES
	XITSIM		/NO

> /IFNZRO FTSIM
	PAGE

/-----CONSOLE TTY INTERRUPT SERVICE

CTY,	CTOSKP		/PRINTER?
	JMP	CTI	/NO
	CTOCLR		/YES-CLEAR IRP.
	DCA	CTOBZ	/    AND BUSY FLAG
	JMS	CTYOUT	/OUTPUT BUFFER IF NECESSARY
	XITIRP

CTI,	CTISKP		/KEYBOARD?
	JMP	NEXCTY	/NO
	CTICLR CTRED	/YES-CLEAR IRP. & READ IT
	DCA	CHARAC
	TAD	(CTYLIN)
	CALL	MAPPUT
	XITIRP


/-----SUBROUTINE TO OUTPUT CHAR ON CTY
/
/	TAD	CHARACTER
/	CALL	CTYPUT
/	...		/RETURN AC=0

CTYPUT,	0
	DCA	CTOBUF	/STORE IN BUFFER
	TAD	CTOBZ	/BUSY?
	SKPNE CLA
	JMS	CTYOUT	/NO--OUTPUT IT
	JMP I	CTYPUT

CTYOUT,	0	/-----TYPE AND ACK. CHAR. IN BUFFER (IF ANY)
	TAD	CTOBUF	/ANYTHING IN BUFFER?
	SKPNE
	JMP I	CTYOUT	/NO
	CTLOD		/YES-OUTPUT IT
	CLA
	DCA	CHARAC
	TAD	(CTYLIN)/   AND ACKNOWLEDGE
	CALL	MAPPUT
	DCA	CTOBUF	/CLEAR BUFFER
	INC	CTOBZ	/   AND SET BUSY
	JMP I	CTYOUT
/-----TTI SERVICE

TTIX,	0
	DCA	CHARAC	/SAVE RAW CHARACTER
	TAD	(-4)	/ADDRESS LSW
	TAD	TTIX
	DCA	AX0	/   WITH AUTO-INDEX
	LSRRED		/RESET LSW WITH PORT NUM.
	CLL RAL
	RTL
	DCA I	AX0
	LSRRED		/ADDRESS PLTAB
	TAD	[PLTABB]
	DCA	TTITA
	TAD I	TTITA	/DISPATCH ACCORDING TO CHAR.FORMAT--PLTAB(1-2)
	RTL
	SZL
	JMP	TTI4	/(2) & (3)

TTI00,	/-----(0) & (1) HERE FOR 11-BIT AND 10-BIT CODE
	CLA STL RTR	/INIT CAW WITH 2000
	DCA I	AX0
	TAD	CHARAC	/GET CHAR
	RAR
TTI001,	RTR
	AND	(777)	/LEAVE STOP BIT FOR 'RECEIVE' FLAG
	DCA	CHARAC
	SZL		/WAS THERE A START BIT?
	JMP	TTIXIT	/NO--MUST HAVE BEEN NOISE
	TAD I	TTITA	/YES-GET PLTAB ENTRY
	SKPGE		/SPECIAL MAPPING?
	JMP	TTI3	/YES
	AND	[177]	/NO--SEND IT TO THE DA-10
	JMS I	DAOQUJ


TTIXIT,	LCCINC		/BUMP LOAD CONTROL CTR.
	JMP I	TTIX

TTI3,	AND	[377]	/QUEUE FOR MAP ROUTINE
	CALL	MAPPUT
	JMP	TTIXIT

TTI4,	SKPGE CLA
	JMP	TTI03
	TAD	(1000)	/(2)--CAW=1000
	DCA I	AX0
	TAD	CHARAC
	STL RTR		/STL FOR 'REC' FLAG
	JMP	TTI001

TTI03,	TAD	(200)	/CAW
	DCA I	AX0
	TAD	CHARAC
	STL RTR
	STL RTR		/STL FOR 'REC' FLG
	JMP	TTI001

TTITA,	0
/HERE ON QUEUE OVERFLOW

QOFLOW,	0
	CLA
	TAD	QOFLOW	/PRINT ADDRESS OF PUT MACRO
	CALL ERRPUT
	0000		/THE CODE FOR QUEUE-OVERFLOW
	INC	BADQUE	/BUMP THE COUNTER
	NOP
	LACM1
	JMP I	QOFLOW


	PAGE
/-----TTO SERVICE

TTOX,	0
	DCA	TTOK	/SET 'LOAD CONTROL CTR.'
	TAD I	TTOX	/GET TTO TABLE ADDRESS
	DCA	TTOAX
	DCA	CHARAC	/0 CHARACTER FOR ACK CALLS TO DAOQUE
	JMP	TTO0


TTO00,	LACM1
	DCA	TTOK
TTO0,	TAD I	TTOAX	/GET A PORT NUMBER
	SKPGE		/NEGATIVE?
	JMP	TTO3	/YES-FINISHED
	LSRCLR LSRLOD	/NO--SET LINE SEL.REG.
	TAD	(TTOSHB)/    AND ADDRESS THIS PORT'S SHIFT WORD
	DCA	TTOSA

	TAD I	TTOSA	/CHAR. IN PROGRESS?
	SKPNE
	JMP	TTO0	/NO--CHECK NEXT PORT
TTO1,	TTO		/YES-PUSH ANOTHER BIT OUT
	SKPNE		/LAST BIT?
	JMP	TTO4	/YES
TTO2,	DCA I	TTOSA	/NO--SAVE REMAINING BITS
	JMP	TTO0	/AND  LOOK AT NEXT PORT

TTO3,	DCA I	TTOX	/STORE NEXT TABLE ADDRESS BACK AT JMS
	INC	TTOX	/   AND RETURN
	JMP I	TTOX

TTO4,	ISZ	TTOK	/CHECK LOAD-CONTROL CTR
	SKP
	JMP	TTO00	/DONT FINISH ANY MORE CHAR.'S THIS TICK
	TAD	TTOSA	/ADDRESS TTOBUF
	TAD	(TTOBUF-TTOSHF)
	DCA	TTOBA
	TAD I	TTOBA	/BUFFERED CHAR.?
	SKPNE
	JMP	TTO2	/NO
TTO5,	DCA I	TTOSA	/YES-MOVE IT TO TTOSHF
	DCA I	TTOBA	/    AND CLEAR TTOBUF
	LSRRED		/ADDRESS PLTAB
	TAD	[PLTABB]
	DCA	TTOPL
	TAD I	TTOPL	/GET LINE NUMBER
	SKPGE		/SPECIAL MAPPING?
	JMP	TTO6	/YES
	AND	[177]	/NO--ACK DIRECTLY TO THE DA-10
	JMS I	DAOQUJ
	JMP	TTO0

TTO6,	AND	[377]	/LET MAP ROUTINE HANDLE THIS ACK
	CALL	MAPPUT
	JMP	TTO0

TTOAX=AX0
TTOSA,	0
TTOBA,	0
TTOPL,	0
TTOK,	0
/-----SUBROUTINE TO PUT CHARACTER IN RIGHT TTO BUFFER
/ CALLED BY DAI SO MUST BE REASONABLY FAST
/
/TTCHAR=CHARACTER
/LINUMB=LINE NUMBER
/AC=LPTAB ENTRY (OR PORT NUM.)

TTOPUT,	0
	AND	[177]	/ADDRESS PLTAB
	TAD	[PLTABB]
	DCA	TTOPUP
	TAD	TTOPUP	/ADDRESS TTOSHF
	TAD	(TTOSHF-PLTAB)
	DCA	TTOPUB
	TAD I	TTOPUB	/IS TTOSHF EMPTY?
	SKPNE CLA
	JMP	TTOPU0	/YES
	TAD	TTOPUB	/NO--ADDRESS TTOBUF
	TAD	(TTOBUF-TTOSHF)
	DCA	TTOPUB
	JMP	TTOPU2

TTOPU0,	DCA	CHARAC	/ACK THIS LINE
	TAD I	TTOPUP	/SPECIAL MAPPING?
	SKPGE CLA
	JMP	TTOPU1	/YES-LET MAP DO IT
	JMS I	DAOPUJ	/NO--GIVE TO DAO
	JMP	TTOPU2
TTOPU1,	TAD	LINUMB
	CALL	MAPPUT

TTOPU2,	TAD I	TTOPUP	/GET PLTAB ENTRY
	RTL		/   AND DISPATCH ON CHAR. FORMAT (BITS 1-2)
	SZL
	JMP	TTOP3	/(2) & (3)
	SKPL CLA
	TAD	(1400-400)/(0)--11 BIT CODE (2 STOP BITS)
	TAD	(400)	/(1)--10 BIT CODE (1 STOP BIT)
TTOP1,	TAD	TTCHAR
	CLL RAL		/ADD START BIT
	DCA I	TTOPUB
	JMP I	TTOPUT

TTOP3,	SKPGE CLA
	TAD	(140-200)/(3)--8 BIT CODE (BAUDOT?)
	TAD	(200)	/(2)---9 BIT CODE (2741?)
	JMP	TTOP1

TTOPUB,	0
TTOPUP,	0
/-----UNSUPPORTED HARDWARE INTERRUPTS

UNS,	PARNOP
	SKP
	JMP	NEXUNS
	PARCLR
	HLT
	XITIRP


	PAGE
/-----SUBROUTINE TO QUEUE SOMETHING FOR MAP
/ CALLED BY TTIX & TTOX SO MUST BE FAST
/
/CHARAC=CHARACTER
/AC=LINE NUMBER

MAPPUT,	0
	PUT1	MAPQ,MAPPUF
	TAD	CHARAC
	PUT2	MAPQ
MAPPUF,	REQMAP
	JMP I	MAPPUT


MAPQ,	QHEAD	MAPQA,MAPQL	/THE QUEUE HEADER
/-----THE MAP ROUTINE
/
/IF LINE NUM. IS NEGATIVE(1'S COMP.): CHAR. IS FOR OUTPUT (TO THE TERMINALS)
/IF LINE NUM. IS POSITIVE THEN:
/	IF CHARACTER NOT 0: CHAR. IS FOR INPUT (FROM THE TERMINALS)
/	IF CHARACTER =0: IT IS AN OUTPUT ACKNOWLEDGMENT
/IF ABS(LINE NUM.) .GE. 200 ITS IGNORED (NULL LINE)

MAP,	SKPQNE	MAPQ	/ANYTHING IN QUEUE?
	JMP	NEXMAP	/NO
MAP0,	GET1	MAPQ	/YES-GET LINE NUM.
	DCA	MAPL
	GET2	MAPQ
	ION
	DCA	MAPC

MAP01,	TAD	MAPL	/INPUT? (FROM TERMINALS)
	SKPL
	JMP	MAP1	/YES
	CMA
	DCA	MAPL	/NO--OUTPUT
	TAD	(JMP I MAPODP)
	JMP	MAP2
MAP1,	CLA
	TAD	(JMP I MAPIDP)
MAP2,	DCA	MAP3
	TAD	(200)	/NULL LINE OR PORT?
	AND	MAPL
	SKPE CLA
	JMP	MAPXIT	/YES - IGNORE IT
	TAD	MAPL	/ADDRESS LINTAB
	TAD	[LINTAB]
	DCA	MAPT
	TAD	(30)	/NULL LINE?
	AND I	MAPT
	SKPNE CLA
	JMP	MAPXIT	/YES - IGNORE IT
	TAD I	MAPT	/   AND DISPATCH ON LINE STATE (BITS 9-11)
	AND	[7]
	TAD	MAP3
	DCA	MAP3
	TAD	MAPC	/   WITH CHAR. IN AC
MAP3,	NOP		/***MODIFIED FOR DISPATCH

MAPIDP,	/-----DISPATCH FOR INPUT (& ACK)
	MAPIJ		/(0)--NORMAL JOB TERMINAL
	MAPIO		/(1)--OPERATOR
	MAPIS		/(2)--SPY
	MAPIT		/(3)--TALK
	MAPXIT		/(4)--NOT USED
	MAPXIT		/(5)--NOT USED
	MAPXIT		/(6)--NOT USED
	MAPXIT		/(7)--NOT USED

MAPODP,	/-----DISPATCH FOR OUTPUT
	MAPOJ		/(0)--NORMAL
	MAPOO		/(1)--OPERATOR
	MAPOS		/(2)--SPY
	MAPOT		/(3)--TALK
	MAPXIT		/(4)--NOT USED
	MAPXIT		/(5)--NOT USED
	MAPXIT		/(6)--NOT USED
	MAPXIT		/(7)--NOT USED


MAPXIT,	ION
	CLA
	IOF
	SKPQNE	MAPQ	/ANYMORE?
	XITMAP		/NO
	JMP	MAP0	/YEP

	PAGE
MAPIJ,	/-----INPUT NORMAL USER
	SKPNE		/ACK?
	JMP	MAPIJ2	/YES
	AND	[377]	/NO--ADD 'RECEIVER' BIT
	TAD	(400)
MAPIJ2,	IOF		/   AND SEND TO DA-10
	DCA	CHARAC
	TAD	MAPL
	DCA	LINUMB
	JMS I	DAOPUJ
	JMP	MAPXIT


MAPIS,	/-----INPUT SPY
	SKPE		/ACK?
	JMP	MAPIJ	/NO
	ISZ	SPYACK	/YES-2ND ONE?
	JMP	MAPXIT	/NO--WAIT FOR IT
	LACM2		/YES-PASS IT ON
	DCA	SPYACK
	JMP	MAPIJ

MAPIT,	/-----INPUT TALK
	SKPNE		/ACK?
	JMP	MAPXIT	/YES-IGNORE IT
	IOF		/NO--TURN IT AROUND FOR OUTPUT
	DCA	CHARAC
	TAD	MAPL
	CMA
	CALL	MAPPUT
	JMP	MAPXIT


MAPIO,	/-----INPUT  OPERATOR
	AND	[177]
	TAD	(-CONX)	/IS IT ^X ?
	SKPE CLA
	JMP	MAPIO2	/NO
	IOF
	CALL	MONINI	/YES-INIT THE MONITOR & OPERATOR LINE
	JMP	MAPXIT

MAPIO2,	TAD	SPYLIN	/SPYING OR TALKING?
	SKPGE
	JMP	MAPIO3	/NO
	DCA	MAPL	/YES-IMITATE IT
	JMP	MAP01

MAPIO3,	CLA
	TAD	MAPC
	SKPNE		/ACK?
	JMP	MAPIO4	/YES
	IOF		/NO--SEND TO THE MONITOR
	AND	[177]
	CALL	MONPUT
	JMP	MAPXIT
MAPIO4,	TAD	MONACK	/SET FLAG
	CIA
	SKPG		/   ONLY IF WAS WAITING FOR FLAG
	JMP	MAPXIT
	DCA	MONACK
	REQMON		/   AND REQUEST THE MONITOR
	JMP	MAPXIT
MAPOS,	/-----OUTPUT SPY
MAPOT,	/-----OUTPUT TALK
	JMS	MAPOUT	/OUTPUT FOR REAL LINE
	TAD	OPRLIN	/   AND OPERATOR LINE
	SKPGE		/   IF THERE IS ONE
	JMP	MAPXIT
	DCA	MAPL
	TAD	MAPL
	TAD	[LINTAB]
	DCA	MAPT

MAPOJ,	/-----OUTPUT NORMAL
MAPOO,	/-----OUTPUT OPERATOR
	JMS	MAPOUT
	JMP	MAPXIT

/-----SUBROUTINE TO OUTPUT CHAR. ACCORDING TO DEVICE TYPE (LINTAB BITS 7-8)

MAPOUT,	0
	CLA
	TAD I	MAPT	/GET DEVICE TYPE
	RTR
	RAR
	AND	(3)
	TAD	(JMP I	MAPOUD)
	DCA	MAPOU0	/   AND DISPATCH ON IT
	TAD	MAPC	/   WITH CHAR. IN AC
MAPOU0,	NOP
MAPOUD,	MAPNX		/(0)--NON-EXISTANT DEVICES (NULL LINES)
	MAPCT		/(1)--CONSOLE TTY
	MAPTT		/(2)--DC08A TTYS
	MAPNX		/(3)--NOT USED

MAPTT,	/-----DC08A TTY
	IOF
	AND	[177]
	DCA	TTCHAR
	TAD	MAPL
	DCA	LINUMB
	TAD	MAPL
	TAD	[LPTABB]
	DCA	TEMP
	TAD I	TEMP
	CALL	TTOPUT
	JMP	MAPOUX

MAPCT,	/-----CONSOLE
	IOF
	CALL	CTYPUT
MAPOUX,	ION
MAPNX,	CLA
	JMP I	MAPOUT
/SUBROUTINE TO SET/CHANGE SIGN BIT IN PLTAB & LPTAB
/ AC=LINE NUM.
/ LINK=DESIRED SIGN BIT

MAPBIT,	0
	TAD	[LPTABB]/ADDRESS LPTAB
	JMS	MAPBIP
	TAD I	TEMP	/ADDRESS PLTAB
	AND	[177]
	TAD	[PLTABB]
	JMS	MAPBIP
	JMP I	MAPBIT

MAPBIP,	0		/AC=TABLE ADDRESS
	DCA	TEMP
	TAD I	TEMP
	AND	(200)	/NEVER CHANGE  SIGN BIT IF BIT4=1
	SKPE CLA
	JMP I	MAPBIT
	TAD I	TEMP
	AND	(3777)
	SZL
	TAD	(4000)
	DCA I	TEMP
	JMP I	MAPBIP


	PAGE
/-----DATA SET CONTROLL INTERRUPT SERVICE

IFNZRO FTMOD<

IFZERO FT689 <

DSC,	CARSKP		/CARRIER?
	JMP	DSC2	/NO
	CARRED		/YES-READ SCANNER
	CARCLR		/CLEAR IRP AND RESTART SCANNER
	DCA	LINUMB
	TAD	LINUMB	/ON OR OFF?
	SKPL CLA
	LAC1		/OFF
	TAD	(11)	/ON
	JMP	DSC3

DSC2,	RNGSKP		/RING?
	JMP	NEXDSC	/NO
	RNGRED		/YES-READ SCANNER
	RNGCLR		/CLEAR IRP AND RESTART SCANNER
	DCA	LINUMB
	TAD	(10)
DSC3,	CALL	MODPUT	/QUEUE IT TO MOD
	XITIRP

> /IFZERO FT689

IFNZRO FT689<

DSC,	CARSKP		/CARRIER?
	JMP	DSC2	/NO
	CARCLR		/YES-CLEAR IRP
	XITIRP
DSC2,	RNGSKP		/RING?
	JMP	NEXDSC	/NO
	RNGCLR		/YES-CLEAR IRP
	XITIRP

> /IFNZRO FT689
/-----SUBROUTINE TO QUEUE SOMETHING FOR MOD
/
/LINUMB=LINE (OR MODEM) NUMBER
/AC=TRANSACTION CODE

MODPUT,	0
	PUT1	MODQ,MODPUF
	TAD	LINUMB
	PUT2	MODQ
MODPUF,	REQMOD
	JMP I	MODPUT

MODQ,	QHEAD	MODQA,MODQL	/THE QUEUE HEADER
/-----ROUTINE TO SERVICE MODQ QUEUE

MOD,	SKPQNE	MODQ	/ANYTHING TO DO?
	JMP	NEXMOD	/NO

MODD0,	GET1	MODQ	/YES-GET TRANSACTION CODE
	DCA	MODCOD	/SAVE CODE
	TAD	MODCOD
	AND	(17)
	TAD	(JMP I MODJMP)/MAKE DISPATCH INSTRUCTION
	DCA	MODD1
	GET2	MODQ	/GET LINE (OR PORT) NUM.
	ION
	AND	[177]
	DCA	MODL	/   AND SAVE IN MODL
MODD1,	NOP		/***MODIFIED FOR DISPATCH

MODJMP,	/-----DISPATCH TABLE
MODDX	/00--POLL FOR PRESENCE (FROM PDP-10)
MOD01	/01--HANG UP MODEM (FROM PDP-10)
MOD02	/02--ANSWER MODEM (FROM PDP-10)
MOD03	/03--REQUEST MODEM STATUS (FROM PDP-10)
MOD04	/04--PDP-10 RESTART (FROM PDP-10)
MODDX	/05--RESERVED (FROM PDP-10)
MOD06	/06--HANGUP ALL MODEMS
MOD07	/07--ANSWER ALL MODEMS
MOD10	/10--RING (FROM DATA-SET)
MOD11	/11--CARRIER ON (FROM DATA-SET)
MOD12	/12--CARRIER OFF (FROM DATA-SET)

/SUBROUTINE TO CK THAT MODEM CONTROL IS ENABLED IF CODE FROM PDP-10

MODCK,	0
	TAD	MODFLG	/CONTROL ENABLED?
	SKPNE CLA
	JMP I	MODCK	/YES
	TAD	MODCOD	/NO--CAME FROM '10?
	SKPL CLA
	JMP I	MODCK	/NO--LET IT PASS
			/YES-FALL INTO MODDX

MODDX,	/-----RETURN HERE FROM DISPATCH
	ION
	CLA		/ANY MORE TO DO?
	IOF
	SKPQNE	MODQ
	XITMOD		/NO
	JMP	MODD0	/YES

MODCOD,	0
/SUBROUTINE TO UPDATE BIT IN MLTAB AND TELL PDP-10 CARRIER STATUS
/ MODL=MODEM NUM. (BITS 5-11)
/ MODC=SIGN BIT TO BE PUT IN MLTAB (PRESERVED)
/ AC=0
/ RETURNS IOF
/ ALSO CALLED BY MODINI

MODCAR,	0
	IOF
	JMS	MODML	/ADDRESS MLTAB AND CONVERT MODL
	JMS	MODLM	/DOES THIS LINE HAVE MODEM?
	 JMP I	MODCAR	/NO
	DCA	MODL	/YES-RESTOR MODMLT
	JMS	MODML
	TAD I	MODMLT	/RESET CARRIER BIT ACCORDING TO LINK BIT
	AND	(3777)
	TAD	MODC
	DCA I	MODMLT
	TAD	MODC
	SKPL CLA	/WHAT WAS CARRIER?
	TAD	[CCICOF-CCICON]/OFF
	TAD	(CCICON)/ON
	JMS	MODTO	/GO TELL IT TO THE TEN
	JMP I	MODCAR


	PAGE
MOD02,	/-----ANSWER MODEM (RAISE TERM.RDY.)
	LACM1

MOD01,	/-----HANG UP MODEM (DROP TERM.RDY.)
	DCA	MODTEM
	JMS	MODCK	/CK FOR 'NO MODEM CONTROL'
	TAD	MODTEM
	JMS	MODTR	/PERFORM T.R. OPERATION
	JMP	MODDX

MOD03,	/-----RETURN CARRIER STATUS
	JMS	MODCK	/CK FOR 'NO MODEM CONTROL'
	JMS	MODLM	/ADDRESS LMTAB & GET PORT NUM.
	 JMP	MODDX	/NO MODEM ON THIS LINE
	TAD	[MLTABB]/ADDRESS MLTAB
	DCA	MODMLT
	TAD I	MODMLT	/WHAT IS CARRIER STATUS?
	SKPL CLA
	TAD	[CCICOF-CCICON]/OFF
	TAD	(CCICON)/ON
	JMS	MODTO	/SEND IT TO PDP-10
	JMP	MODDX

MOD07,	/-----ANSWER ALL MODEMS
	LACM1

MOD06,	/-----HANGUP ALL MODEMS
	DCA	MODTEM
	TAD	(-NUMLIN)
	DCA	MODK
	DCA	MODL
MOD061,	TAD	MODTEM	/GET CODE
	JMS	MODTR	/DO IT TO TRM.RDY.
	INC	MODL
	ISZ	MODK	/FOR ALL LINES
	JMP	MOD061
	JMP	MODDX

MOD04,	/-----RESTART
	JMP	START

MOD11,	/-----CARRIER ON INTERRUPT
	STL CLA RAR	/SET SIGN BIT

MOD12,	/-----CARRIER OFF INTERRUPT
	DCA	MODC
	JMS	MODCAR	/UPDATE BIT IN MLTAB AND TELL PDP-10
	JMP	MODDX

MOD10,	/-----RING INTERRUPT
	JMS	MODML	/CONVERT MODL TO LINE NUM.
	TAD	(CCIRNG)/SEND CODE TO THE PDP-10
	JMS	MODTO
	JMP	MODDX

MODTEM,	0
MODK,	0
/-----SUBROUTINE TO ADDRESS MLTAB AND CONVERT MODL TO LINE NUMBER
/ MODL=MODEM PORT NUM.
/ AC=0
/ LEAVES MODMLT=ADDRESS OF MLTAB ENTRY
/        MODL=LINE NUM.
/ RESPECTS MODC

MODML,	0
	TAD	MODL
	AND	[177]
	TAD	[MLTABB]
	DCA	MODMLT
	TAD I	MODMLT
	AND	[177]
	DCA	MODL
	JMP I	MODML


/-----SUBROUTINE TO SEND SOMETHING TO THE PDP-10
/ AC=TRANSACTION CODE
/ MODL=LINE NUMBER
/ RETURNS IOF

MODTO,	0
	IOF
	DCA	CHARAC
	TAD	MODL
	DCA	LINUMB
	TAD	MODFLG	/IS CONTROL ENABLED?
	SKPNE CLA
	JMS I	DAOPUJ	/YES
	JMP I	MODTO
/SUBROUTINE TO ADDRESS LMTAB AND GET MODEM NUM.
/AC=0
/MODL=LINE NUMBER (PRESERVED)
/NON-SKIP-RETURN IF NO MODEM FOR THIS LINE (AC=0)
/SKIP-RETURN: AC=MODEM NUM.
/         MODMLT=ADDRESS OF LMTAB ENTRY

MODLM,	0
	TAD	MODL
	TAD	[LMTABB]
	DCA	MODMLT
	TAD I	MODMLT
	SKPNE		/MODEM FOR THIS LINE?
	JMP I	MODLM	/NO
	AND	[177]
	INC	MODLM
	JMP I	MODLM
/-----SUBROUTINE TO DO SOMETHING TO TERMINAL READY
/ MODL=LINE NUM.
/ AC=  0: DROP TERM.RDY.,   -1: RAISE TERM.RDY.
/ ALSO CALLED BY MODINI

IFZERO FT689 <

MODTR,	0
	DCA	MODC	/USE MODC AS SWITCH LATER
	JMS	MODLM	/ADDRESS LMTAB AND GET MODEM NUM.
	 JMP I	MODTR	/NO MODEM THIS LINE
	ISZ	MODC	/DO APPROPRIATE IOT
	JMP	MODTR1
	DTRLOD		/RAISE IT
	JMP	MODTR2
MODTR1,	DTRCLR		/DROP IT
MODTR2,	CLA
	JMP I	MODTR

> /IFZERO FT689
IFNZRO FT689<

MODTR,	0
	TAD	(TAB689+3)/ADDRESS 3RD OR 4TH WORD OF ENTRY
	DCA	MODC
	JMS	MODLM	/GET MODEM NUM.
	 JMP I	MODTR	/NO MODEM ON THIS LINE
	AND	(170)	/   AND CALC. TAB689 ADDRESS
	CLL	RAR
	TAD	MODC
	DCA	MODC
	TAD I	MODMLT	/GET MODEM NUM. AGAIN & CALC BIT POSITION
	AND	(7)
	CMA
	IOF
	DCA	TEMP
	STL CLA		/SET LINK
MODTR2,	RAL		/   AND ROTATE IT TO RIGHT PLACE
	ISZ	TEMP
	JMP	MODTR2
	DCA	TEMP	/OR INTO TABLE
	TAD	TEMP
	CMA
	AND I	MODC
	TAD	TEMP
	DCA I	MODC
	ION
	JMP I	MODTR

> /IFNZRO FT689
/-----SUBROUTINE TO INIT THE MODEM CONTROL STUFF

IFZERO FT689 <

MODINI,	0
	CALL	QFLUSH	/START WITH NEW QUEUE
	MODQ
	TAD	(-200)	/LOOK AT ALL 128 LINES
	DCA	TEMP

MODIN1,	MODCLR CARRED	/BUMP CARRIER SCANNER AND READ IT
	DCA	MODL	/MODL=MODEM NUM.
	STL CLA RAR	/SET SIGN BIT
	AND	MODL	/MOD= CARRIER BIT
	DCA	MODC
	TAD	MODL	/WITHIN RANGE?
	AND	[177]
	TAD	(-MLO)
	SKPGE
	JMP	MODIN3	/NO--TOO LOW
	TAD	(MLO-MHI)
	SKPLE CLA
	JMP	MODIN3	/NO--TOO HIGH
	JMS	MODCAR	/YES-SEND STATUS TO PDP-10 AND UPDATE MLTAB BIT
	TAD	MODC	/GET CARRIER AGAIN
	SKPGE CLA	/   AND SET TERM.RDY. ACCORDINGLY
	LACM1
	MODLOD		/ALLOW TERM.RDY. TO BE CHANGED BY MODTR
	JMS	MODTR
MODIN3,	CLA		/LOOP
	ISZ	TEMP
	JMP	MODIN1

	MODCLR		/DESELECT ALL LINES
	CARCLR		/START CARRIER SCANNER
	RNGCLR		/START RING SCANNER
	MODLOD		/ENABLE INERRUPTS

	JMP I	MODINI

> /IFZERO FT689
IFNZRO FT689<

MODINI,	0
	CALL	QFLUSH	/START WITH NEW QUEUE
	MODQ

	JMS	M689I	/INIT GROUP COUNTER
	TAD	(TAB689-1)/ADDRESS BIT TABLE
	DCA	AX0
	MODLOD		/TURN ON MODEM INTERFACE

MODIN2,	DCA I	AX0	/CLEAR RING BIT
	CARRED		/GET CARRIER BITS
	DTRLOD		/MAKE TRM.RDY. AGGREE
	CMA
	DTRCLR
	AND	(377)	/PUT COMPLIMENT OF BITS IN TABLE
	DCA I	AX0	/   SO MOL WILL SEND THEM TO PDP-10
	DCA I	AX0	/CLEAR TRM.RDY ON BITS
	DCA I	AX0	/CLEAR TRM.RDY OFF BITS
	JMS	M689B	/NEXT GROUP
	  JMP	MODIN2	/   AND LOOP

	RNGCLR		/   AND CLEAR OUTSTANGING ONES
	CARCLR
	JMP I	MODINI

> /IFNZRO FT689

	PAGE
IFNZRO FT689<

/SUBROUTINE TO SCAN MODEMS
/  SINCE INTERRUPTS ARE UNDEPENDABLE, THEY ARE
/  IGNORED AND SIMULATED BY SCANNING ALL MODEMS 5 TIMES A SECOND.

MOL,	0
	JMS	M689I	/INIT GROUP HARDWARE & M689M
	TAD	(TAB689)/INIT TABLE PTR.
	DCA	MOLP

MOL0,	TAD	(10)	/CODE 10 FOR 'RING IRP' TO MOD
	DCA	MOLX
	RNGRED		/GET NEW RING BITS
	JMS	MOLUP	/   AND SERVICE THEM
	INC	MOLX	/CODE 11 FOR 'CARRIER ON IRP' TO MOD
	INC	MOLP	/ADDRESS CARRIER BITS
	TAD I	MOLP	/   AND SAVE THEM
	DCA	MOLO
	CARRED		/GET NEW ONES
	JMS	MOLUP	/   AND SERVICE THEM
	INC	MOLX	/CODE 12 FOR 'CARRIER OFF IRP' TO MOD
	TAD I	MOLP	/GET BITS THAT JUST WENT OUT
	CMA
	AND	MOLO
	JMS	MOLBIT	/   AND SERVICE THEM
	INC	MOLP	/ADDRESS TRM.RDY-ON BITS
	TAD I	MOLP	/   AND TURN THEM ON
	DTRLOD
	CLA		/   AND CLEAR TABLE ENTRY
	DCA I	MOLP
	INC	MOLP	/ADDRESS TRM.RDY-OFF BITS
	TAD I	MOLP	/   AND TURN THEM OFF
	DTRCLR
	CLA		/   AND CLEAR TABLE ENTRY
	DCA I	MOLP
	INC	MOLP	/BUMP TO NEXT GROUP
	JMS	M689B
	JMP	MOL0
	JMP I	MOL
/-----SUBROUTNE TO INIT GROP COUNTER FOR 689AG
/ RETURNS WITH HARWARE SET TO 1ST GROUP
/ AND M689M=MODEM NUM.-1 OF 1ST LINE IN THAT GROUP

M689I,	0
	GRPCLR		/GROUP 0
	LACM1		/MODEM NUM. -1
	DCA	M689M
	TAD	(-M689LO)/SET UP FOR 1ST GROUP
	SKPNE
	JMP	M689I1
	DCA	M689K
M689I0,	JMS	M689B
	JMP	M689I0
M689I1,	TAD	(M689LO-M689HI-1)/SET UP M689B COUNTER
	DCA	M689K
	JMP I	M689I

/-----SUBROUTINE TO BUMP TO NEXT GROUP OF 689AG
/ NON-SKIP RETURN IF ANOTHER GROUP (M689M INC. BY 10)
/ SKIP RETURN IF NO MORE GROUPS
/   CALL M689I TO SET TO 1ST GROUP

M689B,	0
	GRPINC		/NEXT GROUP
	TAD	(10)	/NEXT M689M
	TAD	M689M
	DCA	M689M
	ISZ	M689K	/ANY MORE?
	JMP I	M689B	/YES-NON-SKIP RETURN
	INC	M689B	/NO-SKIP RETURN
	JMP I	M689B

M689K,	0

/-----SUBROUTINE TO UPDATE TAB689 FROM HARDWARE
/ AC=NEW GROUP BITS
/ MOLP=ADDRESS TAB689 WORD
/ MOLX=TRANSACTION CODE FOR MOLBIT

MOLUP,	0
	DCA	MOLT	/SAVE NEW BITS
	TAD I	MOLP	/FIND BITS THAT JUST LIT UP
	CMA
	AND	MOLT
	JMS	MOLBIT	/   AND QUEUE THEM TO MOD
	TAD	MOLT	/PUT NEW BITS IN TAB689
	DCA I	MOLP
	JMP I	MOLUP

MOLX,	0
MOLT,	0
MOLP,	0
MOLO,	0

/-----SUBROUTINE TO LOOK FOR CHANGES IN BITS
/ AC=BITS
/ MOLX=TRANSACTION CODE FOR MOD
/ M689M=MODEM NUM.-1 OF FIRST BIT

MOLBIT,	0
	DCA	MOLBT
	DCA	MOLBL

MOLBI1,	TAD	MOLBT	/GET BITS
	SKPNE		/ANY ON?
	JMP I	MOLBIT	/NO
MOLBI2,	INC	MOLBL	/YES-BUMP LINE NUM.
	IOF
	CLL RAR		/NEXT BIT TO LINK
	ION
	SNL CLL		/IS IT LIT?
	JMP	MOLBI2	/NO
	DCA	MOLBT	/YES-SAVE BITS
	TAD	M689M	/MAKE REAL MODEM NUM.
	TAD	MOLBL
	IOF
	DCA	LINUMB	/AND CALL MODPUT
	TAD	MOLX
	CALL	MODPUT
	ION
	JMP	MOLBI1

MOLBT,	0
MOLBL,	0

	PAGE

> /IFNZRO FT689

> /IFNZRO FTMOD
/-----SUBROUTINE TO INIT THE MONITOR & OPERATOR LINE

MONINI,	0
	CLA
	CALL	QFLUSH	/FLUSH ANY INPUT
	MONQ
	TAD	MONCCX	/SEND ^X
	CALL	MONPUT
	DCA	MONACK	/CLEAR ACK.FLAG

	TAD	SPYLIN	/RESET SPY/TALK LINE
	SKPGE
	JMP I	MONINI
	TAD	[LINTAB]
	DCA	TEMP
	TAD I	TEMP
	AND	(7770)
	DCA I	TEMP
	TAD I	TEMP	/IF DC08 LINE:
	AND	(30)
	SKPE CLA
	JMP	MONIN2
	TAD	SPYLIN	/   CLEAR SIGN BITS IN PLTAB & LPTAB
	CLL
	CALL	MAPBIT
MONIN2,	LACM1		/RESET SPYLIN
	DCA	SPYLIN
	JMP I	MONINI


/-----SUBROUTINE TO PUT A CHARACTER TO THE MONITOR
/
/	TAD	CHARACTER
/	CALL	MONPUT
/	...		/RETURN AC=0

MONPUT,	0
	PUT	MONQ,MONFUL
MONFUL,	REQMON
	JMP I	MONPUT


MONQ,	QHEAD	MONQA,MONQL	/THE MONQ HEADER
/-----THE MONITOR

MON,	TAD	MONACK	/WAITING FOR ACK.?
	SKPGE CLA
	JMP	NEXMON	/YES-DONT ENTER YET
	TAD	MONACK	/NO--WAS IT ACK.?
	SKPE CLA
	JMP	MONOAK	/YES
	SKPQNE	MONQ	/NO--ANYTHING IN QUEUE?
	JMP	NEXMON	/NO

MON0,	GET	MONQ	/YES-GET IT
	ION
	AND	[177]
	DCA	MONCAR
	TAD	(-7)	/IS THIS THE BELL?
	TAD	MONCAR
	SKPNE CLA
	JMP	MONEC	/YES-JUST ECHO IT
	DCA	ERRFLG	/TYPEIN SUPPRISSES TERRORS
	LAC1		/AND BELL
	AND	PDP10D
	DCA	PDP10D

	TAD	MONCAR	/IS IT A DIGIT?
	TAD	(-067)	/-"7"
	SKPLE
	JMP	MON1	/NO
	TAD	[7]
	SKPGE
	JMP	MON1	/NO
	DCA	MONTEM	/YES-BUILD NUMBER
	TAD	MONNUM
	CLL RAL
	CLL RTL
	TAD	MONTEM
	DCA	MONNUM
	LACM1
	DCA	MONNUF	/SET 'NUMBER' FLAG
	JMP	MONEC	/ECHO THE DIGIT

MON1,	CLA		/DO A TABLE LOOKUP ON THE CHAR.
	TAD	(MONCDT)
	DCA	MONTEM
MON10,	TAD	MONCAR
	CIA
	TAD I	MONTEM
	INC	MONTEM
	SKPNE CLA
	JMP I	MONTEM	/FOUND IT--DISPATCH
	INC	MONTEM
	JMP	MON10


MONXIT,	IOF		/HERE TO HERE TO EXIT OR DO NEXT INPUT
	SKPQNE	MONQ
	XITMON
	JMP	MON0


	PAGE
		/-----PLACES TO GO WHEN FINISHED WITHE A CHAR.
MON30,	TAD	MONCAR	/TYPE (MONCAR) CRLF +
MON31,	CALL	MONOUT	/TYPE (AC) CRLF +
MON32,	TAD	(053)	/TYPE CRLF +
MON33,	DCA	MONCAR	/TYPE CRLF (MONCAR)
	JMS	MONOCL

MON35,	DCA	MONSLF	/CLEAR/SET SLASH FLAG
	DCA	MONNUM	/CLEAR NUMBER
	DCA	MONNUF	/   AND NUMBER FLAG

MONEC,	TAD	MONCAR	/TYPE MONCAR
MONEAC,	CALL	MONOUT
	JMP	MONXIT
MONX=MON32	/-----^X


MONRO,		/-----RUBOUT
	ION
	CLA
	TAD	(077)	/END LINE WITH ?
	JMP	MON31

MONEQ,		/-----ILLEGAL CHARACTER
	TAD	(077)	/ECHO ?
	JMP	MONEAC

MONCR,		/-----CARRAGE RETURN
	JMS	MONSLO	/PROCESS OPEN SLASH (IF ANY)
	JMP	MON32

MONLF,		/-----LINE FEED
	JMS	MONSLO	/PROCESS OPEN SLASH (IF ANY)
	INC	MONLOC	/BUMP LOC. CTR.
	NOP
	JMS	MONOCL	/TYPE CRLF
	TAD	MONLOC	/   ADDRESS
	CALL	MONON
	JMP	MONSL1	/   AND  SIMULATE "/"


MONSL,		/-----SLASH
	ISZ	MONNUF	/IF NUMBER TYPED, SET LOC.CTR.
	JMP	MONSL1
	TAD	MONNUM
	DCA	MONLOC
MONSL1,	TAD	MONCSL	/TYPE "/ "
	CALL	MONOUT
	TAD	MONCSP
	CALL	MONOUT
	TAD I	MONLOC	/   CONTENTS
	CALL	MONON
	TAD	MONCSP	/   AND SPACE
	DCA	MONCAR
	LACM1		/SET 'OPEN SLASH' FLAG
	JMP	MON35
IFNZRO FTMOD<

MONH,	/-----HANGUP
	LAC1		/CODE 1 FOR 'HANGUP'
	JMP	MONA1

MONA,	/-----ANSWER
	LAC2		/CODE 2 FOR 'ANSWER'
MONA1,	DCA	MONTEM
	JMS	MONLCK	/GOOD LINE NUM.?
	SKPGE CLA	/ALL LINES?
	TAD	(5)	/YES-TURN 1 OR 2 INTO 6 OR 7
	TAD	MONTEM
	DCA	MONTEM
	IOF
	TAD	MONNUM	/YES-SEND TO MOD
	DCA	LINUMB
	TAD	MONTEM
	CALL	MODPUT
	JMP	MON30

> /IFNZRO FTMOD

MONS,	/-----SPY
	LAC2		/STATE=2 FOR SPY
	JMP	MONT1

MONT,	/-----TALK
	LAC3		/STATE=3 FOR TALK
MONT1,	DCA	MONTT
	JMS	MONLCK	/CHECK FOR LEGAL LINE NUM.
	SKPGE CLA	/-1 NOT ACCEPTABLE
	JMP	MONEQ
	TAD	MONCAR	/ECHO T OR S
	CALL	MONOUT
	JMS	MONOCL	/TYPE CRLF
	IOF
	TAD I	MONNUF	/(MONLCK SETUP MONNUF)--WHAT STATE LINE IN?
	AND	[7]
	SKPE CLA
	JMP	MONRO	/NOT NORMAL--ILLEGAL
	TAD	MONTT	/NORMAL--MAKE SPY OR TALK
	TAD I	MONNUF
	DCA I	MONNUF
	TAD	MONNUM	/SET SIGN BIT IN PLTAB & LPTAB
	STL
	CALL	MAPBIT
	TAD	MONNUM	/SET SPYLIN
	DCA	SPYLIN
	LACM2		/SET SPYACK
	DCA	SPYACK
	CALL	QFLUSH	/CLEAR ANY PENDING INPUT
	MONQ
	XITMON		/   AND GO AWAY

MONTT,	0
/-----SUBROUTINE TO TYPE CRLF

MONOCL,	0
	TAD	MONCCR
	CALL	MONOUT
	TAD	MONCLF
	CALL	MONOUT
	JMP I	MONOCL
MONCDT,		/-----THE CHAR. DISPATCH TABLE
IFNZRO FTMOD<
	101	/A
JMP	MONA
	110	/H
JMP	MONH
> /IFNZRO FTMOD
	105	/E
JMP	MONE
	123	/S
JMP	MONS
	124	/T
JMP	MONT
MONCCX,	CONX	/^X
JMP	MONX
MONCSL,	057	//
JMP	MONSL
MONCLF,	012	/L.F.
JMP	MONLF
MONCCR,	015	/C.R.
JMP	MONCR
MONCSP,	040	/SPACE
	JMP	MONEC
	177	/R.O.
JMP	MONRO
MONCAR,	0	/MUST IMMEDIATELY FOLLOW MONCDT
JMP	MONEQ	/MUST IMMEDIATELY FOLLOW MONCAR


/MONSLF,	0	/-1: OPEN SLASH (DEPOSIT IF NUMBER TYPED)
/MONLOC,	0	/LOCATION CTR. FOR "/"
/MONNUM,	0	/NUMBER TYPED IN
/MONNUF,	0	/-1: NUMBER WAS TYPED IN
/MONTEM,	0	/A TEMP.


	PAGE
/SUBROUTINE TO CK FOR LEGAL LINE NUM.
MONLCK,	0
	ISZ	MONNUF	/NUMBER TYPED?
	JMP	MONEQ	/NO--TYPE ?
	TAD	MONNUM	/YES-IS IT IN RANGE?
	SKPGE		/NEGATIVE?
	JMP I	MONLCK	/YES-RETURN IT
	TAD	(-NUMLIN)
	SKPL
	JMP	MONRO	/NO--TYPE ? CRLF +
	TAD	(LINTAB+NUMLIN)/YES-ADDRESS LINTAB
	DCA	MONNUF
	JMP I	MONLCK
MONE,	/-----ERROR PRINT
	TAD	MONCAR	/ECHO THE E
	CALL	MONOUT
	TAD	TIME	/   FOLLOWED BY THE TIME
	CALL	MONON
	CALL	MONOCL	/   AND A CRLF
MONE2,	IOF
	SKPQE	ERRQ	/ANYTHING IN THE QUEUE?
	JMP	MONE3	/YES
	LACM1		/NO-RESET FLAG
	DCA	ERRFLG
	JMP	MON32
MONE3,	GET1	ERRQ
	ION
	CALL	MONON	/   AND PRINT
	TAD	(056)
	CALL	MONOUT
	IOF
	GET2	ERRQ
	ION
	CALL	MONON
	CALL	MONOCL
	JMP	MONE2	/LOOP
/SUBROUTINE TO PUT SOMETHING IN THE ERROR-TYPOUT QUEUE
/	TAD	CODE-2
/	CALL	ERRPUT
/	CODE-1
/	...	/RETURN HERE

ERRPUT,	0
	DCA	TEMP
	SKPQNF	ERRQ	/CK FOR FULL QUEUE
	JMP	ERRPU2	/YES-THROW IT AWAY
	TAD I	ERRPUT
	PUT1	ERRQ,ERRPU2
	TAD	TEMP
	PUT2	ERRQ
	LAC1		/IF ERRFLG=-1,SET IT TO +1
	AND	ERRFLG
	DCA	ERRFLG
ERRPU2,	INC	ERRPUT
	JMP I	ERRPUT

ERRQ,	QHEAD	ERRQA,ERRQL

ERRFLG,	0


	PAGE
/-----SUBROUTINE TO CK. FOR AND PROCESS OPEN SLASH
MONSLO,	0
	ISZ	MONSLF	/OPEN?
	JMP I	MONSLO	/NO
	ISZ	MONNUF	/YES-NUMBER TYPIN?
	JMP I	MONSLO	/NO
	TAD	MONNUM	/YES-DEPOSIT IT
	DCA I	MONLOC
	JMP I	MONSLO


/-----SUBROUTINE TO OUTPUT OCTAL NUMBER
/
/	TAD	NUMBER
/	JMS	MONON
/	...		/RETURN AC=0

MONON,	0
	DCA	MONONN
	TAD	(-4)	/COUNT 4 DIGITS
	DCA	MONONK
MONON1,	IOF		/PROTECT LINK BIT
	TAD	MONONN
	CLL RAL
	RTL
	DCA	MONONN
	TAD	MONONN
	ION
	RAL
	AND	[7]
	TAD	(060)	/MAKE ASCII
	CALL	MONOUT	/TYPE IT
	ISZ	MONONK
	JMP	MONON1
	JMP I	MONON

MONONN,	0
MONONK,	0
/-----SUBROUTINE TO OUTPUT A CHAR
/
/	TAD	CHARACTER
/	CALL	MONOUT
/	...		/RETURN AC=0

MONOUT,	0
	IOF
	DCA	CHARAC
	TAD	OPRLIN	/OPERATOR LINE?
	SKPGE
	JMP	MONOAK	/NO--IGNORE IT
	CMA		/YES-SEND IT TO MAP
	CALL	MAPPUT
	LACM1		/SET FLAG TO 'WAIT FOR ACK'
	DCA	MONACK
	IOF
	IRPMON
	IOF
	CLA
	XITMON		/   AND EXIT

MONOAK,	ION		/HERE WHEN ACK RECEIVED
	CLA
	DCA	MONACK	/CLEAR ACK FLAG
	JMP I	MONOUT	/   AND RETURN TO CALLER
/-----1/5 SECOND CLOCK

TIK,	TAD	TIKTIK
	SKPGE CLA
	JMP	NEXTIK
	TAD	(-BAUD)
	DCA	TIKTIK
	TAD	NULDIS	/UPDATE NULL DISPLAY
	DCA	NULJAC
	DCA	NULDIS
	TAD	(-24)
	DCA	NULCTR
	ION

IFNZRO FTMOD<
IFNZRO FT689<
	JMS	MOL	/SCAN MODEM CONTROLS
>> /IFNZRO FT689 IFNZRO FTMOD

	ISZ	TIKFIV	/COUNT TO 1 SECOND
	JMP	TIK3
	TAD	(-5)
	DCA	TIKFIV

	JMS	SWICH
	ION

	ISZ	TIKSEC	/SERVICE TIME AND DAY
	JMP	TIK2
	TAD	(-36)
	DCA	TIKSEC
	INC	TIME
	ISZ	TIKMIN
	JMP	TIK2
	TAD	(-74)
	DCA	TIKMIN
	TAD	(100)
	TAD	TIME
	AND	(7700)
	DCA	TIME
	ISZ	TIKHOR
	JMP	TIK2
	TAD	(-30)
	DCA	TIKHOR
	DCA	TIME
	INC	DAY
	NOP
TIK2,
IFNZRO FTSIM <	/CHECK FOR CHANGES TO LINTAB SIMULATOR BITS
	JMS	SIMCK
> /IFNZRO FTSIM

	IOF
	TAD	ERRFLG	/START AUTO ERROR TYPEOUT?
	SKPG CLA
	JMP	TIK21	/NO
	DCA	ERRFLG	/YES-SEND 'E' TO MON
	TAD	(105)
	JMP	TIK22

TIK21,	TAD	PDP10D	/PDP-10 JUST DIE?
	SKPL	CLA
	JMP	TIK23	/NO
	TAD	(007)	/YES-DING THE OPERATOR
TIK22,	CALL	MONPUT

TIK23,	ION
	NOP
TIK3,	IOF
	CLA
	XITTIK

TIKFIV,	-5
TIKSEC,	-24	/COUNT SECONDS
TIKMIN,	-74	/COUNT MINUTES
TIKHOR,	-30	/COUNT HOURS


	PAGE
/-----SUBROUTINE TO READ AND OBEY SWITCHES
/
/AC=0 IF FROM TIK,  =-1 IF FROM START

SWICH,	0
	DCA	SWICHF	/SAVE AC
	TAD	SWITCH	/SAVE OLD SWITCHES
	DCA	OSWICH
	TAD	(SWIT1)	/OR IN 'ALWAYS 1'
	OSR
	AND	(-SWIT0-1)/AND OUT 'ALWAYS 0'
	DCA	SWITCH
	TAD	(ION)
	DCA	JSWIC0
	ISZ	SWICHF	/FROM START?
	JMP	SWICH1	/NO
	INC	JSWIC0	/YES-TURN ION INTO IOF
	TAD	SWITCH	/   AND MAKE OLD SWITCHES=COMP.OF NEW ONES
	CMA
	DCA	OSWICH

SWICH1,	TAD	SWITCH	/NSWICH=NEW SWITCHES FOR JSWICH
	DCA	NSWICH
	JMS	JSWICH	/SETUP LINK & SIGN
	JMS	BIT11	/FOR CONSOL SWITCH
	JMS	JSWICH
	JMS	BIT10	/FOR MOD.CONTROL SWITCH
	JMS	JSWICH
	JMS	BIT9	/FOR '10 QUERY SWICH
	JMS	JSWICH
	JMS	BIT8	/FOR DISABLE '10 IRPS SWITCH
	JMP I	SWICH

/PUT NEW BIT IN LINK
/SET SIGN=0 IF OLD BIT SAME, =1 IF DIFFERENT

JSWICH,	0
	CLA
JSWIC0,	ION		/MODIFIED (ION/IOF)
	TAD	OSWICH	/GET OLD BIT
	IOF
	RAR
	DCA	OSWICH
	TAD	NSWICH	/GET NEW BIT
	RAR
	DCA	NSWICH
	TAD	NSWICH
	SZL		/SET SIGN IF DIFFERENT
	CMA
	JMP I	JSWICH


NSWICH,	0
OSWICH,	0
SWICHF=NSWICH
/ENABLE/DISABLE PDP-10 INTERRUPTS

BIT8,	0
	SMA CLA		/CHANGE?
	JMP I	BIT8	/NO
	SZL		/YES--WHICH WAY?
	JMP	BIT81	/DISABLE
	TAD	(DAOUT)	/ENABLE
	DCA	DAOUTJ
	TAD	(DAOQUE)
	DCA	DAOQUJ
	TAD	(DAOPUT)
	DCA	DAOPUJ
	JMP	BIT82

BIT81,	TAD	(NILROT)
	DCA	DAOUTJ
	TAD	(NILROT)
	DCA	DAOQUJ
	TAD	(NILROT)
	DCA	DAOPUJ
	CALL	QFLUSH
	DAOQ
	LACM1
BIT82,	DCA	PDP10I
	JMP I	BIT8


/ENABLE/DISABLE PDP-10 QUERY

BIT9,	0
	SMA CLA		/JUST CHANGE?
	JMP	BIT91	/NO
	LAC1		/YES--SET TO STATE 2
	DCA	PDP10F
	JMP	BIT96
BIT91,	SZL		/ENABLED?
	JMP I	BIT9	/NO
	TAD	PDP10F	/YES-WHATS THE FLAG?
	SKPNE
	JMP	BIT94	/(0)-CLEAR PDP10D
BIT93,	TAD	(-2)
	SKPE
	JMP	BIT95
	TAD	PDP10D	/(2)- DEAD ALREADY?
	SKPE CLA
	JMP	BIT98	/     YES
	LACM1		/SEND 7777.7777 TO ERR
	CALL	ERRPUT
	7777
	LACM1		/AND SET DEAD FLAG
BIT94,	DCA	PDP10D
	JMP	BIT98
BIT95,	SKPL CLA
	JMP I	BIT9	/(3)- DONT DO ANYTHING
BIT96,	TAD	(CCIPOL)/(1)- POKE THE PDP-10
	DCA	CHARAC
	JMS I	DAOPUJ
BIT98,	INC	PDP10F	/INC. THE QUERY FLAG
	JMP I	BIT9
/ENABLE/DISABLE MODEM SERVICE

BIT10,	0
IFNZRO FTMOD<
	CLA		/SET FLAG ACCORDING TO BIT
	SZL
	LAC1
	DCA	MODFLG
> /IFNZRO FTMOD
	JMP I	BIT10


/ENABLE/DISABLE CONSOLE TTY

BIT11,	0
	SMA CLA		/CHANGED?
	JMP I	BIT11	/NO
	TAD	LINTAB+OPLINE/YES-SET LINTAB STATE
	AND	(7770)
	SNL
	IAC		/   TO 1 IF ENABLED
	DCA	LINTAB+OPLINE	/   0 IF DISABLED
	TAD	(OPLINE)	/SET OPRLIN
	SZL
	LACM1		/   -1 IF DISABLED
	DCA	OPRLIN	/   OPLINE IF ENABLED
	CALL	MONINI	/INIT MON
	JMP I	BIT11


	PAGE
/-----SUBROUTINE TO FLUSH A QUEUE
/  IOF
/  JMS  QFLUSH
/  QUEUE HED.ADDRESS
/  ...   /RETURN AC=0,IOF
/        /USES AX0,AX1,AX2
QFLUSH,	0
	LACM1
	TAD I	QFLUSH
	DCA	AX0
	TAD I	AX0
	DCA	AX1
	TAD I	AX0
	DCA	AX2
	TAD	AX1
	DCA I	AX0
	TAD	AX2
	DCA I	AX0
	TAD	AX1
	DCA I	AX0
	LACM1
	DCA I	AX0
	LACM1
	TAD	AX2
	DCA I	AX0
	INC	QFLUSH
	JMP I	QFLUSH
/-----SUBROUTINE TO CHANGE SIMULATOR BITS IN LINTAB
IFNZRO FTSIM <

SIMCK,	0
	TAD	SIMFLG	/REQUEST TO SET SOME BITS?
	SKPGE CLA
	JMP I	SIMCK	/NO
	TAD	SIMAD1	/YES-GET 1ST ADDRESS
	IOF
	DCA	SIMCKL

SIMCK0,	TAD	SIMAD2	/GET LAST ADDRESS
	CIA		/ AND SEE IF WEVE REACHED IT YET
	TAD	SIMCKL
	SKPLE CLA
	JMP	SIMCK3	/YES-EXIT LOOP
	TAD	SIMCKL	/NO--ADDRESS LINTAB
	TAD	[LINTAB]
	DCA	SIMCKA
	TAD I	SIMCKA	/AND INSERT SIMFLG BITS
	AND	(1777)
	DCA I	SIMCKA
	LAC3
	AND	SIMFLG
	CLL RTR
	RAR
	TAD I	SIMCKA
	DCA I	SIMCKA
	TAD	(052)	/START THINGS GOING WITH A CHARACTER
	DCA	CHARAC
	TAD	SIMCKL
	DCA	LINUMB
	CALL	PDP10
	INC	SIMCKL	/NEXT LINE NUM.
	JMP	SIMCK0

SIMCK3,	LACM1		/RESET SIMFLG
	DCA	SIMFLG
	ION
	JMP I	SIMCK

SIMCKA,	0
SIMCKL,	0

	PAGE
> /IFNZRO FTSIM