Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50262/mtio.mac
There are 2 other files named mtio.mac in the archive. Click here to see a list.
;	The following conditional assembly features are
;available in the MTIO package.
;
;	The default mode--IBM vs. DEC
;
;	Whether data is reconverted to PDP-10 form after it
;	has been written out in IBM mode (INTEGER and REAL  
;	numbers only)
;
;
;	At assembly time, MODE should be set to 0 if
;IBM is desired as a default mode and should be set
;to something other than 0 if DEC mode is desired 
;as the default.  The default value for MODE is 0.
;
;
;	The following applies only to the subroutine MTWRIT,
;it has no bearing on any other routine.
;	At assembly time, PROCES should be set to 0 if reconversion
;of data is desired.  The data must be reconverted if it is
;to be used after the call to this routine.  If it is not reconverted
;what comes back in the array will be garbage to the FORTRAN
;program.  If PROCES is non-zero, the data will not be
;reconverted--this is faster and will require slightly less core.
;PROCES==0 is the default value for this parameter.
;
;	The parameters may be set in two ways: by changing the
; source file or at assembly time.  To set MODE equal to 0, the line
;		MODE==0
;should be inserted at the beginning of the MACRO source file.
;Alternatively, the parameters may be set when 
;running the MACRO assembler, for example:
;
;R MACRO
;*T:FILE_TTY:,T:FILE
;MODE==1
;PROCES==1
;
;END OF PASS ONE
;MODE==1
;PROCESS==1
;
;
;Where T is the users Dectape (or disc).
;
	IFNDEF MODE,<MODE==0>
	IFNDEF PROCES,<PROCES==0>
	TITLE MTIO
	ENTRY MTREAD
	ENTRY MTSKIP
	ENTRY MTINIT
	MLON
;GENERAL SUBROUTINE TO READ UNFORMATTED NUMERICAL DATA 
;WRITTEN BY AN IBM 360 COMPUTER ON A MAGNETIC TAPE
;
;FORTRAN CALLING SEQUENCE:

;	CALL READ(ARRAY,SIZE,IERR)
;
;	ARRAY-IS THE ARRAY WHERE THE DATA IS TO BE STORED
;	SIZE-IS THE SIZE OF TE ARRAY
;	IERR-CAN HAVE THE FOLLOWING VALUES
;		0-NO ERROR 
;		1-MT INPUT ERROR
;		2-MT END OF FILE. NO DATA READ
;		3-MT END OF TAPE. NO DATA READ
;
;	ARRAY MAY EITHER BE DECLARED REAL,INTEGER OR LOGICAL
;	IN THE FORTRAN CALLING PROGRAM.  IF IT IS DECLARED
;	LOGICAL, NO CONVERSION IS MADE BETWEEN 360 AND PDP-10
;	REPRESENTATION.  IF IT IS DECLARED INTEGER, THE DATA IS
;	SHIFTED OVER 4 BITS.  IF IT IS DECLARED REAL, CONVERSION
;	IS MADE BETWEEN 360 AND PDP-10 FLOATING POINT REPRESENTATION.
;	SIZE IS THE SIZE OF THE RECORD AND THE ARRAY.  IT IS 
;	ASSUMED TO BE INTEGER. IF IT IS LESS THAN OR EQUAL TO
;	ZERO NO READING TAKES PLACE.
;
;
;	REGISTER CONVENTIONS:

	A=1	;GENERAL PURPOSE
	B=2	;GP
	C=3	;GP
	D=4	;GP
	SIZE=5	;SIZE OF ARRAY
	ADR=6	;ADDRESS OF ARRAY
	J=10	;JSP REGISTER
	Z=16	;JSA-JRA REGISTER


;CHANNEL FOR I/O
	MT==15
;SHOULD BE COMPATIBLE WITH THE DISPLAY RTNS AND HFOS SINCE
;THEY USE CHANNELS 16 AND 17
;FIRST SECTION OF CODING: PICK UP ARRAY SIZE AND ADDRESS, 
;SET UP IOWD AND READ THE DATA.  ERROR BRANCHES TO BDATA.
MTREAD:	Z			;JSA HERE 
	SETZM @2(Z)		;ZERO INDICATES NO ERROR
	SKIPG   SIZE,@1(Z)	;GET RECORD SIZE
	JRST DONE		;IF <= 0, FORGET IT
	MOVN A,SIZE		;IOWD IS  NEGATIVE IN LEFT HALF
	HRLM A,CWD		;STORE IT (SIZE CONTAINS RECORD SIZE)
	MOVE ADR,(Z)		;GET ARRAY ADDRESS
	SOS ADR			;IOWD IS ADDR.-1 IN RIGHT HALF
	HRRM ADR,CWD		;STORE IT
	MTAPE MT,0		;WAIT FOR MT TO BE FREE
	IN MT,CWD		;GET DATA
	SKIPA			;INPUT SUCCESSFUL
	JRST BDATA		;WHOOPS, INPUT ERROR
