home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / HEXDMP.ZIP / HEXDMP.DOC next >
Encoding:
Text File  |  1987-12-01  |  4.8 KB  |  117 lines

  1. Unit HexDmp;
  2.  
  3. {   -----------------------------------------------------------------------
  4.  
  5.     HEXDMP.TPU
  6.     Version 1.0
  7.     Copyright 1987 Lawrence R. Steeger
  8.  
  9.     Permission is granted to distribute this unit and its associated files
  10.     for both commercial and non-commercial use, if all copyright statements
  11.     and the following liability statements are included.
  12.  
  13.     No liability for any damage caused by the use of this unit, or by
  14.     programming errors in this unit, can be assumed by the author.
  15.  
  16.     Programming errors may be reported to Lawrence R. Steeger [72260,107]
  17.     on CompuServe.
  18.  
  19.     -----------------------------------------------------------------------
  20.  
  21. {   This unit provides hexadecimal dump/display routines.   }
  22.  
  23. Interface
  24.  
  25. Type    HexString = string[5];
  26.  
  27. Procedure HexArea(F: string;        { hexadecimal format control string }
  28.                   A: integer;       { ASCII options:
  29.  
  30.                                         Normal ASCII    0   [32..126]
  31.                                         HiBit Masked    1   [32..126,160..206]
  32.                                         IBM Graphics    2   [32..255]        }
  33.                   B: boolean;       { True if base line is offset 0 }
  34.                   P: pointer;       { start of area to dump }
  35.                   W: word           { length of area to dump }
  36.                  );                 { writes output using Writeln(Hexline()) }
  37.  
  38. Function HexLine(F: string;         { hexadecimal format control string }
  39.                   A: integer;       { ASCII options:
  40.  
  41.                                         Normal ASCII    0   [32..126]
  42.                                         HiBit Masked    1   [32..126,160..206]
  43.                                         IBM Graphics    2   [32..255]        }
  44.                  var B: boolean;    { 1st line flag             (updated) }
  45.                  var P: pointer;    { start of area to dump     (updated) }
  46.                  var I: word;       { bytes left to display     (updated) }
  47.                  var D: word        { bytes displayed           (returned) }
  48.                 ): string;          { hexadecimal output        (returned) }
  49.  
  50. Function HexWord(W: word;           { word to be formatted }
  51.                  B: boolean         { if True use Hi-Lo format else Lo-Hi }
  52.                 ): HexString;       { hexadecimal output        (returned) }
  53.  
  54. {   The next fourteen constants may be used in hex format strings.
  55.  
  56.     Any characters not defined below will be displayed as entered
  57.     in the format string.
  58.  
  59.     To display one of the following character tokens as itself,
  60.     the HexEsc token must precede any such character.   }
  61.  
  62. Const   HexOfs = '@';           { offset tokens: }
  63.         HexOfsMask = '@@@@';    { current HexByte offset display }
  64.         HexOfsLMask = '@LLL';   { starting HexLine offset display }
  65.  
  66.         HexSeg = '%';           { segment tokens: }
  67.         HexSegMask = '%%%%';    { current HexByte segment display }
  68.         HexSegLMask = '%LLL';   { starting HexLine segment display }
  69.  
  70.         HexByt = '#';           { byte tokens: }
  71.         HexBytMask = '##';      { HexByte display }
  72.  
  73.         HexHiB = '^';           { vertical HexHi display }
  74.         HexLoB = '&';           { vertical HexLo display }
  75.  
  76.         HexAsc = '~';           { ASCII character display }
  77.         HexVAsc = '!';          { vertical ASCII character display }
  78.  
  79.         HexNL  = '_';           { start new line }
  80.         HexEsc = '/';           { next character displayed as is }
  81.  
  82. {   The next three constants define the HexLine and HexArea ASCII option.    }
  83.  
  84.         HexASCII = 0;           { display normal ASCII only }
  85.         HexHiBit = 1;           { mask hi-bits and display normal ASCII only }
  86.         HexIBMGraph = 2;        { display all bytes in IBM graphics format }
  87.  
  88. {   The next five constants are samples of hexadecimal formatting strings
  89.     for use with HexArea and Hexline.
  90.  
  91.     These constants do not exist in the unit itself.  The user of the unit
  92.     must provide any such definitions.
  93.  
  94. Const   HexBytes: string[79] =
  95. '%%%%:@@@@  ## ## ## ## ## ## ## ##  ## ## ## ## ## ## ## ##  ~~~~~~~~ ~~~~~~~~';
  96.  
  97.         HexDebug: string[78] =
  98. '%%%%:@@@@  ## ## ## ## ## ## ## ##-## ## ## ## ## ## ## ##   ~~~~~~~~~~~~~~~~';
  99.  
  100.     Note:   The following three constants would be concatenated
  101.             to create a format string for a Vertical Hex Format.
  102.  
  103.             Notice the use of the HexNL token to generate multiple
  104.             lines of output.
  105.  
  106.         HexVline1: string[77] =
  107. '       !!!!!!!!  !!!!!!!!  !!!!!!!!  !!!!!!!!  !!!!!!!!  !!!!!!!!  !!!!!!!!_';
  108.         HexVline2: string[77] =
  109. '%LLL:  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^_';
  110.         HexVline3: string[77] =
  111. '@LLL   &&&&&&&&  &&&&&&&&  &&&&&&&&  &&&&&&&&  &&&&&&&&  &&&&&&&&  &&&&&&&&_';
  112.  
  113. }
  114.  
  115. Implementation
  116. 
  117.