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
/
TKERMIT.LBR
/
K.DQC
/
K.DOC
Wrap
Text File
|
2000-06-30
|
17KB
|
412 lines
Turbo Pascal Kermit CP/M-80
Author: Jeff Duncan
Language: Turbo Pascal
Version: 1.1
Date: 29 December 1984
Turbo Kermit Capabilities at a Glance
Local Operation Yes
Remote Operation No
Transfers Text Files Yes
Transfers Binary Files Yes
Wildcard Send No (planned feature)
^X/^Y Interruption No
Filename Collision Avoidance Yes
Can Time Out No
8th Bit Prefixing Yes
Repeat Count Prefixing No
Alternate Block Checks No
Terminal Emulation No
Communications Settings Yes (parity)
Transmit Break No
IBM Communication No
Transaction Logging No
Session Logging No
Raw Upload No
Act as Server No
Talk to Server Yes
Advanced Commands for Server No
Local File Management Yes (dir)
Command/Init Files No
Printer Control Yes
This is a third release of Turbo Pascal Kermit for CP/M 80. It is not
complete or fully debugged. Comments, fixes, bug reports, etc. are welcome.
I am available at (617) 839-5673 evenings, or at
3 Anderson Lane
No. Grafton, Ma. 01536
Much thanks go to Bernie Eiben for help and encouragement, and to Columbia
University for creating Kermit. Thanks also to those who have offered
comments, fixes, and enhancements.
Modification History:
29-DEC-84 Jeff Duncan - Extensively remodeled Turbo Kermit. Major areas
changed were:
V1.1
1. Binary files will now be transmitted and received correctly.
2. Added more extensive comments to entire program.
3. Added section in documentation to list operating system dependent code.
4. Announce procedure added by Alan Hull temporarily eliminated to keep
basic release generic. (but I liked the logo)
Limited/no testing has been done in the following areas:
1. 8'th bit quoting.
2. Generating parity.
3. Printer logging.
V1.0
08-DEC-84 Alan Hull - Corrected Directory function to work on all drives.
Version 0 was hardcoded to drive C only. Enhanced the directory
display to 5 columns, better filename display.
Added Sign-on logo for DEC Robin. Easily changed for other
systems by recoding announce procedure.
Added file delete option (any drive).
Updated Help, command prompt, and all routines affected by the
above enhancements.
V0.0
05-DEC-84 Jeff Duncan - Initial release of Turbo Pascal Kermit for CP/M-80.
Turbo Pascal Kermit Description
The motivation behind writing a Kermit implementation in Turbo Pascal was
principally to have a generic Kermit that would run on a variety of systems
without any modification. Turbo Pascal has turned out to be a popular
language because of its speed, ease of use, and features. It seemed logical
therefore to write a Kermit in Pascal that could be transported without
difficulty to many machines.
This program is still in its developmental stage. There are still some bugs
that have to be worked out, and there are features that should be added, but I
hope this is a good starting point!
The original goal of this project was to produce a Kermit that could compete
speed-wise with an assembly language version, but be written in a higher level
language that would be easier to maintain and could be used in a variety of
systems. It would also be easily adaptable to other operating systens that
can run Turbo Pascal such as MS-DOS and CP/M-86. To a large extent, this is
true. There is more operating system dependent code than I originally
intended, but most of it is in a few routines that could be rewritten easily
for another operating system. The performance is good considering that it is
written in Pascal. Connect mode appears to be glitch-free at 9600 baud, and I
have had no problems with file tranfer due to speed at 9600 baud as well,
using two DEC VT-180's, running both normal CP/M and ZCPR2. The degree of
buffering on various computers could affect this.
Command Summary
*****************************************************************************
IMPORTANT NOTE
To abort form send or receive use -- ^D -- NOT ^C. This is because of
testing problems using ^C.
*****************************************************************************
I have no intention in this preliminary documentation to provide detailed
descriptions of all the commands in this version of Kermit. They are well
documented in the Kermit Users Manual and the Protocol manual provided by
Columbia. I hope that the following will help show what features are
available and any bugs or unresolved issues there are in the implemented
commands.
A note about the command parser: This parser will not allow ? and escape as
in DEC-20 and others. However, the minimum unique abbreviation will be
recognized as a valid command. A good portion of the parser to do this has
been written, and may be added to Turbo Kermit at a later time. Both upper
and lower case letters are acceptable as input.
Connect - Establish a virtual terminal connection to a host connected to a
serial port on the computer. The current version supports the
reader/punch port and the UC1: port, because it was written on a
VT180. Selection of port is done by the SET command, and port
switching is done by manipulating the CP/M standard IOBYTE at
location 3. I/O is done by calls to BIOS via Turbo Pascal standard
functions and procedures. Escape from CONNECT mode is done with
^\-C. Operation, as mentioned before, appears correct at 9600 baud
on a VT180.
Send - Send the selected file to the remote Kermit. At present wildcards
are not supported, but hooks are there to add this feature.
Receive - Receive file(s) from the remote Kermit. Files will be received and
stored in the same names that the remote Kermit specifies in its
file header packet(s). Multiple files may be received. This
command does not request files from the remote Kermit. It waits
until the remote Kermit initiated the file transfer. If the
filename being sent already exists, Turbo Kermit will attempt to
create a unique filename for the file. If this is successful, a
message to this effect will be printed on the screen.
Get <filespec> -
Request from a remote server that certain file(s) be sent. The
filespec as typed is sent exactly to the remote Kermit. Files will
be received and stored as in receive mode.
Bye - When sent to a remote server, log out the server, and log out the
host. If the logout of the server is successful, exit to CP/M. If
it is unable to logout the remote host, Turbo Kermit returns to the
prompt level. This is to allow reconnection to the remote system
for further action without having to reload Kermit.
Finish - Log out the remote server. If this is unsuccessful, a message is
displayed at the terminal.
Logout - Logout the remote server and the remote system and remain in Kermit.
Dir - Print a directory listing for any drive. Wildcards are allowed in
the filespec following the Dir command.
Era - Erase any file(s) specified on any drive. Wildcards are allowed in
the filespec following the Era command.
Set - Set a Turbo Pascal Kermit parameter. The following are valid
parameters:
PRINTER - on of off. WIll turn the printer on for logging a virtual
terminal connection only.
PARITY - mark, space, even, odd, or none. this will convert the 8th
bit of a file transfer to the appropriate parity for file transfer.
Parity is stripped on receive. Any parity except none will attempt
8th bit quoting if binary files are selected.
FILE - Binary or Ascii. If ASCII is selected, all files transmitted
will be terminated on the first ^Z detected in the file. Receiving
will continue until an end of file packet is received. When binary
is selected, the files will be sent until CP/M signals the last
sector. As mentioned above, binary file transfer will be attempted
using 8th bit quoting if parity other than none is selected.
PORT - Currently only reader/punch and UC1: are supported using the
CP/M standard IOBYTE.
Program Organization
Because the program is not fully documented, the following is a description
of the organization of the program to help find what's where. Because Turbo
will only handle a limited size file, there are a number of include files.
This was also done so that the program will compile in memory to speed up
debug.
The files required are:
K.PAS - program header, include's, and main procedure
KINIT.PAS - type, const, and var declarations, and general utilities
KDIR.PAS - directory listing procedures
KOPEN.PAS - open a file on the micro
KDISPLAY.PAS - display procedures for send and receive
KHELP.PAS - help displays and set parameter procedures
KREC.PAS - general receive procedures
KTERM.PAS - virtual terminal mode
KSEND.PAS - sending a file to remote
KREC1.PAS - receiving a file from remote
KCMD.PAS - command parser
The following is a list of procedures and functions by file:
File - K.PAS
none
File - KINIT.PAS
Tab generates a string of spaces
Ctl conversion to/from control character
Char40 adds 40 hex to integer to produce character
Unchar subtracts 40 hex from character to produce
integer
Ltrim removes leading spaces from string
Rtrim removes trailing spaces from string
File - KDIR.PAS
Adjust_Fn expands string to CP/M filename format
also inserts wildcard characters
Init_Fcb sets up FCB for filename search
Searchfirst calls bdos for searching for filename
Searchnext calls bdos for searching for filename
Dir generates directory listing
Delfile delete specified file(s)
Deletefile calls BDOS for the delete
File - KOPEN.PAS
Open_File tries to open a file
Open_For_Write tries to open a file for Writing
File - KDISPLAY.PAS
Displayt base display for send mode
Displayr base display for receive mode
Update update the display
File - KHELP.PAS
Show show local parameters
Help display help message
Set_Param sets up local parameter
File - KREC.PAS
Get_Char tries to get a character form port
also monitors crt for abort or retry
Receive_Packet get a complete packet from remote
File - KTERM.PAS
Send_Char send a character to port
Term virtual terminal mode
FILE - KSEND.PAS
Check_Init sets up parameters from send init dialogue
Check_Ack checks ack packet for correctness
Send_Packet send a packet to remote
Build_Packet put checksum and parity on packet
Quit return to CP/M unconditionally
Finish handle bye, finish, and logout commands
Send send a file to remote host
Get_File_Data build a data packet
Sinit send init state handler
Sheader send file header handler
Sfile send file data handler
Seof send end of file handler
Sbreak send break handler
Send_Ack send an ack packet
Send_Nak send a nak packet
File - KREC1.PAS
Rheader receive file header packet
Get send server get command
Rinit receive send init packet
Expand_Packet disect received data packet
Rfile receive file data
File - KCMD.PAS
Parse parse the command line
Prompt display a prompt
Get_Command_Line dispatch command per typed command line
System Dependent Code
The original intent of Turbo Pascal Kermit was to produce a version of
Kermit that would be written with a minimal need for system dependent code.
Turbo Pascal provides general procedures for screen handling that obviate the
need for much system (or terminal dependent) code, but there are some areas
that must be written with the target system in mind. Somethings just can't be
done without these routines, and speed is enhanced by using them.
However, Turbo Pascal is quite fast. In this implementation, I have had no
need to add assembly language routines to implement the most critical speed
related routines, terminal mode and send/receive packets. I have, though, had
to add system dependent code. This version of Kermit is designed to run on
CP/M-80 only. In all the terminal and communications port routines I have
used BIOS calls. These have allowed a terminal mode that will operate at 9600
baud. BIOS calls have also been used to send and receive data packets. These
are not quite as fast, but appear to limited to slightly less than 4800 baud
with no buffering of data in the basic operating system. The other area of
this program that uses CP/M-80 system calls is the directory printing
routines.
I was planning to separate all the system dependent code into one module,
but decided against that because there is too much of it and the routines span
several blocks that do not logically fit together. Instead, this section of
the manual for Turbo Kermit is intended to detail those areas that have system
dependent code for those who may be interested in modifying this version for
other operating systems.
1. Directory Listings
The directory listing code of Turbo Kermit are almost entirely system
dependent. The directory information is extracted via BIOS calls, and the
directory mask is converted to upper case and expanded to be readable by
CP/M-80. This will probably be different for most other operating
systems.
2. IOBYTE
All communications (terminal mode and send/receive packets) are done
with CP/M Bios calls. In order to interrogate the various ports, the CP/M
IOBYTE is changed to reflect the desired communications port desired.
This version presumes that the IOBYTE is located in RAM at 0003 hex.
Three variables are used to set the IOBYTE. They are 'iobyte',
'base_iobyte', and 'port_iobyte'. 'base_iobyte' is a copy of 'iobyte'
when the program is entered. 'port_iobyte' is initially set to point at
the reader/punch port. This variable can be changed using the 'SET PORT'
command (procedure located in file 'khelp.pas'. Additional ports can be
added in this routine.
3. Sending characters to communications port
The include file 'kterm.pas' includes the virtual terminal mode, and the
only procedure that transmits to the remote ports, 'send_char'. This
procedure resets the IOBYTE to point at the appropriate port and sends the
character using a BIOS call. This routine could be easily replaced to
send a character on another type of system.
4. Receiving packet data
When receiving packet data from a communications port, a procedure
located in the include file 'krec.pas' is used. This procedure, called
'get_char' performs the same type of port switching required by CP/M to
check status as virtual terminal mode. This routine can be replaced by
something a different operating system can understand.
5. Virtual terminal mode
Virtual terminal mode is riddled with CP/M BIOS calls. Because CP/M does
not allow port status to be read except when the port is the logical
console, termianl mode is a loop that changes the ports to be the console,
and checks the status. When the status indicates a character is available
at the communications port, it is fetched and sent to the screen. When a
character is typed at the keyboard, it is sent to the communications port
via the 'send_char' procedure above. Terminal mode would have to be
rewritten for any other type of system.
There is no terminal emulation package in this version of Kermit. This
would be difficult to accomplish and still maintain any reasonable speed.
6. Opening files
File opening and closing is all done with Turbo Pascal procedures.
However, the size of the the filenames is hard encoded into the routines
so some messing around will be required for systems that handle different
length filenames.
Note also that the procedure 'adjust_fn' located in 'kdir.pas' is used to
find places to insert characters in the filename if a naming conflict
occurs when opening a file for writing. If you change the directory
listing routines, leave that one in there, or implement the filename
conflict routine differently.
7. Deleting files
Deleting files is done with CP/M BIOS routines. This will also have to
be rewritten for another system. listing routines, leave that one in there, or implement the filename
conflict routine diffe