home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug041.arc
/
TELFIX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
2KB
|
56 lines
{ GENERALITY : CP/M
APPLICATION AREA : communication
PROGRAM DESCRIPTION : removes the first 80h bytes from a file that has been
transmitted using the non-standard communications protocol implemented by
the Microbee systems program telcom
PROGRAM NAME : telfix.pas (fix telcom)
NECESSARY MODULES : file-io.mod
SOURCE LANGUAGE : Borland turbo pascal (ver 2)
WRITTEN : 25 December 1985 - G. Irlam
LAST MODIFIED : 25 December 1985 - G. Irlam
COMMENTS :
Reason for lack of generality - files are manipulated as a sequence of
8-bit bytes / 128 byte records and thus information about the CP/M file
structure is embedded in the code.
Reason for language implementation dependance - standard pascal does not
allow the manipulation of a binary file.}
PROGRAM telfix (input, source, output, dest);
CONST
buff_rec = 1;
{ Size of file buffers in records (must be >= 1).
A larger value will increase the rate of execution. }
buff_bytes = { buff_rec * $80 = } $80;
buff_bytes_minus_1 = { buff_bytes - 1 = } $7F;
TYPE
file_type = file;
buffer = array [0 .. buff_bytes_minus_1] of byte;
VAR
source, dest : file_type;
buff : buffer;
{$I file-io.mod }
BEGIN
writeln ('TELFIX - G. Irlam, 1985');
writeln ('Remove first 80h bytes from a file transmitted by telcom to a standard');
writeln (' communications package.');
writeln;
open_input (source);
open_output (dest);
IF not eof (source) THEN
blockread (source, buff, 1);
{ 1 record = 80h bytes CP/M }
WHILE not eof (source) DO
BEGIN
blockread (source, buff, buff_rec);
blockwrite (dest, buff, buff_rec)
END;
close (dest);
close (source)
END.