
PRNT,	TAD OUTDEV	/OUTPUT BCD TO TTY OR DSPY FROM # OR ESCAPE
	DCA VPRNT
	TAD VEC1
	JMS I PRNT2
VRSTR,	CLA	/ALL ENTRIES TO COMMAND DECODER PASS HERE
	TAD C202
	DCA TE1	/RESET START
	DCA I LISTX1
	DCA I LISTX2
	JMP I TE1

C202,	START	/PTR TO RESTART

ROT6R,	0
	RTR CLL	/ROT 6 RIGHT, RECOVERS LH
	RTR
	RTR
	JMP I ROT6R

XCAPE,	0	/PRINTS CORE LOCATION+1 CALLING ESCAPE IN BCD
	CLA
	TAD C337
	JMS I OUTL1
	TAD XCAPE
	SPA
	TAD C2000	/DECREASE TO MAX OF 1000 COUNT
	DCA VEC1
	TAD OUTL1
	JMP PRNT+1
/I-O SUBROUTINES
I750,	0
	RSF
	JMP .+4
	DCA I33
	RFC RRB
	JMP I I750
	ISZ I33
	JMP .-6

FULL,	TAD TE1
	TAD MSTART
	SZA CLA
	JMP I TE1
	TAD	BELL
	JMS I	OUTL1	/BYPASS BIT2
	JMP I	TE1
MSTART,	-START	/TEST FOR EXIT VIA NEXT=NO ECHO


I33,	0
	KSF
	JMP .-1
	CLA CLL CML RTL	/=+2 FOR SYNC AND RAISE FLAG
	JMS I DSPYI
	KRB
	JMP I I33

OUTL,	0
	TSF
	JMP .-1
	TLS
	CLA
	JMP I OUTL


OUTH,	0
	PSF
	JMP .-1
	PLS
	CLA
	JMP I OUTH
ENDLN,	0	/ENDS AN INSERTION LINE AND RESETS PTRS
	JMS I PACK1	/PACK CR
	TAD BUFR
	DCA I THIS
	TAD XSAV
	DCA I BUFR
	TAD BUFR
	DCA THIS
	ISZ PACKIN
	TAD PACKIN
	DCA BUFR
	DCA XCTIN
	JMP I ENDLN

FIND,	0	/LOCATE LINE BUFFER
	CIA
	SMA
	ESCAPE	/TOO SMALL
	DCA TEMP2
	TAD TEMP2
	IAC
	TAD LSTN
	SPA CLA
	ESCAPE	/TOO LARGE
	TAD CFRS
	JMP .+3
	TAD I SAVE2	/CHAIN THROUGH LIST.
	SZA	/FAILSAFE
	DCA SAVE2
	ISZ TEMP2
	JMP .-4
	TAD SAVE2
	JMP I FIND
CFRS,	FRST
OPS2=.
	START	/SPARE RESERVED FOR U:LINK GENERATOR
	TRANSL	/B:TRANSLATE EDGRIN TO PAL
	KILL	/K: KILL
	DELE	/D: DELETE
	LIST	/L: LIST
	COMBO	/N: NEXT
	MOVEM	/M: MOVE
	XNS	/I: INSERT

	PUNCN	/P: PUNCH
	FORM	/F: FORM FEED
	WRITE	/W: DISPLAY TEXT
	ERRORS	/T: APPEND AND COMPILE BINARY FILE
	APP	/A: APPEND
	XCRET	/S: SEARCH
	CNGE	/C: CHANGE
	ERRORS	/E: COMPILE ENTIRE BINARY FILE
	TELEN	/R: READ

LIST2=.	/COMMAND CODES

	1000	/SPARE COMMAND (USED BY U)
	302	/B
	313	/K
	304	/D
	314	/L
	316	/N
	315	/M
	311	/I
STALIS=.
	320	/P
	306	/F
	327	/W
	324	/T
	301	/A
	323	/S
	303	/C
	305	/E
	322	/R
	0	/ZERO ENDS INTERPRETER
/WARNING: ALL LISTS MUST TERMINATE WITH NEG ENTRY- NOTE THIS USE
/OF JMS INSTRUCTION FOLLOWING LIST 2 AND LIST 10 AND ELSEWHERE.
COMBO,	JMS TSTOUT	/TEST OUTPUT, WAIT FOR KB FLAG, THEN
	TAD ARG0	/NEXT
	SNA 
	IAC
	CIA
	DCA COUNTP
	TAD CCON	/TO COM THRU AXTAR
	DCA TE1
