Mon 28 December 2020
Every time I get the RC2014 out and try to copy files to/from it, I have to relearn how to do it, so I thought it best to document what I have found to be the easiest way.
The rx and sx programs are provided by the lrzsz package on Ubuntu:
$ sudo apt install lrzsz
The first thing you need to do is use stty to enable RTS/CTS handshaking (I don't really understand why, it's just magic) and set the baud rate:
$ stty -F /dev/ttyUSB0 115200 crtscts
Without this everything will just hang and you'll have no idea why it's not working. You need to re-run this every time you plug in the USB FTDI cable.
We'll send foo.txt from Linux to A:FOO.TXT on CP/M. When sending from Linux to CP/M I find you need to start the sending side before the receiving side otherwise it just hangs.
$ sx foo.txt < /dev/ttyUSB0 > /dev/ttyUSB0
sx seems to stand for "send with xmodem".
B>XMODEM A:FOO.TXT /R /X1
/R means "receive", and /X1 means to communicate via CP/M's "reader and punch", i.e. the secondary serial port.
We'll send A:FOO.TXT from CP/M to foo.txt on Linux. When sending from CP/M to Linux it doesn't seem to matter whether you start the sending side or the receiving side first.
$ rx foo.txt < /dev/ttyUSB0 > /dev/ttyUSB0
rx seems to stand for "receive with xmodem".
B>XMODEM A:FOO.TXT /S /X1
/S means "send".
On my system, /dev/ttyUSB0 becomes group-owned by dialout, so to access it you either need to be in the dialout group, or just be root.
Using a USB FTDI cable, connect the Linux machine to the RC2014's secondary serial port. On my machine this is exposed with a 6-pin header on the back panel:
But on a bare RC2014 it is this one:
The RomWBW CP/M image that is included on the CompactFlash card contains a program called XMODEM.COM and a program called XM.COM. They both appear to implement XMODEM, but XMODEM.COM is the one to use. I couldn't work out how to use XM.COM.
Drive A: is a ramdisk, so files written here will be lost across a power cycle.
Drive B: is a romdisk, so you can't write files here.
The rest of the drives are backed by the CompactFlash card.
CP/M doesn't actually have a way to know exact file lengths, it just knows how many blocks a file takes up, which are 128 bytes long. This isn't a problem when transferring from Linux to CP/M, but text files transferred from CP/M to Linux will be padded to a multiple of 128 bytes with ^Z characters.
$ rx foo.txt < /dev/ttyUSB0 > /dev/ttyUSB0 rx: ready to receive foo.txt Bytes received: 128 BPS:121 Transfer complete
If you like my blog, please consider subscribing to the RSS feed or the mailing list:
B>XMODEM A:FOO.TXT /S /X1 File open Sending via RDR/PUN with checksums * OK Sent 1 blocks