home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug041.arc / TELFIX.PAS < prev    next >
Pascal/Delphi Source File  |  1979-12-31  |  2KB  |  56 lines

  1. { GENERALITY : CP/M
  2.   APPLICATION AREA : communication
  3.   PROGRAM DESCRIPTION : removes the first 80h bytes from a file that has been
  4.     transmitted using the non-standard communications protocol implemented by
  5.     the Microbee systems program telcom
  6.   PROGRAM NAME : telfix.pas (fix telcom)
  7.   NECESSARY MODULES : file-io.mod
  8.   SOURCE LANGUAGE : Borland turbo pascal (ver 2)
  9.   WRITTEN : 25 December 1985 - G. Irlam
  10.   LAST MODIFIED : 25 December 1985 - G. Irlam
  11.  
  12.   COMMENTS :
  13.     Reason for lack of generality - files are manipulated as a sequence of
  14.       8-bit bytes / 128 byte records and thus information about the CP/M file
  15.       structure is embedded in the code.
  16.     Reason for language implementation dependance - standard pascal does not
  17.       allow the manipulation of a binary file.}
  18.  
  19. PROGRAM telfix (input, source, output, dest);
  20.  
  21.   CONST
  22.     buff_rec = 1;
  23.       { Size of file buffers in records (must be >= 1).
  24.           A larger value will increase the rate of execution. }
  25.     buff_bytes = { buff_rec * $80 = } $80;
  26.     buff_bytes_minus_1 =  { buff_bytes - 1 = } $7F;
  27.  
  28.   TYPE
  29.     file_type = file;
  30.     buffer = array [0 .. buff_bytes_minus_1] of byte;
  31.  
  32.   VAR
  33.     source, dest : file_type;
  34.     buff : buffer;
  35.  
  36.   {$I file-io.mod }
  37.  
  38.   BEGIN
  39.     writeln ('TELFIX - G. Irlam, 1985');
  40.     writeln ('Remove first 80h bytes from a file transmitted by telcom to a standard');
  41.     writeln ('  communications package.');
  42.     writeln;
  43.     open_input (source);
  44.     open_output (dest);
  45.     IF not eof (source) THEN
  46.       blockread (source, buff, 1);
  47.         { 1 record = 80h bytes CP/M }
  48.     WHILE not eof (source) DO
  49.       BEGIN
  50.         blockread (source, buff, buff_rec);
  51.         blockwrite (dest, buff, buff_rec)
  52.       END;
  53.     close (dest);
  54.     close (source)
  55.   END.
  56.