README.Amiga
./driver3.2@242/hosts/amiga/README.Amiga · 16.3 KB
From the archive driver3.2@242.tar.gz
Download the archive « Back to the archive contents
adr32 - A port of Amylaar's LPMud to the Amiga
-----------------------------------------------------------------------------
adr32 is an implementation of Amylaar's variant of LPMud for the Amiga.
To run it you need at least 2 MB RAM and two floppies, more RAM and
a harddisk are highly recommended; a faster processor is not desperately
needed, but _very_ useful.
adr32 runs from shell only.
adr32's main purpose is to write and test LPC code at home.
It is able to do true net communication by using the AmiTCP package, but also
has provisions to simulate net communication by using Amiga message ports.
This way, multi-using the mud via serial lines is possibleat least (but
you would have to write your own clients and line watchers).
System Requirements
-------------------
To run the mud:
2 MB RAM at least
Harddisk, or at least two floppies
optionally a faster processor
optionally AmiTCP-2.0
To compile the mud:
more than 4 MB RAM
Harddisk
optionally a faster processor
Installation and Usage
----------------------
[ See also: 'Types of net communication' ]
To run adr32, you need the driver, a program to play mud (depending on its
communication method) and a mudlib.
Mudlibs are available via anonymous ftp (e.g. from ftp.cd.chalmers.se
or ftp.cs.tu-berlin.de).
- copy the appropriate driver (compat or native) to a decent place in your
command path.
- copy the mudlib into a directory, and assign 'mudlib:' to that dir.
Copy the additional files from the 'doc' and 'sys' directory to
'mudlib:doc' and 'mudlib:sys'.
The access check of the driver assumes to find the file 'ACCESS.ALLOW'
from the distributions 'mudlib' directory in the top directory of the
mudlib.
Amylaar's driver needs more functionality in the objects 'master.c'
and 'simul_efun.c', so if you are using a mudlib written for an other
LPMud driver, you'll have merge both included files into the existing
ones of your mudlib.
In case of an unmodified 2.4.5-lib, a simple copy of the supplied
'master.c' and 'simul_efun.c' into the directory 'mudlib:obj' should
suffice.
- assign 'swap:' to a non-ramdisk-directory. LPMud will put its swapfile
there when swapping out LPC code to preserve memory.
- set your stacksize to at least 50K.
To start the mud, simply run the driver. When the message 'setting up ipc'
is printed, the mud is ready for access.
When running, the mud recognizes following keypresses from the console:
Ctrl-C: shutdown all connections and stop the program.
Ctrl-E: abort the current query round for input (simulated net comm. only)
Ctrl-F: reload the master object.
To access the driver, use the program 'PlayMud' for simulated net communication
and a vanilla 'telnet' on 'localhost 8888' for true net communication.
Please note that Amylaar's gamedriver is an extension of the plain
gamedriver (see the DONE file), so existing mudlibs will need appropriate
patches in some places.
Especially with version 3.1.2k a new syntax for specifying rangelimits counted
from the end of the array is used: 'array[0..<4]' is now what 'array[0..-4]'
was before.
Types of net communication
--------------------------
The driver comes in two flavours concerning the network communication: True TCP
or Simulation. The simulation is the default mode in any driver: either the
driver knows nothing else, or it falls back into it if the external TCP
libraries can't be accessed. A nice sideeffect is the limitation on the number
of different binaries.
Simulated net communications:
Socket simulation uses the plain Exec MessagePorts, and is the default mode
if true TCP can't be setup.
It also simulates a bit hostname resolution, using a hardcoded hostname.
If you want to override that name, create a file 'etc:hosts'. Its first
line specifies the IP-Address and -Name adr32 will use, and has to look
like this:
49.34.56.93 amoeba
'etc:' has to be assigned to a directory suitable for miscellaneous files.
Putting this into assign into the system startup will also make programs
happy which use the ixemul.library.
To access the driver, use the 'PlayMud' access program which is distributed
with the driver. PlayMud already knows the drivers default port 8888.
Note: Under OS-1.3, simulated net communications are the only mode available!
True TCP:
This is implemented using the AmiTCP package version 2.0.
The query of the name server by the parallel 'hname' process is not yet
implemented.
If AmiTCP is properly set up, the driver will happily start up. It can then
accessed using any telnet on 'localhost', port 8888.
If AmiTCP is not running or not installed, the driver will fall back into
simulated net communications.
Note: AmiTCP needs at least OS-2.0 to run.
The drivers source has provisions for compilation for Commodore's AS225
package. Due to the lack of availability of the AS225 package, these
provisions are just there, but not supported.
Compiling
---------
Before compiling, check the definitions in 'config.h'.
The most important defines are:
COMPAT_MODE : define this for a compat mode driver.
PORTNO : the portnumber the driver will use (normally 8888).
MAX_COST : the max allowed cost of one single LPC-program thread.
True muds need about 10000000.
RESERVED_USER_SIZE:
the amount of memory reserved for clean shutdowns.
True muds should have >500K, for a simple Testmud 50K
should be sufficient.
RESERVED_MASTER_SIZE,
RESERVED_SYSTEM_SIZE:
additional reserved memory released to complete a shutdown.
MIN_MALLOCED : the initial workspace allocated on startup.
True muds should have 1M, for a simple Testmud 256K
should be sufficient (which is the granularity given by
smallocs large chunks anyway).
Where hosts/amiga/config.h as just a suggestion, you must use the hosts/amiga-
replacements for 'machine.h' and 'Makefile'. Copy them into into the main
directory prior to compilation.
Check the Makefile for compiler specials:
CCFAMILY : the family of the compiler (known so far: DICE)
WHATCC : the specific compiler, for subtle differences
(known so far: DICE206, DICE207)
NETTYPE : the type of net communications. When undefined, only
simulated net communications are compiled
(known so far: <undefined>, AMITCP, AS225)
To recompile then, just start your make utility and see your new
'driver' compile.
The Makefile has been written for Dennis Vadura's 'DMake', but should
be understood by any Unix-compatible make utility (the DMake of DICE
doesn't belong to that group!).
For compilation of the LPC parser you'll need BYacc (Berkeley Yacc) - the
GNU Yacc 'Bison' is not compatible enough.
Note that compiling on a plain Amiga using DICE takes about 4 hours,
up to 4 MB RAM (+ 1 MB temporaries) for the largest modules (interpret.c
and lang.c), and about 1.5 MB each for the others.
In the current version, the Makefile just knows DICE 2.06 and 2.07 as
compiler. Since DICE already implements many Unixisms on its own,
recompilation with other compilers might need some more patches in the
sources.
Compiling with DICE 2.06/2.07 and DMake 3.6:
DICE automatically defines AMIGA and _DCC.
interpret.c and lang.c contain switch-statements with more than 32K code,
but though the compiler uses the large code model, it compiles the
switches using short branches. This is hacked around by compiling the
source into assembler code, catching the error messages from an assembly
attempt and patching the erroreous branches in the asm-source into jumps.
Currently this has to be iterated thrice for interpret.c and twice
for lang.c.
The assembler sources of interpret.c and lang.c needs to be stripped from
comments to be assembled with not more than 5 MB RAM total.
DICE can't compile the statement 'if (<variable_expression>, <constant>)'.
Where this was used, an equivalent construct using && and || has been
used as replacement.
DICE has problems with interleaves of the switch() statement with other
control structures like blocks '{..}'.
DICE's preprocessor can't handle complex macro arithmetic.
DICE folds differences of constant pointers always into a zero difference.
DICE implements an alloca(), but needs special (dynamic) stack code for
this. Thus the compiler option -gs (or -gl, seems to be identical)
must be used.
When compiling for OS-1.3, single precision maths can't be used.
Therefore all floats are either typedef'ed into doubles or compiled
using FFP math. If the latter is the case, scanf() can't be used.
Porting Issues
--------------
Besides inserting a lot of #ifdef's, the following needed special care.
The driver assumes Unix-style filenames. In the port all file-functions
are forced to pipe their name arguments through a conversion routine,
which converts them into Amiga-style filenames.
The timer function alarm() had to be implemented. It was done using
the timer.device in conjunction with special task.exception_code.
Note that this exception code is called by the OS as interrupt code
with arguments in registers and A4 undefined.
In effect, a complete own signal handling has been implemented.
To avoid interferences with the system supplied by the compiler - especially
the checking for Ctrl-C - the code in amiga.c and signal.c has to overlay
the routines supplied by the standard libraries.
The crypt() function was implemented using the fcrypt() from the 'Crack'
package by Alec Muffet.
On some machine/compiler combinations fcrypt() has its problems, so the
equivalent crypt is also included and used by default.
The implementation of floats in the driver uses a special storage format
of 48 bits, which is then mapped onto the compiler's double format.
For the Amiga, the conversion from/to IEEE-double is simply done by
ignoring the last 16 bits of the mantissa.
Some compilers implement floating point math by using the OS' IEEE libraries.
This can cause problems when compiling for OS 1.3 since that version of
the OS don't have libraries for single precision math. If the compiler
doesn't provide special code to handle that situation,
the symbol _NO_OWN_FLOATS need to be defined, so any floats will be replaced
by doubles (OS 1.3 only).
Some of such compilers (like DICE) allow the replacement of float math
by ffp math. In that case leave _NO_OWN_FLOATS defined, but add the necessary
provisions to patchfloat.h.
The compiled source is modified by several of preprocessor symbols:
AMIGA :
Has to be defined for all the Amiga specifics.
_DCC, DICE206, DICE207 :
Encloses specials of the DICE compiler.
AMIGA_TCP :
Activates the code for true TCP communication.
AMITCP :
Has to be defined for AmiTCP-support. Mutual exclusive to AS225.
AS225 :
Has to be defined for AS225-support. Mutual exclusive to AMITCP.
_NO_OWN_FLOATS :
Has to be defined for compilers with no own single-precision float maths.
The Makefile offers these main targets (for macros see above):
driver :
Compiles and links the driver (default).
playmud :
Compiles and links the 'PlayMud' program.
clean :
Removes all rebuildable files.
osclean :
Removes all files containing OS-specific code.
netclean :
Removes all files containing communication-dependend code.
Simulated net communication
---------------------------
This simulation uses Amiga message ports: each socket is implemented by an
own port. This makes interfacing to adr32 easy, but limits the amount of
sockets (each socket-port allocates a task signal), and therefore disables
'true' net communication.
The driver opens a global messageport with the name "PORT_NUMBER" (where
PORT_NUMBER is the value defined in config.h) and waits at this port
for connect messages which contains the name of the port at which the client
will accept messages from the mud.
On arrival of a connect message, the driver will create a new messageport
with a unique name (e.g. "parser00004") at which it will accept messages from
the client. This name is replied with the connect message to the client.
All further communication is then carried out between these two ports.
Since the ports are defined by name and not by pointers, a restart of driver
or client is safe.
In contrast to the original implementation by E.v. Roode, a redefinition
of the FD-stuff (fd_set, FD_SET() etc.) is no longer necessary.
With version k the gamedriver is able to send and receive UDP packets, but
this is not simulated.
True TCP using AmiTCP
---------------------
Using AmiTCP is quite simple, since AmiTCP implements all those BSD-calls
the driver uses. You just have to link in the net.lib.
However, the gamedriver couldn't be allowed to call the AmiTCP-package
directly since if the package isn't running or not installed, the calls need
to be redirected to the simulating code.
To achieve this, hosts/amiga/socket_tcp.h defines macros for all socket
related calls which first check if the AmiTCP package could be accessed and
then dispatch approbiately.
The name server query is not (yet?) implemented, since the gamedriver uses
fork() to spawn off a separate process doing the lookup. This means you won't
get the ip names for incoming connections, just their numbers.
So far, the AmiTCP supports uses my own interface to the package. But chances
are that it will go into the official package... :-)
True TCP using AS225
--------------------
Contributed by Martin Brenner (Deepthought, the Nightfall Sourcerer):
True TCP communication is done via Commodore TCP/IP software AS225,
including 'socket.library'.
So far, TCP/IP seems to work, although certain network problems might not
be handled correctly by Commodore's software. I found one bug with the
socket function accept() not returning a correct error code when used
on a non-blocking socket. Name server query is not yet implemented.
The gamedriver uses fork() to spawn off a seperate process which does
the actual lookup. This means you won't get ip names, if you have your
Mud running on the Internet. Too Bad :-) Sending and receiving UDP
packets (imp) works (we have reimplemented the mudwho interface by
sending UDP messages from the mudlib in Nightfall).
Deepthought's implementation was modified to allow the same fallback into
simulation as the AmiTCP support does.
Note: The AS225 is not yet published by Commodore, and so the gamedriver just
offers the option to be compiled for it - it has not been tested yet!
PlayMud
-------
PlayMud is a simple program to access the running LPMud using simulated net
communication. To compile it just let your make utility make 'PlayMud'.
See 'README.PlayMud' for more informations.
This distribution contains only a subset of the original PlayMud distribution.
The complete PlayMud package is available via FTP, probably on the same servers
carrying ready-compiled gamedrivers.
Credits
-------
The simulated socket communication and the signal handling are developed
from the PD 'unix.lib' by Erik van Roode.
The first implementation of true TCP using AS225 was done by Martin Brenner.
Marge pointed out the problems of simple floats under OS 1.3.
John Fehr <umfehr06@ccu.UManitoba.CA> contributed for 'PlayMud' the stable
handling of 'No Echo' as well as the SAS/C specifics.
bod@mtek.chalmers.se spent a good deal of encouragement.
The AmiTCP group at hut.fi wrote the freeware TCP/IP implementation for Amiga.
Copyright
---------
The sources needed to port LPmud to Amiga are copyrighted by their
authors as mentioned in the sources or under 'Credits'.
Sources herein refers to the source code, and any executables
created from the same source code.
All rights reserved.
Permission is granted to extend and modify the sources provided subject
to the restriction that the sources may not be used in any way whatsoever
for monetary gain.
Permission is granted to use the sources as part of other programs subject
to the restriction that the sources themselves as well as their provided
additional functionality may not be used in any way whatsoever for
monetary gain.
In short: Give credit where credit is due, and don't make money from
sources not written by you.
Contact
-------
Lars Düning; Am Wendenwehr 25; D-38114 Braunschweig; Germany
Voice: (+49) 531/34 56 93; EMail: mateese@ibr.cs.tu-bs.de
Share and enjoy!
----------------