	SUBROUTINE GTBLK6(BLOCK, COUNT)

C  THIS SUBROUTINE RETRIEVES A BLOCK FROM DISK
C  AND BUFFERS IT. IF THERE IS A CHECKSUM ERROR
C  FROM DISK OR THE BLOCK IS TOO BIG THE PROGRAM
C  WRITES THE APPROPRIATE ERROR MESSAGE IN THE
C  LOG FILE AND THEN STOPS

C  SUBROUTINE GETBYT RETURNS THE NEXT
C  EIGHT BIT BYTE FROM DSK

	IMPLICIT INTEGER (A - Z)
	INTEGER BLOCK(2000)
	DATA LOG, POINT /21, 0/

1	FORMAT(' %FILLER BYTE EXPECTED, BUT ',O3,' OBTAINED')
2	FORMAT(' BYTE COUNT = ',I5,'(10) LOAD ADDRESS = ',O6)
3	FORMAT(' ? CHECKSUM ERROR FROM DSK. SUM = ',O3)
4	FORMAT(' ? BLOCK TOO LARGE, COUNT = ',I5)

10	BYTE = GETBYT(CSUM)
	IF(BYTE .NE. 1) GO TO 10
	BLOCK(1) = 1

	CSUM = 1
	BYTE = GETBYT(CSUM)
	IF(BYTE .EQ. 0) GO TO 20
	WRITE(LOG, 1) BYTE
	GO TO 10
20	BLOCK(2) = 0

	BYTEL = GETBYT(CSUM)
	BLOCK(3) = BYTEL
	BYTEH = GETBYT(CSUM)
	BLOCK(4) = BYTEH
	COUNT = BYTEH * 2 ** 8 + BYTEL
	IF(COUNT .LT. 2000) GO TO 30
	WRITE(LOG, 4) COUNT
	CLOSE(UNIT=LOG)
	STOP

30	BYTEL = GETBYT(CSUM)
	BLOCK(5) = BYTEL
	BYTEH = GETBYT(CSUM)
	BLOCK(6) = BYTEH
	LOADDR = BYTEH * 2 ** 8 + BYTEL
	WRITE(LOG, 2) COUNT, LOADDR
	CT = COUNT - 6
	IF(CT .EQ. 0) GO TO 50

	DO 40 POINT = 7, CT + 6
		BLOCK(POINT) = GETBYT(CSUM)
40	CONTINUE
50	BLOCK(COUNT + 1) = GETBYT(CSUM)
	CSUM = CSUM .AND. "377

C  WAS THERE A CHECKSUM ERROR ?

	IF(CSUM .EQ. 0) RETURN
	WRITE(LOG, 3) CSUM
	CLOSE(UNIT=LOG)
	STOP
	END

