4: USING BBC KERMIT AS A TERMINAL EMULATOR

BBC KERMIT includes facilities that enable you to use your BBC computer as
a terminal connected to a mainframe computer. The facilities are not as
sophisticated as those offered by a ROM whose sole purpose is terminal
emulation, since the prime use of KERMIT as a terminal is to allow you to
start running a remote KERMIT program on a mainframe, but it is still
quite usable.

If you are using the RAM version of BBC KERMIT on a model B, the only type
of terminal emulation provided is as a 40 character wide teletype device.

If you are using the sideways ROM version, or have a model B+, B+128 or
Master 128 with either version, you may choose from 3 types of terminal
emulations. By default, BBC KERMIT provides an 80 character wide terminal
compatible with the DEC VT52 standard. If you wish, you may select an 80
character wide simple teletype device, or a 40 character  wide teletype.
Normally, you would need the latter mode only if you wanted to transfer a
large amount of data to or from the BBC's memory: the 40 character wide
terminal emulation uses BBC mode 7, so that memory below &7C00 is
available to you. The 80 character wide teletype and VT52 emulations use
memory down to &3D00.

4.1 RUNNING A TERMINAL SESSION

In this section we shall look at how to set up BBC KERMIT for terminal
emulation and how to control the emulation functions.

4.1.1 Choosing the terminal emulation required

If you are using the RAM version of BBC KERMIT on a model B, you should 
ignore  this  section, since only a 40 character teletype emulation is
provided. Although you are allowed to select other emulation types, you
will not be able to use them.

If you have the sideways ROM version of BBC KERMIT, or have a model B+,
B+128 or Master 128, you should first decide the emulation mode you wish
to choose. The command you will need here is

  SET TERMINAL

to choose the emulation you require. For example, the command

  SET TERMINAL TT80

will turn BBC KERMIT into a simple teletype device using an 80-column
screen.

4.1.2 Setting the line speed

For both the RAM and sideways ROM versions of BBC KERMIT you may need to
change the speed at which characters are transmitted down the
communications line. The

  SET BAUD

command accomplishes this. If you have the wrong setting, you will find
either gibberish or nothing at all appearing on the screen. The default
setting that BBC KERMIT uses is a speed of 9600 baud for both transmitting
and receiving data. If you are unsure of what setting to use, consult the
Advisory or Systems Support personnel of your computer centre. For
example, the command

  SET BAUD 1200

would set up BBC KERMIT to use a baud rate of 1200 for transmit and
receive.

 Some  communications  equipment  mayrequirethatdatais
 transmitted  and  received  at different baud rates: for example,
 some modems may enable the host to send data to you at 1200 baud,
 but require you to send to the host at 75 baud. BBC KERMIT allows
 you to select such a "split  baud  rate"  mode  by  specifying  a
 further  parameter  to the SET BAUD command. In the example here,
 of 1200 baud receive and 75 baud transmit,  you  should  set  the
 baud rates with the two commands

  SET BAUD 1200 RECEIVE

and

  SET BAUD 75 TRANSMIT

4.1.3 Setting parity

For both the sideways ROM and RAM versions of BBC KERMIT you may need to
change the "parity" value which is used on the communications line. The
parity setting determines what is done with the eighth bit of every data
byte: some communications systems or mainframes may insist that this byte
be always set, or always clear, or should reflect the contents of the
other seven bits in some way.

You change the parity setting with the

  SET PARITY

command. As with line speed, if you use the wrong setting you will
probably see garbage appearing on the screen, and file transfers will not
work. As an example, the command

  SET PARITY NONE

would tell BBC KERMIT to use a parity value of NONE (sometimes expressed
as "no parity"). You should consult the systems support personnel at your
site if you are unsure of the correct setting. Parity also affects how
KERMIT decides to transfer some types of file, and you should consult
section 5.3 for more information. By default, BBC KERMIT uses a parity
setting of SPACE.

4.1.4 Selecting the flow control method

When two computers transfer data between each other, some method is needed
to control the data flow, to stop one side sending faster than the other
can receive and process that data. This process is termed "flow control",
and gives the machine that is receiving the data the ability to tell the
other side "don't send any more data till I tell you, as I have a backlog
of bytes to display".

