/1 BATCH INPUT STREAM HANDLER
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/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.
/
/
/
/
/
/
/
/
/
/
	*0
	-1		/NUMBER OF DEVICES
	DEVICE	BAT	/DEVICE TYPE NAME
	DEVICE	BAT	/DEVICE NAME
	2220		/READ ONLY, CODE=22
	0		/ONE PAGE
	ZBLOCK 2

BATIN=	5400
	BATVERSION="B&77


	*200
BAT,	BATVERSION
	CLA		/PROTECTION
	RDF		/GET USER'S FIELD
	TAD BATCDF	/MAKE CDF CIF
	DCA BATXIT	/SAVE FOR EXIT
	TAD BATISZ	/RESET SUCCESS ISZ
	DCA BATXIT-1
	TAD I BAT
	AND BA7700
	CIA
	DCA BATWC	/SAVE WORD COUNT (DIVIDED BY 2)
	TAD I BAT
	AND BA0070
	TAD BATCDF	/CREATE CDF TO BUFFER FIELD
	TAD (-2
	DCA BATBUF
BATISZ,	ISZ BAT
	TAD I BAT
	DCA BATCA	/GET ADDRESS OF BUFFER
	ISZ BAT
	ISZ BAT		/IGNORE BLOCK NUMBER
	TAD BATWC	/WAS COMMAND WRITE OR BUFFER LENGTH ZERO?
BA7700,	SMA CLA
	JMP BATER1	/YES - ERROR
BATCDF,	CDF CIF 0
	TAD I BA7777	/IS BATCH RUNNING?
	RAL
	SMA CLA
	JMP BATER2	/NO - ERROR
	TAD I BA7777
	AND BA0070
	TAD BATCDF	/CREATE CDF TO BATCH FIELD
	DCA BATCAL	/CREATE CDF CIF TO BATCH FIELD



BATLP,	JMS BATGET	/GET CHAR
	DCA I BATCA	/SAVE IN BUFFER
	JMS BATGET	/GET NEXT CHAR
	DCA BATTMP	/SAVE IT FOR PACKING
	JMS BATGET	/GET NEXT CHAR
	RTL
	RTL
	DCA BATTM2	/SAVE IT
	TAD BATTM2
	AND BA7400	/ADD FIRST HALF
	TAD I BATCA	/TO FIRST CHAR
	DCA I BATCA	/SAVE THEM IN BUFFER
	ISZ BATCA	/UPDATE POINTER
BA7400,	7400		/PROTECT THE ISZ
	TAD BATTM2	/GET SECOND HALF OF CHAR
	RTL
	RTL
	AND BA7400
	TAD BATTMP	/ADD TO SECOND CHAR
	DCA I BATCA	/SAVE IN BUFFER
	ISZ BATCA	/UPDATE POINTER
BA0070,	0070		/PROTECT THE ISZ
	ISZ BATWC	/DONE?
	JMP BATLP	/NO - LOOP

	ISZ BAT		/SUCCESS RETURN (ON EOF THIS BECOMES CLA IAC)
BATXIT,	HLT		/CDF CIF TO USER FIELD
	JMP I BAT	/RETURN

BATWC,	0		/WORD COUNT (DIVIDED BY 2)
BATCA,	0		/POINTER INTO BUFFER
BATTM2,
BATCHR,	0		/CHAR RETURNED BY BATGET
BATTMP,	0
BA7777,	7777


BATER1,
BATER2,	CLA STL RAR
	JMP BATXIT
/THIS ROUTINE GETS THE NEXT CHARACTER TO BE PUT INTO THE BUFFER
BATGET,	0
	0		/IF LAST CHAR WAS <CR> THIS IS "JMP BATLF"
BATCAL,	HLT		/CIF CDF BATCH FIELD (ON EOF THIS IS "JMP BATBUF")
	TAD I BATVFY
	TAD (-2214	/VERIFY MAGIC LOCATION IN BATCH
	SZA		/AGAINST EQUALLY MAGIC CONTENTS
	CDF CIF 0
	SZA CLA
	JMP BATER2	/BATCH IS DESTROYED!
	CDF		/WE ARE IN FIELD ZERO
	JMS I BATINN	/CALL THE BATCH INPUT ROUTINE
	JMP BATEOF	/NO SKIP = END OF FILE
	DCA BATCHR	/SAVE CHARACTER RETURNED
	TAD BATCHR
	TAD BMCR	/CARRIAGE RETURN?
	SNA
	JMP BATCR	/YES
	TAD BCRMLF	/LINE FEED?
	SNA
	JMP BATCAL	/YES - IGNORE IT
	TAD BLFMDO	/DOLLAR SIGN?
	SNA CLA
	JMP BATDO	/YES
BATGEX,	DCA BCRFLG	/NO SPECIAL CHAR
	TAD BATCHR	/RETURN WITH CHAR IN AC
BATBUF,	HLT		/CDF USER BUFFER
	JMP I BATGET	/RETURN

BLFJMP,	JMP BATLF
BATCR,	TAD BLFJMP	/SET NEXT CALL TO RETURN <LF>
	DCA BATGET+1
	CLA CMA		/SET TO INDICATE <CR>
	JMP BATGEX

BATLF,	DCA BATGET+1	/ZAP THE JMP TO HERE
	TAD BLF		/RETURN <LF>
BATGEJ,	JMP BATBUF

BATDO,	TAD BCRFLG	/IS THE "$" FIRST ON THIS LINE?
	SNA CLA
	JMP BATGEX	/NO - NOTHING SPECIAL
	TAD I BA7777	/YES - SET FLAG SO THAT
	RTR		/THE BATCH INPUT ROUTINE
	STL RTL		/WILL PUT THE DOLLAR-SIGN BACK
	DCA I BA7777
			/RETURN CURRENT CHARACTER AGAIN
BATEOF,	TAD BATCTZ	/RETURN CTRL-Z THIS TIME
	DCA BATCHR
	DCA BATXIT-1	/SET HANDLER TO RETURN TO ERROR RETURN
	TAD BATGEJ	/SET BATGET TO RETURN ZEROES
	DCA BATCAL
	JMP BATCR+2	/AND FLAG NEW LINE FOR NEXT CALL

BATINN,	BATIN		/ENTRY ADDRESS OF BATCH INPUT ROUTINE
BATVFY,	BATIN+200
BLF,	212
BMCR,	-215
BCRMLF,	215-212
BLFMDO,	212-"$
BCRFLG,	-1
BATCTZ,	32		/CTRL-Z

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