;DATA HAS BEEN READ, NOW MUST DECIDE WHAT IT WAS AND
;WHAT TO DO WITH IT.  FORTRAN LOGICAL MEANS NO PROCESSING
;REAL AND INTEGER MEAN CONVERT.
;
;ALSO--ALTERNATE ENTRY POINT FROM MTWRIT TO RECONVERT
;FROM 360 TO PDP-10 #'S.  (ONLY ON CONDITIONAL
;ASSEMBLY)
;
REPROC:	SKIPGE FLAG		;IBM OR DEC MODE?
	JRST DONE		;DEC,SUPPRESS PROCESSING
	LDB A,[POINT 4,(Z),12]	;GET ARGUMENT TYPE
	JUMPE A,INTGER		;0 IS INTEGER ARGUMENT
	CAIE  A,2		;FLOATING POINT IS 2
	JRST DONE		;IF NOT FLTG OR INTEGER ASSUME LOGICAL


;DATA IS FLOATING POINT SO MUST CONVERT EXPONENT,PICK UP
;MANTISSA AND NORMALIZE
LP1:	AOS ADR			;INCREMENT ADR OF WORD TO BE MODIFIED
	SETZ C,			;ANSWER IS STORED IN C
	SKIPGE A,(ADR)		;PICK UP THE WORD.
	TLZ A,400000		;360 FLTG PNT#'S ARE IN ABSOLUTE
				;VALUE FORM WITH ONLY THE FIRST BIT
				;COMPLEMENTED TO INDICATED MINUS.
				;THEREFORE CLEAR ONLY THAT BIT.
	LDB B,[POINT 7,A,7]	;GET EXPONENT
	SUBI B,^D64		;360 IS EXCESS 64 NOTATION
	ASH B,2			;360 EXP IS TO BASE 16,PDP10 TO
				;BASE 2,SO SCALE 
	ADDI B,^D128		;PDP-10 IS EXCESS 64
	CAIL B,^D256		;EXPONENT TOO LARGE?
	JRST OVFLW		;YES
	JUMPL B,UNFLW		;EXP TOO SMALL
	DPB B,[POINT 8,C,8]	;STORE EXPONENT
	LDB B,[POINT 24,A,31]	;GET MANTISSA
	DPB B,[POINT 24,C,32]	;STORE IT
STORE:	FADRI C,0		;ADD ZERO TO NORMALIZE
	SKIPGE (ADR)		;IF  ORIGINAL WORD WAS <0
	MOVN  C,C		;THEN NEGATE ANSWER
	MOVEM C,(ADR)		;AND STORE IT
	SOJG SIZE,LP1		;ANY WORDS LEFT?
	JRST DONE		;NO SO RETURN
;Here if data is in integer form. Just  shift right
;FOUR PLACES AND RESTORE.
INTGER:	AOS ADR			;INCREMENT ADDRESS
	MOVE A,(ADR)		;PICK UP WORD
	ASH  A,-4		;SHIFT IT
	MOVEM A,(ADR)		;RESTORE IT
	SOJG  SIZE,INTGER	;ARE WE DONE?

DONE:	JRA Z,3(Z)		;RETURN
CWD:	Z			;INPUT CWD HERE
	Z			;0 IS STOP COMMAND
UNFLW:	TLOA C,400		;UNDERFLOW-PUT SMALLEST FLTG PNT #
OVFLW:	HRLOI C,377777		;ON OVERFLOW GET LARGEST
	JRST STORE		;FLTG PT # AND RETURN IT

;INPUT ERROR BRANCHES TO HERE.  POSSIBLE CAUSES: 
;END OF FILE, END OF TAPE, AND INPUT DATA ERROR.
BDATA:	GETSTS MT,A		;GET STATUS TO SEE WHY ERROR
	MOVEI B,1		;IF NOTHING ELSE, I/O ERROR
	TRNE A,20000		;END OF FILE?
	JRST ENDFIL		;GO PROCESS IT
	TRNE A,2000		;END OF TAPE?
	MOVEI B,3		;TELL THE POOR GUY
