Google
 

Trailing-Edge - PDP-10 Archives - BB-T573C-DD_1986 - 5,17/q.unv
There are 9 other files named q.unv in the archive. Click here to see a list.
x+@P CN\I1 @.	CALL	$DEC`RD
	$$CNFG==$$CNFG!1B6
CN]xz `(	CALL	$OCTRD
	$$CNFG==$$CNFG!1B6
CN^)  D	IFG	<A-1@>,<
	MOVEI	T4,A`
	CALL	$RDXRD
	$$CNFG==$$CNFG!1B 6
	IFG	<A-12>,<@
	$$CNFG==$$CNFG`!1B5>>
	IFLE	<A-1>,<
	PX1	?RADI X OF A IS ILLEGA@L.  ASKDEC ASSUMED.
	ASKDEC>
CN^> J	CALL	$SXB RD
	$$CNFG==$$CNFG!1B7
Ge@ ,G2,@ `P	CALL	$CLEAR
	$$CNFG==$$CNFG!1B4
G3J7 :T	CALL	$CLR: LN
	SETIHD	(\A):@
	$$CNFG==$$CNFG!1B28!1B29
&H1GB~
H |	JRST	[AOS 	(P)	;SET A SKIP
		POPJ	P,]	;AND RETURN
GJd` `	OUTSTR	[ASCIZ ^
^]
KK|@  t	JRST	[OUT@STR	[ASCIZ ^?A
^]
	EXIT	]
KbN@ 	`L@ O$-3 9L	CALL	$GTB9 UF
	SETIHD(\A)
	$$CNFG==$$CNFG!1B28!1B33
;%I@O$: 8D	CALL	$GTC8 HR
	SETIHD	(\A)8@
	$$CNFG==$$CNFG!1B28
_BtI;O$I1 ;\	CALL	$DEC; 1
	SETIHD	(\A)
	$$CNFG==$$CNFG!1B28!1B31
W&)O%xz <d	CALL	$OCT< 1
	SETIHD	(\A)
	$$CNFG==$$CNFG!1B28!1B31
4UO&) =~	IFG	<B-1= >,<
	MOVEI	T4,B=@
	CALL	$RDX1
	S=`ETIHD	(\A)
	$$C>NFG==$$CNFG!1B28!> 1B31
	IFG	<B-12>@>,<
	$$CNFG==$$C>`NFG!1B30>>
	IFLE?	<B-1>,<
	PX1	?? RADIX OF B IS IL?@LEGAL.  GETDEC AS?`SUMED.
	GETDEC	A>
oP O&> @ 	CALL	$SX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HWL	T2		;G+@ET A CHAR FROM TH+`E TTY
>
	IFE	<$,$CNFG&LBITS>,<
	, CALL	$$GET		;GET ,@A CHAR FROM THE C,`HANNEL
	$$CNFG==-$$CNFG!1B13	;GENE- RATE $$GET
>
	I-@FN	<$$CNFG&RBITS>-`*<<$$CNFG&LBITS>B.53>,<
	XCT	$RTAB. (P1)	;GET A CHAR
	$$CNFG==$$CNFG!.`3B14
>
	IFN	<$$/CNFG&1B12>,<
	SE/ TZM	$REREAD		;CLE/@AR CHAR TO RESCAN/`
>>

	DEFINE	$0PCHAR(LBITS,RBITS0 ,CHAR),<
	IFE	<$0@$CNFG&RBITS>,<
	0`IFB	<CHAR>,<
	OU1TCHR	T2		;TYPE CH1 AR IN T2
>
	IFN1@B	<CHAR>,<
	OUTC1`HR	[CHAR]		;TYPE 2CHAR
>>
	IFN	<$2 $CNFG&RBITS>,<
	2@IFNB	<CHAR>,<
	M2`OVEI	T2,CHAR		;MO3VE CHARACTER TO T3 2
>
	IFE	<$$CNF3@G&LBITS>,<
	CALL3`	$$PUT		;SEND OUT4 TE CHARACTER
>4 
	IFN	<$$CNFG&LBI4@TS>,<
	XCT	$PTAB4`(P1)	;SEND OUT TH5E CHARACTER
>>>

	IFN	<$$CNFG&<5@41B26+3B2>>,<
;S5`UBR. TO PRINT NUM6BER IN SOME RADIX6 .
;ENTER AT $PTO6@CT FOR OCTAL, $PT6`DEC FOR DECIMAL,
;$PTRDX FOR OTHE7 R WITH T4 SET UP 7@AS RADIX.
;
;DE7`STROYS T1,T2,T4, 8T1 IS ARG
$PTOCT8 :	SKIPA	T4,[10]		8@;RADIX 8
$PTDEC:8`	MOVEI	T4,12		;RA9DIX 12
$PTRDX:	J9 UMPGE	T1,$PTRD1
9@	$PCHAR	(3B2,41B29`6,"-")
	MOVM	T1,:T1
