/11 OS8 SET (PAL8/MACREL VERSION)

/
/S.R.
/
/
/	S E T
/
/
/
/
/
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
/AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/CORPORATION. DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED TO THE PURCHASER
/UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
/(WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
/SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/	COPYRIGHT (C) 1977,1978 BY DIGITAL EQUIPMENT CORPORATION.
/
/
/
/
/	EDIT HISTORY:

/	19-MAR-77	S.R.	REMOVED FROM CAMP V4
/	19-MAR-77	S.R.	FIXED BUG WITH SET MTA FILES
/	19-MAR-77	S.R.	FIXED BUG WITH SET CDR
/	19-MAR-77	S.R.	FIXED BUG WITH = OPTION
/	19-MAR-77	S.R.	CONVERTED TO MACREL CODE
/	01-APR-77	S.R.	TTY PAUSE
/	01-APR-77	S.R.	TTY HEIGHT
/	01-APR-77	S.R.	TTY SCOPE
/	17-APR-77	S.R.	REWROTE TTY PAGE
/	17-APR-77	S.R.	DEV: DVCODE
/	17-APR-77	S.R.	FINISHED TTY SCOPE
/	27-APR-77	S.R.	TTY COL
/	27-APR-77	S.R.	SYS OPTIONS (INIT, OS8, OS78)
/	03-MAY-77	S.R.	LA8A, LA78
/	03-MAY-77	S.R.	INIT OS78 FIXES TERMINATE
/	03-MAY-77	S.R.	BASIC FIXES
/	29-JUN-77	S.R.	TTY ARROW	(NOT FOR PS/8)
/	29-JUN-77	S.R.	TTY ESC		(NOT FOR PS/8)
/	29-JUN-77	S.R.	DEV BLK LOC	(NOT FOR PS/8)
/	 8-DEC-77	S.R.	ADDED SYMBIONT SUPPORT
/	23-MAY-78	S.R.	FIXED SCOPE BUG AND 2-PAGE SYS HANDLER BUG
/	 8-JUN-78	S.R.	FIXED WIDTH=N BUG

/	MUST SKIP LOCS 1000-1777

	LINBUF=1000

	AUXBUF=6600

	IFDEF EDF <MACREL=1>
	IFNDEF EDF <MACREL=0>

	IFNZRO MACREL	< .ASECT AAA
	>
	IFZERO MACREL < *0 >

	0
	CIF 30
	JMP .-1
	IFNZRO MACREL <	.XSECT XSET
	>
	IFZERO MACREL < *10 >

XR1,	0
XR2,	0
XR3,	0

	IFNZRO MACREL <	.ZSECT ZSET
	>
	IFZERO MACREL < *20 >
TEMP,	0
T,	0
T2,	0
LINPTR,	0
T3,	0
FLAG,	0
SPKNT,	0
DEVTYP,	0		/DEVICE TYPE (BITS 6-11)
ENTRY,	0		/HANDLER ENTRY POINT
NUM,	0
TYP,	0		/0 MEANS 'F', 1 MEANS 'R'
T4,	0
DEVNUM,	0
DCW,	0		/DEVICE CONTROL WORD
DCWPTR,	0
USR,	200		/POINTS TO USR ENTRY POINT
ESCBIT,	0		/1 MEANS USER TYPED ALTMODE
CNT,	0
CTOFLG,	0		/-1 MEANS SAW ^O
PTR,	0
DHIT,	0		/DEVICE HANDLER INFO TABLE - 1
DHI,	0		/DEVICE HANDLER INFO
DBLK,	0		/DEVICE HANDLER BLOCK
VNOPTR,	0		/PTS TO VERSION # IN HANDLER
VNO,	0		/CURRENT HANDLER VERSION NUMBER
SAVPTR,	0
NO,	0		/1 MEANS 'NO'
FLG,	1		/1 MEANS SAW NO DIGITS
RR,	0
NUCODE,	0
SCOP,	0		/NON-0 IF TTY IS SCOPE
NUM2,	0

/0000-0777	/SET
/1000-1377	/OS/8 LINE BUFFER
/1400-1777	/PS/8 LINE BUFFER
/2000-6577	/SET
/6600-7177	/AUXILIARY I/O BUFFER
/7000-7177	/I/O BUFFER FOR TECO CCB
/7200-7577	/OS/8 HANDLER
/7600-7777	/OS/8

	SCPBIT=7726	/BIT 4
	IFNZRO MACREL <	.ASECT ASET
	>
	*200

START,	SKP
	JMP CHN
	TAD ("#
	JMS I [TYPE
	JMS BIT
	JMS I [READ	/READ A LINE INTO OS/8 LINE BUFFER
CHN,	TAD [LINBUF	/CHAIN ENTRY ADDRESS
	DCA LINPTR	/INITIALIZE POINTER TO LINE BUFFER
	JMS BIT
	STA
	JMS I [SPACE	/IGNORE LEADING SPACES
	JMS GETTWO	/GET TWO CHARS
	DCA TEMP
	JMS I [SCAN	/SCAN PAST EXTRA LETTERS OR DIGITS
	TAD TEMP
	JMS I [BRANCH	/GO TO APPROPRIATE ROUTINE
	-2305;SET	/SE
	-2605;VERSION	/VE
	-1005;HELP	/HE
	0
	SNA CLA
	JMP I [GOAWAY
	JMP I [SYNTAX	/NONE OF THESE

BIT,	0
	CDF 10
	TAD I (SCPBIT
	CDF 0
	AND [200
	DCA SCOP	/NOTE WHETHER TTY IS SCOPE	V3D
	TAD I (7612
	TAD (-3
	SNA CLA
	JMS I (FIX2P	/FIXUP 2-PAGE SYSTEM HANDLER
	DCA .-1		/ONCE
	JMP I BIT
/	GETTWO

/GET TWO LETTERS OR DIGITS FROM INPUT LINE, PACK IN SIXBIT
/ADVANCE PAST THEM. SUBSTITUTE NULL IF NOT FOUND.

GETTWO,	0
	JMS GETSIX
	CLL RTL
	RTL
	RTL
	DCA T2
	JMS GETSIX
	TAD T2		/COMBINE
	JMP I GETTWO

GETSIX,	0		/GET A SIXBIT LETTER OR DIGIT (OR NULL)
	JMS ALPHA	/IS IT ALPHANUMERIC?
	JMP NOTALPH	/NO
	AND [77		/YES
	JMP I GETSIX	/TRUNCATE TO SIXBIT
NOTALPH,CLA
	JMS BACKC
	JMP I GETSIX	/RETURN NULL

GETC,	0		/GET A CHARACTER, ADVANCE POINTER
	TAD I LINPTR
	AND [177	/ALWAYS RETURN 8-BIT
	SZA
	TAD [200	/WITH HIGH ORDER BIT ON
	ISZ LINPTR	/ADVANCE SCAN
	JMP I GETC	/RETURN

BACKC,	0		/MOVE SCAN POINTER BACK ONE
	STA
	TAD LINPTR
	DCA LINPTR
	JMP I BACKC	/RETURN
/RETURN 1	NOT OF TYPE DESIRED
/RETURN 2	DESIRED TYPE
/IN BOTH CASES, CHAR IS LEFT IN AC

ALPHA,	0		/LOOK FOR ALPHANUMERIC
	JMS I [GETC
	JMS LETTER	/IS IT A LETTER?
	JMP TRYDIG	/NO, TRY DIGIT
	JMP GOTAL	/YES
TRYDIG,	JMS DIGIT	/IS IT A DIGIT?
	JMP I ALPHA	/NO, AINT LETTER OR DIGIT
GOTAL,	ISZ ALPHA	/YES, EITHER LETTER OR DIGIT
	JMP I ALPHA	/RETURN WITH IT IN AC

LETTER,	0		/LOOK FOR LETTER
	TAD (-"A
	CLL
	TAD ("A-"Z-1
	SNL
	ISZ LETTER
	TAD ("Z+1	/RESTORE CHAR
	JMP I LETTER

DIGIT,	0		/LOOK FOR DIGIT
	TAD (-"0
	CLL
	TAD ("0-"9-1	/(DECIMAL)
	SNL
	ISZ DIGIT
	TAD ("9+1	/RESTORE DIGIT TO CHARACTER FORM
	JMP I DIGIT	/AND RETURN WITH IT IN AC
HELP,	JMS I [PRINT
	TEXT	/SET DEV: [NO] ATTRIB [N]/
	JMS I [PRINT
	TEXT	/VERSION/
	JMS I [PRINT
	TEXT	/HELP/
	JMP I [START
	PAGE
SYNTAX,	CLA
	JMS PRINT
	TEXT	/? SYNTAX ERROR/
GOAWAY,	TAD ESCBIT
	SZA CLA
	JMP I [7605	/LINE ENDED WITH ESCAPE
	TAD I [READ	/WAS 'READ' EVER CALLED?
	SZA CLA
	JMP I [START	/YES, GET A NEW LINE
	JMP I [7605	/NO, WE MUST'VE BEEN CHAINED TO, RECALL KBM

PRINT,	0
	TAD I PRINT
	RTR
	RTR
	RTR
	JMS PRIN
	TAD I PRINT
	JMS PRIN
	ISZ PRINT
	JMP PRINT+1
LV,	JMS I [CRLF
	ISZ PRINT
	JMP I PRINT

PRIN,	0
	AND [77
	SNA
	JMP LV
	TAD [240
	AND [77
	TAD [240
	DCA T3
	TAD [200
	KRS
	TAD (-203
	SNA
	JMP CTRLC
	TAD (203-217	/^O
	SNA CLA
	JMS CTRLO
	TAD T3
	JMS I [TYPE
	JMP I PRIN
CTRLC,	TAD ["^
	JMS I [TYPE
	TAD ("C
	JMS I [TYPE	/ECHO "^C"
	JMS I [DELAYY
	JMP I [7600	/THEN GO AWAY
CTRLO,	0
	KCC		/CLEAR OUT ^O
	TAD ["^
	JMS I [TYPE
	TAD ("O
	JMS I [TYPE
	JMS I [CRLF
	STA
	DCA CTOFLG	/STOP ECHOING
	JMP I CTRLO

NUMBIG,	JMS PRINT
	TEXT	/? NUMBER TOO BIG/
	JMP I [GOAWAY
NONEX,	JMS PRINT
	TEXT	/? CAN'T - DEVICE DOESN'T EXIST/
	JMP I [GOAWAY

SYSERR,	JMS PRINT
	TEXT	\? I/O ERROR ON SYS:\
	JMP I [GOAWAY
FIX2P,	0
	TAD (66
	DCA I TB
	ISZ .-1
	ISZ KTR
	JMP .-4
	JMP I FIX2P
TB,	TP1;TP2;TP3;TP4
KTR,	-4
	PAGE
SYSOS8,	0
	TAD NO		/REVERSE MEANING OF 'NO'
	SNA CLA
	IAC
	DCA NO
	JMS SYS78
	JMP I SYSOS8

SYS78,	0
	TAD [7771
	JMS I [SET200
	JMS I [7607
	200
	AUXBUF
	0
	JMP I [SYSERR
	TAD (AUXBUF+371
	JMS I [SET200
	JMS I [7607
	4200
	AUXBUF
	0
	JMP I [SYSERR
	JMS I [7607	/THERE'S A 2ND COPY
	200		/IN BLOCK 11 LOCATION 56
	AUXBUF
	11
	JMP I [SYSERR
	TAD (AUXBUF+56
	JMS I [SET200
	JMS I [7607
	4200
	AUXBUF
	11
	JMP I [SYSERR
	JMS I (FIXCCL
	JMP I SYS78
SYSINI,	0
	JMS I [GETC
	SNA CLA
	JMP DEFINI	/ASSUME @INIT
	TAD NO
	SZA CLA
	JMP I [SYNTAX	/SET SYS NO INIT CMD
	JMS I [BACKC
	TAD LINPTR
	DCA SAVLP
	TAD (-6		/ALLOW A MAXIMUM OF 5 CHARS
	DCA SAVKN
SAVLUP,	JMS I [GETC
	SNA CLA
	JMP DEFDO
	ISZ SAVKN
	JMP SAVLUP
	JMS I [PRINT
	TEXT	/? INITIAL COMMAND TOO BIG/
	JMP I [GOAWAY

SAVKN,	0
SAVLP,	0

DEFINI,	TAD (INIMSG
	DCA SAVLP
DEFDO,	JMS I [7607
	200
	AUXBUF
TP1,	0
	JMP I [SYSERR
	TAD NO
	SZA CLA
	TAD (400-1077
	TAD (1077
	DCA I (AUXBUF+77
	JMS I [7607
	4200
	AUXBUF
TP2,	0
	JMP I [SYSERR
	TAD NO
	SZA CLA
	JMP I SYSINI
	JMS I [7607
	200
	AUXBUF
	11
	JMP I [SYSERR
	STA
	TAD SAVLP
	DCA XR2
	TAD (AUXBUF-1
	DCA XR3
	TAD (-5
	DCA SAVKN
MOVL,	TAD I XR2
	DCA I XR3
	ISZ SAVKN
	JMP MOVL
	JMS I [7607
	4200
	AUXBUF
	11
	JMP I [SYSERR
	JMP I SYSINI

INIMSG,	"@;"I;"N;"I;"T;0
	PAGE
	*1400

/THIS WON'T ALWAYS WORK UNDER PS/8:

TTGGO,	JMP I TTGAG
TTGAG,	0
	JMS I [TTST1
	JMS I [PRINT
TEXT /A FUNNY THING HAPPENED TO ME ON THE WAY TO THE COMPUTER ROOM./
	JMS I [PRINT
TEXT /A PANHANDLER CAME UP TO ME AND SAID,/
	JMS I [PRINT
TEXT /"CAN YOU SPARE ME $25,000 FOR A CUP OF COFFEE?"/
	JMS I [PRINT
TEXT /"WHY SO MUCH?", I ASKED IN AMAZEMENT./
	JMS I [PRINT
TEXT /"THINGS HAVE BECOME SO AUTOMATED", HE REPLIED,/
	JMS I [PRINT
TEXT /"THAT THE ONLY WAY I CAN ORDER IT/
	JMS I [PRINT
TEXT /IS WITH A COMPUTER ORDER FORM"./
	JMP I (TTGGO
TTESC,	0		/V3D
	JMS I (OLDTST
	JMS I [SRCH
	200;200;44
	JMP I [REASEM
	TAD (-4
	DCA TEMP	/SEE SOURCE OF KL8E
	TAD NO
	SZA CLA
	TAD (7640-CLA	/YES
	TAD (CLA	/NO
	DCA I TEMP
	JMP I TTESC

TTAROW,	0		/V3D
	JMS I (OLDTST
	JMS I [SRCH
	200;200;7740
	JMP I [REASEM
	IAC
	DCA TEMP
	TAD I TEMP
	RAL
KSPA,	SPA CLA
	JMP I [REASEM
	ISZ TEMP
	ISZ TEMP
	TAD TEMP
	TAD (3
	DCA TEMP2
	TAD NO
	SNA CLA
	JMP YESARO	/YES
	TAD KSPA	/NO
NOAROW,	DCA I TEMP
	JMP I TTAROW
YESARO,	TAD I TEMP2
	JMP NOAROW
GENBLK,	0		/V3D
	JMS I (GENCMN
	TAD NUM2
	DCA BLOK	/GET BLOCK NUMBER
	TAD (LOC
	JMS I [KEYSRCH
	JMP I [SYNTAX
	JMS I (GENCMN	/GET LOCATION
	TAD [-400
	CLL
	TAD NUM2
	SZL CLA
	JMP I [NUMBIG
	TAD NUM2
	TAD PAUXBUF
	DCA NUM2
	JMS I ENTRY	/READ BLOCK
	200
PAUXBUF,AUXBUF
BLOK,	0
	JMP I [SYSERR
	TAD TEMP
	SNA CLA
	JMS I (ODT
	JMS I [ONUM
	DCA NUM
	CLA IAC
	DCA DEVNUM	/FAKE OUT - PREVENTS RE-WRITING USED HANDLER
	TAD FLG
	SZA CLA
	JMP I GENBLK
	JMS I [GETC
	SZA CLA
	JMP I [SYNTAX
	TAD NUM
	DCA I NUM2	/SET NEW VALUE
	TAD BLOK
	DCA BLOK2
	JMS I ENTRY
	4200
	AUXBUF
TEMP2,
BLOK2,	0
	JMP I [SYSERR
	JMP I GENBLK
	PAGE
	*2000

/ORIGIN PAST OS/8 LINE BUFFER AT 1000.
/SKIP PAST PS/8 LINE BUFFER (AT 1400) JUST IN CASE
/PS/8 USERS WISH TO PATCH THIS PROGRAM

/SCAN PAST EXTRA LETTERS OR DIGITS

SCAN,	0
	JMS I [ALPHA
	JMP NOPE
	CLA
	JMP SCAN+1
NOPE,	CLA
	JMS I [BACKC
	JMP I SCAN

/SCAN PAST SPACES; GIVE ERROR IF NO SPACES FOUND UNLESS AC=-1

SPACE,	0
	DCA FLAG	/SET AC=-1 TO PREVENT ERROR ON NO SPACES FOUND
	DCA SPKNT	/INITIALIZE SPACE COUNTER
	SKP		/JUMP INTO LOOP
GOTSP,	ISZ SPKNT
	JMS I [GETC	/GET NEXT CHAR
	TAD [-240
	SNA CLA		/IS IT A SPACE?
	JMP GOTSP	/YES, COUNT IT
	JMS I [BACKC	/NO, PUT IT BACK
	ISZ FLAG	/CHECK FLAG
	SKP		/USER DIDN'T SPECIFY FLAG
	JMP I SPACE	/-0 MEANT DON'T CHECK IF FOUND SPACE
	TAD SPKNT	/HOW MANY SPACES DID WE FIND?
	SZA CLA
	JMP I SPACE	/SOME.  OK
	JMP I [SYNTAX	/NONE.  TSK. TSK.
BRANCH,	0
	DCA T
BR2,	TAD I BRANCH
	ISZ BRANCH
	SNA
	JMP NOTFND
	TAD T
	SNA CLA
	JMP FOUND
	ISZ BRANCH
	JMP BR2

FOUND,	TAD I BRANCH
	DCA T
	JMP I T		/FOUND ITEM IN COLUMN 1, JUMP TO ADDRESS IN COL 2

NOTFND,	TAD T
	JMP I BRANCH	/IF NOT FOUND IN COL 1, RETURN WITH AC INTACT

BADKBM,	CDF 0
	JMS I [PRINT
	TEXT	/? OLD VERSION OF KBM/
	JMP I [GOAWAY
	LLS=6666
	DBTD=6574
	LSF=6661
	DBST=6570

LP78,	0
	TAD (CMA-NOP
	JMS LP8A
	JMP I LP78

LP8A,	0
	TAD (NOP	/AC MAY BE NON-0
	DCA LPKOD
	JMS I (LPTST1
	TAD VNO
	TAD (-2
	SNA CLA
	JMP I (OLDERR
	JMS I [SRCH
	0;200;7700
	JMP I (OLDERR
	TAD (3
	DCA TEMP
	TAD I TEMP
	AND [7000
	TAD [-7000
	SZA CLA		/NOP OR CMA
	JMP I (OLDERR
	TAD LPKOD
	DCA I TEMP
	ISZ TEMP
	TAD I TEMP
	AND [7000
	TAD (-6000
	SZA CLA
	JMP I (OLDERR
	TAD LPKOD
	AND [70
	SZA CLA
	TAD (DBTD-LLS
	TAD (LLS
	DCA I TEMP
	ISZ TEMP
	TAD LPKOD
	DCA I TEMP
	JMS I [SRCH
	100;100;6203
	JMP I (OLDERR
	TAD (2
	DCA TEMP
	TAD LPKOD
	AND [70
	SZA CLA
	TAD (DBST-LSF
	TAD (LSF
	DCA I TEMP
	JMP I LP8A

LPKOD,	0
	PAGE
/READ A LINE INTO OS/8 LINE BUFFER

READ,	0
	DCA CTOFLG	/ALLOW ECHOING
RD1,	TAD [LINBUF
	DCA LINPTR
	DCA ESCBIT
GT,	JMS I [GET
LOOK,	JMS I [BRANCH
	-377;RUBOUT
	-217;GT		/^O
	-203;CTRLC	/^C
	-212;LF		/LINE FEED
	-215;CR		/CARRIAGE RETURN
	-375;ESCAPE	/ALTMODE
	-376;ESCAPE	/ALTMODE (2ND FLAVOR)
	-233;ESCAPE	/ESCAPE
	-225;CTRLU	/^U
	-200;GT		/IGNORE NULLS
	-223;GT		/IGNORE ^S
	0
	DCA TEMP	/NONE OF THESE
	TAD LINPTR
	TAD (-LINBUF-377
	SNA CLA		/AT END OF LINE BUFFER?
	JMP GT		/YES, DON'T ACCEPT CHAR
	TAD TEMP	/NO, RETRIEVE CHAR
	JMS I [TYPE	/ECHO IT
	TAD TEMP	/INSERT IN BUFFER
	DCA I LINPTR
	ISZ LINPTR	/BUMP POINTER
	JMP GT		/NEXT

CTRLU,	TAD ["^
	JMS I [TYPE
	TAD ("U
	JMS I [TYPE	/ECHO "^U" <CR><LF>
	JMS I [CRLF
RDA,	TAD ("#
	JMS I [TYPE
	JMP RD1
	BS=10

RUBOUT,	TAD LINPTR
	TAD [-LINBUF
	SNA
	JMP BOL		/AT BEGIN OF LINE
	TAD [LINBUF-1
	DCA LINPTR	/MOVE POINTER BACK ONE
	TAD SCOP
	SZA CLA
RUB3X,	TAD (BS-"\
	TAD ["\
	JMS I [TYPE	/ECHO "\"
RUB3,	TAD SCOP
	SNA CLA
	JMP .+3
	TAD [40
	SKP
	TAD I LINPTR
	JMS I [TYPE	/ECHO RUBBED-OUT CHARACTER
	TAD SCOP
	SNA CLA
	JMP GT2
	TAD [BS
	JMS I [TYPE
GT2,	JMS I [GET
	JMS I [BRANCH
	-377;RUB2
	-216;GT2	/IGNORE ^O
	-203;CTRLC	/^C
	0
	DCA TEMP	/A NEW CHAR
	TAD SCOP
	SZA CLA
	JMP .+3
	TAD ["\
	JMS I [TYPE	/ENCLOSE RUBBED-OUT CHARS IN \'S
	TAD TEMP
	JMP LOOK

RUB2,	TAD LINPTR
	TAD [-LINBUF
	SNA
	JMP BOL2
	TAD [LINBUF-1
	DCA LINPTR
	TAD SCOP
	SNA CLA
	JMP RUB3
	JMP RUB3X
BOL2,	TAD SCOP
	SZA CLA
	JMP BOL
	TAD ["\
	JMS I [TYPE
BOL,	JMS I [CRLF
	JMP RDA

ESCAPE,	TAD ["$		/ECHO ESCAPE AS DOLLAR SIGN
	JMS I [TYPE
	ISZ ESCBIT	/NOTE ESCAPE
CR,	DCA I LINPTR	/INSERT 0 AT END
	JMS I [CRLF
	JMP I READ	/RETURN, WE GOT LINE
LF,	DCA I LINPTR	/TEMPORARILY INSERT A 0 SENTINEL
	TAD [LINBUF-1
	DCA XR1
	JMS I [CRLF
	TAD ["#
	JMS I [TYPE
LFLP,	TAD I XR1
	SNA
	JMP I [GT	/FINISHED, GET SOME MORE CHARS
	JMS I [TYPE	/ECHO CURRENT CHARS
	JMP LFLP
	PAGE
/GET A DECIMAL NUMBER, RETURN IT IN AC

NUMBER,	0
	DCA NUM
	CLA IAC
	DCA FLG
	JMS I [BACKC
NM1,	JMS I [GETC
	JMS I [DIGIT
	JMP EON
	TAD (-"0	/CONVERT TO DIGIT
	DCA T4
	DCA FLG		/NOTE PASSAGE OF A DIGIT
	TAD NUM
	AND [7000
	SZA CLA
	JMP I [NUMBIG
	TAD NUM
	CLL RTL
	TAD NUM
	CLL RAL
	TAD T4
	SZL
	JMP I [NUMBIG
	DCA NUM
	JMP NM1

EON,	CLA
	JMS I [BACKC
	TAD FLG
	SZA
	DCA NUM		/IF NO DIGITS, RETURN A 1
	TAD NUM
	JMP I NUMBER
/	GETDEV

/PARSES OFF A DEVICE NAME (1-4 CHARS)
/DETERMINES IF IT EXISTS
/LOADS HANDLER INTO 7200-7577 IF NOT ALREADY IN CORE
/SETS ENTRY POINT ADDRESS AT 'ENTRY'
/SETS DEVICE NUMBER AT 'DEVNUM'
/SETS DEVICE CONTROL WORD AT 'DCW'
/SETS 'DEVTYP'

GETDEV,	0
	JMS I [GETTWO
	DCA WD1
	JMS I [GETTWO
	DCA WD2
	TAD WD1
	TAD WD2
	DCA WD1		/COMBINE TWO WORDS INTO 1 (IN WD1)
	TAD WD2
	SNA CLA
	JMP INQ
	TAD WD1		/OS/8 KLUDGE FOR UNIQUENESS
	CLL RAL
	STL RAR		/FORCE BIT 0 ON IF 2ND WORD WAS NON-ZERO
	DCA WD1
INQ,	DCA WD2
	CIF 10
	JMS I USR
	12		/INQUIRE
WD1,	0		/DEVICE NAME
WD2,	0		/GETS DEVICE NUMBER
WD3,	0		/GETS ENTRY POINT
	JMP I [NONEX	/DEVICE DOESN'T EXIST
	TAD WD3
	SZA		/IS HANDLER ALREADY IN CORE?
	JMP INCORE	/YES
	TAD WD1
	DCA DW1
	TAD (7201	/ALLOW TWO PAGE HANDLER IN 7200
	DCA DW3
	DCA DW2
	CIF 10
	JMS I USR
	1		/FETCH
DW1,	0		/DEVICE NAME
DW2,	0		/GETS DEVICE NUMBER
DW3,	0		/GETS ENTRY POINT
	JMP I [NONEX	/DOESN'T EXIST
	TAD DW2
	DCA DEVNUM
	TAD DW3
	DCA ENTRY
	JMP GETYP
INCORE,	DCA ENTRY
	TAD WD2
	DCA DEVNUM
GETYP,	TAD DEVNUM
	TAD (7757
	DCA DCWPTR	/POINT INTO DEVICE CONTROL WGRD TABLE
	CDF 10
	TAD I DCWPTR	/GET DCW
	DCA DCW
	TAD DCW
	RTR
	RAR
	AND [77
	DCA DEVTYP
	STA
	TAD I (37	/GET ADDRESS OF DHIT
	DCA DHIT
	TAD DHIT
	TAD DEVNUM
	DCA DHI
	TAD I DHI
	CDF 0
	DCA DHI
	TAD DHI
	RTL
	RTL
	RTL
	AND (17
	SZA
	TAD (15
	DCA DBLK
	JMP I GETDEV

DELAYY,	0
	TAD (-10
	DCA OUTER
	ISZ ZER
	JMP .-1
	ISZ OUTER
	JMP .-3
	JMP I DELAYY
ZER,	0
OUTER,	-10
	PAGE
OLDTST,	0		/V3D
	JMS I (ASRTST
	TAD VNO
	JMS I [BRANCH
	-1;OLDERR
	-2;OLDERR
	-3;OLDERR
	-4;OLDERR
	-5;TSTOK
	ZBLOCK 4
	0
	JMP I [NEWERR
TSTOK,	JMP I OLDTST
TTPAUS,	0
	JMS OLDTST
	JMS I [SRCH
	200;100;15
	JMP I [REASEM
	TAD (-3
	DCA TEMP	/SEE SOURCE OF KL8E FOR EXPLANATION
	TAD NO
	SNA CLA
	TAD (7650-7610	/YES
	TAD (7610	/NO
	DCA I TEMP
	DCA NUM
	JMS I [GETC
	SNA CLA
	JMP NOPA	/NO PAUSE VALUE
	TAD NO
	SZA CLA
	JMP I [SYNTAX	/SET TTY NO PAUSE N
	JMS I [NUMBER
	SNA
	JMP BADPAUS
	DCA NUM
	TAD NUM		/SCALE CORRECTLY
	CLL RAL
	TAD NUM
	CLL RTL
	DCA NUM
	TAD FLG
	SZA CLA
	JMP BADPAUS	/NO DIGITS
	TAD NUM
	AND [6000
	SZA CLA
	JMP BADPAUS
	JMS I [SRCH
	300;77;7600
	JMP I [REASEM
	TAD (5
	DCA TEMP
	TAD NUM
	CIA
	DCA I TEMP
NOPA,	JMS I (BASLUK
	JMP I TTPAUS
	TAD NUM
	CIA
	DCA I (AUXBUF+1
	JMS I (BASWRI
	JMP I TTPAUS
BADPAUS,JMS I [PRINT
	TEXT	/? BAD VALUE FOR PAUSE DURATION/
	JMP I [GOAWAY
ONUM,	0
	DCA NUM
	CLA IAC
	DCA FLG
ONM1,	JMS I [GETC
	TAD (-"0-10	/CONVERT TO DIGIT
	CLL
	TAD [10
	SNL
	JMP OEON
	DCA T4
	DCA FLG
	TAD NUM
	AND [7000
	SZA CLA
	JMP I [NUMBIG
	TAD NUM
	CLL RTL
	RAL
	TAD T4
	DCA NUM
	JMP ONM1
OEON,	CLA
	JMS I [BACKC
	TAD NUM
	JMP I ONUM
	PAGE
TTCOL,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX	/SET TTY NO COL
	JMS I [GETC
	SNA CLA
	JMP BADCOL	/NO COL SPECIFIED
	JMS I [NUMBER
	SNA
	JMP BADCOL
	DCA NUM
	TAD FLG
	SZA CLA
	JMP I [SYNTAX
	TAD NUM
	AND [7770
	SZA CLA
	JMP BADCOL
	TAD (CCLNAM	/READ IN CCL.SV
	JMS I [LOOKUP
	JMP CCLNF	/CCL NOT FOUND
	TAD (2		/WANT 2ND BLOCK IN CCL
	DCA ARG2	/CCL LOCATIONS 12400-12777
	JMS I (7607
	200		/READ IN 2 PAGES
	AUXBUF
ARG2,	0
	JMP I [SYSERR
	TAD ARG2
	DCA ARG3
	TAD I (AUXBUF	/GET PTR TO DIRECT COL WORD
	SPA
	JMP OLDCCL
	TAD (AUXBUF-2400	/RELOCATE
	DCA ARG2
	TAD NUM
	DCA I ARG2
	JMS I (7607
	4200
	AUXBUF
ARG3,	0
	JMP I [SYSERR
	JMP I TTCOL
BADCOL,	JMS I [PRINT
	TEXT	/? BAD COLUMN COUNT/
	JMP I [GOAWAY

OLDCCL,	CLA
	JMS I [PRINT
	TEXT	/? WRONG VERSION OF CCL/
	JMP I [GOAWAY
TYPE,	0
	DCA TYPEM
	JMS I [DELAYY
	DCA .-1		/DELAY FIRST TIME THRU TO LET THINGS QUIET DOWN
	TAD CTOFLG
	SZA CLA
	JMP I TYPE	/NO ECHOING
	TAD TYPEM
	TLS
	TSF
	JMP .-1
	CLA
	JMP I TYPE

TYPEM,	0

CCLNAM,	FILENAME CCL.SV

CCLNF,	JMS I [PRINT
	TEXT	/? CCL.SV NOT FOUND/
	JMP I [GOAWAY
	CCLBLK=67

FIXCCL,	0
	JMS I [7607
	200
	AUXBUF
	CCLBLK
	JMP I [SYSERR
	TAD I (AUXBUF
	TAD (-"G
	SPA CLA
	JMP I (OLDCCL
	TAD (CCLTBL
	JMS I (FIXUP
	JMS I [7607
	4200
	AUXBUF
	CCLBLK
	JMP I [SYSERR
	JMP I FIXCCL
	PAGE
ESC,	"E;"S;"C;4000+"A;4000+"P;4000+"E;0

TTHGHT,	0
	JMS I (OLDTST
	JMS I [GETC
	SNA CLA
	JMP I (BADHIT	/NO HEIGHT
	TAD NO
	SZA CLA
	JMP I [SYNTAX	/SET TTY NO HEIGHT
	JMS I [NUMBER
	SNA
	JMP I (BADHIT
	DCA NUM
	TAD FLG
	SZA CLA
	JMP I (BADHIT	/NO DIGITS
	JMS I [SRCH
	300;77;7600
	JMP I [REASEM
	TAD (3
	DCA TEMP
	TAD NUM
	CIA
	DCA I TEMP
	TAD I TEMP
	ISZ TEMP
	DCA I TEMP
	JMS I (BASLUK
	JMP I TTHGHT
	TAD NUM
	CIA
	DCA I (AUXBUF
	JMS I (BASWRI
	JMP I TTHGHT
/	LOC		YES	NO
KBMTBL,	AUXBUF+313;	0210;	1100
	AUXBUF+314;	1313;	2020
	AUXBUF+316;	1324;	7240
	AUXBUF+317;	4423;	3020
	AUXBUF+322;	1313;	1440
	AUXBUF+224;	7555;	7403
	AUXBUF+225;	1207;	1302
	AUXBUF+226;	7557;	7402
	AUXBUF+227;	1207;	1302
	0

CDTBL,	AUXBUF+135;	0210;	1102
	AUXBUF+136;	1335;	2024
	AUXBUF+140;	1346;	7240
	AUXBUF+141;	4466;	3024
	AUXBUF+144;	1335;	1420
	AUXBUF+33;	7555;	7403
	AUXBUF+34;	5207;	5321
	AUXBUF+35;	7557;	7402
	AUXBUF+36;	5207;	5321
	0

CCLTBL,	AUXBUF+4;	0024;	0002
	AUXBUF+5;	0522;	0143
	AUXBUF+6;	5551;	5363
	AUXBUF+7;	5600;	6000
	0

AROW,	"A;"R;"R;"O;"W;0
	PAGE
/	SCOPE BIT ON DISK:
/	BLOCK 0		REL 126	BIT 4

/	SCOPE BIT IN MEMORY:
/	LOC 17726	BIT 4

TTSCOP,	0
/THE FOLLOWING CODE WOULD BE ADDED IF WE WANT TO
/ALLOW CHANGING KL8E SCOPE PATTERNS
/	JMS I (ASRTST
/	TAD VNO
/	JMS I [BRANCH
/	-1;OLDERR
/	-2;OLDERR
/	-3;OLDERR
/	-4;OLDERR
/	-5;TTSCOK
/	ZBLOCK 2
/	0
/	JMP I [NEWERR
TTSCOK,	JMS I (7607
	200
	AUXBUF		/READ 2 PAGES INTO AUXILIARY BUFFER
	11
	JMP I [SYSERR
	TAD (KBMTBL
	JMS FIXUP
	JMS I (7607
	4200
	AUXBUF
	11
	JMP I [SYSERR
	JMS I (7607
	200
	AUXBUF		/READ BLOCK 53 (CD)
	53
	JMP I [SYSERR
	TAD (CDTBL
	JMS FIXUP
	JMS I (7607
	4200
	AUXBUF
	53
	JMP I [SYSERR
	TAD NO		/SET SCOPE BIT
	SNA CLA
	IAC
	DCA SCOP
	CDF 10
	TAD (SCPBIT
	JMS SET200
	CDF 0
	JMS I (7607
	200
	AUXBUF
TP3,	0
	JMP I [SYSERR
	TAD (AUXBUF+126
	JMS SET200
	JMS I (7607
	4200
	AUXBUF
TP4,	0
	JMP I [SYSERR
/	JMS I [SRCH
/	366;11;7770
/	JMP I [REASEM
/	CLA
/	JMS I [SRCH
/	0;200;"\
/	JMP I [OLDERR
/	IAC
/	DCA TEMP
/	TAD NO
/	SNA CLA
/	TAD (1336-1367
/	TAD (1367
/	DCA I TEMP
	JMP I TTSCOP
SET200,	0		/DF IS SPECIALLY SET
	DCA HLTPTR
	TAD I HLTPTR
	AND (7577
	DCA TEMP
	TAD TEMP
	TAD (-HLT
	SZA CLA
	JMP I (BADKBM
	TAD NO
	SNA CLA
	TAD [200
	TAD TEMP
	DCA I HLTPTR
	JMP I SET200
HLTPTR,	0

FIXUP,	0
	DCA FIXPTR
FIXLUP,	TAD I FIXPTR
	SNA
	JMP I FIXUP
	DCA FIXLOC
	ISZ FIXPTR
	TAD NO
	SZA CLA
	ISZ FIXPTR
	TAD I FIXPTR
	DCA I FIXLOC
	TAD NO
	SNA CLA
	ISZ FIXPTR
	ISZ FIXPTR
	JMP FIXLUP

FIXPTR,	0
FIXLOC,	0
BASNAM,	FILENAME BASIC.SV

BASLUK,	0
	TAD (BASNAM
	JMS I (LOOKUP
	JMP I BASLUK
	ISZ BASLUK
	TAD (7
	DCA BASBLK
	JMS I [7607
	200
	AUXBUF
BASBLK,	0
	JMP I [SYSERR
	TAD BASBLK
	DCA BASB2
	TAD I (AUXBUF+2
	SNA CLA
	JMP I BASLUK
	JMP I (OLDBAS

BASWRI,	0
	JMS I [7607
	4200
	AUXBUF
BASB2,	0
	JMP I [SYSERR
	JMP I BASWRI
	PAGE
TTCODE,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS I [ONUM
	SNA
	JMP I [SYNTAX
	DCA NUCODE
	TAD NUCODE
	AND [7700
	SZA CLA
	JMP I [NUMBIG
	JMS I [TTST1
	TAD (7200
	DCA RR
	JMS GETIOT
	JMP I [OLDERR
	CIA
	DCA T2
TTLP,	JMS GETIOT
	JMP I [OLDERR
	CIA
	DCA T3
	TAD T3
	CIA
	TAD T2
	SNA
	JMP TTLP
	SMA CLA
	JMP .+3
	TAD T3
	DCA T2		/T2 CONTAINS NEG OF SMALLER IOT
	TAD (7200
	DCA RR
TTLP2,	JMS GETIOT
	JMP I TTCODE
	TAD T2
	SZA CLA
	CLA IAC
	TAD NUCODE
	CLL RTL
	RAL
	DCA T3
	TAD I RR
	AND (7007
	TAD T3
	DCA I RR
	JMP TTLP2
GETIOT,	0
	ISZ RR
	TAD RR
	TAD (-7600
	SNA CLA
	JMP I GETIOT
	TAD I RR
	AND [7000
	TAD [-6000
	SZA CLA
	JMP GETIOT+1
	TAD I RR
	RTR
	RAR
	AND [77
	TAD (-20
	CLL RAR
	SNA
	JMP GETIOT+1
	RAL
	TAD (20
	ISZ GETIOT
	JMP I GETIOT
NOTIMPL,JMS I [PRINT
	TEXT	/% OPERATION NOT YET IMPLEMENTED/
	JMP I [GOAWAY
SET,	JMS I [SPACE
	DCA VNO		/V3C
	JMS I [GETDEV
	JMS I [GETC
	JMS I [BRANCH
	-":;COLN
	-" ;COLN
	-"-;HYPH
	0
	JMP I [SYNTAX	/NO : OR BLANK AFTER NAME

BADHIT,	JMS I [PRINT
	TEXT	/? BAD HEIGHT SPECIFIED/
	JMP I [GOAWAY

TTALT,	0
	JMS I [TTST1
	JMP I [NOTIMPL
	JMP I TTALT
	PAGE
COLN,	STA
	JMS I [SPACE	/IGNORE OPTIONAL SPACES
	JMS I [GETC
	SNA
	JMP I [SYNTAX
	TAD (-"-
	SNA CLA
	JMP HYPH
	JMS I [BACKC
	STA
	TAD DEVNUM
	SNA CLA
	JMP SYSDV
COLN2,	DCA NAM1
	DCA NAM2
	TAD (MAIN-1	/LOOK FOR DEVICE TYPE IN MAIN TABLE
MNLUP,	DCA XR1
	TAD I XR1
	SMA SZA
	JMP NOTYP	/NOT FOUND
	TAD DEVTYP
	SNA CLA
	JMP FNDTYP
	TAD XR1
	TAD (3		/POINT TO NEXT ENTRY
	JMP MNLUP
FNDTYP,	TAD I XR1	/GET GENERIC NAME
	DCA NAM1
	TAD I XR1
	DCA NAM2
	DCA AUXFLG
	TAD I XR1	/GET PTR TO DEVICE TABLE
INTO,	DCA PTR
	DCA NO
	TAD LINPTR
	DCA SAVPTR	/SAVE SCAN POINTER
	JMS I [GETTWO
	TAD (-1617
	SNA CLA		/ARE NEXT TWO CHARS 'NO'?
	JMS SAWNO	/YES
	TAD SAVPTR	/NO
	DCA LINPTR	/RESTORE PTR
SCNLUP,	TAD I PTR
	SNA		/GET NEXT KEYWORD POINTER
	JMP NOKEY
	ISZ PTR		/POINT TO PTR TO ROUTINE
	JMS I [KEYSRCH
	JMP NOF		/NOT FOUND
	TAD I PTR	/FOUND
	DCA PTR		/GET PTR TO ROUTINE
	STA
	TAD DEVNUM
	SZA CLA
	JMS I (HREAD	/READ HANDLER
	JMS I PTR	/CALL ROUTINE
	STA
	TAD DEVNUM
	SZA CLA
	JMS I (HWRITE	/REWRITE HANDLER
	JMP I [GOAWAY

SYSDV,	ISZ AUXFLG
	TAD (SYSAUX
	JMP INTO	/V3D ALLOW SET SYS:
HYPH,	JMS I [ALPHA
	JMP I [BADV
	DCA VNO
	TAD VNO
	SNA
	JMP I [BADV
	AND [17
	DCA VNO
	JMS I [SPACE	/IGNORE SPACE
	JMP COLN2
NOKEY,	TAD AUXFLG
	SNA CLA
	JMP NOO
	JMS I [PRINT
	TEXT	\? UNKNOWN ATTRIBUTE FOR DEVICE  \
	*.-1
NAM1,	0
NAM2,	0
	0
	JMP I [GOAWAY

SAWNO,	0
	ISZ NO
	STA
	JMS I [SPACE
	TAD LINPTR
	DCA SAVPTR
	JMP I SAWNO

NOTYP,	CLA
	ISZ AUXFLG
	TAD (AUX	/SEARCH AUXILIARY TABLE
	JMP INTO
NOF,	ISZ PTR
	TAD SAVPTR
	DCA LINPTR
	JMP SCNLUP

AUXFLG,	0

NOO,	ISZ AUXFLG
	TAD (AUX
	DCA PTR
	JMP SCNLUP
	PAGE
HREAD,	0
	TAD DBLK
	SNA
	JMP RESERR
	DCA BLOCK
	JMS I [7607
	200		/READ 2 PAGES
L7200,	7200		/INTO 7200-7577
BLOCK,	0		/FROM THIS BLOCK ON SYSTEM DEVICE
	JMP I [SYSERR
	TAD DHI
	AND [177	/GET RELATIVE ENTRY PT
	TAD L7200
	DCA ENTRY
	TAD VNO
	SZA CLA		/V3C
	JMP I HREAD	/VNO ALREADY SET BY - COMMAND
	TAD ENTRY
VLOOP,	DCA VNOPTR
	TAD I VNOPTR
	CLL
	TAD [-33
	SZL CLA
	JMP BACKV
	TAD I VNOPTR
	SNA
	JMP OLDERR
	DCA VNO
	JMP I HREAD
BACKV,	STA
	TAD VNOPTR
	JMP VLOOP

RESERR,	JMS I [PRINT
	TEXT	/? CAN'T - DEVICE IS RESIDENT/
	JMP I [GOAWAY
OLDERR,	CLA
	JMS I [PRINT
	TEXT	/? CAN'T - OBSOLETE HANDLER/
	JMP I [GOAWAY

HWRITE,	0
	TAD BLOCK
	DCA BLKTWO
	JMS I [7607
	4200
	7200
BLKTWO,	0
	JMP I [SYSERR
	JMP I HWRITE
NEWERR,	CLA
	JMS I [PRINT
	TEXT	/? CAN'T - UNKNOWN VERSION OF THIS HANDLER/
	JMP I [GOAWAY
MAIN,	-0;	DEVICE TTY;	TTYTBL
	-1;	DEVICE PTR;	PTRTBL
	-2;	DEVICE PTP;	PTPTBL
	-3;	DEVICE CDR;	CDRTBL
	-4;	DEVICE LPT;	LPTTBL
	-20;	DEVICE MTA;	MTATBL
	1
	ZBLOCK 20
/TABLE ENDS WITH A POSITIVE NON-ZERO NUMBER
LPTTBL,	WIDTH;LPWDTH
	LC;LPLC
	LV8E;LPLV
	LA8A;	LP8A
	LA78;	LP78
	ZBLOCK 4
	0

MTATBL,	PARITY;MTAPAR
	DENSITY;MTADEN
	FILES;MTAFIL
	ZBLOCK 4
	0
AUX,	LOC;GENLOC
	FILES;GENFIL
	READO;GENREA
	VERS;GENVER
	DVCO;GENDVC	/V3D
	BLK;GENBLK	/V3D
	ZBLOCK 6
	0
WIDTH,	"W;"I;"D;"T;"H;0
LC,	"L;"C;0
LV8E,	"L;"V;4000+"8;4000+"E;0
CODE,	"C;"O;"D;"E;0
ALT,	"A;"L;"T;4000+"M;4000+"O;4000+"D;4000+"E;0
ECHO,	"E;"C;"H;"O;0
PAYGE,	"P;"A;"G;"E;0
TAB,	"T;"A;"B;0
LOC,	"L;"O;"C;4000+"A;4000+"T;4000+"I;4000+"O;4000+"N;0
FILES,	"F;"I;"L;"E;4000+"S;0
READO,	"R;"E;"A;"D;4000+"O;4000+"N;4000+"L;4000+"Y;0
VERS,	"V;"E;"R;4000+"S;4000+"I;4000+"O;4000+"N;0
PARITY,	"P;"A;"R;4000+"I;4000+"T;4000+"Y;0
DENSITY,"D;"E;"N;4000+"S;4000+"I;4000+"T;4000+"Y;0
FILL,	"F;"I;"L;"L;0
FLAGG,	"F;"L;"A;"G;0
CTRL,	"C;"T;"R;"L;0
EVEN,	"E;4000+"V;4000+"E;4000+"N;0
ODD,	"O;4000+"D;4000+"D;0
DELAY,	"D;"E;"L;"A;"Y;0
GAG,	"G;"A;"G;0
PAUS,	"P;"A;"U;"S;"E;0
HGHT,	"H;"E;"I;"G;"H;"T;0
SCOPP,	"S;"C;"O;"P;"E;0
SYSAUX,	INIT;	SYSINI
	OS8;	SYSOS8
	OS78;	SYS78
	ZBLOCK 10
	0
DVCO,	"D;"V;"C;4000+"O;4000+"D;4000+"E;0
COL,	"C;"O;"L;4000+"U;4000+"M;4000+"N;0
LA8A,	"L;"A;"8;"A;0
LA78,	"L;"A;"7;"8;0
INIT,	"I;"N;"I;"T;0
OS8,	"O;"S;"8;0
OS78,	"O;"S;"7;"8;0
	PAGE
LPWDTH,	0
	JMS I (GETWID
	JMS LPTST1
	TAD NUM
	CMA
	DCA I (7200
	JMP I LPWDTH

LPTST1,	0
	TAD I (7201
	SPA CLA
	JMP L645
	TAD VNO
	JMS I [BRANCH
	-1;OLDERR
	-2;LPTOK
	-3;LPTOK
	ZBLOCK 4
	0
	JMP I [NEWERR
LPTOK,	JMP I LPTST1

L645,	JMS I [PRINT
	TEXT	/? CAN'T AFFECT ANNALEX LPT/
	JMP I [GOAWAY
ASRTST,	0
	TAD DHI
	SPA CLA
	JMP I ASRTST
	JMS I [PRINT
	TEXT	/? CAN'T - NOT KL8E HANDLER/
	JMP I [GOAWAY
GENVER,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS I [ALPHA
	JMP BADV
	DCA NUM
	TAD NUM
	AND (40
	SZA CLA
	JMP BADV
	TAD NUM
	AND (37
	DCA I VNOPTR
	JMP I GENVER

GENREA,	0
	CDF 10
	TAD I DCWPTR
	CLL RTL
	CLL RAL
	TAD NO
	RAR
	CML RAR
	RAR
	DCA I DCWPTR
	CDF 0
	JMP I GENREA

GENFIL,	0
	CDF 10
	TAD I DCWPTR
	CLL RAL
	CLL RAL		/ZERO LINK
	TAD NO
	RAR
	CML RAR
	DCA I DCWPTR
	CDF 0
	JMP I GENFIL
BADV,	CLA
	JMS I [PRINT
	TEXT	/? BAD VERSION LETTER/
	JMP I [GOAWAY

CRLF,	0
	TAD [215
	JMS I (TYPE
	TAD [212
	JMS I (TYPE
	JMP I CRLF
	PAGE
LPLV,	0
	JMS I (LPTST1
	TAD NO
	CLL RTL
	RTL
	TAD (4
	DCA I (7201
	JMP I LPLV

LPLC,	0
	JMS I (LPTST1
	TAD NO
	CLL RTL
	RTL
	RAL
	CIA
	DCA I (7202
	JMP I LPLC

TTECHO,	0
	JMS I [TTST1
	TAD NO
	SZA CLA
	TAD (SKP CLA-SZA
	TAD (SZA
	DCA I (7200+120
	JMP I TTECHO
TTPAGE,	0
	JMS I (OLDTST
	JMS I [SRCH	/V3D NEW ROUTINE
	215;100;7450
	JMP I [REASEM
	TAD (3		/POINT TO 'SZA CLA'
	DCA TEMP
	TAD NO
	SNA CLA
	TAD (SZA CLA-CLA	/YES
	TAD (CLA		/NO
	DCA I TEMP
	JMP I TTPAGE
TTTAB,	0
	JMS I [TTST1
	JMS I [GETC
	SNA
	JMP TTEO
	TAD (-"/
	SNA CLA
	JMS I [GETC
	TAD (-"N
	SZA CLA
	JMP I [SYNTAX
	JMP NOTEC
TTEO,	TAD NO
	SNA CLA
	TAD (5000
	TAD L200
	JMS I (TECO
NOTEC,	JMS I [SRCH
L200,	200;100;7
	JMP I [REASEM
	DCA TEMP
	STA CLL RAL	/-2
	TAD TEMP
	DCA T2
	TAD TEMP
	TAD (3
	DCA T3
	TAD NO
	SNA CLA
	JMP SETAB
	TAD TEMP
	TAD (-4
	DCA T4
	TAD T4
	AND (77
	TAD (1200	/TAD TTY240
	DCA I T2
	TAD (SZA CLA
	DCA I T3
	JMP I TTTAB
SETAB,	TAD TEMP
	TAD (-12
	DCA T4
	TAD I T4
	DCA I T2
	TAD (SKP CLA
	DCA I T3
	JMP I TTTAB

BADWID,	JMS I [PRINT
	TEXT	/? ILLEGAL WIDTH/
	JMP I [GOAWAY

BLK,	"B;"L;"O;"C;"K;0
	PAGE
TTFILL,	0
	JMS I [TTST1
	JMS I [SRCH
	200;100;1377
	JMP I [REASEM
	TAD (-1
	DCA TEMP
	TAD NO
	CLL RAL
	TAD (2
	TAD TEMP
	DCA T2
	TAD I T2
	DCA I TEMP
	JMP I TTFILL

REASEM,	JMS I [PRINT
	TEXT	/? CAN'T - MUST REASSEMBLE KL8E SOURCE/
	JMP I [GOAWAY

TTDELAY,0
	JMS I [TTST1
	JMP I [NOTIMPL
	JMP I TTDELAY
/ENTER WITH PTR TO POSSIBLE KEYWORD IN AC

KEYSRCH,0
	DCA KPTR
KL,	TAD I KPTR
	ISZ KPTR
	SNA
	JMP GOTKEY
	CIA
	DCA TEMP
	JMS I [ALPHA	/IS IT ALPHANUMERIC?
	JMP EOK		/NO
	TAD TEMP	/COMPARE
	CLL RAL		/LOW ORDER 11 BITS
	SNA CLA
	JMP KL		/MATCHED, KEEP LOOKING
	JMP I KEYSRCH	/DIDN'T MATCH
EOK,	JMS I [BACKC
	TAD TEMP
	CIA		/INPUT STREAM RAN OUT OR HIT SPACE
	SPA CLA
	JMP GOTKEY	/SPACE OR EOL MATCH FLAGGED CHARACTER
	JMP I KEYSRCH

KPTR,	0

GOTKEY,	JMS I [SCAN
	STA		/SKIP EXTRA STUFF
	JMS I [SPACE
	ISZ KEYSRCH	/TAKE GOOD RETURN 2
	JMP I KEYSRCH

PTRTBL,	ZBLOCK 4
	0

PTPTBL,	ZBLOCK 4
	0
TTYTBL,	WIDTH;TTWIDTH
	CODE;TTCODE
	ALT;TTALT
	ECHO;TTECHO
	LC;TTLC
	PAYGE;TTPAGE
	TAB;TTTAB
	FILL;TTFILL
	FLAGG;TTFLAG
	CTRL;TTCTRL
	GAG;TTGAG
	DELAY;TTDELAY
	PAUS;TTPAUS	/V3D
	HGHT;TTHGHT	/V3D
	SCOPP;TTSCOP	/V3D
	COL;TTCOL	/V3D
	ESC;TTESC	/V3D
	AROW;TTAROW	/V3D
	ZBLOCK 10
	0
	PAGE
TTFLAG,	0
	JMS TTST1
	JMS I [SRCH
	200;200;247
	JMP I [REASEM
	TAD (-2
	DCA TEMP
	TAD NO
	SNA CLA
	TAD (SZA CLA-CLA
	TAD (CLA
	DCA I TEMP
	JMP I TTFLAG

TTLC,	0
	JMS TTST1
	JMS I [SRCH
	200;200;377
	JMP I [REASEM
	TAD (5
	DCA TEMP
	TAD I TEMP
	CLL
	TAD [200
	SNL CLA
	JMP I [REASEM
	TAD NO
	SNA CLA
	TAD [40		/SNA CLA
	TAD (7610	/SKP CLA
	DCA I TEMP
	JMP I TTLC

TTCTRL,	0
	JMS TTST1
	JMP I [NOTIMPL
	JMP I TTCTRL
TTWIDTH,0
	JMS GETWID
	JMS TTST1
	TAD NUM
	AND [7
	SZA CLA
	JMP I [BADWID
	TAD NUM
	TAD [-200
	SNA CLA
	JMP I [BADWID
	JMS I [SRCH
	200;200;7600
	JMP I [REASEM
	IAC
	DCA TEMP
	TAD I TEMP
	AND [177
	TAD (177+7200
	DCA T2
	TAD TEMP
	IAC
	DCA T3
	TAD NUM
	CIA
	DCA I T3
	TAD I T3
	DCA I T2
	JMP I TTWIDTH
GETWID,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS OPTEQ
	JMS I [NUMBER
	SNA
	JMP I (BADWID
	DCA NUM
	TAD FLG
	SZA CLA
	JMP I [SYNTAX	/NO DIGITS
	TAD NUM
	AND [7400
	SZA CLA
	JMP I [NUMBIG
	JMP I GETWID

TTST1,	0
	JMS I (ASRTST
	TAD VNO
	JMS I [BRANCH
	-1;OLDERR
	-2;OLDERR
	-3;TTOK
	-4;TTOK		/V3C
	-5;TTOK		/V3D
	ZBLOCK 4
	0
	JMP I [NEWERR
TTOK,	JMP I TTST1
OPTEQ,	0
	JMS I [GETC
	TAD (-"=
	SZA CLA
	JMP I OPTEQ
	STA		/V3D
	JMS I [SPACE
	JMS I [GETC	/ADVANCE OVER =
	CLA
	JMP I OPTEQ
	PAGE
OPRIN,	0
	DCA N3
	TAD (-4
	DCA OKNT
OPLP,	TAD N3
	RTL
	RTL
	AND [7
	TAD [60
	JMS I [TYPE
	TAD N3
	RTL
	RAL
	DCA N3
	ISZ OKNT
	JMP OPLP
	JMP I OPRIN

OKNT,	0
N3,	0
GTEM,	0
SRCH,	0
	TAD I SRCH
	ISZ SRCH
	TAD (7200-1
	DCA XR1
	TAD I SRCH
	ISZ SRCH
	CIA
	DCA CNT
	TAD I SRCH
	CIA
	DCA TEMP
	ISZ SRCH
SRLUP,	TAD I XR1
	TAD TEMP
	SNA CLA
	JMP SRFND
	ISZ CNT
	JMP SRLUP
	JMP I SRCH
SRFND,	ISZ SRCH
	TAD XR1
	JMP I SRCH
GENCMN,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS I [ONUM
	DCA NUM2
	TAD FLG
	SZA CLA
	JMP I [SYNTAX
	JMS I [GETC
	DCA TEMP
	TAD TEMP
	SNA
	JMP I GENCMN
	TAD (-"=
	SZA
	TAD ("=-",
	SZA CLA
	JMP I [SYNTAX
	JMP I GENCMN
GENLOC,	0
	JMS GENCMN
	TAD DHI
	SPA CLA
	TAD [-200
	TAD [-200
	CLL
	TAD NUM2
	SZL CLA
	JMP I [NUMBIG
	TAD NUM2
	TAD (7200	/BASE OF HANDLER
	DCA NUM2
	TAD TEMP
	SNA CLA
	JMS ODT
GETNEW,	JMS I [ONUM
	DCA NUM
	TAD FLG
	SZA CLA
	JMP I GENLOC
	JMS I [GETC
	SZA CLA
	JMP I [SYNTAX
	TAD NUM
	DCA I NUM2
	JMP I GENLOC
ODT,	0
	TAD I NUM2
	JMS OPRIN
	TAD ("/
	JMS I [TYPE
	TAD I [READ
	DCA GTEM	/SAVE CHAIN STATUS
	JMS I [READ
	TAD [LINBUF
	DCA LINPTR
	TAD GTEM
	DCA I [READ
	JMP I ODT

OLDBAS,	JMS I [PRINT
	TEXT	/? OLD BASIC/
	JMP I [GOAWAY
VERSION,JMS I (PRINT
	TEXT	\OS/8 SET V2A\
	JMP I [START
	PAGE
MTAPAR,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS MTST1
	TAD LINPTR
	DCA SAVPTR
	TAD (EVEN
	JMS I [KEYSRCH
	SKP
	JMP SETE
	TAD SAVPTR
	DCA LINPTR
	TAD (ODD
	JMS I [KEYSRCH
	JMP I [SYNTAX
	TAD (400
SETE,	TAD (2
	DCA I (7200
	JMP I MTAPAR

MTST1,	0
	TAD VNO
	JMS I [BRANCH
	-1;OLDERR
	-2;OLDERR
	-3;OLDERR
	-4;MTOK
	-5;MTOK
	-6;MTOK
	ZBLOCK 4
	0
	JMP I [NEWERR
MTOK,	JMP I MTST1

MTADEN,	0
	JMS MTST1
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMP I [NOTIMP
	JMP I MTADEN
MTAFIL,	0
	JMS MTST1
	TAD NO
	CIA		/V3D
	IAC		/V3D
	DCA I (7201
	JMP I MTAFIL

BADCOD,	JMS I [PRINT
	TEXT	/? UNKNOWN CARD CODE/
	JMP I [GOAWAY

/SUPPOSED TO WORK ON ALL VERSIONS

CDCODE,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS I (OPTEQ
	JMS I [NUMBER
	TAD (-32	/026
	SNA
	JMP C026
	TAD (32-35	/029
	SZA CLA
	JMP BADCOD
	JMS CHANGE
	LIST1;LIST2
	JMP I CDCODE
C026,	JMS CHANGE
	LIST1;LIST3
	JMP I CDCODE
CHANGE,	0
	TAD I CHANGE
	DCA P1
	ISZ CHANGE
	TAD I CHANGE
	DCA P2
	ISZ CHANGE
CHLUP,	TAD I P1
	SNA
	JMP I CHANGE
	TAD (7200	/BASE OF HANDLER
	DCA P3
	TAD I P2
	DCA I P3
	ISZ P1
	ISZ P2
	JMP CHLUP

P1,	0
P2,	0
P3,	0
GET,	0
	KSF
	JMP .-1
	KRB
	AND [177
	TAD [200	/FORCE TO 8-BIT
	JMP I GET
	PAGE
/FIXED FOR V3D:
LIST1,	104;105;106
	114;115;116
	124;125;126;127
	134;135;136
	0

LIST2,	3203;4007;3502
	7514;0577;3637
	0104;1211;3374;0641
	7316;3410;1376

LIST3,	7735;4076;0774
	3314;1002;0305
	3204;1273;3606;1341
	3716;1175;3401
TECNAM,	FILENAME TECO.SV

TECO,	0
	DCA SA
	TAD (TECNAM
	JMS LOOKUP
	JMP I TECO	/NOT THERE
	DCA BLKN
	JMS I (7607
	100		/READ 1 PAGE FROM TECO
	7000		/BUFFER
BLKN,	0
	JMP I [SYSERR
	TAD BLKN
	DCA BLKN2
	TAD SA
	DCA I (7002	/REL LOC 2 IS S.A.
	JMS I (7607
	4100
	7000
BLKN2,	0
	JMP I [SYSERR
	JMP I TECO

SA,	0
LOOKUP,	0
	DCA ARG1	/PTR TO FILENAME IN AC
	CLA IAC		/LOOKUP ON SYS
	CIF 10
	JMS I USR
	2
ARG1,	0		/STARTING BLOCK
	0
	JMP I LOOKUP	/NOT FOUND
	TAD ARG1
	ISZ LOOKUP
	JMP I LOOKUP	/RETURN 2 WITH BLOCK # IN AC
GENDVC,	0
	TAD NO
	SZA CLA
	JMP I [SYNTAX
	JMS I [ONUM
	SNA
	JMP I [SYNTAX
	DCA NUCODE
	TAD NUCODE
	AND [7700
	SZA CLA
	JMP I (NUMBIG
	TAD NUCODE
	TAD (-30
	SPA CLA
	JMP I [NUMBIG
	TAD NUCODE
	CLL RTL
	RAL
	DCA NUCODE
	TAD (7200
	DCA RR
DVLUP,	JMS I (GETIOT
	JMP I GENDVC
	TAD (-30
	SPA CLA
	JMP DVLUP
	TAD I RR
	AND (7007
	TAD NUCODE
	DCA I RR
	JMP DVLUP
CDRTBL,	CODE;CDCODE
	ZBLOCK 4
	0
	PAGE

/7000-7177 BUFFER FOR TECO CCB
/7200-7577 BUFFER FOR HANDLER
	FIELD 0
	*200
	$
