C
C COPYRIGHT (C) 1975
C DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
C
C THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
C ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
C THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
C SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
C VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
C EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
C THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
C SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
C
C THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
C WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
C MITMENT BY DIGITAL EQUIPMENT CORPORATION.
C
C DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
C OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY
C DEC.
C
C
C EDIT #1	M. HEBENSTREIT		12/15/75
C
C PROGRAM TO READ CODE FILE CALLED 'CODE SRC' ON
C DAT SLOT 1 AND FROM ANSWERS, GENERTATE A BATCH
C JOB FILE CALLED 'RSX BAT' ON DAT SLOT 2.
C
C DAT SLOTS 1 AND 2 SHOULD BE ASSIGNED TO DISK
C DAT SLOTS 12(8) AND 13(8) TO A TTY.
C
	INTEGER LABEL,MODE,JUMP,FILE,FLAG,ANSWER,IFLAG(99),TARGET
	REAL TEXT(12),RSX(2),CODE(2)
	COMMON LABEL,MODE,JUMP,FILE,FLAG,TEXT,IFLAG
	DATA CODE,RSX/'CODE ',' SRC ','RSX  ',' BAT '/
	DATA BLANK/5H     /
	CALL SEEK(1,CODE)
	CALL ENTER(2,RSX)
10	FORMAT(1X,12A5)
110	FORMAT(1X,'ERROR - UNSATISFIED JUMP TO ',I3)
101	FORMAT(I3,1X,I2,1X,I3,1X,I6,1X,I2,1X,12A5)
201	FORMAT(12A5,20X)
	CALL SYSDEV(IFLAG(99))
1001	READ(1,101)LABEL,MODE,JUMP,FILE,FLAG,TEXT
20	GOTO(1,2,3,4,5,6,7,8,9,90,91,92,93,94,2001),MODE
30	TARGET=JUMP
3001	READ(1,101,END=4001)LABEL,MODE,JUMP,FILE,FLAG,TEXT
	IF(LABEL.EQ.TARGET)GOTO 20
	GOTO 3001
1	CONTINUE
C	OUTPUT TEXT TO TTY
	CALL TTOUT(TEXT,12)
	GOTO 1001
2	CONTINUE
C	Y/N ROUTINE (YES PROCEED/NO JUMP)
	CALL TTOUT(TEXT,12)
	CALL REPLY(ANSWER)
	GOTO(1001,30),ANSWER
3	CONTINUE
C	Y/N ROUTINE (NO PROCEED/YES JUMP)
	CALL TTOUT(TEXT,12)
	CALL REPLY(ANSWER)
	GOTO(30,1001),ANSWER
4	CONTINUE
C	OUTPUT TEXT TO FILE "FILE"
	DO 104 I=0,12
	IF(TEXT(12-I).NE.BLANK)GOTO 204
104	CONTINUE
	GOTO 304
204	IF(I.EQ.0)GOTO 304
	TEXT(13-I)[0:6]=#15
304	WRITE(FILE,201)TEXT
	GOTO 1001
5	CONTINUE
C	JUMP TO LABEL
	GOTO 30
6	CONTINUE
C	SET FLAG WITH VALUE 'FILE'
	IFLAG(FLAG)=FILE
	GOTO 1001
7	CONTINUE
C	TEST FLAG AND JUMP IF VALUE NE 'FILE'
	IF(IFLAG(FLAG).NE.FILE)GOTO 30
	GOTO 1001
8	CONTINUE
C	TEST FLAG AND JUMP IF VALUE EQ 'FILE'
	IF(IFLAG(FLAG).EQ.FILE)GOTO 30
	GOTO 1001
9	CONTINUE
C	BACK UP TO LABEL
	REWIND 1
	GOTO 30
90	CONTINUE
C	INCREMENT FLAG "FLAG" AND TEST VALUE "FILE" OUTPUT FILE "JUMP" IF EQ
	IFLAG(FLAG)=IFLAG(FLAG)+1
	IF(IFLAG(FLAG).NE.FILE)GOTO 1001
	FILE=JUMP
	GOTO 4
91	CONTINUE
C	INCREMENT FLAG "FLAG" AND TEST VALUE "FILE" JUMP TO "JUMP" IF EQ
	IFLAG(FLAG)=IFLAG(FLAG)+1
	IF(IFLAG(FLAG).EQ.FILE)GOTO 30
	GOTO 1001
92	CONTINUE
C	MODE 12 - READ A DECIMAL NO. AND STORE IN IFLAG
	CALL TTOUT(TEXT,12)
	CALL GDNUM
	GOTO 1001
93	CONTINUE
C	MODE 13 - WRITE TEXT TO FILE AND APPEND NUMBER IN IFLAG
	CALL MODE13
	GOTO 1001
94	CONTINUE
C	MODE 14 - WRITE K WORDS IN IFLAG TO FILE AS OCTAL BLOCKS
	CALL MODE14
	GOTO 1001
4001	WRITE(10,110)TARGET
2001	ENDFILE 2
	ENDFILE 1
	STOP
	END
