/	WPCOM--GENERAL PURPOSE CX					/A018
/	CAREFUL WITH XXX--SOME LABELS USE THIS SEQUENCE			/A018
/
/	057	EMcD	04-Sep-85	Add 8 bit to 7bit NRC conversion 
/					for Vt100 option
/	056	Mart	12-jul-85	SAve PANEL swap area if VT125 GRAPHICS
/	055	EMcD	18-Mar-85	8 Bit support
/	054	DFB	29-NOV-84	Fix DS, DP, DH problems with Gold Halt
/	053	TCW	30-AUG-84	Remove Integral Modem check
/	052	ECH	30-AUG-84	MOVED KBTOCH AND KBTICH TO WPCOM
/					CHECK HALT FLAG IN DP AND HP MODES
/	051	ECH	15-AUG-84	TRANSLATE TECH CHAR FOR CX TO HOST,
/					SCREEN,	AND PRINTER. REMOVED DSKGCH
/					TO WPCX2. 1 1/2 PAGES AT DOCSAV.
/					YOU'RE WELCOME
/	050	TCW	17-JUL-84	EXPAND # OF TERMINAL MODES
/	049	TCW	02-JUL-84	INTEGRAL MODEM SUPPORT
/	048	WCE	11-MAY-84	REMOVED ALL OCCURANCES OF USERNO
/	047	DFB	08-APR-84	MOVE TABLE FROM WPCX FOR SPACE REASONS
/	046	WJY	17-FEB-84	IMPLEMENT DMIIV1.5 FUNCTIONALITY ON DMI
/	045	HLP	19-JAN-84	INCLUDE AND P177 SO CHRS FROM KB WILL
/					BE MASKED (ESC KEY WASN'T AFTER 044)
/	044	GDH	6-JAN-84	FIXED F4 F4 BUG.
/	043	GDH	5-JAN-84	MAP <CR><LF><LF> SEQS TO EQUIVALENT
/					NUMBER OF NEWLINE CHARACTERS.
/	042	SBB	09-OCT-83	MINOR ADJUSTMENTS FOR VT125
/	041	GDH	3-OCT-83	CHANGE TO DSK HANDLER TO CHECK FOR SOD
/	040	GDH	22-JUL-83	FIX TO '039'.
/	039	GDH	20-JUL-83	CHANGES TO ACCOMODATE LOGON ENTRY TO
/					NOT CLEAR SCREEN UPON ENTRY.
/	038	GDH	11-JUL-83	RE-DEFINED EZLINK ENABLE BIT.
/	037	GDH	24-JUN-83	ADDED SEND TAB NOSPACE TO DOCUMENT STUFF
/	036	HLP	10-JUN-83	CHANGE PRINTER PAGE SIZE REFERENCE
/					FROM CT TO PRQPSZ IN PRINTER
/	035	GDH	23-MAY-83	CHANGED FILE-TOO-BIG CUTOFF POINT.
/	034	GDH	23-MAY-83	ADDED LOGON ENTRY SUPPORT.
/	033	GDH	19-APR-83	ADDED TM EZ-LINK SUPPORT.
/	032	HLP	25-FEB-83	PRASF NOW PART OF LPONLN IN FIELD 1
/	031	MJS	2-FEB-83	CONDITIONALIZED SOME CODE AT KBTJOB
/					ON "CONDOR" (TO ALLOW DECMATE I AND II
/					ASSEMBLIES USING THE SAME SOURCE)

/(EDITS BELOW ARE FOR DECMATE II "CONDOR")
/
/	030	GDH	10-JAN-83	ADDED CODE TO INIT TERMINAL AT STARTUP.
/	029	GDH	15-OCT-82	CHANGED \R, \H TO CLOSE OPENED FILES.
/	028	SBB	22-OCT-82	ADDED TRAP FOR TOP ROW ESC SEQ'S
/	027	SBB	15-OCT-82	NOW WE CAN PASS $C TO FIRMWARE
/	026	SBB	13-OCT-82	KEEP TERMINAL MODES AND FIRMWR IN SYNC
/	025	GJP	12-OCT-82	FIX UNINITIALIZED DISKETT BUG
/	024	HLP	23-SEP-82	DELETED RESET TERM ESC SQ WHEN EXIT CX
/	023	HLP	09-SEP-82	DEVEL CONDITIONALIZED DIGIT ERROR CODES
/	022	HLP	09-SEP-82	CONDOR CONDITIONALIZED CHANGES OF 021
/	021	HLP	03-SEP-82	ADDED CODE TO SAVE TERMINAL MODE
/					WHEN GO INTO CX BLANK SCREEN MODE
/					(IOA ASSUMES VT100 MODE)
/					CHANGED CODE WHICH HANGS UP MODEM
/	020	HLP	20-AUG-82	ADDED \H CODE AT KBTATN
/	019	HLP	29-JUL-82	STANDARDIZED SYSTEM CALLS:
/					TTYIN,TTYOUT,HS2IN,HS2OU
/	018	HLP	22-JUN-82	CONDITIONALIZED FOR CONDOR (DM-II)
/
/	017	GDH	08-MAR-82	FIXED DOCUMENT AS A SOURCE TO NOT
/					DO "WAIT" UNLESS DH IS ACTIVE.
/	016	GDH	03-MAR-82	CHANGED ASF PAGE SIZE TO USE PRINTER'S
/					MOST RECENT PAGE SIZE.
/	015	GDH	08-FEB-82	ADDED "READ ERROR DETECTION" CODE.
/	014	GDH	21-JAN-82	ADDED "SHIFT-IN" PRIOR TO FIX 0013.
/	013	GDH	13-JAN-82	ADDED "SELECT US CHARACTER SET" ON
/					GOLD-MENU TERMINAL RESTORE.
/	012	EH/GDH	01-DEC-81	FIXED A "FREEZE-UP" PROBLEM UPON
/					EXITING CX WITH \R GOLD M SEQUENCE
/	011	GDH	19-OCT-81	MERGED WITH WS200 (V4.4) BUG FIXES.
/	010	GDH	17-OCT-81	ADDED SUPPORT FOR USER ESC SEQUENCES.
/	007	GDH	7-OCT-81	FIXED SOME "FREEZE-UP" PROBLEMS.
/	006	GDH	5-OCT-81	AUTO PAGINATION FOR ASF PRINTERS.
/	005	GDH	25-SEP-81	IMPLEMENTED TM VTMODE SWITCH.
/	004	GDH	26-AUG-81	WPFILS CALLING SEQ CHANGES.
/	003	GDH	21-AUG-81	ADDED VT52 EMULATION FOR VT278.
/
/	002	JM	02-JUN-81	ADDED CODE TO SWITCH TERMINAL MODES
/					(VT100,VT52) WHEN NECESSARY (WS80
/					ONLY) AND TO RESTORE TERMINAL
/					CHARACTERISTICS (WS80 AND VT278)
/	001	JM	12-MAY-81	CHANGES TO ALLOW COM TO WS80
/					SERIAL LQP
/	3.0	MB	8-AUG-78	ADD THE NEW CX THAT ALLOWS SENDING
/					DOCUMENTS TO BE CHANGED BY THE USER
/	III.C	KEE	27-FEB-78	REMOVE COM SETTINGS STUFF
/	2.7-2	KEE	1/5/78		MOVE CLEAR SCREEN TO PREFIX FILE

/***********************************************************************
/LOCAL EQUIVALENCES							
	CDFVTF=CDFEDT		/TERMINAL MODE FLAG IN 2ND FIELD	
/***********************************************************************
/WE HAVE JUST HIT RETURN TO ENTER CX BLANK SCREEN MODE			/A021
/START OTHER JOBS

CNTN6,	JMS	MSKSET		/ Set char mask to 7577 or 7777 for 7-8 bit/A055
	JMS	RETERM		/GO SET TERM TO LAST VTMODE USED BY CX	/A026
	TAD	(JSBX0)
	DCA	X0
	TAD	(JLIST-1)
	DCA	X1
	JMP	BE

A,	MQL
	TAD	X0
	DCA	T1
	CDF 0
	RIF
	CLL RAL
	DCA I	X0
	DCA I	X0
	MQA
	DCA I	X0
	DCA I	X0
	ISZ	X0
	CDFMYF			/A CDF FOR THIS FIELD
				/WILL BE INSERTED AT RUN TIME
	TAD	T1
	CIFSYS
	JSTRT

BE,	TAD I	X1
	SZA
	JMP	A
	JMP	KBTJOB

/THE KEYBOARD JOB FOLLOWS

KBTJB1,	TAD	ERFLG
	SZA CLA
	JMP	INTERR
	CIFSYS
	JWAIT			/FOR TTYIN, BELOW

KBTJOB,	TAD	EXITFL		/TIME TO EXIT YET?			/A033
	SZA CLA			/NOPE, NOT YET!				/A033
	JMP	CONFIG		/SOMEBODY SET THE EXIT FLAG.		/A033
	IFDEF CONDOR <
	CIFEDT			/SET UP TO WORK FROM CX2		/A024
	JMS	KBMTCK		/RETURN 2 +1 IF TRAP EMPTY OR FROM KRTRA/A024
	CIFSYS
	TTYIN
	JMP	KBTJB1
	MQL			/SAVE CHARACTER IN MQ.			/A044
KBTJB2,	ACL			/LOAD CHARACTER FROM MQ.		/A044
	CIFEDT			/WE'RE GOING TO WORK IN FLD 3 WITH TABLE/A028
	JMS	KBTRAP		/TRAP ESC SEQ'S FROM KEYBOARD		/A028
	SKP			/CONTINUE NORMAL PROCESS (POOR PLANING)	/A028
	JMP	KBTJOB		/LIKE IT NEVER HAPPENED (NO PRINT RETUR	/A028
			>	/END IFDEF CONDOR

	IFNDEF CONDOR <
	CIFSYS
	TTYIN
	JMP	KBTJB1							/A031
			>	/END IFNDEF CONDOR

	AND	P377		/SAVE 8 FOR K2H HANDLER.		/A010
	DCA	K2HCHR							/A010
	TAD	K2HCHR		/ Get char back				/A057
	CIFEDT			/ Point to WPCX2			/A057
	JMS I	(NRCTRM)	/ Check if 8 bit to 7 bit NRC req	/A057
	  JMP	KBTJOB		/ Bad char				/A057
	  NOP			/  Just for now !!!			/A057

	TAD	K2HCHR		/BUT EVERYBODY ELSE WANTS		/A010
	JMS	MASKIT		/Mask to 7 or 8 bit		/M055	/M045
	IFNDEF	CONDOR		</DM2 CHECKS FOR '\' KEY IN KBTRAP.	/A044
	TAD	(-ATTN)		/BACKSLASH CODE
	SNA
	JMP	KBTATN
	TAD	(ATTN)
		>		/IFNDEF CONDOR.				/A044

KBTGTI,	DCA	KBTCHR
	TAD	(ODLIST-1)
	DCA	KBTOXL
	TAD	KBTFLG
	DCA	KBTFL1
	JMS	KB2DOC		/TAKE CARE OF A DOCUMENT.

	IFNDEF	CONDOR	<
	CIFEDT
	JMS	KB2HST		/TAKE CARE OF HOST.
		>		/END IFNDEF CONDOR


KBTLP3,	TAD	KBTFL1		/ADDED LABEL WITH 			/A028
KBTLP2,	SNA
	JMP	KBTJOB		/No more to do so go back		
	JMS	KBTLPS		/Set up service routine			/A055
	JMS	CKFLBK		/Check if Fall back required 		/A055
	  JMP	NOFLBK		/No					/A055
FALBAK,	TAD	FLBKC1		/Get char one				/A055
	JMS	KBTIO		/Output it				/A055
	CLA			/Just in case				/A055
	TAD	KBTXXX		/Get service routine			/A055
	TAD	(-LPTOU)	/Was it a print				/A055
	SZA CLA			/					/A055
	JMP	FBKCNT		/No , go on				/A055
	TAD	(10)		/Load up a backspace			/A055
	JMS	KBTIO		/And output it				/A055
	CLA			/Clear Ac just 				/A055
FBKCNT,	TAD	FLBKC2		/Get second char			/A055
NOFLBK,	CIFEDT			/ Point to WPCX2 field			/A059
	JMS	NRCSWP		/ See if we want to replace the char	/A059
	JMS	MASKIT		/ Strip it down to 7 bit		/A055
	JMS	KBTIO		/Output it				/A055
	JMP	KBTLP3							/M028

FLBKC1,	0			/Fall back char 1			/A055
FLBKC2,	0			/Fall back char 2			/A055


/REWROTE THIS SECTION TO ADD \H AND SAVE SPACE				/A020
	ATTN="\-200
	CIFSYS
	JWAIT			/FOR TTYIN, BELOW
KBTATN,	CIFSYS
	TTYIN
	JMP	.-4
	AND	P377							/M055
	MQL			/SAVE CHARACTER IN MQ FOR NOW.		/M044
	MQA			/GET CHARACTER BACK.			/M044
	AND	(137		/TURN OFF LOWER CASE BIT		/A020
	TAD	(-123)		/S
	SNA
	JMP	KBXOF
	IAC			/CHECK FOR A \R--122
	SNA
	JMP	CONFIG
	IAC			/CHECK FOR A \Q--121
	SNA
	JMP	KBXON
	JMP	KBECHK		/Jump to remaining code moved to CNLINE	/A057
				/ page					/A057


/-----------------------------
	PAGE

KBHGUP,	TAD	(7402		/CODE TO HANGUP MODEM		/A020	/C021
	CIFSYS			/CALL SYS TO WIGGLE DTR			/A020
	HS2OU			/BY SENDING A B-I-G CHR			/A020
	NOP			/IT MUST NEVER RETURN NOT ACCEPTABLE	/A020
	JMP	CONFIG		/AND GO PUT UP CX MENU			/A020

KBXOF,	AC0002			/XOF = 23 XON = 21
KBXON,	TAD	(XON)		/SEND A XON
	DCA	KBTCHR		/SAVE THE CHARACTER.			/M007
	TAD	KBTFLG		/SEE WHAT FLAG IS SET
	AND	(10)
	SNA CLA
	JMP	KBTJMP

	SKP			/OUTPUT THE CHARACTER.			/A007
KBXOWT,	JMS	CHKHLT		/CHECK HALT FLAG.			/A007
	CIFSYS
	JWAIT
	TAD	KBTCHR		/GET CHARACTER TO OUTPUT.		/A007
	CIFSYS
	HS2OU
	JMP	KBXOWT
KBTJMP,	JMP	KBTJOB

KB2DOC,	XX			/A LF IS IGNORED. ONLY A CR WILL GENERATE
				/A CRLF. ADDS A CHARACTER TO THE DOCUMENT
	TAD	KBTFL1
	AND	(20)
	SNA CLA			/SKIP IF DOING DOCUMENT.
	JMP I	KB2DOC		/RETURN IF NOT DOING DOC.

	TAD	K2HCHR		/Get character back			/A055
	AND	(200)		/Mask 8th Bit				/A055
	SZA CLA			/Anything there ?			/A055
	JMP	DOC8BIT		/Yes , write dead seq			/A055

	TAD	KBTCHR		/No , output as is			/A055
	JMS	KB2DCOUT	/					/A055
	JMP	NODCOPTN	/And take out Doc option for this pass	/A055

DOC8BIT,
	TAD	KBTCHR		/Get full char back			/A055
	JMS	DOC8OUT		/Output to disk as dead thing		/A055

NODCOPTN,
	CLA
	TAD	KBTFL1		/TAKE "TO DOCUMENT" OUT OF THIS PASS
	AND	(17)
	DCA	KBTFL1
	JMP I	KB2DOC		/RETURN TO CALLER.

/THE TEST JOB FOLLOWS

TSTXIT,	DCA	TSTACF		/SAY TEST JOB NOT RUNNING.		/A011
	CIFSYS
	JEXIT			/GO AWAY IF NOTHING TO DO
TJSTRT,	AC0001			/SAY TEST JOB RUNNING.			/A011
	DCA	TSTACF							/A011
TSTJOB,	TAD	TSTFLG
	SNA CLA
	JMP	TSTXIT
	JMS	CLRPAN		/ clear the panel swap area if VT125	/a056
	JMP	TSTJB2		/ jump to another page for more room	/a056

/
/		Hook for Blaster					/A055
/

BHOOK,	XX								/A055
	DCA	BLACSV		/Save accumulator			/A055
	RDF			/Get data field				/A055
	TAD	CDF0		/Make a CDF inst.			/A055
	DCA	BHKEXI		/Save for a return			/A055
	CDFMYF			/Set to hooks field			/A055
	TAD I	BHOOK		/get Table entry			/A055
	MQL			/Push into MQ				/A055
	TAD	BLACSV		/Get the ac				/A055
	ISZ	BHOOK		/increment return address		/A055
	CIFMNU			/increment return address		/A055
	IOF			/turn interrupts off before		/A055
	JMS I	BLASTH		/Calling Blaster			/A055
	ISZ 	BHOOK		/Skip return exit			/A055
BHKEXI,	0			/CDF inst (position after JMS important)/A055
	JMP I	BHOOK		/return					/A055
BLASTH,	BLASTR			/Blaster address			/A055
BLACSV,	0			/Save Accumulator			/A055

/
/	Routine to check if fallback representation required		/A055
/	If so puts two word rep at FLBKC1 and FLBKC2 			/A055
/	If not puts char into Ac for return				/A055
/	
/	AC = 0 on entry => Check K2HCHR					/A055
/	AC = 1 on entry => Check H2TCHR					/A055
/	

CKFLBK,	XX
	DCA	KHFLG			/Save request type		/A055
	CDFVTF				/Change to video field		/A055		
	TAD I	(VTMODE)		/Get terminal type		/A055
	CDFMYF				/Back to here			/A055
	TAD	(-6)			/Is it type 6 (7 bit fallback)	/A055
	SZA CLA				/				/A055
	JMP 	CKFLEX			/Get out			/A055
	TAD	KHFLG			/Do we want K2H or H2T ?	/A055
	JMS	K2HLD			/Load K2TCHR or H2TCHR		/A055
	TAD	(-200)			/Is it 8 bit ?			/A055
	SPA CLA				/No				/A055
	JMP	CKFLEX			/Get it back and exit		/A055	
	JMS	K2HLD			/Load K2TCHR or H2TCHR		/A055
	AND 	P177			/Mask off 200 bit		/A055
	TAD	(-40)			/Take off 40 to make subscript	/A055
	CLL RAL				/Multiply by 2			/A055
	TAD	(FLBKTB)		/Subscript into panel		/A055
	DCA	FBKPNL			/Store in line for execution	/A055
	PRQ3				/Do panel request to get rep	/A055
	5045				/Move it from panel 5 to user 4	/A055
FBKPNL,	0				/Modified in code		/A055
	FLBKC1				/Put to this address		/A055
	-2				/Two fallback words		/A055
	7777				/Terminator			/A055
	ISZ	CKFLBK			/Do skip return			/A055
	JMP I	CKFLBK			/Exit				/A055
CKFLEX,	JMS 	K2HLD			/Get char again			/A055
	JMP I	CKFLBK			/Now return			/A055

KHFLG,	0				/Temp used by Fall back check	/A055





/MOVED HERE FROM NEXT PAGE FOR ROOM					/A042
CHKHLT,	XX			/CHECK FOR THE HALT FLAG. ABORT IF SET	/A007
	CLA			/(I.E., DID USER ENTER GOLD HALT)
	CDFSYS
	TAD I	HLTFLG		/TEST HALT FLAG IF SET RESPOND AS IF A \R
	CDFMYF
	SNA			/SKIP IF ALREADY SET.			/A033
	TAD	EXITFL		/ARE WE SUPPOSED TO EXIT ANYWAYS?	/A033
	SZA CLA
	JMP	CONFIG
	JMP I	CHKHLT		/RETURN TO CALLER.

	PAGE

/ENTERING BLANK SCREEN MODE FROM CX MENU				/A026
/CHANGE FROM VT100 TO LAST VTMODE USED IN BLANK SCREEN COMM		/A026
RETERM,	XX			/RESTORE TERMINAL OR FIRMWARE		/A026
	ISZ	FROMLO		/ARE WE BEING INVOKED FROM LOGON?	/M040
	SKP			/IF NO THEN CLEAR THE SCREEN.		/A039
	JMP	RETRM1		/IF YES, THEN CONTINUE W/O CLEARING	/M040
	CIFMNU			/CLEAR SCREEN IF NOT FROM LOGON.	/A039
	JMS I	IOACAL		/CLEAR THE SCREEN			/A039
	0								/A039
	CLRSCN								/A039
	0								/A039
RETRM1,	IFDEF	CONDOR	<						/A039
	CLA			/JUST IN CASE				/A026
	CDFVTF			/NEED TO GET FLAG FROM FLD 3		/A026
	TAD I	(VTMODE)	/0=52 1=100 2=DM2 3=125 4=227 5=228 6=22F/A026 /M050
	CDFMYF								/A026
	CIA			/0	-1  -2    -3    -4    -5     -6 /A02	/M050
	SNA			/SKIP UNLESS 52				/A026
	JMP	SWVT52		/SET 52					/A026
	IAC			/X	0   -1    -2	-3    -4     -5 /A02	/M050
/D055	AND	(1)		/X       0       1     0	1/A04	/M050
/D050	SZA			/SKIP IF VT100			/M04	/A026
	JMS	PRQSU2		/AC11=1 WILL SET FIRMWARE TO DM2	/A026
	CLA			/CLEAR AC FOR RETURN			/A049
			>	/IFDEF CONDOR				/A039
	JMP I	RETERM		/WHEW!					/A026

	IFDEF	CONDOR	<
/COMING OUT OF BLANK SCREEN MODE TO WPS CX MENU				/A026
CFGXXX,	XX								/A026
CFG5,	JMS	DMTOSC		/OUTPUT ESC SEQ TO ENTER VT100 MOD	/A026
	ESC								/A026
	74			/LEFT ANGLE BRACKET			/A026
	0			/STOPPER				/A026
	AC7776			/TO TEST FOR -2				/A026
	CDFVTF			/NEED TO GET AT MODE FLAG IN FLD 3	/A026
	TAD I	(VTMODE)	/0=2	1=VT100	2=DM2 3=VT125		/A026
	CDFMYF			/NOW SEE WHAT WE'VE GOT			/A026
	SNA			/DON'T DO ANYTHING IF NOT DM2	/M04	/A026
	JMS	PRQSU2		/SUBROUTINE TO SWITCH FIRMWARE FROM DM2	/A026
	IFDEF	VT125R	<	/FOR VT125				/A042
	TAD	NEG1		/TO MAKE A 0 IF VTMODE =3 (VT125)	/A042
	SNA CLA			/SKIP IF NOT VT125			/A042
	JMP	SCROFF		/GO TURN OFF GRFX SCREEN IF WAS VT125	/A042
				>/END IFDEF VT125R			/A042

RETCFG,	JMS	DKACTS		/STOP THE DISK JOB AND CLOSE FILE 4 READ/A022
	TAD	EXITFL		/ARE WE SUPPOSED TO EXIT?		/A033
	SZA CLA			/SKIP IF NO.				/A033
	JMP	RTNSY		/JMP DIRECTLY TO EXIT CODE IF SO.	/A033
	JMP I	CFGXXX		/RETURN TO CONFIG			/A022

	IFDEF	VT125R		</FOR VT125				/A042
SCROFF,	CIF	PRMFLD		/NEED TO ACCESS PRIMITIVES FIELD	/A042
	TAD	KSETP3		/GET ADR OF SETUP OPCODE		/A042
	JMS I	CMPRIM		/GO TO PRIM TO STOP GRFX SCREEN		/A042
	JMP	RETCFG		/GET BACK IN LINE			/A042

CMPRIM,	PRIM			/ENTRY ADR INTO PRIM			/A042
KSETP3,	SETP3			/ADR OF SETUP OPCODE			/A042
SETP3,	42			/SETUP OPCODE				/A042
	4			/GRFX TO MONITOR ONLY			/A042
				>/END IFDEF VT125R			/A042

/ENTER WITH AC11 = TO 0 OR 1 TO SET FROM OR TO DM2			/A026
PRQSU2,	XX								/A026
	SNA			/ Is it a VT52 ?			/A055
	JMP	PRQLB		/ Yes , use ESC - BS keys		/A055
	TAD	(2)		/					/A055
	SZA 			/ VT125 ?				/A056
	AC0001			/ Use ESC/BS keys			/a056
	
PRQLB,	PRQ3			/PANEL REQUEST 3			/A026
	10			/EIGHT					/A026
NEG1,	7777			/1				/M04	/A026
	JMP I	PRQSU2		/GO BACK WHERE YOU CAME FROM		/A026

SWVT52,	JMS	DMTOSC		/OUTPUT $[?2l TO SWITCH TO VT52.
	ESC
	"[&177
	"?&177
	"2&177
	"l&177
	0			/STOPPER.
	CLA			/CLEAR AC FOR RETURN			/A049
	JMP I	RETERM		/WHEW!					/A026
				>/END IFDEF CONDOR



/THE PROGRAM TO HANDLE THE DISK TO DEVICE COMMANDS

DKTJBA,	CIFSYS
	JWAIT

/DISK JOB BEGINS HERE.  THER OPERATIONS PERFORMED ARE AS FOLLOW:
/SEE IF THERE ARE DOCUMENTS TO BE OPENED
/SEE IF THERE IS ENOUGH SPACE LEFT ON THE DOCUMENT BEING WRITTEN TO
/WRITE THE NEXT CHARACTER FROM THE OUTPUT BUFFER TO THE DISK
/CHECK FOR \R, ETC REQUESTING DISK JOB TO DROP
/IF THERE-S AN INPUT FILE, GET THE NEXT CHARACTER FROM DISK

DKTJOB,	JMS	CXRDOP		/OPEN ANY DOCUMENT WAITING TO BE READ

DKTLOP,	TAD	DSKCNT		/CHECK FOR CHAR. TO BE OUTPUTED
	SNA CLA
	JMP	NOPE
	JMS	DKTODC		/WRITE A CHARACTER TO SCROLL.		/M011
	JMP	DKTERR		/WRITE ERROR.				/M011
	JMP	DKTER2		/DEVICE FULL ERROR.			/M011
	JMP	DKTLOP		/LOOP UNTIL NO MORE TO OUTPUT.		/A011

NOPE,	TAD	DKACTF
	SZA CLA
	JMP	DKCLRD		/SEE IF SOMETHING TO DO (NON ZERO)
	TAD	ITFILE
	TAD	OTFILE
	SNA CLA
	JMP	EXDSK		/EXIT ROUTINE
	TAD	ITFILE
	SNA CLA
	JMP	DKTJBA		/PUT IN WAIT
	JMP	DSKJOB

/MOVED HERE TO MAKE ROOM ELSEWHERE.					/M017
DKACTS,	XX
	CDFMYF
	CLA
	TAD	ITFILE
	TAD	OTFILE
	SNA CLA			/ANY FILES OPEN?
	JMP I	DKACTS		/NO, JUST RETURN.
	DCA	DKTFLG		/SAY NOTHING TO OUTPUT TO.		/A007
	AC0001
	DCA	DKACTF		/SET FLAG TO TELL THE DISK PROG. TO DO SOMETHING
DKACTL,	TAD	DKACTF		/WAIT UNTIL THE DISK PROG. IS DONE
	SNA CLA
	JMP	DKACXT		/CLOSE OPEN FILES & RETURN.		/M029
	CIFSYS
	JSWAP
	JMP	DKACTL

DKACXT,	JMS	CXRDCL		/CLOSE ANY OPEN READ FILE.		/A029
	JMS	CXSKCL		/CLOSE ANY OPEN SCROLL FILE.		/A029
	JMP I	DKACTS		/NOW WE CAN RETURN.			/A029
/
/	Routine to mask character to 7 or 8 bit depending on 
/	VTMODE setting

MASKIT,	XX
	CDFVTF			/ Change field to video field		/A055
	AND I	(VT22MSK)	/ mask to 7 or 8 bit			/A055
	CDFMYF			/ and back to my field			/A055
	JMP I	MASKIT		/ return				/A055




/--------------------------
	PAGE

/GET THE NEXT DISK INPUT CHARACTER

DSKJOB,	CDIEDT			/DATA AND INSTRUCTION TO FIELD 3

/THERE ARE 3 RETURNS FROM THIS SUBROUTINE CALL
/PLUS 1 IS FOR THE WAIT STATE
/PLUS 2 IS FOR END OF DOCUMENT
/PLUS 3 IS SUCCESS. CHARACTER IN AC. RULERS AND FORM CONTROL CHARACTERS
/ARE STRIPPED, TECHNICAL CHARACTERS ARE TRANSLATED TO CORRECT ONES
/AND RETURNED

	JMS	DSKGCH		/GET THE NEXT CHARACTER TO SEND FROM THE DISK
	JMP	DKTJBA		/RETURN 1  PUT INTO A WAIT STATE
	JMP	ENDOUT		/RETURN 2  END OF DOCUMENT
	MQL			/RETURN 3  SUCCESSFUL WITH CHARACTER IN AC

	AC0001
	AND	DKTFLG		/CHECK FOR CHARACTER TO GO TO SCREEN
	SZA CLA
	JMP	DKTSCR

DKTLP3,	TAD	DKTFLG
DKTLP6,	DCA	DKTFLX
	MQA
	DCA	DKTCHR
	TAD	(ODLIST-1) 	/THE OUTPUT ROUTINES
	DCA	DKTOXL

DKTLP1,	TAD	DKTFLX
	SNA
	JMP	DKTHST		/DONE RETURN
DKTLP2,	ISZ	DKTOXL
	CLL RAR
	SNL
	JMP	DKTLP2		/CHECK THE BITS
	DCA	DKTFLX
	TAD I	DKTOXL
	DCA	DKTXXX
	JMP	DKTPUT							/M007

DKTXOF,								/C054
/D054	JMS	CHKHLT							/A052
	CIFSYS
	JWAIT
	CLA								/A054
	TAD	DKTFLG							/A007
	SNA CLA			/SKIP IF YES.				/A007
	JMP	DKTLP1		/DON'T OUTPUT TO THIS DEVICE.		/A007
DKTPUT,	TAD	DKTCHR
	CIFEDT			/ Point to CX2 instr field		/A057
	JMS I	(NRCTRM)	/ And go check if 8 bit to 7 bit NRC	/A057
				/ conversion required			/A057
	  JMP	DKTHST		/ Bad char , try again			/A057
	  NOP			/					/A057
	TAD 	DKTCHR							/A057
	CIFEDT			/ Point to WPCX2 field			/A057
	JMS	NRCSWD		/ See if NRC swap required		/A057
	CIFSYS
DKTXXX,	XX
	JMP	DKTXOF
	JMP	DKTLP1

EXDSK,	DCA	DSKACF		/SAY DISK JOB NOT RUNNING.		/A011
	CIFSYS
	JEXIT
DKSTRT,	AC0001			/SAY DISK JOB IS RUNNING.		/A011
	DCA	DSKACF							/A011
	JMP	DKTJOB

DKTCHR,	0
DKTOXL,	0
DKTFLX,	0
DSKPT2,	0			/POINTER TO THE NEXT CHARACTER TO BE
				/TAKEN FROM THE BUFFER
				/AND WRITTEN TO THE DISK

/DKTODC - WILL OUTPUT A CHARACTER TO SCROLL IF THERE IS ANYTHING TO OUTPUT.
/IT CHECKS FOR DISK FULL AND A WRITE DISK ERROR. IT WILL SUBTRACT ONE FROM
/THE CHARACTER COUNTER DSKCNT AND INCREMENT THE BUFFER POINTER DSKPT2 FOR
/EVERY CHARACTER WRITTEN.

/CALL:
/JMS	DKTODC
/WRITE ERROR RETURN
/NO ROOM ERROR RETURN
/OK RETURN


DKTODC,	XX
	CLA								/A011
	CDFFIO								/M004
	TAD I	(SCFSPC)
	CDFMYF

	TAD	(-24)		/CHECK FOR 20 OR LESS FREE BLOCKS	/M035
	SPA CLA
	JMP	DKTOE2		/IF LESS THAN 20, JUMP			/M035

/GET THE NEXT OUTPUT BUFFER CHARACTER AND PUT IT TO THE DISK.
/USE THE BUFFER MANAGEMENT SCHEME DESCRIBED WHERE THE BUFFER IS ALLOCATED.

	TAD I	DSKPT2
	SPA
	DCA	DSKPT2
	SNA
	TAD I	DSKPT2		/GET CHAR. TO PUT IN BUFFER

	JMS	DOCFLT		/THROW OUT THE UNWANTED CHARACTERS
	SNA
	JMP	DKTRND		/IF ZERO RETURN THROW OUT THE CHARACTER
	CIFFIO								/M004
	FILEIO								/M004
	XPUTST
	SZA CLA			/ERROR ON WRITE?
	JMP	DKTOE1		/YES, JUMP.

	CDF 0
	DCA I	(INTFLG)
	CDFMYF			/SET ACTION FLAG

DKTRND,	AC7777
	TAD	DSKCNT
	DCA	DSKCNT		/DECR THE COUNTER
	ISZ	DSKPT2
	NOP
	ISZ	DKTODC		/OK RETURN.
DKTOE2,	ISZ	DKTODC		/NO ROOM ERROR.
DKTOE1,	JMP I	DKTODC		/WRITE ERROR RETURN.

/RESTORE TERMINAL CHARACTERISTICS					/A002

/SEND THE FOLLOWING ESCAPE SEQUENCES TO THE TERMINAL:			/A002

/$C		RESET TERMINAL (CONDOR ONLY)				/A021
/$=		SELECT ALT KEYPAD MODE					/A002
/$[?1H		CURSOR KEYS TO APPLICATION MODE				/A002
/$[?8H		TURN ON AUTO REPEAT					/A002
/$[0M		TURN OFF ALL ATTRIBUTES					/A002
/^O		SHIFT-IN (SHIFT TO G0 CHARACTER SET)			/A014
/$(B		SELECT G0 AS US CHARACTER SET.				/A013
/$)0		SELECT G1 AS GRAPHICS CHAR SET.				/A014

RESTOR,	XX			/DURING  G O L D MENU RETURN ONLY	/A002
	AC0001			/RESET TERMINAL TO WPS MODE		/A050
	JMS	PRQSU2							/A050
	JMS	DMTOSC		/RESET REST OF CHARACTERISTICS		/A002

/THE FOLLOWING ESCAPE SEQUENCE WAS CHANGING BAUD RATES BACK TO THOSE	/A024
/OF THE DECMATE-II FIRMWARE SETUP MODE AN THUS HAS BEEN DELETED		/A024
	ESC;"c&177		/FIRMWARE ALLEDGEDLY CAN NOW HANDLE $c	/A027
	ESC			/$= - ALT KEYPAD MODE			/A002
	"=&177								/A002
	ESC			/$[?1;8h - APPLICATION MODE AND AUTO REPEAT/A002
	"[&177								/A002
	"?&177								/A002
	"1&177								/A002
	";&177								/A002
	"8&177								/A002
	"h&177								/A002
	ESC			/$[0m - ATTRIBUTES OFF			/A002
	"[&177								/A002
	"0&177								/A002
	"m&177								/A002
	"O&77			/SHIFT-IN (^O)				/A014
/
/	The escape seq below was moved to WPCX on edit 057 to free up 	/A057
/	space and allow easier change of NRC				/A057
/
/
/d057	ESC			/$(B  - SET G0 TO US ASCII CHARACTER SET/A013
/d057	"(&177								/A013
/d057	"B&177								/A013
/d057	ESC			/$)0  - SET G1 TO GRAPHICS CHARACTER SET/A014
/d057	")&177								/A014
/d057	"0&177								/A014
	0			/STOPPER				/A002
	JMS	RESNRC		/ Reset NRC if required			/A057
RSTXIT,	JMP I	RESTOR		/RETURN TO CALLER			/A002


/------------------------------
	PAGE


/IF THERE ARE OPENED INPUT AND/OR OUTPUT FILES, THIS WAIT LOOP WILL BE
/EXECUTED BEFORE THE DISK JOB DROPS OUT.  IT WILL NEVER BE EXECUTED
/WHEN THERE IS NEITHER AND INPUT NOR AN OUTPUT FILE.  THE MAGIC FORMULA IS
/AS FOLLOWS:
/ALWAYS WAIT TO SEE IF THERE IS AN INPUT FILE TO RETURN.  (DKACTS WILL
/ALWAYS SET THE DISK ACTION FLAG IF THERE IS EITHER)
/IF CLOSING THE INPUT FILE LEAVES NO OPEN FILES, THEN DON'T WAIT FOR
/A REQUEST TO CLOSE THE OUTPUT FILE BECAUSE IT WILL NEVER COME
/(DKACTS WILL NEVER PASS IT ON)

DKCLRD,	JMS	CXRDCL		/CLOSE THE FILE FOR READ IF ONE IS OPEN.
	TAD	OTFILE		/ONLY WAIT FOR CLOSE OF OUTPUT FILE
				/IF THERE IS ONE
	SNA CLA
	JMP	DKCLS3							/A012

DKCLSC,	TAD	DSKCNT		/DUMP REST OF BUFFER TO SCROLL FILE.	/A011
	SNA CLA			/SKIP IF THERE IS MORE TO DO.		/A011
	JMP	DKCLS2		/JMP WHEN ALL DONE.			/A011
	JMS	DKTODC		/OUTPUT A CHARACTER TO SCROLL FILE.	/A011
	NOP			/WRITE ERROR.				/A011
	JMP	DKCLS2		/DEVICE FULL ERROR.			/A011
	JMP	DKCLSC		/SEE IF DONE.				/A011

DKCLS2,	JMS	CXSKCL		/CLOSE SCROLL
DKCLS3,	CLA								/M012
	DCA	DKACTF		/CLEAR THE DONE FLAG
	JMP	EXDSK

/DISK OVERFLOW ERROR.
/SET ERROR FLAG INDICATING OVERFLOW (1 NOW PLUS 1 ADDED BELOW = 2)
/JOIN CODE TO WAIT FOR ERROR TO BE ACKNOWLEDGED

DKTER2,	ISZ	ERFLG		/NO MORE ROOM

DKTERR,	ISZ	ERFLG		/ERFLG SET BEFORE OTHER JOBS ARE TERMINATED

DKTLP,	CIFSYS
	JSWAP			/WAIT FOR DISK ACTION FLAG
				/INDICATING SOMETHING TO DO
				/WILL ONLY BE SET WHEN WAITING
				/FOR A CLOSE REQUEST
	CLA
	TAD	DKACTF
	SNA CLA
	JMP	DKTLP
	JMP	DKCLRD		/ELSE GO DO WHAT IS TO BE DONE

/DSKPUT PUTS A CHARACTER INTO THE OUTPUT BUFFER.  IT USES THE BUFFER
/MANAGEMENT SCHEME DESCRIBED AT DSKBUF, WHERE THE BUFFER IS ALLOCATED.
/THUS, THER FOLLOWING IS ENFORCED:
/THE CHARACTER MUST NEVER HAVE A SET SIGN BIT.
/THE BUFFER MUST ALWAYS BEGIN AT AN ADDRESS WHICH CAUSES THE SIGN
/BIT TO BE SET.

DSKPUT,	XX			/HANDLES THE CHARACTERS TO BE OUTPUTTED TO DSK
	AND	P3777
	DCA I	DSKPT1
	TAD	DSKCNT
	TAD	(-BFSIZ)
	SNA CLA
	JMP	DBFULL
	ISZ	DSKCNT
	ISZ	DSKPT1
	TAD I	DSKPT1
	SPA
	DCA	DSKPT1
	CLA
	CDF 0
	DCA I	(INTFLG)
	CDFMYF			/SET FLAG
	ISZ	DSKPUT		/IS SUCCESSFUL THEN SKIP RETURN
	JMP I	DSKPUT

DBFULL,	TAD I	DSKPT1
	JMP I	DSKPUT		/IF NOT NO SKIP AND AC HAD CHR

DSKPT1,	0			/POINTER TO THE NEXT AVAILABLE
				/BUFFER LOCATION FOR
				/CHARACTERS GOING INTO THE BUFFER
DSKCNT,	0			/NUMBER OF CHARACTERS CURRENTLY IN THE BUFFER

ENDOUT,	CLA
	DCA	DKTFLG
	TAD	(CNTRLG)
	JMS	KBTOCH
	JMS	CXRDCL		/CLOSE THE FILE SINCE WE ARE DONE
	JMP	DKTJOB

/XBSBUF - WILL SET THE BUFFERS USED BY CX TO DEFINE SOME VARIABLE
/LIKE END OF LINE AND OTHERS TO THE CURRENT SETTINGS. IT WILL READ
/THE SETTING IN FOR CX2 TO USE.

/THIS ROUTINE ALSO SENDS THE FOLLOWING ESCAPE SEQUENCES TO THE		/A030
/TERMINAL (PREPARATION FOR "BLANK SCREEN MODE":				/A030
/	$>		SET KEYPAD TO NUMERIC MODE.			/A030
/	$[?1l		SET CURSOR TO CURSOR MODE.			/A030

XBSBUF,	XX
	JMS	DMTOSC		/OUTPUT THE ESCAPE SEQUENCES.		/A030
	ESC;">&177		/SET KEYPAD TO NUMERIC.			/A030
	ESC
	"[&177
	"?&177
	"1&177
	"l&177			/CURSOR TO CURSOR MODE			/A030
	0			/STOPPER.				/A030
	TAD	(DSKBUF-1)	/GET ADDRESS OF DISK BUFFER.		/A033
	DCA	X0		/SAVE IN AN INDEX REGISTER.		/A033
	TAD	(-BFSIZ-1)	/COMPUTE # OF WORDS TO ZAP.		/A033
	DCA	T1		/SAVE FOR ISZ LOOP.			/A033
XBS1,	DCA I	X0		/ZERO OUT DSK BUFFER.			/A033
	ISZ	T1		/LOOP ON BUFFER SIZE.			/A033
	JMP	XBS1							/A033
	TAD	(DSKBUF)	/SET RING POINTER FOR LOOP-BACK.	/A033
	DCA I	X0							/A033
	CIFEDT
	JMS I	(CX2RWB)	/CROSS FIELD CALL TO "CX2RWB".		/A015
	RXERD
	DLCX2C
	CDFMNU			/MAP THE MENU FIELD.			/A015
	TAD I	(MUBUF+MNTMP6)	/GET EZ-LINK MODE.			/A033
	DCA	T1		/SAVE IN A TEMP.			/A033
	DCA I	(MUBUF+MNTMP6)	/ZAP EZ-LINK MODE FOR WHEN WE EXIT.	/A033
	TAD	T1		/SET THE "FROM LOGON" FLAG		/A040
	DCA	FROMLO		/THIS WILL SET TO "-1" IF FROM LOGON.	/A040
	TAD	T1		/WERE WE JUST CHAINED TO?		/A033
	SZA SMA CLA		/SKIP IF NO. (IE NORMAL STARTUP).	/M034
	JMP	XBSBF3		/JMP IF "CHAINED" STARTUP.		/A033
XBSBF1,	AC0002			/THE EZLINK BIT IS #10.			/A038
	AND I	(MUBUF+MNXONF)	/GET THE EZLINK ENABLE BIT.		/A033
	SNA CLA			/IF ON THEN EZLINK IS DISABLED.		/A033
	ISZ	EZLINK		/SET EZ-LINK INDICATOR.			/A033
	TAD I	(MUBUF+CXTMOD)	/NOW GET TERMINAL MODE.			/A033
XBSBF2,	CDFEDT			/MAP THE EDT FIELD (TO STORE VTMODE).	/A015
	DCA I	(VTMODE)	/SAVE INITIAL TERMINAL MODE.		/A015
	TAD I	(VTMODE)	/WHAT WAS THAT AGAIN			/A028
	SZA			/DON'T ZERO OLD (IS 4 ANSI MODES ONLY)	/A028
	DCA I	(VTMOLD)	/INITIALLY KEEP MODE & OLD THE SAME	/A028
	CDFMYF			/CHANGE DATA FIELD BACK TO US.		/A015
		IFDEF	VT125R	</FOR VT125 GRAPHICS			/A042
	CIFEDT			/OTHER CX FIELD				/A042
	JMS I	(GRLOAD)	/SEE IF NEED TO LOAD GRAFIX MODULES	/A042
				>/END IF DEF VT125R			/A042
	TAD	T1		/IS THIS A RESTART?			/A033
	SNA CLA			/SKIP IF YES.				/A033
	JMP I	XBSBUF		/RETURN TO CALLER.			/A033
	JMP	CNMERG		/FOR NOW WE MERGE INTO BLANK SCREEN	/A033
				/WITH THE DEFAULT SETTINGS OF KH HS	/A033
XBSBF3,	ISZ	EZLINK		/SET EZ-LINK MODE.			/A033
	CDFSYS			/MAP SYS FIELD.				/A033
	TAD I	(EZLNTM)	/GET SAVED TM MODE WORD.		/A033
	JMP	XBSBF2		/MERGE ABOVE.				/A033
				/FROMLO MUST BE ON THIS PAGE DUE TO	/A039
				/DATE FIELD CONSTRAINTS.		/A039
FROMLO,	0			/SET TO -1 WHEN ENTERED FROM LOGON.	/A039

	PAGE

H2TXON,	CIFSYS
	JWAIT
H2TJOB,	CLA
	TAD	H2TFLG
	SNA CLA
	JMP	H2TXIT
	CIFSYS
	HS2IN
	JMP	H2TXON
	DCA	H2TCHR		/SAVE AND TEST FOR LINE ERRORS
	TAD	H2TCHR
	AND	(3400)		/CHECK FOR ERRORS
	SNA								/C023
	JMP	H2TJB1

	CLA								/A023
	TAD	("?)

	JMP	H2BK1		/YES, INSERT A "?"
H2TJB1,	TAD	H2TCHR
	CIFEDT			/ Point to WPCX2 field		/A057
	JMS I	(NRCTRM)	/ Check for 8 bit to 7 bit NRC	/A057
	  JMP	NRCTRN		/ Translate from 7 bit to 8 bit	/A057
	  JMP	H2TJOB		/ Bad char , ignore		/A057

	TAD	H2TCHR		/ Get char back			/A057
NRCRPD,	
/d055	AND	P377		/ONLY WANT 7 BITS			/M055
	JMS	MASKIT		/ Mask to 7 or 8 bits			/A055
	DCA	H2TCHR
	TAD	H2TCHR		/STORE THE CHARACTER
	CIA

	CDFEDT
	TAD I	(RECFLG)
	CDFMYF			/SEE IF RECEIVE IS SET
	SNA CLA
	JMP	H2TJB3

H2TJB2,	TAD	H2TCHR
	CIA
	CDFEDT
	TAD I	(WATFLG)
	CDFMYF			/SEE IF THE SEND DOCUMENT SOFTWARE
				/IS WAITING FOR SOMETHING
	SNA CLA
	JMP	H2TJB4		/IF MATCHES THEN RESUME SENDING

H2TJB5,	TAD	H2TCHR

H2BK1,	DCA	H2TCHR
	TAD	H2TFLG
	DCA	H2TFLX
	TAD	(ODLIST-1)
	DCA	H2TOXL
	TAD	H2TFLX
	AND	(20)
	SZA CLA
	JMS	H2TDSK
	AC0001
	AND	H2TFLX		/SEE IF THE SCREEN FLAG IS SET
	SZA CLA
	JMS	H2TSCR
	TAD	H2TFLX
H2TLP1,	SNA
	JMP	H2TJOB
	JMP	H2TLP2


H2TJB3,	JMS	H2TSRB		/SEND THE CONTENTS OF THE RECEIVE BUFFER
	JMP	H2TJB5		/RETURN AND CONTINUE FOR THE CHARACTER THAT
				/STARTED THIS.
H2TJB4,	AC7777			/CLEAR THE WAIT FLAG
	CDFEDT
	DCA I	(WATFLG)
	CDFMYF
	JMP	H2TJB5		/THEN RETURN THE CHARACTER

H2TLP2,	ISZ	H2TOXL
	CLL RAR
	SNL
	JMP	H2TLP2
	DCA	H2TFLX
	TAD I	H2TOXL
	DCA	H2TXXX
H2TLP3,	JMP	H2TPUT

H2TXOF,									/C054
/D054	JMS	CHKHLT							/A052
	CIFSYS
	JWAIT
	CLA								/A054
	TAD	H2TFLG							/A007
	SNA CLA			/SKIP IF NO.				/A007
	JMP	H2TXIT		/EXIT IF YES.				/A007
H2TPUT,	AC0001
	JMS	CKFLBK		/Check if we need fall back		/A055
	  JMP 	H2TIO		/No fall back required	char in Ac	/A055
	TAD	H2TXXX		/Get service routine			/A055
	DCA	FBKSRV		/ Save in line for fall back IO		/A055
	TAD	FLBKC1		/Get 1st char				/A055
	CIFSYS			/Output it here				/A055
FBKSRV,	XX			/Modified in line to be service routine	/A055
	JMP	H2TXOF		/ Error return				/A055
	TAD	FBKSRV		/Get service routine again		/A055
	TAD	(-LPTOU)	/Was it to the printer			/A055
	SZA CLA			/					/A055
	JMP	H2FB2		/Output Fall back char 2		/A055
	TAD	(10)		/Load Backspace				/A055
	CIFSYS			/Ouput it here				/A055
	LPTOU			/Must be to the printer			/A055
	JMP 	H2TXOF		/Error out				/A055

H2FB2,	TAD	FLBKC2		/Get 2nd char				/A055
H2TIO,	CIFSYS			/					/M055
H2TXXX,	XX
	JMP	H2TXOF
	TAD	H2TXXX		/DID WE JUST OUTPUT TO THE PRINTER?	/A006
	TAD	(-LPTOU)	/?					/A006
	SNA CLA			/SKIP IF NO.				/A006
	JMS	LPTCHK		/SEE IF TIME TO DO AUTO-PAGINATION.	/A006
	TAD	H2TFLX
	JMP	H2TLP1

/
/	H2TXIT moved from here to code at KBTICH/KBTOCH for space	/A057
/	reasons on edit 57						/A057
/







	PAGE

/IF THE CHARACTER THAT WAS LAST SENT WAS A CR THEN FOLLOW IT WITH A LF TO
/ALL THE NON-HOSTS THAT THE DISK JOB IS SENDING TO.

DKTHST,	TAD	DKTCHR		/CHECK FOR END OF LINE
	TAD	EOLCHR		/DID WE SEND AN END OF LINE CHAR LAST?
	SZA CLA
	JMP	DKTJOB		/NOTHING SPECIAL IF NOT
	TAD	PADCHR
	MQL			/THEN SEND PAD CHAR.; IF EOL = CR SEND LF
	TAD	DKTFLG
	AND	(23)
	JMP	DKTLP6

EOLCHR,	-CR
PADCHR,	LF

/DOCFLT - FILTER FOR DOCUMENTS
/THIS IS THE CHARACTER FILTER FOR ALL CHARACTERS GOING TO DOCUMENT
/THIS IS CALLED FROM THE DISK ROUTINE WHEN PUTTING CHARACTERS TO THE DISK

DOCFLT,	XX
	DCA	DCFLCHR		/Save char				/A055
	TAD	DCFLCHR		/Get it back				/A055
	AND	(400)		/Check for one of our St-End Dead 8 bit	/A055
	SZA CLA			/					/A055
	JMP	NOFLTR		/Its 410 or 415 from 8 bit stuf		/A055
	TAD	DCFLCHR		/Get char back				/A055
	AND	P377		/REMOVE WEIRD BITS THAT COULD HURT A DOCUMENT
	DCA	T1
	TAD	T1		/IS THIS CHAR TO BE IGNORED?		/A043
	TAD	DOCSAV							/A043
	SNA CLA			/SKIP IF NO.				/A043
	JMP	DOCFLN		/FILTER CHAR OUT.			/A043
	TAD	T1
	TAD	(-RUBOUT)	/RUBOUT?				/A043
	SNA			/SKIP IF NO.				/A043
	JMP	DOCFLN		/JMP IF YES. FILTER CHAR OUT.		/A043
	TAD	(RUBOUT-TAB)	/SEE IF A TAB; THAT IS A VALID CHARACTER
	SZA			/IF A TAB THEN OUTPUT IT.		/A043
	TAD	(TAB-FF)	/FORM FEED
	SZA			/OUTPUT FORM FEED CHARACTERS TOO.	/A043
	TAD	(FF-40)		/SEE IF >= SPACE CHARACTER.		/A043
	SMA CLA			/SKIP IF < SPACE.			/A043
	JMP	DOCFOK		/JMP TO OUTPUT OK CHARACTER.		/A043
	TAD	T1		/GET CHARACTER BACK.			/A043
	TAD	(-LF)		/LINE FEED?				/A043
	SNA			/SKIP IF NO.				/A043
	JMP	DOCEOL		/SET 'IGNORE CR FLAG'.			/A043
	TAD	(LF-CR)		/CARRIAGE RETURN?			/A043
	SZA CLA			/JMP IF YES. SET 'IGNORE LF FLAG'.	/A043
	JMP	DOCFLN		/IGNORE CHARACTER (FILTER IT OUT).	/A043
	SKP			/SKIP TO SET 'IGNORE LF' FLAG.		/A043
DOCEOL,	TAD	(-CR+LF)	/SET 'IGNORE CR' FLAG.			/A043
	TAD	(-LF)		/SET 'IGNORE LF' FLAG.			/A043
	DCA	DOCSAV		/SAVE CHAR TO IGNORE IF MATCH NEXT CHAR	/A043
	TAD	(LF)		/CONVERT ALL CR'S TO LF'S.		/A043
	JMP I	DOCFLT		/& RETURN TO CALLER W/EOL CHARACTER.	/A043

DOCFOK,	TAD	T1		/RESTORE CHAR TO RETURN.		/A043
DOCFLN,	DCA	T1		/SAVE IT (OR ZAP IF FILTERING).		/A043
	DCA	DOCSAV		/ZAP 'CHAR TO IGNORE' FLAG.		/A043
	TAD	T1		/GET CHAR TO RETURN.			/A043
	JMP I	DOCFLT		/RETURN W/CHAR (OR 0) IN AC.		/A043

NOFLTR,	TAD	DCFLCHR		/Get it back 				/A055
	AND	P177		/Mask of 400 bit			/A055
	DCA	T1		/Save it				/A055
	JMP	DOCFOK		/Rejoin main code			/A055


DOCSAV,	0			/SAVE CHAR OF LAST CHAR PUT TO DISK.	/A043
DCFLCHR,0			/Another temp for Filtered char		/A055  
/
/	This routine will set up the character mask to 7577 or 7777	/A055
/	depending on which option is requested (VTMODE=5 for 8 bit)	/A055
/
MSKSET,	XX
	CDFVTF			/ Change to cosmetics pointer field	/A055
	AC7777			/ Test if vt100				/A057
	TAD I	(VTMODE)	/ get mode 				/A055
	SNA 			/ 					/A057
	JMP 	MSK8		/ It was VT100				/A057
	TAD	M4		/ No ,Is it 5 (VT220 8 bit)		/A055
	SNA 			/					/A055
	JMP	MSK8		/ Term type 5 , 8 bit			/A055
	TAD	M1		/ Subtract 1 more (-6) for 7 bit fallbck/A055
	SNA CLA			/					/A055
MSK8,	TAD	K200		/ 8 bit  , mask to 7777			/A055
	TAD	K7577		/ 7 bit , mask to  7577			/A055
	DCA I	(VT22MSK)	/ and save it 				/A055
	TAD I	(VT22MSK)	/ get it back				/A055
	AND	K200		/ Was the 8th bit set			/A055
	DCA I	(TM8BIT)	/ Save in 8 bit terminal flag		/A055
	CDFMYF			/ back to this field			/A055
	JMP I	MSKSET		/ Return				/A055

M4,	-4
K200,	200
K7577,	7577
M1,	-1

/
/	This routine is more or less a copy of KB2LPX code moved here	/A055
/	from KB2DOC routine for space reasons				/A055
/

KB2DCOUT,
	XX
	DCA	DOCOCHR		/Save char				/A055
	SKP
KB2DHLT,								/A055
	JMS	CHKHLT		/Check halt flag			/A055
	CIFSYS			/					/A055
	JWAIT			/Hang about				/A055
	CLA			/Just in case				/A055
	TAD	DOCOCHR		/Get char back				/A055
	JMS	DSKPUT		/Write it to disk			/A055
	JMP	KB2DHLT		/Retry if required			/A055
	JMP I	KB2DCOUT	/Return					/A055

DOCOCHR,0			/Temp for char to be output		/A055


/
/	H2DOCOUT outputs a char (from Host port) to Doc Buffer		/A055
/	Moved (and slightly reworked) from in line code at H2TDSK	/A055
/

H2DOCOUT,
	XX
	DCA	H2DCCHR		/Save char parameter			/A055
	JMP	H2DPUT		/					/A055

H2DXOF,	CIFSYS
	JWAIT
	CLA			/SEE IF WE ARE STILL TO RUN.		/A007
	TAD	H2TFLG							/A007
	SNA CLA			/SKIP IF YES.				/A007
	JMP	H2TXIT		/EXIT IF NO.				/A007
H2DPUT,	TAD	H2DCCHR		/STORE THE CHARACTER IN THE DOCUMENT BUFFER
	AND	(577)		/Don't filter out 410 & 415 8 bit	/M055
	JMS	DSKPUT		/		
	JMP	H2DXOF		/
	CLA			/
	JMP I	H2DOCOUT	/Exit

H2DCCHR,0			/Temp for output char			/A055



/-------------------------
	PAGE

KBTOCH,	XX
	JMP	KBTOC1
KBTOC0,	CIFSYS
	JWAIT
KBTOC1,	CIFSYS
	TTYOU
	JMP	KBTOC0
	JMP I	KBTOCH

KBTICH,	XX
	JMP	KBTIC1
KBTIC0,	CIFSYS
	JWAIT
KBTIC1,	CIFSYS
	XLTIN
	JMP	KBTIC0
	JMP I	KBTICH



/
/	The code below was moved to here and JLIST that was here has	/A057
/	to DSKBUF for space reasons					/A057
/
/


H2TXIT,	CLA
	DCA	RSNFLG		/CLEAR THE FLAG THAT MAKES DSKJOB PAUSE.
	DCA	HSTACF		/SAY HOST JOB NOT RUNNING.		/A011
	CIFSYS
	JEXIT
H2STRT,	AC0001			/SET HOST JOB RUNNING FLAG.		/A011
	DCA	HSTACF							/A011
	JMP	H2TJOB



/DKTOSR - OUTPUT A CHARACTER TO THE SCREEN FROM THE DISK PROGRAM

DKTOSR,	XX
	JMP	DKTOS1
DKTOS2,	CIFSYS
	JWAIT
DKTOS1,	CIF 0
	TTYOU
	JMP	DKTOS2
	JMP I	DKTOSR

/
/	This routine outputs a sequence of the form 
/
/	<St Dead><Space><62><Chr Value-200><End Dead>
/
/	to the disk for any 8 bit char found (a la V2.0)
/

DOC8OUT,
	XX							/A055
	AND	P177		/Mask of 8th bit		/A055
	DCA	DOC8CHR		/And put into string		/A055
	TAD	(DOC8STR)	/Get string Start address	/A055
	DCA	DOC8PTR		/Save as a pointer		/A055
DOC8NXT,							/A055
	TAD I	DOC8PTR		/Get next char			/A055
	SNA			/Terminator ? (zero)		/A055
	JMP 	DOC8FIN		/Yes get out			/A055
	JMS	KB2DCOUT	/Output it to disk		/A055
	CLA			/Just in case			/A055
	ISZ	DOC8PTR		/Bump Pointer			/A055
	JMP	DOC8NXT		/And output next		/A055

DOC8FIN,
	JMP I	DOC8OUT		/ Return			/A055


DOC8STR,410;40;62		/First part of dead		/A055
DOC8CHR,0			/Char to dead, modified in code	/A055
	415;0			/rest of dead string and termin	/A055
DOC8PTR,0			/Pointer into DOC8STR		/A055


/
/	This routine is a copy of the one above except its for	/A055
/	the comms port which may interupt at the same time as 	/A055
/	the Keyboard so the routines should be seperate	(I think)/A055
/

H2DC8OUT,
	XX							/A055
	AND	P177		/Mask of 8th bit		/A055
	DCA	HDC8CHR		/And put into string		/A055
	TAD	(HDC8STR)	/Get string Start address	/A055
	DCA	HDC8PTR		/Save as a pointer		/A055
HDC8NXT,							/A055
	TAD I	HDC8PTR		/Get next char			/A055
	SNA			/Terminator ? (zero)		/A055
	JMP 	HDC8FIN		/Yes get out			/A055
	JMS	H2DOCOUT	/Output it to disk		/A055
	CLA			/Just in case			/A055
	ISZ	HDC8PTR		/Bump Pointer			/A055
	JMP	HDC8NXT		/And output next		/A055

HDC8FIN,
	JMP I	H2DC8OUT	/ Return			/A055


HDC8STR,410;40;62		/First part of dead		/A055
HDC8CHR,0			/Char to dead, modified in code	/A055
	415;0			/rest of dead string and termin	/A055
HDC8PTR,0			/Pointer into HDC8STR		/A055




/
/	Moved here on Edit 55 for space reasons to allow room for 	/A055
/	8 bit stuff from Host to Doc					/A055

DMTOSC,	XX			/LOOP OUTPUTTER				/A002
DMTOS1,	CLA								/A002
	TAD I	DMTOSC		/GET CHAR TO OUTPUT			/A002
	ISZ	DMTOSC		/POINT TO NEXT CHAR OR RETURN		/A002
	SNA			/0 MEANS END OF LIST			/A002
	JMP I	DMTOSC		/RETURN					/A002
	JMS	DKTOSR		/OUTPUT CHAR.
	JMP	DMTOS1		/DO NEXT CHAR				/A002



/
/H2TOSR - OUTPUT A CHARACTER TO THE SCREEN IN THE AC.
/WILL NOT RETURN UNTIL IT IS DONE.
/
/	Moved here on edit 55/56 for space reasons			/M055
/
H2TOSR,	XX
	JMP	H2TOS1
H2TOS2,	CIFSYS
	JWAIT
H2TOS1,	CIFSYS
	TTYOU
	JMP	H2TOS2
	JMP I	H2TOSR


/
/	Moved here on edit 055 for space reasons			/A055
/
/	THIS IS THE HOST TO SCREEN SPECIAL CHECK
/

H2TSCR,	XX			/THE ONLY THING THAT IS CONSIDERED IS TAB
	TAD	H2TCHR
	TAD	(-XON)		/GET RID OF XON/XOF GOING TO SCREEN
	SZA
	TAD	(XON-XOF)
	SZA CLA
	JMP	H2TSC4							/A002
	TAD	H2TFLX		/MODIFY FLAG SO SCREEN WON'T GET THE CHAR
	AND	(7776)
	DCA	H2TFLX
	JMP I	H2TSCR

H2TSC4,	TAD	H2TCHR		/GET CHAR				/A002
	TAD	(-ESC)							/A002
	SZA CLA			/DID WE SEE AN ESCAPE ?			/A002
	JMP	H2TSC5		/NO, JUST RETURN			/A002
	AC0001								/A002
	DCA	HSXX		/YES, SET FLAG				/A002
H2TSC5,	CIFEDT
	JMS	HST2SC		/MONITOR HOST-TO-SCREEN I/O.
	JMP I	H2TSCR							/A002

HSXX,	0			/SET TO 1 IF HS EVER ACTIVATED		/A002


/
/
/	Routine to decide whether to load H2TCHR or K2HCHR for fallback	/A055 
/	test.
/
K2HLD,	XX
	TAD	KHFLG			/K2 or H2 ?			/A055
	SNA CLA				/				/A055
	JMP 	K2LD			/Want K2			/A055
	TAD	H2TCHR			/Load Char			/A055
	JMP I	K2HLD			/Exit				/A055
K2LD,	TAD	K2HCHR			/Want K2HCHR so load it		/A055
	JMP I	K2HLD			/Exit				/A055




/----------------------
	PAGE

/DKTSCR - CHECKS FILTERS OUT XON AND XOF FROM GOING TO THE SCREEN AND ALSO
/TRANSLATES TABS INTO SPACES

DKTSCR,	MQA			/UPON CALLING THE CHARACTER IS IN THE MQ
	TAD	(-TAB)		/CHECK FOR TAB
	SZA
	JMP	DKTSC2
	TAD	(BLANK)
	JMS	DKTOSR

DKTSC3,	AC7776			/SET THE MASK TO NOT INCLUDE THE SCREEN
	AND	DKTFLG
	JMP	DKTLP6		/DO THE OTHER DEVICES

DKTSC2,	TAD	(TAB-XON)
	SNA
	JMP	DKTSC3
	TAD	(XON-XOF)
	SNA CLA
	JMP	DKTSC3
	JMP	DKTLP3

/HOST TO DOCUMENT

H2TDSK,	XX							/A055
	CLA			/Just in case			/A055
	TAD	H2TCHR		/Get char back			/A055
	AND	(200)		/Check for 8th bit on		/A055
	SNA CLA			/				/A055
	JMP	H2DC7BT		/No , output 7 bit		/A055
H2DC8BT,
	TAD	H2TCHR		/Yes , Get it back again	/A055
	JMS	H2DC8OUT	/And use 8 bit out routine	/A055
	JMP	H2DCFIN		/And get out			/A055
H2DC7BT,
	TAD	H2TCHR		/Get char back			/A055
	JMS	H2DOCOUT	/And output it			/A055
H2DCFIN,
	CLA
	TAD	H2TFLX
	AND	(17)
	DCA	H2TFLX
	JMP I	H2TDSK


/H2TSRB - HOST 2 WILL USE HIS ROUTINE TO SEND THE CONTENTS OF RECBUF
/THE BUFFER THAT CONTAINS THE COMMAND TO EXECUTE WHEN A DEFINED EVENT OCCURS.
/AN EVENT IS DEFINED AS RECEIVING A CHARACTER WHOSE VALUE IS IN RECFLG.

H2TSRB,	XX
	AC0001
	DCA	RSNFLG		/SET A FLAG TO TELL DSKJOB THAT H2JOB NEEDS
				/CONTROL OF THE HOST LINE UNTIL DONE SENDING

	TAD	(RCVBOF)	/INITALIZE THE RECEIVE COMMAND BUFFER
	CIFEDT
	JMS I	(DBRINI)

H2TSR2,	CIFEDT
	JMS I	(DBRGCH)	/GET THE NEXT VALUE IN THE BUFFER
	JMP	H2TSR2		/NOT SENDABLE
	SPA
	JMP	H2TSR3		/IF NEGATIVE THEN END OF THE COMMAND
	JMS	H2OUT		/OTHERWISE SEND THE CHARACTER OUT
	JMP	H2TSR2

H2TSR3,	CLA
	DCA	RSNFLG		/CLEAR THE FLAG TO ALLOW DSKJOB TO CONTINUE
	JMP I	H2TSRB

/H2OUT - SEND A CHARACTER OUT OVER THE COMMUNICATIONS LINE.
/IF H2TFLG IS NOT SET IT WILL EXIT THE JOB

H2OUT,	XX
	JMP	H2OU3

H2OU2,	MQL			/STORE THE CHARACTER
	TAD	H2TFLG		/CHECK TO SEE IF SHOULD CONTINUE
	SNA CLA
	JMP	H2TXIT
	MQA			/GET IT BACK TO OUTPUT IT AGAIN
	CIFSYS
	JWAIT

H2OU3,	CIFSYS
	HS2OU
	JMP	H2OU2
	JMP I	H2OUT

LPTCHK,	XX			/CHECK FOR <NEWLINE> & DO FF TO ASF	/A006
				/AS NECESSARY.				/A006
	TAD	H2TCHR		/GET CHARACTER JUST SENT TO PRINTER.	/A006
	TAD	(-FF)		/CHECK FOR A FORM-FEED.			/A016
	SNA			/SKIP IF NOT FF.			/A016
	JMP	LPTOU3		/JMP TO RESET LINE COUNT.		/A016
	TAD	(FF-LF)		/SEE IF IT WAS A LINEFEED.		/A016
	SZA CLA								/A006
	JMP I	LPTCHK		/RETURN IF NO.				/A006
	ISZ	LPTCNT		/1 MORE LINE PRINTED ON PRINTER.	/A006
	JMP I	LPTCHK		/RETURN IF PAGE NOT FULL.		/A006
	CDFPRT			/SEE IF PRINTER IS AN ASF.		/A006
	TAD I	(LPONLN)						/C032
	AND	(ASFMSK)						/A032
	CDFMYF			/BACK TO US.				/A006
	SNA CLA			/SKIP IF YES. SEND A FF.		/A006
	JMP	LPTOU4		/RESET COUNTERS & RETURN.		/A006
	TAD	(FF)		/SEND FF TO PRINTER.			/A006
	JMP	LPTOU2		/OUTPUT THE CHARACTER.			/A006

LPTOU1,	CIFSYS
	JWAIT
	MQL			/SAVE CHARACTER.			/A007
	TAD	H2TFLG		/ARE WE STILL OUTPUTTING?		/A007
	SNA CLA			/SKIP IF YES.				/A007
	JMP	H2TXIT		/EXIT JOB IF NO.			/A007
	MQA			/GET CHARACTER BACK AGAIN.		/A007
LPTOU2,	CIFSYS			/OUTPUT CHARACTER.			/A006
	LPTOU								/A006
	JMP	LPTOU1		/BUFFER FULL. WAIT & TRY AGAIN.		/A006
	CLA			/RESET PAGE SIZE COUNTER.		/A006
LPTOU3,	CDFPRT			/GET IT FROM PRINTER		/A016	/C036
	TAD I	(PRQPSZ)					/A016	/C036
	CDFMYF			/BACK TO US.				/A006
	CIA			/STORE "-PAGESIZE".			/A006
LPTOU4,	DCA	LPTCNT		/FOR THE ISZ.				/A006
	JMP I	LPTCHK		/RETURN W/CLEARED AC.			/A006


/
/	This is a modified copy of the loop at KBTLP3 made into 2
/	small routines and moved here for space reasons
/
/
KBTLPS,	XX							/M055
KBTLP1,	ISZ	KBTOXL						/M055
	CLL RAR			/				/M055
	SNL			/				/M055
	JMP	KBTLP1		/				/M055
	DCA	KBTFL1		/				/M055
	TAD I	KBTOXL		/Get service routine address	/M055
	DCA	KBTXXX		/Store in line for execution	/M055
	JMP I	KBTLPS		/Return				/M055


	PAGE

/THIS BUFFER HAS BEEN  MOVED HERE FROM WPCX TO MAKE ROOM		/A025
/FOR WPCRE WHICH HAS GROWN LARGER TO CHECK FOR AN INTIALIZED		/A025
/DISKETTE AND TO MAKE SURE THAT IT DOES NOT TRY TO CREATE 201		/A025
/DOCUMENTS INSTEAD OF 200 DOCUMENTS (WHICH IS WHAT IT IS SUPPOSED	/A025
/TO DO.									/A025

CNLINE,	IFDEF ENGLSH <
	"K-200								/M025
	"H-200								/M025
	" -200								/M025
	"H-200								/M025
	"S-200								/M025
	>
	IFDEF ITALIAN <
	"T-200
	"O-200
	" -200
	"O-200
	"V-200
	>
	IFDEF V30NOR <
	"T-200								/M025
	"V-200								/M025
	" -200								/M025
	"V-200								/M025
	"B-200								/M025
	>
	IFDEF V30SWE <
	"T-200
	"A-200
	" -200
	"A-200
	"B-200
	>




	ZBLOCK	47							/M025
	CNLEND=.-1							/M025
	0								/M025
/
/	Moved here on edit 57 to free up space at KBTATN		/A057
/
/	Some of the table here were moved to page 0 in WPCX		/A057
/

	IFDEF CONDOR <
KBECHK,	TAD	K121		/CHECK FOR LEADING ESC (POSSIBLE F4 F4)	/A044
	SNA			/SKIP IF NOT LEADING ESCAPE.		/A044
	JMP I	XKBTJB2		/PASS ESC CHAR TO KBTRAP.		/A044
	TAD	K110		/Q MINUS H				/A020
			>	/END IFDEF CONDOR

	IFNDEF CONDOR <
	TAD	(11)		/DIFFERENCE BETWEEN A "Q" AND "H"	/A046
			>	/END IFNDEF CONDOR

	SNA								/A020
	JMP I	XKBHGUP		/IS \H--GO HANGUP MODEM			/A020

	ACL			/LOAD ORIG CHAR BACK FROM THE MQ	/A044
	JMP I	XKBTGTI		/NONE OF THE ABOVE--OUTPUT CHR AFTER \
				/(I.E., \\ SENDS A \)

/
/	Constants below are to avoid generating links in the middle of	/A057
/	the Disk buffer							/A057
/

K121,	121-ESC
XKBTJB2,KBTJB2
K110,	ESC-110
XKBHGUP,KBHGUP
XKBTGTI,KBTGTI
/
/	Moved here on edit 055 for space reasons
/

ODLIST,	TTYOU
	LPTOU
	HS2OU
	HS2OU

/********************* VER 047 ****************

/THESE TABLES MOVED HERE TO ADD GRAPHICS CODE TO WPCX
/..AND NO ROOM AVAILABLE IN WPCX


/THE TABLES THAT FOLLOW DESCRIBE THE CX OPTIONS WHICH ARE SPECIFIED BY THE
/USER FROM THE KEYBOARD.  EACH OPTION IS SPECIFIED AS A PAIR OF CHARACTERS,
/THE FIRST OF WHICH IS THE DEVICE FROM WHICH CHARACTERS ARE TO BE TAKEN,
/AND THE SECOND OF WHICH GIVES THE DEVICE THAT THESE CHARACTERS ARE TO BE
/WRITTEN TO.

/THE TABLES ARE GROUPED INTO TWO SETS.
/TABLES DESCRIBING THE FIRST CHARACTER
/TAB1 - LEGAL FIRST LETTERS
/TAB2 - ADDRESS OF THE FLAG WORD CORRESPONDING TO EACH TAB1 ENTRY. WHEN
/THE FLAG WORD IS NONZERO, THE CORRESPONDING DEVICE IS BEING READ FROM.
/TABLES DESCRIBING THE SECOND CHARACTER
/TAB3 - LEGAL SECOND CHARACTERS OF THE PAIRS
/TAB4 - BIT TO BE SET INDICATING THAT THE INPUT JOB IS TO SEND ITS
/CHARACTERS TO THE CORRESPONDING 'TAB3' DEVICE.  THESE
/BITS ARE SET IN THE FLAG WORD FOR THE FIRST CHARACTER OF THE PAIR.
/ODLST - OUTPUT DEVICE HANDLER ADDRESSES  CORRESPONDIG TO DEVICES
/SPECIFIED IN 'TAB3'.  THERE IS NO ADDRESS FOR THE DISK HANDLER
/BECAUSE THE DISK JOB TAKES CARE OF ALL OF THAT (INSTEAD, THE
/INPUT JOBS PUT CHARACTERS INTO A BUFFER)


/
/	N O T E ....							/A057
/									/A057
/	The tables TAB1,TAB2,Tab3 and TAB4 have been moved to WPCX	/A057
/	page 0 to free up space here					/A057
/	Therefore they have been marked as deleted IN THIS PAGE		/A057
/




/d057TAB1,	IFDEF ENGLSH <
/d057	"K-200
/d057	"H-200
/d057	"T-200
/d057	"D-200
/d057	>
/d057	IFDEF ITALIAN <
/d057	"T-200
/d057	"O-200
/d057	"C-200
/d057	"D-200
/d057	>
/d057	-1
/d057TAB2,	KBTFLG
/d057	H2TFLG
/d057	TSTFLG
/d057	DKTFLG
/d057	-1
/d057TAB3,	IFDEF ENGLSH <
/d057	"S-200
/d057	"P-200
/d057	"H-200
/d057	"D-200
/d057	>
/d057	IFDEF ITALIAN <
/d057	"V-200
/d057	"S-200
/d057	"O-200
/d057	"D-200
/d057	>
/d057	-1
/d057TAB4,	CRT			/SCREEN
/d057	LQP			/LQP PRINTER
/d057	H2T			/PRIMARY HOST
/d057	DOC			/OUTPUT DOCUMENT

	/	
	/Routine moved here for space reasons			/M055
	/
	/Modified version of code that used to be at KBTLP3 loop/M055
	/

KBTIO,	XX							/M055
	DCA	KBIOCHR		/Store character away		/M055
	JMP	KBTOUT		/And try to output		/M055
KBTWAT,	JMS I	XCHKHLT		/User requested halt		/M055
	CIFSYS			/Change to system field		/M055
	JWAIT			/Hang about			/M055
KBTOUT,	TAD	KBIOCHR		/Get char back			/M055
	CIFSYS			/Change to system field		/M055
KBTXXX,	XX			/Service routine		/M055
	JMP	KBTWAT		/Busy , so go wait		/M055
	JMP I	KBTIO		/Return				/M055
KBIOCHR,0							/A055
XCHKHLT,CHKHLT			/Pointer to CHKHLT routine to	/A055
				/avoid auto link		/A055


/
/	Moved here on edit 057 for space reasons			/A057
/

JLIST,	H2STRT
	TJSTRT
	DKSTRT
	0


/THIS IS A CIRCULAR BUFFER FOR CHARACTERS THAT ARE TO BE OUTPUT TO DISK.
/ITS USE MAKES THE FOLLOWING ASSUMPTIONS:
/NO ENTRY HAS ITS SIGN BIT SET
/THE ADDRESS OF THE BUFFER IS AT LEAST 4000 OR GREATER
/THE LAST WORD+1 OF THE BUFFER CONTAINS THE ADDRESS OF THE START OF
/THE BUFFER.  BECAUSE THIS ADDRESS IS AT LEAST 4000, ITS SIGN BIT WILL
/BE SET.

/TO USE THE BUFFER, THE POINTER WILL BE ADVANCED THRU THE BUFFER
/LOCATIONS.  A TEST OF THE VALUE OF THE LOCATION TO BE USED NEXT SHOULD
/ALWAYS BE DONE BEFORE ANY STORES.  WHEN THE VALUE OF THE LOCATION IS
/NEGATIVE, IT IS THE ADDRESS OF THE FIRST WORD OF THE BUFFER INSTEAD,
/AND THE BUFFER POINTER MUST BE RESET BEFORE THE LOAD OR STORE IS DONE.

	BFSIZ=6000-.-2

DSKBUF,	ZBLOCK BFSIZ+1		/BUFFER FOR ALL WRITES TO DISK
	DSKBUF			/TRAILER AND POINTER TO NEXT LOCATION