$PTRD1:	IDIVI: 	T1,(T4)		;DON'T :@KNOW RADIX
	HRLM:`	T2,(P)		;YE OLD ;RECURSIVE NUMBER ; PRINTER
	SKIPE	T;@1		;DONE YET?
	P;`USHJ	P,$PTRD1	;NO<PE
	HLRZ	T2,(P)	< 	;PICK UP ARG
	A<@DDI	T2,"0"		;MAKE<` IT INTELLIGIBLE
	IFN	<$$CNFG&<1B= 1+1B26>>,<
	CAIL=@E	T2,"9"		;GT A 9=` ?
	ADDI	T2,"A"->"9"-1	;YES- IMPRO> VE DIGIT
>
	$PC>@HAR	(3B2,41B26)
>`	POPJ	P,		;CONTIN?UE
>

	IFN	<$$? CNFG&<1B3+1B27>>,?@<
;SUBR. TO PRIN?`T IN SIXBIT.
;
@;T1 IS ARG, T2,T4@  DESTROYED
$PTSI@@X:	MOVE	T4,[POINT@` 6,T1]	;SET UP BPA
$PTSX1:	ILDB	T2A ,T4		;GET A CHAR
	JUMPE	T2,$PTSX2A`	;IGNORE BLANK
	BADDI	T2,"0"-'0'	;B MAKE ASCII
	$PCHB@AR	(1B3,1B27)
$PB`TSX2:	TLNE	T4,770C000	;GONE FAR ENOC UGH?
	JRST	$PTSXC@1		;NO.MORE CHARSC`
	POPJ	P,		;YES,D NO MORE CHARS
>D 


	IFN	<$$CNFD@G&<3B6+3B31>>,<
D`;SUBR. TO READ A EDECIMAL,OCTAL, ORE  ELSWISE NUMBER
E@;FROM TTY.
;
;TE`2,T3,T4 DESTROYEDF, T1 IS NUMBER
F 
	IFN	<$$CNFG&3B3F@1>,<
$OCT1:	SKIPF`A	T4,[10]		;OCTALG
$DEC1:	MOVEI	T4G ,12		;DECIMAL
$RG@DX1:	PUSHJ	P,$STAG`R1	;SET UP $$GET
	MOVEI	T1,2		;SEH T UP A SKIP RETURH@N
	ADDM	T1,(P)		H`;(MUST SKIP OVER IARGUMENT)
	SETZBI 	T1,T3
	IFN	<$$CI@NFG&3B6>,<
	MOVEI`M	P1,$SAVP1	;SAVEJ P1 FOR AN INDEX J REGISTER
	MOVEI	J@P1,1		;INDEX OF 1J`
	JRST	$RDX2
>>K
	IFN	<$$CNFG&3BK 6>,<
$OCTRD:	SKIK@PA	T4,[10]		;OCTAK`L
$DECRD:	MOVEI	LT4,12		;DECIMAL
L $RDXRD:	SETZB	T1,L@T3
	IFN	<$$CNFG&L`3B31>,<
	MOVEM	PM1,$SAVP1	;SAVE INM DEX REGISTER
	SEM@TZ	P1,		;INDEX OFM` 0
$RDX2:
>>
	NSETOM	$$SGNF		;-1N  MEANS # IS PLUS,N@ 0 MEANS -
$RDXRN`1:
	$RCHAR	(3B6,O3B31)
	CAIN	T2,"O -"		;IF CHAR IS AO@ -
	JRST	$RDXR2	O`	;THEN SET FLAG
P	CAIL	T2,"0"		;LEP GAL CHAR?
	CAILEP@	T2,"0"-1(T4)	;LEP`GAL FOR THIS RADIQX
	JRST	$RDXR4
Q 	IFN	<$$CNFG&<1B5Q@+1B30>>,<
	CAILEQ`	T4,12		;RADIX GTR 10. ?
	CAIG	T4,R "9"		;YES- DIGIT R@GT 9 ?
	JRST	$RDR`XR0		;NO- NOTHINGS SPECIAL
	JRST	$S RDXR4		;BOTH OF TS@HOSE- SPECIAL CHES`CK
>
$RDXR0:	IMTULI	T1,(T4)		;SHIT FT OVER A RADIX DT@IGIT
	ADDI	T1,-6T`0(T2)	;ADD IN CHAUR
	AOJA	T3,$RDXRU 1	;AND SCAN FOR AU@NOTHER, SETTING
U`				;GOOD-CHAR-BEVEN-FOUND-FLAG
		V 		;(T3 GT 0)
$RDV@XR2:	JUMPG	T3,$RDV`XR3	;IF FOUND CHAWRS, DON'T WANT A W MINUS SIGN
	AOSNW@	$$SGNF		;SAY WE W`FOUND A MINUS SIGXN
	JRST	$RDXR1		X ;(UNLESS WE FOUNDX@ ONE BEFORE, IF SX`O FALL
				;INTOY $RDXR3)
	IFN	<$Y $CNFG&<1B5+1B30>>Y@,<
	JRST	$RDXR3	Y`	;NO- NOTHING SPEZCIAL
>
$RDXR4:
	IFN	<$$CNFG&<1BZ@5+1B30>>,<
	CAILZ`	T2,"A"		;LESS TH[AN AN A ?
	CAILE[ 	T2,"A"-^D11(T4)	[@;GOOD DIGIT ?
	J[`RST	$RDXR7		;NO
\	SUBI	T2,"A"-"9"-\ 1	;YES- SCALE DOW\@N
	JRST	$RDXR0
\`>
$RDXR7:	CAIE	T]1," "		;IS THIS A]  SPACE?
	CAIN	T1]@,"	"	;OR A TAB?
]`	JUMPE	T3,$RDXR1	^;YES--IGNORE THEM^  IF LEADING
$RDX^@R3:	SKIPL	$$SGNF	^`	;DID WE FIND A M_INUS SIGN?
	MOVN_ S	T1		;YES, NEGAT_@E ANSWER
	IFN	<$_`$CNFG&3B31>*<<$$C`NFG&3B6>B53>,<
	` MOVE	P1,$SAVP1	;R`@ESTORE INDEX
	$$``CNFG==$$CNFG!1B11a
>
	POPJ	P,		;Ra ETURN
	$LOW$
$$a@SGNF:	BLOCK	1
	$a`HIGH$
>

	IFN	b<$$CNFG&<1B7+1B32b >>,<
;SUBROUTINEb@ TO READ IN SIXBIb`T
;
;T2,T3,T4 DcESTROYED, T1 HAS c ANSWER

	IFN	<$c@$CNFG&1B32>,<
$Sc`XB1:	PUSHJ	P,$STAdR1	;SET UP FOR $$d GET
	MOVEI	T1,2	d@	;SET UP A SKIP Rd`ETURN
	ADDM	T1,(eP)		;(MUST SKIP Oe VER ARGUMENT)
	Ie@FN	<$$CNFG&1B7>,<e`
	MOVEM	P1,$SAVPf1	;SAVE INDEX
	Mf OVEI	P1,1		;INDEXf@ OF 1
	JRST	$SXBf`2
>>
	IFN	<$$CNgFG&1B7>,<
$SXBRDg :
	IFN	<$$CNFG&1g@B32>,<
	MOVEM	P1g`,$SAVP1	;SAVE INDhEX
	SETZ	P1,		;Ih NDEX OF 0
$SXB2:h@
>>
	MOVE	T4,[Ph`OINT 6,T1]
	SETZiB	T3,T1		;GOOD CHi AR BEEN FOUND FLAi@G
$SXBR1:
	$RCHi`AR	(1B7,1B32)
	CjAIG	T2,"Z"		;IS Tj HIS A VALID
	CAIj@GE	T2,"A"		;LETTEj`R
	JRST	$SXBR2		k;NOT A LETTER-COUk LD BE NUMBER
$SXk@BR3:	SUBI	T2,"0"-k`'0'	;MAKE SIXBIT
	TLNE	T4,770000	l ;DEPOSITED SIX CHl@ARS?
	IDPB	T2,T4l`		;NO-REMEMBER THmIS ONE
	AOJA	T3,m $SXBR1	;GET ANOTHm@ER CHAR AND
				m`;SET GOOD-CHAR-BEnEN-FOUND FLAG
$Sn XBR2:	CAIG	T2,"9"n@		;IS IT A NUMBERn`
	CAIGE	T2,"0"
o	SKIPA			;NOT A No UMBER
	JRST	$SXBo@R3		;A NUMBER
	Co`AIG	T2,"z"		;ALSOp CHECK LOWER CASEp  A-Z
	CAIGE	T2,"p@a"
	JRST	.+3		;Np`OT LC A-Z
	SUBI	qT2,40		;MAKE UPPEq R CASE
	JRST	$SXq@BR3		;AND PRETENDq` IT WAS UPPER CASrE
	CAIE	T2," "		r ;IF A SPACE
	CAIr@N	T2,"	"	;OR A TAr`B
	JUMPE	T3,$SXBsR1	;AND HAVEN'T Fs OUND A GOOD CHAR
				;THEN CONTINs`UE SCANNING
	IFNt	<$$CNFG&1B32>*<<t $$CNFG&1B7>B53>,<t@
	MOVE	P1,$SAVP1t`	;RESTORE INDEX
u	$$CNFG==$$CNFG!1u B11
>
	POPJ	P,	u@	;ELSE GIVE UP (Pu`ROBABLY SPACE,CR
				;OR COMMA)
v >

	IFN	<$$CNFGv@&<1B29+1B4>>,<
;v`SUBR TO CLEAR NEXwT LINE

	DEFINEw 	$RTRN,<
	IFN	<$w@$CNFG&1B29>*<<$$Cw`NFG&1B4>B53>,<
	xJRST	$RP1PJ		;RESx TORE INDEX AND REx@TURN
>
	IFE	<$$x`CNFG&1B29>*<<$$CNyFG&1B4>B53>,<
	Py OPJ	P,		;YES- RETy@URN
>>

	IFN	<y`$$CNFG&1B29>,<
$zCLRLN:	CALL	$STARz 1		;SET UP $$GET
	AOS	(P)		;POINTz` PAST ARGUMENT
	{AOS	(P)		;AND SET{  UP A SKIP RETURN{@
	IFN	<$$CNFG&1B{`4>,<
	MOVEM	P1,$|SAVP1	;SAVE INDEX| 
	MOVEI	P1,1		;S|@ET UP INDEX OF 1
	JRST	$CLR1
>>
	IFN	<$$CNFG&1B4} >,<
$CLEAR:
	IF}@N	<$$CNFG&1B29>,<}`
	MOVEM	P1,$SAVP~1	;SAVE INDEX
	S~ ETZ	P1,		;SET UP ~@INDEX OF 0
>>
$~`CLR1:	CAIL	T2,12		;BETWEEN A LF AN D A FF ?
	CAILE	@T2,14
	CAIN	T2,7`		;OR BELL?
	$RTRN
	CAIE	T2,33		 ;ALTMOD ?
	CAIN	@T2,32		;OR ^Z ?
`	$RTRN
	$RCHAR	(1B4,1B29)
	JRST	 $CLR1

	IFN	<$$@CNFG&1B29>*<<$$CN`FG&1B4>B53>,<
$RP1PJ:	MOVE	P1,$SA VP1	;RESTORE INDE@X
	$$CNFG==$$CNF`G!1B11
	POPJ	P,		;AND RETURN
