Trailing-Edge
-
PDP-10 Archives
-
decuslib10-07
-
43,50446/getbyt.f4
There are no other files named getbyt.f4 in the archive.
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