unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

VAR
   G_Buffer : ARRAY[0..4096] of Char ;

procedure TForm1.Button1Click(Sender: TObject);
CONST
   C_CRLFz : ARRAY[0..2] of Char = #13#10  +  #0 ;
   C_HexCh : String[16] = '0123456789ABCDEF' ;
VAR
   L_P      : PChar ;
   L_Buf25  : ARRAY[0..25] of Char ;
   L_Buf01z : ARRAY[0..1] of Char ;

   L_i : Integer ;

   L_j    : Integer ;
   L_Code : Integer ;
begin
   L_P := @G_Buffer ;
   L_P^:= #0 ;

   L_P := StrECopy ( L_P ,  '        0123456789ABCDEF'  +  #13#10  );
   L_P := StrECopy ( L_P ,  '        ----------------'  +  #13#10  );

   L_Buf01z[1] := #0 ;

   {----- LOOP 1 }
   FOR L_i := 0 TO 15 DO BEGIN
      {----- Line address (in decimal) and in hexa }
      Str ( (L_i*16):3 , L_Buf25 );
      L_P := StrECopy ( L_P ,  '('      );
      L_P := StrECopy ( L_P ,  L_Buf25  );
      L_P := StrECopy ( L_P ,  ')'      );

      L_P^ := C_HexCh[L_i+1];
      Inc ( L_P );
      L_P := StrECopy ( L_P ,  '0>'  );

      {----- LOOP 2 }
      FOR L_j := 0 TO 15 DO BEGIN
         L_Code := L_i*16  +  L_j ;

         L_Buf01z[0] := Chr(L_Code);
         L_P := StrECopy ( L_P ,  L_Buf01z  );
      END;{j}

      L_P := StrECopy ( L_P ,  C_CRLFz  );
   END;{i}

   Memo1.SetTextBuf ( G_Buffer );
end;

end.
