Part I | Required Components | (SubRef: 1) |
Part II | RS232 Adapter Instructions | (SubRef: 2) |
Part III | Setting up the LINUX box | (SubRef: 3) |
Part IV | Setting up the Commodore BBS program | (SubRef: 4) |
Part V | What's missing | (SubRef: 5) |
Part VI | Credits | (SubRef: 6) |
USER PORT STD. DB9 COM NULL DB9 COM CABLE CABLE | +------\ | | | 2 | \ 3 | | M -|------------------| U1-A O-------|- 2 TX ----------|- 3 RX | | / | | | +------/ | | | \ | | | | \ | | | 3| \ 4 4+------\ | | D -|---|U3-B O----+---| \ 6 | | | | / | 5| U1-B O-------|- 7 RTS ----------|- 8 CTS | | / +---| / | | | / +------/ | | | | | | \ | | | | \ | | | 5| \ 6 9+------\ | | E -|---|U3-C O----+---| \ 8 | | | | / | 10| U1-C O-------|- 4 DTR ------+---|- 6 DSR | | / +---| / | | | | / +------/ | | | | | | | | | | | | / | | | B -|---+ / | | | | | | 3 / | 1 | | | C -|-----------------O U2-A -----------|- 2 RX ------|---|- 3 TX | \ | | | | | \ | | | | | \ | | | | | | | | | | | | | | | | / / | | | | / | / | | | | | 10 / |11 6 / | 4 | | | L -|----O U3-E ------O U2-B -----------|- 6 DSR ---+ +---|- 1 DCD | \ | \ | | | | | \ | \ | | | | | \ \ | | | | | | | | | | | | / / | | | | / | / | | | | | 12 / |13 8 / | 10 | | | K -|----O U3-F ------O U2-C -----------|- 8 CTS ---|------|- 7 RTS | \ | \ | | | | | \ | \ | | | | | \ \ | | | | | | | | | | | | / / | | | | / | / | | | | | 8 / | 9 11 / | 13 | | | H -|----O U3-D ------O U2-D -----------|- 1 DCD ---+------|- 4 DTR | \ | \ | | | | \ | \ | | | | \ \ | | | | | | | | N -|-----------------------------------|- 5 SIG GND ----------|- 5 | | | | +5V | | 2 -|----+------------+ +------|- PROTECTIVE GND --------|- | | | | | | | | | | | | | --+-- 0.1uF | ------- | | | --+-- 10V | --- | | | | | - | ********************************* A -|----+ | | * * | | | | * U-1 1488 RS-232 XMTR * | ------- | 14 +----+ 7 | * * | --- +----| U2 |--+ | * U-2 1489 RS-232 RCVR * | - | +----+ \ | * * | | \ | * U-3 7404 HEX INVERTER * | | 14 +----+ 7\ | * * | +----| U3 |--+ | * DIODES SIGNAL DIODES * | |\ | +----+ | | * WILL WORK HERE * | | \| | | * * 10-|----| |---+--------+ | | * NOTE: THE RS-232 VOLTAGE * | | /| + | | ------- | * BE APPX +/- 10 VOLTS * | |/ | --+-- | --- | * WHICH IS OK TO USE * | 100uF --+-- 14 | - | * PER RS-232 STANDARD * | 15V | +--|--+ | * * | | | | 7 | * * | ------- | U1 +----+ | ********************************* | --- | | | | | - +--|--+ | | | 1 | ------- | | | --- | | 120uF | - | | 15V | /| | | ********************************* | +|| |/ | | | * * 11-|--||----+---| |----+----+ | * Commodore User Port to RS-232 * | || | |\ | | | * Adaptor designed by Stephen * | | | \| | | * Coan, Version 2, 03-NOV-83. * | | | | * * | -------- 100uF ---+--- | * This general design has also * | \ / 15V ---+--- | * been used in other devices * | \/ + | | * where a negative voltage was * | -------- | | * not available for the RS-232 * | | | | * * | | | | * The user port is a 44 pin * | +-------+----------+ | * edge connector and the PC COM * | | | * port is a female DB 9 (as on * | | | * on a joystick) * | ------- | * * --- | * * - | * * | * * | ********************************* | |
You'll want to follow the instructions for the NULL modem cable for the sake of this project, so use the pin settings on the right hand side.
The first step will be to create the above shell "new_minicom" and its accompanying configuration "cua0".
new_minicom -l -o cua0 (or cua1 for com port 2)The next step is to create the BBS "user."
bbs::504:100:bbs:/home/bbs:/usr/bin/new_minicom -l -o cua0
If you are using com 2, change the shell command to read "cua1" instead of cua0.
Now that you're frightened, you'll be glad to know that the necessary files are available at:
147.26.162.107in the "lib" subdirectory.
The only files you'll really need are "new_minicom", which must be copied to your /usr/bin directory, and the file "wb.rc" (discussed below), which must be copied to /home/bbs. Also available is the file "newminicom.zip" which contains all the modified source code.
The following changes, to the best of my memory, were made:
chmod +r /dev/cau0 (or cua1) chmod +w /dev/cau0 (or cua1)Read and execute abilities can be added to minicom similarly:
chmod +x /usr/bin/new_minicomNow you're done, right? No, but the last step requires a bit of explanation. Our telnet session is maintained because we have an actual user logged on and running a program. Should this user disconnect themselves from their telnet session without logging off, we are actually left with an open session of new_minicom still running in LINUX. Normally we wouldn't care, except that so long as new_minicom is running, the com port is protected from use, such that the system will be eternally busy! What we need to do then is to have a shell script, with root privileges, that will keep an eye on copies of new_minicom running without a telnet daemon connection. The following shell script will do that.
From the /home/bbs directory, create the file "wb.rc" (I call it the watch-boy) and enter the following lines:
set temp=1 while (temp=1) do pid=`ps -auxg | grep 'new_minicom' | grep -v 'grep' | grep 'bbs' \ | grep '?'| awk '{print $2}'` tty=`ps -auxg | grep 'new_minicom' | grep -v 'grep' | grep 'bbs' \ | grep '?' | awk '{print $7}' | grep '?'` if [ 'expr $tty : "?"' ] then kill -9 $pid fi sleep 60 done[!NOTE!: The two lines with the backslash (\) are extensions of the prior lines. For instance, the characters "| awk '{print $2}'`" should immediately follow the end of the line that reads "...grep '?'". Do not include the backslashes!]
What this actually does is to look for occurrences of "new_minicom" being run by a user called "bbs" in which there is no terminal connection. It then kills those processes and goes to sleep for awhile before checking again.
This file can also be downloaded from 147.26.162.107 in the "lib" subdirectory.
Last thing to do then is to activate the watchboy by adding the following line to the file /etc/rc.d/rc.local /home/bbs/wb.rc &
You can start up the watch boy as root without rebooting the machine, but the above will make sure it is started up whenever the LINUX box is restarted.
Now on to the Commodore side.
You'll first want to select the BBS program to work with. Make sure it is one that is written in BASIC so that you can modify it easily. The BBS should also support ASCII, and preferably ANSI as well. For the time being, ANSI is the only way we'll get any color at all out of LINUX. The BBS program should support 2400 baud through the modem port. If not, you'll need to lower the set baud rate in minicom above.
Detecting a connection is accomplished by simply watching the Data Carrier Detect line on the modem port. That will be bit 4 in location 56577. When the following BASIC condition becomes true, the BBS should go online:
(peek(56577)and16)=16The BBS program should go online by swinging its Data Terminal Ready signal high. This can be done with the following: poke56577,6:poke56579,6
The BBS program should hang up whenever it detects the Data Carrier Detect line go low. That's done with something similar to the peek above:
(peek(56577)and16)=0Lastly, the program will hang-up by doing two things. The first thing is to tell minicom to terminate. This is done by the following:
print#2,chr$(1);chr$(2);chr$(3);chr$(4);
Where print#2 is above you should substitute the proper modem channel for the number 2.
The second is to drop the Data Terminal ready signal by entering:
poke56577,0:poke56579,32If the BBS program does all these things, it will perform admirably.
The other problem concerns time lag. Normally, lag is unimportant, but some transfer protocols are now especially sensitive to lag time. For this reason, along with translation problems mentioned above and the sensitivity of minicom to its termination codes, make the operation of the stream transfer protocols on the telnet BBS impossible. Perhaps some modified uuencoding packet based protocol could be written and patched in to the BBS program. If any such solution presents itself, it will be pursued.
Last Updated: 1997-03-31 by Jim
Brain