NET and BM ported to the Atari ST

by R.E. Janssen, PE1CHL.

The NET and BM programs have been ported to the Atari ST series 
of computers.  All models of the ST series (260, 520, 1040 and 
MEGA) are basically the same, and the programs should run on all 
versions, both with TOS in RAM, and the original or the "blitter 
TOS" in ROM.  The programs have been compiled using Mark Williams 
C version 2.1.7.  Other compilers require quite some changes to 
many modules, so I recommend sticking with MW if you want to 
recompile the package.


Changes made when porting to the Atari ST

-    Because the Atari ST is sold with the GEM Desktop as the 
     primary user interface, no "standard" command processor 
     exists that can be called from NET and BM when a subshell is 
     requested.  However, several command processors exist, both 
     available commercially and in the public domain.  Therefore, 
     a variant of the "shell" command has been implemented in 
     NET, that allows you to set the pathname of the program to 
     be executed as a command processor.  The syntax is:

          shell =pathname

     This statement can be included in the autoexec.net file. 
     Example:

          shell =c:\toolkit\command.tos

     No equivalent syntax has been built in BM, I thing the 
     configuration file access routines should be made somewhat 
     more sophisticated, before adding too many optional 
     reconfiguration commands.  Work still to be done...

-    This implementation only knows about "asy" hardware.  2 
     ports are defined, one being the RS232 serial port, and the 
     other the MIDI serial port.  Both can be used for KISS or 
     SLIP links.

     The RS232 port can be attached with:

          attach asy 0 0 ax25 ax0 2048 256 9600

     This attaches the port for ax25 (KISS) operation, as device 
     ax0, with a 2048byte buffer, an MTU of 256, and a baudrate 
     of 9600 bauds.
     The RS232 port is accessed using "hardware address" 0.  This 
     does not represent the physical location of the chip, but 
     rather the device number used in the Atari Iorec() call...
     Valid baudrates are 300, 600, 1200, 1800, 2000, 2400, 3600, 
     4800, 9600 and 19200 bauds.

     The MIDI port can be attached with:

          attach asy 2 0 ax25 ax1 2048 256 9600

     This port uses the same parameter structure as the RS232 
     port attach command.  The "hardware address" is 2.
     Some restrictions apply to the usage of this port:

     -    The baudrate is only settable to 7812 or 31250 bauds. A 
          simple hardware modification makes it possible to 
          change this to 9600 or 38400 bauds, but the software 
          can't tell the difference, so it will blindly accept 
          all 4 mentioned values for the baudrate, assuming that 
          you installed the mod if you specify 9600 or 38400.

     -    Of course, the interface on this port is a 5mA current 
          loop, so you will need an external conversion circuit 
          if you want to connect this to an RS232 TNC.  Please 
          note, that "current ON" on the midi port corresponds to 
          a positive voltage on the RS232 pins, this is reverse 
          from "normal" current loop operation as used with 
          teleprinters and the like.

     -    The transmit routine on this port does not use 
          interrupts, but it busy-waits for each character in a 
          frame.  This is because the interrupt handler for the 
          serial chip used on MIDI is shared with the 
          keyboard/mouse interrupt handler, and it does not 
          support transmitter interrupts....

     The MIDI port CAN be used to link two STs using SLIP, and no 
     hardware mods are necessary.  Only connect 4 wires between 
     the MIDI ports on the machines (from MIDI IN to MIDI OUT and 
     vice versa) and use the following attach command:

          attach asy 2 0 slip sl0 4096 576 31250

-    End-of-line conventions.  Some extra work has gone in 
     attempts to correct the end-of-line sequences generated by 
     the RECORD commands form AX.25 and TELNET, and the ASCII 
     type file transfer from FTP.  As observed by Phil, the whole 
     mess of CR/LF handling has been neatly avoided by UNIX, but 
     we poor souls using MS-DOS (or Atari TOS) need to solve the 
     problem in some way.  On the Mark Williams compiler for the 
     ST, the default open mode for files is "text mode", and in 
     this case all \n characters get translated to CR/LF pairs in 
     the file, and vice-versa.  This means that writing CR/LF in 
     text mode results in CR/CR/LF in the file.  You can open the 
     file in "binary mode" (using "wb" in the fopen call), and 
     the characters will be written untranslated.  This seems to 
     be more like the behaviour of Aztec C, so I used the binary 
     mode as a temporary fix for the problems with RECORD mode, 
     but this should really be fixed in the code at the 
     appropriate place.  I did some work in the code for AX.25 
     mode, but commented it out for now.  The TELNET code still 
     needs to be converted.  IF you want to get this correct in 
     the UNIX version, it should be fixed because UNIX does not 
     know about "file modes" and always writes what you tell it 
     to write...

-    BM file naming conventions have been changed to allow use of 
     the program on non-DOS environments, using the same approach 
     as in the NET program (871225 release).  Module "files.c" is 
     now also used by BM, and in defines all filenames and 
     directory names used in the program.  The bm_rc[] definition 
     has been added for this purpose.  Please note, that 
     directory names also include the trailing \ or / character, 
     this is because the separator character used differs between 
     DOS, UNIX and Atari TOS.  This also means that the syntax of 
     the "smtp" command in the BM.RC file has changed, it now 
     should also include the trailing separator.  In fact, the 
     smtp command is not really necessary because the default 
     value is now equal to the value used by NET.

