This was the only Spectrum i/o channel that could be used in the early versions of the emulator. Using .TAP files instead of the RS232 channel is often easier, but sometimes using the RS232 channel can be very useful too, for instance if you've got a null-modem lead that connects a Spectrum with interface I to the PC you can use it to transfer data and programs easily. Furthermore, the RS232 channel is the easiest way to let the emulator communicate with a PC printer.
The Interface I RS232 port is called the "B" or "T" channel. The first is the binary channel, the "T" channel won't let all control codes through and will expand any keyword; useful for LISTing a program but otherwise annoying.
The Spectrum 128 has its own RS232 port; it is called the "P" channel. Output to either the Interface I's or Spectrum 128's own RS232 port will all be processed as `RS232 output', and input will go to both (that is, to the one you happen to read from).
The output to the RS232 channel can be routed to an LPT port, to a COM port or to a file on disk. Input can come from either a file or a COM port.
If you want to use the RS232 channel for printing using LPRINT
and LLIST
(shorthand for PRINT #3
and LIST #3
),
be sure to open that channel for
output to RS232; by default it sends its output to the ZX Printer, which
is not supported. You can open the channel by typing
OPEN #3,"B"
(or "T" for listings, or "P" on a Spectrum 128).
Input and output are buffered. This is important to remember when
you're transferring files using the SAVE
and LOAD *"b"
commands of the
Interface I. If the header is missed, for instance if you try to load
the wrong file type, re-sending the file will not directly work because
there will still be bytes in the buffer. You have to clear the input
buffer before re-sending the file. When inputting from a disk file, the
file pointer can be reset to point to the start of the file again to
re-read the header.
When inputting or outputting from or to a disk file, the read or write position is displayed as a byte-count. An <EOF> sign will appear if an input file is read completely through to the end.
The RS232 redirection options are in the Change Settings (F4) menu. The menu options are pretty obvious if you keep above remarks in mind, so I won't go into that.
When using a COM port, make sure you have initialised it before starting the emulator with the Dos MODE command, for instance
MODE com1:96,n,8,1
|
Here is how to transfer programs from a Spectrum to the PC using the
RS232 lead. First, you need a null-modem lead. I myself use the
following cable:
Spectrum | AT | PC | |
(9 pins) | (9 pins) | (25 pins) | |
3 | TxD ———————– RxD | 2 | 3 |
4 | DSR ———————– DTR | 4 | 20 |
CTS | 7 | 4 | |
| | |||
RTS | 8 | 5 | |
7 | GND ———————– GND | 5 | 7 |
(so CTS and RTS have to be connected!) This is not a full null-modem lead; you can only send data from the Spectrum to a PC. Here's how to transfer: load the program SAVESPEC.Z80 in the emulator and type the basic program over into the real Spectrum, and run it. It saves a short piece of code to tape.
Now load the program you want to transfer, and stop it. (This may be tricky!) Load the code back into memory at address 16384 (the code is relocatable but this is the safest place):
LOAD "RS232" CODE 16384
|
OPEN #3,"b"
, on a Spectrum 128 it would be
OPEN #3,"p"
,
and with other interfaces you'll probably know what to do. Select the
right baud rate on the Spectrum (probably FORMAT "b",9600
or something like that).
Now initialise the appropriate COM port on the PC and type
GETRS /n filename.z80 (n=COM port used)
|
RANDOMIZE USR 16384
to send the whole
memory over to the PC. The resulting .Z80 file should now be exactly
49182 bytes long (that is 48K+30 bytes), if not try again or try a lower
baud-rate. Voila, transferred!
To transfer short blocks of data it's often easier to use the
LOAD *"b"
and SAVE *"b"
commands of the Interface I. When the right options have
been selected in the RS232 i/o redirection menu, you should just follow
the instructions of the Interface I user manual and all should work as
expected.