BBC KERMIT supports the two most common techniques of flow control, and
you can switch at will between them. The command

  SET FLOW-CONTROL XON/XOFF

selects "XON/XOFF" flow control, whereby "stop" and "go" is signalled by
sending special byte values. Alternatively, the command

  SET FLOW-CONTROL CTS/RTS

will select "CTS/RTS" or "hardware" flow control, where "stop" and "go" is
signalled by changing voltages on the line connecting the systems.

The setting you should use will depend entirely on the communications
system or mainframe you are using, and you should consult the systems
support personnel at your site for advice. If you have the wrong setting
you will probably find parts of output lines missing when you use terminal
mode. By default, BBC KERMIT will use XON/XOFF flow control.

4.1.5 Specifying an "ignore" character

Some mainframe systems assume that all terminals connected to them are
produced by the same manufacturer, and will send "filler" characters to
them, assuming that the terminal will know that they are not to be
displayed on the screen. BBC KERMIT, of course, is unaware that this is
being done, so will take no special action: all characters with ASCII
codes greater than 31, and the CR, LF, DEL, BS and FF characters will be
output to the screen. (TAB characters are expanded into spaces and ESCAPE
is handled specially).

If the filler character the mainframe sends is one that is normally
displayed by BBC KERMIT, you can suppress its output by nominating it as
the "ignore character". For example,

  SET IGNORE &7F

would cause DEL characters (ASCII code &7F) to be ignored. Typing

  SET IGNORE

on its own would switch off the ignore facility once more.

4.1.6 Starting terminal emulation

To start BBC KERMIT as a terminal emulator, you should set up the speed,
parity, flow control and "ignore" character values as described above,
then type the command

  CONNECT

This sets up the screen in the required mode and clears it. Any characters
you type now are sent directly to the RS423 output port, exactly as they
would be if the BBC were a real terminal. You may now "wake  up" the
system you are connected to, and do anything else you wish.

Note that if you have chosen a terminal emulation that BBC KERMIT cannot
provide (for instance, if you have selected VT52 mode with the RAM version
on a model B), the CONNECT command will be rejected and the error message
"Terminal not supported" will be displayed.

In all terminal emulation modes BBC KERMIT will display a "status line" at
the top of the screen. The line contains a brief reminder of the functions
you can select by pressing the CONTROL key with a function key and
indicates what facilities are currently operating.

4.1.7 Sending a break signal

Many mainframe computer or communications systems require the terminal to
send them a "break" signal for some operations.

BBC KERMIT allows you to send either of two types of break signal.
Pressing CONTROL and F9 will send a "short break" signal: this is the most
commonly-used type, and the break signal will last about 240 milliseconds.
In some circumstances a "long break" signal may be needed: pressing
CONTROL and F8 will send a signal lasting 3.5 seconds. Your systems
support or advisory service will be able to tell you which, if any, break
signal you need to use.

Note that you should not press the key marked BREAK for sending break
signals.

4.1.8 Using the function keys

In terminal emulation mode BBC KERMIT reserves the 10 function keys for
its own use: in VT52 emulation mode it uses them to emulate the "keypad"
keys of the real VT52. However, you can still use the function keys to
produce strings, but now you will need to press the CONTROL and SHIFT keys
at the same time as the function key concerned.

As an example, suppose that in BBC KERMIT command mode (or indeed before
you started to run BBC KERMIT) you issued the Operating System command

  *KEY 0 type myfile.dat

Then, in terminal emulation mode, pressing CONTROL-SHIFT-F0 would produce
the string "type myfile.dat" on the screen exactly as if you had typed it
from the keyboard.

4.1.9 Using the cursor keys

BBC KERMIT uses the four cursor keys in one of two ways, depending on what
terminal emulation you have selected.

If you have selected either a 40 character or an 80 character teletype
emulation, the keys function as normal BBC Computer edit keys. You can use
them in conjunction with the COPY key to edit lines, in exactly the same
way as you would edit a BASIC program.

In VT52 emulation mode, though, the cursor keys will by default produce
VT52 ESCAPE sequences that programs such as the VAX/VMS EDT editor expect,
and these are described below. You can, though, specify that they should
be used as BBC edit keys by pressing CONTROL and F4. An "E" will appear in
the status line to remind you, and the keys will now operate as BBC edit
keys. Any program you are running on the mainframe will not be aware that
you have pressed a cursor key. To return to using VT52-mode cursor keys,
press CONTROL and F4 once more.