-    DIRUTIL.C has been revised to run on both MS-DOS and Atari 
     TOS, and some cleanup has been done on the code.  Now, it is 
     possible to define the character used to separate the digits 
     in large numbers, by compiling with -DTHSEP="'.'"

-    BM now uses NET's version of DIRUTIL.C.  This module could 
     be split up to avoid inclusion of directory print routines.

-    An extra option has been added to BM.RC:

          tz TIM

     sets the timezone used in date/time strings produced by BM.  
     This was necessary because no standard way has been defined 
     to add values to the top-level environment of the ST 
     operating system, so the getenv() would always fail if you 
     started BM from the desktop.  Now, you can define your local 
     timezone in BM.RC (should be 3 characters, e.g. GMT, WET).

-    Changes were made to GLOBAL.H because of bugs in the Mark 
     Williams C compiler:
     
     -    the construct 'x >> 16' confuses the optimizer, 
          therefore the hiword define has been changed to a 
          function, and the shift is coded differently in this 
          function (atari.c)

     -    the compiler doesn't like void pointers to be further 
          typecasted. (as in: (struct mbuf **) (void *) 0)
          therefore, the general purpose pointer has been changed 
          to char * type.

-    STILL EXPERIMENTAL: Desktop accessory version
     I'm working on a version of NET that can run as a desktop 
     accessory on the ST.  The code is included with this 
     version, and can be comiled by defining the GEMDESK 
     preprocessor symbol. An entry in the makefile, NET.ACC, 
     provides for this.  The resulting program still has some 
     problems.  Be careful when running programs with NET.ACC in 
     the background...
     The accessory version defines a window that can be popped up 
     by selecting the entry in the Desk menu.  It will also be 
     popped up automatically when the NET program prints a bell, 
     usually when a new connection comes in.
     The file search algorithm is different from the TOS version: 
     on startup, after a 5 second delay to allow other programs 
     to initialize, the program searches the drives looking for a 
     file \NET\AUTOEXEC.NET, and assumes the drive on which this 
     file is found will also contain all other files. (This 
     mechanism is only used on hard-disk systems).
     One of the problems of the accessory version is that the 
     current directory will be changed when the foreground 
     program does a Dsetpath function, and you may confuse the 
     foreground program when you change directory in the 
     accessory.  This is because only one 'current directory' is 
     kept in the system.



Installation on an Atari ST

The Atari ST implementation assumes the following directory 
structure:

On the disk (any disk- can be floppy, harddisk or RAMdisk) a 
directory named "net" must be created directly under the root 
directory.  This directory contains:

\net:
autoexec.net        - NET configuration file
bm                  - (directory containing sources for BM)
bm.rc               - BM configuration file
bm.tos              - the BM program
des                 - (directory containing DES sources)
doc                 - (directory containing documentation)
ftpusers            - FTP configuration file
hosts.net           - IP configuration file
mail                - directory for incoming mail
mbox                - (default mailbox file for BM)
mqueue              - directory for outgoing mail
net.log             - (NET logfile)
net.tos             - the NET program
rqueue              - directory used for mail routing
src                 - (directory containing NET sources)
tmp                 - directory for temporary files

Items in parentheses are optional, or will be created 
automatically when you run the programs.  The contents of the 
mentioned directories are:

\net\bm:
bm.h                - BM sourcefiles
bmutil.c            -
header.c            -
header.h            -
main.c              -
makefile            -
send.c              -
version.c           -
+ objectfiles, when the package has been compiled

\net\des:
... DES sourcefiles and uuencode/uudecode ...

\net\doc:
... Documentation files ...

\net\mail:
yourname.txt        - created by SMTP server for incoming mail

\net\mqueue:
sequence.seq        - sequence number for outgoing mail, 
                      maintained by BM

\net\src:
... Sources for NET ...

\net\tmp:
... Tempfiles created here, any files remaining after exit from 
    NET and BM can be removed ...



Changes to the above directory structure can be made only when 
the NET sourcefile, files.c, is edited, and everything is 
recompiled.
To install the package on a disk, make all mentioned directories 
(e.g. using the "New Folder" command on the desktop), and copy 
the files in the proper directory.
To run NET or BM, double-click on the icon, or type NET or BM 
while in some command processor.  When using a command processor, 
make sure the current disk is the disk on which the \NET 
directory can be found.




Example configuration file AUTOEXEC.NET, used on my own machine

[ now distributed as some separate files ]

Example BM.RC from my machine

; configuration file for Bdale's Mailer...
host pe1chl.PA_UTnet.ampr
user rob
fullname R.E. Janssen (PE1CHL)
reply rob@pe1chl
edit c:\toolkit\tempus.prg
; smtp d:\net\mail\
maxlet 100
tz WET

