DataMuseum.dk

Presents historical artifacts from the history of:

Bogika Butler

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

See our Wiki for more about Bogika Butler

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦9da34e786⟧ TextFile

    Length: 1920 (0x780)
    Types: TextFile
    Names: »HEXDUMP.PAS«

Derivation

└─⟦6367c43c0⟧ Bits:30004325 PolyPascal vers. 3.10 for Butler
    └─ ⟦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 file to be dumped, and the name of the file or logical å
æ device (CON:, LST:, etc.), which is to receive the dump.      å

TYPE
  sector = ARRAYÆ0..7,0..15Å OF byte;
  hexstring = STRINGÆ4Å;
  filename = STRINGÆ14Å;

VAR
  address,l,p,i,j,n: 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 halt;
  write('Output file name? '); readln(outname);
  IF outname='' THEN halt;
  assign(infile,inname); æ$I-å reset(infile) æ$I+å;
  IF iores>0 THEN
  BEGIN
    writeln(inname,' does not exist'); halt;
  END;
  assign(outfile,outname); rewrite(outfile);
  address:=0;
  REPEAT
    blockread(infile,buffer,1,n);
    IF n<>0 THEN
    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;
    END;
  UNTIL n=0;
  close(infile); close(outfile);
END.
«eof»