4.1.10 Pausing screen output

You have several choices if you wish to stop output to the screen for a
moment (for example to study part of a file that is being listed). One
method uses the standard "stop scroll" mechanism of the BBC Computer:
output will stop if you hold the CONTROL and SHIFT keys down together, and
will resume when you release them.

If you wish to hold the screen while you do something else, though, a
better method is to use BBC KERMIT's own mechanism. If you press the
CONTROL and F3 keys once, output to the screen will stop. An "H" will be
displayed on the status line to indicate that you have suspended output.
The screen will remain as it is until you again press CONTROL and F3:
unlike the first technique, this lets you move away from the machine if
you wish.

4.1.11 Returning to command mode

At some point, particularly if you are going to perform file transfers,
you will wish to leave terminal emulation mode and return to the command
screen, since the commands that perform file transfer can be issued only
from KERMIT command mode. To return to command mode you should press
CONTROL and F0 together: the BBC KERMIT command screen will reappear and
you may issue any BBC KERMIT commands you wish, and return to terminal
emulation mode when you require.

4.2 LOGGING OUTPUT TO A DISC FILE

You may wish to record your terminal session in a file on disc for later
use: this is a convenient way of down-loading a text file from a mainframe
if it does not have a KERMIT facility of its own (however, it is strongly
recommended that you do use KERMIT for file transfer whenever possible).

Terminal logging must be initiated from the BBC KERMIT command screen
before you issue the CONNECT command to start terminal emulation. You
could type, for example

  LOGGING ON MYLOG

which would initiate logging, and open a file called MYLOG to record the
data. At this point, though, although logging is initiated, it is not
active, so nothing will be sent to the file.

Once you have entered terminal emulation mode you can activate or
deactivate logging at will. Pressing CONTROL and F1 once will activate
logging: any character that appears on the screen will be copied to the
file. Pressing CONTROL and F1 again will deactivate logging, and no
characters will go the file. You may repeat this activation and
de-activation as often as you wish. A "D" will appear at the right hand
side of the status line whenever logging is active, to remind you that
output is being sent to disc.

When you have finished your terminal session, you should return to the
command screen by pressing CONTROL and F0, then issue the

  LOGGING OFF

command to terminate logging and close the file. This step is important:
if you don't do it some data will be lost from the file.

A possible sequence you could use to capture a text file from a mainframe
would be this:

1. Issue the command, for example, LOGGING ON MYFILE to open a file and
initiate logging.

2. Enter terminal emulation mode with the command CONNECT

3. Log in to the mainframe, and type the command to list a file to the
terminal, but don't press RETURN to send the command to the mainframe.

4. Activate logging to the disc file by pressing CONTROL and F1.

5. Press RETURN to send the listing command to the mainframe.

6. When the file has been displayed on the screen, press CONTROL and F1
again to deactivate logging.

7. Return to the BBC KERMIT command screen by pressing  CONTROL and F0.

8. Terminate logging and close the file with the command LOGGING OFF

4.3 LOGGING OUTPUT TO A PRINTER

BBC KERMIT allows you to copy all the characters that appear on the screen
to a printer, to give a hard copy log of a terminal session. At any time
while you are in terminal mode, pressing CONTROL and F2 together will turn
on the copying of bytes to the printer; pressing CONTROL and F2 once more
will turn it off again. A "P" will appear on the right of the status line
whenever bytes are being logged to the printer.

An alternative, and preferable way of obtaining a hard copy of a file on
your printer is to use the file transfer facilities of BBC KERMIT to move
the file from the mainframe to your BBC system, specifying that the data
be sent directly to the printer with the

  SET DESTINATION PRINTER

command. This method, although slower, has the advantages of providing an
error-free copy of the file, and enabling all possible character values to
be sent. The technique is further described in Chapter 5.

4.4 SENDING A FILE TO A HOST WITHOUT KERMIT

BBC KERMIT contains facilities to let you transfer files from BBC discs to
another machine even if that machine does not have a KERMIT program of its
own. This  facility, sometimes called "raw send" is controlled by the
TRANSMIT command. You should note, though, that this method offers no
error-correction at all, so you should always use KERMIT to transfer data
if you can.

