100 DEFINT A-Z
110 CLS : CLOSE
120 PRINT "Hex File Display Program"
130 INPUT "Enter file name: ", FILENAME$
140 OPEN "R",#1,FILENAME$,128
150 FIELD #1,128 AS RECORD$
160 PRINT "Dumping "+FILENAME$+" . . ."
170 OPEN "lpt1:" FOR OUTPUT AS #2
180 PRINT #2, "Dumping "+FILENAME$+" . . ."
190 PRINT #2,""
200 OFFSET = 0
210 RECORDOUT$ = ""
220 RECORDOUT1$ = ""
230 '
240   GET #1
250   PRINT #2, ""
260   IF EOF(1) THEN 410
270   FOR I=1 TO LEN(RECORD$)
280     CHAR = ASC(MID$(RECORD$,I,1))
290     CHAR$ = HEX$(CHAR)
300     IF LEN(CHAR$)=1 THEN CHAR$="0"+CHAR$
310     RECORDOUT$=RECORDOUT$+CHAR$
320     CHARPRT$ = "."
330     IF CHAR < 32 THEN 360
340     IF CHAR >= 127 THEN 360
350     CHARPRT$ = CHR$(CHAR)
360     RECORDOUT1$ = RECORDOUT1$ + CHARPRT$
370     IF LEN(RECORDOUT$) >= 32 THEN GOSUB 460
380   NEXT I
390   GOTO 240
400 '
410 GOSUB 460
420 CLOSE
430 PRINT "File Display Program Ended"
440 STOP
450 '
460 RECLEN = LEN(RECORDOUT$)
470 IF RECLEN = 0 THEN 600
480 OFFSET$="    "+HEX$(OFFSET)
490 OFFSET$=MID$(OFFSET$,LEN(OFFSET$)-4,5)
500 PRINT #2,OFFSET$+":  ";
510 J=1
520   IF RECLEN-J < 8 THEN 560
530   PRINT #2,MID$(RECORDOUT$,J,8)+" ";
540   J = J + 8
550   GOTO 520
560 PRINT #2,MID$(RECORDOUT$,J) + "  *" + RECORDOUT1$ + "*"
570 OFFSET = OFFSET + RECLEN/2
580 RECORDOUT$ = ""
590 RECORDOUT1$ = ""
600 RETURN
610 '
620 END