STATUS:	TRZ A,740000		;CLEAR ANY ERROR BITS
	SETSTS MT,(A)		;AND TELL MONITOR
	MOVEM B,@2(Z)		;RETURN FLAG TO USER
	JRA Z,3(Z)		;AND GO RETURN

ENDFIL:	MOVEI B,2		;SET EOF FLAG
	CLOSE MT,		;CLOSE AND 
	JSP J,INITMT		;REOPEN TO GET RID OF EOF
	JRST STATUS		;AND GO RETURN
;SUBROUTINE TO SKIP FILES AND RECORDS ON MAGTAPE
;IN CONJUNCTION WITH ABOVE RTN.
;
;FORTRAN CALLING SEQUENCE:
;
;	CALL MTSKIP(IFILE,IREC)
;
;	IFILE-THE NUMBER OF FILES TO BE SKIPPED
;	IREC-THE NUMBER OF RECORDS TO BE SKIPPED
;
;	IFILE AND IREC ARE ASSUMED TO BE INTEGER AND
;	MAY BE EITHER POSITIVE, ZERO OR NEGATIVE.  IF THEY
;	IF POSITIVE, THE INDICATED # OF FILES AND RECORDS
;	ARE SKIPPED, IF ZERO, NONE ARE SKIPPED, AND IF NEGATIVE
;	THE INDICATED # OF FILES IS BACKSPACED.
;	FILES ARE SKIPPED BEFORE RECORDS ARE.
;
	FILE==16	;SKIP A FILE
;	FILE+1=17 IS BACKSPACE FILE
	RECORD==6	;SKIP A RECORD
;	RECORD+1=7 IS BACKSPACE RECORD

MTSKIP:	Z			;JSA HERE
	MOVEI C,FILE		;SET UP TO SKIP FILE
	MOVE A,@(Z)		;PICK UP FIRST ARGUMENT
	JUMPE A,MTSKRC		;IF =0,DON'T SKIP ANYTHNG
	CLOSE MT,		;CLOSE MT
	JSP J,EXECUT		;NE 0, GO DO IT
	JSP J,INITMT		;AND REOPEN
MTSKRC:	MOVEI C,RECORD		;SET UP TO SKIP RECORDS
	MOVE A,@1(Z)		;2ND ARG IS # RECORDS
	JSP J,EXECUT		;DO IT
	JRA Z,2(Z)		;GO DO IT

EXECUT:	SKIPGE  A		;IF A IS >0 NO MODIFICATION TO MTAPE
	AOS  C			;IF <0, ADD 1 TO MTAPE OPERATOR TO
				;INDICATE BACKSPACING
	MOVM  B,A		;#TO GO FORWARD OR BACK
EXEC1:	SOJL B,EXEC2		;SKIP SOMETHING
	MTAPE MT,(C)		;C HAS WHAT WE DO
	JRST EXEC1		;TRY AGAIN

EXEC2:	CAIE C,17		;IF WE WERE BACKSPACING FILES
				;THEN MUST CHECK POSITION
	JRST  (J)		;ALL OK,RETURN
	MTAPE MT,17		;WE WERE BACKSPACING SO
				;GO ONE MORE AND THEN SEE IF
				;WE SHOULD GO FORWARD.
	MTAPE MT,0		;WAIT UNTIL NOT BUSY
	STATO MT,4000		;AT BEGINNING OF TAPE?
	MTAPE MT,FILE		;NO,MUST SKIP OVER FILE MARK
	JRST  (J)		;RETURN
;SUBROUTINE TO INITIALIZE CHANNELS FOR I/O TO MAGTAPE AND
;POSITION THE TAPE INITIALLY.  MUST BE CALLED PRIOR TO THE
;CALL OF THE ABOVE TWO ROUTINES.
;
;FORTRAN CALLING SEQUENCE:
;
;	CALL MTINIT(FILE,REC)
;
;	FILE-POSITION TAPE JUST BEFORE THIS FILE
;	REC-POSITION TAPE JUST BEFORE THIS RECORD
;
;	FILE AND REC ARE ASSUMED TO BE INTEGER.  THEY 
;	INDICATE THE FILE THAT WILL BE READ NEXT (ASSUMING MTSKIP
;	IS NOT CALLED). CALL MTINIT(1,1) AND CALL MTINIT(0,0) ARE
;	EQUIVALENT, BOTH REWIND THE TAPE  AND SET UP TO READ THE
;	FIRST FILE, FIRST RECORD. A CALL WITH FILE LESS THAN 0
;SUPPRESSES ANY POSITINING, THE I/O CHANNEL IS SIMPLY
;INITIALIZED AND I/O BEGINS AT THE CURRENT TAPE POSITION.
;
	DUMP==17	;DUMP MODE FOR UNBUFFERED I/O

