Add README.md
[pdp8.git] / sw / src / adventure / IO.FT
1 SUBROUTINE IO(RECORD)
2 C
3 C
4 C This function reads the direct access file and unpacks it.
5 C we put 6 13-character records into a single direct access record
6 C because OS/8 FORTRAN puts every record into a single block.
7 C Packing this saves one-sixth the space.
8 C
9 COMMON /TXTCOM/ RTEXT,LINES,ASCVAR,TXTLOC,DATA
10 INTEGER RTEXT(205),LINES(12),DATA(78),RECORD
11 INTEGER OLDREC,TXTLOC
12 C COMMON /RECMEM/OLDREC
13 DATA OLDREC/-1/
14
15 C WRITE (1,111) RECORD
16 IREC = RECORD/6 + 1
17 C WRITE (1,112) OLDREC, IREC
18 IF (IREC .NE. OLDREC)READ(8'IREC)DATA
19 OLDREC = IREC
20 N = 13 * (MOD(RECORD-1,6)) + 1
21 TXTLOC = DATA(N)
22 DO 10 I = 1, 12
23 10 LINES(I) = DATA(N+I)
24 RETURN
25 C111 FORMAT(' IO FOR ', I15)
26 C112 FORMAT(' IO, OLD=', I15, ' NEW=',I15)
27 END