>
 >

	IFN	<$$CNFG@&<103B27+7B3>>,<
;SUBROUTINE CALLED BY PUT??? MACR OS TO PUT A NUMBE@R IN THE OUTPUT B`UFFER.
;CALL	PUSHJ	P,$PRINT
;	AR G	CODE,WORD
;	AR@G	CHN,BUFHED
;
`	IFN	<$$CNFG&103B27>,<
$PRINT:
	 IFG	.-400000,<
	@SAVE	T1		;SAVE 1 `AC
	CALL	$STARG		;SET UP $$PUT IN ITIALLY
	RESTORE@	T1		;AND RESTORE` IT
>
	SAVE4T			;SAVE T1-T4
	MO VEI	T1,T2		;T2 IS@ WHERE THE CHARS `WILL BE
	HRRM	T1	,$$PUT+1	;SET UP 	 THE CALL ON $PTCH	@R
	LDB	T2,[POINT	` 4,@-5(P),12]	;FI
ND ARG TYPE
	MOV
 EI	T1,@-5(P)	;GET
@ THE ADDRESS OF T
`HE ARGUMENTS
	CAIN	T2,2		;PUTRDX?  (IF SO, CHANNEL @IS OFFSET)
	SKIP`A	T1,2(T1)	;YES

	MOVE	T1,1(T1)	;N
 O
	MOVE	T2,-3(P)
