/8	DUMP LPT HANDLER FOR OS/8
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1977 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.
/
/
/
/
/
/
/
/
/
/

/	DEC-S8-UCASA-A-LA

/	COPYRIGHT 1972

/	DIGITAL EQUIPMENT CORPORATION

/	MAYNARD MASSACHUSETTS   01754

/	MOUTH/DORP

	IFNDEF CODE <CODE=0>

	KCLR=CODE^10+6700	/CLEAR ALL
	KSDR=CODE^10+6701	/SKIP ON DATA FLAG
	KSEN=CODE^10+6702	/SKIP ON ERROR
	KSBF=CODE^10+6703	/SKIP ON READY FLAG
	KLSA=CODE^10+6704	/LOAD STATUS A
	KSAF=CODE^10+6705	/SKIP ON ANY FLAG OR ERROR
	KGOA=CODE^10+6706	/ASSERT CONTENTS OF STATUS A AND XFER
	KRSB=CODE^10+6707	/READ STATUS B

	BSW=7002	/BYTE SWAP	[8/E,F ONLY]

/REWIND=10
/BACKFIL=30
/WRGAP=40
/BACKBLOCK=50
/SKPFIL=70

/SPECIAL CODES

/	0	WRITE EOF
/	1	REWIND
/	2	BACKBLOCK
/	3	SKIPFILE/BACKFILE

/	4-7	UNUSED (TAKES LOW ORDER 2 BITS ONLY CURRENTLY)

/	EDIT HISTORY:

/	1976		S.R.	ORIGINALLY WRITTEN
/	19-MAR-77	S.R.	FIXED BUG WITH BUFFER ENDING AT 7777

	*0

	-1
	DEVICE DUMP;DEVICE DUMP;1360;DUMP&177+4000;ZBLOCK 2

	DMPVER="C&77
	*200

LINK,	0		/POINTS TO 'LINC' ON NEXT PAGE
	TAD I DUMP	/GET FUNCTION CONTROL WORD
	DCA FNWD
	ISZ DUMP	/POINT TO BUFFER STARTING ADDRESS
	TAD I DUMP	/GET BUFFER STARTING ADDRESS
	DCA BUFFER
	ISZ DUMP	/POINT TO STARTING BLOCK #
	TAD I DUMP	/GET STARTING BLOCK NUMBER
	DCA BLOCK	/SAVE IT IN 'BLOCK'
	ISZ DUMP	/POINT TO  USER'S ERROR RETURN
	RDF
	TAD KCIDF	/FOR 'CIF CDF' TO USER'S FIELD
	DCA DMPRET	/NEED IT TO RETURN TO HIM LATER
	TAD FNWD	/LOOK AT FUNCTION WORD
	SMA		/BIT 0 IS READ/WRITE BIT
	JMP ERRET	/TAKE FATAL ERROR IF GUY TRIED TO
			/READ FROM 'DUMP'
	AND L3700
	CLL RTR
	SNA
	JMP CLOSE	/0 PAGES MEANS PERFORM CLOSE
			/OPERATION, GO AWAY
	CIA		/STORE AWAY NEGATIVE OF
			/NUMBER OF LINES TO DUMP
	DCA KNT
	TAD FNWD	/LOOK SOME MORE AT ALL-IMPORTANT
			/FUNCTION WORD
L374,	AND L70		/ISOLATE FIELD OF BUFFER
	TAD KCDF	/FORM 'CDF' TO FLD OF BUFFER
	DCA .+1		/STORE IT IN NEXT LOCATION
FNWD,
BPTR,	HLT		/CHANGE DATA FIELD TO FLD OF BUFFER
B,	TAD M40
	DCA RKNT
	JMS I LINK
	TAD LOW-200
	CIA CLL
	TAD BLOCK
	SZL CLA
	TAD KLLS
	JMS I LINK
	DCA LPUT+1-200
	TAD BLOCK
	JMS I LINK
	JMP BLK-200
	JMS I LINK
	JMP CRLF-200
