home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / utility / unittool / turbo5 / intrfac5 / dump.pas next >
Encoding:
Pascal/Delphi Source File  |  1988-12-13  |  742 b   |  35 lines

  1. unit dump;
  2. {  Various routines to dump memory to system.output  }
  3.  
  4. interface
  5.  
  6. procedure dumpbytes(var loc;num:word);
  7. function hexbyte(b:byte):string;
  8. function hexword(w:word):string;
  9.  
  10. implementation
  11.  
  12. function hexbyte(b:byte):string;
  13. const
  14.   symbol : array[0..$f] of char = ('0','1','2','3','4','5','6','7',
  15.                                    '8','9','A','B','C','D','E','F');
  16. begin
  17.   hexbyte := symbol[b shr 4] + symbol[b and $f];
  18. end;
  19.  
  20. function hexword(w:word):string;
  21. begin
  22.   hexword := hexbyte(hi(w))+hexbyte(lo(w));
  23. end;
  24.  
  25. procedure dumpbytes(var loc;num:word);
  26. var
  27.   bytes:array[1..65520] of byte absolute loc;
  28.   i:word;
  29. begin
  30.   for i:=1 to num do
  31.     write(hexbyte(bytes[i]),' ');
  32.   writeln;
  33. end;
  34.  
  35. end.