For example, suppose you wish to transfer the contents of a file
:1.RESULTS to a mainframe that does not have KERMIT. You can take the
following steps:

1. Use the CONNECT command to enter terminal mode, and log in to the host.

2. Type the host command needed to store what you type in a file. Your
system may have an INPUT or CREATE command, or you may need to use the
editor to do this: if in doubt, consult your systems support personnel or
advisory service.

3. Press CONTROL and F0 to return to BBC KERMIT command mode.

4. Issue the TRANSMIT command. In this example, you would type TRANSMIT
:1.RESULTS. BBC KERMIT will now return to terminal mode, and the contents
of file :1.RESULTS will be sent to the host, just as if you were typing at
the keyboard. In order not to overload the host  system with data arriving
at too high a rate, BBC KERMIT will pause for half-a-second after sending
each line of the file.

5. Once the file has been sent, type whatever is needed to tell the host
that there is no more data to go into the file, and carry on with your
terminal session. Note that you can press ESCAPE at any time to terminate
sending the file. BBC KERMIT will once more take input from the keyboard,
exactly as normal.

It may sometimes happen that your file contains line-feed (LF) characters
at the end of each line as well as the usual carriage-return (CR)
characters, and these can sometimes cause problems at the host end.
Accordingly, BBC KERMIT lets you control what happens to them, as follows:

If the file type you have set with the SET FILE TYPE command is ASCII CR,
line-feed characters in the file are ignored and not sent to the host.

If the file type is anything else, the data in the file is sent exactly as
it is, without any changes.

4.5 VT52 KEYPAD EMULATION

Since the model B, B+ and B+128 keyboards do not possess a VT52 keypad, it
is necessary to emulate these keys using the 10 function keys. In VT52
terminal emulation mode the function and cursor keys correspond to the
VT52 keypad in the following way:

	BBC key	   VT52 keypad key	ESCAPE sequence
	   F0		   0	 	ESC ? p
	   F1		   1	 	ESC ? q
	   F2		   2	 	ESC ? r
	   F3		   3	 	ESC ? s
	   F4		   4	 	ESC ? t
	   F5		   5	 	ESC ? u
	   F6		   6	 	ESC ? v
	   F7		   7	 	ESC ? w
	   F8		   8	 	ESC ? x
	   F9		   9	 	ESC ? y

	SHIFT-F1	  PF1		ESC P
	SHIFT-F2	  PF2		ESC Q
	SHIFT-F3	  PF3		ESC R
	SHIFT-F4	  PF4		ESC S
	SHIFT-F5	 MINUS		ESC ? m
	SHIFT-F6	 COMMA		ESC ? l
	SHIFT-F7	 PERIOD		ESC ? n
	SHIFT-F8	 ENTER		ESC ? M

	   UP		   UP		ESC A
	  DOWN		  DOWN		ESC B
	  RIGHT		  RIGHT		ESC C
	  LEFT		  LEFT		ESC D

Note that keys PF4, MINUS and COMMA may not exist on a real VT52 device,
although they are present and usable on a VT100 terminal that is operating
in VT52 mode.

The Master 128 allows you to use the above keys as described, but also
lets you use the built-in keypad, which is considerably easier. The
arrangement of the keys correspond to a real VT52 keypad closely, and they
have the following meaning:

  ---------------------------------
  !	   !	   !	   !	   !
  !  PF1  !  PF2  !  PF3  !  PF4  !
  !	   !	   !	   !	   !
  ---------------------------------
  !	   !	   !	   !	   !
  !   7   !   8   !   9   ! MINUS !
  !	   !	   !	   !	   !
  ---------------------------------
  !	   !	   !	   !	   !
  !   4   !   5   !   6   !	   !
  !	   !	   !	   !	   !
  ---------------------------------
  !	   !	   !	   !	   !
  !   1   !   2   !   3   ! COMMA !
  !	   !	   !	   !	   !
  ---------------------------------
  !	   !	   !		   !
  !   0   ! PERIOD!	 ENTER	   !
  !	   !	   !		   !
  ---------------------------------


Note that the keypad DELETE key is not used.

Appendix 3 details the use of the function keys with the EDT editor
available on the VAX/VMS Operating System.