A,	JMS INIT
	TAD RKNT
	TAD L40		/MUST BE REAL 40
	JMS I LINK
	JMS PRINT-200
	TAD KSLASH
	JMS I LINK
	JMP SPACE-200
C,	TAD I BPTR	/GET WORD FROM BUFFER
	JMS I LINK
	JMS PRINT-200	/PRINT IT IN OCTAL ON LIST DEVICE
	ISZ BPTR	/POINT TO NEXT WORD IN BUFFER
	NOP		/V3D
	ISZ CKNT	/DONE WITH THIS ROW?
	JMP C		/NO, GO PRINT NEXT WORD
	JMS I LINK
	JMP SPACE-200
	JMS INIT
D,	TAD I BPTR
	RTR
	RTR
	RTR
	JMS I LINK
	JMP PUT6-200
	TAD I BPTR
	JMS I LINK
	JMP PUT6-200
	ISZ BPTR	/POINT TO NEXT WORD IN BUFFER
	NOP		/V3D
	ISZ CKNT	/DONE WITH THIS ROW?
	JMP D		/NO, GO ON TO NEXT WORD
	JMS I LINK
	JMP SPACE-200
	JMS INIT
E,	TAD I BUFFER	/GET WORD 1 OF PAIR
	JMS I LINK
	JMP PUTSAV-200	/PUT OUT THE CHAR AND SAVE THE WORD
	ISZ BUFFER	/POINT TO WORD 2 OF PAIR
	TAD I BUFFER	/GET WORD 2 OF PAIR
	JMS I LINK
	JMP PUTSAV-200
	ISZ BUFFER	/POINT TO BEGIN OF NEXT PAIR
	JMS I LINK
	JMP THIRD-200	/PRINT THIRD CHAR FROM
			/REMEMBRANCES OF LAST TWO
	ISZ CKNT
	ISZ CKNT	/DONE WITH THIS ROW?
	JMP E		/NO, GO ON TO NEXT PAIR
	JMS I LINK	/YES
	JMP CRLF-200	/PRINT CARRIAGE RETURN/LINE FEED
	ISZ KNT		/DONE WITH BUFFER YET?
	SKP		/NO
	JMP OKRET	/YES
	ISZ RKNT	/DONE WITH LAST ROW OF PAGE?
	JMP A		/NO, GO ON TO NEXT ROW IN SAME PAGE
	ISZ BLOCK	/BUMP BLOCK NUMBER BY 1
	JMP B		/GO DUMP THE NEXT PAGE
CLOSE,	STA		/-1 CHANGES CR TO FORM FEED
	JMS I LINK
	JMP CRLF-200
OKRET,	ISZ DUMP	/POINT TO NORMAL RETURN
M40,	SMA SZA CLA	/AC 0 SO ALWAYS SKIPS
ERRET,	STL CLA RAR	/FATAL ERROR HAS AC NEGATIVE
DMPRET,	HLT		/PERFORM 'CIF CDF' TO USER'S FIELD
	JMP I DUMP	/RETURN

INIT,	0
	TAD M10
	DCA CKNT
	TAD BUFFER
	DCA BPTR
	JMP I INIT

KSLASH,	57-40
KCIDF,	CIF CDF 0
KCDF,	CDF 0
M10,	-10
L40,	40		/MUST BE REAL 40
L3700,	3700
BUFFER,	0
RKNT,	0		/ROW COUNT
CKNT,	0		/COLUMN COUNT
BLOCK,	0		/CURRENT BLOCK NUMBER
KLLS,	LLS
	IFZERO .-375&4000 <ERROR>
	*374
L70,	70		/MUST BE AT REL LOC 174
KNT,	0		/- NUMBER OF PAGES LEFT TO DUMP
	IFNZRO L70-374 <ERROR>
