DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦70d9ae374⟧ TextFile

    Length: 2176 (0x880)
    Types: TextFile
    Names: »HEXDUMP.PAS«

Derivation

└─⟦1a1ae220f⟧ Bits:30004190 COMPAS Pascal v.2.2
    └─ ⟦this⟧ »HEXDUMP.PAS« 
└─⟦693a7a378⟧ Bits:30003305 COMPAS, RcTekst, RcKalk, RCComal80 til RC703
    └─ ⟦this⟧ »HEXDUMP.PAS« 
└─⟦6bdda2365⟧ Bits:30005253 COMPAS Pascal v2.21 til CR7
    └─ ⟦this⟧ »HEXDUMP.PAS« 
└─⟦7e35b155b⟧ Bits:30005838 CP/M 58K v. 2.2 med COMPAS Pascal 2.13DK (RC700)
    └─ ⟦this⟧ »HEXDUMP.PAS« 
└─⟦856c4d8a3⟧ Bits:30003073 SW1729 COMPAS Pascal v2.20 installationsdiskette til Piccolo
    └─ ⟦this⟧ »HEXDUMP.PAS« 
└─⟦f5abb7d57⟧ Bits:30005754 SW1329/D8 COMPAS Pascal v2.20 (RC703)
    └─ ⟦this⟧ »HEXDUMP.PAS« 

TextFile

PROGRAM HEXDUMP; æ$A+,R-,S+å

æ This program will output a hex dump af any disk file. Each	å
æ line shows the address of the first byte of the line, then	å
æ 16 bytes in hex, and then the same bytes in ASCII, if they	å
æ are printable. On running the program, you must specify the	å
æ name of the disk file to be dumped, and the name of the disk	å
æ file or logical device (CON:, LST:, etc.), which is to reci-	å
æ eve the dump. The dump can be halted temporarily by pressing	å
æ any key, or aborted using ^C.					å

LABEL BREAK,EXIT;

TYPE
  SECTOR = ARRAYÆ0..7,0..15Å OF BYTE;
  HEXSTRING = STRINGÆ4Å;
  FILENAME = STRINGÆ14Å;

VAR
  ADDRESS,L,P,I,J: INTEGER;
  CH: CHAR;
  INNAME,OUTNAME: FILENAME;
  BUFFER: SECTOR;
  INFILE: FILE;
  OUTFILE: TEXT;

FUNCTION HEX(NUMBER,DIGITS: INTEGER): HEXSTRING;
CONST
  HEXDIGIT: ARRAYÆ0..15Å OF CHAR = '0123456789ABCDEF';
VAR
  D: INTEGER;
  H: HEXSTRING;
BEGIN
  HÆ0Å:=CHR(DIGITS);
  FOR D:=DIGITS DOWNTO 1 DO
  BEGIN
    HÆDÅ:=HEXDIGITÆNUMBER AND 15Å;
    NUMBER:=NUMBER SHR 4;
  END;
  HEX:=H;
END;

BEGIN
  WRITE('Input file name? '); READLN(INNAME);
  IF INNAME='' THEN GOTO EXIT;
  WRITE('Output file name? '); READLN(OUTNAME);
  IF OUTNAME='' THEN GOTO EXIT;
  ASSIGN(INFILE,INNAME); æ$I-å RESET(INFILE) æ$I+å;
  IF IORES>0 THEN
  BEGIN
    WRITELN(INNAME,' does not exist'); GOTO EXIT;
  END;
  ASSIGN(OUTFILE,OUTNAME); REWRITE(OUTFILE);
  ADDRESS:=0;
  WHILE NOT EOF(INFILE) DO
  BEGIN
    BLOCKREAD(INFILE,BUFFER,1);
    FOR L:=0 TO 7 DO
    BEGIN
      WRITE(OUTFILE,HEX(ADDRESS,4),' ');
      FOR P:=0 TO 15 DO
      BEGIN
	IF P=8 THEN WRITE(OUTFILE,' ');
	WRITE(OUTFILE,HEX(BUFFERÆL,PÅ,2):3);
      END;
      WRITE(OUTFILE,'  ');
      FOR P:=0 TO 15 DO
      BEGIN
	CH:=CHR(BUFFERÆL,PÅ);
	IF (CH>=@32) AND (CH<=@126) THEN
	WRITE(OUTFILE,CH) ELSE WRITE(OUTFILE,'.');
      END;
      WRITELN(OUTFILE);
      ADDRESS:=ADDRESS+16;
      IF KEYPRESS THEN
      BEGIN
	READ(KBD,CH); IF CH=^C THEN GOTO BREAK;
	READ(KBD,CH); IF CH=^C THEN GOTO BREAK;
      END;
    END;
  END;
  BREAK:
  CLOSE(INFILE); CLOSE(OUTFILE);
  EXIT:
END.
«eof»