home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / SAMPLPAT.PAS < prev    next >
Pascal/Delphi Source File  |  2000-06-30  |  2KB  |  57 lines

  1. Program SamplePatch;
  2.  
  3. {
  4.   This program demonstrates how to use the program
  5.    PATCH.COM to enable a Turbo Pascal program to
  6.    access the CP/M command tail.
  7.  
  8.   Background: the Z80 versions of Turbo Pascal trash all
  9.    but the first 32 bytes of the CP/M command tail in a
  10.    .COM file.  Eliot Moss wrote PATCH.PAS to move the
  11.    command tail to high memory; his program will repair
  12.    any .COM file generated with Turbo version 2.0.  (The
  13.    8088 versions do not share this problem since MS-DOS
  14.    implements the command tail differently.  Also, the
  15.    addresses are different in Z80 version 1.0.)
  16.  
  17.   Usage: write your .PAS source file the way you normally
  18.    would.  Add the following lines:
  19.  
  20.     In the 'type' section:
  21.       PatchString = string[127];
  22.  
  23.     In the 'var' section:
  24.       CmdPtr  : ^PatchString absolute $DB;
  25.       CmdTail : string[127];
  26.  
  27.     As the very first line of your main program:
  28.       CmdTail := CmdPtr^;
  29.  
  30.   Assume your program source is FOO.PAS.  Compile your
  31.    program into FOO.COM.  Exit from Turbo and type:
  32.      PATCH FOO
  33.  
  34.   To use your file, type:  FOO these are the args to foo
  35.  
  36.   Written by   : Ferd S. Brundick
  37.   Date written : 20 Jan 85
  38. }
  39.  
  40. type
  41.   PatchString = string[127];
  42.  
  43. var
  44.   CmdPtr  : ^PatchString absolute $DB;
  45.   CmdTail : string[127];
  46.  
  47. begin  { program SamplePatch }
  48.  
  49. { copy CP/M command tail to a safe location }
  50.   CmdTail := CmdPtr^;
  51.  
  52. { display command tail to show that it is intact }
  53.   writeln('Your command tail was:');
  54.   writeln('|', CmdTail, '|')
  55.  
  56. end.  { program SamplePatch }
  57.