MTINIT:	Z			;JSA HERE
	IFE MODE,<SETZM FLAG>	;MODE=0 IMPLIES DEFAULT IS IBM
	IFN MODE,<SETOM FLAG>	;MODE NE 0 IMPLIES DEC IS DEFAULT
	MOVEI A,17		;INITIALLY DUMP MODE
	HRRM A,INITMT		;OTHER SUBROUTINES MAY CHANGE THIS
	JSP J,INITMT		;INITIALIZE MT
	SKIPGE A,@(Z)		;THIS IS FILE#
	JRA Z,2(Z)		;IF <0, DON'T TOUCH TAPE
	MTAPE MT,1		;OTHERWISE REWIND IT
	SOSG A			;# OF FILES TO SKIP IS
		;DESIRED POSITION - 1
	JRST SKIPRC		;BUT DON'T SKIP -1 OR 0 FILES
	MOVEI C,FILE		;WHAT TO DO
	JSP J,EXECUT		;GO DO IT
SKIPRC:	MOVE A,@1(Z)		;THIS IS RECORD POSITION
	MOVEI C,RECORD		;WHAT TO DO
	SOSLE A			;IF <= 0,DON'T DO ANYTHING
	JSP J,EXECUT		;GO DO IT
	JRA Z,2(Z)		;RETURN, ALL DONE

INITMT:	INIT MT,DUMP		;DUMP MODE FOR I/O
	SIXBIT .MTA0.		;MAG TAPE
	Z			;NO BUFFERS
	JRST UNAVIL		;INIT FAILED
	MOVE C,FLAG		;0 INDICATES IBM,-1 DEC
	ADDI C,101		;101 INDICATES IBM,100 DEC
	MTAPE MT,(C)		;SET THE STATUS
	JRST (J)		;RETURN

FLAG:	0			;-1 IS DEC,0 IS IBM MODE
UNAVIL:	OUTSTR [ASCIZ/MTIO --MTA0 unavailable
/]
	EXIT
;SUBROUTINE TO CHANGE FROM IBM MODE(STANDARD)
;TO DEC COMPATIBLE MODE.
;THE CALL IS:

;	CALL SETDEC

;THERE ARE NO ARGUMENTS.
;
	ENTRY SETDEC
SETDEC:	Z			;JSA HERE
	SETOM FLAG		;SET DEC FLAG
	MTAPE MT,100		;CHANGE STATUS TO DEC-COMPATIBLE
	JRA Z,(Z)		;RETURN


;SUBROUTINE TO CHANGE BACK TO IBM MODE FROM DEC MODE
;(AS SET BY SETDEC).
;THE CALL IS:
;
;	CALL SETDEC
;
;THERE ARE NO ARGUMENTS
;
	ENTRY SETIBM
SETIBM:	Z			;JSA HERE FROM FORTRAN
	SETZM FLAG		;0 IS IBM FLAG
	MTAPE MT,101		;CHANGE STATUS TO IBM MODE
	JRA Z,(Z)		;RETURN

;SUBROUTINE TO WRITE AN END-OF-FILE MARK ON MAGTAPE
;
;CALL:
;	CALL MTCLOS
;
;THERE ARE NO ARGUMENTS
;

	ENTRY MTCLOS
MTCLOS:	Z			;JSA HERE
	RELEAS MT,		;GET RID OF THE MT
	JRA Z,(Z)		;RETURN

;SUBROUTINE TO WRITE EOF
;
;	CALL MTEOF
;
	ENTRY MTEOF
MTEOF:	Z			;JSA HERE
	MTAPE MT,3		;WRITE AN EOF MARKER
	JRA Z,(Z)		;RETURN TO FORTRAN
