program tobin c c c Authors: E.F.Beadel, Jr., Manager c C.A.U.S.E. Instructional Computer Center c SUNY at Oswego c Oswego, NY 13126 c phone: 315/341-3055 c c and c c T.J.Weslowski, Instructor c Computer Science Department c SUNY at Oswego c Oswego, NY 13126 c c Date: 10-aug-83 c c************************************************************ c************************************************************ c c This is the sister program of "TOHEX". This program c reconstructs a disk file from the information contained c in an ascii hex file generated by the program "TOHEX". c c It must be linked with the macro-11 file "UNHEX" as follows: c c FORTRAN TOBIN c MACRO UNHEX c LINK TOBIN,UNHEX c RUN TOBIN c c integer dada(256),norec integer cptr,nrec,lnctr,lnq byte line(64),unhex,char(512) equivalence (char(1),dada(1)) c c type *,'Enter input filename' type * call assign(50,'',-1,'RDO') type *,'How many blocks long is the output file to be?' accept *,norec type *,'Enter output filename' type * c c call assign(51,'',-1,'NEW') define file 51 (norec,256,U,nrec) c c lnctr=1 ! init line counter nrec=1 ! init block counter cptr=1 ! Init character pointer. c c c 500 read(50,52,end=1000)lnq,line ! fetch a line 52 format(i4,':',64a1) if(lnq .ne. lnctr) stop 'Line count error' d type 52,lnq,line lnctr=lnctr+1 ! Update line counter. c c do 11 j=1,64,2 ! process the line char(cptr)=unhex(line(j),line(j+1)) cptr=cptr+1 11 continue c c d type*,'CPTR=',CPTR c c if(cptr .ne. 513) goto 500! Get another line if buffer not full write(51'nrec)dada ! Dump the buffer cptr=1 ! Reset character pointer. goto 500 ! Process another block c c 1000 close (unit=50) close (unit=51) stop 'Program terminated normally.' end