View source | |
# 2024-11-12 - Involuntary Old Computer Challenge | |
My daily driver Slackware64 15.0 system died, so i am doing an | |
involuntary old computer challenge. When it comes to obsolete | |
resources, i have an embarassment of riches, including my phone and | |
the public computers at the community library. However, those are the | |
easy way out. What better excuse do i need to get nerdy? | |
Long ago, a friend gave me a raspberry pi 0w. At a thrift store i | |
bought a (prolific?) USB RS-232 adapter for $1. From a family member | |
i inherited an IBM PC with a Pentium processor and 32 MB of memory. I | |
am happily running FreeDOS 1.3 on it. | |
I installed Alpine Linux on the raspberry pi and am using the FreeDOS | |
PC as a terminal. I tried three different approaches for FreeDOS: | |
* telemate, with the raspberry pi as a virtual modem | |
* lsppp, with the raspberry pi as a PPP server | |
* kermit, with the raspberry pi as a Linux shell | |
At home i only have WIFI network access. The raspberry pi acts as a | |
bridge between the WIFI network and the RS-232 serial port on my DOS | |
machine. Of the three approaches mentioned, i like kermit the best | |
because it is reliable and has professional quality documentation. | |
Often on these retrocomputing explorations i will take detailed | |
private notes, kind of a "build sheet" for my own future reference. | |
I think it would be too obtuse to include these notes in their | |
entirety, so i will post highlights. | |
# telemate, with the raspberry pi as a virtual modem | |
Using tcpser as a virtual modem with telemate worked great. Telemate | |
used the serial port and Hayes modem codes to dial out, and tcpser | |
bridged that to a telnet BBS. | |
Here is an article describing tcpser: | |
https://magpi.raspberrypi.com/articles/add-internet-access-to-a-vintage-compute… | |
Here is a version of tcpser fixed for Alpine Linux: | |
gopher://tilde.club/1/~freet/gophhub/?https://github.com/go4retro/tcpser | |
I installed the build-base package to get a GCC toolchain to compile | |
tcpser on Alpine Linux. | |
Here's how i created my /etc/inittab entry for tcpser: | |
# PHONE="$(printf %-21s 5553456789)=endofthelinebbs.com" | |
# TCPSER=/home/ben/local/bin/tcpser | |
# echo ttyUSB0::respawn:$TCPSER -d /dev/ttyUSB0 -s 9600 -n"$PHONE" \ | |
>>/etc/inittab | |
Why do i format the PHONE entry with printf? Telemate pads the phone | |
number to 21 characters with trailing spaces. Those trailing spaces | |
make a difference to tcpser, where a real modem would ignore them. | |
Why do i use ymodem for file transfers? Zmodem is not tuned for | |
TCP/IP congestion control, etc. Ymodem performs better on a telnet | |
BBS. | |
http://www.ipingthereforeiam.com/bbs/msgs/view.plx?schema=echoes&id=255525&echo… | |
# lsppp, with the raspberry pi as a PPP server | |
After some testing, i found that PPP and kermit file transfers do well | |
with the serial port at full speed, but kermit terminal emulation is more | |
reliable at slower speeds. For this reason i configured getty to toggle | |
between 9600 and 115200 baud, when it receives a break. | |
I referred to the following documents when configuring PPP. | |
http://www.steptail.com/guides:virtual_modem | |
https://tldp.org/HOWTO/PPP-HOWTO/ | |
Once configured, PPP worked great. I used the PING command from MTCP | |
and the lynx and links browsers from the FreeDOS install CD. | |
I found it necessary to configure the PPP server option | |
"lcp-echo-interval 0" or else lsppp would time out and disconnect | |
after a few seconds. | |
I wrote a batch file ppp.bat which uses MS-DOS kermit as the chat | |
script, then runs lsppp, and configures mtcp.cfg, wattcp.cfg, and sets | |
a few environment variables such as DNS1 for the DNS server IP address. | |
By the way, here is NSLOOKUP.BAT, which uses MTCP: | |
@echo off | |
C:\FREEDOS\NET\MTCP\dnstest -name %1 -nameserver %DNS1% | |
# kermit, with the raspberry pi as a Linux shell | |
I used the ctmouse mouse driver included with FreeDOS. I also | |
configured mouse copy and paste using the "clip" package. | |
gopher://tilde.pink/1/~bencollver/files/dos/util/clip/ | |
Here is the relevant section of my C:\FDAUTO.BAT | |
C:\FREEDOS\BIN\CTMOUSE.EXE | |
C:\UTIL\CLIP\WINOLDAP\WINOLDAP.COM | |
C:\UTIL\CLIP\MOUSCLIP\MOUSCLIP /B32767 | |
I click and drag the left mouse button to select text, and i | |
right-click to paste text. This works at the command prompt and also in | |
MS-DOS kermit. | |
I use MS-DOS kermit in two ways: | |
* Kermit file transfers (works best at full speed) | |
* Kermit terminal emulator (works best at 9600 bps) | |
# Kermit file transfers | |
Kermit can change the DOS serial port speed. The getty program can | |
change the Linux serial port speed. If i am already logged into | |
Linux, then i will need to exit to the login: prompt in order to | |
return control to getty, so it can change the speed on the server. | |
[C:\] MS-Kermit>set speed 115200 | |
[C:\] MS-Kermit>connect | |
I press Enter on the keyboard. If i see gibberish instead of a login: | |
prompt, i press Alt-B to send a break. This triggers getty to toggle | |
the Linux serial port speed. Once i get a login: prompt, then i log | |
into a shell. I can use the "stty" command to verify the Linux server | |
serial port speed. | |
At the Linux shell, i run "ckermit" to start the ckermit server. Then | |
i press Alt-X to escape to the MS-DOS kermit prompt. At this prompt i | |
can use the "remote dir" command to get a list of Linux files, "get" | |
to get files from Linux, and "send" to send files from DOS. | |
When i am done transfering files, i type "c" and enter to return to | |
the ckermit server prompt, then i type "q" and enter to quit back to | |
the Linux shell prompt. | |
# Kermit terminal emulation | |
Kermit terminal emulation is a little quirky at 115200 bps speed. | |
I frequently needed to press Alt-R to reset the terminal emulator, | |
then Ctrl-L to redraw the screen. The terminal emulation seems more | |
reliable and stable at 9600 bps. | |
If i am logged in, then i will need to exit to the login: prompt in | |
order to return control to getty, so it can change the speed on the | |
server. | |
[C:\] MS-Kermit>set speed 9600 | |
[C:\] MS-Kermit>connect | |
I press Enter on the keyboard. If i see gibberish instead of a login: | |
prompt, i press Alt-B to trigger getty to toggle the Linux server | |
serial port speed. Once i get a login: prompt, then i log into a | |
shell. I can use the "stty" command to verify the Linux server | |
serial port speed. | |
## Copy / paste text from a DOS file | |
Suppose i wish to copy a snippet into Linux from the C:\FDAUTO.BAT | |
file on the DOS machine? I have list.com in my path to view text | |
files. First, i press Alt-X to exit to the MS-DOS kermit prompt, then | |
i use the run command, like so: | |
[C:\] MS-Kermit>run list.com C:\FDAUTO.BAT | |
I navigate to the desired section and drag the left mouse button to | |
select text. I press the Esc key to quit back to the MS-DOS kermit | |
prompt. I type "c" and the Enter key to return to Linux. Then i | |
click the right mouse button to paste the text. | |
## Input Unicode characters | |
MS-DOS kermit doesn't support multi-byte character sets. | |
Alpine Linux with MUSL libc supports two character sets: | |
* UTF-8 | |
* C | |
The C character set is 8-bit clean and single-byte. So simple! | |
I added the following snippet to my ~/.profile | |
if [ "$TERM" = "vt100" ] | |
then | |
# probably kermit | |
export CHARSET=C | |
export LANG=C | |
fi | |
Then i configured mskermit | |
[C:\] MS-Kermit>set translation input off | |
Input Translation is off | |
[C:\] MS-Kermit>set terminal character-set transparent | |
[C:\] MS-Kermit>set terminal display 8-bit | |
[C:\] MS-Kermit>connect | |
Now i can enter CP437 data into the shell. My PC has standard BIOS, | |
so i can enter the degree symbol by holding down the Alt key, | |
pressing 2, 4, 8 on the number pad, then releasing the Alt key. | |
After i enter this data into a file, then i can convert it to | |
UTF-8 using iconv. | |
$ awk 'BEGIN {printf "Preheat oven to 350%cF.", 248}' >test.cp437 | |
$ file test.cp437 | |
test.cp437: ISO-8859 text, with no line terminators | |
$ iconv -f CP437 -t UTF-8 test.cp437 >test.txt | |
$ file test.txt | |
test.txt: Unicode text, UTF-8 text, with no line terminators | |
Note that test.cp437 is actually CP437 data, even though the file | |
command reports ISO-8859. When editing test.cp437 with busybox vi, it | |
will display a "." placeholder instead of the degree symbol. The "ed" | |
editor will faithfully display the degree symbol. | |
One advantage of this method is that it seamlessly integrates with | |
normal DOS methods of character display and input. One disadvantage | |
is that it can only represent characters that exist in CP437. For a | |
more capable workaround, i can use my modified version of UTF8TOCP. | |
gopher://tilde.pink/1/~bencollver/files/dos/util/utf8tocp/ | |
p.s. | |
While i can use my CHARSET=C workaround at the shell, it won't work in | |
tmux because tmux simply won't support CP437. GNU screen can be | |
configured to do CP437, but it has bitrot and other issues. I will | |
use utf8tocp within tmux. For example, if i want to represent a | |
Unicode degree symbol: | |
$ echo "Preheat oven to 350\u00B0F." >test.enc | |
$ utf8tocp -r 437 test.enc >test.utf8 | |
$ utf8tocp 437 test.utf8 >test.cp437 | |
The \u00B0 represents the UTF-8 codepoint 00B0 for a degree symbol. | |
The test.enc format is easy to edit in any editor. Both the calvin | |
editor in DOS and the xvi editor in Linux display test.utf8 in the | |
same way: | |
Preheat oven to 350\302\260F. | |
The \302\260 represents octal escape sequences for the two bytes in | |
a UTF-8 encoded degree symbol. | |
tags: bencollver,retrocomputing,technical,unix | |
# Tags | |
bencollver | |
retrocomputing | |
technical | |
unix | |