;SUBROUTINE TO SET DENSITY
;
;	CALL SETDEN(IDENS)
;
;	WHERE IDENS IS AN INTEGER AND CAN HAVE THESE VALUES
;
;	IDENS =	0--SYSTEM STANDARD
;		1--200 BPI
;		2--556 BPI
;		3--800 BPI
;0 IS THE DEFAULT VALUE
;
	ENTRY SETDEN
SETDEN:	Z			;ENTERBHEREDE, THEN CAN'T SET
	JRA Z,1(Z)		;PARITY SO RETURN

	SKIPL A,@(Z)		;ARG <0?
	CAILE A,3		;NO, >3?
	SETZ A,			;YES, SO ASSUME 0
	DPB A,[POINT 2,INITMT,28]	;SET THE BITS IN INIT
	GETSTS MT,B		;GET THE OLD STATUS
	DPB A,[POINT 2,B,28]	;STORE IT
	SETSTS MT,(B)		;AND TELL THE MONITOR
	JRA Z,1(Z)		;RETURN

;SUBROUTINE TO SET PARITY
;
;	CALL SETPAR(IPAR)
;
;	WHERE IPAR - EQ	0--ODD PARITY
;		     NE 0--EVEN PARITY

	ENTRY SETPAR
SETPAR:	Z			;JSA HERE
	SKIPN FLAG		;IF INM MODE CAN7T SET DENSITY
	JRA Z,1(Z)		;SO RETURN
	SKIPN A,@(Z)		;IF ARG NE 0
	MOVEI A,1		;THEN ASSUME 1
	DPB A,[POINT 1,INITMT,26]	;STORE IT AT THE INIT
	GETSTS MT,B		;GET STATUS
	SKIPG A			;EVEN OR ODD?
	TRZA B,1B26		;ODD, SO ZERO AND SKIP
	TRO B,1B26		;EVEN, SO SET IT
	SETSTS MT,(B)		;RETURN THE VALUE
	JRA Z,1(Z)		;RETURN

;SUBROUTINE TO WAIT FOR MAGTAPE TO STOP SPINNING
;
;	CALL MTWAIT
;
	ENTRY MTWAIT
MTWAIT:	Z
	MTAPE	MT,0			;WAIT FOR MT
	JRA	Z,(Z)			;RETURN
;
;SUBROUTINE TO WRITE OUT ONE RECORD ON MAGNETIC TAPE.
;MTINIT MUST HAVE BEEN CALLED PRIOR TO THIS TO 
;INITIALIZE THE I/O CHANNEL.  THE CALL IS:
;
;	CALL MTWRIT(ARRAY,SIZE,IERR)
;
;	ARRAY-IS THE ARRAY WHERE THE DATA IS STORED
;	SIZE-IS THE SIZE OF THE ARRAY (AND THE RECORD)
;	IERR-HAS THE SAME VALUES AS MTREAD
;
;THE APPROPRIATE TRANSFORMATION IS MADE FROM PDP-10 TO 360
;REPRESENTATION OF FIXED AND FLOATING POINT NUMBERS.
;******THE DATA IS DESTROYED WHEN IT IS PUT ON MAGNETIC TAPE*******
;(EXCEPT IN THE CASE OF LOGICAL DATA WHERE NO CHANGE IS MADE)
;

;SPECIAL REGISTERS USED BY THIS ROUTINE
	EXP=7	;HOLDS EXPONENT OF FLTG POINT #
	FRAC=11	;HOLDS FRACTION

	ENTRY MTWRIT
MTWRIT:	Z			;JSA HERE
	SETZM @2(Z)		;INITIALLY NO ERRORS DETECTED
	MOVN SIZE,@1(Z)		;SECOND ARG IS ARRAY SIZE
	JUMPGE SIZE,DONE	;IF WAS <= 0,DON'T WRITE RECORD
	HRLM SIZE,CWD		;IOWD IS - IN LEFT HALF
	MOVE ADR,(Z)		;GET ADDRESS OF ARRAY
	HRRM ADR,CWD		;STORE IT AT CWD
	SOS CWD			;ADDRESS IS ADDRESS - 1
	SKIPGE FLAG		;IF IN IBM MODE, OK
	JRST WRITE		;IF NOT, DON'T DO ANY CONVERSION
	LDB A,[POINT 4,(Z),12]	;GET PNTR TO ARGUMENT TYPE
;
;IOWD HAS BEEN SET UP.  MUST DETERMINE WHAT KIND OF ARGUMENT
;AND PROCESS ACCORDINGLY.
;
	JUMPE A,INTCON		;0 IS INTEGER ARGUMENT
	CAIE A,2		;2 IS FLTG POINT
	JRST WRITE		;EVERYTHING ELSE ASSUMED LOGICAL