COMB,	TAD CCON	/COM1-1
	DCA AXTAR
	DCA ARG0
	JMP PUNCN+1

CCON,	.+1
	JMP I AXTAR
	JMP FORM+1	/FORM-FEED
	JMP I KILL1	/KILL
	JMP TELEN	/READ
	ISZ COUNTP
	JMP COMB
	JMP I VRSTR2
	NOP
	NOP
LIST10=.
	211	/TAB
	212	/LF EXECUTES CRLF FUNCTION
C213,	213	/VERTICAL TAB IS THE ERASE AND RESET
	215	/CR WILL EXECUTE LINENO
	2	/EXECUTES THE STABILIZATION FUNCTION
FORM,	JMS TSTOUT	/FORM
	TAD C214
	JMS I OUT1
	JMS LEAD
	JMP I TE1

LIST4=.
	375	/ALT
	212	/LF
	211	/TAB
LIST13=.
	377	/RO
	215	/CR

PUNCN,	JMS TSTOUT	/TEST OUTPUT, WAIT FOR KB AND THEN
	ISZ ECHOSW	/PUNCH
	JMS LEAD
	JMP I LIS

LEAD,	0	/LEADER-TRAILER
	TAD M41
	DCA TSTOUT
	JMS I OUT1
	ISZ TSTOUT
	JMP .-2
	DCA TCNT
	JMP I LEAD

TSTOUT,	0	/TEST OUTPUT-SET OUTPUT DEVICE FROM
	KSF	/BIT 10 AND WAIT FOR KB FLAG TO BEGIN OUTPUT
	JMP .-1
	ISZ ECHOSW	/SET FOR PRINTING
	LAS	/BIT10 FOR OUTPUT
	RTR
	SZL CLA
	TAD HIGH
	TAD OUTL1
	DCA OUTDEV
	PLS	/RAISE OUTPUT FLAG.
	JMP I TSTOUT
HIGH,	OUTH-OUTL
WSAV2,	-1
WRITE,	TAD ARG0
	SNA	/W WITH NO ARGUMENTS=USE PREVIOUS ONES
	JMP .+4
	DCA WSAV1	/SAVE NON-ZERO STARTING LINE
	TAD ARG1
	DCA WSAV2
	TAD WSAV2
	DCA ARG1
	TAD WSAV1
	DCA ARG0
	TAD C213
	JMS I OUT1	/SETUP LIMITS, ERASE SCREEN IF IN :W
	JMP I LIS	/START DATA


TELEN,	DCA ECHOSW	/READ
	LAS	/TEST INPUT BITS.
	RTR	/BIT11 FOR INPUT
	SMA CLA
	JMP I APP1
	TAD INHIGH
	DCA INDEV
	RFC
	JMP I APP1
INHIGH,	I750
MOVEM,	TAD VEC1	/MOVE-TEST FOR GOOD ARGS.
	CIA
	TAD VEC3
	SPA CLA	/A,B,CM: C<A?
	JMP .+6
	TAD VEC2
	CMA
	TAD VEC3
	SPA SNA CLA	/TEST COMMAND LOGIC
	ESCAPE
	TAD VEC1	/A
	JMS I FIN1
	DCA VEC1
	IAC
	TAD VEC2	/B
	JMS I FIN1
	DCA VEC2
	TAD VEC3	/C
	JMS I FIN1
	DCA VEC3	/ALL FOUND.
	TAD I VEC1	/SWAP POINTERS
	DCA TEMP
	TAD I VEC2
	DCA I VEC1
	TAD I VEC3
	DCA I VEC2
	TAD TEMP
	DCA I VEC3
	JMP I TE1