@	;RESTORE T2
	MO
`VEM	T1,$$PUT+2	;F
	CALL	$;GET ARGUM
	$$CNFG==$$CNFG!1B10
	 IFN	<$$CNFG&7B3>,@<
	MOVEM	P1,$SAV`P1	;SAVE AN INDEX
	MOVEI	P1,1		;I NDEX IS 1.
	JRST@	$GETVR		;FIGURE `OUT WHAT TO DO
>>
	IFN	<$$CNFG&7 B3>,<
;SUBROUTIN@E CALLED BY TYP??`? MACROS TO TYPE
;A NUMBER
;
;C ALL:
;	PUSHJ	P,$@TYPE
;	ARG	CODE,`WORD
;
;WHERE CODE IS A CODE IND ICATING WHAT KIND@ OF TYPEING
;WOR`D IS ADDRESS OF WORD TO BE TYPEED
;
$TYPE:	SAVE4T@			;SAVE T1-T4 TO` B4 NICE
	CALL	$GTARG		;GET ARGUM ENT
	$$CNFG==$$C@NFG!1B10
	IFN	<$`$CNFG&103B27>,<
	MOVEM	P1,$SAVP1	 ;SAVE INDEX
	SET@Z	P1,		;INDEX IS `0
$GETVR:
>>
	LDB	T2,[POINT 4,@ -5(P),12]	;COULDN@'T DO THIS BEFORE`
				;BECAUSE ARG MIGHT HAVE BEEN  IN T2
	IFN	<$$C@NFG&103B27>*<<$$C`NFG&7B3>B53>,<
	PUSHJ	P,@$TAB(T2) 	;CALL ROUTINE
	@MOVE	P1,$SAVP1	;R`ESTORE INDEX
	$$CNFG==$$CNFG!1B11 
	POPJ	P,		;AND @RETURN