;
;FLOATING POINT CONVERSION.  DATA IS DESTROYED.
;
FLTGLP:	MOVM A,(ADR)		;GET A DATA WORD
	SETZ C,			;RESULT WILL GO HERE
	LDB EXP,[POINT 8,A,8]	;REGISTER 8 HAS EXPONENT
	SUBI EXP,^D128		;EXPONENT WAS IN EXCESS 128
	LDB FRAC,[POINT 24,A,32];THIS IS THE FRACTION
;
;HAVE EXPONENT AND FRACTION, MUST 'DE-NORMALIZE' NUMBER
;TO 360 STANDARDS.  WANT EXPONENT EVEN MULTIPLE OF 4
;SINCE 360 IS BASE 16. (2**4=16).  SO SHIFT FRACTION RIGHT 
;ONE BIT (= DIVIDE BY TWO), AND INCREMENT EXPONENT BY 1
;(= MULTUPLY BY TWO). CONTINUE UNTIL EXPONENT MULTIPLE
;OF 4.
;
NORMLP:	TRNN EXP,3		;ARE LOW ORDER 2 BITS OF
				;EXPONENT ZERO
	JRST NORMAL		;YES, SUCCESSFULLY DENORMALIZED
	LSH FRAC,-1		;SHIFT FRACTION (= DIVIDE BY 2)
	AOJA EXP,NORMLP		;ADD ONE TO EXPONENT, TRY AGAIN

;
;THE NUMBER HAS BEEN NORMALIZED TO THE 360'S POINT OF VIEW
;
NORMAL:	LSH EXP,-2		;CONVERT EXPONENT TO BASE OF 16
	ADDI EXP,^D64		;360 IS EXCESS 64 NOTATION
	DPB EXP,[POINT 7,C,7]	;STORE CALCULATED EXPONENT
	DPB FRAC,[POINT 24,C,31];AND CALCULATED FRACTION
	SKIPGE (ADR)		;IF ORIGINAL # WAS <=0
	TLO C,400000		;THEN MUST SET 360 SIGN BIT
	MOVEM C,(ADR)		;STORE THIS NUMBER
	AOS ADR			;INCREMENT ADDRESS
	AOJL SIZE,FLTGLP	;SEE IF ANOTHER # IS TO BE CONVERTED
	JRST WRITE1		;ALL DONE, WRITE THE BUFFER
;
;INTEGER CONVERSION BRANCHES HERE.  ALL THAT MUST BE DONE
;IS SHIFT THE DATA OVER 4 BITS.
;
INTCON:	MOVE A,(ADR)		;GET THE NUMBER
	ASH A,4			;SHIFT IT OVER SO 360 WILL GET
				;FIRST 32 BBITS
	MOVEM A,(ADR)		;STORE IT
	AOS ADR			;INCREMENT ADDRESS
	AOJL SIZE,INTCON	;ANY MORE #'S?

;
;ANY CONVERSION THAT NEEDS TO BE MADE HAS BEEN DONE.
;NOW JUST WRITE THE DATA ON THE TAPE AND RETURN TO THE USER.
;
WRITE1:
	IFE PROCES,<MOVE SIZE,@1(Z)	;IF RECONVERTING DATA, GET
	HRRZ ADR,(Z)		;START ADR AND SIZE
	SOS ADR>		;WANT ADDR-1
WRITE:	MTAPE MT,0		;WAIT FOR THE MTAPE TO BE DONE
	OUT MT,CWD		;OUTPUT THE BLOCK
WRET:				;HERE IF DATA WRITTEN
	IFN PROCES,<JRA Z,2(Z)	;NOT PROCESSING DATA SO RETURN
	JRST BDATA>		;AN ERROR, FIND WHAT
	IFE PROCES,<JRST REPROC	;PROCESSING DATA SO DO IT
	GETSTS MT,A		;SOME ERROR-FIND WHAT
	MOVEI B,1		;ASSUME I/O ERROR
	TRNE A,2000		;END OF TAPE?
	MOVEI B,3		;YES
	TRZ A,740000		;CLEAR ANY ERROR BITS
	MOVEM B,@2(Z)		;TELL THE GUY
	SETSTS MT,(A)		;TELL THE MONITOR
	JRST REPROC>		;AND DEPROCESS DATA.


	END