LIST1=.
	254	/COMMA IS ARG DELIMITER
	215	/CR IS IGNORED
	212	/LF IS IGNORED
	240	/SPACE ASSUMES + SIGN
	253	/PLUS USED IN BCD DECODER
	255	/MINUS ALSO
	256	/.=THIS LINE NUMBER
	257	//=LAST LINE NUMBER
	274	/<=L.-1
	275	/PRINTS DECIMAL VALUE PRECEDING =
	276	/>=.+1
	000	/NULL USED TO EXIT FROM SLAS ETC.
	252	/* TO INTENSIFY A VECTOR
LISTX,	0	/: IS THE GRIN COMMAND CALL
	0	/; IS THE GRIN COMMAND TERMINATOR (ALSO ALT)
	377	/RUBOUT RESTARTS THE COMMAND DECODER

	307	/G GETS THE TEXT STRING
	224	/^T SETS OUTPUT TO TELETYPE
	223	/^S SETS OUTPUT TO THE SCOPE
	213	/VERTAB ERASES THE SCREEN
	243	/# PRINTS REMAINING BUFFER STORE
	214	/FORMFEED ENDS INPUT VIA TRANSL
	-1	/SPARE LOCATIONS

/THIS PROGRAM PERMITS ECHO DIRECT ON THE TUBE INSTEAD OF TTY
MARG,	-435
WASL,	OUTL-DSPY
ITSL,	TAD WASL
ITSW,	TAD DSPYI
	DCA VIEWSW	/THIS PTR WILL BE OUTL (FOR TTY) OR DSPY
	JMP I TE1	/BACK TO KEYBOARD COMMAND MONITOR


OPS10=.
	OUTTAB+4	/TAB IS CONVERTED INTO SPACES
	CR	/LF GIVES CRLF FUNCTION
	RESET	/VER TAB GIVES ERASE AND RESET FUNCTION
	LINENO	/CR
	SYNC	/CONTROL-SHIFT-BACK ARROW SYNCS CHARACTER
MARG1,	-376
LINENO,	TAD MARG	/HERE FOR CR. PRINTS BUFFER LINE NUMBER
	DCA XCPR	/SET CHARACTER POSITION REGISTER (CPR) TO LEFT MARGIN
	TAD OUTCH1
	DCA VPRNT	/SET PTR FOR PRINT
	TAD C240
	JMS I OUTCH1

	TAD THSN
	JMS I PRNT2	/PRINT LINE NUMBER
	JMP I DSPY	/AND EXIT

/ROUTINE -RESET- ACCOMPLISHES THE "VERTAB" FUNCTION (CTRL/K).

RESET,	TAD TOP	/ERASE SCREEN, RESET INTGEGRATORS AND CPR TO TOP LEFT
	6066	/EXECUTE 
	DCA YCPR	/SET Y TO TOP
	DCA TCNT
CR,	TAD MARG1
	DCA XCPR
	TAD LINEFD	/-12 DECIMAL
	TAD YCPR
	DCA YCPR
XCUTE,	TAD C240
	JMP DSPY2	/SET INTEGRATORS TO "MARGIN".


DSPY,	0	/CALL WITH ASCII CHAR IN ACCUMULATOR
	JMS I SORTJ	/IS IT A SEARCH CHARACTER?
		LIST10-1
		OPS10-LIST10
	TAD I PACK1	/CHECK FOR CONTROL CHAR
	TAD M240
	SPA CLA
	JMP I DSPY	/IGNORE CONTROL CHAR (NO ECHO)
	TAD I PACK1
DSPY2,	JMS I OUTCH1	/OUTPUT TO DISPLAY
	JMP I DSPY	/EXIT WITH AC=0

SYNC,	TAD M7	/"WHERE ARE YOU"	A STABLIZING FUNCTION!!!
	TAD XCPR
	6064	/RAISE SCOPE FLAG
	DCA XCPR
	JMP XCUTE

TOP,	506
M7,	-7
STRING,	JMS I CHI1	/CHARACTER STRING SEARCH
	TAD MCR
	SZA CLA
	ESCAPE	/MUST TERMINATE WITH C.R.
	TAD VEC2	/SECOND ARG IS STRING COUNT
	SPA
	ESCAPE	/NEG COUNT IS GARBAGE
	SNA
	IAC	/IF NULL, MAKE IT ONE
	CIA
	DCA VEC2	/MINUS CHAR STRING COUNT
	TAD COMBEG
	DCA AXCOMB	/SET PTR TO TOP OF COMBUF
	JMS I CHI1	/GET THE CHAR STRING
	JMS I COMAN1	/LOAD THE COMBUF WITH THEM
	TAD CHAR
	TAD MCR
	SZA CLA
	JMP .-5	/TEST FOR CR TERMINATOR
	TAD COMBEG
	DCA AXCOMB	/RESET THE COMBUF PTR
	TAD VEC1
	DCA ARG0	/SET THE OUTPUT STARTING LOCATION
	TAD ST1
	DCA OUTDEV	/INTERCEPT OUTPUT TO TEST FOR MATCH
	TAD VEC1
	CIA
	TAD LSTN
	DCA ARG1	/SET THE LINE COUNT
	JMP I LIS	/AND GO LIST
ST1,	TSTRNG
TSTRNG,	0	/TESTS FOR CHAR STRING MATCH
	CIA
	DCA B	/SAVE MINUS CHAR
	TAD I AXCOMB
	TAD MCR
	SNA
	JMP ST3	/CR INDICATES MATCH IS COMPLETE
	TAD CCR
	TAD B
	SNA CLA
	JMP I TSTRNG	/A MATCH WAS FOUND
ST4,	TAD COMBEG
	DCA AXCOMB
	JMP I TSTRNG	/NO MATCH FOUND, RESTART PTR
ST3,	ISZ VEC2	/INCREMENT AND TEST MATCH COUNT
	JMP ST4	/NOT ENOUGH MATCHES YET
	TAD VIEWSW
	DCA OUTDEV	/PRINT LINE NO OF MATCH
	DCA TCNT
	CMA
	JMP I .+1
	L0-1
OPS1=.
	GTOP	/COMMA
	GSTART+2	/CR
	GSTART+2	/LINEFEED
	GEXP	/SPACE
	GEXP	/PLUS
	GMIN	/MINUS
	PERI	/POINT
	SLAS	/SLASH
	EXLAS	/BACKUP
	PRNT	/=
	EXNEX	/NEXT
	DBCV2	/DUMMY
	ASTER	/*
	COLON	/:
	ALT3	/ALT (MOD 33)
	GSTART	/COMMAND RUBOUT, COMPILER MODE
	STRING	/G GETS STRING:M,N G CR STRING CR;M=START LINE,N=NO OF OCCURENCES
	ITSL	/CONTROL T SETS OUTPUT TO TTY
	ITSW	/CONTROL S SETS OUTPUT TO DISPLAY
	GSTART+2	/VERTAB WILL RETURN TO RESTART
	NUMSGN	/# WILL PRINT ASCII BUFFER SIZE
	VRSTR	/FORM FEED CLEARS ALL PATCHES
	START	/SPARE ENTRY
/THIS IS THE ROUTINE WHICH ACTUALLY EXECUTES THE 
/STROKES, POINT DISPLAYS, AND OTHER FUNCTIONS FOR
/THE KV8/I CONTROLLER...
/DISPLAY OUTPUT AUTO SEQUENCE

VOUT,	0
	6071	/WAIT FOR READY FLAG
	JMP .-1
VSTATE,	6064	/AUTO SEQUENCED INSTRUCTION
	ISZ VSTATE	/SEQUENCE
	CLA 
	JMP I VOUT


/THIS IS THE ROUTINE WHICH DEALS WITH THE "MASK" AND
/"DISPATCH" CONTROL WORDS FOR THE ACTUAL DETERMINATION
/AND EXECUTION OF THE APPROPRIATE VECTOR STROKES TO 
/BE DISPLAYED ON THE SCOPE.....

SAR1,	SAR
MASKS,	MASK0-1

OUTCHM,	0	/DISPLAY CHARCTER. ENTER WITH ASCII 240-337
	AND C77	/MASK TO 6 BITS
	CLL RAL	/*2
	TAD SAR1	/ADD DISPATCH
	DCA A
	TAD I A	/THIS IS MASK WORD
	AND C7	/MASK OFF MASK BITS
	CLL RAL	/*2
	DCA B
	TAD B
	CLL RAL	/*4
	TAD B	/*6 NOW
	TAD MASKS	/6 TIMES MASK + MASK HEAD POINTER
	DCA C	/PTR FOR MASK ADDRESSES
	TAD I A
	CLL RAR
	DCA B	/SETS INTENSIFY BLANKING BITS, FIRST ALWAYS BLANKED
	ISZ A
	TAD I A
	DCA A	/RETRIEVE CONTROL WORD
	DCA H	/SETS LEFT HALF
	TAD C7
	TAD XCPR
	DCA XCPR	/CHAR ADVANCE
VA,	TAD H
	CIA
	DCA H	/RESET HALFWORD SWITCH
	ISZ H
	ISZ C	/ADVANCE PTR ON ZERO H
	TAD A
	SNA	/TEST NEXT CONTROL BIT
VAX,	JMP I OUTCHM	/ZERO MEANS ALL VECTORS WERE EXECUTED, SO EXIT
	CLL RAL
	DCA A	/NEXT CONTROL BIT IN LINK
	SNL	/THIS IS THE Y0 "MARGIN" POINTER IN 2'S COMP..
	JMP VA	/NOT AN EXECUTION

	TAD C6064	/INITIALIZE VOUT
	DCA VSTATE
	TAD H	/0 IF RIGHT HALF, 1 IF LEFT HALF
	CLL RAR	/INTO LINK
	TAD I C	/GET MASK ADDRESS
	SZL
	JMS I ROT6RI	/LH
	DCA S

	TAD S
	RTR
	RAR
	AND C7
	TAD XCPR	/ADD X MASK TO CPR
	JMS VOUT	/LOAD X
	TAD S
	AND C7
	TAD YCPR	/ADD Y MASK TO CPR
	JMS VOUT	/LOAD Y

	TAD B
	CLL RAL
	DCA B	/RETRIEVE NEXT BLANKING BIT INTO LINK
	RAL	/AND THEN INTO BIT 11
	TAD CEX	/EXECUTE ABSOLUTE (VISIBLE) VECTOR
	JMS VOUT
	JMP VA	/BACK FOR MORE VECTORS
/THE FOLLOWING PARTS ARE THE CHARACTER TABLES FOR THE CHARACTER
/GENERATOR .

/CHARACTER MASK COORDINATES


MASK0,	0301	/D,J,5,&,%,]
2143
4145
2705
0747
0301
	0701	/L,U,V,W,X,Y,I,T,N,M,0,1,(,),]
0706
2447
2724
2141
0147
	0141	/2,S,4,9,7,Z,$,/,\,<,>
0747
4404
0747
0141
2127
	0424	/A,C,E,F,G,H,K,0,Q,R,P,3,6,8,L,B
3444
4147
0701
4144
2404
	2622	/^,B.A.,-,+,*
4305
4503
0426
4404

CEX,	400	/MASK 4 USES ONLY 10 PTS.

	4525	/@,#,=
0503
2343
4721
2707
0141
	0627	/",',;,:,?,!,,,
2525
4524
2323
1121
2147
SAR=.	/CHARACTER DISPATCH TABLE
7745	/@
6347
5603	/A
4760
7703	/B
2175
7003	/C
0170
7700	/D
3551
5603	/E
5170
5403	/F
5160
7603	/G
0176
5203	/H
4760
5201	/I
1156
7000	/J
5404
6503	/K
6172
6003	/L
0070
7401	/M
3304
7001	/N
3005
7403	/O
0370
7403	/P
4560
7603	/Q
2370
7503	/R
4572
7602	/S
6360
5001	/T
1150
7001	/U
6005
6001	/V
4011
7401	/W
6205
5001	/X
1007
6401	/Y
1330
7002	/Z
0074
7001	/[
0154
4002	/\
0044
7000	/]
3050
5404	/^
6070
6404	/B.A.
2074


0000	/SP
7000	/EXECUTE 3 "INVISIBLE" VECTOR STROKES.
5006	/!
2046
5006	/"
3201
5245	/#
5572
7642	/$
6363
6740	/%
1675
6760	/&
3637
4006	/'
3000
6001	/(
0124
6001	/)
1202
5204	/*
7700
5004	/+
6014
4006	/,
0030
4004	/-
0014
4006	/.
0060
4002	//
4400
7601	/0
3107
6401	/1
0456
7602	/2
1714
5503	/3
4770
6402	/4
0364
7600	/5
3434
7603	/6
0175
6002	/7
0070
5703	/8
4770
7402	/9
0364
5006	/:
1460
5006	/;
1430
6002	/<
2120
5005	/=
5500
6002	/>
4240
7506	/?
6346
/THIS IS THE LAST OF THE CHARACTER DISPATCH TABLE.....

	211	/TAB
	257	/SLASH
BUFBEG=.-1	/BEGINNING OF THE DATA AREAS:
/INPUT COMMAND BUFFER-EDGRIN SCRATCH BUFFER FOR SUBR AND PUSHDOWN
/THEN EDGRIN BINARY BUFFER
/THEN THE ASCII BUFFER. ASCII BUFFER STARTS HERE WHEN NO GRAPHICS


PAUSE

