A MACRO-11 assembler for the PDP-11 in portable C source code.

Copyright (c) 2001, Richard Krehbiel
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

o Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.

o Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.

o Neither the name of the copyright holder nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

modified 2009 by Joerg Hoppe,
modified 2015 by Olaf 'Rhialto' Seibert.

Files:
    macro11.c       Command line parsing and driving the passes.
    assemble.c      Handles all of the opcodes and directives.
    assemble_aux.c  Helper functions mostly called from assemble().
    assemble_globals.c Global variables for assemble().
    extree.c        Expression tree: memory management and evaluation.
    listing.c       Listing generation.
    macros.c        Define macros and make them available as stream2s.
    parse.c         Basic parsing for numbers, labels, strings, expressions
    rept_irpc.c     stream2 subclass for processing .REPT and .IREPT.
    object.c        Functions for writing RSX-11 compatible .OBJ files.
    mlb-rsx.c       Classes (!) for reading RSX-11 macro libraries.
    mlb.c           Classes (!) for reading RT-11 macro libraries.
    stream2.c       Functions for managing input streams and buffers.
    rad50.c         Functions for converting text to and from RAD50.
    util.c          A few general utility fuctions.

    macro11.h, object.h, mlb.h, stream2.h, rad50.h, util.h
                    types and symbols exported from the associated sources.

    dumpobj.c       A program I wrote to examine the output from
                    RT-11's MACRO.SAV program and compare it with my
                    own output.

    Makefile        A GNU makefile for Linux; simple enough, it
                    should be convertible to any Unix.
                    Contains automatic dependency generation.

    macro11.dsp, dumpobj.dsp, macro11.dsw
                    Visual Studio 6 projects. Out of date.

    README          This file

    LICENSE         The copyright notice and license

    CHANGES         A list of changes from previous versions

    TODO            A list of things that may need fixing


Notes:

Sorry, I am a believer in 4 column hardware tabs, for a number of
reasons, mostly regarding editing convenience.  (I did untabify this
README file though.)

The bulk of Richard's development was done in Microsoft Visual Studio 6,
but currently Olaf maintains it using a Unix (NetBSD) system. I build
with gcc and a lot of warning options, and from time to time check with
a Linux system which has a different gcc version, and clang. The Visual
Studio project files are out of date.

Richard used the MACRO11 from RT-11 as reference, but I use the one
from RSX-11M+. It turns out there are some small file format
differences. I used the dumpobj command to compare the output of this
macro11 with the reference version when assembling Kermit-11 source
files, and currently there seem to be no significant differences.

The macro11 command line:

macro11 [options...] files...

Options:
    -v              Prints program version.

    -e opt          .ENABL option.  Implemented options are AMA, GBL,
                    and also .LIST options ME, BEX, and
                    MD, though the status of listing control is
                    presently very poor.

    -d opt          .DSABL option; same options as -e.

    -m macname      Gives a macro library name.
                    Up to 32 macro libraries may be specified, one per
                    -m option.
                    Note: unlike MACRO.SAV, SYSMAC.SML is not
                    automatically included; you must name it.

    -p macpath      For any .MCALL <macro> directive, macro11 will
                    first search -m macro libraries, then it will
                    search the MCALL path for a file named <macro>.MAC
                    to locate the body of the macro.  The MCALL path
                    is an environment variable containing directory
                    names separated by delimiters (":" for Unix-style
                    targets; ";" for Windows).  The -p command line
                    options appends a directory name to the MCALL
                    path.

    -I incpath      For any .INCLUDE <file> directive, macro11 will
                    search the INCLUDE path for a file named <file>
                    to include. The INCLUDE path works like the MCALL
                    path. If not specified at all, the default is the
                    current directory.  If <file> contains a drive
                    and/or directory in RSX/RT-11 form
                    (DEV:[DIR]FILE.EXT) then the search is also tried
                    without DEV: and without DEV:[DIR].

    -o objname      Gives the name of the object file.  No extension
                    is assumed; if you want .OBJ you have to say it.
                    With no -o option, no object file is generated.

    -l lstname      Gives the name of a listing file.  The name "-"
                    may be given to write the listing to stdout.  No
                    extension is assumed; if you want .LST you have to
                    say it.  With no -l option, no listing file is
                    written.

    -x              Tells macro11 not to assemble anything, but rather
                    to simply extract all the macros in all the -m
                    macro libraries into individual .MAC files in the
                    current directory.  This should be the last option
                    given, as none following will be processed.
                    This also works for extracting an object library
                    (.OLB) file.

    Various options starting with -y enable extensions:

    -ysl <num>      Allow longer symbols up to the given length.
                    The maximal allowed value is 64.

    -yus            Allow underscore in symbol names.

    -yl1            Include the processing of the first pass in the
                    listing file. This may be useful for finding
                    phase errors.

    files...        Any number of input files.  They will be assembled
                    as if they were concatenated together.


You may define the MCALL and INCLUDE environment variable prior to
invoking macro11, as a path to directories containing macros or files to
be included, respectively.