$PTAB:	`OUTCHR	T2		;TTY OUTPUT
	PUSHJ	P,$ $PUT		;DEVICE OUT@PUT
>
	IFE	<$$C`NFG&103B27>*<<$$CNFG&7B3>B53>,<
	 XCT	$TAB(T2)	;DIS@PATCH TO ROUTINE
>
	IFN	<$$CNFG&1B8>,<
$GRDX:	MO VEI	T4,@-5(P)	;NO@ INDEX
	HRRZ	T4,`1(T4)	;RADIX GOES IN T4
	PJRST	$P TRDX		;HANDLE IT
>
$TAB:
	IFN	<`$$CNFG&<1B2+1B21>>,<
	PJRST	$PTOC T
	PJRST	$PTDEC
>
	IFE	<$$CNFG&`<1B2+1B21>>,<
	POPJ	P,
	POPJ	P,
>
	IFN	<$$CNFG&@1B8>,<
	PJRST	$G`RDX
>
	IFE	<$$C NFG&1B8>,<
	POPJ  	P,
>
	IFN	<$$C @NFG&<1B3+1B27>>,< `
	PJRST	$PTSIX
!>
	IFE	<$$CNFG&<! 1B3+1B27>>,<
	PO!@PJ	P,
>>
	IFN	<!`$$CNFG&1B18>,<
;"$PTSPC PUTS A SPA" CE IN THE OUTPUT "@BUFFER
$PTSPC:	S"`AVE	T1		;BE A NIC#E GUY
	CALL	$STA# RG		;SET UP $$PUT#@ ARGUMENTS
	MOVE#`I	T1," "		;GET TH$E SPACE
	PUSHJ	P$ ,$$PUT		;OUTPUT I$@T
	RESTORE	T1
	$`RETURN
>
	IFN	<%$$CNFG&1B25>,<
;% $PTTAB PUTS A TAB%@ INTO THE OUTPUT %`BUFFER
$PTTAB:	S&AVE	T1
	PUSHJ	P,& $STARG	;SET UP AR&@GS
	MOVEI	T1,11	&`	;11'S A TAB
	PU'SHJ	P,$$PUT
	RES' TORE	T1
	RETURN
>
	IFN	<$$CNFG&'`1B20>,<
