Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap4_198111 - decus/20-0125/getbyt.for
There is 1 other file named getbyt.for in the archive. Click here to see a list.
	INTEGER FUNCTION GETBYT(CSUM)

C  THIS FUNCTION IS USED TO RETRIEVE FOUR
C  EIGHT BIT BYTES FROM ONE THIRTY SIX
C  BIT WORD AND SUM INTO CHECKSUM
C  THIS ROUTINE RETURNS ONE BYTE FOR EACH CALL

	INTEGER CSUM, DSK, LOG, POS, WORD36, GFIELD
	DATA DSK, LOG, POS /20, 21, 0/

1	FORMAT(' ? PREMATURE END OF FILE')

	POS = MOD(POS, 4)
	IF(POS .GT. 0) GO TO 10
	READ(DSK, END = 1000) WORD36
10	POS = POS + 1
	IF(POS .EQ. 1) GETBYT = GFIELD(WORD36, 10, 8)
	IF(POS .EQ. 2) GETBYT = GFIELD(WORD36, 2, 8)
	IF(POS .EQ. 3) GETBYT = GFIELD(WORD36, 28, 8)
	IF(POS .EQ. 4) GETBYT = GFIELD(WORD36, 20, 8)
	CSUM = CSUM + GETBYT
	RETURN
1000	WRITE(LOG, 1)
	CLOSE(UNIT=LOG)
	STOP
	END