DUMP,	DMPVER
	JMS LINK	/GET ADDRESS OF NEXT PAGE INTO LINK
	IFNZRO .-400 <ERROR>
	PAGE
	LSF=6661	/SLIP ON LPT FLAG
	LLS=6666	/LOAD LPT BUFFER

	IFDEF	DMPTTY	<
	LSF=TSF
	LLS=TLS
	>

LINC,	0
	DCA ARG
	RDF
	TAD HCDF
TTY12,	DCA TEMP
HCDF,	CDF 0
	TAD I LINC
	DCA DOIT
	ISZ LINC
L77,	77
TEMP,	0
	TAD ARG
CNT,
DOIT,	HLT
POP,	JMP I LINC	/RETURN
L177,	177
	IFNZRO  POP&177-15 <ERROR> /MUST BE AT 15 IN PG
	IFNZRO DOIT&177-14 <ERROR>
	IFNZRO TEMP&177-12 <ERROR>

THIRD,	TAD SAVE
	DCA ARG
	TAD ARG
PUTSAV,	AND L7600
	CLL RAL
	TAD SAVE
	RTL
	RTL
	AND L177
	DCA SAVE
	TAD ARG
	AND L177	/FORCE 7-BIT
	TAD M140	/DO RANGE CHECK
	CLL
	TAD (100	/FOR BETWEEN 40 AND 137
	SNL		/SKIP ON SUCCESS
TTY40,
M140,	SZA CLA		/NEVER SKIPS
PUTSPC,	TAD TTY40	/RESTORE CHAR OR BLANK
PUTPOP,	JMS LPUT
TTY215,	JMP POP
LPUT,	0
	NOP		/THIS MAY BE AN 'LLS' OR 0
L7600,	7600		/CLA
KBD,	KSF
	JMP CHECKL
	TAD L7600
	KRS
	TAD (-7603
	SNA CLA
	JMP CTRLC
	KRB
	TLS
	AND L177
	TAD (-15
	SNA
	JMP CR
	TAD (15-70
	CLL
	TAD (10
	DCA TEMP
	SNL
	JMP NOT		/NOT A DIGIT
	TAD NUM
	CLL RAL
	CLL RAL
	CLL RAL
	TAD TEMP
	DCA NUM
	JMP CHECKL
CTRLC,	CIF CDF 0
	JMP I L7600
CR,	TAD NUM
	DCA LOW
	TAD (12-77
NOT,	TAD L77
	TSF
	JMP .-1
XTRA,	TLS
	CLA
	DCA NUM
CHECKL,	LSF
	JMP KBD
	JMP I LPUT	/YES, RETURN
NUM,	0
LOW,	0
PUT6,	TAD TTY40
	AND L77
	JMP PUTSPC

PRINT,	0
	DCA ARG
	TAD TTY40
	JMS LPUT
	TAD (-4
	DCA CNT
PRLUP,	TAD ARG
	AND L7600
	CLL RTL
	TAD L214	/14 SHIFTS TO 60 
			/AND L214 HAS AC0 = 0
	RTL
	JMS LPUT
	TAD ARG
	RTL
	RAL
	DCA ARG
	ISZ CNT		/BUG IF TRY TO USE AS L214
	JMP PRLUP
	JMP I PRINT
L214,	214		/COULD BE 'AND CNT'

SAVE,	0		/MUST BE DEDICATED.  USED AS SHIFT
			/REG AND MUST BE ALMOST 0 ON ENTRY
ARG,	0

SPACE,	TAD TTY40
	JMS LPUT
	JMP PUTSPC

BLK,	SNA CLA
	DCA LOW		/BLOCK 0 INITIALIZATION
	TAD L214	/FORM FEED
	JMS LPUT
	TAD ARG
	JMS PRINT
/	TAD (-10
/	DCA TEMP
/	TAD TTY3
/	JMS SPACE
/LUP,	TAD TEMP
/	TAD (10		/MUST BE REAL 10
/	JMS PRINT
/	ISZ TEMP
/	JMP LUP
CRLF,	TAD TTY215
	JMS LPUT
	TAD TTY12
	JMP PUTPOP
	PAGE