;$PTMIN (PUTS A MINUS SIGN(  INTO THE OUTPUT (@BUFFER
$PTMIN:	S(`AVE	T1		;SAVE THE) TEMP
	PUSHJ	P,$) STARG	;SET UP ARG)@S
	MOVEI	T1,"-"
	PUSHJ	P,$$PUT		*;OUTPUT IT
	REST* ORE	T1
	RETURN
*@>
	IFN	<$$CNFG&1*`B22>,<
;$PTSTR P+UTS THE ASCIZ STR+ ING IN THE ARG FI+@ELD INTO THE OUTP+`UT BUFFER
$PTSTR,:
	IFG	.-400000,, <	;IF WE ARE IN T,@HE HIGH SEG
	SAV,`E	T1		;SAVE AN AC-
	CALL	$STARG		;- THEN BLT $$PUT TO-@ LOW SEG
	RESTOR-`E	T1
>
	SAVE4T	.		;NEED LOTS OF T. EMPS
	MOVEI	T1,T.@2		;WHERE THE CHA.`RS WILL GO
	HRRM/	T1,$$PUT+1	;SAVE/  IT
	MOVEI	T1,@-/@5(P)	;GET ADDRESS/` OF CHANNEL
	MOV0E	T1,1(T1)	;GET B0 UFFER HEADER
	MO0@VEM	T1,$$PUT+2	;S0`TORE IT
	MOVE	T11,@-5(P)	;GET THE 1 ADDRESS OF THE AR1@G
	MOVEM	T1,$GTI1`ND	;STORE IN MEMO2RY
	MOVE	T1,-4(P2 )	;RESTORE T1
	M2@OVEI	T1,@$GTIND	;2`GET ADDRESS
	$$C3NFG==$$CNFG!1B15
	SUBI	T1,1		;MAK3@E IT A BYTE POINT3`ER
	TLO	T1,700		4;SIZE FIELD OF BY4 TE POINTER
$PTST4@1:	ILDB	T2,T1		;G4`ET A BYTE
	JUMPE5	T2,$PTST2	;IF IT5 'S ZERO WE'RE THR5@OUGH
	PUSHJ	P,$$5`PUT		;OUTPUT IT
6	JRST	$PTST1		;TR6 Y FOR MORE
$PTST6@2:	RETURN			;GO B6`ACK TO WHEREVER
7>

	IFN	<$$CNFG7 &1B19>,<
;$PTLF 7@PUTS A CARRIAGE R7`ETURN, LINE FEED 8INTO THE OUTPUT B8 UFFER
$PTLF:	SAV8@E	T1		;SAVE THE T8`EMP
	PUSHJ	P,$ST9ARG	;SET UP ARGS
	MOVEI	T1,15		;T9@HAT'S A CR
	PUSH9`J	P,$$PUT
	MOVEI:	T1,12		;THAT'S T: HE LINE FEED
	PU:@SHJ	P,$$PUT
	RES:`TORE	T1
	RETURN
>

	IFN	<$$CNF; G&3B24>,<
;$PTCH;@R PUTS THE CHAR I;`N E INTO THE OUTP<UT BUFFER
$PTCHR< :	SAVE4T			;DON'T<@ NEED ALL FOR; $G<`TARG EXPECTS IT
=	CALL	$GTARG		;GE= T THE CHARACTER
=@	$$CNFG==$$CNFG!1=`B10
	MOVEI	T2,@->5(P)	;GET ADR OF > ARGS
	HRRZ	T2,1(>@T2)	;GET THE BUFF>`ER HEADER ADDRESS?
	SOSG	2(T2)		;R? OOM LEFT IN BUFFE?@R?
	PUSHJ	P,$GVB?`UF	;GET A NEW BUF@FER
	IDPB	T1,1(T@ 2)	;USE MONITOR'S@@ BUFFER POINTER
@`	RETURN
$GVBUF:	ASAVE	T3		;NEED ANA OTHER REGISTER
	A@MOVEI	T3,@-7(P)	;A`GET ADDRESS OF ARBGUMENTS
	LDB	T3,B [POINT 4,1(T3),12B@]	;CHANNEL # IN TB`3
$PBUF:	LSH	T3,C5		;PUT CHANNEL IC N AC FIELD
	TRO	C@T3,(OUT	0,)	;RIGHC`T HALF IS OUT UUOD
	HRLZS	T3		;SWAD P HALVES
	XCT	T3D@		;DO IT
	JRST	$D`T3RET		;RESTORE TE3 AND GO TO THE RE IGHT PLACE
	TYPEE@	(?CHANNEL )
	LDE`B	T3,[POINT 4,T3,F12]	;GET THE CHANF NEL NUMBER
	TRZEF@	T3,10		;CHANNEL F`GE 10 ?
	OUTCHR	G["1"]		;YES- TYPEG  A 1
	ADDI	T3,"0G@"		;CONVERT OTHERG` DIGIT TO ASCII
H	OUTCHR	T3		;TYPEH  IT
	OUTSTR	[ASCH@IZ	/ OUT UUO failH`ed/]
	EXIT
$T3RIET:	RESTORE	T3		;I RESTORE TEMP
	POI@PJ	P,		;RETURN
	I`IFN	<$$CNFG&1B24>J,<
$PTBUF:	SAVE	J T3		;SET UP FOR PJ@UTBUF
	MOVEI	T3,J`@-1(P)	;GET ADDREKSS OF ARGS
	LDB	K T3,[POINT 4,(T3),K@12]
	JRST	$PBUF	K`	;PUT THE BUFFER
>
$STARG:
	IFGL 	.-400000,<
	MOVL@E	T1,[$$PUT0,,$$PL`UT]
	BLT	T1,$$PUMT+3	;SET UP ROUTIM NE IN LOWSEG
> ;M@END OF IFG	.-4000M`00
	MOVEI	T1,T1	N	;T1 IS WHERE TO N GET THE CHAR
	HRN@RM	T1,$$PUT+1	;STN`ORE IT
	MOVE	T1,O@-2(P)	;GET THE AO DDRESS OF THE BUFO@FER HEADER
	MOVEO`M	T1,$$PUT+2	;STOPRE IT
	POPJ	P,		P ;RETURN
	IFL	.-4P@00000,<	;IF WE ARP`E IN THE LOW SEG
$$PUT:				;THEN Q NO BLT IS NECESSAQ@RY
>
$$PUT0:	CAQ`LL	$PTCHR
	ARG	0R,0		;OVERWRITTEN R WITH ADDRESS
	ARR@G	0,0		;OVERWRITTR`EN WITH CHANNEL
S	POPJ	P,		;RETURNS 
	IFGE	.-400000,S@<	;IF WE ARE IN TS`HE HIGH SEG
	$LOTW$
$$PUT:	BLOCK	T 4		;WHERE ROUTINET@ IS PLACED
	$HIGT`H$
> ;END OF IFGUE	.-400000
> ;ENU D OF $PTCHR

	IU@FN	<$$CNFG&<1B28+U`1B33>>,<
;$GTCHRV GETS THE NEXT CHV ARACTER INTO T2
V@$GTCHR:	MOVEI	T2,V`@(P)		;GET ADDRESWS OF ARGS
	HRRZ	W T2,(T2)		;GET BUFW@FER HEADER ADDRESW`S
$GTCH9:	SOSLE	X2(T2)		;ANYTHING X IN BUFFER?
	JRSTX@	$GBYT1		;YES--GEX`T IT
	PUSHJ	P,$GYTBF0	;NO--GET A NY EW BUFFER
	  POPY@J	P,		;EOF
$GBYTY`1:	ILDB	T2,1(T2)	Z;GET THE BYTE
	JZ UMPE	T2,$GTCH9	;DZ@ON'T RETURN ANY NZ`ULLS
	AOS	(P)		;[POINT PAST ARGUME[ NT
	CPOPJ1			;AN[@D DO A SKIP RETUR[`N
$GTBF0:	SAVE	T\1		;SAVE A TEMPOR\ ARY
	MOVEI	T1,@-\@2(P)	;GET ADDRESS\` OF ARGS
	IFN	<$]$CNFG&1B33>,<
	J] RST	$GTBF2		;AND ]@GET A NEW BUFFER
$GTBUF:	SAVE	T1	^	;SAVE A TEMPORAR^ Y
	MOVEI	T1,@-1(^@P)	;GET ADR OF AR^`G
$GTBF2:
>
	L_DB	T1,[POINT 4,(T_ 1),12]
	HRLI	T1,_@(IN	0,)	;DUMMY IN_` UUO
	DPB	T1,[PO`INT 4,T1,12]	;LOA` D UP THE AC FIELD`@
	HLLZS	T1		;CLE``AR RIGHT HALF
	XaCT	T1		;DO THE INa 
	  AOS	-1(P)		;a@SUCCESS! SET SKIPa` RETURN
	RESTOR	bT1		;RESTORE T1
b 	POPJ	P,		;RETURNb@

	IFN	<$$CNFG&b`1B14>,<
$RTAB:	IcNCHWL	T2		;TELETYc PE GET A CHAR
	Pc@USHJ	P,$$GET		;DEc`VICE GET A CHAR
d>
	IFN	<$$CNFG&1d B13>,<
$STAR1:
d@	IFGE	.-400000,<	d`;IF WE ARE IN THEe HIGH SEG
	MOVE	e T1,[$$GET0,,$$GETe@]
	BLT	T1,$$GET+e`5	;SET UP ROUTINEf IN LOWSEG
> ;ENf D OF IFGE	.-40000f@0
	MOVE	T1,@-1(Pf`)	;GET CHANNEL INgFO
	MOVEM	T1,$$Gg ET+1	;SAVE IT
	Pg@OPJ	P,
	IFL	.-40g`0000,<	;IF WE AREh IN THE LOW SEG
h $$GET:				;NO BLTh@ IS NEEDED
>
$$h`GET0:	CALL	$GTCHRi		;GET A CHARACTEi R
	ARG	0,0		;WILi@L BE OVERWRITTEN
	SOSA	-1(P)
	POjPJ	P,		;RETURN
	j MOVEI	T2,12		;FAKj@E OUT CLRLIN WITHj` A LF
	POPJ	P,
k	IFGE	.-400000,<
	$LOW$
$$GET:	Bk@LOCK	6
	$HIGH$
k`>> ;END OF IFGE	.l-400000
> ;END Ol F $GTCHR

	IFN	l@<$$CNFG&1B10>,<
l`$GTARG:	MOVE	T1,@m-6(P)	;GET ADDRESm S WORD
	MOVEM	T1m@,$GTIND	;STORE INm` MEMORY
	MOVE	T1n,-5(P)	;RESTORE Tn 1
	MOVE	T1,@$GTIn@ND	;GET THE ARG!
	POPJ	P,		;AND RoETURN
	$$CNFG==$o $CNFG!1B15
>

o@	IFN	<$$CNFG&1B15o`>,<
	$LOW$
$GTIpND:	BLOCK	1		;PLAp CE FOR INDIRECTIOp@N
	$HIGH$
>

p`	IFN	<$$CNFG&1B17q>,<
;SUBROUTINE q TO DO STANDARD SIq@XBIT TABLE SEARCHq`
$MATCH:	SAVE4		r	;SAVE P1-P4
	SEr TZB	P1,T4		;CLEARr@ MATCH MASK AND Pr`OINTER
	MOVSI	P2s,770000	;START ATs  LEFT END
$MATC1s@:	TDNE	T1,P2		;SEs`E IF THIS CHAR ISt A SPACE
	IOR	P1t ,P2		;NO--IMPROVEt@ MASK
	LSH	P2,-6t`		;MOVE RIGHT ONEu CHAR
	JUMPN	P2,u $MATC1	;LOOP FOR u@SIX CHARS
	SETO	u`P2,		;SET ABBREVIvATION COUNTER
	Mv OVE	P3,T3		;SAVE v@POINTER
$MATC2:	v`MOVE	P4,(T3)		;GEwT NEXT CANDIDATE
	XOR	P4,T1		;COMw@PARE
	JUMPE	P4,$w`MATCW	;EXACT.
	AxND	P4,P1		;NO--MAx SK IT
	JUMPN	P4,x@$MATC3	;NO MATCH
	MOVE	T4,T3		;WIyN--SAVE POINTER
y 	AOS	P2		;COUNT Sy@UCCESS
$MATC3:	Ay`OBJN	T3,$MATC2	;LzOOP FOR ALL ENTRIz ES
	MOVE	T3,T4		z@;RESTORE POSSIBLEz` WINNER
	JUMPN	P{2,$MATCR	;RETURN { IF UNSUCCESSFUL
{@$MATCW:	SUB	T3,P3{`		;COMPUTE INDEX
	TLZ	T3,-1		;CLE| AR JUNK IN LEFT H|@ALF
	AOS	(P)		;S|`ET SKIP RETURN
$}MATCR:	POPJ	P,		;} RETURN
>

	IFN}@	<$$CNFG&1B9>,<
}`;SUBROUTINE TO SA~VE REGISTERS T1-T~ 4 ON PUSH DOWN ST~@ACK
;THEREFORE C~`AN BE CALLED RECURSIVELY
$SAVE4:	 EXCH	T1,0(P)		;SA@VE T1,GET RETURN `ADDRESS
	HRLI	T1,0(P)		;SAVE WHER E T1 IS STORED
	@PUSH	P,T2
	PUSH	`P,T3
	PUSH	P,T4
	PUSHJ	P,$SVJMP	 ;RESTORE T1 AND R@ETURN TO CALLER
`	  SKIPA			;NON-SKIP RETURN
	AOS	 -4(P)		;SKIP RETU@RN
	POP	P,T4
	P`OP	P,T3
	POP	P,T2
	POP	P,T1
	PO PJ	P,

$SVJMP:	@JRA	T1,(T1)		;RES`TORE T1 AND RETURN TO CALLER
>
 
	IFN	<$$CNFG&1B1@6>,<
;SUBROUTINE` TO SAVE REGISTERS P1-P4 ON PUSH D OWN STACK
;THERE@FORE CAN BE CALLE`D RECURSIVELY
$SAVEP:	EXCH	P1,0(P )		;SAVE P1,GET R@ETURN ADDRESS
	H`RLI	P1,0(P)		;SAVE WHERE P1 IS STO RED
	PUSH	P,P2
@	PUSH	P,P3
	PUSH`	P,P4
	PUSHJ	P,$SVJM1	;RESTORE P1  AND RETURN TO CA@LLER
		SKIPA			`;NON-SKIP RETURN
	AOS	-4(P)		;SKI	 P RETURN
	POP	P,	@P4
	POP	P,P3
	P	`OP	P,P2
	POP	P,P
1
	POPJ	P,

$S
 VJM1:	JRA	P1,(P1)
@		;RESTORE P1 AND
` RETURN TO CALLER
>

	IFN	<$$CN FG&1B11>,<
	$LOW@$
$SAVP1:	BLOCK	`1		;PLACE TO SAVE
 INDEX
	$HIGH$

 >

	IFN	<$$CNFG
@&1B12>,<
	$LOW$	
`		;TO LOW SEG
$READ:BLOCK	1		;P
	$H$			;TO HIGH SEG
>
	LIST
q@ 	IFB	<C>, <
	A==B>
	IFN@B	<C>,<
	A=B>
	"Lz `H	IFG	$$ZZ-	400000,RELOC
	PURGE	$$ZZ
	2~q B	$$ZZ==.
 	IFG	$$ZZ-400000,RELOC

Q S@P >}{woP