program hpbdeh c c See "hpbker.bwr" for details. c c Adapted from the FORTRAN-77 program "k11hex.ftn" originally c written by Brian Nelson 02-Mar-84 13:50:23. c c This abbreviated version of the original program can be used c ONLY for DECODE of "simple" (no checksum bytes) HEX-coded files c that are formatted with 64 characters per line, and which have a c decoded length that is exactly equal to an integral number of c RT-11 blocks. The 'checksum' verification routine in Brian's c program has been omitted. The size of the task image is about c 18 kB, and it should run on a PDP-11 under any of the RT-11 c monitors (SJ, FB, or XM), or under TSX+. However, it has been c tested in this form ONLY under TSX+. Conversion times depend on c the system and its loading: hpbker.hex, read from a hard disk, c took about 2.5 min on a lightly-loaded pdp-11/73; the same file c took about 8.5 min to convert when read from an RX-50 floppy on c a fairly busy PDP-11/23+. Conversion times for other HPB*. HEX c files are proportionately shorter. c c Roger Wallace 24-Apr-89 c c c To compile and link: FORTRAN/REC:512 HPBDEH.F77 c c LINK HPBDEH c c c byte infil(40),outfil(40) c write (5,30040) write (5,30030) write (5,30035) write (5,30000) read (5,30010) infil write (5,30020) read (5,30010) outfil infil(40) = 0 outfil(40) = 0 open (unit=1,type='OLD',name=infil,readonly, 1 carriagecontrol='LIST') open (unit=2,type='NEW',name=outfil,access='DIRECT', 1 recordsize=512/4,form='UNFORMATTED') call cretsk close (unit=1) close (unit=2) call exit c 30000 format (1x,'Input HEX file ? '$) 30010 format (64a1) 30020 format (1x,'Output DEH file ? '$) 30030 format (1x,'Program DECODES simple 64 chars/line HEX files. ') 30035 format (1x,'No checksum routine included. '//) 30040 format (1x,' '//) c end c c c c c c subroutine cretsk c implicit integer (a-z) byte buffer(512) byte lbuff(64) byte cbuff(6) byte chr integer chmap(256) data chmap /256*0/ c c WARNING: Any "illegal" HEX character, not 0-9 or A-F, will simply c be set to zero. This program will run, but he resulting decode c will be corrupted and probably not usable. Make sure you have c "clean" HEX sources! c chmap(48) = 0 chmap(49) = 1 chmap(50) = 2 chmap(51) = 3 chmap(52) = 4 chmap(53) = 5 chmap(54) = 6 chmap(55) = 7 chmap(56) = 8 chmap(57) = 9 chmap(65) = 10 chmap(66) = 11 chmap(67) = 12 chmap(68) = 13 chmap(69) = 14 chmap(70) = 15 c type *,' ' type *,' ' write (5,30040) c rnum = 1 blkidx = 1 10 continue off = 1 do 90 j = 1 , 16 read(1,30010,end=100,err=99) lbuff i = 1 do 20 k = off,off+31 buffer(k) = chr( chmap(lbuff(i))*16 + chmap(lbuff(i+1)) ) i = i + 2 20 continue off = off + 32 90 continue write(2'rnum) buffer write (5,30060) if (blkidx .eq. 78) then write (5,30070) blkidx = 0 endif rnum = rnum + 1 blkidx = blkidx + 1 go to 10 c 99 continue write (5,30070) type *,' Error reading HEX file. Decode aborted.' write (5,30070) return c 100 continue write (5,30070) type *,' Decoding completed. ' type *,' ' wrnum = rnum - 1 write (5,30050) wrnum c c Yes, it's rnum - 1. The rnum counter is incremented AFTER the c write, but before the check for 'end-of-file'. c 30010 format (64a1) 30040 format (1x,'Now starting to decode the HEX file ....'//) 30050 format (1x,' Number of RT-11 blocks written: 'I6///) 30060 format (1h+,'*'$) 30070 format (1x,' '/) c return end c c c c c c byte function chr(i) c integer i byte b(2) integer ch equivalence (b(1),ch) ch = i chr = b(1) return end