DLX MULTI-LINE BULLETIN BOARD SYSTEM
Version 7.0

*********************
* Source Code Notes *
*********************

PUBLIC DOMAIN PROGRAM

The DLX programs and files, including the source code, are now public
domain.  This means that you may freely use it, copy it and modify
it, including for commercial purposes.  This is better than shareware
- there is no fee at all for using it.  You may use this code to
develop a modified DLX, or an entirely different BBS, or for whatever
purpose you like.  I have voluntarily surrended my copyright on it
and placed it in the public domain.

SOURCE CODE INSTRUCTIONS

*** Tools ***

I started writing DLX in 1985, using Microsoft Pascal and assembler.
The last version of Microsoft Pascal (Version 4.0) was released in
1988, so it's getting to be an old compiler now.  In addition, two of
the utility programs are written in C.  In order to build DLX and the
utility programs, you will need the following tools:

Microsoft Pascal 4.0
	This is the final version of the Microsoft "high" Pascal compiler.
	MS Pascal 4.0 is no longer made, so you will have to either find
	a used copy, or a dealer with a new copy still in stock.  The
	fact that it is no longer sold doesn't mean it's public domain,
	so please get a legit copy.  You need the 4.0 version; the
	earlier ones won't work.

	Now a logical question to ask is: Can I use Borland Turbo Pascal
	instead?  Alas, the dialects of Pascal are different and so it
	won't work.  Likewise, Microsoft Quick Pascal won't work either,
	because	it uses a dialect similar to Turbo Pascal.  Could it be
	translated?  I'm sure it's possible in principle but you'll have
	to do the work (not me!).

	When you install Pascal, I suggest that you override the defaults
	and install the binaries in \PASCAL\BIN, the libraries in
	\PASCAL\LIB, the include files in \PASCAL\INCLUDE and so on,
	rather than in root \BIN, \LIB and \INCLUDE.  This will make it
	easier to manage multiple compilers on your hard disk.  Also,
	choose the "altmath" floating point library (libpasa) during setup.
	All MS Pascal 4.0 programs are "medium model" in C terms.

	The Microsoft Download Service (1-206-936-6735 modem) has a bug
	fix for MS Pascal 4.0 that fixes incorrect assignment of lstrings.
	The file is called SP0285.EXE.

MASM Macro Assembler
	Any recent version should work (5.1 or later), perhaps with a
	little tweaking.  The one I used for this release was MASM 6.11.
	I haven't tried TASM or OPTASM.  I have included the assembled
	.obj files in with the sources, so you don't have to buy a copy
        of MASM if you don't want to fool with the assembler sources.

C Compiler (optional)
	The C used for two of the utility programs is pretty generic and
	any C compiler should work.  The one I used for this release was
	Microsoft Visual C++ Version 1.5.  Unless you want to modify
	the two utility programs written in C (RNDB and RNTABS), you
	don't need to go out and buy a C compiler just for DLX work.

With two compilers and an assembler installed, it can be a problem
getting the environment variables set up right.  You may have to
experiment a bit for your particular situation.  Here is what I used:

    path c:\windows;c:\dos;c:\pascal\bin;c:\msvc\bin;c:\masm611\bin;c:\bin
    set include=c:\pascal\include;c:\msvc\include;c:\masm611\include
    set lib=c:\pascal\lib;c:\msvc\lib;c:\masm611\lib


*** How to build DLX ***

A makefile is included in the sources.  To build from it, just run
Microsoft's NMAKE or an equivalent program.  I used NMAKE version
1.40 for this release, but the version probably isn't important.
Don't use the MAKE.EXE program included in MS Pascal - that's a
different program altogether and would require a makefile of a
different format.

If you prefer to use a batch file instead of a makefile, you can run
BUILD.BAT.

Before you start modifying the source code, build the unchanged
sources and make sure that the resulting DLX.EXE that you get has the
same size as the one included in the ZIP file, and compares *exactly*
to it also.  This will ensure that you are starting out from the
right place.

The utility programs can be built using the batch file UTILS.BAT.
You will need a C compiler for two of the programs.  Build DLX itself
before you build the utilities, because the utilities use some of the
compiler modules from DLX.

*** How DLX Works ***

The main program, DLX.PAS, is essentially a round-robin scheduler.
It polls each modem line (and the keyboard) in sequence.  If it finds
any input or output data pending for that line, then the appropriate
routine is called.  Then it goes on to the next line.

The modem / serial communications routines in COM_PAX2.ASM include
custom interrupt handlers for conventional serial ports and for
Digiboard cards.  These interrupt handlers are unusual because they
not only capture incoming data, they also echo the incoming
characters back so that the main program does not have to.  They also
handle backspaces and tabs and echo the right things.  Doing this in
the interrupt handler makes every modem line seem "live" and
responsive at all times, even when the main program is busy doing
something else (like a DOS file operation) for another line.

The actions that DLX takes in response to input lines is governed by
the script files, SCRIPT0-5.PAS.  These files describe a kind of
state machine.  At all times, every modem line and the console is in
a particular state.  When a new input line of text comes in, the
script files are called with the current state and the new input
line.  The script files do their thing and leave the modem line in a
new state.

When adding code the SCRIPT* files, you must be careful how you use
variables.  Local variables will not be around from one state to the
next, so only use them to store values that will not be saved.
Global variables will stick around from call to call, but remember
there's only one copy, so things may appear to work when you test out
the program with just one person (yourself) online and then fail when
two or more people are online.  The proper way to store info in the
SCRIPT* files is to use the q or w arrays of structures.  There is a
q and w record for each telephone line and the console.

The other files are essentially collections of utility routines.
Here's a rundown:

DATABASE.PAS	Routines to access the members file and pubmail
DATAINIT.PAS	Routines to initialize various data
DLXINIT.PAS	Routines used when starting DLX (initializing modems etc)
DLXUTIL.PAS	Utility routines used by DLX.PAS
EXTNDH.ASM	Utility for more file handles in older MS-DOS versions
FS_PKG.PAS	Routines for reading and writing mail
FUNS.PAS	Ampersand codes
IDENT.PAS	Herald when DLX starts
KBD.ASM 	Routines to handle keyboard input
LOAD.PAS	Definitions of prompts
LOADINIT.PAS	Read in prompts, essay, etc.
NEWASM.ASM	Utility routines in assembler (1988 or later)
PASASM.ASM	Utility routines in assembler (old)
SUTILS.PAS	Utility routines for the SCRIPT* files
UTILS.PAS	General utility routines
XMODEM.PAS	XMODEM and XMODEM-1K code

Another way to approach DLX is to start with the data formats.  Read
the file TYPES.INT for all the basic types that DLX defines, then
read the file GLOBALS.INT for all the global variables that DLX
defines.

*** Compiler Limits

Some of the larger source module files are close to the maximum size
that Microsoft Pascal 4.0 can handle.  If you exceed the limit, you
start getting weird, unjustified syntax errors and the like.  The
only solution is to break up the large module into two or more
modules by using the MS Pascal module mechanism.

*** Linker Issues

DLX uses overlays to keep the amount of memory used by the code to a
minimum.  The code that is used only when starting up (dlxinit,
loadinit and datainit) is overlaid with running code when startup is
complete.  The overlay manager supplied with MS Pascal 4.0 is used.
This overlay manager will not work with all versions of the Microsoft
Link program, and it is safest to link DLX with the version of link
supplied with MS Pascal 4.0, namely Link Version 5.01.21.  DLX does
not use the newer MOVE overlay manager.

*** Missing Source Code

The sources to the utility programs MQSTATS.EXE and ULSTATS.EXE have,
unfortunately, been lost.
