changeset 379:85b592c8b8f6

Removing old cruft that is no longer needed
author lost@starbug
date Mon, 26 Apr 2010 19:31:35 -0600
parents 1c31e9005ff7
children cc154dc614fe
files old-trunk/COPYING old-trunk/ChangeLog old-trunk/INSTALL old-trunk/Makefile.am old-trunk/README old-trunk/README.MAINT old-trunk/TODO old-trunk/autogen.sh old-trunk/configure.ac old-trunk/doc/Makefile.am old-trunk/doc/README old-trunk/doc/internals.txt old-trunk/doc/lwasm.txt old-trunk/doc/manual.docbook.sgml old-trunk/extra/README old-trunk/extra/ar old-trunk/extra/as old-trunk/extra/ld old-trunk/lwar/Makefile.am old-trunk/lwar/add.c old-trunk/lwar/extract.c old-trunk/lwar/list.c old-trunk/lwar/lwar.c old-trunk/lwar/lwar.h old-trunk/lwar/main.c old-trunk/lwar/remove.c old-trunk/lwar/replace.c old-trunk/lwar/util.c old-trunk/lwar/util.h old-trunk/lwasm/Makefile.am old-trunk/lwasm/lwasm.c old-trunk/lwasm/lwasm.h old-trunk/lwasm/main.c old-trunk/lwasm/old/expr.c old-trunk/lwasm/old/expr.h old-trunk/lwasm/old/insn_bitbit.c old-trunk/lwasm/old/insn_gen.c old-trunk/lwasm/old/insn_indexed.c old-trunk/lwasm/old/insn_inh.c old-trunk/lwasm/old/insn_logicmem.c old-trunk/lwasm/old/insn_rel.c old-trunk/lwasm/old/insn_rlist.c old-trunk/lwasm/old/insn_rtor.c old-trunk/lwasm/old/insn_tfm.c old-trunk/lwasm/old/instab.c old-trunk/lwasm/old/instab.h old-trunk/lwasm/old/list.c old-trunk/lwasm/old/lwasm.c old-trunk/lwasm/old/lwasm.h old-trunk/lwasm/old/lwval.c old-trunk/lwasm/old/lwval.h old-trunk/lwasm/old/macro.c old-trunk/lwasm/old/main.c old-trunk/lwasm/old/os9.c old-trunk/lwasm/old/output.c old-trunk/lwasm/old/parse.c old-trunk/lwasm/old/pass1.c old-trunk/lwasm/old/pass2.c old-trunk/lwasm/old/pragma.c old-trunk/lwasm/old/pseudo.c old-trunk/lwasm/old/symbol.c old-trunk/lwasm/old/util.c old-trunk/lwasm/old/util.h old-trunk/lwasm/pragma.c old-trunk/lwlib/Makefile.am old-trunk/lwlib/lw_mem.c old-trunk/lwlib/lw_mem.h old-trunk/lwlib/lw_value.c old-trunk/lwlib/lw_value.h old-trunk/lwlink/Makefile.am old-trunk/lwlink/expr.c old-trunk/lwlink/expr.h old-trunk/lwlink/link.c old-trunk/lwlink/lwlink.c old-trunk/lwlink/lwlink.h old-trunk/lwlink/main.c old-trunk/lwlink/map.c old-trunk/lwlink/objdump.c old-trunk/lwlink/output.c old-trunk/lwlink/readfiles.c old-trunk/lwlink/script.c old-trunk/lwlink/util.c old-trunk/lwlink/util.h old-trunk/m4/gnulib-cache.m4 old-trunk/misc/fileheader
diffstat 84 files changed, 0 insertions(+), 15892 deletions(-) [+]
line wrap: on
line diff
--- a/old-trunk/COPYING	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--- a/old-trunk/ChangeLog	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-The following includes the various changes in each release of LWTOOLS.
-
-Each item is prefixed by a flag in []. The flags mean:
-
-[*] Project structure or other "meta" change
-[!] critical bug fix - code generation error, etc.
-[+] new feature
-[-] feature removed
-[b] minor bugfix
-[ ] general improvement
-
-Also, the software affected may follow in [].
-
-Version 3.0
-
-[*] Completely new architecture
-[b] Fixed bug that caused segfault on pass 2 if bad expression [LWASM]
-
-Version 2.5
-
-[!] Fixed error in the fix for invalid operands included in 2.4 [LWASM]
-[b] Fixed bug with "include" directive operand parsing [LWASM]
-[b] Fixed additional parsing errors with pseudo ops [LWASM]
-[b] Fixed parsing error with various conditional nesting situations [LWASM]
-[+] Added includebin directive to include the literal contents of a binary
-    file at the current assembly address. [LWASM]
-[+] Added || and && as boolean or and boolean and respectively [LWASM]
-[+] Added COPY, COPY-, IMP, EXP, TFRP, TFRM, TFRS, TFRR as alternatives to
-    the TFM instruction variations for compatibility with other assemblers
-    [LWASM]
-[+] Added --6809/-9 switch to cause 6309 instructions to be rejected; also
-    included --6309/-3 switch to force default allow of 6309 instructions
-    [LWASM]
-[+] ALIGN now takes an optional padding value (ALIGN align,pad) to specify
-    the byte value that will be used for padding if needed [LWASM]
-[+] Added OS9 module target along with the OS9, MOD, and EMOD pseudo ops
-    to allow building OS9 modules [LWASM]
-[+] Added pragma "dollarlocal"/"nodollarlocal" and "dollarnotlocal"/
-    "nodollarnotlocal" to control whether $ localizes a symbol [LWASM]
-[ ] Fixed a few cosmetic issues with error reporting
-
-Version 2.4
-
-[!] Fixed off by one relocation offest for base page external references
-    generated by lwasm [LWASM]
-[b] Fixed segfault in "extern" pseudo op and allowed a symbol list as the
-    operand just like "export" [LWASM]
-[b] Fixed lack of error when there are extraneous characters at the end
-    of the operand. This did not cause incorrect code generation for correct
-    code but would silently generate incorrect code for some easy errors
-[+] 8 bit immediate operands can now be external references [LWASM]
-
-Version 2.3
-
-[*] added support for compiling using MinGW and added portions of gnulib
-    to support argp, among other things. Yah! A Windows build!
-[+] added library search path (-L) and library specification (-l) to LWLINK
-[+] added ability to specify section base addresses on the command line to
-    LWLINK (they get prepended to the built in link script)
-[+] added ability to output a "linkmap" to lwlink (--map, -m)
-[+] added LWEX0 (LWOS simple binary) target to LWLINK
-[+] added ability to extract files in LWAR
-[+] added ability to "replace" members in LWAR
-[+] added support for "sym=expr" in the opcode field; this will define a
-    global symbol (non-section) if it resolves to a constant
-[+] added operator ~ as a prefix operator for a 1s complement in LWASM
-[+] allow exporting multiple symbols (export sym,sym,sym...)
-[+] allow extern references in base page addresing mode, possibly buggy
-    still (LWASM)
-[+] handle 8 bit external references, possibly buggy still (LWLINK)
-[+] arranged for unused members of library files (archives) to be ignored
-    during linking to keep the final size of the binary down (LWLINK)
-[b] arranged for output files for lwasm/lwlink to be removed if the assembly
-    or linking fails
-[b] fixed incorrect handling of library search path which caused only the
-    last directory to ever matter
-[ ] DECB output of LWLINK now collapses contiguous output blocks into single
-    single blocks in the output file; this eliminates the explosion of
-    preambles that previously occurred
-[ ] LWLINK now displays *all* undefined symbols and references instead of
-    bailing out after the first one
-
-Version 2.2
-
-[*] created LWAR to manage library/archive files
-[+] cescapes pragma to allow C-style string escapes in FCC, FCS, and FCN
-[+] .area alias for SECTION
-[+] .globl alias for EXPORT; also accept name of symbol as operand
-[+] various compatibility directive aliases for FCB, FDB, FQB, RMB, FCC,
-    FCS, and FCN
-[+] accept "*" has a prefix for base page addressing mode
-[+] sections named "bss" or ".bss" in any case are now assumed to be
-    BSS sections. The "!bss" flag can be used to remove that assumption.
-[+] ignore lines starting with # to permit C pre-processor output to be used
-    as input to lwasm
-[+] allow "0x" and "0X" as prefixes to identify hexadecimal numbers
-[+] added support for a simple library/archive file format to LWLINK
-[b] actually show assembly errors when no list requested
-[b] pragma and --pragma now actually take multiple pragmas as documented
-
-Version 2.1
-
-[*] merged LWLINK (1.0) and LWASM to create LWTOOLS
-[+] [LWASM] pragmas can be specified on the command line
-[+] [LWASM] undefextern pragma added (undefined symbols treated as external)
-[+] documentation
-[b] [LWASM] made pragmas case insensitive
-[b] [LWASM] made EXTERN symbols never be part of a section in symbol table
-
-
-LWASM Version 2.0
-
-[*] major rewrite of the entire assembler
-[+] object file support
-
-
-LWLINK Version 1.0
-
-[*] initial released version
--- a/old-trunk/INSTALL	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007 Free Software Foundation, Inc.
-
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
-
-Basic Installation
-==================
-
-Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
-   It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
-   The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
-
-The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.
-
-     Running `configure' might take a while.  While running, it prints
-     some messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package.
-
-  4. Type `make install' to install the programs and any data files and
-     documentation.
-
-  5. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
-
-  6. Often, you can also type `make uninstall' to remove the installed
-     files again.
-
-Compilers and Options
-=====================
-
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
-
-   You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment.  Here
-is an example:
-
-     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
-
-   *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you can use GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
-   With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory.  After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
-
-Installation Names
-==================
-
-By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
-`--build=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
-     CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
-     OS KERNEL-OS
-
-   See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
-   If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
-produce code for.
-
-   If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-Variables not defined in a site shell script can be set in the
-environment passed to `configure'.  However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost.  In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'.  For example:
-
-     ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug.  Until the bug is fixed you can use this workaround:
-
-     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-`configure' Invocation
-======================
-
-`configure' recognizes the following options to control how it operates.
-
-`--help'
-`-h'
-     Print a summary of the options to `configure', and exit.
-
-`--version'
-`-V'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`--cache-file=FILE'
-     Enable the cache: use and save the results of the tests in FILE,
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
-     disable caching.
-
-`--config-cache'
-`-C'
-     Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`configure' also accepts some other, not widely useful, options.  Run
-`configure --help' for more details.
-
--- a/old-trunk/Makefile.am	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = lib lwlib lwasm
-DIST_SUBDIRS = doc lib lwlib lwasm
-EXTRA_DIST = m4/gnulib-cache.m4
--- a/old-trunk/README	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-This distribution constitutes the LWASM cross-assembler for the MC6809 and
-HD6309 microprocessors.
-
-All files that form a part of this distribution use the UTF8 character
-encoding method unless otherwise noted.
--- a/old-trunk/README.MAINT	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-This file is intended for source package maintainers/distributors.
-
-Before a release is made, a branch for that release must be made. Within
-that branch, all files that will be distributed with the particular release
-must be generated and added to the repository on that branch. Once the
-release is deemed stable and ready for release, the release tag should
-be generated from the head of that particular branch. Thus all release
-series will have the autotool generated files in the repository as well
-as any other generated files intended to be distributed.
-
-Any branch not directly intended to be a release need not include the
-generated files.
-
-The trunk development stream must not include the autotool generated files
-as these are likely to change rapidly and it can cause a great deal of
-confusion for little gain. Also, the main trunk need not contain such
-things as generated documentation files for the same reason.
-
-By including the generated files in the release branches, it is possible
-to replicate any problems users of the package may have, including if it
-is due to problems with the autotools themselves.
-
-
-Naming of branches and tags should conform to the following guidlines.
-
-1. any branch leading to a release series must be named as the base revision
-of the series. Thus, for a 1.0 release, the branch is called 1.0 and will
-contain the results for a 1.0 release, a 1.0.1 release, and so on. If a
-sub-release will occur, say under 1.0.1, then a branch named "1.0.1" would
-be created and then releases such as 1.0.1.1 would be created. This should
-be avoided if at all possible.
-
-2. any tag for a specific release version will be named as the release. So
-for a 1.0 release, the name would be "1.0". For version 1.0.1.1, the name
-would be "1.0.1.1".
-
-3. branches not associated with a release stream - say for feature development
-or what have you should be named sensibly and should be removed when no longer
-needed. They must not appear to be version numbers.
-
-4. tags not specifying a release must not look like version numbers
--- a/old-trunk/autogen.sh	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-#!/bin/sh
-# run this file to generate any auto-generated files
-gnulib-tool --update
-autoreconf -if
--- a/old-trunk/configure.ac	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-AC_INIT([LWTOOLS], [3.0-pre], [lost@l-w.ca])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign])
-AC_PROG_CC
-gl_EARLY
-# for gnulib
-gl_INIT
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([
-	Makefile
-	lib/Makefile
-	lwlib/Makefile
-	lwasm/Makefile
-])
-AC_OUTPUT
--- a/old-trunk/doc/Makefile.am	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXTRA_DIST = lwasm.txt internals.txt manual.docbook.sgml manual
-
-
--- a/old-trunk/doc/README	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-If there are no html files in the "manual" directory and there is no
-"manual.html" file, it means that you have either checked out the source
-repository on a non-release branch or the packager messed up.
-
-In either case, if you have "docbook2html" installed, you should be able
-to build the manual with one of the following:
-
-docbook2html -o manual manual.docbook.sgml
-
-or
-
-docbook2html -u manual.docbook.sgml && mv manual.docbook.html manual/manual.html
-
--- a/old-trunk/doc/internals.txt	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-LWASM Internals
-===============
-
-LWASM is a table-driven assembler that notionally uses two passes. However,
-it implements its assembly in several passes as follows.
-
-Pass 1 - Preprocessing & Parsing
---------------------------------
-
-This pass reads the source file and all included source files. It handles
-macro definition and expansion.
-
-As it reads the various lines, it also identifies any symbol associated with
-the line, the operation code, and, based on the operation code, the operand,
-if any. Upon examination of the operand, any expressions are stored in an
-internal postfix notation for later evaluation. During this pass,
-preliminary values are assigned to all symbols using the largest possible
-instruction size. A table of lines that reference every symbol is generated
-to be used in the following pass. Note that any symbols for which the value
-is known with no uncertainty factor will be generated with the smallest
-possible instruction.
-
-At this stage, simple optimizations are performed on expressions. This
-includes coalescing constants (1+2+x => 3+x). It also includes some basic
-algebra (x+x => 2*x, 2*x+4*x => 6*x, x-x => 0).
-
-Pass 2 - Optimization
----------------------
-
-This pass sweeps the code looking for operations which could use a shorter
-instruction. If it finds one, it must then re-define all symbols defined
-subsequently and all symbols defined in terms of one of those symbols in a
-cascade. This process is repeated until no more possible reductions are
-discovered.
-
-If, in the process of implementing an instruction reduction, a phasing error
-or other conflict is encountered, the reduction is backed out and marked as
-forced. 
-
-The following may be candidates for reduction, depending on assembler
-options:
-
-- extended addressing -> direct addressing (not in obj target)
-- 16 bit offset -> 8 bit offset (indirect indexed)
-- 16 bit offset -> 8 bit or 5 bit offset (direct indexed)
-- 16 bit offset -> no offset (indexed)
-- 16 bit relative -> 8 bit relative (depending on configuration)
-
-
--- a/old-trunk/doc/lwasm.txt	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-LWASM 2.0
-=========
-
-LWASM is a cross-assembler for the MC6809 and HD6309 CPUs. It should
-assemble most reasonable EDTASM compatible source code. This document is not
-intended to teach assembly language for these CPUs but rather to document
-the behaviour of LWASM.
-
-
-TARGETS
--------
-
-LWASM supports several targets for assembly. These are decb, raw, and obj.
-
-The raw target generates a raw binary output. This is useful for building
-ROMs and other items that are not intended to be loaded by any kind of
-loader. In this mode, the ORG directive is merely advisory and does not
-affect the output except for the addresses symbols are defined to have.
-
-The decb target generates output that can be loaded with the CLOADM or LOADM
-commands in Color Basic. There will be approximately one segment in the
-output file for every ORG statement after which any code is emitted. (That
-is, two ORG statements in a row will not generate two output segments.)
-This is approximately equivalent to running A/AO in EDTASM.
-
-The obj target generates output that is intended to be linked later with
-LWLINK. This target disallows the use of ORG for defining anything other
-than constants. In this target, source files consist of a number of sections
-(SECTION/ENDSECTION). Nothing outside of a section is permitted to cause any
-output at all. Use of an ORG statement within a section is an error. This
-target also permits tagging symbols for export (EXPORT) and marking a symbol
-as externally defined (IMPORT/EXTERN). The linker will resolve any external
-references at link time. Additionally, any inter-section references will be
-resolved by the linker. All code in each section is assembled with an
-implicit origin of 0. SETDP has no effect because the assembler has no idea
-what address the linker will assign to the code when it is linked. Any
-direct addressing modes will default to extended to allow for the linker to
-perform relocations. Intersegment references and external references will
-use 16 bit relative addressing but intrasegment internal references may use
-8 bit relative addressing. Forced 8 bit direct modes are probably an error
-but are permitted on the theory that the programmer might know something the
-assembler doesn't.
-
--- a/old-trunk/doc/manual.docbook.sgml	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1985 +0,0 @@
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.5//EN">
-<book>
-<bookinfo>
-<title>LW Tool Chain</title>
-<author><firstname>William</firstname><surname>Astle</surname></author>
-<copyright><year>2009</year><holder>William Astle</holder></copyright>
-</bookinfo>
-<chapter>
-
-<title>Introduction</title>
-
-<para>
-The LW tool chain provides utilities for building binaries for MC6809 and
-HD6309 CPUs. The tool chain includes a cross-assembler and a cross-linker
-which support several styles of output.
-</para>
-
-<section>
-<title>History</title>
-<para>
-For a long time, I have had an interest in creating an operating system for
-the Coco3. I finally started working on that project around the beginning of
-2006. I had a number of assemblers I could choose from. Eventually, I settled
-on one and started tinkering. After a while, I realized that assembler was not
-going to be sufficient due to lack of macros and issues with forward references.
-Then I tried another which handled forward references correctly but still did
-not support macros. I looked around at other assemblers and they all lacked
-one feature or another that I really wanted for creating my operating system.
-</para>
-
-<para>
-The solution seemed clear at that point. I am a fair programmer so I figured
-I could write an assembler that would do everything I wanted an assembler to
-do. Thus the LWASM probject was born. After more than two years of on and off
-work, version 1.0 of LWASM was released in October of 2008.
-</para>
-
-<para>
-As the aforementioned operating system project progressed further, it became
-clear that while assembling the whole project through a single file was doable,
-it was not practical. When I found myself playing some fancy games with macros
-in a bid to simulate sections, I realized I needed a means of assembling
-source files separately and linking them later. This spawned a major development
-effort to add an object file support to LWASM. It also spawned the LWLINK
-project to provide a means to actually link the files.
-</para>
-
-</section>
-
-</chapter>
-
-<chapter>
-<title>Output Formats</title>
-
-<para>
-The LW tool chain supports multiple output formats. Each format has its
-advantages and disadvantages. Each format is described below.
-</para>
-
-<section>
-<title>Raw Binaries</title>
-<para>
-A raw binary is simply a string of bytes. There are no headers or other
-niceties. Both LWLINK and LWASM support generating raw binaries. ORG directives
-in the source code only serve to set the addresses that will be used for
-symbols but otherwise have no direct impact on the resulting binary.
-</para>
-
-</section>
-<section>
-<title>DECB Binaries</title>
-
-<para>A DECB binary is compatible with the LOADM command in Disk Extended
-Color Basic on the CoCo. They are also compatible with CLOADM from Extended
-Color Basic. These binaries include the load address of the binary as well
-as encoding an execution address. These binaries may contain multiple loadable
-sections, each of which has its own load address.</para>
-
-<para>
-Each binary starts with a preamble. Each preamble is five bytes long. The
-first byte is zero. The next two bytes specify the number of bytes to load
-and the last two bytes specify the address to load the bytes at. Then, a
-string of bytes follows. After this string of bytes, there may be another
-preamble or a postamble. A postamble is also five bytes in length. The first
-byte of the postamble is $FF, the next two are zero, and the last two are
-the execution address for the binary.
-</para>
-
-<para>
-Both LWASM and LWLINK can output this format.
-</para>
-</section>
-
-<section>
-<title>OS9 Modules</title>
-<para>
-
-Since version 2.5, LWASM is able to generate OS9 modules. The syntax is
-basically the same as for other assemblers.  A module starts with the MOD
-directive and ends with the EMOD directive.  The OS9 directive is provided
-as a shortcut for writing system calls.
-
-</para>
-
-<para>
-
-LWASM does NOT provide an OS9Defs file. You must provide your own. Also note
-that the common practice of using "ifp1" around the inclusion of the OS9Defs
-file is discouraged as it is pointless and can lead to unintentional
-problems and phasing errors.  Because LWASM reads each file exactly once,
-there is no benefit to restricting the inclusion to the first assembly pass.
-
-</para>
-
-<para>
-
-It is also critical to understand that unlike many OS9 assemblers, LWASM
-does NOT maintain a separate data address counter.  Thus, you must define
-all your data offsets and so on outside of the mod/emod segment.  It is,
-therefore, likely that source code targeted at other assemblers will require
-edits to build correctly.
-
-</para>
-
-<para>
-
-LWLINK does not, yet, have the ability to create OS9 modules from object
-files.
-
-</para>
-</section>
-
-<section>
-<title>Object Files</title>
-<para>LWASM supports generating a proprietary object file format which is
-described in <xref linkend="objchap">. LWLINK is then used to link these
-object files into a final binary in any of LWLINK's supported binary
-formats.</para>
-
-<para>Object files also support the concept of sections which are not valid
-for other output types. This allows related code from each object file
-linked to be collapsed together in the final binary.</para> 
-
-<para>
-Object files are very flexible in that they allow references that are not
-known at assembly time to be resolved at link time.  However, because the
-addresses of such references are not known at assembly time, there is no way
-for the assembler to deduce that an eight bit addressing mode is possible. 
-That means the assember will default to using sixteen bit addressing
-whenever an external or cross-section reference is used.
-</para>
-
-<para>
-As of LWASM 2.4, it is possible to force direct page addressing for an
-external reference.  Care must be taken to ensure the resulting addresses
-are really in the direct page since the linker does not know what the direct
-page is supposed to be and does not emit errors for byte overflows.
-</para>
-
-<para>
-It is also possible to use external references in an eight bit immediate
-mode instruction.  In this case, only the low order eight bits will be used. 
-Again, no byte overflows will be flagged.
-</para>
-
-
-</section>
-
-</chapter>
-
-<chapter>
-<title>LWASM</title>
-<para>
-The LWTOOLS assembler is called LWASM. This chapter documents the various
-features of the assembler. It is not, however, a tutorial on 6x09 assembly
-language programming.
-</para>
-
-<section>
-<title>Command Line Options</title>
-<para>
-The binary for LWASM is called "lwasm". Note that the binary is in lower
-case. lwasm takes the following command line arguments.
-</para>
-
-<variablelist>
-
-<varlistentry>
-<term><option>--6309</option></term>
-<term><option>-3</option></term>
-<listitem>
-<para>
-This will cause the assembler to accept the additional instructions available
-on the 6309 processor. This is the default mode; this option is provided for
-completeness and to override preset command arguments.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--6809</option></term>
-<term><option>-9</option></term>
-<listitem>
-<para>
-This will cause the assembler to reject instructions that are only available
-on the 6309 processor.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--decb</option></term>
-<term><option>-b</option></term>
-<listitem>
-<para>
-Select the DECB output format target. Equivalent to <option>--format=decb</option>.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--format=type</option></term>
-<term><option>-f type</option></term>
-<listitem>
-<para>
-Select the output format. Valid values are <option>obj</option> for the
-object file target, <option>decb</option> for the DECB LOADM format,
-<option>os9</option> for creating OS9 modules, and <option>raw</option> for
-a raw binary.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--list[=file]</option></term>
-<term><option>-l[file]</option></term>
-<listitem>
-<para>
-Cause LWASM to generate a listing. If <option>file</option> is specified,
-the listing will go to that file. Otherwise it will go to the standard output
-stream. By default, no listing is generated.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--obj</option></term>
-<listitem>
-<para>
-Select the proprietary object file format as the output target.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--output=FILE</option></term>
-<term><option>-o FILE</option></term>
-<listitem>
-<para>
-This option specifies the name of the output file. If not specified, the
-default is <option>a.out</option>.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--pragma=pragma</option></term>
-<term><option>-p pragma</option></term>
-<listitem>
-<para>
-Specify assembler pragmas. Multiple pragmas are separated by commas. The
-pragmas accepted are the same as for the PRAGMA assembler directive described
-below.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--raw</option></term>
-<term><option>-r</option></term>
-<listitem>
-<para>
-Select raw binary as the output target.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--help</option></term>
-<term><option>-?</option></term>
-<listitem>
-<para>
-Present a help screen describing the command line options.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--usage</option></term>
-<listitem>
-<para>
-Provide a summary of the command line options.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--version</option></term>
-<term><option>-V</option></term>
-<listitem>
-<para>
-Display the software version.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--debug</option></term>
-<term><option>-d</option></term>
-<listitem>
-<para>
-Increase the debugging level. Only really useful to people hacking on the
-LWASM source code itself.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-
-</section>
-
-<section>
-<title>Dialects</title>
-<para>
-LWASM supports all documented MC6809 instructions as defined by Motorola. 
-It also supports all known HD6309 instructions.  While there is general
-agreement on the pneumonics for most of the 6309 instructions, there is some
-variance with the block transfer instructions. TFM for all four variations
-seems to have gained the most traction and, thus, this is the form that is
-recommended for LWASM. However, it also supports COPY, COPY-, IMP, EXP,
-TFRP, TFRM, TFRS, and TFRR. It further adds COPY+ as a synomym for COPY,
-IMPLODE for IMP, and EXPAND for EXP.
-</para>
-
-<para>By default, LWASM accepts 6309 instructions. However, using the
-<parameter>--6809</parameter> parameter, you can cause it to throw errors on
-6309 instructions instead.</para>
-
-<para>
-The standard addressing mode specifiers are supported. These are the
-hash sign ("#") for immediate mode, the less than sign ("&lt;") for forced
-eight bit modes, and the greater than sign ("&gt;") for forced sixteen bit modes.
-</para>
-
-<para>
-Additionally, LWASM supports using the asterisk ("*") to indicate
-base page addressing. This should not be used in hand-written source code,
-however, because it is non-standard and may or may not be present in future
-versions of LWASM.
-</para>
-
-</section>
-
-<section>
-<title>Source Format</title>
-
-<para>
-LWASM accepts plain text files in a relatively free form. It can handle
-lines terminated with CR, LF, CRLF, or LFCR which means it should be able
-to assemble files on any platform on which it compiles.
-</para>
-<para>
-Each line may start with a symbol. If a symbol is present, there must not
-be any whitespace preceding it. It is legal for a line to contain nothing
-but a symbol.</para>
-<para>
-The op code is separated from the symbol by whitespace. If there is
-no symbol, there must be at least one white space character preceding it.
-If applicable, the operand follows separated by whitespace. Following the
-opcode and operand is an optional comment.
-</para>
-<para>
-A comment can also be introduced with a * or a ;. The comment character is
-optional for end of statement comments. However, if a symbol is the only
-thing present on the line other than the comment, the comment character is
-mandatory to prevent the assembler from interpreting the comment as an opcode.
-</para>
-
-<para>
-For compatibility with the output generated by some C preprocessors, LWASM
-will also ignore lines that begin with a #. This should not be used as a general
-comment character, however.
-</para>
-
-<para>
-The opcode is not treated case sensitively. Neither are register names in
-the operand fields. Symbols, however, are case sensitive.
-</para>
-
-<para>
-LWASM does not support line numbers in the file.
-</para>
-
-</section>
-
-<section>
-<title>Symbols</title>
-
-<para>
-Symbols have no length restriction. They may contain letters, numbers, dots,
-dollar signs, and underscores. They must start with a letter, dot, or
-underscore.
-</para>
-
-<para>
-LWASM also supports the concept of a local symbol. A local symbol is one
-which contains either a "?" or a "@", which can appear anywhere in the symbol.
-The scope of a local symbol is determined by a number of factors. First,
-each included file gets its own local symbol scope. A blank line will also
-be considered a local scope barrier. Macros each have their own local symbol
-scope as well (which has a side effect that you cannot use a local symbol
-as an argument to a macro). There are other factors as well. In general,
-a local symbol is restricted to the block of code it is defined within.
-</para>
-
-<para>
-By default, unless assembling to the os9 target, a "$" in the symbol will
-also make it local.  This can be controlled by the "dollarlocal" and
-"nodollarlocal" pragmas.  In the absence of a pragma to the contrary, For
-the os9 target, a "$" in the symbol will not make it considered local while
-for all other targets it will.
-</para>
-
-</section>
-
-<section>
-<title>Numbers and Expressions</title>
-<para>
-
-Numbers can be expressed in binary, octal, decimal, or hexadecimal. Binary
-numbers may be prefixed with a "%" symbol or suffixed with a "b" or "B".
-Octal numbers may be prefixed with "@" or suffixed with "Q", "q", "O", or
-"o". Hexadecimal numbers may be prefixed with "$", "0x" or "0X", or suffixed
-with "H". No prefix or suffix is required for decimal numbers but they can
-be prefixed with "&amp;" if desired. Any constant which begins with a letter
-must be expressed with the correct prefix base identifier or be prefixed
-with a 0. Thus hexadecimal FF would have to be written either 0FFH or $FF.
-Numbers are not case sensitive.
-
-</para>
-
-<para> A symbol may appear at any point where a number is acceptable. The
-special symbol "*" can be used to represent the starting address of the
-current source line within expressions. </para>
-
-<para>The ASCII value of a character can be included by prefixing it with a
-single quote ('). The ASCII values of two characters can be included by
-prefixing the characters with a quote (").</para>
-
-<para>
-
-LWASM supports the following basic binary operators: +, -, *, /, and %. 
-These represent addition, subtraction, multiplication, division, and
-modulus.  It also supports unary negation and unary 1's complement (- and ^
-respectively).  It is also possible to use ~ for the unary 1's complement
-operator.  For completeness, a unary positive (+) is supported though it is
-a no-op.  LWASM also supports using |, &, and ^ for bitwise or, bitwise and,
-and bitwise exclusive or respectively.
-
-</para>
-
-<para>
-
-Operator precedence follows the usual rules. Multiplication, division, and
-modulus take precedence over addition and subtraction.  Unary operators take
-precedence over binary operators.  Bitwise operators are lower precdence
-than addition and subtraction.  To force a specific order of evaluation,
-parentheses can be used in the usual manner.
-
-</para>
-
-<para>
-
-As of LWASM 2.5, the operators && and || are recognized for boolean and and
-boolean or respectively.  They will return either 0 or 1 (false or true). 
-They have the lowest precedence of all the binary operators.
-
-</para>
-
-</section>
-
-<section>
-<title>Assembler Directives</title>
-<para>
-Various directives can be used to control the behaviour of the
-assembler or to include non-code/data in the resulting output. Those directives
-that are not described in detail in other sections of this document are
-described below.
-</para>
-
-<section>
-<title>Data Directives</title>
-<variablelist>
-<varlistentry><term>FCB <parameter>expr[,...]</parameter></term>
-<term>.DB <parameter>expr[,...]</parameter></term>
-<term>.BYTE <parameter>expr[,...]</parameter></term>
-<listitem>
-<para>Include one or more constant bytes (separated by commas) in the output.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>FDB <parameter>expr[,...]</parameter></term>
-<term>.DW <parameter>expr[,...]</parameter></term>
-<term>.WORD <parameter>expr[,...]</parameter></term>
-<listitem>
-<para>Include one or more words (separated by commas) in the output.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>FQB <parameter>expr[,...]</parameter></term>
-<term>.QUAD <parameter>expr[,...]</parameter></term>
-<term>.4BYTE <parameter>expr[,...]</parameter></term>
-<listitem>
-<para>Include one or more double words (separated by commas) in the output.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>FCC <parameter>string</parameter></term>
-<term>.ASCII <parameter>string</parameter></term>
-<term>.STR <parameter>string</parameter></term>
-<listitem>
-<para>
-Include a string of text in the output. The first character of the operand
-is the delimiter which must appear as the last character and cannot appear
-within the string. The string is included with no modifications>
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>FCN <parameter>string</parameter></term>
-<term>.ASCIZ <parameter>string</parameter></term>
-<term>.STRZ <parameter>string</parameter></term>
-<listitem>
-<para>
-Include a NUL terminated string of text in the output. The first character of
-the operand is the delimiter which must appear as the last character and
-cannot appear within the string. A NUL byte is automatically appended to
-the string.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>FCS <parameter>string</parameter></term>
-<term>.ASCIS <parameter>string</parameter></term>
-<term>.STRS <parameter>string</parameter></term>
-<listitem>
-<para>
-Include a string of text in the output with bit 7 of the final byte set. The
-first character of the operand is the delimiter which must appear as the last
-character and cannot appear within the string.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry><term>ZMB <parameter>expr</parameter></term>
-<listitem>
-<para>
-Include a number of NUL bytes in the output. The number must be fully resolvable
-during pass 1 of assembly so no forward or external references are permitted.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry><term>ZMD <parameter>expr</parameter></term>
-<listitem>
-<para>
-Include a number of zero words in the output. The number must be fully
-resolvable during pass 1 of assembly so no forward or external references are
-permitted.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry><term>ZMQ <parameter>expr<parameter></term>
-<listitem>
-<para>
-Include a number of zero double-words in the output. The number must be fully
-resolvable during pass 1 of assembly so no forward or external references are
-permitted.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>RMB <parameter>expr</parameter></term>
-<term>.BLKB <parameter>expr</parameter></term>
-<term>.DS <parameter>expr</parameter></term>
-<term>.RS <parameter>expr</parameter></term>
-<listitem>
-<para>
-Reserve a number of bytes in the output. The number must be fully resolvable
-during pass 1 of assembly so no forward or external references are permitted.
-The value of the bytes is undefined.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry><term>RMD <parameter>expr</parameter></term>
-<listitem>
-<para>
-Reserve a number of words in the output. The number must be fully
-resolvable during pass 1 of assembly so no forward or external references are
-permitted. The value of the words is undefined.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry><term>RMQ <parameter>expr</parameter></term>
-<listitem>
-<para>
-Reserve a number of double-words in the output. The number must be fully
-resolvable during pass 1 of assembly so no forward or external references are
-permitted. The value of the double-words is undefined.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>INCLUDEBIN <parameter>filename</parameter></term>
-<listitem>
-<para>
-Treat the contents of <parameter>filename</parameter> as a string of bytes to
-be included literally at the current assembly point. This has the same effect
-as converting the file contents to a series of FCB statements and including
-those at the current assembly point.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-
-</section>
-
-<section>
-<title>Address Definition</title>
-<para>The directives in this section all control the addresses of symbols
-or the assembly process itself.</para>
-
-<variablelist>
-<varlistentry><term>ORG <parameter>expr</parameter></term>
-<listitem>
-<para>Set the assembly address. The address must be fully resolvable on the
-first pass so no external or forward references are permitted. ORG is not
-permitted within sections when outputting to object files. For the DECB
-target, each ORG directive after which output is generated will cause
-a new preamble to be output. ORG is only used to determine the addresses
-of symbols when the raw target is used.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><parameter>sym</parameter> EQU <parameter>expr</parameter></term>
-<term><parameter>sym</parameter> = <parameter>expr</parameter></term>
-<listitem>
-<para>Define the value of <parameter>sym</parameter> to be <parameter>expr</parameter>.
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><parameter>sym</parameter> SET <parameter>expr</parameter></term>
-<listitem>
-<para>Define the value of <parameter>sym</parameter> to be <parameter>expr</parameter>.
-Unlike EQU, SET permits symbols to be defined multiple times as long as SET
-is used for all instances. Use of the symbol before the first SET statement
-that sets its value is undefined.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>SETDP <parameter>expr</parameter></term>
-<listitem>
-<para>Inform the assembler that it can assume the DP register contains
-<parameter>expr</parameter>. This directive is only advice to the assembler
-to determine whether an address is in the direct page and has no effect
-on the contents of the DP register. The value must be fully resolved during
-the first assembly pass because it affects the sizes of subsequent instructions.
-</para>
-<para>This directive has no effect in the object file target.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>ALIGN <parameter>expr</parameter>[,<parameter>value</parameter>]</term>
-<listitem>
-
-<para>Force the current assembly address to be a multiple of
-<parameter>expr</parameter>.  If <parameter>value</parameter> is not
-specified, a series of NUL bytes is output to force the alignment, if
-required.  Otherwise, the low order 8 bits of <parameter>value</parameter>
-will be used as the fill.  The alignment value must be fully resolved on the
-first pass because it affects the addresses of subsquent instructions. 
-However, <parameter>value</parameter> may include forward references; as
-long as it resolves to a constant for the second pass, the value will be
-accepted.</para>
-
-<para>Unless <parameter>value</parameter> is specified as something like $12,
-this directive is not suitable for inclusion in the middle of actual code. 
-The default padding value is $00 which is intended to be used within data
-blocks.  </para>
-
-</listitem>
-</varlistentry>
-
-</variablelist>
-
-</section>
-
-<section>
-<title>Conditional Assembly</title>
-<para>
-Portions of the source code can be excluded or included based on conditions
-known at assembly time. Conditionals can be nested arbitrarily deeply. The
-directives associated with conditional assembly are described in this section.
-</para>
-<para>All conditionals must be fully bracketed. That is, every conditional
-statement must eventually be followed by an ENDC at the same level of nesting.
-</para>
-<para>Conditional expressions are only evaluated on the first assembly pass.
-It is not possible to game the assembly process by having a conditional
-change its value between assembly passes. Thus there is not and never will
-be any equivalent of IFP1 or IFP2 as provided by other assemblers.</para>
-
-<variablelist>
-<varlistentry>
-<term>IFEQ <parameter>expr</parameter></term>
-<listitem>
-<para>If <parameter>expr</parameter> evaluates to zero, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFNE <parameter>expr</parameter></term>
-<term>IF <parameter>expr</parameter></term>
-<listitem>
-<para>If <parameter>expr</parameter> evaluates to a non-zero value, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFGT <parameter>expr</parameter></term>
-<listitem>
-<para>If <parameter>expr</parameter> evaluates to a value greater than zero, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFGE <parameter>expr</parameter></term>
-<listitem>
-<para>If <parameter>expr</parameter> evaluates to a value greater than or equal to zero, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFLT <parameter>expr</parameter></term>
-<listitem>
-<para>If <parameter>expr</parameter> evaluates to a value less than zero, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFLE <parameter>expr</parameter></term>
-<listitem>
-<para>If <parameter>expr</parameter> evaluates to a value less than or equal to zero , the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFDEF <parameter>sym</parameter></term>
-<listitem>
-<para>If <parameter>sym</parameter> is defined at this point in the assembly
-process, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>IFNDEF <parameter>sym</parameter></term>
-<listitem>
-<para>If <parameter>sym</parameter> is not defined at this point in the assembly
-process, the conditional
-will be considered true.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>ELSE</term>
-<listitem>
-<para>
-If the preceding conditional at the same level of nesting was false, the
-statements following will be assembled. If the preceding conditional at
-the same level was true, the statements following will not be assembled.
-Note that the preceding conditional might have been another ELSE statement
-although this behaviour is not guaranteed to be supported in future versions
-of LWASM.
-</para>
-</listitem>
-
-<varlistentry>
-<term>ENDC</term>
-<listitem>
-<para>
-This directive marks the end of a conditional construct. Every conditional
-construct must end with an ENDC directive.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-</section>
-
-<section>
-<title>OS9 Target Directives</title>
-
-<para>This section includes directives that apply solely to the OS9
-target.</para>
-
-<variablelist>
-
-<varlistentry>
-<term>OS9 <parameter>syscall</parameter></term>
-<listitem>
-<para>
-
-This directive generates a call to the specified system call. <parameter>syscall</parameter> may be an arbitrary expression.
-
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>MOD <parameter>size</parameter>,<parameter>name</parameter>,<parameter>type</parameter>,<parameter>flags</parameter>,<parameter>execoff</parameter>,<parameter>datasize</parameter></term>
-<listitem>
-<para>
-
-This tells LWASM that the beginning of the actual module is here. It will
-generate a module header based on the parameters specified.  It will also
-begin calcuating the module CRC.
-
-</para>
-
-<para>
-
-The precise meaning of the various parameters is beyond the scope of this
-document since it is not a tutorial on OS9 module programming.
-
-</para>
-
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>EMOD</term>
-<listitem>
-<para>
-
-This marks the end of a module and causes LWASM to emit the calculated CRC
-for the module.
-
-</para>
-</varlistentry>
-
-</variablelist>
-</section>
-
-<section>
-<title>Miscelaneous Directives</title>
-
-<para>This section includes directives that do not fit into the other
-categories.</para>
-
-<variablelist>
-
-<varlistentry>
-<term>INCLUDE <parameter>filename</parameter></term>
-<term>USE <parameter>filename</parameter></term>
-
-<listitem> <para> Include the contents of <parameter>filename</parameter> at
-this point in the assembly as though it were a part of the file currently
-being processed.  Note that if whitespace appears in the name of the file,
-you must enclose <parameter>filename</parameter> in quotes.
-</para>
-
-<para>
-Note that the USE variation is provided only for compatibility with other
-assemblers. It is recommended to use the INCLUDE variation.</para>
-
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>END <parameter>[expr]</parameter></term>
-<listitem>
-<para>
-This directive causes the assembler to stop assembling immediately as though
-it ran out of input. For the DECB target only, <parameter>expr</parameter>
-can be used to set the execution address of the resulting binary. For all
-other targets, specifying <parameter>expr</parameter> will cause an error.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>ERROR <parameter>string</parameter></term>
-<listitem>
-<para>
-Causes a custom error message to be printed at this line. This will cause
-assembly to fail. This directive is most useful inside conditional constructs
-to cause assembly to fail if some condition that is known bad happens.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>.MODULE <parameter>string</parameter></term>
-<listitem>
-<para>
-This directive is ignored for most output targets. If the output target
-supports encoding a module name into it, <parameter>string</parameter>
-will be used as the module name.
-</para>
-<para>
-As of version 2.2, no supported output targets support this directive.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-</section>
-
-</section>
-
-<section>
-<title>Macros</title>
-<para>
-LWASM is a macro assembler. A macro is simply a name that stands in for a
-series of instructions. Once a macro is defined, it is used like any other
-assembler directive. Defining a macro can be considered equivalent to adding
-additional assembler directives.
-</para>
-<para>Macros my accept parameters. These parameters are referenced within
-a macro by the a backslash ("\") followed by a digit 1 through 9 for the first
-through ninth parameters. They may also be referenced by enclosing the
-decimal parameter number in braces ("{num}"). These parameter references
-are replaced with the verbatim text of the parameter passed to the macro. A
-reference to a non-existent parameter will be replaced by an empty string.
-Macro parameters are expanded everywhere on each source line. That means
-the parameter to a macro could be used as a symbol or it could even appear
-in a comment or could cause an entire source line to be commented out
-when the macro is expanded.
-</para>
-<para>
-Parameters passed to a macro are separated by commas and the parameter list
-is terminated by any whitespace. This means that neither a comma nor whitespace
-may be included in a macro parameter.
-</para>
-<para>
-Macro expansion is done recursively. That is, within a macro, macros are
-expanded. This can lead to infinite loops in macro expansion. If the assembler
-hangs for a long time while assembling a file that uses macros, this may be
-the reason.</para>
-
-<para>Each macro expansion receives its own local symbol context which is not
-inherited by any macros called by it nor is it inherited from the context
-the macro was instantiated in. That means it is possible to use local symbols
-within macros without having them collide with symbols in other macros or
-outside the macro itself. However, this also means that using a local symbol
-as a parameter to a macro, while legal, will not do what it would seem to do
-as it will result in looking up the local symbol in the macro's symbol context
-rather than the enclosing context where it came from, likely yielding either
-an undefined symbol error or bizarre assembly results.
-</para>
-<para>
-Note that there is no way to define a macro as local to a symbol context. All
-macros are part of the global macro namespace. However, macros have a separate
-namespace from symbols so it is possible to have a symbol with the same name
-as a macro.
-</para>
-
-<para>
-Macros are defined only during the first pass. Macro expansion also
-only occurs during the first pass. On the second pass, the macro
-definition is simply ignored. Macros must be defined before they are used.
-</para>
-
-<para>The following directives are used when defining macros.</para>
-
-<variablelist>
-<varlistentry>
-<term><parameter>macroname</parameter> MACRO</term>
-<listitem>
-<para>This directive is used to being the definition of a macro called
-<parameter>macroname</parameter>. If <parameter>macroname</parameter> already
-exists, it is considered an error. Attempting to define a macro within a
-macro is undefined. It may work and it may not so the behaviour should not
-be relied upon.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>ENDM</term>
-<listitem>
-<para>
-This directive indicates the end of the macro currently being defined. It
-causes the assembler to resume interpreting source lines as normal.
-</para>
-</listitem>
-</variablelist>
-
-</section>
-
-<section>
-<title>Object Files and Sections</title>
-<para>
-The object file target is very useful for large project because it allows
-multiple files to be assembled independently and then linked into the final
-binary at a later time. It allows only the small portion of the project
-that was modified to be re-assembled rather than requiring the entire set
-of source code to be available to the assembler in a single assembly process.
-This can be particularly important if there are a large number of macros,
-symbol definitions, or other metadata that uses resources at assembly time.
-By far the largest benefit, however, is keeping the source files small enough
-for a mere mortal to find things in them.
-</para>
-
-<para>
-With multi-file projects, there needs to be a means of resolving references to
-symbols in other source files. These are known as external references. The
-addresses of these symbols cannot be known until the linker joins all the
-object files into a single binary. This means that the assembler must be
-able to output the object code without knowing the value of the symbol. This
-places some restrictions on the code generated by the assembler. For
-example, the assembler cannot generate direct page addressing for instructions
-that reference external symbols because the address of the symbol may not
-be in the direct page. Similarly, relative branches and PC relative addressing
-cannot be used in their eight bit forms. Everything that must be resolved
-by the linker must be assembled to use the largest address size possible to
-allow the linker to fill in the correct value at link time. Note that the
-same problem applies to absolute address references as well, even those in
-the same source file, because the address is not known until link time.
-</para>
-
-<para>
-It is often desired in multi-file projects to have code of various types grouped
-together in the final binary generated by the linker as well. The same applies
-to data. In order for the linker to do that, the bits that are to be grouped
-must be tagged in some manner. This is where the concept of sections comes in.
-Each chunk of code or data is part of a section in the object file. Then,
-when the linker reads all the object files, it coalesces all sections of the
-same name into a single section and then considers it as a unit.
-</para>
-
-<para>
-The existence of sections, however, raises a problem for symbols even
-within the same source file. Thus, the assembler must treat symbols from
-different sections within the same source file in the same manner as external
-symbols. That is, it must leave them for the linker to resolve at link time,
-with all the limitations that entails.
-</para>
-
-<para>
-In the object file target mode, LWASM requires all source lines that
-cause bytes to be output to be inside a section. Any directives that do
-not cause any bytes to be output can appear outside of a section. This includes
-such things as EQU or RMB. Even ORG can appear outside a section. ORG, however,
-makes no sense within a section because it is the linker that determines
-the starting address of the section's code, not the assembler.
-</para>
-
-<para>
-All symbols defined globally in the assembly process are local to the 
-source file and cannot be exported. All symbols defined within a section are
-considered local to the source file unless otherwise explicitly exported.
-Symbols referenced from external source files must be declared external,
-either explicitly or by asking the assembler to assume that all undefined
-symbols are external.
-</para>
-
-<para>
-It is often handy to define a number of memory addresses that will be
-used for data at run-time but which need not be included in the binary file.
-These memory addresses are not initialized until run-time, either by the
-program itself or by the program loader, depending on the operating environment.
-Such sections are often known as BSS sections. LWASM supports generating
-sections with a BSS attribute set which causes the section definition including
-symbols exported from that section and those symbols required to resolve
-references from the local file, but with no actual code in the object file.
-It is illegal for any source lines within a BSS flagged section to cause any
-bytes to be output.
-</para>
-
-<para>The following directives apply to section handling.</para>
-
-<variablelist>
-<varlistentry>
-<term>SECTION <parameter>name[,flags]</parameter></term>
-<term>SECT <parameter>name[,flags]</parameter></term>
-<term>.AREA <parameter>name[,flags]</parameter></term>
-<listitem>
-<para>
-Instructs the assembler that the code following this directive is to be
-considered part of the section <parameter>name</parameter>. A section name
-may appear multiple times in which case it is as though all the code from
-all the instances of that section appeared adjacent within the source file.
-However, <parameter>flags</parameter> may only be specified on the first
-instance of the section.
-</para>
-<para>There is a single flag supported in <parameter>flags</parameter>. The
-flag <parameter>bss</parameter> will cause the section to be treated as a BSS
-section and, thus, no code will be included in the object file nor will any
-bytes be permitted to be output.</para>
-<para>
-If the section name is "bss" or ".bss" in any combination of upper and
-lower case, the section is assumed to be a BSS section. In that case,
-the flag <parameter>!bss</parameter> can be used to override this assumption.
-</para>
-<para>
-If assembly is already happening within a section, the section is implicitly
-ended and the new section started. This is not considered an error although
-it is recommended that all sections be explicitly closed.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>ENDSECTION</term>
-<term>ENDSECT</term>
-<term>ENDS</term>
-<listitem>
-<para>
-This directive ends the current section. This puts assembly outside of any
-sections until the next SECTION directive.
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><parameter>sym</parameter> EXTERN</term>
-<term><parameter>sym</parameter> EXTERNAL</term>
-<term><parameter>sym</parameter> IMPORT</term>
-<listitem>
-<para>
-This directive defines <parameter>sym</parameter> as an external symbol.
-This directive may occur at any point in the source code. EXTERN definitions
-are resolved on the first pass so an EXTERN definition anywhere in the
-source file is valid for the entire file. The use of this directive is
-optional when the assembler is instructed to assume that all undefined
-symbols are external. In fact, in that mode, if the symbol is referenced
-before the EXTERN directive, an error will occur.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><parameter>sym</parameter> EXPORT</term>
-<term><parameter>sym</parameter> .GLOBL</term>
-
-<term>EXPORT <parameter>sym</parameter></term>
-<term>.GLOBL <parameter>sym</parameter></term>
-
-<listitem>
-<para>
-This directive defines <parameter>sym</parameter> as an exported symbol.
-This directive may occur at any point in the source code, even before the
-definition of the exported symbol.
-</para>
-<para>
-Note that <parameter>sym</parameter> may appear as the operand or as the
-statement's symbol. If there is a symbol on the statement, that will
-take precedence over any operand that is present.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-
-</section>
-
-<section>
-<title>Assembler Modes and Pragmas</title>
-<para>
-There are a number of options that affect the way assembly is performed.
-Some of these options can only be specified on the command line because
-they determine something absolute about the assembly process. These include
-such things as the output target. Other things may be switchable during
-the assembly process. These are known as pragmas and are, by definition,
-not portable between assemblers.
-</para>
-
-<para>LWASM supports a number of pragmas that affect code generation or
-otherwise affect the behaviour of the assembler. These may be specified by
-way of a command line option or by assembler directives. The directives
-are as follows.
-</para>
-
-<variablelist>
-<varlistentry>
-<term>PRAGMA <parameter>pragma[,...]</parameter></term>
-<listitem>
-<para>
-Specifies that the assembler should bring into force all <parameter>pragma</parameter>s
-specified. Any unrecognized pragma will cause an assembly error. The new
-pragmas will take effect immediately. This directive should be used when
-the program will assemble incorrectly if the pragma is ignored or not supported.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>*PRAGMA <parameter>pragma[,...]</parameter></term>
-<listitem>
-<para>
-This is identical to the PRAGMA directive except no error will occur with
-unrecognized or unsupported pragmas. This directive, by virtue of starting
-with a comment character, will also be ignored by assemblers that do not
-support this directive. Use this variation if the pragma is not required
-for correct functioning of the code.
-</para>
-</listitem>
-</varlistentry>
-</variablelist>
-
-<para>Each pragma supported has a positive version and a negative version.
-The positive version enables the pragma while the negative version disables
-it. The negatitve version is simply the positive version with "no" prefixed
-to it. For instance, "pragma" vs. "nopragma". Only the positive version is
-listed below.</para>
-
-<para>Pragmas are not case sensitive.</para>
-
-<variablelist>
-<varlistentry>
-<term>index0tonone</term>
-<listitem>
-<para>
-When in force, this pragma enables an optimization affecting indexed addressing
-modes. When the offset expression in an indexed mode evaluates to zero but is
-not explicity written as 0, this will replace the operand with the equivalent
-no offset mode, thus creating slightly faster code. Because of the advantages
-of this optimization, it is enabled by default.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>cescapes</term>
-<listitem>
-<para>
-This pragma will cause strings in the FCC, FCS, and FCN pseudo operations to
-have C-style escape sequences interpreted. The one departure from the official
-spec is that unrecognized escape sequences will return either the character
-immediately following the backslash or some undefined value. Do not rely
-on the behaviour of undefined escape sequences.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>importundefexport</term>
-<listitem>
-<para>
-This pragma is only valid for targets that support external references. When
-in force, it will cause the EXPORT directive to act as IMPORT if the symbol
-to be exported is not defined.  This is provided for compatibility with the
-output of gcc6809 and should not be used in hand written code.  Because of
-the confusion this pragma can cause, it is disabled by default.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>undefextern</term>
-<listitem>
-<para>
-This pragma is only valid for targets that support external references. When in
-force, if the assembler sees an undefined symbol on the second pass, it will
-automatically define it as an external symbol. This automatic definition will
-apply for the remainder of the assembly process, even if the pragma is
-subsequently turned off. Because this behaviour would be potentially surprising,
-this pragma defaults to off.
-</para>
-<para>
-The primary use for this pragma is for projects that share a large number of
-symbols between source files. In such cases, it is impractical to enumerate
-all the external references in every source file. This allows the assembler
-and linker to do the heavy lifting while not preventing a particular source
-module from defining a local symbol of the same name as an external symbol
-if it does not need the external symbol. (This pragma will not cause an
-automatic external definition if there is already a locally defined symbol.)
-</para>
-<para>
-This pragma will often be specified on the command line for large projects.
-However, depending on the specific dynamics of the project, it may be sufficient
-for one or two files to use this pragma internally.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>dollarlocal</term>
-<listitem>
-
-<para>When set, a "$" in a symbol makes it local. When not set, "$" does not
-cause a symbol to be local.  It is set by default except when using the OS9
-target.</para>
-
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>dollarnotlocal</term>
-<listitem>
-
-<para> This is the same as the "dollarlocal" pragma except its sense is
-reversed.  That is, "dollarlocal" and "nodollarnotlocal" are equivalent and
-"nodollarlocal" and "dollarnotlocal" are equivalent.  </para>
-
-</listitem>
-</varlistentry>
-
-</variablelist>
-
-</section>
-
-</chapter>
-
-<chapter>
-<title>LWLINK</title>
-<para>
-The LWTOOLS linker is called LWLINK. This chapter documents the various features
-of the linker.
-</para>
-
-<section>
-<title>Command Line Options</title>
-<para>
-The binary for LWLINK is called "lwlink". Note that the binary is in lower
-case. lwlink takes the following command line arguments.
-</para>
-<variablelist>
-<varlistentry>
-<term><option>--decb</option></term>
-<term><option>-b</option></term>
-<listitem>
-<para>
-Selects the DECB output format target. This is equivalent to <option>--format=decb</option>
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--output=FILE</option></term>
-<term><option>-o FILE</option></term>
-<listitem>
-<para>
-This option specifies the name of the output file. If not specified, the
-default is <option>a.out</option>.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--format=TYPE</option></term>
-<term><option>-f TYPE</option></term>
-<listitem>
-<para>
-This option specifies the output format. Valid values are <option>decb</option>
-and <option>raw</option>
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--raw</option></term>
-<term><option>-r</option></term>
-<listitem>
-<para>
-This option specifies the raw output format.
-It is equivalent to <option>--format=raw</option>.
-and <option>raw</option>
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--script=FILE</option></term>
-<term><option>-s</option></term>
-<listitem>
-<para>
-This option allows specifying a linking script to override the linker's
-built in defaults.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--section-base=SECT=BASE</option></term>
-<listitem>
-<para>
-Cause section SECT to load at base address BASE. This will be prepended
-to the built-in link script. It is ignored if a link script is provided.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--map=FILE</option></term>
-<term><option>-m FILE</option></term>
-<listitem>
-<para>
-This will output a description of the link result to FILE.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--library=LIBSPEC</option></term>
-<term><option>-l LIBSPEC</option></term>
-<listitem>
-<para>
-Load a library using the library search path. LIBSPEC will have "lib" prepended
-and ".a" appended.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--library-path=DIR</option></term>
-<term><option>-L DIR</option></term>
-<listitem>
-<para>
-Add DIR to the library search path.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--debug</option></term>
-<term><option>-d</option></term>
-<listitem>
-<para>
-This option increases the debugging level. It is only useful for LWTOOLS
-developers.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--help</option></term>
-<term><option>-?</option></term>
-<listitem>
-<para>
-This provides a listing of command line options and a brief description
-of each.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--usage</option></term>
-<listitem>
-<para>
-This will display a usage summary.
-of each.
-</para>
-</listitem>
-</varlistentry>
-
-
-<varlistentry>
-<term><option>--version</option></term>
-<term><option>-V</option></term>
-<listitem>
-<para>
-This will display the version of LWLINK.
-</para>
-</listitem>
-</varlistentry>
-
-</section>
-
-<section>
-<title>Linker Operation</title>
-
-<para>
-
-LWLINK takes one or more files in supported input formats and links them
-into a single binary. Currently supported formats are the LWTOOLS object
-file format and the archive format used by LWAR. While the precise method is
-slightly different, linking can be conceptualized as the following steps.
-
-</para>
-
-<orderedlist>
-<listitem>
-<para>
-First, the linker loads a linking script. If no script is specified, it
-loads a built-in default script based on the output format selected. This
-script tells the linker how to lay out the various sections in the final
-binary.
-</para>
-</listitem>
-
-<listitem>
-<para>
-Next, the linker reads all the input files into memory. At this time, it
-flags any format errors in those files. It constructs a table of symbols
-for each object at this time.
-</para>
-</listitem>
-
-<listitem>
-<para>
-The linker then proceeds with organizing the sections loaded from each file
-according to the linking script. As it does so, it is able to assign addresses
-to each symbol defined in each object file. At this time, the linker may
-also collapse different instances of the same section name into a single
-section by appending the data from each subsequent instance of the section
-to the first instance of the section.
-</para>
-</listitem>
-
-<listitem>
-<para>
-Next, the linker looks through every object file for every incomplete reference.
-It then attempts to fully resolve that reference. If it cannot do so, it
-throws an error. Once a reference is resolved, the value is placed into
-the binary code at the specified section. It should be noted that an
-incomplete reference can reference either a symbol internal to the object
-file or an external symbol which is in the export list of another object
-file.
-</para>
-</listitem>
-
-<listitem>
-<para>
-If all of the above steps are successful, the linker opens the output file
-and actually constructs the binary.
-</para>
-</listitem>
-</orderedlist>
-
-</section>
-
-<section
-<title>Linking Scripts</title>
-<para>
-A linker script is used to instruct the linker about how to assemble the
-various sections into a completed binary. It consists of a series of
-directives which are considered in the order they are encountered.
-</para>
-<para>
-The sections will appear in the resulting binary in the order they are
-specified in the script file. If a referenced section is not found, the linker will behave as though the
-section did exist but had a zero size, no relocations, and no exports.
-A section should only be referenced once. Any subsequent references will have
-an undefined effect.
-</para>
-
-<para>
-All numbers are in linking scripts are specified in hexadecimal. All directives
-are case sensitive although the hexadecimal numbers are not.
-</para>
-
-<para>A section name can be specified as a "*", then any section not
-already matched by the script will be matched. The "*" can be followed
-by a comma and a flag to narrow the section down slightly, also.
-If the flag is "!bss", then any section that is not flagged as a bss section
-will be matched. If the flag is "bss", then any section that is flagged as
-bss will be matched.
-</para>
-
-<para>The following directives are understood in a linker script.</para>
-<variablelist>
-<varlistentry>
-<term>section <parameter>name</parameter> load <parameter>addr</parameter></term>
-<listitem><para>
-
-This causes the section <parameter>name</parameter> to load at
-<parameter>addr</parameter>. For the raw target, only one "load at" entry is
-allowed for non-bss sections and it must be the first one. For raw targets,
-it affects the addresses the linker assigns to symbols but has no other
-affect on the output. bss sections may all have separate load addresses but
-since they will not appear in the binary anyway, this is okay.
-</para><para>
-For the decb target, each "load" entry will cause a new "block" to be
-output to the binary which will contain the load address. It is legal for
-sections to overlap in this manner - the linker assumes the loader will sort
-everything out.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term>section <parameter>name</parameter></term>
-<listitem><para>
-
-This will cause the section <parameter>name</parameter> to load after the previously listed
-section.
-</para></listitem></varlistentry>
-<varlistentry>
-<term>exec <parameter>addr or sym</parameter></term>
-<listitem>
-<para>
-This will cause the execution address (entry point) to be the address
-specified (in hex) or the specified symbol name. The symbol name must
-match a symbol that is exported by one of the object files being linked.
-This has no effect for targets that do not encode the entry point into the
-resulting file. If not specified, the entry point is assumed to be address 0
-which is probably not what you want. The default link scripts for targets
-that support this directive automatically starts at the beginning of the
-first section (usually "init" or "code") that is emitted in the binary.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>pad <parameter>size</parameter></term>
-<listitem><para>
-This will cause the output file to be padded with NUL bytes to be exactly
-<parameter>size</parameter> bytes in length. This only makes sense for a raw target.
-</para>
-</listitem>
-</varlistentry>
-</variablelist>
-
-
-
-</section>
-
-</chapter>
-
-<chapter>
-<title>Libraries and LWAR</title>
-
-<para>
-LWTOOLS also includes a tool for managing libraries. These are analogous to
-the static libraries created with the "ar" tool on POSIX systems. Each library
-file contains one or more object files. The linker will treat the object
-files within a library as though they had been specified individually on
-the command line except when resolving external references. External references
-are looked up first within the object files within the library and then, if
-not found, the usual lookup based on the order the files are specified on
-the command line occurs.
-</para>
-
-<para>
-The tool for creating these libary files is called LWAR.
-</para>
-
-<section>
-<title>Command Line Options</title>
-<para>
-The binary for LWAR is called "lwar". Note that the binary is in lower
-case. The options lwar understands are listed below. For archive manipulation
-options, the first non-option argument is the name of the archive. All other
-non-option arguments are the names of files to operate on.
-</para>
-
-<variablelist>
-<varlistentry>
-<term><option>--add</option></term>
-<term><option>-a</option></term>
-<listitem>
-<para>
-This option specifies that an archive is going to have files added to it.
-If the archive does not already exist, it is created. New files are added
-to the end of the archive.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--create</option></term>
-<term><option>-c</option></term>
-<listitem>
-<para>
-This option specifies that an archive is going to be created and have files
-added to it. If the archive already exists, it is truncated.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--merge</option></term>
-<term><option>-m</option></term>
-<listitem>
-<para>
-If specified, any files specified to be added to an archive will be checked
-to see if they are archives themselves. If so, their constituent members are
-added to the archive. This is useful for avoiding archives containing archives.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--list</option></term>
-<term><option>-l</option></term>
-<listitem>
-<para>
-This will display a list of the files contained in the archive.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--debug</option></term>
-<term><option>-d</option></term>
-<listitem>
-<para>
-This option increases the debugging level. It is only useful for LWTOOLS
-developers.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--help</option></term>
-<term><option>-?</option></term>
-<listitem>
-<para>
-This provides a listing of command line options and a brief description
-of each.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--usage</option></term>
-<listitem>
-<para>
-This will display a usage summary.
-of each.
-</para>
-</listitem>
-</varlistentry>
-
-
-<varlistentry>
-<term><option>--version</option></term>
-<term><option>-V</option></term>
-<listitem>
-<para>
-This will display the version of LWLINK.
-of each.
-</para>
-</listitem>
-</varlistentry>
-
-</section>
-
-</chapter>
-
-<chapter id="objchap">
-<title>Object Files</title>
-<para>
-LWTOOLS uses a proprietary object file format. It is proprietary in the sense
-that it is specific to LWTOOLS, not that it is a hidden format. It would be
-hard to keep it hidden in an open source tool chain anyway. This chapter
-documents the object file format.
-</para>
-
-<para>
-An object file consists of a series of sections each of which contains a
-list of exported symbols, a list of incomplete references, and a list of
-"local" symbols which may be used in calculating incomplete references. Each
-section will obviously also contain the object code.
-</para>
-
-<para>
-Exported symbols must be completely resolved to an address within the
-section it is exported from. That is, an exported symbol must be a constant
-rather than defined in terms of other symbols.</para>
-
-<para>
-Each object file starts with a magic number and version number. The magic
-number is the string "LWOBJ16" for this 16 bit object file format. The only
-defined version number is currently 0. Thus, the first 8 bytes of the object
-file are <code>4C574F424A313600</code>
-</para>
-
-<para>
-Each section has the following items in order:
-</para>
-
-<itemizedlist>
-<listitem><para>section name</para></listitem>
-<listitem><para>flags</para></listitem>
-<listitem><para>list of local symbols (and addresses within the section)</para></listitem>
-<listitem><para>list of exported symbols (and addresses within the section)</para></listitem>
-<listitem><para>list of incomplete references along with the expressions to calculate them</para></listitem>
-<listitem><para>the actual object code (for non-BSS sections)</para></listitem>
-</itemizedlist>
-
-<para>
-The section starts with the name of the section with a NUL termination
-followed by a series of flag bytes terminated by NUL. There are only two
-flag bytes defined. A NUL (0) indicates no more flags and a value of 1
-indicates the section is a BSS section. For a BSS section, no actual
-code is included in the object file.
-</para>
-
-<para>
-Either a NULL section name or end of file indicate the presence of no more
-sections.
-</para>
-
-<para>
-Each entry in the exported and local symbols table consists of the symbol
-(NUL terminated) followed by two bytes which contain the value in big endian
-order. The end of a symbol table is indicated by a NULL symbol name.
-</para>
-
-<para>
-Each entry in the incomplete references table consists of an expression
-followed by a 16 bit offset where the reference goes. Expressions are
-defined as a series of terms up to an "end of expression" term. Each term
-consists of a single byte which identifies the type of term (see below)
-followed by any data required by the term. Then end of the list is flagged
-by a NULL expression (only an end of expression term).
-</para>
-
-<table frame="all"><title>Object File Term Types</title>
-<tgroup cols="2">
-<thead>
-<row>
-<entry>TERMTYPE</entry>
-<entry>Meaning</entry>
-</row>
-</thead>
-<tbody>
-<row>
-<entry>00</entry>
-<entry>end of expression</entry>
-</row>
-
-<row>
-<entry>01</entry>
-<entry>integer (16 bit in big endian order follows)</entry>
-</row>
-<row>
-<entry>02</entry>
-<entry>	external symbol reference (NUL terminated symbol name follows)</entry>
-</row>
-
-<row>
-<entry>03</entry>
-<entry>local symbol reference (NUL terminated symbol name follows)</entry>
-</row>
-
-<row>
-<entry>04</entry>
-<entry>operator (1 byte operator number)</entry>
-</row>
-<row>
-<entry>05</entry>
-<entry>section base address reference</entry>
-</row>
-
-<row>
-<entry>FF</entry>
-<entry>This term will set flags for the expression. Each one of these terms will set a single flag. All of them should be specified first in an expression. If they are not, the behaviour is undefined. The byte following is the flag. There is currently only one flag defined. Flag 01 indicates an 8 bit relocation.</entry>
-</row>
-</tbody>
-</tgroup>
-</table>
-
-
-<para>
-External references are resolved using other object files while local
-references are resolved using the local symbol table(s) from this file. This
-allows local symbols that are not exported to have the same names as
-exported symbols or external references.
-</para>
-
-<table frame="all"><title>Object File Operator Numbers</title>
-<tgroup cols="2">
-<thead>
-<row>
-<entry>Number</entry>
-<entry>Operator</entry>
-</row>
-</thead>
-<tbody>
-<row>
-<entry>01</entry>
-<entry>addition (+)</entry>
-</row>
-<row>
-<entry>02</entry>
-<entry>subtraction (-)</entry>
-</row>
-<row>
-<entry>03</entry>
-<entry>multiplication (*)</entry>
-</row>
-<row>
-<entry>04</entry>
-<entry>division (/)</entry>
-</row>
-<row>
-<entry>05</entry>
-<entry>modulus (%)</entry>
-</row>
-<row>
-<entry>06</entry>
-<entry>integer division (\) (same as division)</entry>
-</row>
-
-<row>
-<entry>07</entry>
-<entry>bitwise and</entry>
-</row>
-
-<row>
-<entry>08</entry>
-<entry>bitwise or</entry>
-</row>
-
-<row>
-<entry>09</entry>
-<entry>bitwise xor</entry>
-</row>
-
-<row>
-<entry>0A</entry>
-<entry>boolean and</entry>
-</row>
-
-<row>
-<entry>0B</entry>
-<entry>boolean or</entry>
-</row>
-
-<row>
-<entry>0C</entry>
-<entry>unary negation, 2's complement (-)</entry>
-</row>
-
-<row>
-<entry>0D</entry>
-<entry>unary 1's complement (^)</entry>
-</row>
-</tbody>
-</tgroup>
-</table>
-
-<para>
-An expression is represented in a postfix manner with both operands for
-binary operators preceding the operator and the single operand for unary
-operators preceding the operator.
-</para>
-
-</chapter>
-</book>
-
--- a/old-trunk/extra/README	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-These files are extra utility type scripts that can be used for various
-purposes.
-
-as
-
-This is a sort of front-end script that makes lwasm look approximately like
-gnu as which is useful for using lwasm as a backend to gcc. You will
-probably need to edit it to make it work fully. Simply put this in place
-of whatever gcc6809 installed for "as" (in the "m6809/bin" folder in
-"--prefix") after editing it to point to the real location of the "lwasm"
-binary.
-
-
-ld
-
-Similar to the "as" script above except for lwlink.
-
-
-ar
-
-Similar to the "as" script above except for lwar.
-
-
-To use these scripts, you really need to understand how to build a gcc as a
-cross compiler. The basics are that you put the as, ld, and ar scripts
-whereever you plan to put your cross-development binaries. Then, when
-building the cross compiler, you tell it where the scripts are.
-
-You should probably name them m6809-unknown-none-{ar,as,ld} or similar
-depending on your gcc build target. Then you'll want to get the gcc6809
-patch and patch the correct gcc source code. Then use a configure line
-similar to the following:
-
-configure --enable-languages=c --target=m6809-coco
---program-prefix=m6809-coco-lwos- --enable-obsolete
---srcdir=/home/lost/gcc6809/src/gcc-4.3.3 --disable-threads --disable-nls
---disable-libssp --prefix=/usr/local/coco --with-as=/usr/local/coco/bin/as
---with-ld=/usr/local/coco/bin/ld --with-sysroot=/usr/local/coco
-
-Obviously adjust various paths to match what you're doing.
-
-The exact mechanics of configuring and getting gcc to install correctly is
-left as an exercise to the dedicated masochist.
--- a/old-trunk/extra/ar	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#!/bin/sh
-#
-#
-# Copyright 2009 by William Astle <lost@l-w.ca>
-#
-#This file is part of LWTOOLS.
-#
-#LWTOOLS is free software: you can redistribute it and/or modify it under the
-#terms of the GNU General Public License as published by the Free Software
-#Foundation, either version 3 of the License, or (at your option) any later
-#version.
-#
-#This program is distributed in the hope that it will be useful, but WITHOUT
-#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-#more details.
-#
-#You should have received a copy of the GNU General Public License along with
-#this program. If not, see <http://www.gnu.org/licenses/>.
-
-# this was based somewhat on the "ar" script from gcc6809
-
-# This script is a frontend to the lwar library manager, to make it
-# look more like GNU ar.  Not all ar features are supported here.
-# It basically translates ar style options into lwar format.
-
-# Parse and translate command-line options
-
-# ar options cheatsheet:
-# r: insert (with replace)
-# c: create archive
-# u: only replace newer files
-# v: verbose mode
-# x: extract files from archive
-
-options=$1; shift
-case $options in
-	rc|cru|-rc|-cru)
-		options="--replace --create"
-		;;
-	rv)
-		options="--replace"
-		;;
-	x|-x)
-		options="--extract"
-		;;
-	-C|--cache)
-		exit 0
-		;;
-	*)
-		options="--replace --create $options"
-		if [ "$libname" = "" ]; then
-			libname=$options
-		fi
-		;;
-esac
-
-if [ "x$options" = "x" ]; then
-	echo "ar (m6809): no options given"
-	exit 1
-fi
-
-# Run the real lwar with translated options.
-exec lwar $options $*
--- a/old-trunk/extra/as	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2009 by William Astle <lost@l-w.ca>
-#
-#This file is part of LWASM.
-#
-#LWASM is free software: you can redistribute it and/or modify it under the
-#terms of the GNU General Public License as published by the Free Software
-#Foundation, either version 3 of the License, or (at your option) any later
-#version.
-#
-#This program is distributed in the hope that it will be useful, but WITHOUT
-#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-#more details.
-#
-#You should have received a copy of the GNU General Public License along with
-#this program. If not, see <http://www.gnu.org/licenses/>.
-
-# this was based somewhat on the "as" script from gcc6809
-
-#echo "LWASM-as $0 $*"
-
-show_version () {
-cat <<END
-LWASM (GNU assembler frontend) 2.3
-This program is free software; you may redistribute it under the terms of
-the GNU General Public License.  This program has absolutely no warranty.
-END
-}
-
-fatal_error () {
-	echo $* 1>&2
-	exit 1
-}
-
-# Assume nothing.
-
-input_file=
-output_file=
-list_file=
-options=
-list_file_enabled=n
-
-# Parse the command-line options.  See the GNU 'as' man page for
-# an explanation of all these options.  Our goal is to translate
-# them into lwasm form.
-
-while [ "$1" != "" ]; do
-	arg=$1; shift
-	case $arg in
-		-m6809)
-			true
-			;;
-		-gn)
-			# Generate NoICE debug symbols
-			# ignored - no output formats support debugging symbols
-			;;
-		-gs)
-			# Generate SDCC debug symbols
-			# ignored - no output formats supprt debugging symbols
-			;;
-#		--globalize-symbols)
-#			# Make all symbols global
-#			# lwasm does not support globalizing everything by default
-#			;;
-		-m*)
-			fatal_error "invalid CPU option '$arg'"
-			;;
-		--)
-			fatal_error "standard input not supported"
-			;;
-#		-a*)
-#			options="${options}lc"
-#			list_file_enabled=y
-#			;;
-		-I*)
-			#include_file=${arg#-I}
-			#echo "warning: include path '$include_file' ignored"
-			;;
-		-MD)
-			fatal_error "assembler option '$arg' not supported"
-			;;
-		-o)
-			output_file=$1; shift
-			;;
-		-v|-version)
-			show_version
-			;;
-		--version)
-			show_version
-			exit 0
-			;;
-		-D|-f|-K|--traditional-format|-w|-x|-Z|-W|--no-warn)
-			# These options are accepted but ignored by GNU as.
-			true
-			;;
-#		=*)
-#			# Set the name of the listing file
-#			list_file=${arg#=}
-#			;;
-		-*)
-			echo "as (m6809): unrecognized option $arg"
-			exit 1
-			;;
-		*)
-			input_file=$arg
-			;;
-	esac
-done
-
-# Complain if no input files given.  We don't support redirecting
-# from standard input.
-
-if [ "x$input_file" = "x" ]; then
-	fatal_error "no input file specified"
-fi
-
-# Invoke the real (lwasm) assembler.
-# The -o option specifies the output file name
-# --obj creates object files
-# --pragma=undefextern causes undefined symbols to be assumed external
-# --pragma=cescapes allows C escape syntax in strings
-#echo lwasm -o "$output_file" $options --obj --pragma=undefextern --pragma=cescapes $input_file
-lwasm -o "$output_file" $options --obj --pragma=undefextern --pragma=cescapes --pragma=importundefexport $input_file
-rc=$?
-
-# OK, see if the assembler succeeded or not.
-# If it failed, the source is copied to /tmp/as6809_error.s
-# so that it can be inspected.  GCC will normally delete any
-# temporary .s files that it generates.  This makes debugging
-# the compiler easier.
-#
-# lwasm does not create an output file if it errors out but it also doesn't
-# remove an existing file if it fails so we remove it anyway...
-
-if [ "$rc" != "0" ]; then
-	cp -p $input_file /tmp/as6809_error.s
-	rm -f $asoutput_file
-	exit $rc
-fi
-
-# we don't need anything fancy here since lwasm supports specifying output
-# file names....
--- a/old-trunk/extra/ld	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-#!/bin/sh
-#
-#
-# Copyright 2009 by William Astle <lost@l-w.ca>
-#
-#This file is part of LWTOOLS.
-#
-#LWTOOLS is free software: you can redistribute it and/or modify it under the
-#terms of the GNU General Public License as published by the Free Software
-#Foundation, either version 3 of the License, or (at your option) any later
-#version.
-#
-#This program is distributed in the hope that it will be useful, but WITHOUT
-#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-#more details.
-#
-#You should have received a copy of the GNU General Public License along with
-#this program. If not, see <http://www.gnu.org/licenses/>.
-
-# this was based somewhat on the "as" script from gcc6809
-
-echo "LWTOOLS-as $0 $*"
-path_to_lwlink=lwlink
-
-# Set defaults.  Some are based on the target type, which is 
-# determined by the name by which the program was invoked.
-output_file=a.out
-libpaths=
-libs=
-verbose=
-case $0 in
-	*m6809-coco-*)
-		options="--format=decb"
-#		options="-b .text=0x2000 -b .data=0x7000 -b .bss=0x7C00 -b .ctors=0x7F00 -b .dtors=0x7F80 -b vector=0x7FF0"
-#		aslink_options="-nwxst"
-#		exe_suffix=.bin
-		;;
-	*)
-		options="--format=decb"
-#		options="-b .text=0x8000 -b .data=0x1000 -b .bss=0x0100 -b .ctors=0xFD00 -b .dtors=0xFE00 -b vector=0xFFF0"
-#		aslink_options="-nwxso"
-#		exe_suffix=.s19
-		;;
-esac
-
-
-while [ "$1" != "" ]; do
-	arg=$1; shift
-	case $arg in
-		-gn)
-			# Generate NoICE debug file
-			# ignored because debugging not supported by targets
-			;;
-		-gs)
-			# Generate SDCC debug file
-			# ignored because debugging not supported by targets
-			;;
-		-o)
-			output_file=$1; shift
-			;;
-		-L*)
-			arg=${arg#-L}
-			libpaths="$libpaths --library-path=$arg"
-			;;
-		-l*)
-			arg=${arg#-l}
-			libs="$libs --library=$arg"
-			;;
-		--section-start)
-			section_value=$1; shift
-			options="$options --section-start=$section_value"
-			;;
-		-Tbss)
-			options="$options --section-start=.bss=$1"; shift
-			;;
-		-Tdata)
-			options="$options --section-start=.data=$1"; shift
-			;;
-		-Ttext|-Tcode)
-			options="$options --section-start=.text=$1"; shift
-			;;
-		-v|--verbose)
-			verbose=1
-			;;
-		*crt0.o)
-			startup_files=$arg
-			;;
-		-g)
-			# Ignored by GNU ld; we should do the same
-			true
-			;;
-		-h|--help)
-			echo "ld (m6809)"
-			exit 0
-			;;
-		-T)
-			echo "-T scripts not supported";
-			exit 1;
-			;;
-		--format-lwex)
-			options="$options --format=lwex"
-			;;
-
-		-*)
-			echo "ld (m6809): unknown option $arg"
-			exit 1
-			;;
-		*)
-			input_files="$input_files $arg"
-			;;
-	esac
-done
-
-options="$options -o $output_file"
-
-if [ "$verbose" = "1" ]; then
-	echo "$path_to_lwlink $options $input_files $startup_files $libpaths $libs"
-fi
-
-$path_to_lwlink $options $input_files $startup_files $libpaths $libs
-rc=$?
-
-if [ "$rc" != "0" ]; then
-	rm -f $output_file
-	exit $rc
-fi
--- a/old-trunk/lwar/Makefile.am	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
-bin_PROGRAMS = lwar
-lwar_SOURCES = main.c util.c lwar.c list.c add.c remove.c replace.c extract.c
-lwar_LDADD = -L$(top_builddir)/lib -L$(top_srcdir)/lib -lgnu
-EXTRA_DIST = lwar.h util.h
--- a/old-trunk/lwar/add.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
-add.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lwar.h"
-
-void do_add(void)
-{
-	FILE *f;
-	unsigned char buf[8];
-	long l;
-	int c;
-	FILE *f2;
-	int i;
-	
-	f = fopen(archive_file, "r+");
-	if (!f)
-	{
-		if (errno == ENOENT)
-		{
-			f = fopen(archive_file, "w");
-			if (f)
-			{
-				fputs("LWAR1V", f);
-				goto doadd;
-			}
-		}
-		perror("Cannot open archive file");
-	}
-	
-	fread(buf, 1, 6, f);
-	if (memcmp("LWAR1V", buf, 6))
-	{
-		fprintf(stderr, "%s is not a valid archive file.\n", archive_file);
-		exit(1);
-	}
-
-	for (;;)
-	{
-		c = fgetc(f);
-		if (c == EOF && ferror(f))
-		{
-			perror("Reading archive file");
-			exit(1);
-		}
-		if (c == EOF)
-			goto doadd;
-		
-		if (!c)
-		{
-			fseek(f, -1, SEEK_CUR);
-			goto doadd;
-		}
-		
-		// find the end of the file name
-		while (c)
-		{
-			c = fgetc(f);
-			if (c == EOF || ferror(f))
-			{
-				fprintf(stderr, "Bad archive file\n");
-				exit(1);
-			}
-		}
-		
-		// get length of archive member
-		l = 0;
-		c = fgetc(f);
-		l = c << 24;
-		c = fgetc(f);
-		l |= c << 16;
-		c = fgetc(f);
-		l |= c << 8;
-		c = fgetc(f);
-		l |= c;
-		
-		fseek(f, l, SEEK_CUR);
-	}
-	// back up to the NUL byte at the end of the file
-	fseek(f, -1, SEEK_CUR);
-doadd:
-	for (i = 0; i < nfiles; i++)
-	{
-		f2 = fopen(files[i], "r");
-		if (!f2)
-		{
-			fprintf(stderr, "Cannot open file %s:", files[i]);
-			perror("");
-			exit(1);
-		}
-		fread(buf, 1, 6, f2);
-		if (mergeflag && !memcmp("LWAR1V", buf, 6))
-		{
-			// add archive contents...
-			for (;;)
-			{
-				c = fgetc(f2);
-				if (c == EOF || ferror(f2))
-				{
-					perror("Reading input archive file");
-					exit(1);
-				}
-				if (c == EOF)
-					break;
-		
-				if (!c)
-				{
-					break;
-				}
-		
-				// find the end of the file name
-				while (c)
-				{
-					fputc(c, f);
-					c = fgetc(f2);
-					if (c == EOF || ferror(f))
-					{
-						fprintf(stderr, "Bad input archive file\n");
-						exit(1);
-					}
-				}
-				fputc(0, f);
-				
-				// get length of archive member
-				l = 0;
-				c = fgetc(f2);
-				fputc(c, f);
-				l = c << 24;
-				c = fgetc(f2);
-				fputc(c, f);
-				l |= c << 16;
-				c = fgetc(f2);
-				fputc(c, f);
-				l |= c << 8;
-				c = fgetc(f2);
-				fputc(c, f);
-				l |= c;
-		
-				while (l)
-				{
-					c = fgetc(f2);
-					fputc(c, f);
-					l--;
-				}
-			}
-			
-			fclose(f2);
-			continue;
-		}
-		fseek(f2, 0, SEEK_END);
-		l = ftell(f2);
-		fseek(f2, 0, SEEK_SET);
-		fputs(files[i], f);
-		fputc(0, f);
-		fputc(l >> 24, f);
-		fputc((l >> 16) & 0xff, f);
-		fputc((l >> 8) & 0xff, f);
-		fputc(l & 0xff, f);
-		while (l)
-		{
-			c = fgetc(f2);
-			fputc(c, f);
-			l--;
-		}
-	}
-	
-	// flag end of file
-	fputc(0, f);	
-}
--- a/old-trunk/lwar/extract.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-extract.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwar.h"
-
-void do_extract(void)
-{
-	FILE *f;
-	char buf[8];
-	long l;
-	int c;
-	char fnbuf[1024];
-	int i;
-	FILE *nf;
-	
-	f = fopen(archive_file, "r");
-	if (!f)
-	{
-		perror("Opening archive file");
-		exit(1);
-	}
-	
-	fread(buf, 1, 6, f);
-	if (memcmp("LWAR1V", buf, 6))
-	{
-		fprintf(stderr, "%s is not a valid archive file.\n", archive_file);
-		exit(1);
-	}
-
-	for (;;)
-	{
-		c = fgetc(f);
-		if (ferror(f))
-		{
-			perror("Reading archive file");
-			exit(1);
-		}
-		if (c == EOF)
-			return;
-		
-		
-		// find the end of the file name
-		if (!c)
-			return;
-		
-		i = 0;
-		while (c)
-		{
-			fnbuf[i++] = c;
-			c = fgetc(f);
-			if (c == EOF || ferror(f))
-			{
-				fprintf(stderr, "Bad archive file\n");
-				exit(1);
-			}
-		}
-		fnbuf[i] = 0;
-		
-		// get length of archive member
-		l = 0;
-		c = fgetc(f);
-		l = c << 24;
-		c = fgetc(f);
-		l |= c << 16;
-		c = fgetc(f);
-		l |= c << 8;
-		c = fgetc(f);
-		l |= c;
-		
-		for (i = 0; i < nfiles; i++)
-		{
-			if (!strcmp(files[i], fnbuf))
-				break;
-		}
-		if (i < nfiles || nfiles == 0)
-		{
-			// extract the file
-			nf = fopen(fnbuf, "w");
-			if (!nf)
-			{
-				fprintf(stderr, "Cannot extract '%s': %s\n", fnbuf, strerror(errno));
-				exit(1);
-			}
-			while (l)
-			{
-				c = fgetc(f);
-				fputc(c, nf);
-				l--;
-			}
-			fclose(nf);
-		}
-		else
-		{
-			// skip the file
-			fseek(f, l, SEEK_CUR);
-		}
-	}
-}
--- a/old-trunk/lwar/list.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-list.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwar.h"
-
-void do_list(void)
-{
-	FILE *f;
-	char buf[8];
-	long l;
-	int c;
-		
-	f = fopen(archive_file, "r");
-	if (!f)
-	{
-		perror("Opening archive file");
-		exit(1);
-	}
-	
-	fread(buf, 1, 6, f);
-	if (memcmp("LWAR1V", buf, 6))
-	{
-		fprintf(stderr, "%s is not a valid archive file.\n", archive_file);
-		exit(1);
-	}
-
-	for (;;)
-	{
-		c = fgetc(f);
-		if (ferror(f))
-		{
-			perror("Reading archive file");
-			exit(1);
-		}
-		if (c == EOF)
-			return;
-		
-		
-		// find the end of the file name
-		if (!c)
-			return;
-
-		while (c)
-		{
-			putchar(c);
-			c = fgetc(f);
-			if (c == EOF || ferror(f))
-			{
-				fprintf(stderr, "Bad archive file\n");
-				exit(1);
-			}
-		}
-		
-		// get length of archive member
-		l = 0;
-		c = fgetc(f);
-		l = c << 24;
-		c = fgetc(f);
-		l |= c << 16;
-		c = fgetc(f);
-		l |= c << 8;
-		c = fgetc(f);
-		l |= c;
-		printf(": %04lx bytes\n", l);
-		fseek(f, l, SEEK_CUR);
-	}
-}
--- a/old-trunk/lwar/lwar.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-lwar.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#define __lwar_c_seen__
-#include "lwar.h"
-#include "util.h"
-
-typedef struct
-{
-	FILE *f;
-} arhandle_real;
-
-int debug_level = 0;
-int operation = 0;
-int nfiles = 0;
-char *archive_file = NULL;
-int mergeflag = 0;
-
-char **files = NULL;
-
-void add_file_name(char *fn)
-{
-	files = lw_realloc(files, sizeof(char *) * (nfiles + 1));
-	files[nfiles] = fn;
-	nfiles++;
-}
--- a/old-trunk/lwar/lwar.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-lwar.h
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains the main defs used by the linker
-*/
-
-
-#define LWAR_OP_LIST	1
-#define LWAR_OP_ADD		2
-#define LWAR_OP_REMOVE	3
-#define LWAR_OP_CREATE	4
-#define LWAR_OP_EXTRACT	5
-#define LWAR_OP_REPLACE	6
-
-#ifndef __lwar_h_seen__
-#define __lwar_h_seen__
-
-#ifndef __lwar_c_seen__
-
-extern char *archive_file;
-extern int debug_level;
-extern int operation;
-extern int nfiles;
-extern char **files;
-extern int mergeflag;
-
-//typedef void * ARHANDLE;
-
-#define AR_MODE_RD		1
-#define AR_MODE_WR		2
-#define AR_MODE_RW		3
-#define AR_MODE_CREATE	4
-
-
-#define __lwar_E__ extern
-#else
-#define __lwar_E__
-#endif // __lwar_c_seen__
-
-__lwar_E__ void add_file_name(char *fn);
-
-//__lwar_E__ ARHANDLE open_archive(char *fn, int mode);
-
-#undef __lwar_E__
-
-#endif //__lwar_h_seen__
--- a/old-trunk/lwar/main.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
-main.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <argp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "lwar.h"
-
-// command line option handling
-const char *argp_program_version = "LWAR from " PACKAGE_STRING;
-const char *argp_program_bug_address = PACKAGE_BUGREPORT;
-char *program_name;
-
-static error_t parse_opts(int key, char *arg, struct argp_state *state)
-{
-	switch (key)
-	{
-	case 'd':
-		// debug
-		debug_level++;
-		break;
-	
-	case 'a':
-		// add members
-		operation = LWAR_OP_ADD;
-		break;
-	
-	case 'c':
-		// create archive
-		operation = LWAR_OP_CREATE;
-		break;
-	
-	case 'm':
-		mergeflag = 1;
-		break;
-
-	case 'r':
-		// replace members
-		operation = LWAR_OP_REPLACE;
-		break;
-	
-	case 'l':
-		// list members
-		operation = LWAR_OP_LIST;
-		break;
-	
-	case 'x':
-		// extract members
-		operation = LWAR_OP_EXTRACT;
-		break;
-
-	case ARGP_KEY_ARG:
-		if (archive_file)
-		{
-			// add archive member to list
-			add_file_name(arg);
-		}
-		else
-			archive_file = arg;
-		break;
-		
-	default:
-		return ARGP_ERR_UNKNOWN;
-	}
-	return 0;
-}
-
-static struct argp_option options[] =
-{
-	{ "replace",	'r',	0,		0,
-				"Add or replace archive members" },
-	{ "extract",	'x',	0,		0,
-				"Extract members from the archive" },
-	{ "add",		'a',	0,		0,
-				"Add members to the archive" },
-	{ "list",		'l',	0,		0,
-				"List the contents of the archive" },
-	{ "create",		'c',	0,		0,
-				"Create new archive (or truncate existing one)" },
-	{ "merge",		'm',	0,		0,
-				"Add the contents of archive arguments instead of the archives themselves" },
-	{ "debug",		'd',	0,		0,
-				"Set debug mode"},
-	{ 0 }
-};
-
-static struct argp argp =
-{
-	options,
-	parse_opts,
-	"<archive> [<file> ...]",
-	"LWAR, a library file manager for LWLINK"
-};
-
-extern void do_list(void);
-extern void do_add(void);
-extern void do_remove(void);
-extern void do_replace(void);
-extern void do_extract(void);
-
-// main function; parse command line, set up assembler state, and run the
-// assembler on the first file
-int main(int argc, char **argv)
-{
-	program_name = argv[0];
-	argp_parse(&argp, argc, argv, 0, 0, NULL);
-	if (archive_file == NULL)
-	{
-		fprintf(stderr, "You must specify an archive file.\n");
-		exit(1);
-	}
-
-	if (operation == 0)
-	{
-		fprintf(stderr, "You must specify an operation.\n");
-		exit(1);
-	}
-
-	if (operation == LWAR_OP_LIST || operation == LWAR_OP_REMOVE || operation == LWAR_OP_EXTRACT)
-	{
-		struct stat stbuf;
-		// make sure the archive exists
-		if (stat(archive_file, &stbuf) < 0)
-		{
-			fprintf(stderr, "Cannot open archive file %s:\n", archive_file);
-			perror("");
-			exit(2);
-		}
-	}
-	if (operation == LWAR_OP_CREATE)
-	{
-		struct stat stbuf;
-		// check if the archive exists
-		if (stat(archive_file, &stbuf) < 0)
-		{
-			if (errno != ENOENT)
-			{
-				fprintf(stderr, "Cannot create archive file %s:\n", archive_file);
-				perror("");
-				exit(2);
-			}
-		}
-		else
-		{
-			if (unlink(archive_file) < 0)
-			{
-				fprintf(stderr, "Cannot create archive file %s:\n", archive_file);
-				perror("");
-				exit(2);
-			}
-				
-		}
-	}
-	
-	switch (operation)
-	{
-	case LWAR_OP_LIST:
-		do_list();
-		break;
-	
-	case LWAR_OP_ADD:
-	case LWAR_OP_CREATE:
-		do_add();
-		break;
-	
-	case LWAR_OP_REMOVE:
-		do_remove();
-		break;
-	
-	case LWAR_OP_REPLACE:
-		do_replace();
-		break;
-	
-	case LWAR_OP_EXTRACT:
-		do_extract();
-		break;
-	}
-
-	exit(0);
-}
--- a/old-trunk/lwar/remove.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-remove.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include "lwar.h"
-
-void do_remove(void)
-{
-}
--- a/old-trunk/lwar/replace.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
-replace.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwar.h"
-
-void do_replace(void)
-{
-	FILE *f;
-	FILE *nf;
-	unsigned char buf[8];
-	long l;
-	int c;
-	FILE *f2;
-	int i;
-	char fnbuf[1024];
-	char fnbuf2[1024];
-		
-	sprintf(fnbuf, "%s.tmp", archive_file);
-	
-	f = fopen(archive_file, "r+");
-	if (!f)
-	{
-		if (errno == ENOENT)
-		{
-			nf = fopen(fnbuf, "w");
-			if (nf)
-			{
-				fputs("LWAR1V", nf);
-				goto doadd;
-			}
-		}
-		perror("Cannot open archive file");
-	}
-	
-	fread(buf, 1, 6, f);
-	if (memcmp("LWAR1V", buf, 6))
-	{
-		fprintf(stderr, "%s is not a valid archive file.\n", archive_file);
-		exit(1);
-	}
-
-	nf = fopen(fnbuf, "w");
-	if (!nf)
-	{
-		perror("Cannot create temp archive file");
-		exit(1);
-	}
-
-	fputs("LWAR1V", nf);
-
-	for (;;)
-	{
-		c = fgetc(f);
-		if (c == EOF && ferror(f))
-		{
-			perror("Reading archive file");
-			exit(1);
-		}
-		if (c == EOF)
-			goto doadd;
-		
-		if (!c)
-		{
-			goto doadd;
-		}
-		
-		// find the end of the file name
-		i = 0;
-		while (c)
-		{
-			fnbuf2[i++] = c;
-			c = fgetc(f);
-			if (c == EOF || ferror(f))
-			{
-				fprintf(stderr, "Bad archive file\n");
-				exit(1);
-			}
-		}
-		fnbuf2[i] = 0;
-		
-		// get length of archive member
-		l = 0;
-		c = fgetc(f);
-		l = c << 24;
-		c = fgetc(f);
-		l |= c << 16;
-		c = fgetc(f);
-		l |= c << 8;
-		c = fgetc(f);
-		l |= c;
-		
-		// is it a file we are replacing? if so, do not copy it
-		for (i = 0; i < nfiles; i++)
-		{
-			if (!strcmp(files[i], fnbuf2))
-				break;
-		}
-		if (i < nfiles)
-		{
-			fseek(f, l, SEEK_CUR);
-		}
-		else
-		{
-			// otherwise, copy it
-			fprintf(nf, "%s", fnbuf2);
-			fputc(0, nf);
-			fputc(l >> 24, nf);
-			fputc((l >> 16) & 0xff, nf);
-			fputc((l >> 8) & 0xff, nf);
-			fputc(l & 0xff, nf);
-			while (l)
-			{
-				c = fgetc(f);
-				fputc(c, nf);
-				l--;
-			}
-		}
-	}
-	
-	// done with the original file
-	fclose(f);
-doadd:
-	for (i = 0; i < nfiles; i++)
-	{
-		f2 = fopen(files[i], "r");
-		if (!f2)
-		{
-			fprintf(stderr, "Cannot open file %s:", files[i]);
-			perror("");
-			exit(1);
-		}
-		fread(buf, 1, 6, f2);
-		if (mergeflag && !memcmp("LWAR1V", buf, 6))
-		{
-			// add archive contents...
-			for (;;)
-			{
-				c = fgetc(f2);
-				if (c == EOF || ferror(f2))
-				{
-					perror("Reading input archive file");
-					exit(1);
-				}
-				if (c == EOF)
-					break;
-		
-				if (!c)
-				{
-					break;
-				}
-		
-				// find the end of the file name
-				while (c)
-				{
-					fputc(c, nf);
-					c = fgetc(f2);
-					if (c == EOF || ferror(f))
-					{
-						fprintf(stderr, "Bad input archive file\n");
-						exit(1);
-					}
-				}
-				fputc(0, nf);
-				
-				// get length of archive member
-				l = 0;
-				c = fgetc(f2);
-				fputc(c, nf);
-				l = c << 24;
-				c = fgetc(f2);
-				fputc(c, nf);
-				l |= c << 16;
-				c = fgetc(f2);
-				fputc(c, nf);
-				l |= c << 8;
-				c = fgetc(f2);
-				fputc(c, nf);
-				l |= c;
-		
-				while (l)
-				{
-					c = fgetc(f2);
-					fputc(c, nf);
-					l--;
-				}
-			}
-			
-			fclose(f2);
-			continue;
-		}
-		fseek(f2, 0, SEEK_END);
-		l = ftell(f2);
-		fseek(f2, 0, SEEK_SET);
-		fputs(files[i], nf);
-		fputc(0, nf);
-		fputc(l >> 24, nf);
-		fputc((l >> 16) & 0xff, nf);
-		fputc((l >> 8) & 0xff, nf);
-		fputc(l & 0xff, nf);
-		while (l)
-		{
-			c = fgetc(f2);
-			fputc(c, nf);
-			l--;
-		}
-	}
-	
-	// flag end of file
-	fputc(0, nf);
-	
-	fclose(nf);
-	
-	if (rename(fnbuf, archive_file) < 0)
-	{
-		perror("Cannot replace old archive file");
-		unlink(fnbuf);
-	}
-}
--- a/old-trunk/lwar/util.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
-util.c
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Utility functions
-*/
-
-#define __util_c_seen__
-#include <config.h>
-
-#include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "util.h"
-
-void *lw_malloc(int size)
-{
-	void *ptr;
-	
-	ptr = malloc(size);
-	if (!ptr)
-	{
-		// bail out; memory allocation error
-		fprintf(stderr, "lw_malloc(): Memory allocation error\n");
-		exit(1);
-	}
-	return ptr;
-}
-
-void *lw_realloc(void *optr, int size)
-{
-	void *ptr;
-	
-	if (size == 0)
-	{
-		lw_free(optr);
-		return;
-	}
-	
-	ptr = realloc(optr, size);
-	if (!ptr)
-	{
-		fprintf(stderr, "lw_realloc(): memory allocation error\n");
-		exit(1);
-	}
-}
-
-void lw_free(void *ptr)
-{
-	if (ptr)
-		free(ptr);
-}
-
-char *lw_strdup(const char *s)
-{
-	char *d;
-	
-	if (!s)
-		return NULL;
-
-	d = strdup(s);
-	if (!d)
-	{
-		fprintf(stderr, "lw_strdup(): memory allocation error\n");
-		exit(1);
-	}
-	
-	return d;
-}
--- a/old-trunk/lwar/util.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-util.h
-Copyright © 2009 William Astle
-
-This file is part of LWAR.
-
-LWAR is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Utility functions
-*/
-
-#ifndef __util_h_seen__
-#define __util_h_seen__
-
-#ifndef __util_c_seen__
-#define __util_E__ extern
-#else
-#define __util_E__
-#endif
-
-// allocate memory
-__util_E__ void *lw_malloc(int size);
-__util_E__ void lw_free(void *ptr);
-__util_E__ void *lw_realloc(void *optr, int size);
-
-// string stuff
-__util_E__ char *lw_strdup(const char *s);
-
-#undef __util_E__
-
-#endif // __util_h_seen__
--- a/old-trunk/lwasm/Makefile.am	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/lwlib
-bin_PROGRAMS = lwasm
-lwasm_SOURCES = main.c lwasm.c pragma.c
-lwasm_LDADD = -L$(top_builddir)/lib -L$(top_srcdir)/lib -L$(top_srcdir)/lwlib -lgnu -llw
-EXTRA_DIST = lwasm.h
--- a/old-trunk/lwasm/lwasm.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-lwasm.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Contains random functions used by the assembler
-*/
-
-#define __lwasm_c_seen__
-#include <config.h>
-
-#include "lwasm.h"
-
-int debug_level = 0;
-
--- a/old-trunk/lwasm/lwasm.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-lwasm.h
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains the main defs used by the assembler
-*/
-
-
-#ifndef __lwasm_h_seen__
-#define __lwasm_h_seen__
-
-#define OUTPUT_DECB		0	// DECB multirecord format
-#define OUTPUT_RAW		1	// raw sequence of bytes
-#define OUTPUT_OBJ		2	// proprietary object file format
-#define OUTPUT_RAWREL	3	// raw bytes where ORG causes a SEEK in the file
-#define OUTPUT_OS9		4	// os9 module target
-
-// keep track of current assembler state
-typedef struct {
-	const char *infile;			// input file
-	const char *outfile;		// output file
-	const char *listfile;		// output listing file
-	int outformat;				// output format type
-	int no6309;					// set for 6809-only mode
-	int pragmas;				// pragmas in effect
-} asmstate_t;
-
-// do not rewrite XXX,r to ,r if XXX evaluates to 0
-#define PRAGMA_NOINDEX0TONONE	1
-// any undefined symbols are considered external
-#define PRAGMA_UNDEFEXTERN		2
-// allow C-style escapes in fcc, fcs, and fcn directives
-#define PRAGMA_CESCAPES			4
-// allow "export <undefsym>" to import the symbol
-#define PRAGMA_IMPORTUNDEFEXPORT	8
-// don't have $ as a local symbol
-#define PRAGMA_DOLLARNOTLOCAL	16
-
-#ifndef __lwasm_c_seen__
-#define __lwasm_E__ extern
-#else
-#define __lwasm_E__
-#endif
-
-__lwasm_E__ int debug_level;
-
-#undef __lwasm_E__
-
-#endif //__lwasm_h_seen__
--- a/old-trunk/lwasm/main.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
-main.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <argp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "lwasm.h"
-
-extern void pseudo_pragma_real(asmstate_t *as, void *cl, char **optr, int error);
-
-// command line option handling
-const char *argp_program_version = "LWASM from " PACKAGE_STRING;
-const char *argp_program_bug_address = PACKAGE_BUGREPORT;
-
-static error_t parse_opts(int key, char *arg, struct argp_state *state)
-{
-	asmstate_t *as = state -> input;
-	char *p;
-	
-	switch (key)
-	{
-	case 'o':
-		// output
-		if (as -> outfile)
-		{
-		}
-		as -> outfile = arg;
-		break;
-	
-	case 'd':
-		// debug
-		debug_level++;
-		break;
-	
-	case 'l':
-		// list
-		if (arg)
-			as -> listfile = arg;
-		else
-			as -> listfile = "-";
-		break;
-	
-	case 'b':
-		// decb output
-		as -> outformat = OUTPUT_DECB;
-		break;
-	
-	case 'r':
-		// raw binary output
-		as -> outformat = OUTPUT_RAW;
-		break;
-	
-	case 0x100:
-		// proprietary object format
-		as -> outformat = OUTPUT_OBJ;
-		break;
-		
-	case 'f':
-		// output format
-		if (!strcasecmp(arg, "decb"))
-			as -> outformat = OUTPUT_DECB;
-		else if (!strcasecmp(arg, "raw"))
-			as -> outformat = OUTPUT_RAW;
-		else if (!strcasecmp(arg, "obj"))
-			as -> outformat = OUTPUT_OBJ;
-		else if (!strcasecmp(arg, "os9"))
-		{
-			as -> pragmas |= PRAGMA_DOLLARNOTLOCAL;
-			as -> outformat = OUTPUT_OS9;
-		}
-		else
-		{
-			fprintf(stderr, "Invalid output format: %s\n", arg);
-			exit(1);
-		}
-		break;
-	
-	case 'p':
-		// pragmas
-		p = arg;
-		pseudo_pragma_real(as, NULL, &p, 2);
-		if (!p)
-		{
-			fprintf(stderr, "Invalid pragma string: %s\n", arg);
-			exit(1);
-		}
-		break;
-
-	case '9':
-		as -> no6309 = 1;
-		break;
-	
-	case '3':
-		as -> no6309 = 0;
-		break;
-
-	case ARGP_KEY_END:
-		// done; sanity check
-		if (!as -> outfile)
-			as -> outfile = "a.out";
-		break;
-	
-	case ARGP_KEY_ARG:
-		// non-option arg
-		if (as -> infile)
-			argp_usage(state);
-		as -> infile = arg;
-		break;
-		
-	default:
-		return ARGP_ERR_UNKNOWN;
-	}
-	return 0;
-}
-
-static struct argp_option options[] =
-{
-	{ "output",		'o',	"FILE",	0,
-				"Output to FILE"},
-	{ "debug",		'd',	0,		0,
-				"Set debug mode"},
-	{ "format",		'f',	"TYPE",	0,
-				"Select output format: decb, raw, obj, os9"},
-	{ "list",		'l',	"FILE",	OPTION_ARG_OPTIONAL,
-				"Generate list [to FILE]"},
-	{ "decb",		'b',	0,		0,
-				"Generate DECB .bin format output, equivalent of --format=decb"},
-	{ "raw",		'r',	0,		0,
-				"Generate raw binary format output, equivalent of --format=raw"},
-	{ "obj",		0x100,		0,		0,
-				"Generate proprietary object file format for later linking, equivalent of --format=obj" },
-	{ "pragma",		'p',	"PRAGMA",	0,
-				"Set an assembler pragma to any value understood by the \"pragma\" pseudo op"},
-	{ "6809",		'9',	0,			0,
-				"Set assembler to 6809 only mode" },
-	{ "6309",		'3',	0,			0,
-				"Set assembler to 6309 mode (default)" },
-	{ 0 }
-};
-
-static struct argp argp =
-{
-	options,
-	parse_opts,
-	"<input file>",
-	"LWASM, a HD6309 and MC6809 cross-assembler"
-};
-
-char *program_name;
-
-// main function; parse command line, set up assembler state, and run the
-// assembler on the first file
-int main(int argc, char **argv)
-{
-	asmstate_t asmstate;
-
-	program_name = argv[0];
-	
-	argp_parse(&argp, argc, argv, 0, 0, &asmstate);
-
-	if (!asmstate.infile)
-	{
-		fprintf(stderr, "No input files specified.\n");
-		exit(1);
-	}	
-
-	// lose the output file if it already exists...
-	unlink(asmstate.outfile);
-
-	exit(0);
-}
-
--- a/old-trunk/lwasm/old/expr.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,938 +0,0 @@
-/*
-expr.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-This file contains the actual expression evaluator
-*/
-
-#define __expr_c_seen__
-
-#include <config.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "expr.h"
-#include "util.h"
-#include "lwasm.h"
-
-lwasm_expr_stack_t *lwasm_expr_stack_create(void)
-{
-	lwasm_expr_stack_t *s;
-	
-	s = lwasm_alloc(sizeof(lwasm_expr_stack_t));
-	s -> head = NULL;
-	s -> tail = NULL;
-	return s;
-}
-
-void lwasm_expr_stack_free(lwasm_expr_stack_t *s)
-{
-	while (s -> head)
-	{
-		s -> tail = s -> head;
-		s -> head = s -> head -> next;
-		lwasm_expr_term_free(s -> tail -> term);
-		lwasm_free(s -> tail);
-	}
-	lwasm_free(s);
-}
-
-void lwasm_expr_term_free(lwasm_expr_term_t *t)
-{
-	if (t)
-	{
-		if (t -> term_type == LWASM_TERM_SYM)
-			lwasm_free(t -> symbol);
-		lwasm_free(t);
-	}
-}
-
-lwasm_expr_term_t *lwasm_expr_term_create_oper(int oper)
-{
-	lwasm_expr_term_t *t;
-
-	debug_message(10, "Creating operator term: %d", oper);
-	
-	t = lwasm_alloc(sizeof(lwasm_expr_term_t));
-	t -> term_type = LWASM_TERM_OPER;
-	t -> value = oper;
-	return t;
-}
-
-lwasm_expr_term_t *lwasm_expr_term_create_int(int val)
-{
-	lwasm_expr_term_t *t;
-	debug_message(10, "Creating integer term: %d", val);
-	
-	t = lwasm_alloc(sizeof(lwasm_expr_term_t));
-	t -> term_type = LWASM_TERM_INT;
-	t -> value = val;
-	return t;
-}
-
-lwasm_expr_term_t *lwasm_expr_term_create_secbase(void)
-{
-	lwasm_expr_term_t *t;
-	debug_message(10, "Creating section base term");
-	
-	t = lwasm_alloc(sizeof(lwasm_expr_term_t));
-	t -> term_type = LWASM_TERM_SECBASE;
-	return t;
-}
-
-lwasm_expr_term_t *lwasm_expr_term_create_sym(char *sym)
-{
-	lwasm_expr_term_t *t;
-	
-	debug_message(10, "Creating symbol term: %s", sym);
-	
-	t = lwasm_alloc(sizeof(lwasm_expr_term_t));
-	t -> term_type = LWASM_TERM_SYM;
-	t -> symbol = lwasm_strdup(sym);
-	return t;
-}
-
-lwasm_expr_term_t *lwasm_expr_term_dup(lwasm_expr_term_t *t)
-{
-	switch (t -> term_type)
-	{
-	case LWASM_TERM_INT:
-		return lwasm_expr_term_create_int(t -> value);
-		
-	case LWASM_TERM_OPER:
-		return lwasm_expr_term_create_oper(t -> value);
-		
-	case LWASM_TERM_SYM:
-		return lwasm_expr_term_create_sym(t -> symbol);
-	
-	case LWASM_TERM_SECBASE:
-		return lwasm_expr_term_create_secbase();
-		
-	default:
-		debug_message(0, "lwasm_expr_term_dup(): invalid term type %d", t -> term_type);
-		exit(1);
-	}
-// can't get here
-}
-
-void lwasm_expr_stack_push(lwasm_expr_stack_t *s, lwasm_expr_term_t *t)
-{
-	lwasm_expr_stack_node_t *n;
-
-	if (!s)
-	{
-		debug_message(0, "lwasm_expr_stack_push(): invalid stack pointer");
-		exit(1);
-	}
-	
-	n = lwasm_alloc(sizeof(lwasm_expr_stack_node_t));
-	n -> next = NULL;
-	n -> prev = s -> tail;
-	n -> term = lwasm_expr_term_dup(t);
-	
-	if (s -> head)
-	{
-		s -> tail -> next = n;
-		s -> tail = n;
-	}
-	else
-	{
-		s -> head = n;
-		s -> tail = n;
-	}
-}
-
-lwasm_expr_term_t *lwasm_expr_stack_pop(lwasm_expr_stack_t *s)
-{
-	lwasm_expr_term_t *t;
-	lwasm_expr_stack_node_t *n;
-	
-	if (!(s -> tail))
-		return NULL;
-	
-	n = s -> tail;
-	s -> tail = n -> prev;
-	if (!(n -> prev))
-	{
-		s -> head = NULL;
-	}
-	
-	t = n -> term;
-	n -> term = NULL;
-	
-	lwasm_free(n);
-	
-	return t;
-}
-
-// the following two functions are co-routines which actually parse
-// an infix expression onto the expression stack, each returns -1
-// if an error is encountered
-
-/*
-parse a term and push it onto the stack
-
-this function handles unary prefix operators (-, +, .not., .com.)
-as well as ()
-*/
-int lwasm_expr_parse_term(lwasm_expr_stack_t *s, const char **p)
-{
-	lwasm_expr_term_t *t;
-	debug_message(2, "Expression string %s", *p);
-
-eval_next:
-	if (!**p || isspace(**p) || **p == ')' || **p == ']')
-		return -1;
-	if (**p == '(')
-	{
-		debug_message(3, "Starting paren");
-		(*p)++;
-		lwasm_expr_parse_expr(s, p, 0);
-		if (**p != ')')
-			return -1;
-		(*p)++;
-		return 0;
-	}
-	
-	if (**p == '+')
-	{
-		debug_message(3, "Unary +");
-		(*p)++;
-		goto eval_next;
-	}
-	
-	if (**p == '-')
-	{
-		// parse expression following "-"
-		(*p)++;
-		if (lwasm_expr_parse_expr(s, p, 200) < 0)
-			return -1;
-		t = lwasm_expr_term_create_oper(LWASM_OPER_NEG);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	
-	if (**p == '^' || **p == '~')
-	{
-		// parse expression following "^"
-		(*p)++;
-		if (lwasm_expr_parse_expr(s, p, 200) < 0)
-			return -1;
-		t = lwasm_expr_term_create_oper(LWASM_OPER_COM);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	
-	/*
-		we have an actual term here so evaluate it
-		
-		it could be one of the following:
-		
-		1. a decimal constant
-		2. a hexadecimal constant
-		3. an octal constant
-		4. a binary constant
-		5. a symbol reference
-		6. the "current" instruction address (*)
-		7. the "current" data address (.)
-		8. a "back reference" (<)
-		9. a "forward reference" (>)
-		
-		items 6 through 9 are stored as symbol references
-		
-		(a . followed by a . or a alpha char or number is a symbol)
-	*/
-	if (**p == '*'
-		|| (
-			**p == '.' 
-			&& (*p)[1] != '.' 
-			&& !((*p)[1] >= 'A' && (*p)[1] <= 'Z') 
-			&& !((*p)[1] >= 'a' && (*p)[1] <= 'z') 
-			&& !((*p)[1] >= '0' && (*p)[1] <= '9')
-			)
-		|| **p == '<'
-		|| **p == '>')
-	{
-		char tstr[2];
-		tstr[0] = **p;
-		tstr[1] = '\0';
-		t = lwasm_expr_term_create_sym(tstr);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		(*p)++;
-		return 0;
-	}
-	
-	/*
-		- a symbol will be a string of characters introduced by a letter, ".",
-		  "_" but NOT a number OR it may start with a digit if it contains a $
-		- a decimal constant will consist of only digits, optionally prefixed
-		  with "&"
-		- a binary constant will consist of only 0s and 1s either prefixed with %
-		  or suffixed with "B"
-		- a hex constant will consist of 0-9A-F either prefixed with $ or
-		  suffixed with "H"; a hex number starting with A-F must be prefixed
-		  with $ or start with 0 and end with H
-		- an octal constant will consist of 0-7 either prefixed with @ or
-		  suffixed with "O" or "Q"
-		- an ascii constant will be a single character prefixed with a '
-		- a double ascii constant will be two characters prefixed with a "
-		
-	*/
-	if (**p == '"')
-	{
-		// double ascii constant
-		int val;
-		(*p)++;
-		if (!**p)
-			return -1;
-		if (!*((*p)+1))
-			return -1;
-		val = **p << 8 | *((*p) + 1);
-		(*p) += 2;
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	else if (**p == '\'')
-	{
-		// single ascii constant
-		int val;
-		(*p)++;
-		debug_message(3, "Single ascii character constant '%c'", **p);
-		if (!**p)
-			return -1;
-		val = **p;
-		(*p)++;
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	else if (**p == '&')
-	{
-		// decimal constant
-		int val = 0;
-		
-		(*p)++;
-		while (**p && strchr("0123456789", **p))
-		{
-			val = val * 10 + (**p - '0');
-			(*p)++;
-		}
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	else if (**p == '%')
-	{
-		// binary constant
-		int val = 0;
-		
-		(*p)++;
-		while (**p == '0' || **p == '1')
-		{
-			val = val * 2 + (**p - '0');
-			(*p)++;
-		}
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	else if (**p == '$')
-	{
-		// hexadecimal constant
-		int val = 0, val2;
-		
-		(*p)++;
-		debug_message(3, "Found prefix hex constant: %s", *p);
-		while (**p && strchr("0123456789ABCDEFabcdef", **p))
-		{
-			val2 = toupper(**p) - '0';
-			if (val2 > 9)
-				val2 -= 7;
-			debug_message(3, "Got char: %c (%d)", **p, val2);
-			val = val * 16 + val2;
-			(*p)++;
-		}
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	else if (**p == '0' && tolower(*(*p + 1)) == 'x')
-	{
-		// "C" style hexadecimal constant
-		int val = 0, val2;
-		
-		(*p)+=2;
-		debug_message(3, "Found \"C\" style prefix hex constant: %s", *p);
-		while (**p && strchr("0123456789ABCDEFabcdef", **p))
-		{
-			val2 = toupper(**p) - '0';
-			if (val2 > 9)
-				val2 -= 7;
-			debug_message(3, "Got char: %c (%d)", **p, val2);
-			val = val * 16 + val2;
-			(*p)++;
-		}
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	// an @ followed by a digit is an octal number
-	// but if it's followed by anything else, it is a symbol
-	else if (**p == '@' && isdigit(*(*p + 1)))
-	{
-		// octal constant
-		int val = 0;
-		
-		(*p)++;
-		while (**p && strchr("01234567", **p))
-		{
-			val = val * 8 + (**p - '0');
-			(*p)++;
-		}
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-
-	// symbol or bare decimal or suffix identified constant here
-	
-	// find the end of a potential symbol
-	do
-	{
-		int l = 0;
-		char *sb;
-		int havedol = 0;
-		
-		// evaluate a symbol here
-		static const char *symchars = "_.$@?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-		while ((*p)[l] && strchr(symchars, (*p)[l]))
-		{
-			if ((*p)[l] == '$')
-				havedol = 1;
-			l++;
-		}
-		if (l == 0)
-			return -1;
-
-		if (havedol || **p < '0' || **p > '9')
-		{
-			// have a symbol here
-
-			sb = lwasm_alloc(l + 1);
-			sb[l] = '\0';
-			memcpy(sb, *p, l);
-			t = lwasm_expr_term_create_sym(sb);
-			lwasm_expr_stack_push(s, t);
-			lwasm_expr_term_free(t);
-			(*p) += l;
-			debug_message(3, "Symbol: '%s'; (%s)", sb, *p);
-			lwasm_free(sb);
-			return 0;
-		}
-	} while (0);
-
-	if (!**p)
-		return -1;
-	
-	// evaluate a suffix based constant
-	{
-		int decval = 0, binval = 0, hexval = 0, octval = 0;
-		int valtype = 15;	// 1 = bin, 2 = oct, 4 = dec, 8 = hex
-		int bindone = 0;
-		int val;
-		int dval;
-		
-		while (1)
-		{
-			if (!**p || !strchr("0123456789ABCDEFabcdefqhoQHO", **p))
-			{
-				// we can legally have bin or decimal here
-				if (bindone)
-				{
-					// we just finished a binary value
-					val = binval;
-					break;
-				}
-				else if (valtype & 4)
-				{
-					// otherwise we must be decimal (if we're still allowed one)
-					val = decval;
-					debug_message(3, "End of decimal value");
-					break;
-				}
-				else
-				{
-					// bad value
-					return -1;
-				}
-			}
-			
-			dval = toupper(**p);
-			(*p)++;
-			
-			if (bindone)
-			{
-				// any characters past "B" means it is not binary
-				bindone = 0;
-				valtype &= 14;
-			}
-			
-			switch (dval)
-			{
-			case 'Q':
-			case 'O':
-				if (valtype & 2)
-				{
-					val = octval;
-					valtype = -1;
-					break;
-				}
-				else
-				{
-					// not a valid octal value
-					return -1;
-				}
-				/* can't get here */
-
-			case 'H':
-				if (valtype & 8)
-				{
-					val = hexval;
-					valtype = -1;
-					break;
-				}
-				else
-				{
-					// not a valid hex number
-					return -1;
-				}
-				/* can't get here */
-
-			case 'B':
-				// this is a bit of a sticky one since B is a legit hex
-				// digit so this may or may not be the end of the number
-				// so we fall through to the digit case
-
-				if (valtype & 1)
-				{
-					// could still be binary
-					bindone = 1;
-					valtype = 9;	// hex and binary
-				}
-				/* fall through intentional */
-				
-			default:
-				// digit
-				dval -= '0';
-				if (dval > 9)
-					dval -= 7;
-				debug_message(3, "Got digit: %d", dval);
-//				if (dval > 1)
-//					valtype &= 14;
-//				if (dval > 7)
-//					valtype &= 12;
-//				if (dval > 9)
-//					valtype &= 8;
-
-				if (valtype & 8)
-				{
-					hexval = hexval * 16 + dval;
-				}
-				if (valtype & 4)
-				{
-					if (dval > 9)
-						valtype &= 11;
-					else
-						decval = decval * 10 + dval;
-				}
-				if (valtype & 2)
-				{
-					if (dval > 7)
-						valtype &= 13;
-					else
-						octval = octval * 8 + dval;
-				}
-				if (valtype & 1)
-				{
-					if (dval > 1)
-						valtype &= 14;
-					else
-						binval = binval * 2 + dval;
-				}
-			}
-			// break out if we have a return value
-			if (valtype == -1)
-				break;
-			// return if no more valid possibilities!
-			if (valtype == 0)
-				return -1;
-			val = decval;	// in case we fall through
-		}
-		
-		// we get here when we have a value to return
-		t = lwasm_expr_term_create_int(val);
-		lwasm_expr_stack_push(s, t);
-		lwasm_expr_term_free(t);
-		return 0;
-	}
-	/* can't get here */
-}
-
-// parse an expression and push the result onto the stack
-// if an operator of lower precedence than the value of "prec" is found,
-int lwasm_expr_parse_expr(lwasm_expr_stack_t *s, const char **p, int prec)
-{
-	static const struct operinfo
-	{
-		int opernum;
-		char *operstr;
-		int operprec;
-	} operators[] =
-	{
-		{ LWASM_OPER_PLUS, "+", 100 },
-		{ LWASM_OPER_MINUS, "-", 100 },
-		{ LWASM_OPER_TIMES, "*", 150 },
-		{ LWASM_OPER_DIVIDE, "/", 150 },
-		{ LWASM_OPER_MOD, "%", 150 },
-		{ LWASM_OPER_INTDIV, "\\", 150 },
-		
-		// boolean AND/OR
-		{ LWASM_OPER_AND, "&&", 25 },
-		{ LWASM_OPER_OR, "||", 25 },
-		
-		// bitwise ops
-		{ LWASM_OPER_BWAND, "&", 50 },
-		{ LWASM_OPER_BWOR, "|", 50 },
-		
-		// this collides with the unary complement but shouldn't cause
-		// any trouble because of operator precedence
-		{ LWASM_OPER_BWXOR, "^", 50 },
-		
-		{ LWASM_OPER_NONE, "", 0 }
-	};	
-	int opern, i;
-	lwasm_expr_term_t *operterm;
-	
-	// return if we are at the end of the expression or a subexpression
-	if (!**p || isspace(**p) || **p == ')' || **p == ',' || **p == ']')
-		return 0;
-	
-	if (lwasm_expr_parse_term(s, p) < 0)
-		return -1;
-
-eval_next:
-	if (!**p || isspace(**p) || **p == ')' || **p == ',' || **p == ']')
-		return 0;
-	
-	// expecting an operator here
-	for (opern = 0; operators[opern].opernum != LWASM_OPER_NONE; opern++)
-	{
-		for (i = 0; (*p)[i] && operators[opern].operstr[i] && ((*p)[i] == operators[opern].operstr[i]); i++)
-			/* do nothing */ ;
-		if (operators[opern].operstr[i] == '\0')
-			break;
-	}
-	if (operators[opern].opernum == LWASM_OPER_NONE)
-	{
-		// unrecognized operator
-		return -1;
-	}
-	
-	// the operator number in question is in opern; i is the length of the
-	// operator string
-	
-	// logic:
-	// if the precedence of this operation is <= to the "prec" flag,
-	// we simply return without advancing the input pointer; the operator
-	// will be evaluated again in the enclosing function call
-	if (operators[opern].operprec <= prec)
-		return 0;
-	
-	// logic:
-	// we have a higher precedence operator here so we will advance the
-	// input pointer to the next term and let the expression evaluator
-	// loose on it after which time we will push our operator onto the
-	// stack and then go on with the expression evaluation
-	(*p) += i;	// advance input pointer
-	
-	// evaluate next expression(s) of higher precedence
-	if (lwasm_expr_parse_expr(s, p, operators[opern].operprec) < 0)
-		return -1;
-	
-	operterm = lwasm_expr_term_create_oper(operators[opern].opernum);
-	lwasm_expr_stack_push(s, operterm);
-	lwasm_expr_term_free(operterm);
-	
-	// return if we are at the end of the expression or a subexpression
-	if (!**p || isspace(**p) || **p == ')')
-		return 0;
-
-	// continue evaluating
-	goto eval_next;	 	
-}
-
-/*
-actually evaluate an expression
-
-This happens in two stages. The first stage merely parses the expression into
-a lwasm_expr_stack_t * which is then evaluated as much as possible before the
-result is returned.
-
-Returns NULL on a parse error or otherwise invalid expression. *outp will
-contain the pointer to the next character after the expression if and only
-if there is no error. In the case of an error, *outp is undefined.
-*/
-lwasm_expr_stack_t *lwasm_expr_eval(const char *inp, const char **outp, lwasm_expr_stack_t *(*sfunc)(char *sym, void *state), void *state)
-{
-	lwasm_expr_stack_t *s;
-	const char *p;
-	int rval;
-		
-	// actually parse the expression
-	p = inp;
-	s = lwasm_expr_stack_create();
-	
-	rval = lwasm_expr_parse_expr(s, &p, 0);
-	if (rval < 0)
-		goto cleanup_error;
-	
-	// save end of expression
-	if (outp)
-		(*outp) = p;
-	
-	// return potentially partial expression
-	if (lwasm_expr_reval(s, sfunc, state) < 0)
-		goto cleanup_error;
-
-	if (lwasm_expr_is_constant(s))
-		debug_message(3, "Constant expression evaluates to: %d", lwasm_expr_get_value(s));
-	
-	return s;
-
-cleanup_error:
-	lwasm_expr_stack_free(s);
-	return NULL;
-}
-
-/*
-take an expression stack s and scan for operations that can be completed
-
-return -1 on error, 0 on no error
-
-possible errors are: division by zero or unknown operator
-
-theory of operation:
-
-scan the stack for an operator which has two constants preceding it (binary)
-or 1 constant preceding it (unary) and if found, perform the calculation
-and replace the operator and its operands with the result
-
-repeat the scan until no futher simplications are found or if there are no
-further operators or only a single term remains
-
-*/
-int lwasm_expr_reval(lwasm_expr_stack_t *s, lwasm_expr_stack_t *(*sfunc)(char *sym, void *state), void *state)
-{
-	lwasm_expr_stack_node_t *n, *n2;
-	lwasm_expr_stack_t *ss;
-	int c;
-	
-next_iter_sym:
-	// resolve symbols
-	// symbols that do not resolve to an expression are left alone
-	for (c = 0, n = s -> head; n; n = n -> next)
-	{
-		if (n -> term -> term_type == LWASM_TERM_SYM)
-		{
-			ss = sfunc(n -> term -> symbol, state);
-			if (ss)
-			{
-				c++;
-				// splice in the result stack
-				if (n -> prev)
-				{
-					n -> prev -> next = ss -> head;
-				}
-				else
-				{
-					s -> head = ss -> head;
-				}
-				ss -> head -> prev = n -> prev;
-				ss -> tail -> next = n -> next;
-				if (n -> next)
-				{
-					n -> next -> prev = ss -> tail;
-				}
-				else
-				{
-					s -> tail = ss -> tail;
-				}
-				lwasm_expr_term_free(n -> term);
-				lwasm_free(n);
-				n = ss -> tail;
-				
-				ss -> head = NULL;
-				ss -> tail = NULL;
-				lwasm_expr_stack_free(ss);
-			}
-		}
-	}
-	if (c)
-		goto next_iter_sym;
-
-next_iter:	
-	// a single term
-	if (s -> head == s -> tail)
-		return 0;
-	
-	// search for an operator
-	for (n = s -> head; n; n = n -> next)
-	{
-		if (n -> term -> term_type == LWASM_TERM_OPER)
-		{
-			if (n -> term -> value == LWASM_OPER_NEG
-				|| n -> term -> value == LWASM_OPER_COM
-				)
-			{
-				// unary operator
-				if (n -> prev && n -> prev -> term -> term_type == LWASM_TERM_INT)
-				{
-					// a unary operator we can resolve
-					// we do the op then remove the term "n" is pointing at
-					if (n -> term -> value == LWASM_OPER_NEG)
-					{
-						n -> prev -> term -> value = -(n -> prev -> term -> value);
-					}
-					else if (n -> term -> value == LWASM_OPER_COM)
-					{
-						n -> prev -> term -> value = ~(n -> prev -> term -> value);
-					}
-					n -> prev -> next = n -> next;
-					if (n -> next)
-						n -> next -> prev = n -> prev;
-					else
-						s -> tail = n -> prev;	
-					
-					lwasm_expr_term_free(n -> term);
-					lwasm_free(n);
-					break;
-				}
-			}
-			else
-			{
-				// binary operator
-				if (n -> prev && n -> prev -> prev && n -> prev -> term -> term_type == LWASM_TERM_INT && n -> prev -> prev -> term -> term_type == LWASM_TERM_INT)
-				{
-					// a binary operator we can resolve
-					switch (n -> term -> value)
-					{
-					case LWASM_OPER_PLUS:
-						n -> prev -> prev -> term -> value += n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_MINUS:
-						n -> prev -> prev -> term -> value -= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_TIMES:
-						n -> prev -> prev -> term -> value *= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_DIVIDE:
-						if (n -> prev -> term -> value == 0)
-							return -1;
-						n -> prev -> prev -> term -> value /= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_MOD:
-						if (n -> prev -> term -> value == 0)
-							return -1;
-						n -> prev -> prev -> term -> value %= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_INTDIV:
-						if (n -> prev -> term -> value == 0)
-							return -1;
-						n -> prev -> prev -> term -> value /= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_BWAND:
-						n -> prev -> prev -> term -> value &= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_BWOR:
-						n -> prev -> prev -> term -> value |= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_BWXOR:
-						n -> prev -> prev -> term -> value ^= n -> prev -> term -> value;
-						break;
-
-					case LWASM_OPER_AND:
-						n -> prev -> prev -> term -> value = (n -> prev -> term -> value && n -> prev -> prev -> term -> value) ? 1 : 0;
-						break;
-
-					case LWASM_OPER_OR:
-						n -> prev -> prev -> term -> value = (n -> prev -> term -> value || n -> prev -> prev -> term -> value) ? 1 : 0;
-						break;
-
-					default:
-						// return error if unknown operator!
-						return -1;
-					}
-
-					// now remove the two unneeded entries from the stack
-					n -> prev -> prev -> next = n -> next;
-					if (n -> next)
-						n -> next -> prev = n -> prev -> prev;
-					else
-						s -> tail = n -> prev -> prev;	
-					
-					lwasm_expr_term_free(n -> term);
-					lwasm_expr_term_free(n -> prev -> term);
-					lwasm_free(n -> prev);
-					lwasm_free(n);
-					break;
-				}
-			}
-		}
-	}
-	// note for the terminally confused about dynamic memory and pointers:
-	// n will not be NULL even after the lwasm_free calls above so
-	// this test will still work (n will be a dangling pointer)
-	// (n will only be NULL if we didn't find any operators to simplify)
-	if (n)
-		goto next_iter;
-	
-	return 0;
-}
--- a/old-trunk/lwasm/old/expr.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
-expr.h
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Definitions for expression evaluator
-*/
-
-#ifndef __expr_h_seen__
-#define __expr_h_seen__
-
-#ifndef __expr_c_seen__
-#define __expr_E__ extern
-#else
-#define __expr_E__
-#endif
-
-// term types
-#define LWASM_TERM_NONE		0
-#define LWASM_TERM_OPER		1	// an operator
-#define LWASM_TERM_INT		2	// 32 bit signed integer
-#define LWASM_TERM_SYM		3	// symbol reference
-#define LWASM_TERM_SECBASE	4	// section base reference
-
-// operator types
-#define LWASM_OPER_NONE		0
-#define LWASM_OPER_PLUS		1	// +
-#define LWASM_OPER_MINUS	2	// -
-#define LWASM_OPER_TIMES	3	// *
-#define LWASM_OPER_DIVIDE	4	// /
-#define LWASM_OPER_MOD		5	// %
-#define LWASM_OPER_INTDIV	6	// \ (don't end line with \)
-#define LWASM_OPER_BWAND	7	// bitwise AND
-#define LWASM_OPER_BWOR		8	// bitwise OR
-#define LWASM_OPER_BWXOR	9	// bitwise XOR
-#define LWASM_OPER_AND		10	// boolean AND
-#define LWASM_OPER_OR		11	// boolean OR
-#define LWASM_OPER_NEG		12	// - unary negation (2's complement)
-#define LWASM_OPER_COM		13	// ^ unary 1's complement
-
-
-// term structure
-typedef struct lwasm_expr_term_s
-{
-	int term_type;		// type of term (see above)
-	char *symbol;		// name of a symbol
-	int value;			// value of the term (int) or operator number (OPER)
-} lwasm_expr_term_t;
-
-// type for an expression evaluation stack
-typedef struct lwasm_expr_stack_node_s lwasm_expr_stack_node_t;
-struct lwasm_expr_stack_node_s
-{
-	lwasm_expr_term_t		*term;
-	lwasm_expr_stack_node_t	*prev;
-	lwasm_expr_stack_node_t	*next;	
-};
-
-typedef struct lwasm_expr_stack_s
-{
-	lwasm_expr_stack_node_t *head;
-	lwasm_expr_stack_node_t *tail;
-} lwasm_expr_stack_t;
-
-__expr_E__ void lwasm_expr_term_free(lwasm_expr_term_t *t);
-__expr_E__ lwasm_expr_term_t *lwasm_expr_term_create_oper(int oper);
-__expr_E__ lwasm_expr_term_t *lwasm_expr_term_create_sym(char *sym);
-__expr_E__ lwasm_expr_term_t *lwasm_expr_term_create_int(int val);
-__expr_E__ lwasm_expr_term_t *lwasm_expr_term_create_secbase(void);
-__expr_E__ lwasm_expr_term_t *lwasm_expr_term_dup(lwasm_expr_term_t *t);
-
-__expr_E__ void lwasm_expr_stack_free(lwasm_expr_stack_t *s);
-__expr_E__ lwasm_expr_stack_t *lwasm_expr_stack_create(void);
-
-__expr_E__ void lwasm_expr_stack_push(lwasm_expr_stack_t *s, lwasm_expr_term_t *t);
-__expr_E__ lwasm_expr_term_t *lwasm_expr_stack_pop(lwasm_expr_stack_t *s);
-
-/*
-Evaluate an expression. The result is an lwasm_expr_stack_t pointer. If the
-expression evaluates to a constant result, the stack will contain exactly one
-value which will be a constant. Otherwise, the stack will contain the
-expression with all operations that can be evaluated completely evaluated.
-You must call lwasm_expr_stack_free() on the result when you are finished
-with it.
-*/
-__expr_E__ lwasm_expr_stack_t *lwasm_expr_eval(const char *inp, const char **outp, lwasm_expr_stack_t *(*sfunc)(char *sym, void *state), void *state);
-
-// simplify expression
-__expr_E__ int lwasm_expr_reval(lwasm_expr_stack_t *s, lwasm_expr_stack_t *(*sfunc)(char *sym, void *state), void *state);
-
-// useful macros
-// is the expression "simple" (one term)?
-#define lwasm_expr_is_simple(s) ((s) -> head == (s) -> tail)
-
-// is the expression constant?
-#define lwasm_expr_is_constant(s) (lwasm_expr_is_simple(s) && (!((s) -> head) || (s) -> head -> term -> term_type == LWASM_TERM_INT))
-
-// get the constant value of an expression or 0 if not constant
-#define lwasm_expr_get_value(s) (lwasm_expr_is_constant(s) ? ((s) -> head ? (s) -> head -> term -> value : 0) : 0)
-
-#undef __expr_E__
-
-#endif // __expr_h_seen__
--- a/old-trunk/lwasm/old/insn_bitbit.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
-insn_bitbit.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling inherent mode instructions
-*/
-
-#define __insn_bitbit_c_seen__
-
-#include <config.h>
-#include <stdlib.h>
-
-#include "lwasm.h"
-#include "instab.h"
-#include "expr.h"
-
-// these instructions cannot tolerate external references
-OPFUNC(insn_bitbit)
-{
-	int r;
-	lwasm_expr_stack_t *s;
-	int v1;
-	int tv;
-
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-	
-	r = toupper(*(*p)++);
-	if (r == 'A')
-		r = 1;
-	else if (r == 'B')
-		r = 2;
-	else if (r == 'C' && toupper(**p) == 'C')
-	{
-		r = 0;
-		(*p)++;
-	}
-	else
-	{
-		register_error(as, l, 1, "Bad register");
-		return;
-	}
-	if (*(*p)++ != ',')
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	s = lwasm_evaluate_expr(as, l, *p, NULL, 0);
-	if (!s)
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	if (!lwasm_expr_is_constant(s))
-	{
-		register_error(as, l, 2, "Incomplete reference");
-	}
-	v1 = lwasm_expr_get_value(s);
-	lwasm_expr_stack_free(s);
-	if (v1 < 0 || v1 > 7)
-	{
-		register_error(as, l, 2, "Invalid bit number");
-		v1 = 0;
-	}
-	if (*(*p)++ != ',')
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	r = (r << 6) | (v1 << 3);
-
-	s = lwasm_evaluate_expr(as, l, *p, NULL, 0);
-	if (!s)
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	if (!lwasm_expr_is_constant(s))
-	{
-		register_error(as, l, 1, "Incomplete reference");
-	}
-	v1 = lwasm_expr_get_value(s);
-	lwasm_expr_stack_free(s);
-	if (v1 < 0 || v1 > 7)
-	{
-		register_error(as, l, 2, "Invalid bit number");
-		v1 = 0;
-	}
-	if (*(*p)++ != ',')
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	r |= v1;
-	
-	lwasm_emit(as, l, r);
-			
-	// ignore base page address modifier
-	if (**p == '<')
-		(*p)++;
-			
-	s = lwasm_evaluate_expr(as, l, *p, NULL, 0);
-	if (!s)
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	if (!lwasm_expr_is_constant(s))
-	{
-		register_error(as, l, 1, "Incomplete reference");
-	}
-	v1 = lwasm_expr_get_value(s);
-	lwasm_expr_stack_free(s);
-	v1 &= 0xFFFF;
-
-	tv = v1 - ((as -> dpval) << 8);
-	if (tv > 0xFF || tv < 0)
-	{
-		register_error(as, l, 2, "Byte overflow");
-	}
-	lwasm_emit(as, l, tv & 0xff);
-}
--- a/old-trunk/lwasm/old/insn_gen.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*
-insn_gen.c, Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains code for parsing general addressing modes (IMM+DIR+EXT+IND)
-*/
-
-#include <config.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-
-#include "lwasm.h"
-#include "instab.h"
-#include "expr.h"
-
-extern void insn_indexed_aux(asmstate_t *as, lwasm_line_t *l, const char **p, int *b1, int *b2, int *b3);
-
-// "extra" is required due to the way OIM, EIM, TIM, and AIM work
-void insn_gen_aux(asmstate_t *as, lwasm_line_t *l, char **optr, int opnum, int extra)
-{
-	int b1 = -1, b2 = -1, b3 = -1;
-
-	const char *optr2;
-	int v1, tv, rval;
-	lwasm_expr_stack_t *s;
-	int f8 = 0;
-	int f16 = 0;
-	int isdp = 0;
-
-	optr2 = *optr;
-	while (*optr2 && !isspace(*optr2) && *optr2 != ',') optr2++
-		/* do nothing */ ;
-
-	if (*optr2 != ',' && **optr != '[')
-	{
-		// not indexed
-		if (l -> fsize == 1)
-			f8 = 1;
-		else if (l -> fsize == 2)
-			f16 = 1;
-
-		if (**optr == '<')
-		{
-			(*optr)++;
-			f8 = 1;
-		}
-		// for compatibility with asxxxx
-		// * followed by a digit, alpha, or _, or ., or ?, or another * is "f8"
-		else if (**optr == '*')
-		{
-			tv = *(*optr + 1);
-			if (isdigit(tv) || isalpha(tv) || tv == '_' || tv == '.' || tv == '?' || tv == '@' || tv == '*' || tv == '+' || tv == '-')
-			{
-				f8 = 1;
-				(*optr)++;
-			}
-		}
-		else if (**optr == '>')
-		{
-			(*optr)++;
-			f16 = 1;
-		}
-		rval = lwasm_expr_result2(as, l, optr, 0, &v1, 0);
-		if (rval != 0)
-		{
-			f16 = 1;
-			v1 = 0;
-			l -> fsize = 2;
-		}
-
-		if (((v1 >> 8) & 0xff) == (as -> dpval & 0xff))
-			isdp = 1;
-		
-		// disallow non-explicit DP in obj target
-		if (as -> outformat == OUTPUT_OBJ && !f8)
-			f16 = 1;
-	
-		if (f8 || (!f16 && isdp))
-		{
-			v1 = v1 & 0xffff;
-			tv = v1 - ((as -> dpval) << 8);
-			if (tv < 0 || tv > 0xff)
-			{
-				register_error(as, l, 2, "Byte overflow");
-			}
-			v1 = v1 & 0xff;
-			lwasm_emitop(as, l, instab[opnum].ops[0]);
-			if (extra != -1)
-				lwasm_emit(as, l, extra);
-			l -> relocoff = as -> addr - l -> codeaddr;
-			l -> reloc8bit = 1;
-			lwasm_emit(as, l, v1 & 0xff);
-			return;
-		}
-		else
-		{
-			// everything else is 16 bit....
-			lwasm_emitop(as, l, instab[opnum].ops[2]);
-			if (extra != -1)
-				lwasm_emit(as, l, extra);
-			l -> relocoff = as -> addr - l -> codeaddr;
-			lwasm_emit(as, l, v1 >> 8);
-			lwasm_emit(as, l, v1 & 0xff);
-			return;
-		}
-	}	
-
-	lwasm_emitop(as, l, instab[opnum].ops[1]);
-	if (extra != -1)
-		lwasm_emit(as, l, extra);
-	insn_indexed_aux(as, l, (const char **)optr, &b1, &b2, &b3);
-	if (b1 != -1)
-		lwasm_emit(as, l, b1);
-	if (b2 != -1)
-		lwasm_emit(as, l, b2);
-	if (b3 != -1)
-		lwasm_emit(as, l, b3);
-	return;
-}
-
-// the various insn_gen? functions have an immediate mode of ? bits
-OPFUNC(insn_gen0)
-{
-	if (**p == '#')
-	{
-		register_error(as, l, 1, "Immediate mode not allowed");
-		return;
-	}
-	
-	// handle non-immediate
-	insn_gen_aux(as, l, p, opnum, -1);
-}
-
-OPFUNC(insn_gen8)
-{
-	int rval;
-	int r;
-	
-	if (**p == '#')
-	{
-		lwasm_emitop(as, l, instab[opnum].ops[3]);
-		(*p)++;
-		r = lwasm_expr_result2(as, l, p, 0, &rval, 0);
-		if (r != 0)
-			rval = 0;
-		if (r == 1 && as -> passnum == 2)
-		{
-			l -> relocoff = as -> addr - l -> codeaddr;
-			l -> reloc8bit = 1;
-		}
-//			register_error(as, l, 2, "Illegal external or intersegment reference");
-		lwasm_emit(as, l, rval & 0xff);
-		return;
-	}
-	
-	insn_gen_aux(as, l, p, opnum, -1);
-}
-
-OPFUNC(insn_gen16)
-{
-	int rval, r;
-	
-	if (**p == '#')
-	{
-		lwasm_emitop(as, l, instab[opnum].ops[3]);
-		(*p)++;
-
-		r = lwasm_expr_result2(as, l, p, 0, &rval, 0);
-		if (r != 0)
-			rval = 0;
-		if (r == 1 && as -> passnum == 2)
-		{
-			l -> relocoff = as -> addr - l -> codeaddr;
-		}
-		lwasm_emit(as, l, (rval >> 8) & 0xff);
-		lwasm_emit(as, l, rval & 0xff);
-		return;
-	}
-	
-	insn_gen_aux(as, l, p, opnum, -1);
-}
-
-OPFUNC(insn_gen32)
-{
-	int r, rval;
-	
-	if (**p == '#')
-	{
-		lwasm_emitop(as, l, instab[opnum].ops[3]);
-		(*p)++;
-
-		r = lwasm_expr_result2(as, l, p, 0, &rval, 0);
-		if (r != 0)
-			rval = 0;
-		if (r == 1 && as -> passnum == 2)
-		{
-			register_error(as, l, 2, "Illegal external or intersegment reference");
-		}
-
-		lwasm_emit(as, l, (rval >> 24) & 0xff);
-		lwasm_emit(as, l, (rval >> 16) & 0xff);
-		lwasm_emit(as, l, (rval >> 8) & 0xff);
-		lwasm_emit(as, l, rval & 0xff);
-		return;
-	}
-	
-	insn_gen_aux(as, l, p, opnum, -1);
-}
-
-OPFUNC(insn_imm8)
-{
-	int r, rval;
-	
-	if (**p == '#')
-	{
-		lwasm_emitop(as, l, instab[opnum].ops[0]);
-		(*p)++;
-
-		r = lwasm_expr_result2(as, l, p, 0, &rval, 0);
-		if (r != 0)
-			rval = 0;
-		if (r == 1 && as -> passnum == 2)
-			register_error(as, l, 2, "Illegal external or intersegment reference");
-
-		if (rval < -128 || rval > 255)
-			register_error(as, l, 2, "Byte overflow");
-		lwasm_emit(as, l, rval & 0xff);
-		return;
-	}
-
-	register_error(as, l, 1, "Bad operand");	
-}
--- a/old-trunk/lwasm/old/insn_indexed.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,482 +0,0 @@
-/*
-insn_indexed.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling indexed mode instructions
-*/
-
-#define __insn_indexed_c_seen__
-
-#include <config.h>
-
-#include <ctype.h>
-#include <string.h>
-
-#include "lwasm.h"
-#include "instab.h"
-#include "expr.h"
-
-void insn_indexed_aux(asmstate_t *as, lwasm_line_t *l, const char **p, int *b1, int *b2, int *b3)
-{
-	struct opvals { char *opstr; int pb; };
-	
-	static const char *regs = "X  Y  U  S  W  PCRPC ";
-	static const struct opvals simpleindex[] =
-	{
-		{",x", 0x84},		{",y", 0xa4},		{",u", 0xc4},		{",s", 0xe4},
-		{",x+", 0x80},		{",y+", 0xa0},		{",u+", 0xc0},		{",s+", 0xe0},
-		{",x++", 0x81},		{",y++", 0xa1},		{",u++", 0xc1},		{",s++", 0xe1},
-		{",-x", 0x82},		{",-y", 0xa2},		{",-u", 0xc2},		{",-s", 0xe2},
-		{",--x", 0x83},		{",--y", 0xa3},		{",--u", 0xc3},		{",--s", 0xe3},
-		{"a,x", 0x86},		{"a,y", 0xa6},		{"a,u", 0xc6},		{"a,s", 0xe6},
-		{"b,x", 0x85},		{"b,y", 0xa5},		{"b,u", 0xc5},		{"b,s", 0xe5},
-		{"e,x", 0x87},		{"e,y", 0xa7},		{"e,u", 0xc7},		{"e,s", 0xe7},
-		{"f,x",	0x8a},		{"f,y",	0xaa},		{"f,u", 0xca},		{"f,s", 0xea},
-		{"d,x", 0x8b},		{"d,y", 0xab},		{"d,u", 0xcb},		{"d,s", 0xed},
-		{"w,x", 0x8e},		{"w,y", 0xae},		{"w,u", 0xce},		{"w,s", 0xee},
-		{",w", 0x8f},							{",w++", 0xcf},		{",--w", 0xef},
-		
-		{"[,x]", 0x94},		{"[,y]", 0xb4},		{"[,u", 0xd4},		{"[,s]", 0xf4},
-		{"[,x++]", 0x91},	{"[,y++]", 0xb1},	{"[,u++]", 0xd1},	{"[,s++]", 0xf1},
-		{"[,--x]", 0x93},	{"[,--y]", 0xb3},	{"[,--u]", 0xd3},	{"[,--s]", 0xf3},
-		{"[a,x]", 0x96},	{"[a,y]", 0xb6},	{"[a,u]", 0xd6},	{"[a,s]", 0xf6},
-		{"[b,x]", 0x95},	{"[b,y]", 0xb5},	{"[b,u]", 0xd5},	{"[b,s]", 0xf5},
-		{"[e,x]", 0x97},	{"[e,y]", 0xb7},	{"[e,u]", 0xd7},	{"[e,s]", 0xf7},
-		{"[f,x]", 0x9a},	{"[f,y]", 0xba},	{"[f,u]", 0xda},	{"[f,s]", 0xfa},
-		{"[d,x]", 0x9b},	{"[d,y]", 0xbb},	{"[d,u]", 0xdb},	{"[d,s]", 0xfd},
-		{"[w,x]", 0x9e},	{"[w,y]", 0xbe},	{"[w,u]", 0xde},	{"[w,s]", 0xfe},
-		{"[,w]", 0x90},							{"[,w++]", 0xd0},	{"[,--w]", 0xf0},
-		
-		{ "", -1 }
-	};
-
-	static const char *regs9 = "X  Y  U  S     PCRPC ";
-	static const struct opvals simpleindex9[] =
-	{
-		{",x", 0x84},		{",y", 0xa4},		{",u", 0xc4},		{",s", 0xe4},
-		{",x+", 0x80},		{",y+", 0xa0},		{",u+", 0xc0},		{",s+", 0xe0},
-		{",x++", 0x81},		{",y++", 0xa1},		{",u++", 0xc1},		{",s++", 0xe1},
-		{",-x", 0x82},		{",-y", 0xa2},		{",-u", 0xc2},		{",-s", 0xe2},
-		{",--x", 0x83},		{",--y", 0xa3},		{",--u", 0xc3},		{",--s", 0xe3},
-		{"a,x", 0x86},		{"a,y", 0xa6},		{"a,u", 0xc6},		{"a,s", 0xe6},
-		{"b,x", 0x85},		{"b,y", 0xa5},		{"b,u", 0xc5},		{"b,s", 0xe5},
-		{"d,x", 0x8b},		{"d,y", 0xab},		{"d,u", 0xcb},		{"d,s", 0xed},
-		
-		{"[,x]", 0x94},		{"[,y]", 0xb4},		{"[,u", 0xd4},		{"[,s]", 0xf4},
-		{"[,x++]", 0x91},	{"[,y++]", 0xb1},	{"[,u++]", 0xd1},	{"[,s++]", 0xf1},
-		{"[,--x]", 0x93},	{"[,--y]", 0xb3},	{"[,--u]", 0xd3},	{"[,--s]", 0xf3},
-		{"[a,x]", 0x96},	{"[a,y]", 0xb6},	{"[a,u]", 0xd6},	{"[a,s]", 0xf6},
-		{"[b,x]", 0x95},	{"[b,y]", 0xb5},	{"[b,u]", 0xd5},	{"[b,s]", 0xf5},
-		{"[d,x]", 0x9b},	{"[d,y]", 0xbb},	{"[d,u]", 0xdb},	{"[d,s]", 0xfd},
-		
-		{ "", -1 }
-	};
-	char stbuf[25];
-	int i, j, rn;
-	int f8 = 0, f16 = 0, f0 = 0;
-	int r, v;
-	int indir = 0;
-	int fs8 = 0, fs16 = 0;
-	const struct opvals *simples;
-	const char *reglist;
-	
-	if (as -> no6309)
-	{
-		simples = simpleindex9;
-		reglist = regs9;
-	}
-	else
-	{
-		simples = simpleindex;
-		reglist = regs;
-	}
-	
-	// initialize output bytes
-	*b1 = *b2 = *b3 = -1;
-	
-	// fetch out operand for lookup
-	for (i = 0; i < 24; i++)
-	{
-		if (*((*p) + i) && !isspace(*((*p) + i)))
-			stbuf[i] = *((*p) + i);
-		else
-			break;
-	}
-	stbuf[i] = '\0';
-	
-	// now look up operand in "simple" table
-	if (!*((*p) + i) || isspace(*((*p) + i)))
-	{
-		// do simple lookup
-		for (j = 0; simples[j].opstr[0]; j++)
-		{
-			if (!strcasecmp(stbuf, simples[j].opstr))
-				break;
-		}
-		if (simples[j].opstr[0])
-		{
-			*b1 = simples[j].pb;
-			(*p) += i;
-			return;
-		}
-	}
-
-	// now do the "hard" ones
-
-	// is it indirect?
-	if (**p == '[')
-	{
-		indir = 1;
-		(*p)++;
-	}
-	
-	// look for a "," - all indexed modes have a "," except extended indir
-	rn = 0;
-	for (i = 0; (*p)[i] && !isspace((*p)[i]); i++)
-	{
-		if ((*p)[i] == ',')
-		{
-			rn = 1;
-			break;
-		}
-	}
-
-	// if no "," and indirect, do extended indir
-	if (!rn && indir)
-	{
-		// extended indir
-		*b1 = 0x9f;
-		*b2 = 0;
-		*b3 = 0;
-		r = lwasm_expr_result2(as, l, (char **)p, 0, &v, 0);
-		if (r < 0)
-		{
-			return;
-		}
-		if (**p != ']')
-		{
-			register_error(as, l, 1, "Bad operand");
-			return;
-		}
-		
-		(*p)++;
-		
-		if (r == 1 && as -> passnum == 2)
-		{
-			l -> relocoff = as -> addr - l -> codeaddr + 1;
-		}
-		
-		*b2 = (v >> 8) & 0xff;
-		*b3 = v & 0xff;
-		return;
-	}
-
-	// if we've previously forced the offset size, make a note of it
-	if (l -> fsize == 1)
-		f8 = 1;
-	else if (l -> fsize == 2)
-		f16 = 1;
-
-	if (**p == '<')
-	{
-		fs8 = 1;
-		(*p)++;
-	}
-	else if (**p == '>')
-	{
-		fs16 = 1;
-		(*p)++;
-	}
-
-	if (**p == '0' && *(*p+1) == ',')
-	{
-		f0 = 1;
-	}
-	
-	// now we have to evaluate the expression
-	r = lwasm_expr_result2(as, l, (char **)p, 0, &v, 0);
-	if (r < 0)
-	{
-		return;
-	}
-	// now look for a comma; if not present, explode
-	if (*(*p)++ != ',')
-	{
-		// syntax error; force 0 bit
-		*b1 = 00;
-		l -> fsize = 0;
-		return;
-	}
-	
-	// now get the register
-	rn = lwasm_lookupreg3(reglist, p);
-	if (rn < 0)
-	{
-		*b1 = 0;
-		l -> fsize = 0;
-		register_error(as, l, 1, "Bad register");
-		return;
-	}
-	
-	if (indir)
-	{
-		if (**p != ']')
-		{
-			register_error(as, l, 1, "Bad operand");
-			l -> fsize = 0;
-			*b1 = 0;
-			return;
-		}
-		else
-			(*p)++;
-	}
-	
-	// incomplete reference on pass 1 forces 16 bit
-	if (r == 1 && as -> passnum == 1)
-	{
-		f16 = 1;
-		l -> fsize = 2;
-	}
-	
-	// incomplete reference on pass 2 needs relocoff set
-	if (r == 1 && as -> passnum == 2)
-	{
-		l -> relocoff = as -> addr - l -> codeaddr + 1;
-	}
-
-	// nnnn,W is only 16 bit (or 0 bit)
-	if (rn == 4)
-	{
-		if (f8)
-		{
-			register_error(as, l, 1, "n,W cannot be 8 bit");
-			l -> fsize = 0;
-			*b1 = 0;
-			return;
-		}
-		// note: set f16 above for incomplete references
-		// also set reloc offset
-		if (!f16 && !f0 && !(as -> pragmas & PRAGMA_NOINDEX0TONONE) && v == 0)
-		{
-			if (indir)
-				*b1 = 0x90;
-			else
-				*b1 = 0x8f;
-			return;
-		}
-		
-		if (indir)
-			*b1 = 0xb0;
-		else
-			*b1 = 0xcf;
-		*b2 = (v >> 8) & 0xff;
-		*b3 = v & 0xff;
-		return;
-	}
-	
-	// set indir to correct bit value
-	if (indir) indir = 0x10;
-	
-	// PCR? then we have PC relative addressing (like B??, LB??)
-	if (rn == 5)
-	{
-		lwasm_expr_term_t *t;
-		// external references are handled exactly the same as for
-		// relative addressing modes
-		// on pass 1, adjust the expression for a subtraction of the
-		// current address
-		
-		// need to re-evaluate the expression with "SECTCONST"...
-		r = lwasm_expr_result2(as, l, (char **)p, EXPR_SECTCONST | EXPR_REEVAL, &v, 0);
-		if (r != 0)
-			v = 0;
-		if (as -> passnum == 1)
-		{
-			l -> fsize = 0;
-		}
-		f8 = f16 = 0;
-		if (r == 1 && as -> passnum == 1 && !fs8)
-		{
-			l -> fsize = 2;	
-			f16 = 1;
-		}
-		if (fs8)
-			f8 = 1;
-		if (fs16)
-			f16 = 1;
-		if (l -> fsize == 2)
-			f16 = 1;
-		else if (l -> fsize == 1)
-			f8 = 1;
-		if (as -> passnum == 1)
-			v -= as -> addr;
-		
-		// we have a slight problem here
-		// PCR based on current insn loc is really
-		// -125 <= offset <= +130 (8 bit offset)
-		// NOTE: when we are called, we already have the opcode emitted
-		// so we only need to worry about the size of the operand
-		// hence the 2 and 3 magic numbers below instead of 3 and 4
-		// (and that also avoids errors with two byte opcodes, etc)
-		if (f8 || (!f16 && v >= -125 && v <= 130))
-		{
-			f8 = 1;
-			l -> fsize = 1;
-			*b1 = indir | 0x8C;
-			if (as -> passnum == 1)
-				v -= 2;
-			if (v < -128 || v > 127)
-				register_error(as, l, 2, "Byte overflow");
-			*b2 = v & 0xff;
-			if (r != 0 && as -> passnum == 2)
-			{
-				register_error(as, l, 2, "Illegal incomplete reference");
-			}
-			goto finpcr;
-		}
-		
-		// anything else is 16 bit offset
-		// need 16 bit
-		
-		l -> fsize = 2;
-		*b1 = indir | 0x8D;
-		if (as -> passnum == 1)
-			v -= 3;
-		*b2 = (v >> 8) & 0xff;
-		*b3 = v & 0xff;
-		if (as -> passnum == 2 && r == 1)
-		{
-			t = lwasm_expr_term_create_secbase();
-			lwasm_expr_stack_push(l -> exprs[0], t);
-			lwasm_expr_term_free(t);
-			t = lwasm_expr_term_create_oper(LWASM_OPER_MINUS);
-			lwasm_expr_stack_push(l -> exprs[0], t);
-			lwasm_expr_term_free(t);
-		}
-
-	finpcr:
-		if (as -> passnum == 1)
-		{
-			// need to adjust the expression
-			if (l -> exprs[0])
-			{
-				t = lwasm_expr_term_create_int(as -> addr + (f8 ? 2 : 3));
-				lwasm_expr_stack_push(l -> exprs[0], t);
-				lwasm_expr_term_free(t);
-				t = lwasm_expr_term_create_oper(LWASM_OPER_MINUS);
-				lwasm_expr_stack_push(l -> exprs[0], t);
-				lwasm_expr_term_free(t);
-			}
-			else
-			{
-				l -> exprvals[0] -= as -> addr + (f8 ? 2 : 3);
-			}
-		}
-		return;
-	}
-	if (fs16)
-		f16 = 1;
-	if (fs8)
-		f8 = 1;
-
-	if (f8 && r != 0)
-	{
-		register_error(as, l, 2, "Illegal external or inter-section reference");
-		r = 0;
-		v = 0;
-	}
-
-	// constant offset from PC (using PC as regular register :) )
-	// FIXME: handle external references intelligently
-	if (rn == 6)
-	{
-		if (f8 || (!f16 && v >= -128 && v <= 127))
-		{
-			*b1 = indir | 0x8C;
-			if (v < -128 || v > 127)
-				register_error(as, l, 2, "Byte overflow");
-			*b2 = v & 0xff;
-			return;
-		}
-		
-		// everything else must be 16 bit
-		// need 16 bit
-		*b1 = indir | 0x8D;
-		*b2 = (v >> 8) & 0xff;
-		*b3 = v & 0xff;
-		return;
-	}
-
-	// we only have to deal with x,y,u,s here
-	if (!f8 && !f16 && v >= -16 && v <= 15)
-	{
-		// zero offset going to ,R?
-		if (v == 0 && !f0 && !(as -> pragmas & PRAGMA_NOINDEX0TONONE))
-		{
-			*b1 = rn << 5 | indir | 0x80 | 0x04;
-			return;
-		}
-		
-		// no 5 bit on indirect
-		if (indir)
-		{
-			f8 = 1;
-			l -> fsize = 1;
-			goto no5bit;
-		}
-		
-		// 5 bit addressing
-		*b1 = rn << 5 | (v & 0x1F);
-		return;
-	}
-
-no5bit:
-	if (f16 || (!f8 && (v < -128 || v > 127)))
-	{
-		// must be a 16 bit offset here
-		*b1 = rn << 5 | indir | 0x80 | 0x09;
-		*b2 = (v >> 8) & 0xff;
-		*b3 = v & 0xff;
-		return;
-	}
-	
-	// if we're here, we have an 8 bit offset
-	// note: cannot get here if incomplete reference detected above
-	*b1 = rn << 5 | indir | 0x80 | 0x08;
-	if (v < -128 || v > 127)
-		register_error(as, l, 2, "Byte overflow");
-	*b2 = v & 0xff;
-	return;
-}
-
-OPFUNC(insn_indexed)
-{
-	int b1, b2, b3;
-	
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-
-	insn_indexed_aux(as, l, (const char **)p, &b1, &b2, &b3);
-	if (b1 != -1)
-		lwasm_emit(as, l, b1);
-	if (b2 != -1)
-		lwasm_emit(as, l, b2);
-	if (b3 != -1)
-		lwasm_emit(as, l, b3);
-}
--- a/old-trunk/lwasm/old/insn_inh.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-insn_inh.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling inherent mode instructions
-*/
-
-#define __insn_inh_c_seen__
-#include <config.h>
-
-#include "lwasm.h"
-#include "instab.h"
-
-OPFUNC(insn_inh)
-{
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-	// skip to end of line
-	for (; **p; (*p)++)
-		/* do nothing */ ;
-}
--- a/old-trunk/lwasm/old/insn_logicmem.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-insn_logicmem.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains code for handling logic/mem instructions
-*/
-
-#include <config.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "lwasm.h"
-#include "instab.h"
-#include "expr.h"
-
-extern void insn_gen_aux(asmstate_t *as, lwasm_line_t *l, char **optr, int opnum, int extra);
-
-// for aim, oim, eim, tim
-// the immediate operand must be constant on pass 2
-OPFUNC(insn_logicmem)
-{
-	int rval, v1;
-	const char *p2;
-	lwasm_expr_stack_t *s;
-	
-	if (**p == '#')
-		(*p)++;
-	
-	rval = lwasm_expr_result2(as, l, p, 0, &v1, 1);
-	if (rval != 0)
-		v1 = 0;
-	if (rval == 1 && as -> passnum == 2)
-		register_error(as, l, 2, "Illegal external or intersegment reference");
-
-	if (v1 < -128 || v1 > 255)
-		register_error(as, l, 2, "Byte overflow");
-	
-	if (**p != ',' && **p != ';')
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	
-	(*p)++;
-
-	// now we have a general addressing mode - call for it
-	insn_gen_aux(as, l, p, opnum, v1 & 0xff);
-}
--- a/old-trunk/lwasm/old/insn_rel.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-insn_rel.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling relative mode instructions
-*/
-
-#define __insn_rel_c_seen__
-#include <config.h>
-#include <stdlib.h>
-
-#include "expr.h"
-#include "lwasm.h"
-#include "instab.h"
-
-OPFUNC(insn_rel8)
-{
-	int v;
-	lwasm_expr_term_t *t;
-	int r;
-	
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-
-	if (**p == '#')
-		(*p)++;
-
-	if ((r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST, &v, 0)) < 0)
-		v = 0;
-	else
-	{
-		if (as -> passnum == 1)
-		{
-			// need to adjust the expression
-			if (l -> exprs[0])
-			{
-				t = lwasm_expr_term_create_int(as -> addr + 1);
-				lwasm_expr_stack_push(l -> exprs[0], t);
-				lwasm_expr_term_free(t);
-				t = lwasm_expr_term_create_oper(LWASM_OPER_MINUS);
-				lwasm_expr_stack_push(l -> exprs[0], t);
-				lwasm_expr_term_free(t);
-			}
-			else
-			{
-				l -> exprvals[0] -= as -> addr + 1;
-			}
-		}
-	}
-	if (r == 1 && as -> passnum == 2)
-	{
-		register_error(as, l, 2, "Illegal external or intersegment reference");
-	}
-	if (v < -128 || v > 127)
-		register_error(as, l, 2, "Byte overflow");
-	lwasm_emit(as, l, v & 0xff);
-}
-
-/*
-External and intersegment references are adjusted for the relative addressing mode
-by adjusting the expression on pass 1 and then treated as absolute references later
-*/
-OPFUNC(insn_rel16)
-{
-	int v;
-	int r;
-	lwasm_expr_term_t *t;
-	
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-	
-	if (**p == '#')
-		(*p)++;
-
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST, &v, 0);
-	if (r < 0)
-		v = 0;
-	else
-	{
-		if (as -> passnum == 1)
-		{
-			// need to adjust the expression
-			if (l -> exprs[0])
-			{
-				t = lwasm_expr_term_create_int(as -> addr + 2);
-				lwasm_expr_stack_push(l -> exprs[0], t);
-				lwasm_expr_term_free(t);
-				t = lwasm_expr_term_create_oper(LWASM_OPER_MINUS);
-				lwasm_expr_stack_push(l -> exprs[0], t);
-				lwasm_expr_term_free(t);
-			}
-			else
-			{
-				l -> exprvals[0] -= as -> addr + 2;
-			}
-		}
-	}
-	if (as -> passnum == 2 && r == 1)
-	{
-		// since we have a reference outside this section, add
-		// a subtract of the section base to get the right value
-		// upon linking
-		t = lwasm_expr_term_create_secbase();
-		lwasm_expr_stack_push(l -> exprs[0], t);
-		lwasm_expr_term_free(t);
-		t = lwasm_expr_term_create_oper(LWASM_OPER_MINUS);
-		lwasm_expr_stack_push(l -> exprs[0], t);
-		lwasm_expr_term_free(t);
-
-		l -> relocoff = as -> addr - l -> codeaddr;
-	}
-	lwasm_emit(as, l, (v >> 8) & 0xff);
-	lwasm_emit(as, l, v & 0xff);
-}
--- a/old-trunk/lwasm/old/insn_rlist.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-insn_rlist.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling inherent mode instructions
-*/
-
-#define __insn_rlist_c_seen__
-#include <config.h>
-#include "lwasm.h"
-#include "instab.h"
-
-OPFUNC(insn_rlist)
-{
-	int rb = 0;
-	int rn;
-	static const char *regs = "CCA B DPX Y U PCD S ";
-
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-	while (**p && !isspace(**p))
-	{
-		rn = lwasm_lookupreg2(regs, p);
-		if (rn < 0)
-		{
-			register_error(as, l, 1, "Bad register '%s'", *p);
-			lwasm_emit(as, l, 0);
-			return;
-		}
-		if (**p && **p != ',' && !isspace(**p))
-		{
-			register_error(as, l, 1, "Bad operand");
-			lwasm_emit(as, l, 0);
-		}
-		if (**p == ',')
-			(*p)++;
-		if (rn == 8)
-			rn = 6;
-		else if (rn == 9)
-			rn = 0x40;
-		else
-			rn = 1 << rn;
-		rb |= rn;
-	}
-	lwasm_emit(as, l, rb);
-}
--- a/old-trunk/lwasm/old/insn_rtor.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-insn_rtor.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling register to register mode instructions
-*/
-
-#define __insn_rtor_c_seen__
-#include <config.h>
-#include "lwasm.h"
-#include "instab.h"
-
-OPFUNC(insn_rtor)
-{
-	int r0, r1;
-	static const char *regs = "D X Y U S PCW V A B CCDP0 0 E F ";
-	static const char *regs9 = "D X Y U S PC    A B CCDP        ";
-		
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-	// register to register (r0,r1)
-	// registers are in order:
-	// D,X,Y,U,S,PC,W,V
-	// A,B,CC,DP,0,0,E,F
-	r0 = lwasm_lookupreg2((as -> no6309) ? regs9 : regs, p);
-	if (r0 < 0 || *(*p)++ != ',')
-	{
-		register_error(as, l, 1, "Bad operand");
-		r0 = r1 = 0;
-	}
-	else
-	{
-		r1 = lwasm_lookupreg2((as -> no6309) ? regs9 : regs, p);
-		if (r1 < 0)
-		{
-			register_error(as, l, 1, "Bad operand");
-			r0 = r1 = 0;
-		}
-	}
-	lwasm_emit(as, l, (r0 << 4) | r1);
-}
--- a/old-trunk/lwasm/old/insn_tfm.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
-insn_tfm.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling inherent mode instructions
-*/
-
-#define __insn_tfm_c_seen__
-#include <config.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "lwasm.h"
-#include "instab.h"
-
-OPFUNC(insn_tfm)
-{
-	static const char *reglist = "DXYUS   AB  00EF";
-	int r0, r1;
-	char *c;
-	int tfm = 0;
-			
-	c = strchr(reglist, toupper(*(*p)++));
-	if (!c)
-	{
-		register_error(as, l, 1, "Unknown operation");
-		return;
-	}
-	r0 = c - reglist;
-	if (**p == '+')
-	{
-		(*p)++;
-		tfm = 1;
-	}
-	else if (**p == '-')
-	{
-		(*p)++;
-		tfm = 2;
-	}
-	if (*(*p)++ != ',')
-	{
-		register_error(as, l, 1, "Unknown operation");
-		return;
-	}
-	c = strchr(reglist, toupper(*(*p)++));
-	if (!c)
-	{
-		register_error(as, l, 1, "Unknown operation");
-		return;
-	}
-	r1 = c - reglist;
-
-	if (**p == '+')
-	{
-		(*p)++;
-		tfm |= 4;
-	}
-	else if (**p == '-')
-	{
-		(*p)++;
-		tfm |= 8;
-	}
-	
-	if (**p && !isspace(**p))
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-			
-	// valid values of tfm here are:
-	// 1: r0+,r1 (2)
-	// 4: r0,r1+ (3)
-	// 5: r0+,r1+ (0)
-	// 10: r0-,r1- (1)
-	switch (tfm)
-	{
-	case 5: //r0+,r1+
-		lwasm_emitop(as, l, instab[opnum].ops[0]);
-		break;
-	case 10: //r0-,r1-
-		lwasm_emitop(as, l, instab[opnum].ops[1]);
-		break;
-	case 1: // r0+,r1
-		lwasm_emitop(as, l, instab[opnum].ops[2]);
-		break;
-	case 4: // r0,r1+
-		lwasm_emitop(as, l, instab[opnum].ops[3]);
-		break;
-	default:
-		register_error(as, l, 1, "Unknown operation");
-		return;
-	}
-	lwasm_emit(as, l, (r0 << 4) | r1);
-}
-
-OPFUNC(insn_tfmrtor)
-{
-	int r0, r1;
-	static const char *regs = "D X Y U S       A B     0 0 E F ";
-	
-	lwasm_emitop(as, l, instab[opnum].ops[0]);
-	// register to register (r0,r1)
-	// registers are in order:
-	// D,X,Y,U,S,PC,W,V
-	// A,B,CC,DP,0,0,E,F
-	r0 = lwasm_lookupreg2(regs, p);
-	if (r0 < 0 || *(*p)++ != ',')
-	{
-		register_error(as, l, 1, "Bad operand");
-		r0 = r1 = 0;
-	}
-	else
-	{
-		r1 = lwasm_lookupreg2(regs, p);
-		if (r1 < 0)
-		{
-			register_error(as, l, 1, "Bad operand");
-			r0 = r1 = 0;
-		}
-	}
-	lwasm_emit(as, l, (r0 << 4) | r1);
-}
--- a/old-trunk/lwasm/old/instab.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,463 +0,0 @@
-/*
-instab.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Contains the instruction table for assembling code
-*/
-#include <config.h>
-
-#include <stdlib.h>
-#define __instab_c_seen__
-#include "instab.h"
-
-extern OPFUNC(insn_inh);
-extern OPFUNC(insn_gen8);
-extern OPFUNC(insn_gen16);
-extern OPFUNC(insn_gen32);
-extern OPFUNC(insn_gen0);
-extern OPFUNC(insn_rtor);
-extern OPFUNC(insn_imm8);
-extern OPFUNC(insn_rel8);
-extern OPFUNC(insn_rel16);
-extern OPFUNC(insn_rlist);
-extern OPFUNC(insn_bitbit);
-extern OPFUNC(insn_logicmem);
-extern OPFUNC(insn_tfm);
-extern OPFUNC(insn_tfmrtor);
-extern OPFUNC(insn_indexed);
-
-extern OPFUNC(pseudo_org);
-extern OPFUNC(pseudo_equ);
-extern OPFUNC(pseudo_rmb);
-extern OPFUNC(pseudo_rmd);
-extern OPFUNC(pseudo_rmq);
-extern OPFUNC(pseudo_zmb);
-extern OPFUNC(pseudo_zmd);
-extern OPFUNC(pseudo_zmq);
-extern OPFUNC(pseudo_include);
-extern OPFUNC(pseudo_end);
-extern OPFUNC(pseudo_align);
-extern OPFUNC(pseudo_error);
-extern OPFUNC(pseudo_fcc);
-extern OPFUNC(pseudo_fcs);
-extern OPFUNC(pseudo_fcn);
-extern OPFUNC(pseudo_fcb);
-extern OPFUNC(pseudo_fdb);
-extern OPFUNC(pseudo_fqb);
-extern OPFUNC(pseudo_ifne);
-extern OPFUNC(pseudo_ifeq);
-extern OPFUNC(pseudo_ifgt);
-extern OPFUNC(pseudo_ifge);
-extern OPFUNC(pseudo_iflt);
-extern OPFUNC(pseudo_ifle);
-extern OPFUNC(pseudo_ifp1);
-extern OPFUNC(pseudo_ifp2);
-extern OPFUNC(pseudo_else);
-extern OPFUNC(pseudo_endc);
-extern OPFUNC(pseudo_macro);
-extern OPFUNC(pseudo_endm);
-extern OPFUNC(pseudo_setdp);
-extern OPFUNC(pseudo_set);
-extern OPFUNC(pseudo_section);
-extern OPFUNC(pseudo_endsection);
-extern OPFUNC(pseudo_pragma);
-extern OPFUNC(pseudo_starpragma);
-extern OPFUNC(pseudo_extern);
-extern OPFUNC(pseudo_export);
-extern OPFUNC(pseudo_ifdef);
-extern OPFUNC(pseudo_ifndef);
-extern OPFUNC(pseudo_noop);
-extern OPFUNC(pseudo_includebin);
-
-extern OPFUNC(pseudo_os9);
-extern OPFUNC(pseudo_mod);
-extern OPFUNC(pseudo_emod);
-
-instab_t instab[] =
-{
-	{ "abx",	{	0x3a,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "adca",	{	0x99,	0xa9,	0xb9,	0x89	},	insn_gen8 },
-	{ "adcb",	{	0xd9,	0xe9,	0xf9,	0xc9	},	insn_gen8 },
-	{ "adcd",	{	0x1099,	0x10a9,	0x10b9,	0x1089	},	insn_gen16 , 0, 0, 0, 1},
-	{ "adcr",	{	0x1031,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "adda",	{	0x9b,	0xab,	0xbb,	0x8b	},	insn_gen8 },
-	{ "addb",	{	0xdb,	0xeb,	0xfb,	0xcb	},	insn_gen8 },
-	{ "addd",	{	0xd3,	0xe3,	0xf3,	0xc3	},	insn_gen16 },
-	{ "adde",	{	0x119b,	0x11ab,	0x11bb,	0x118b	},	insn_gen8, 0, 0, 0, 1 },
-	{ "addf",	{	0x11db,	0x11eb,	0x11fb,	0x11cb	},	insn_gen8, 0, 0, 0, 1 },
-	{ "addr",	{	0x1030,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "addw",	{	0x109b,	0x10ab,	0x10bb,	0x108b	},	insn_gen16, 0, 0, 0, 1 },
-	{ "aim",	{	0x02,	0x62,	0x72,	-0x1	},	insn_logicmem, 0, 0, 0, 1 },
-	{ "anda",	{	0x94,	0xa4,	0xb4,	0x84	},	insn_gen8 },
-	{ "andb",	{	0xd4,	0xe4,	0xf4,	0xc4	},	insn_gen8 },
-	{ "andcc",	{	0x1c,	-0x1,	-0x1,	0x1c	},	insn_imm8 },
-	{ "andd",	{	0x1094,	0x10a4,	0x10b4,	0x1084	},	insn_gen16, 0, 0, 0, 1 },
-	{ "andr",	{	0x1034,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "asl",	{	0x08,	0x68,	0x78,	-0x1	},	insn_gen0 },
-	{ "asla",	{	0x48,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "aslb",	{	0x58,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "asld",	{	0x1048,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "asr",	{	0x07,	0x67,	0x77,	-0x1	},	insn_gen0 },
-	{ "asra",	{	0x47,	-0x1,	-0x1,	-0x1	}, 	insn_inh },
-	{ "asrb",	{	0x57,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "asrd",	{	0x1047,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	
-	{ "band",	{	0x1130,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "bcc",	{	0x24,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bcs",	{	0x25,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "beor",	{	0x1134,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "beq",	{	0x27,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bge",	{	0x2c,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bgt",	{	0x2e,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bhi",	{	0x22,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bhs",	{	0x24,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "biand",	{	0x1131,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "bieor",	{	0x1135,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "bior",	{	0x1133, -0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "bita",	{	0x95,	0xa5,	0xb5,	0x85	},	insn_gen8 },
-	{ "bitb",	{	0xd5,	0xe5,	0xf5,	0xc5	},	insn_gen8 },
-	{ "bitd",	{	0x1095,	0x10a5,	0x10b5,	0x1085	},	insn_gen16, 0, 0, 0, 1 },
-	{ "bitmd",	{	0x113c, -0x1,	-0x1,	0x113c	},	insn_imm8, 0, 0, 0, 1 },
-	{ "ble",	{	0x2f,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "blo",	{	0x25,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bls",	{	0x23,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "blt",	{	0x2d,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bmi",	{	0x2b,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bne",	{	0x26, 	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bor",	{	0x1132,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "bpl",	{	0x2a,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bra",	{	0x20,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "brn",	{	0x21,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bsr",	{	0x8d,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bvc",	{	0x28,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	{ "bvs",	{	0x29,	-0x1,	-0x1,	-0x1	},	insn_rel8 },
-	
-	{ "clr",	{	0x0f,	0x6f,	0x7f,	-0x1	},	insn_gen0 },
-	{ "clra",	{	0x4f,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "clrb",	{	0x5f,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "clrd",	{	0x104f,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "clre",	{	0x114f,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "clrf",	{	0x115f,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "clrw",	{	0x105f,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "cmpa",	{	0x91,	0xa1,	0xb1,	0x81	},	insn_gen8 },
-	{ "cmpb",	{	0xd1,	0xe1,	0xf1,	0xc1	},	insn_gen8 },
-	{ "cmpd",	{	0x1093,	0x10a3,	0x10b3,	0x1083	},	insn_gen16 },
-	{ "cmpe",	{	0x1191,	0x11a1,	0x11b1,	0x1181	},	insn_gen8, 0, 0, 0, 1 },
-	{ "cmpf",	{	0x11d1,	0x11e1,	0x11f1,	0x11c1	},	insn_gen8, 0, 0, 0, 1 },
-	{ "cmpr",	{	0x1037,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "cmps",	{	0x119c,	0x11ac,	0x11bc,	0x118c	},	insn_gen16 },
-	{ "cmpu",	{	0x1193,	0x11a3,	0x11b3,	0x1183	},	insn_gen16 },
-	{ "cmpw",	{	0x1091,	0x10a1,	0x10b1,	0x1081	},	insn_gen16, 0, 0, 0, 1 },
-	{ "cmpx",	{	0x9c,	0xac,	0xbc,	0x8c	}, 	insn_gen16 },
-	{ "cmpy",	{	0x109c,	0x10ac,	0x10bc,	0x108c	},	insn_gen16 },
-	{ "com",	{	0x03,	0x63,	0x73,	-0x1	},	insn_gen0 },
-	{ "coma",	{	0x43,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "comb",	{	0x53,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "comd",	{	0x1043,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "come",	{	0x1143,	-0x1, 	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "comf", 	{	0x1153, -0x1,	-0x1,	-0x1	}, 	insn_inh, 0, 0, 0, 1 },
-	{ "comw",	{	0x1053,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "cwai",	{	0x3c, 	-0x1,	-0x1,	-0x1	},	insn_imm8 },
-	
-	{ "daa",	{	0x19,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "dec",	{	0x0a,	0x6a,	0x7a,	-0x1	},	insn_gen0 },
-	{ "deca",	{	0x4a,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "decb",	{	0x5a,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "decd",	{	0x104a,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "dece",	{	0x114a,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "decf",	{	0x115a,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "decw",	{	0x105a,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "divd",	{	0x118d,	0x119d,	0x11ad,	0x11bd	},	insn_gen8, 0, 0, 0, 1 },
-	{ "divq",	{	0x118e,	0x119e,	0x11ae,	0x11be	},	insn_gen16, 0, 0, 0, 1 },
-
-	{ "eim",	{	0x05,	0x65,	0x75,	-0x1	},	insn_logicmem, 0, 0, 0, 1 },
-	{ "eora",	{	0x98,	0xa8,	0xb8,	0x88	},	insn_gen8 },
-	{ "eorb",	{	0xd8,	0xe9,	0xf9,	0xc8	},	insn_gen8 },
-	{ "eord",	{	0x1098,	0x10a8,	0x10b8,	0x1088	},	insn_gen16, 0, 0, 0, 1 },
-	{ "eorr",	{	0x1036,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "exg",	{	0x1e,	-0x1,	-0x1,	-0x1	},	insn_rtor },
-	
-	{ "inc",	{	0x0c,	0x6c,	0x7c,	-0x1	},	insn_gen0 },
-	{ "inca",	{	0x4c,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "incb",	{	0x5c,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "incd",	{	0x104c,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "ince",	{	0x114c,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "incf",	{	0x115c,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "incw",	{	0x105c,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	
-	{ "jmp",	{	0x0e,	0x6e,	0x7e,	-0x1	},	insn_gen0 },
-	{ "jsr",	{	0x9d,	0xad,	0xbd,	-0x1	}, 	insn_gen0 },
-	
-	{ "lbcc",	{	0x1024,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbcs",	{	0x1025,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbeq",	{	0x1027,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbge",	{	0x102c,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbgt",	{	0x102e,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbhi",	{	0x1022,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbhs",	{	0x1024,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lble",	{	0x102f,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lblo",	{	0x1025,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbls",	{	0x1023,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lblt",	{	0x102d, -0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbmi",	{	0x102b,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbne",	{	0x1026,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbpl",	{	0x102a,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbra",	{	0x16,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbrn",	{	0x1021,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbsr",	{	0x17,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbvc",	{	0x1028,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lbvs",	{	0x1029,	-0x1,	-0x1,	-0x1	},	insn_rel16 },
-	{ "lda",	{	0x96,	0xa6,	0xb6,	0x86	},	insn_gen8 },
-	{ "ldb",	{	0xd6,	0xe6,	0xf6,	0xc6	},	insn_gen8 },
-	{ "ldbt",	{	0x1136,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "ldd",	{	0xdc,	0xec,	0xfc,	0xcc	},	insn_gen16 },
-	{ "lde",	{	0x1196,	0x11a6,	0x11b6,	0x1186	},	insn_gen8, 0, 0, 0, 1 },
-	{ "ldf",	{	0x11d6,	0x11e6,	0x11f6,	0x11c6	},	insn_gen8, 0, 0, 0, 1 },
-	{ "ldq",	{	0x10dc,	0x10ec,	0x10fc,	0xcd	},	insn_gen32, 0, 0, 0, 1 },
-	{ "lds",	{	0x10de,	0x10ee,	0x10fe,	0x10ce	},	insn_gen16 },
-	{ "ldu",	{ 	0xde,	0xee,	0xfe,	0xce	},	insn_gen16 },
-	{ "ldw",	{	0x1096,	0x10a6,	0x10b6,	0x1086	},	insn_gen16, 0, 0, 0, 1 },
-	{ "ldx",	{	0x9e,	0xae,	0xbe,	0x8e	},	insn_gen16 },
-	{ "ldy",	{	0x109e,	0x10ae,	0x10be,	0x108e	},	insn_gen16 },
-	{ "ldmd",	{	0x113d, -0x1,	-0x1,	0x113d	},	insn_imm8, 0, 0, 0, 1 },
-	{ "leas",	{	0x32,	-0x1,	-0x1,	-0x1	},	insn_indexed },
-	{ "leau",	{	0x33,	-0x1,	-0x1,	-0x1	},	insn_indexed },
-	{ "leax",	{	0x30,	-0x1,	-0x1,	-0x1	},	insn_indexed },
-	{ "leay",	{	0x31,	-0x1,	-0x1,	-0x1	},	insn_indexed },
-	{ "lsl",	{	0x08,	0x68,	0x78,	-0x1	},	insn_gen0 },
-	{ "lsla",	{	0x48,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "lslb",	{	0x58,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "lsld",	{	0x1048,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "lsr",	{	0x04,	0x64,	0x74,	-0x1	},	insn_gen0 },
-	{ "lsra",	{	0x44,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "lsrb",	{	0x54,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "lsrd",	{	0x1044,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "lsrw",	{	0x1054,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-
-	{ "mul",	{	0x3d,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "muld",	{	0x118f,	0x119f,	0x11af,	0x11bf	},	insn_gen16, 0, 0, 0, 1 },
-	
-	{ "neg",	{	0x00,	0x60,	0x70,	-0x1	},	insn_gen0 },
-	{ "nega",	{	0x40,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "negb",	{	0x50,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "negd",	{	0x1040,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "nop",	{	0x12,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	
-	{ "oim",	{	0x01,	0x61,	0x71,	-0x1	},	insn_logicmem, 0, 0, 0, 1 },
-	{ "ora",	{	0x9a,	0xaa,	0xba,	0x8a	},	insn_gen8 },
-	{ "orb",	{	0xda,	0xea,	0xfa,	0xca	},	insn_gen8 },
-	{ "orcc",	{	0x1a,	-0x1,	-0x1,	0x1a	},	insn_imm8 },
-	{ "ord",	{	0x109a,	0x10aa,	0x10ba,	0x108a	},	insn_gen16, 0, 0, 0, 1 },
-	{ "orr",	{	0x1035,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	
-	{ "pshs",	{	0x34,	-0x1,	-0x1,	-0x1	},	insn_rlist },
-	{ "pshsw",	{	0x1038,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "pshu",	{	0x36,	-0x1,	-0x1,	-0x1	},	insn_rlist },
-	{ "pshuw",	{	0x103a,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1	},
-	{ "puls",	{	0x35,	-0x1,	-0x1,	-0x1	},	insn_rlist },
-	{ "pulsw",	{	0x1039,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "pulu",	{	0x37,	-0x1,	-0x1,	-0x1	},	insn_rlist },
-	{ "puluw",	{	0x103b,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	
-	{ "rol",	{	0x09,	0x69,	0x79,	-0x1	},	insn_gen0 },
-	{ "rola",	{	0x49,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "rolb",	{	0x59,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "rold",	{	0x1049,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "rolw",	{	0x1059,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "ror",	{	0x06,	0x66,	0x76,	-0x1	},	insn_gen0 },
-	{ "rora",	{	0x46,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "rorb",	{	0x56,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "rord",	{	0x1046,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "rorw",	{	0x1056,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "rti",	{	0x3b,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "rts",	{	0x39,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	
-	{ "sbca",	{	0x92,	0xa2,	0xb2,	0x82	},	insn_gen8 },
-	{ "sbcb",	{	0xd2,	0xe2,	0xf2,	0xc2	},	insn_gen8 },
-	{ "sbcd",	{	0x1092,	0x10a2,	0x10b2,	0x1082	},	insn_gen16, 0, 0, 0, 1 },
-	{ "sbcr",	{	0x1033,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "sex",	{	0x1d,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "sexw",	{	0x14,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "sta",	{	0x97,	0xa7,	0xb7,	-0x1	},	insn_gen0 },
-	{ "stb",	{	0xd7,	0xe7,	0xf7,	-0x1	},	insn_gen0 },
-	{ "stbt",	{	0x1137,	-0x1,	-0x1,	-0x1	},	insn_bitbit, 0, 0, 0, 1 },
-	{ "std",	{	0xdd,	0xed,	0xfd,	-0x1	},	insn_gen0 },
-	{ "ste",	{	0x1197,	0x11a7,	0x11b7,	-0x1	},	insn_gen0, 0, 0, 0, 1 },
-	{ "stf",	{	0x11d7,	0x11e7,	0x11f7,	-0x1	},	insn_gen0, 0, 0, 0, 1 },
-	{ "stq",	{	0x10dd,	0x10ed,	0x10fd,	-0x1	},	insn_gen0, 0, 0, 0, 1 },
-	{ "sts",	{	0x10df,	0x10ef,	0x10ff,	-0x1	},	insn_gen0 },
-	{ "stu",	{	0xdf,	0xef,	0xff,	-0x1	},	insn_gen0 },
-	{ "stw",	{	0x1097,	0x10a7,	0x10b7,	-0x1	},	insn_gen0, 0, 0, 0, 1 },
-	{ "stx",	{	0x9f,	0xaf,	0xbf,	-0x1	},	insn_gen0 },
-	{ "sty",	{	0x109f,	0x10af,	0x10bf,	-0x1	},	insn_gen0 },
-	{ "suba",	{	0x90,	0xa0,	0xb0,	0x80	},	insn_gen8 },
-	{ "subb",	{	0xd0,	0xe0,	0xf0,	0xc0	},	insn_gen8 },
-	{ "subd",	{	0x93,	0xa3,	0xb3,	0x83	},	insn_gen16 },
-	{ "sube",	{	0x1190,	0x11a0,	0x11b0,	0x1180	},	insn_gen8, 0, 0, 0, 1 },
-	{ "subf",	{	0x11d0,	0x11e0,	0x11f0,	0x11c0	},	insn_gen8, 0, 0, 0, 1 },
-	{ "subr",	{	0x1032,	-0x1,	-0x1,	-0x1	},	insn_rtor, 0, 0, 0, 1 },
-	{ "subw",	{	0x1090,	0x10a0,	0x1090,	0x1080	},	insn_gen8, 0, 0, 0, 1 },
-	{ "swi",	{	0x3f,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "swi2",	{	0x103f,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "swi3",	{	0x113f,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "sync",	{	0x13,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	
-	// note: 		r+,r+	r-,r-	r+,r	r,r+
-	{ "tfm",	{	0x1138,	0x1139,	0x113a,	0x113b	},	insn_tfm, 0, 0, 0, 1 },
-
-	// compatibility opcodes for tfm in other assemblers
-	{ "copy",	{	0x1138, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "copy+",	{	0x1138, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "tfrp",	{	0x1138, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	
-	{ "copy-",	{	0x1139, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "tfrm",	{	0x1139, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	
-	{ "imp",	{	0x113a, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "implode",{	0x113a, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "tfrs",	{	0x113a, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	
-	{ "exp",	{	0x113b, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "expand",	{	0x113b, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-	{ "tfrr",	{	0x113b, -1, -1, -1},	insn_tfmrtor, 0, 0, 0, 1 },
-
-	{ "tfr",	{	0x1f,	-0x1,	-0x1,	-0x1	},	insn_rtor },
-	{ "tim",	{	0x0b,	0x6b,	0x7b,	-0x1	},	insn_logicmem, 0, 0, 0, 1 },
-	{ "tst",	{	0x0d,	0x6d,	0x7d,	-0x1	},	insn_gen0 },
-	{ "tsta",	{	0x4d,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "tstb",	{	0x5d,	-0x1,	-0x1,	-0x1	},	insn_inh },
-	{ "tstd",	{	0x104d,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "tste",	{	0x114d,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "tstf",	{	0x115d,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-	{ "tstw",	{	0x105d,	-0x1,	-0x1,	-0x1	},	insn_inh, 0, 0, 0, 1 },
-
-	{ "org",	{ -1, -1, -1, -1 },	pseudo_org },
-
-	{ "equ",	{ -1, -1, -1, -1 },	pseudo_equ,	0,	0,	1 },
-	{ "=",		{ -1, -1, -1, -1 },	pseudo_equ,	0,	0,	1 },
-	{ "extern",	{ -1, -1, -1, -1 },	pseudo_extern,	0,	0,	1 },
-	{ "external",	{ -1, -1, -1, -1 },	pseudo_extern,	0,	0,	1 },
-	{ "import",	{ -1, -1, -1, -1 },	pseudo_extern,	0,	0,	1 },
-	{ "export",	{ -1, -1, -1, -1 },	pseudo_export,	0,	0,	1 },
-
-
-	{ "rmb", 	{ -1, -1, -1, -1 }, pseudo_rmb },
-	{ "rmd", 	{ -1, -1, -1, -1 }, pseudo_rmd },
-	{ "rmq", 	{ -1, -1, -1, -1 }, pseudo_rmq },
-
-	{ "zmb", 	{ -1, -1, -1, -1 }, pseudo_zmb },
-	{ "zmd", 	{ -1, -1, -1, -1 }, pseudo_zmd },
-	{ "zmq", 	{ -1, -1, -1, -1 }, pseudo_zmq },
-
-	{ "fcc",	{ -1, -1, -1, -1 },	pseudo_fcc },
-	{ "fcn",	{ -1, -1, -1, -1 },	pseudo_fcn },
-	{ "fcs",	{ -1, -1, -1, -1 },	pseudo_fcs },
-
-	{ "fcb",	{ -1, -1, -1, -1 },	pseudo_fcb },
-	{ "fdb",	{ -1, -1, -1, -1 },	pseudo_fdb },
-	{ "fqb",	{ -1, -1, -1, -1 },	pseudo_fqb },
-
-	{ "end", 	{ -1, -1, -1, -1 }, pseudo_end },
-
-	{ "includebin", { -1, -1, -1, -1}, pseudo_includebin },
-	{ "include", { -1, -1, -1, -1 }, pseudo_include },
-	{ "use",	{ -1, -1, -1, -1 },	pseudo_include },
-	
-	{ "align", { -1, -1, -1, -1 },	pseudo_align },
-
-	{ "error",	{ -1, -1, -1, -1},	pseudo_error },
-
-	// these are *dangerous*
-	{ "ifp1",	{ -1, -1, -1, -1},	pseudo_ifp1, 1 },
-	{ "ifp2",	{ -1, -1, -1, -1},	pseudo_ifp2, 1 },
-
-	{ "ifeq",	{ -1, -1, -1, -1}, 	pseudo_ifeq, 1 },
-	{ "ifne",	{ -1, -1, -1, -1}, 	pseudo_ifne, 1 },
-	{ "if",		{ -1, -1, -1, -1}, 	pseudo_ifne, 1 },
-	{ "ifgt",	{ -1, -1, -1, -1}, 	pseudo_ifgt, 1 },
-	{ "ifge",	{ -1, -1, -1, -1}, 	pseudo_ifge, 1 },
-	{ "iflt",	{ -1, -1, -1, -1}, 	pseudo_iflt, 1 },
-	{ "ifle",	{ -1, -1, -1, -1}, 	pseudo_ifle, 1 },
-	{ "endc",	{ -1, -1, -1, -1}, 	pseudo_endc, 1 },
-	{ "else",	{ -1, -1, -1, -1}, 	pseudo_else, 1 },
-	{ "ifdef",	{ -1, -1, -1, -1},	pseudo_ifdef, 1},
-	{ "ifndef",	{ -1, -1, -1, -1},	pseudo_ifndef, 1},
-
-	{ "macro",	{ -1, -1, -1, -1}, 	pseudo_macro,	1,	0,	1 },
-	{ "endm",	{ -1, -1, -1, -1},	pseudo_endm,	1,	1,	1 },
-
-	{ "setdp", 	{ -1, -1, -1, -1},	pseudo_setdp },
-	{ "set",	{ -1, -1, -1, -1},	pseudo_set,	0,	0,	1 },
-
-	{ "section",	{ -1, -1, -1, -1},	pseudo_section },
-	{ "sect",	{ -1, -1, -1, -1},	pseudo_section },
-	{ "ends",	{ -1, -1, -1, -1},	pseudo_endsection },
-	{ "endsect",	{ -1, -1, -1, -1},	pseudo_endsection },
-	{ "endsection",	{ -1, -1, -1, -1},	pseudo_endsection },
-	
-	{ "pragma",	{ -1, -1, -1, -1},	pseudo_pragma },
-	{ "*pragma",	{ -1, -1, -1, -1},	pseudo_starpragma },
-	
-	// for os9 target
-	{ "os9",	{ -1, -1, -1, -1 }, pseudo_os9 },
-	{ "mod",	{ -1, -1, -1, -1 },	pseudo_mod },
-	{ "emod",	{ -1, -1, -1, -1 },	pseudo_emod },
-
-	/* for compatibility with gcc6809 output... */
-	{ ".area",	{ -1, -1, -1, -1},	pseudo_section },
-	{ ".globl",	{ -1, -1, -1, -1}, 	pseudo_export },
-	{ ".module",	{ -1, -1, -1, -1},	pseudo_noop },
-	
-	{ ".4byte",	{ -1, -1, -1, -1},	pseudo_fqb },
-	{ ".quad",	{ -1, -1, -1, -1},	pseudo_fqb },
-	
-	{ ".word",	{ -1, -1, -1, -1},	pseudo_fdb },
-	{ ".dw",	{ -1, -1, -1, -1},	pseudo_fdb },
-
-	{ ".byte",	{ -1, -1, -1, -1},	pseudo_fcb },
-	{ ".db",	{ -1, -1, -1, -1},	pseudo_fcb },
-
-	{ ".ascii",	{ -1, -1, -1, -1},	pseudo_fcc },
-	{ ".str",	{ -1, -1, -1, -1},	pseudo_fcc },
-	
-	{ ".ascis",	{ -1, -1, -1, -1},	pseudo_fcs },
-	{ ".strs",	{ -1, -1, -1, -1},	pseudo_fcs },
-	
-	{ ".asciz",	{ -1, -1, -1, -1},	pseudo_fcn },
-	{ ".strz",	{ -1, -1, -1, -1},	pseudo_fcn },
-	
-	{ ".blkb",	{ -1, -1, -1, -1},	pseudo_rmb },
-	{ ".ds",	{ -1, -1, -1, -1},	pseudo_rmb },
-	{ ".rs",	{ -1, -1, -1, -1},	pseudo_rmb },
-
-// needs to handle C escapes maybe?
-//	{ ".ascii",	{ -1, -1, -1, -1},	pseudo_ascii },
-
-	// for compatibility
-	{ ".end", 	{ -1, -1, -1, -1 }, pseudo_end },
-	
-	// extra ops that are ignored because they are generally only for
-	// pretty printing the listing
-	{ "nam",	{ -1, -1, -1, -1 }, pseudo_noop },
-	{ "pag",	{ -1, -1, -1, -1 }, pseudo_noop },
-	{ "ttl",	{ -1, -1, -1, -1 }, pseudo_noop },
-
-	/* flag end of table */	
-	{ NULL,		{ -0x1, -0x1, -0x1, -0x1 }, insn_inh }
-};
--- a/old-trunk/lwasm/old/instab.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-instab.h
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Contains definitions for the instruction table
-*/
-
-#ifndef __instab_h_seen__
-#define __instab_h_seen__
-
-#include "lwasm.h"
-
-typedef struct
-{
-	char *opcode;				/* the mneumonic */
-	int ops[4];					/* opcode values for up to four addr modes */
-	void (*fn)(asmstate_t *as, lwasm_line_t *l, char **optr, int opnum);
-	int iscond;					/* set if this should be dispatched even if skipping a condition/macro */
-	int endm;					/* end of macro? */
-	int setsym;					/* does this set a symbol address? EQU, SET */
-	int is6309;					/* is this 6309 only? */
-} instab_t;
-
-#define OPFUNC(fn)	void (fn)(asmstate_t *as, lwasm_line_t *l, char **p, int opnum)
-
-#ifndef __instab_c_seen__
-extern instab_t instab[];
-#endif //__instab_c_seen__
-
-#endif //__instab_h_seen__
--- a/old-trunk/lwasm/old/list.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-list.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains code for displaying a program listings, etc.
-*/
-
-#define __list_c_seen__
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lwasm.h"
-
-void lwasm_show_errors(asmstate_t *as)
-{
-	lwasm_line_t *l;
-	lwasm_error_t *e;
-	
-	for (l = as -> lineshead; l; l = l -> next)
-	{
-		if (l -> err)
-		{
-			for (e = l -> err; e; e = e -> next)
-			{
-				fprintf(stderr, "ERROR: %s\n", e -> mess);
-			}
-			fprintf(stderr, "%s:%d: %s\n", l -> filename, l -> lineno, l -> text);
-		}
-	}
-}
-
-void lwasm_list(asmstate_t *as)
-{
-	FILE *lf;
-	lwasm_line_t *l;
-	int c, c3;
-	char *p;
-	
-	if (!as -> listfile)
-		goto showerr;
-	if (as -> listfile[0] == '-' && as -> listfile[1] == '\0')
-		lf = stdout;
-	else
-	{
-		lf = fopen(as -> listfile, "w");
-		if (!lf)
-		{
-			fprintf(stderr, "Unable to open list file '%s'. No listing will be generated: ", as -> listfile);
-			perror("");
-			goto showerr;
-		}
-	}
-
-	for (l = as -> lineshead; l; l = l -> next)
-	{
-		if (l -> addrset == 1 || l -> codelen > 0 || l -> nocodelen > 0)
-		{
-			fprintf(lf, "%04X ", l -> codeaddr);
-		}
-		else
-		{
-			fprintf(lf, "     ");
-		}
-		
-		if (l -> addrset == 2)
-		{
-			fprintf(lf, "%04X      ", l -> symaddr);
-		}
-		else
-		{
-			for (c = 0; c < l -> codelen && c < 5; c++)
-			{
-				fprintf(lf, "%02X", l -> bytes[c]);
-			}
-			while (c < 5)
-			{
-				fprintf(lf, "  ");
-				c++;
-			}
-		}
-		fprintf(lf, " %20.20s:%05d ", l -> filename, l -> lineno);
-		
-		// print line here
-		for (c3 = 0, c = 0, p = l -> text; *p; c++, p++)
-		{
-			if (*p == '\t')
-			{
-				int c2;
-				c2 = 8 - (c3 % 8);
-				c3 += c2;
-				while (c2--) fputc(' ', lf);
-			}
-			else
-			{
-				c3++;
-				fputc(*p, lf);
-			}
-		}
-		fputc('\n', lf);
-		
-		if (l -> codelen > 5)
-		{
-			fprintf(lf, "%04X ", (l -> codeaddr + 5) & 0xFFFF);
-			for (c = 5; c < l -> codelen; c++)
-			{
-				if (!(c % 5) && c != 5)
-				{
-					fprintf(lf, "\n%04X ", (l -> codeaddr + c) & 0xFFFF);
-				}
-				fprintf(lf, "%02X", l -> bytes[c]);
-			}
-			fputc('\n', lf);
-		}
-	}
-	
-	lwasm_list_symbols(as, lf);
-	
-	if (lf != stdout)
-		fclose(lf);
-
-showerr:
-	lwasm_show_errors(as);
-}
--- a/old-trunk/lwasm/old/lwasm.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,463 +0,0 @@
-/*
-lwasm.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Contains random functions used by the assembler
-*/
-
-#define __lwasm_c_seen__
-#include <config.h>
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "lwasm.h"
-#include "util.h"
-#include "expr.h"
-
-int debug_level = 0;
-
-int register_error(asmstate_t *as, lwasm_line_t *l, int pass, const char *fmt, ...)
-{
-	lwasm_error_t *e;
-	va_list args;
-	char errbuff[1024];
-	int r;
-	
-	if (!l)
-		return;
-
-	if (as -> passnum != pass)
-		return;
-	
-	va_start(args, fmt);
-	
-	e = lwasm_alloc(sizeof(lwasm_error_t));
-	
-	e -> next = l -> err;
-	l -> err = e;
-	
-	as -> errorcount++;
-	
-	r = vsnprintf(errbuff, 1024, fmt, args);
-	e -> mess = lwasm_strdup(errbuff);
-	
-	va_end(args);
-	
-	return r;
-}
-
-void lwasm_emit(asmstate_t *as, lwasm_line_t *l, int b)
-{
-	as -> addr += 1;
-	as -> addr &= 0xffff;
-	
-	if (as -> outformat == OUTPUT_OBJ && !(as -> csect))
-	{
-		register_error(as, l, 1, "Output not allowed outside sections with obj target");
-		return;
-	}
-	if (as -> outformat == OUTPUT_OBJ && as -> csect -> flags & SECTION_BSS)
-	{
-		register_error(as, l, 1, "Output not allowed inside BSS sections");
-		return;
-	}
-	
-	if (as -> outformat == OUTPUT_OS9 && as -> inmod == 0)
-	{
-		register_error(as, l, 1, "Output not allowed outside of module in OS9 mode");
-		return;
-	}
-	
-	if (as -> passnum == 1)
-		return;
-
-
-	if (l -> codelen >= l -> codesize)
-	{
-		l -> bytes = realloc(l -> bytes, l -> codesize + 16);
-		l -> codesize += 16;
-	}
-	l -> bytes[l -> codelen] = b & 0xff;
-	l -> codelen += 1;
-	
-	if (as -> outformat == OUTPUT_OS9 && as -> inmod)
-	{
-		// calc the CRC
-		// this is a direct transliteration from the nitros9 asm source
-		// to C; it can, no doubt, be optimized for 32 bit processing
-		b &= 0xff;
-		
-		b ^= (as -> crc)[0];
-		(as -> crc)[0] = (as -> crc)[1];
-		(as -> crc)[1] = (as -> crc)[2];
-		(as -> crc)[1] ^= (b >> 7);
-		(as -> crc)[2] = (b << 1);
-		(as -> crc)[1] ^= (b >> 2);
-		(as -> crc)[2] ^= (b << 6);
-		b ^= (b << 1);
-		b ^= (b << 2);
-		b ^= (b << 4);
-		if (b & 0x80)
-		{
-			(as -> crc)[0] ^= 0x80;
-			(as -> crc)[2] ^= 0x21;
-		}
-	}
-}
-
-void lwasm_emitop(asmstate_t *as, lwasm_line_t *l, int o)
-{
-	if (o >= 0x100)
-		lwasm_emit(as, l, o >> 8);
-	lwasm_emit(as, l, o & 0xff);
-}
-
-int lwasm_lookupreg2(const char *reglist, char **str)
-{
-	int rval = 0;
-
-	while (*reglist)
-	{
-		if (toupper(**str) == *reglist)
-		{
-			// first char matches
-			if (reglist[1] == ' ' && !isalpha(*(*str + 1)))
-				break;
-			if (toupper(*(*str + 1)) == reglist[1])
-				break;
-		}
-		reglist += 2;
-		rval++;
-	}
-	if (!*reglist)
-		return -1;
-	if (reglist[1] == ' ')
-		(*str)++;
-	else
-		(*str) += 2;
-	return rval;
-}
-
-int lwasm_lookupreg3(const char *rlist, const char **str)
-{
-	int rval = 0;
-	int f = 0;
-	const char *reglist = rlist;
-		
-	while (*reglist)
-	{
-		if (toupper(**str) == *reglist)
-		{
-			// first char matches
-			if (reglist[1] == ' ')
-			{
-				f = 1;
-				break;
-			}
-			if (toupper(*(*str + 1)) == reglist[1])
-			{
-				// second char matches
-				if (reglist[2] == ' ')
-				{
-					f = 1;
-					break;
-				}
-				if (toupper(*(*str + 2)) == reglist[2])
-				{
-					f = 1;
-					break;
-				}
-			}
-		}
-		reglist += 3;
-		rval++;
-	}
-	if (f == 0)
-		return -1;
-	
-	
-	reglist = rval * 3 + rlist;
-	if (reglist[1] == ' ')
-		(*str) += 1;
-	else if (reglist[2] == ' ')
-		(*str) += 2;
-	else
-		(*str)+=3;
-	return rval;
-}
-
-struct symstateinfo
-{
-	asmstate_t *as;
-	lwasm_line_t *l;
-	int flags;
-};	
-
-lwasm_expr_stack_t *lwasm_expr_lookup_symbol(char *sym, void *state)
-{
-	lwasm_symbol_ent_t *se;
-	struct symstateinfo *st;
-	lwasm_expr_stack_t *rs;
-	lwasm_expr_term_t *t;
-	lwasm_expr_stack_node_t *n;
-	
-	int val;
-	
-	st = state;
-	debug_message(3, "lwasm_expr_lookup_symbol(): find '%s' (context=%d)", sym, st -> as -> context);	
-
-	// check for special symbols first...
-	if (sym[1] == '\0')
-	{
-		switch (sym[0])
-		{
-		// current line address
-		case '*':
-		case '.':
-			val = st -> l -> codeaddr;
-			goto retconst;
-		
-		case '<':
-			// previous branch point
-			// not implemented
-			break;
-		case '>':
-			// next branch point
-			// not implemented
-			break;
-		}
-	}
-
-	// look for local symbol first then global symbol
-	se = lwasm_find_symbol(st -> as, sym, st -> as -> context);
-	if (!se)
-		se = lwasm_find_symbol(st -> as, sym, -1);
-	debug_message(3, "lwasm_expr_lookup_symbol(): got '%p'", se);
-	if (!se)
-	{
-		register_error(st -> as, st -> l, 2, "Undefined symbol '%s'", sym);
-		return NULL;
-	}
-	// external reference - can not resolve it
-	if (se -> flags & SYMBOL_EXTERN)
-	{
-		return NULL;
-	}
-	if (st -> flags & EXPR_SECTCONST)
-	{
-		if (se -> sect == st -> l -> sect)
-		{
-			if (se -> expr)
-				goto retsym;
-			val = se -> value;
-			goto retconst;
-		}
-	}
-	if (st -> as -> outformat == OUTPUT_OBJ && se -> sect != NULL)
-	{
-		return NULL;
-	}
-	if (st -> as -> outformat != OUTPUT_OBJ || se -> sect == NULL)
-	{
-		// global symbol, intrasegment reference, or not an object target
-		val = se -> value;
-		goto retconst;
-	}
-	
-	// an intersegment reference will return as NULL (to be resolved at output/link time)
-	// if se -> expr is NULL, it has to be an intersegment reference here
-	if (se -> expr == NULL)
-	{
-		return NULL;
-	}
-	
-retsym:
-	// duplicate the expression for return
-	rs = lwasm_expr_stack_create();
-	for (n = se -> expr -> head; n; n = n -> next)
-	{
-		lwasm_expr_stack_push(rs, n -> term);
-	}
-	return rs;
-
-retconst:
-	rs = lwasm_expr_stack_create();
-	t = lwasm_expr_term_create_int(val);
-	lwasm_expr_stack_push(rs, t);
-	lwasm_expr_term_free(t);
-	return rs;
-}
-
-lwasm_expr_stack_t *lwasm_evaluate_expr(asmstate_t *as, lwasm_line_t *l, const char *inp, const char **outp, int flags)
-{
-	struct symstateinfo st;
-	
-	st.as = as;
-	st.l = l;
-	st.flags = flags;
-	
-	debug_message(2, "Evaluate expression: %s", inp);
-	
-	return(lwasm_expr_eval(inp, outp, lwasm_expr_lookup_symbol, &st));
-}
-
-
-int lwasm_reevaluate_expr(asmstate_t *as, lwasm_line_t *l, lwasm_expr_stack_t *s, int flags)
-{
-	struct symstateinfo st;
-	
-	st.as = as;
-	st.l = l;
-	st.flags = flags;
-	return(lwasm_expr_reval(s, lwasm_expr_lookup_symbol, &st));
-}
-
-// return 1 if no undefined symbols (externals and incompletes are okay)
-// return 0 if there are undefined symbols
-int lwasm_expr_result_ckconst(asmstate_t *as, lwasm_expr_stack_t *s)
-{
-	lwasm_expr_stack_node_t *n;
-	lwasm_symbol_ent_t *se;
-	
-	if (as -> outformat != OUTPUT_OBJ)
-	{
-		if (lwasm_expr_is_constant(s))
-			return 1;
-		else
-			return 0;
-	}
-	
-	for (n = s -> head; n; n = n -> next)
-	{
-		if (n -> term -> term_type == LWASM_TERM_SYM)
-		{
-			se = lwasm_find_symbol(as, n -> term -> symbol, as -> context);
-			if (!se)
-				se = lwasm_find_symbol(as, n -> term -> symbol, -1);
-			if (!se)
-				return 0;
-		}
-	}
-	return 1;
-}
-
-/*
-Evaluate an expression according to the flag value. Return 0 if a constant result was
-obtained, 1 if an incomplete result was obtained, and -1 if an error was flagged.
-
-*/
-int lwasm_expr_result2(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val, int slot)
-{
-	lwasm_expr_stack_t *s = NULL;
-	const char *ep;
-	int rval;
-
-	if ((as -> passnum == 1 && !(flag & EXPR_REEVAL)) || slot < 0)
-	{		
-		s = lwasm_evaluate_expr(as, l, *inp, &ep, flag);
-		if (slot >= 0)
-		{
-			l -> exprs[slot] = s;
-			l -> exprends[slot] = ep;
-		}
-		if (!s)
-		{
-			register_error(as, l, 1, "Bad expression");
-			*val = 0;
-			return -1;
-		}
-		*inp = (char *)ep;
-		if (slot >= 0)
-		{
-//			l -> exprends[slot] = (char *)ep;
-			l -> exprvals[slot] = lwasm_expr_get_value(s);
-		}
-	}
-	else if (l -> exprs[slot])
-	{
-		s = l -> exprs[slot];
-		lwasm_reevaluate_expr(as, l, s, flag);
-		l -> exprvals[slot] = lwasm_expr_get_value(s);
-	}
-	if (as -> passnum == 2 && slot >= 0)
-		*inp = l -> exprends[slot];
-
-	if (s && lwasm_expr_is_constant(s))
-	{
-		*val = lwasm_expr_get_value(s);
-		lwasm_expr_stack_free(s);
-		l -> exprs[slot] = NULL;
-		s = NULL;
-		return 0;
-	}
-
-	if (!s && slot >= 0)
-	{
-		*val = l -> exprvals[slot];
-		return 0;
-	}
-	else if (!s)
-	{
-		*val = 0;
-		return 0;
-	}
-
-	// was a constant result on pass 1 requested?
-	// that means we must have a constant on either pass
-	if (flag & EXPR_PASS1CONST)
-	{
-		*val = 0;
-		if (slot >= 0)
-			l -> exprvals[slot] = 0;
-		register_error(as, l, 1, "Illegal forward, external, or inter-section reference");
-		lwasm_expr_stack_free(s);
-		if (slot >= 0)
-			l -> exprs[slot] = NULL;
-		return -1;
-	}
-	
-	return 1;
-}
-
-void debug_message(int level, const char *fmt, ...)
-{
-	va_list args;
-	
-	va_start(args, fmt);
-	if (debug_level >= level)
-	{
-		if (level > 0)
-			fprintf(stderr, "DEBUG %d: ", level);
-		vfprintf(stderr, fmt, args);
-		fputc('\n', stderr);
-	}
-	va_end(args);
-}
-
-int lwasm_next_context(asmstate_t *as)
-{
-	int r;
-	r = as -> nextcontext;
-	as -> nextcontext += 1;
-	debug_message(3, "lwasm_next_context(): %d (%d) pass %d", r, as -> nextcontext, as -> passnum);
-	return r;
-}
-
--- a/old-trunk/lwasm/old/lwasm.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-/*
-lwasm.h
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains the main defs used by the assembler
-*/
-
-
-#ifndef __lwasm_h_seen__
-#define __lwasm_h_seen__
-
-#include <stdio.h>
-#include "expr.h"
-
-#define OUTPUT_DECB		0	// DECB multirecord format
-#define OUTPUT_RAW		1	// raw sequence of bytes
-#define OUTPUT_OBJ		2	// proprietary object file format
-#define OUTPUT_RAWREL	3	// raw bytes where ORG causes a SEEK in the file
-#define OUTPUT_OS9		4	// os9 module target
-
-// structure for tracking sections
-typedef struct section_reloc_list_s section_reloc_list_t;
-struct section_reloc_list_s
-{
-	int offset;						// offset into section
-	int relocsize;					// size of relocation in bytes
-	lwasm_expr_stack_t *expr;		// value definition
-	int context;					// symbol context (for local syms)
-	section_reloc_list_t *next;		// next relocation
-};
-
-typedef struct export_list_s export_list_t;
-struct export_list_s
-{
-	int offset;						// offset of symbol
-	char *sym;						// name of symbol
-	export_list_t *next;			// next export	
-};
-
-#define SECTION_BSS		1	// the section contains no actual code - just uninit vars
-typedef struct sectiontab_s sectiontab_t;
-struct sectiontab_s
-{
-	char *name;				// name of the section
-	int offset;				// current offset in the section
-	int flags;				// section flags
-	sectiontab_t *next;		// next section
-	// the following are used during code output
-	unsigned char *obytes;	// output bytes
-	int oblen;				// how many bytes output so far?
-	int obsize;				// how big is output buffer so far?
-	section_reloc_list_t *rl;	// relocation list
-	export_list_t *exports;	// export list for the section
-};
-
-// structure for tracking macros
-typedef struct macrotab_s macrotab_t;
-struct macrotab_s
-{
-	char *name;
-	char **lines;
-	int numlines;
-	macrotab_t *next;
-};
-
-// structure for tracking errors
-typedef struct lwasm_error_s lwasm_error_t;
-struct lwasm_error_s
-{
-	char *mess;				// the actual error message
-	lwasm_error_t *next;	// ptr to next error
-};
-
-// structure for keeping track of lines
-// it also as space for 4 expressions which is enough for all known
-// instructions and addressing modes
-// on pass 1, the expressions are parsed, on pass 2 they are re-evaluated
-// to determine constancy
-typedef struct lwasm_line_s lwasm_line_t;
-struct lwasm_line_s {
-	char *text;			// the actual text of the line
-	int lineno;			// line number within the file
-	char *filename;		// file name reference
-	lwasm_line_t *next;	// next line
-	lwasm_line_t *prev;	// previous line
-	lwasm_error_t *err;	// error messages
-	int fsize;			// forced size (0 = no forced size)
-	char *sym;			// scratch area to record the presence of a symbol
-	unsigned char *bytes;	// actual bytes emitted
-	int codelen;		// number of bytes emitted
-	int codesize;		// the size of the code buffer
-	int codeaddr;		// address the code goes at
-	int nocodelen;		// for "RMB" type instructions
-	int addrset;		// set if this instruction sets the assembly address
-	int symaddr;		// set if this instruction sets a symbol addr with EQU or the like
-	int badop;			// bad operation - ignore it
-	int context;		// the symbol context for this line
-	int forceglobal;	// force a "global" symbol definition if constant
-	
-	// the following are used for obj format - for external references, inter-section
-	// references, and intrasection relocations
-	int relocoff;		// offset into insn where relocation value goes
-	int reloc8bit;		// size of relocation (0 = 16 bit, 1 = 8 bit)
-	lwasm_expr_stack_t *exprs[4];	// non-constant expression values
-	int exprvals[4];	// constant expression values
-	char *exprends[4];	// pointer to character after end of expression
-	int inmod;			// in an os9 module
-	
-	sectiontab_t *sect;	// which section is the line in?
-};
-
-// for keeping track of symbols
-#define	SYMBOL_SET		1	// the symbol was used for "SET"
-#define SYMBOL_COMPLEX	2	// register symbol as a complex symbol (from l -> expr)
-#define SYMBOL_FORCE	4	// force resetting the symbol value if it already exists on pass 2
-#define SYMBOL_NORM		0	// no flags
-#define SYMBOL_EXTERN	8	// the symbol is an external reference
-#define SYMBOL_GLOBAL	16	// force global if non-complex symbol
-typedef struct lwasm_symbol_ent_s lwasm_symbol_ent_t;
-struct lwasm_symbol_ent_s
-{
-	char *sym;					// the symbol
-	int context;				// the context number of the symbol (-1 for global)
-	int value;					// the value of the symbol
-	int flags;					// flags for the symbol
-	char *externalname;			// for external references that are aliased locally
-	sectiontab_t *sect;			// the section the symbol exists in; NULL for none
-	lwasm_expr_stack_t *expr;	// expression for a symbol that is not constant NULL for const
-	lwasm_symbol_ent_t *next;	// next symbol in the table
-	lwasm_symbol_ent_t *prev;	// previous symbol in the table
-};
-
-// keep track of current assembler state
-typedef struct {
-	int dpval;					// current dp value (setdp)
-	int addr;					// current address
-	int context;				// context counter (for local symbols)
-	int errorcount;				// error count
-	int passnum;				// which pass are we on?
-	int execaddr;				// execution address for the program (END ....)
-	int pragmas;				// what pragmas are in effect?
-
-	lwasm_line_t *lineshead;	// first line of source code
-	lwasm_line_t *linestail;	// last line of source code
-	
-	lwasm_symbol_ent_t *symhead;	// first entry in symbol table
-	lwasm_symbol_ent_t *symtail;	// last entry in symbol table
-	
-	macrotab_t *macros;			// macro table
-
-	const char *infile;			// input file
-	const char *outfile;		// output file
-	const char *listfile;		// output listing file
-	int outformat;				// output format type
-	char **filelist;			// files that have been read
-	int filelistlen;			// number of files in the list
-	
-	int endseen;				// set to true if "end" has been seen
-	int skipcond;				// skipping a condition?
-	int skipcount;				// how many?
-	int skipmacro;				// skipping a macro?
-	int inmacro;				// are we currently in a macro?
-	int macroex;				// current depth of macro expansion
-	int nextcontext;			// next context number
-	int skiplines;				// number of lines to skip
-	
-	// items used only for the "object" target
-	sectiontab_t *sections;		// pointer to section table
-	sectiontab_t *csect;		// current section - NULL if not in one
-	
-	// only 6809 ops?
-	int no6309;	
-	
-	// for os9 mode
-	int inmod;					// in a module?
-	unsigned char crc[3];			// running crc count
-} asmstate_t;
-
-// do not rewrite XXX,r to ,r if XXX evaluates to 0
-#define PRAGMA_NOINDEX0TONONE	1
-// any undefined symbols are considered external
-#define PRAGMA_UNDEFEXTERN		2
-// allow C-style escapes in fcc, fcs, and fcn directives
-#define PRAGMA_CESCAPES			4
-// allow "export <undefsym>" to import the symbol
-#define PRAGMA_IMPORTUNDEFEXPORT	8
-// don't have $ as a local symbol
-#define PRAGMA_DOLLARNOTLOCAL	16
-
-#ifndef __lwasm_c_seen__
-#define __lwasm_E__ extern
-#else
-#define __lwasm_E__
-#endif
-
-__lwasm_E__ int debug_level;
-
-__lwasm_E__ int register_error(asmstate_t *as, lwasm_line_t *l, int pass, const char *fmt, ...);
-__lwasm_E__ void debug_message(int level, const char *fmt, ...);
-
-__lwasm_E__ void lwasm_emit(asmstate_t *as, lwasm_line_t *l, int b);
-__lwasm_E__ void lwasm_emitop(asmstate_t *as, lwasm_line_t *l, int o);
-__lwasm_E__ int lwasm_lookupreg2(const char *reglist, char **str);
-__lwasm_E__ int lwasm_lookupreg3(const char *rlist, const char **str);
-
-__lwasm_E__ lwasm_expr_stack_t *lwasm_evaluate_expr(asmstate_t *as, lwasm_line_t *l, const char *inp, const char **outp, int flags);
-
-
-// return next context number and update it
-__lwasm_E__ int lwasm_next_context(asmstate_t *as);
-
-// also throw an error on expression eval failure
-// return 0 on ok, -1 on error, 1 if a complex expression was returned
-#define EXPR_NOFLAG			0
-#define EXPR_PASS1CONST		1	// no forward references on pass 1
-#define EXPR_SECTCONST		2	// resolve symbols local to section
-#define EXPR_REEVAL			4	// re-evaluate the expression
-__lwasm_E__ int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val);
-__lwasm_E__ int lwasm_expr_result2(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val, int slot);
-
-#undef __lwasm_E__
-
-
-#ifndef __symbol_c_seen__
-#define __lwasm_E__ extern
-#else
-#define __lwasm_E__
-#endif
-
-__lwasm_E__ int lwasm_register_symbol(asmstate_t *as, lwasm_line_t *l, char *sym, int val, int flags);
-__lwasm_E__ lwasm_symbol_ent_t *lwasm_find_symbol(asmstate_t *as, char *sym, int scontext);
-__lwasm_E__ int lwasm_set_symbol(asmstate_t *as, char *sym, int scontext, int val);
-__lwasm_E__ void lwasm_list_symbols(asmstate_t *as, FILE *f);
-#undef __lwasm_E__
-
-
-#define skip_operand(p) do { char **p2 = (char **)(p); for ( ; **p2; (*p2)++ ) ; } while (0)
-
-#endif //__lwasm_h_seen__
--- a/old-trunk/lwasm/old/lwval.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*
-lwval.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-This file contains implementations associated with the expression evaluator
-used by LWASM.
-
-*/
-#include <config.h>
-
-#include <malloc.h>
-
-#define __lwval_c_seen__
-#include "lwval.h"
-
-LWVAL *lwval_construct_int(int value)
-{
-	LWVAL *v;
-	
-	v = malloc(sizeof(LWVAL));
-	if (!v)
-		return NULL;
-	
-	v -> lwval_type = LWVAL_TYPE_INT;
-	v -> dt.lwval_int = value;
-	
-	return v;
-}
-
-LWVAL *lwval_construct_err(int errno)
-{
-	LWVAL *v;
-	
-	v = malloc(sizeof(LWVAL));
-	if (!v)
-		return NULL;
-	
-	v -> lwval_type = LWVAL_TYPE_ERR;
-	v -> dt.lwval_int = errno;
-	
-	return v;
-}
-
-LWVAL *lwval_construct_nan(void)
-{
-	LWVAL *v;
-	
-	v = malloc(sizeof(LWVAL));
-	if (!v)
-		return NULL;
-	
-	v -> lwval_type = LWVAL_TYPE_NAN;
-	
-	return v;
-}
-
-LWVAL *lwval_construct_undef(void)
-{
-	LWVAL *v;
-	
-	v = malloc(sizeof(LWVAL));
-	if (!v)
-		return NULL;
-	
-	v -> lwval_type = LWVAL_TYPE_UNDEF;
-	
-	return v;
-}
-
-LWVAL *lwval_construct_expr(LWVAL *v1, LWVAL *v2, int op)
-{
-	LWVAL *v;
-	v = malloc(sizeof(LWVAL));
-	if (!v)
-		return NULL;
-	
-	v -> lwval_type = LWVAL_TYPE_EXPR;
-	v -> dt.expr.v1 = v1;
-	v -> dt.expr.v2 = v2;
-	v -> dt.expr.op = op;
-	return v;
-}
-
-void lwval_destroy(LWVAL *value)
-{
-	if (value)
-	{
-		lwval_clear(value);
-		free(value);
-	}
-}
-
-// performs a deep copy of an LWVAL, including ALL referenced values
-void lwval_dup(LWVAL *v1, LWVAL *v2)
-{
-	lwval_clear(v2);
-	
-	switch (v1 -> lwval_type)
-	{
-	case LWVAL_TYPE_INT:
-	case LWVAL_TYPE_ERR:
-		v2 -> dt.lwval_int = v1 -> dt.lwval_int;
-		break;
-	
-	case LWVAL_TYPE_EXPR:
-		v2 -> dt.expr.op = v1 -> dt.expr.op;
-		if (v1 -> dt.expr.v1)
-		{
-			v2 -> dt.expr.v1 = lwval_construct_undef();
-			lwval_dup(v1 -> dt.expr.v1, v2 -> dt.expr.v1);
-		}
-		else
-			v2 -> dt.expr.v1 = NULL;
-		if (v1 -> dt.expr.v2)
-		{
-			v2 -> dt.expr.v2 = lwval_construct_undef();
-			lwval_dup(v1 -> dt.expr.v2, v2 -> dt.expr.v2);
-		}
-		else
-			v2 -> dt.expr.v2 = NULL;
-		break;
-	}
-	
-	v2 -> lwval_type = v1 -> lwval_type;
-}
-
-void lwval_clear(LWVAL *value)
-{
-	switch (value -> lwval_type)
-	{
-	case LWVAL_TYPE_EXPR:
-		lwval_destroy(value -> dt.expr.v1);
-		lwval_destroy(value -> dt.expr.v2);
-		break;
-	}
-	value -> lwval_type = LWVAL_TYPE_UNDEF;
-}
-
-// for integer, simply negate value
-// for expr, change to "-1 * (expr)"
-// everything else: error
-LWVAL *lwval_neg(LWVAL *v1)
-{
-	switch (v1 -> lwval_type)
-	{
-	case LWVAL_TYPE_INT:
-		v1 -> dt.lwval_int = -(v1 -> dt.lwval_int);
-		break;
-	
-	case LWVAL_TYPE_EXPR:
-		{
-			LWVAL *v, *v2;
-			v = lwval_construct_undef();
-			lwval_dup(v1, v);
-			lwval_clear(v1);
-			v2 = lwval_construct_expr(lwval_construct_int(-1), v, '*');
-			lwval_dup(v2, v1);
-			lwval_destroy(v2);
-		}
-		break;
-	
-	default:
-		lwval_clear(v1);
-		v1 -> lwval_type = LWVAL_TYPE_ERR;
-		v1 -> dt.lwval_int = 1;
-	}
-	
-	return v1;
-}
-
-// v1 + v2 -> v1
-LWVAL *lwval_add(LWVAL *v1, LWVAL *v2)
-{
-}
-
-// v1 - v2 -> v1
-LWVAL *lwval_sub(LWVAL *v1, LWVAL *v2)
-{
-}
-
-// v1 * v2 -> v1
-LWVAL *lwval_mul(LWVAL *v1, LWVAL *v2)
-{
-}
-
-// v1 / v2 -> v1
-LWVAL *lwval_div(LWVAL *v1, LWVAL *v2)
-{
-}
-
-// v1 % v2 -> v1
-LWVAL *lwval_mod(LWVAL *v1, LWVAL *v2)
-{
-}
--- a/old-trunk/lwasm/old/lwval.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-lwval.h
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-This file contains definitions associated with the expression evaluator used
-by LWASM.
-
-The core of the entire expression handler is the opaque type LWVAL, pointers
-to which are passed around to keep track of values. A value may be a simple
-integer or it could be a more complex expression linked by operators or it
-could be a polynomial expression. Simple integers are merely a degenerate
-case of polynomials.
-
-The package understands the following operations:
-
-addition
-subtraction
-multiplication
-division
-modulus
-parentheses
-unary negation
-unary "positive"
-bitwise and
-bitwise or
-bitwise not (1's complement)
-bitwise exclusive or
-
-Infix operators can be expressed as LWVAL <op> LWVAL. Thus, the order of
-operations is only relevant when initially parsing the expression. The order
-of evaluation is determined by what appears on either side of the <op> as
-an LWVAL may be an expression.
-*/
-
-#ifndef __lwval_h_seen__
-#define __lwval_h_seen__
-
-typedef struct lwval LWVAL;
-
-struct lwval_dt_expr
-{
-	LWVAL *v1;						// first value
-	LWVAL *v2;						// second value
-	int op;							// operator
-};
-
-union lwval_dt
-{
-	int lwval_int;					// integer type data
-	char *lwval_var;				// pointer to variable name
-	struct lwval_dt_expr expr;		// expression
-};
-
-enum
-{
-	LWVAL_TYPE_UNDEF,				// undefined
-	LWVAL_TYPE_NAN,					// not a number
-	LWVAL_TYPE_INT,					// integer
-	LWVAL_TYPE_VAR,					// variable (symbol)
-	LWVAL_TYPE_EXPR,				// expression
-	LWVAL_TYPE_ERR					// error
-};
-
-struct lwval
-{
-	int lwval_type;					// data type
-	union lwval_dt dt;				// type specific stuff
-};
-
-#ifndef __lwval_c_seen__
-#define __lwval_extern__ extern
-#else
-#define __lwval_extern__
-#endif
-
-__lwval_extern__ LWVAL *lwval_construct_int(int value);
-__lwval_extern__ LWVAL *lwval_construct_err(int errno);
-__lwval_extern__ LWVAL *lwval_construct_nan(void);
-__lwval_extern__ LWVAL *lwval_construct_expr(LWVAL *v1, LWVAL *v2, int op);
-__lwval_extern__ LWVAL *lwval_construct_undef(void);
-__lwval_extern__ void lwval_clear(LWVAL *value);
-__lwval_extern__ void lwval_destroy(LWVAL *value);
-__lwval_extern__ void lwval_dup(LWVAL *v1, LWVAL *v2);
-
-// operators - operate on v1 and v2 in order, result goes into
-// v1; return v1
-__lwval_extern__ LWVAL *lwval_add(LWVAL *v1, LWVAL *v2);
-__lwval_extern__ LWVAL *lwval_sub(LWVAL *v1, LWVAL *v2);
-__lwval_extern__ LWVAL *lwval_mul(LWVAL *v1, LWVAL *v2);
-__lwval_extern__ LWVAL *lwval_div(LWVAL *v1, LWVAL *v2);
-__lwval_extern__ LWVAL *lwval_mod(LWVAL *v1, LWVAL *v2);
-__lwval_extern__ LWVAL *lwval_neg(LWVAL *v1);
-
-#undef __lwval_extern__
-
-#endif //__lwval_h_seen__
--- a/old-trunk/lwasm/old/macro.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +0,0 @@
-/*
-macro.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains stuff associated with macro processing
-*/
-
-#include <config.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include "lwasm.h"
-#include "instab.h"
-#include "util.h"
-
-OPFUNC(pseudo_macro)
-{
-	macrotab_t *m;
-
-	// if skipping a condition, flag in a macro
-	if (as -> skipcond)
-	{
-		as -> skipmacro = 1;
-		return;
-	}
-
-	// actually define a macro
-	if (as -> inmacro)
-	{
-		register_error(as, l, 1, "Attempt to define a macro inside a macro");
-		return;
-	}
-
-	as -> inmacro = 1;
-
-	// don't actually do anything if not pass 1
-	if (as -> passnum != 1)
-		return;
-
-
-	if (!l -> sym)
-	{
-		register_error(as, l, 1, "Macro definition with no effect - no symbol");
-		return;
-	}
-	
-	// search for macro by same name...
-	for (m = as -> macros; m; m = m -> next)
-	{
-		if (!strcmp(m -> name, l -> sym))
-			break;
-	}
-	if (m)
-	{
-		register_error(as, l, 1, "Duplicate macro definition");
-		return;
-	}
-	
-	m = lwasm_alloc(sizeof(macrotab_t));
-	m -> name = lwasm_strdup(l -> sym);
-	m -> next = as -> macros;
-	m -> lines = NULL;
-	m -> numlines = 0;
-	as -> macros = m;
-
-	while (**p && !isspace(**p))
-		(*p)++;
-}
-
-OPFUNC(pseudo_endm)
-{
-	if (as -> skipcond)
-	{
-		as -> skipmacro = 0;
-		return;
-	}
-	
-	if (!as -> inmacro)
-	{
-		register_error(as, l, 1, "ENDM without MACRO");
-		return;
-	}
-	
-	as -> inmacro = 0;
-	
-	// a macro definition counts as a context break for local symbols
-	as -> context = lwasm_next_context(as);
-}
-
-// the current macro will ALWAYS be the first one in the table
-int add_macro_line(asmstate_t *as, char *optr)
-{
-	if (!as -> inmacro)
-		return 0;
-	
-	if (as -> passnum == 2)
-		return 1;
-
-	as -> macros -> lines = lwasm_realloc(as -> macros -> lines, sizeof(char *) * (as -> macros -> numlines + 1));
-	as -> macros -> lines[as -> macros -> numlines] = lwasm_strdup(optr);
-	as -> macros -> numlines += 1;
-	return 1;
-}
-
-void macro_add_to_buff(char **buff, int *loc, int *len, char c)
-{
-	if (*loc == *len)
-	{
-		*buff = lwasm_realloc(*buff, *len + 32);
-		*len += 32;
-	}
-	(*buff)[(*loc)++] = c;
-}
-
-// this is just like a regular operation function
-/*
-macro args are referenced by "\n" where 1 <= n <= 9
-or by "\{n}"; a \ can be included by writing \\
-a comma separates argument but one can be included with "\,"
-whitespace ends argument list but can be included with "\ " or the like
-
-In pass 1, actually add the lines to the system, in pass 2, do not
-In pass 2, track the number of lines to skip because they already will be
-processed by this function - this will be in as -> skiplines
-
-*/
-int expand_macro(asmstate_t *as, lwasm_line_t *l, char **p, char *opc)
-{
-	int lc;
-	lwasm_line_t *cl, *nl;
-	int oldcontext;
-	macrotab_t *m;
-
-	char **args = NULL;		// macro arguments
-	int nargs = 0;			// number of arguments
-
-	char *p2, *p3;
-	
-	int bloc, blen;
-	char *linebuff;
-
-	for (m = as -> macros; m; m = m -> next)
-	{
-		if (!strcmp(opc, m -> name))
-			break;
-	}
-	// signal no macro expansion
-	if (!m)
-		return -1;
-	
-
-	// save current symbol context for after macro expansion
-	oldcontext = as -> context;
-
-	cl = l;
-
-	as -> context = lwasm_next_context(as);
-
-	// step 1: parse arguments (pass 1 only)
-	if (as -> passnum == 1)
-	{
-		while (**p && !isspace(**p) && **p != ',')
-		{
-			p2 = *p;
-			while (*p2 && !isspace(*p2) && *p2 != ',')
-			{
-				if (*p2 == '\\')
-				{
-					if (p2[1])
-						p2++;
-				}
-				p2++;
-			}
-			
-			// have arg here
-			args = lwasm_realloc(args, sizeof(char *) * (nargs + 1));
-			args[nargs] = lwasm_alloc(p2 - *p + 1);
-			args[nargs][p2 - *p] = '\0';
-			memcpy(args[nargs], *p, p2 - *p);
-			*p = p2;
-			
-			// now collapse out "\" characters
-			for (p3 = p2 = args[nargs]; *p2; p2++, p3++)
-			{
-				if (*p2 == '\\' && p2[1])
-				{
-					p2++;
-				}
-				*p3 = *p2;
-			}
-			*p3 = '\0';
-			
-			nargs++;
-			if (**p == ',')
-				(*p)++;
-		}
-	}
-	
-	{
-		int i;
-		for (i = 0; i < nargs; i++)
-		{
-			debug_message(10, "Macro (%s) arg %d: %s", m -> name, i + 1, args[i]);
-		}
-	}
-	
-	// step 2: iterate over the lines
-	if (as -> passnum == 2)
-	{
-		// pass 2 only - parse the lines and count them
-		for (lc = 0; lc < m -> numlines; lc++)
-		{
-			cl = cl -> next;
-			as -> skiplines++;
-			lwasm_parse_line(as, cl);
-		}
-	}
-	else
-	{
-		// pass 1 only - construct the lines and parse them
-		for (lc = 0; lc < m -> numlines; lc++)
-		{
-			nl = lwasm_alloc(sizeof(lwasm_line_t));
-			nl -> lineno = lc + 1;
-			nl -> filename = m -> name;
-			nl -> next = NULL;
-			nl -> prev = as -> linestail;
-			nl -> err = NULL;
-			nl -> fsize = 0;
-			nl -> sym = NULL;
-			nl -> bytes = NULL;
-			nl -> codelen = 0;
-			nl -> codesize = 0;
-			nl -> nocodelen = 0;
-			nl -> addrset = 0;
-			nl -> symaddr = -1;
-			nl -> badop = 0;
-			nl -> relocoff = -1;
-			if (as -> linestail)
-				as -> linestail -> next = nl;
-			as -> linestail = nl;
-			if (!(as -> lineshead))
-				as -> lineshead = nl;
-
-			bloc = blen = 0;
-			linebuff = NULL;
-			for (p2 = m -> lines[lc]; *p2; p2++)
-			{
-				if (*p2 == '\\' && isdigit(p2[1]))
-				{
-					int n;
-					
-					p2++;
-					n = *p2 - '0';
-					if (n == 0)
-					{
-						for (p3 = m -> name; *p3; p3++)
-							macro_add_to_buff(&linebuff, &bloc, &blen, *p3);
-						continue;
-					}
-					if (n < 1 || n > nargs)
-						continue;
-					for (p3 = args[n - 1]; *p3; p3++)
-						macro_add_to_buff(&linebuff, &bloc, &blen, *p3);
-					continue;
-				}
-				else if (*p2 == '{')
-				{
-					int n = 0, n2;
-					p2++;
-					while (*p2 && isdigit(*p2))
-					{
-						n2 = *p2 - '0';
-						if (n2 < 0 || n2 > 9)
-							n2 = 0;
-						n = n * 10 + n2;
-						p2++;
-					}
-					if (*p2 == '}')
-						p2++;
-					 
-					if (n == 0)
-					{
-						for (p3 = m -> name; *p3; p3++)
-							macro_add_to_buff(&linebuff, &bloc, &blen, *p3);
-						continue;
-					}
-					if (n < 1 || n > nargs)
-						continue;
-					for (p3 = args[n - 1]; *p3; p3++)
-						macro_add_to_buff(&linebuff, &bloc, &blen, *p3);
-					continue;
-				}
-				else
-				{
-					macro_add_to_buff(&linebuff, &bloc, &blen, *p2);
-				}
-			}
-
-			macro_add_to_buff(&linebuff, &bloc, &blen, 0);
-			
-			nl -> text = linebuff;
-
-			lwasm_parse_line(as, nl);
-			if (as -> endseen)
-				break;
-
-		}
-	}
-	
-	// restore context from before the macro was called
-	as -> context = oldcontext;
-
-	// clean up
-	if (args)
-	{
-		while (nargs)
-		{
-			lwasm_free(args[--nargs]);
-		}
-		lwasm_free(args);
-	}
-
-	// indicate a macro was expanded
-	return 0;	
-}
--- a/old-trunk/lwasm/old/main.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
-main.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <argp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "lwasm.h"
-
-// external declarations
-extern void lwasm_pass1(asmstate_t *as);
-extern void lwasm_pass2(asmstate_t *as);
-extern void lwasm_list(asmstate_t *as);
-extern void lwasm_output(asmstate_t *as);
-extern void pseudo_pragma_real(asmstate_t *as, lwasm_line_t *cl, char **optr, int error);
-
-// command line option handling
-const char *argp_program_version = "LWASM from " PACKAGE_STRING;
-const char *argp_program_bug_address = PACKAGE_BUGREPORT;
-
-static error_t parse_opts(int key, char *arg, struct argp_state *state)
-{
-	asmstate_t *as = state -> input;
-	char *p;
-	
-	switch (key)
-	{
-	case 'o':
-		// output
-		if (as -> outfile)
-		{
-		}
-		as -> outfile = arg;
-		break;
-	
-	case 'd':
-		// debug
-		debug_level++;
-		break;
-	
-	case 'l':
-		// list
-		if (arg)
-			as -> listfile = arg;
-		else
-			as -> listfile = "-";
-		break;
-	
-	case 'b':
-		// decb output
-		as -> outformat = OUTPUT_DECB;
-		break;
-	
-	case 'r':
-		// raw binary output
-		as -> outformat = OUTPUT_RAW;
-		break;
-	
-	case 0x100:
-		// proprietary object format
-		as -> outformat = OUTPUT_OBJ;
-		break;
-		
-	case 'f':
-		// output format
-		if (!strcasecmp(arg, "decb"))
-			as -> outformat = OUTPUT_DECB;
-		else if (!strcasecmp(arg, "raw"))
-			as -> outformat = OUTPUT_RAW;
-		else if (!strcasecmp(arg, "obj"))
-			as -> outformat = OUTPUT_OBJ;
-		else if (!strcasecmp(arg, "os9"))
-		{
-			as -> pragmas |= PRAGMA_DOLLARNOTLOCAL;
-			as -> outformat = OUTPUT_OS9;
-		}
-		else
-		{
-			fprintf(stderr, "Invalid output format: %s\n", arg);
-			exit(1);
-		}
-		break;
-	
-	case 'p':
-		// pragmas
-		p = arg;
-		pseudo_pragma_real(as, NULL, &p, 2);
-		if (!p)
-		{
-			fprintf(stderr, "Invalid pragma string: %s\n", arg);
-			exit(1);
-		}
-		break;
-
-	case '9':
-		as -> no6309 = 1;
-		break;
-	
-	case '3':
-		as -> no6309 = 0;
-		break;
-
-	case ARGP_KEY_END:
-		// done; sanity check
-		if (!as -> outfile)
-			as -> outfile = "a.out";
-		break;
-	
-	case ARGP_KEY_ARG:
-		// non-option arg
-		if (as -> infile)
-			argp_usage(state);
-		as -> infile = arg;
-		break;
-		
-	default:
-		return ARGP_ERR_UNKNOWN;
-	}
-	return 0;
-}
-
-static struct argp_option options[] =
-{
-	{ "output",		'o',	"FILE",	0,
-				"Output to FILE"},
-	{ "debug",		'd',	0,		0,
-				"Set debug mode"},
-	{ "format",		'f',	"TYPE",	0,
-				"Select output format: decb, raw, obj, os9"},
-	{ "list",		'l',	"FILE",	OPTION_ARG_OPTIONAL,
-				"Generate list [to FILE]"},
-	{ "decb",		'b',	0,		0,
-				"Generate DECB .bin format output, equivalent of --format=decb"},
-	{ "raw",		'r',	0,		0,
-				"Generate raw binary format output, equivalent of --format=raw"},
-	{ "obj",		0x100,		0,		0,
-				"Generate proprietary object file format for later linking, equivalent of --format=obj" },
-	{ "pragma",		'p',	"PRAGMA",	0,
-				"Set an assembler pragma to any value understood by the \"pragma\" pseudo op"},
-	{ "6809",		'9',	0,			0,
-				"Set assembler to 6809 only mode" },
-	{ "6309",		'3',	0,			0,
-				"Set assembler to 6309 mode (default)" },
-	{ 0 }
-};
-
-static struct argp argp =
-{
-	options,
-	parse_opts,
-	"<input file>",
-	"LWASM, a HD6309 and MC6809 cross-assembler"
-};
-
-char *program_name;
-
-// main function; parse command line, set up assembler state, and run the
-// assembler on the first file
-int main(int argc, char **argv)
-{
-
-	program_name = argv[0];
-	
-	// assembler state
-	asmstate_t asmstate = { 0 };
-
-	argp_parse(&argp, argc, argv, 0, 0, &asmstate);
-
-	if (!asmstate.infile)
-	{
-		fprintf(stderr, "No input files specified.\n");
-		exit(1);
-	}	
-
-	// lose the output file if it already exists...
-	unlink(asmstate.outfile);
-
-	/* pass 1 - collect the symbols and assign addresses where possible */
-	/* pass 1 also resolves included files, etc. */
-	/* that means files are read exactly once unless included multiple times */
-	lwasm_pass1(&asmstate);
-	
-	// pass 2: actually generate the code; if any phasing errors appear
-	// at this stage, we have a bug
-	lwasm_pass2(&asmstate);
-
-	// now make a pretty listing
-	lwasm_list(&asmstate);
-
-	// now write the code out to the output file
-	lwasm_output(&asmstate);
-
-	if (asmstate.errorcount > 0)
-		exit(1);
-
-	exit(0);
-}
-
--- a/old-trunk/lwasm/old/os9.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
-os9.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-This file implements the various pseudo operations related to OS9 target
-*/
-#include <config.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "lwasm.h"
-#include "instab.h"
-#include "expr.h"
-#include "util.h"
-
-OPFUNC(pseudo_os9)
-{
-	int r, rval;
-	
-	if (as -> outformat != OUTPUT_OS9)
-	{
-		register_error(as, l, 1, "os9 directive only valid for OS9 target");
-		return;
-	}
-	
-	// fetch immediate value
-	r = lwasm_expr_result2(as, l, p, 0, &rval, 0);
-	if (r != 0)
-		rval = 0;
-	if (r == 1 && as -> passnum == 2)
-		register_error(as, l, 2, "Illegal external or intersegment reference");
-
-	// SWI2; FCB ...
-	lwasm_emit(as, l, 0x10);
-	lwasm_emit(as, l, 0x3f);
-	lwasm_emit(as, l, rval);
-}
-
-OPFUNC(pseudo_mod)
-{
-	int modvals[6];
-	int r, v, i;
-	
-	if (as -> outformat != OUTPUT_OS9)
-	{
-		register_error(as, l, 1, "mod directive only valid for OS9 target");
-		return;
-	}
-	
-	if (as -> inmod)
-	{
-		register_error(as, l, 1, "Already in a module!");
-		return;
-	}
-
-	// parse 6 expressions...
-	for (i = 0; i < 5; i++)
-	{
-		r = lwasm_expr_result2(as, l, p, 0, &v, -1);
-		if (r < 0)
-			return;
-		if (r > 0)
-		{
-			register_error(as, l, 2, "Illegal external or inter-segment reference (only 1 per FDB line)");
-			v = 0;
-		}
-		else
-		{
-			modvals[i] = v;
-		}
-		if (**p != ',')
-		{
-			register_error(as, l, 1, "Bad operand");
-			return;
-		}
-		(*p)++;
-	}
-	r = lwasm_expr_result2(as, l, p, 0, &v, -1);
-	if (r < 0)
-		return;
-	if (r > 0)
-	{
-		register_error(as, l, 2, "Illegal external or inter-segment reference (only 1 per FDB line)");
-		v = 0;
-	}
-	else
-	{
-		modvals[5] = v;
-	}
-
-	l -> inmod = 1;
-	
-	// we have an implicit ORG 0 with "mod"
-	l -> codeaddr = 0;
-	l -> addrset = 1;
-	as -> addr = 0;
-
-	// init crc
-	as -> crc[0] = 0xff;
-	as -> crc[1] = 0xff;
-	as -> crc[2] = 0xff;
-	as -> inmod = 1;
-
-	// sync bytes
-	lwasm_emit(as, l, 0x87);
-	lwasm_emit(as, l, 0xcd);
-	
-	// mod length
-	lwasm_emit(as, l, modvals[0] >> 8);
-	lwasm_emit(as, l, modvals[0] & 0xff);
-	
-	// name offset
-	lwasm_emit(as, l, modvals[1] >> 8);
-	lwasm_emit(as, l, modvals[1] & 0xff);
-	
-	// type
-	lwasm_emit(as, l, modvals[2]);
-	
-	// flags/rev
-	lwasm_emit(as, l, modvals[3]);
-	
-	// header check
-	lwasm_emit(as, l, ~(0x87 ^ 0xCD ^ (modvals[0] >> 8) ^ (modvals[0] & 0xff)
-		^ (modvals[1] >> 8) ^ (modvals[1] & 0xff)
-		^ modvals[2] ^ modvals[3]));
-
-	// module type specific output
-	// note that these are handled the same for all so
-	// there need not be any special casing
-	
-	// exec offset or fmgr name offset
-	lwasm_emit(as, l, modvals[4] >> 8);
-	lwasm_emit(as, l, modvals[4] & 0xff);
-	
-	// data size or drvr name offset
-	lwasm_emit(as, l, modvals[5] >> 8);
-	lwasm_emit(as, l, modvals[5] & 0xff);
-}
-
-OPFUNC(pseudo_emod)
-{
-	unsigned char tcrc[3];
-	
-	if (as -> outformat != OUTPUT_OS9)
-	{
-		register_error(as, l, 1, "emod directive only valid for OS9 target");
-		return;
-	}
-	
-	if (!(as -> inmod))
-	{
-		register_error(as, l, 1, "not in a module!");
-		return;
-	}
-	
-	// don't mess with CRC!
-	tcrc[0] = as -> crc[0] ^ 0xff;
-	tcrc[1] = as -> crc[1] ^ 0xff;
-	tcrc[2] = as -> crc[2] ^ 0xff;
-	lwasm_emit(as, l, tcrc[0]);
-	lwasm_emit(as, l, tcrc[1]);
-	lwasm_emit(as, l, tcrc[2]);
-	as -> inmod = 0;
-}
--- a/old-trunk/lwasm/old/output.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,458 +0,0 @@
-/*
-output.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Contains the code for actually outputting the assembled code
-*/
-#include <config.h>
-//#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-//#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#define __output_c_seen__
-//#include "instab.h"
-#include "lwasm.h"
-#include "util.h"
-
-void write_code_raw(asmstate_t *as, FILE *of);
-void write_code_decb(asmstate_t *as, FILE *of);
-void write_code_rawrel(asmstate_t *as, FILE *of);
-void write_code_obj(asmstate_t *as, FILE *of);
-void write_code_os9(asmstate_t *as, FILE *of);
-
-// this prevents warnings about not using the return value of fwrite()
-#define writebytes(s, l, c, f)	do { int r; r = fwrite((s), (l), (c), (f)); } while (0)
-
-void lwasm_output(asmstate_t *as)
-{
-	FILE *of;
-	
-	if (as -> errorcount > 0)
-	{
-		fprintf(stderr, "Not doing output due to assembly errors.\n");
-		return;
-	}
-	
-	of = fopen(as -> outfile, "wb");
-	if (!of)
-	{
-		fprintf(stderr, "Cannot open '%s' for output", as -> outfile);
-		perror("");
-		return;
-	}
-
-	switch (as -> outformat)
-	{
-	case OUTPUT_RAW:
-		write_code_raw(as, of);
-		break;
-		
-	case OUTPUT_DECB:
-		write_code_decb(as, of);
-		break;
-		
-	case OUTPUT_RAWREL:
-		write_code_rawrel(as, of);
-		break;
-	
-	case OUTPUT_OBJ:
-		write_code_obj(as, of);
-		break;
-
-	case OUTPUT_OS9:
-		write_code_os9(as, of);
-		break;
-
-	default:
-		fprintf(stderr, "BUG: unrecognized output format when generating output file\n");
-		fclose(of);
-		unlink(as -> outfile);
-		return;
-	}
-
-	fclose(of);
-}
-
-/*
-rawrel output treats an ORG directive as an offset from the start of the
-file. Undefined results will occur if an ORG directive moves the output
-pointer backward. This particular implementation uses "fseek" to handle
-ORG requests and to skip over RMBs.
-
-This simple brain damanged method simply does an fseek before outputting
-each instruction.
-*/
-void write_code_rawrel(asmstate_t *as, FILE *of)
-{
-	lwasm_line_t *cl;
-	
-	for (cl = as -> lineshead; cl; cl = cl -> next)
-	{
-		if (cl -> codelen == 0)
-			continue;
-		
-		fseek(of, cl -> codeaddr, SEEK_SET);
-		writebytes(cl -> bytes, cl -> codelen, 1, of);
-	}
-}
-
-/*
-raw merely writes all the bytes directly to the file as is. ORG is just a
-reference for the assembler to handle absolute references. Multiple ORG
-statements will produce mostly useless results
-*/
-void write_code_raw(asmstate_t *as, FILE *of)
-{
-	lwasm_line_t *cl;
-	
-	for (cl = as -> lineshead; cl; cl = cl -> next)
-	{
-		if (cl -> nocodelen)
-		{
-			int i;
-			for (i = 0; i < cl -> nocodelen; i++)
-				writebytes("\0", 1, 1, of);
-			continue;
-		}
-		writebytes(cl -> bytes, cl -> codelen, 1, of);
-	}
-}
-
-
-/*
-OS9 target also just writes all the bytes in order. No need for anything
-else.
-*/
-void write_code_os9(asmstate_t *as, FILE *of)
-{
-	lwasm_line_t *cl;
-	
-	for (cl = as -> lineshead; cl; cl = cl -> next)
-	{
-		if (cl -> inmod == 0)
-			continue;
-		if (cl -> nocodelen)
-		{
-			int i;
-			for (i = 0; i < cl -> nocodelen; i++)
-				writebytes("\0", 1, 1, of);
-			continue;
-		}
-		writebytes(cl -> bytes, cl -> codelen, 1, of);
-	}
-}
-
-void write_code_decb(asmstate_t *as, FILE *of)
-{
-	long preambloc;
-	lwasm_line_t *cl;
-	int blocklen = -1;
-	int nextcalc = -1;
-	unsigned char outbuf[5];
-	
-	for (cl = as -> lineshead; cl; cl = cl -> next)
-	{
-		if (cl -> nocodelen)
-			continue;
-		if (cl -> codeaddr != nextcalc && cl -> codelen > 0)
-		{
-			// need preamble here
-			if (blocklen > 0)
-			{
-				// update previous preamble if needed
-				fseek(of, preambloc, SEEK_SET);
-				outbuf[0] = (blocklen >> 8) & 0xFF;
-				outbuf[1] = blocklen & 0xFF;
-				writebytes(outbuf, 2, 1, of);
-				fseek(of, 0, SEEK_END);
-			}
-			blocklen = 0;
-			nextcalc = cl -> codeaddr;
-			outbuf[0] = 0x00;
-			outbuf[1] = 0x00;
-			outbuf[2] = 0x00;
-			outbuf[3] = (nextcalc >> 8) & 0xFF;
-			outbuf[4] = nextcalc & 0xFF;
-			preambloc = ftell(of) + 1;
-			writebytes(outbuf, 5, 1, of);
-		}
-		nextcalc += cl -> codelen;
-		writebytes(cl -> bytes, cl -> codelen, 1, of);
-		blocklen += cl -> codelen;
-	}
-	if (blocklen > 0)
-	{
-		fseek(of, preambloc, SEEK_SET);
-		outbuf[0] = (blocklen >> 8) & 0xFF;
-		outbuf[1] = blocklen & 0xFF;
-		writebytes(outbuf, 2, 1, of);
-		fseek(of, 0, SEEK_END);
-	}
-	
-	// now write postamble
-	outbuf[0] = 0xFF;
-	outbuf[1] = 0x00;
-	outbuf[2] = 0x00;
-	outbuf[3] = (as -> execaddr >> 8) & 0xFF;
-	outbuf[4] = (as -> execaddr) & 0xFF;
-	writebytes(outbuf, 5, 1, of);
-}
-
-void write_code_obj_sbadd(sectiontab_t *s, unsigned char b)
-{
-	if (s -> oblen >= s -> obsize)
-	{
-		s -> obytes = lwasm_realloc(s -> obytes, s -> obsize + 128);
-		s -> obsize += 128;
-	}
-	s -> obytes[s -> oblen] = b;
-	s -> oblen += 1;
-}
-
-void write_code_obj(asmstate_t *as, FILE *of)
-{
-	lwasm_line_t *l;
-	sectiontab_t *s;
-	lwasm_symbol_ent_t *se;
-	export_list_t *ex;
-	section_reloc_list_t *re;
-	lwasm_expr_stack_node_t *sn;			
-	
-	int i;
-	unsigned char buf[16];
-
-	// output the magic number and file header
-	// the 8 is NOT an error
-	writebytes("LWOBJ16", 8, 1, of);
-	
-	// run through the entire system and build the byte streams for each
-	// section; at the same time, generate a list of "local" symbols to
-	// output for each section
-	// NOTE: for "local" symbols, we will append \x01 and the ascii string
-	// of the context identifier (so sym in context 1 would be "sym\x011"
-	// we can do this because the linker can handle symbols with any
-	// character other than NUL.
-	// also we will generate a list of incomplete references for each
-	// section along with the actual definition that will be output
-	
-	// once all this information is generated, we will output each section
-	// to the file
-	
-	// NOTE: we build everything in memory then output it because the
-	// assembler accepts multiple instances of the same section but the
-	// linker expects only one instance of each section in the object file
-	// so we need to collect all the various pieces of a section together
-	// (also, the assembler treated multiple instances of the same section
-	// as continuations of previous sections so we would need to collect
-	// them together anyway.
-	
-	for (l = as -> lineshead; l; l = l -> next)
-	{
-		if (l -> sect)
-		{
-			// we're in a section - need to output some bytes
-			for (i = 0; i < l -> codelen; i++)
-				write_code_obj_sbadd(l -> sect, l -> bytes[i]);
-			for (i = 0; i < l -> nocodelen; i++)
-				write_code_obj_sbadd(l -> sect, 0);
-			
-			// do we have a "relocation"? If so, add a reference to the
-			// relocation table
-			if (l -> relocoff >= 0)
-			{
-				// build the relocation reference for the linker
-				re = lwasm_alloc(sizeof(section_reloc_list_t));
-				re -> next = l -> sect -> rl;
-				l -> sect -> rl = re;
-				
-				re -> offset = l -> codeaddr + l -> relocoff;
-				re -> expr = l -> exprs[0];
-				re -> context = l -> context;
-				re -> relocsize = 2;
-				if (l -> reloc8bit)
-					re -> relocsize = 1;
-			}
-		}
-	}
-	
-	// run through the sections
-	for (s = as -> sections; s; s = s -> next)
-	{
-		// write the name
-		writebytes(s -> name, strlen(s -> name) + 1, 1, of);
-		
-		// write the flags
-		if (s -> flags & SECTION_BSS)
-			writebytes("\x01", 1, 1, of);
-		
-		// indicate end of flags - the "" is NOT an error
-		writebytes("", 1, 1, of);
-		
-		
-		// now the local symbols
-		for (se = as -> symhead; se; se = se -> next)
-		{
-			// ignore symbols not in this section
-			if (se -> sect != s)
-				continue;
-			
-			if (se -> flags & SYMBOL_SET)
-				continue;
-			
-			if (se -> flags & SYMBOL_EXTERN)
-				continue;
-			
-			writebytes(se -> sym, strlen(se -> sym), 1, of);
-			if (se -> context >= 0)
-			{
-				writebytes("\x01", 1, 1, of);
-				sprintf(buf, "%d", se -> context);
-				writebytes(buf, strlen(buf), 1, of);
-			}
-			// the "" is NOT an error
-			writebytes("", 1, 1, of);
-			
-			// write the address
-			buf[0] = (se -> value >> 8) & 0xff;
-			buf[1] = se -> value & 0xff;
-			writebytes(buf, 2, 1, of);
-		}	
-		// flag end of local symbol table - "" is NOT an error
-		writebytes("", 1, 1, of);
-		
-		// now the exports
-		for (ex = s -> exports; ex; ex = ex -> next)
-		{
-			writebytes(ex -> sym, strlen(ex -> sym) + 1, 1, of);
-			buf[0] = (ex -> offset >> 8) & 0xff;
-			buf[1] = ex -> offset & 0xff;
-			writebytes(buf, 2, 1, of);
-		}
-		
-		// flag end of exported symbols - "" is NOT an error
-		writebytes("", 1, 1, of);
-		
-		// now output the "incomplete references"
-		// this being the most complex bit
-		for (re = s -> rl; re; re = re -> next)
-		{
-			if (re -> expr == NULL)
-			{
-				// this is an error but we'll simply ignore it
-				// and not output this expression
-				continue;
-			}
-			
-			// work through each term in the expression and output
-			// the proper equivalent to the object file
-			if (re -> relocsize == 1)
-			{
-				// flag an 8 bit relocation (low 8 bits will be used)
-				buf[0] = 0xFF;
-				buf[1] = 0x01;
-				writebytes(buf, 2, 1, of);
-			}
-			for (sn = re -> expr -> head; sn; sn = sn -> next)
-			{
-				switch (sn -> term -> term_type)
-				{
-				case LWASM_TERM_OPER:
-					buf[0] =  0x04;
-					buf[1] = sn -> term -> value;
-					writebytes(buf, 2, 1, of);
-					break;
-					
-				case LWASM_TERM_INT:
-					buf[0] = 0x01;
-					buf[1] = (sn -> term -> value >> 8) & 0xff;
-					buf[2] = sn -> term -> value & 0xff;
-					writebytes(buf, 3, 1, of);
-					break;
-				
-				case LWASM_TERM_SECBASE:
-					writebytes("\x05", 1, 1, of);
-					break;
-
-				case LWASM_TERM_SYM:
-					// now for the ugly part - resolve a symbol reference
-					// and determine whether it's internal, external, or
-					// a section base
-					se = lwasm_find_symbol(as, sn -> term -> symbol, re -> context);
-					if (!se)
-						se = lwasm_find_symbol(as, sn -> term -> symbol, -1);
-					if (!se || se -> flags & SYMBOL_EXTERN)
-					{
-						// not found - assume external reference
-						// found but flagged external - handle it
-						writebytes("\x02", 1, 1, of);
-						writebytes(se -> sym, strlen(se -> sym) + 1, 1, of);
-						break;
-					}
-					// a local symbol reference here
-					writebytes("\x03", 1, 1, of);
-					writebytes(se -> sym, strlen(se -> sym), 1, of);
-					if (se -> context >= 0)
-					{
-						writebytes("\x01", 1, 1, of);
-						sprintf(buf, "%d", se -> context);
-						writebytes(buf, strlen(buf), 1, of);
-					}
-					writebytes("", 1, 1, of);
-					break;
-
-				default:
-					// unrecognized term type - replace with integer 0
-					buf[0] = 0x01;
-					buf[1] = 0x00;
-					buf[2] = 0x00;
-					writebytes(buf, 3, 1, of);
-					break;
-				}
-			}
-			
-			// flag end of expressions
-			writebytes("", 1, 1, of);
-			
-			// write the offset
-			buf[0] = (re -> offset >> 8) & 0xff;
-			buf[1] = re -> offset & 0xff;
-			writebytes(buf, 2, 1, of);
-		}
-		// flag end of incomplete references list
-		writebytes("", 1, 1, of);
-		
-		// now blast out the code
-		
-		// length
-		buf[0] = s -> oblen >> 8 & 0xff;
-		buf[1] = s -> oblen & 0xff;
-		writebytes(buf, 2, 1, of);
-		
-		if (!(s -> flags & SECTION_BSS))
-		{
-			writebytes(s -> obytes, s -> oblen, 1, of);
-		}
-	}
-	
-	// flag no more sections
-	// the "" is NOT an error
-	writebytes("", 1, 1, of);
-}
--- a/old-trunk/lwasm/old/parse.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
-parse.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Contains the general parser
-*/
-
-#define __parse_c_seen__
-#include <config.h>
-
-#include <ctype.h>
-#include <string.h>
-
-#include "lwasm.h"
-#include "instab.h"
-#include "util.h"
-
-// parse a line and despatch to the appropriate handlers for opcodes
-int lwasm_parse_line(asmstate_t *as, lwasm_line_t *l)
-{
-	char *p, *p2;
-	char *opc;
-	int opnum;
-	char *sym = NULL;
-
-	// if this was a bad op first pass (or otherwise a no-process line)
-	// ignore it
-	if (l -> badop)
-		return;
-	
-	p = l -> text;
-	l -> sect = as -> csect;
-	l -> inmod = as -> inmod;
-
-	// blank lines are a no brainer
-	if (!*p)
-	{
-		as -> context = lwasm_next_context(as);
-		return 0;
-	}
-	
-	// for output generation later but only on pass 1
-	// also used by some pseudo ops on pass 2
-	if (as -> passnum == 1)
-		l -> codeaddr = as -> addr;
-	
-	// if it's a comment, return (this doesn't cause a context change)
-	if (*p == '*' || *p == ';')
-		return;
-	
-	// if we have C pre-processor directives/output, ignore it
-	if (*p == '#')
-		return;
-	
-	// if we start with a non-space character, it's a symbol
-	if (!isspace(*p))
-	{
-		// we have a symbol specified here
-		// parse it out and record it for later use
-		for (p2 = p; *p2 && !isspace(*p2) && *p2 != ':'; p2++)
-			/* do nothing */ ;
-		
-		sym = lwasm_alloc((p2 - p) + 1);
-		sym[p2 - p] = '\0';
-		memcpy(sym, p, p2 - p);
-		
-		p = p2;
-		if (!*sym)
-		{
-			register_error(as, l, 1, "Invalid symbol");
-			lwasm_free(sym);
-			sym = NULL;
-		}
-		if (*p == ':')
-			p++;
-	}
-	l -> sym = sym;
-
-	// now skip any whitespace to find the opcode
-	while (*p && isspace(*p))
-		p++;
-	
-	// is the line blank?
-	if (!*p && !sym)
-	{
-		// nothing but white space *is* a context break
-		as -> context = lwasm_next_context(as);
-		return;
-	}
-	
-	// parse the opcode
-	for (p2 = p; *p2 && !isspace(*p2); p2++)
-		/* do nothing */ ;
-	
-	opc = lwasm_alloc((p2 - p) + 1);
-	memcpy(opc, p, p2 - p);
-	opc[p2 - p] = '\0';
-
-	l -> forceglobal = 0;
-	// if the opcode contains an =, treat it as "symbol = expr"
-	if (!sym && strchr(opc, '='))
-	{
-		for (p2 = opc; *p2 && *p2 != '='; p2++)
-			/* do nothing */ ;
-		sym = lwasm_alloc((p2 - opc) + 1);
-		memcpy(sym, opc, p2 - opc);
-		sym[p2 - opc] = '\0';
-		l -> sym = sym;
-		
-		p2 = p + (p2 - opc) + 1;
-//		p2++;
-		opc[0] = '=';
-		opc[1] = '\0';
-		debug_message(2, "Found opcode = with symbol %s and operand %s", sym, p2);
-		l -> forceglobal = 1;
-	}
-	
-	debug_message(2, "Found operation code: '%s'", opc);
-
-	// skip intervening whitespace if present
-	while (*p2 && isspace(*p2))
-		p2++;
-
-	// look up instruction in insn table
-	for (opnum = 0; instab[opnum].opcode; opnum++)
-	{
-		if (!strcasecmp(instab[opnum].opcode, opc))
-			break;
-	}
-	
-	// if we found no operation, check if we had a comment
-	// the reason this check is here is to allow for "private"
-	// operation codes like "*pragma" which will be ignored by
-	// other assemblers
-	// also skip empty ops
-	if (!(instab[opnum].opcode))
-	{
-		if (*opc == '*' || *opc == ';' || !*opc)
-			goto done_line;
-	}
-
-	// now we have the opcode and the symbol, we can decide if we're
-	// actually going to do anything with this line
-	
-	// we will NOT call the function if any of the following are true:
-	
-	// - we are skipping a condition and the operation code is not a conditional
-	// - we are defining a macro and the operation code is not ENDM
-
-	// we will call the function in any other circumstance
-	
-	// first condition above
-	if (as -> inmacro && instab[opnum].endm == 0)
-	{
-		add_macro_line(as, l -> text);
-		goto done_line;
-	}
-
-	// second condition above	
-	if (as -> skipcond && instab[opnum].iscond == 0)
-		goto done_line;
-
-	// we've registered the symbol as needed
-	// now we need to check for a macro call IFF we don't collide with
-	// an operation code; otherwise, call the operation function
-	if (instab[opnum].opcode)
-	{
-		if (instab[opnum].fn && !(as -> no6309 && instab[opnum].is6309))
-		{
-			(instab[opnum].fn)(as, l, &p2, opnum);
-			
-			// if we didn't end on a "space" character or EOL, throw error
-			if (*p2 && !isspace(*p2) && !(l -> err) && as -> passnum == 1)
-				register_error(as, l, 1, "Bad operand: %s (%d)", p2, as -> passnum);
-		}
-		else
-		{
-			// carp about unimplemented operation
-			if (instab[opnum].is6309)
-				register_error(as, l, 1, "Use of 6309 operation code: %s", opc);
-			else
-				register_error(as, l, 1, "Unimplemented operation code: %s", opc);
-		}
-	}
-	else
-	{
-		if (expand_macro(as, l, &p2, opc) == 0)
-			goto done_line;
-
-		// carp about an unknown operation code and note that fact for
-		// pass 2 in case a macro appears later with the same name!
-		register_error(as, l, 1, "Uknown operation code: %s", opc);
-		l -> badop = 1;
-	}
-
-done_line:
-	if (!(as -> skipcond || as -> inmacro))
-	{
-		// register symbol if the operation didn't
-		if (sym && instab[opnum].setsym == 0)
-		{
-			if (as -> passnum == 1)
-			{
-				debug_message(1, "Registering symbol '%s' at %04X", sym, l -> codeaddr);
-				if (lwasm_register_symbol(as, l, sym, l -> codeaddr, SYMBOL_NORM) < 0)
-					l -> sym = NULL;
-				else
-					l -> addrset = 1;
-			}
-		}
-	}
-
-	l -> sect = as -> csect;
-	l -> context = as -> context;
-	
-	lwasm_free(opc);
-	if (sym)
-		lwasm_free(sym);
-}
--- a/old-trunk/lwasm/old/pass1.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
-pass1.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Handles first pass of assembly
-
-First pass involves the following:
-
-1. read all lines from the main source file, following all "include"
-   directives as appropriate
-2. each operand is evaluated for syntax and futher for value if there are
-   multiple addressing sizes available; any undefined or not fully resolved
-   value will default to the largest addressing size available (16 bit)
-3. addresses are assigned to every symbol defined in the assembly
-4. macros are defined and expanded at this pass
-
-* note: the lines are re-evaluated on the second pass
-
-All source lines are read into memory with a record of the file name and
-line number within the files.
-
-Lines are one of the following formats:
-
-<symbol> <opcode> <operand> <comment>
-<symbol> <opcode> <comment>
- <opcode> <operand> <comment>
- <opcode> <comment>
-
-A "*" or ";" appearing anywhere on the line that is not otherwise interpreted
-as part of an operation code or operand introduces a comment.
-
-Certain lwasm specific operations are prefixed with a "*" to aid in source
-code portability (like *pragma).
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lwasm.h"
-#include "util.h"
-
-
-extern int lwasm_parse_line(asmstate_t *as, lwasm_line_t *l);
-
-// we can't use standard line inputting functions here because we have to
-// handle non-standard line terminations (CR, LF, CRLF, or LFCR)
-int lwasm_read_file(asmstate_t *as, const char *filename)
-{
-	FILE *f;
-	int c, c2;
-	lwasm_line_t *nl;
-	int lineno = 1;
-	char *fnref;
-	
-	// ought to be long enough...we truncate longer lines
-	char linebuff[2049];
-	int lbloc = 0;
-	int eol = 0;
-
-	// add filename to list
-	as -> filelist = lwasm_realloc(as -> filelist, sizeof(char *) * (as -> filelistlen + 1));
-	fnref = as -> filelist[as -> filelistlen] = lwasm_strdup(filename);
-	as -> filelistlen += 1;
-	
-	f = fopen(filename, "rb");
-	if (!f)
-		return -1;
-
-	for (;;)
-	{
-		c = fgetc(f);
-		if (c == EOF)
-		{
-			linebuff[lbloc] = '\0';
-			eol = 1;
-		}
-		else if (c == '\r')
-		{
-			linebuff[lbloc] = '\0';
-			eol = 1;
-			// check for '\n':
-			c2 = fgetc(f);
-			if (c2 == EOF)
-				c = EOF;
-			else if (c2 != '\n')
-				ungetc(c2, f);
-		}
-		else if (c == '\n')
-		{
-			linebuff[lbloc] = '\0';
-			eol = 1;
-			// check for '\r':
-			c2 = fgetc(f);
-			if (c2 == EOF)
-				c = EOF;
-			else if (c2 != '\r')
-				ungetc(c2, f);
-		}
-		else
-		{
-			// silently ignore characters past 2K on a line... FIXME
-			if (lbloc < 2048)
-				linebuff[lbloc++] = c;
-		}
-		if (eol)
-		{
-			eol = 0;
-			lbloc = 0;
-			nl = lwasm_alloc(sizeof(lwasm_line_t));
-			nl -> text = lwasm_strdup(linebuff);
-			nl -> lineno = lineno++;
-			nl -> filename = fnref;
-			nl -> next = NULL;
-			nl -> prev = as -> linestail;
-			nl -> err = NULL;
-			nl -> fsize = 0;
-			nl -> sym = NULL;
-			nl -> bytes = NULL;
-			nl -> codelen = 0;
-			nl -> codesize = 0;
-			nl -> nocodelen = 0;
-			nl -> addrset = 0;
-			nl -> symaddr = -1;
-			nl -> badop = 0;
-			nl -> relocoff = -1;
-			if (as -> linestail)
-				as -> linestail -> next = nl;
-			as -> linestail = nl;
-			if (!(as -> lineshead))
-				as -> lineshead = nl;
-			lwasm_parse_line(as, nl);
-			if (as -> endseen)
-				break;
-		}
-		if (c == EOF)
-			break;
-	}
-	
-	fclose(f);
-	return 0;
-}
-
-void lwasm_pass1(asmstate_t *as)
-{
-	as -> passnum = 1;
-	as -> addr = 0;
-	as -> nextcontext = 1;
-
-	as -> inmod = 0;
-	
-	debug_message(1, "Entering pass 1");
-	if (lwasm_read_file(as, as -> infile) < 0)
-	{
-		fprintf(stderr, "Error reading input file '%s'", as -> infile);
-		perror("");
-		exit(1);
-	}
-	
-}
--- a/old-trunk/lwasm/old/pass2.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-pass2.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Handles second pass of assembly
-
-*/
-
-#include <config.h>
-
-#include "lwasm.h"
-
-void lwasm_pass2(asmstate_t *as)
-{
-	lwasm_line_t *l;
-	sectiontab_t *st;
-	
-	debug_message(1, "Entering pass 2");
-	as -> passnum = 2;
-	as -> addr = 0;
-	as -> context = 0;
-	as -> endseen = 0;
-	as -> skipcond = 0;
-	as -> skipcount = 0;
-	as -> skipmacro = 0;
-	as -> inmacro = 0;
-	as -> nextcontext = 1;
-	as -> skiplines = 0;
-	as -> dpval = 0;
-	as -> inmod = 0;
-	
-	for (st = as -> sections; st; st = st -> next)
-		st -> offset = 0;
-	as -> csect = NULL;
-	
-	// iterate over all the lines and re-parse them
-	for (l = as -> lineshead; l && !(as -> endseen); l = l -> next)
-	{
-		if (as -> skiplines)
-			as -> skiplines--;
-		else
-			lwasm_parse_line(as, l);
-	}
-}
--- a/old-trunk/lwasm/old/pragma.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
-pragma.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-This file contains stuff associated with lwasm specific strangeness
-*/
-#include <config.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include "lwasm.h"
-#include "instab.h"
-
-/*
-A pragma is a means of controlling code generation.
-
-The pseudo op "*pragma" which will be treated as a comment by an assembler
-that doesn't recognize it and thus will not cause assembly errors. This is
-the preferred way of flagging a pragma if it will not cause incorrect
-execution of the program.
-
-The pseudo op "pragma" which will cause an error on an assembler that does
-not understand it.
-
-In the case of "*pragma", unrecognized pragmas MUST be silently ignored. In
-the case of "pragma", unrecognized pragmas should raise an error.
-
-LWASM understands the following pragmas:
-
-index0tonone
-noindex0tonone
-
-When set (index0tonone), an expression that evaluates to 0, other than a
-bare constant, in a <offset>,r operand will cause the code for ",r" to be
-emitted rather than "0,r". If not set (noindex0tonone), the "0,r" output
-will be emitted. The default is to perform the optimization.
-
-This particular optimization will save a cycle for a direct operation. For
-an indirect operation, however, it will save several cycles and a program byte
-which may be very useful.
-*/
-
-void pseudo_pragma_real(asmstate_t *as, lwasm_line_t *cl, char **optr, int error)
-{
-	char pragma[128];
-	int c = 0;
-	
-	while (**optr && isspace(**optr))
-		(*optr)++;
-
-pragmaagain:
-	c = 0;	
-	while (c < 127 && **optr && **optr != ',' && !isspace(**optr))
-	{
-		pragma[c++] = **optr;
-		(*optr)++;
-	}
-	
-	if (c == 0 || (**optr && **optr != ',' && !isspace(**optr)))
-	{
-		if (error)
-		{
-			register_error(as, cl, 1, "Unrecognized pragma");
-		}
-		if (error == 2)
-		{
-			*optr = NULL;
-		}
-		return;
-	}
-	pragma[c] = 0;
-	if (!strcasecmp(pragma, "noindex0tonone"))
-	{
-		as -> pragmas |= PRAGMA_NOINDEX0TONONE;
-	}
-	else if (!strcasecmp(pragma, "index0tonone"))
-	{
-		as -> pragmas &= ~PRAGMA_NOINDEX0TONONE;
-	}
-	else if (!strcasecmp(pragma, "undefextern"))
-	{
-		as -> pragmas |= PRAGMA_UNDEFEXTERN;
-	}
-	else if (!strcasecmp(pragma, "noundefextern"))
-	{
-		as -> pragmas &= ~PRAGMA_UNDEFEXTERN;
-	}
-	else if (!strcasecmp(pragma, "cescapes"))
-	{
-		as -> pragmas |= PRAGMA_CESCAPES;
-	}
-	else if (!strcasecmp(pragma, "nocescapes"))
-	{
-		as -> pragmas &= ~PRAGMA_CESCAPES;
-	}
-	else if (!strcasecmp(pragma, "importundefexport"))
-	{
-		as -> pragmas |= PRAGMA_IMPORTUNDEFEXPORT;
-	}
-	else if (!strcasecmp(pragma, "noimportundefexport"))
-	{
-		as -> pragmas &= ~PRAGMA_IMPORTUNDEFEXPORT;
-	}
-	else if (!strcasecmp(pragma, "dollarnotlocal") || !strcasecmp(pragma, "nodollarlocal"))
-	{
-		as -> pragmas |= PRAGMA_DOLLARNOTLOCAL;
-	}
-	else if (!strcasecmp(pragma, "dollarlocal") || !strcasecmp(pragma, "nodollarnotlocal"))
-	{
-		as -> pragmas &= ~PRAGMA_DOLLARNOTLOCAL;
-	}
-	else
-	{
-		if (error)
-		{
-			register_error(as, cl, 1, "Unrecognized pragma");
-			if (error == 2)
-			{
-				*optr = NULL;
-			}
-		}
-	}
-	if (*optr && **optr == ',')
-	{
-		(*optr)++;
-		goto pragmaagain;
-	}
-}
-
-OPFUNC(pseudo_pragma)
-{
-	pseudo_pragma_real(as, l, p, 1);
-}
-
-OPFUNC(pseudo_starpragma)
-{
-	pseudo_pragma_real(as, l, p, 0);
-}
--- a/old-trunk/lwasm/old/pseudo.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1336 +0,0 @@
-/*
-pseudo.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-This file implements the various pseudo operations.
-*/
-#include <config.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "lwasm.h"
-#include "instab.h"
-#include "expr.h"
-#include "util.h"
-
-extern int lwasm_read_file(asmstate_t *as, const char *filename);
-
-OPFUNC(pseudo_noop)
-{
-	skip_operand(p);
-}
-
-OPFUNC(pseudo_org)
-{
-	int v, r;
-
-	if (as -> csect)
-	{
-		register_error(as, l, 1, "ORG not allowed within sections");
-		return;
-	}
-	if (as -> inmod)
-	{
-		register_error(as, l, 1, "ORG not allowed within modules");
-		return;
-	}
-
-	if (as -> passnum != 1)
-	{
-		// org is not needed to be processed on pass 2
-		// this will prevent phasing errors for forward references that
-		// resolve on the second pass
-		// we saved the org address in l -> codeaddr on pass 1
-		as -> addr = l -> codeaddr;
-		skip_operand(p);
-		return;
-	}
-	
-	if (l -> sym)
-	{
-		register_error(as, l, 1, "No symbol allowed with ORG");
-	}
-	
-	r = lwasm_expr_result2(as, l, p, EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-	l -> codeaddr = v;
-	l -> addrset = 1;
-	as -> addr = v;
-}
-
-/*
-The operand for include is a string optionally enclosed in "
-*/
-OPFUNC(pseudo_include)
-{
-	int v1;
-	char *fn;
-	
-	// only include files on pass 1
-	// but make sure local include context is right
-	// for the next line...
-	if (as -> passnum != 1)
-	{
-		as -> context = lwasm_next_context(as);
-		skip_operand(p);
-		return;
-	}
-
-	while (**p && isspace(**p))
-		(*p)++;
-
-	if (!**p)
-	{
-		register_error(as, l, 1, "Bad file name");
-		return;
-	}
-
-	if (**p == '"')
-	{
-		// search for ending "
-		(*p)++;
-		for (v1 = 0; *((*p)+v1) && *((*p)+v1) != '"'; v1++)
-			/* do nothing */ ;
-		if (*((*p)+v1) != '"')
-		{
-			register_error(as, l, 1, "Bad file name");
-			return;
-		}
-	}
-	else
-	{
-		// search for a space type character
-		for (v1 = 0; *((*p)+v1) && !isspace(*((*p)+v1)); v1++)
-			;
-	}
-
-	fn = lwasm_alloc(v1 + 1);
-	memcpy(fn, *p, v1);
-	fn[v1] = '\0';
-
-	(*p) += v1;
-	if (**p == '"')
-		(*p)++;
-
-	// end local label context on include	
-	as -> context = lwasm_next_context(as);
-	if (lwasm_read_file(as, fn) < 0)
-	{
-		register_error(as, l, 1, "File include error (%s)", fn);
-	}
-	lwasm_free(fn);
-}
-
-/*
-The operand for includebin is a string optionally enclosed in "
-*/
-OPFUNC(pseudo_includebin)
-{
-	int v1;
-	char *fn;
-	FILE *f;
-	
-	// only include files on pass 1
-	while (**p && isspace(**p))
-		(*p)++;
-
-	if (!**p)
-	{
-		register_error(as, l, 1, "Bad file name");
-		return;
-	}
-
-	if (**p == '"')
-	{
-		// search for ending "
-		(*p)++;
-		for (v1 = 0; *((*p)+v1) && *((*p)+v1) != '"'; v1++)
-			/* do nothing */ ;
-		if (*((*p)+v1) != '"')
-		{
-			register_error(as, l, 1, "Bad file name");
-			return;
-		}
-	}
-	else
-	{
-		// search for a space type character
-		for (v1 = 0; *((*p)+v1) && !isspace(*((*p)+v1)); v1++)
-			;
-	}
-
-	fn = lwasm_alloc(v1 + 1);
-	memcpy(fn, *p, v1);
-	fn[v1] = '\0';
-
-	(*p) += v1;
-	if (**p == '"')
-		(*p)++;
-
-	// open the file
-	f = fopen(fn, "rb");
-	if (!f)
-	{
-		register_error(as, l, 1, "Cannot open file: %s", strerror(errno));
-		register_error(as, l, 2, "Cannot open file: %s", strerror(errno));
-	}
-	
-	// don't need fn any more
-	lwasm_free(fn);
-	
-	// read the contents of the file and "emit()" it
-	while (!feof(f) && !ferror(f))
-	{
-		v1 = fgetc(f);
-		if (v1 == EOF)
-			break;
-		lwasm_emit(as, l, v1);
-	}
-	// close file
-	fclose(f);
-}
-
-OPFUNC(pseudo_rmb)
-{
-	int r, v;
-	
-	if (as -> passnum == 2)
-	{
-		as -> addr += l -> nocodelen;
-		skip_operand(p);
-		return;
-	}
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, -1);
-	if (r != 0)
-		return;
-	l -> nocodelen = v;
-	as -> addr += v;
-}
-
-OPFUNC(pseudo_rmd)
-{
-	int r, v;
-	
-	if (as -> passnum == 2)
-	{
-		as -> addr += l -> nocodelen;
-		skip_operand(p);
-		return;
-	}
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-	v *= 2;
-	l -> nocodelen = v;
-	as -> addr += v;
-}
-
-OPFUNC(pseudo_rmq)
-{
-	int r, v;
-	
-	if (as -> passnum == 2)
-	{
-		as -> addr += l -> nocodelen;
-		skip_operand(p);
-		return;
-	}
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-	v *= 4;
-	l -> nocodelen = v;
-	as -> addr += v;
-}
-
-OPFUNC(pseudo_zmb)
-{
-	int r, v;
-	
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-	while (v--)
-		lwasm_emit(as, l, 0);
-}
-
-OPFUNC(pseudo_zmd)
-{
-	int r, v;
-	
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-	v *= 2;
-	while (v--)
-		lwasm_emit(as, l, 0);
-}
-
-OPFUNC(pseudo_zmq)
-{
-	int r, v;
-	
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-	v *= 4;
-	while (v--)
-		lwasm_emit(as, l, 0);
-}
-
-OPFUNC(pseudo_end)
-{
-	int r, v;
-	lwasm_expr_stack_t *s;
-	
-
-	as -> endseen = 1;
-	
-	// address only matters for DECB output
-	if (as -> outformat != OUTPUT_DECB)
-	{
-		skip_operand(p);
-		return;
-	}
-	
-	r = lwasm_expr_result2(as, l, p, 0, &v, 0);
-	if (r != 0)
-	{
-		register_error(as, l, 2, "Bad operand");
-	}
-
-	v = v & 0xffff;
-	if (as -> passnum == 2)
-	{
-		as -> execaddr = v;
-		l -> symaddr = v;
-		l -> addrset = 2;
-	}
-}
-
-
-OPFUNC(pseudo_align)
-{
-	int cn;
-	int r, v;
-	int pad = 0;
-// we have to parse this on pass 2 so that we get the pad value	
-//	if (as -> passnum == 2)
-//	{
-//		skip_operand(p);
-//		while (as -> addr < l -> symaddr)
-//			lwasm_emit(as, l, 0);
-//		return;
-//	}
-	
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-	{
-		l -> symaddr = as -> addr;
-		return;
-	}
-
-	if (v < 1)
-	{
-		register_error(as, l, 1, "Illegal alignment %d", v);
-		return;
-	}
-	
-	cn = l -> codeaddr % v;
-	if (cn)
-		cn = v - cn; 
-
-	if (**p == ',')
-	{
-		// we have a padding value specified
-		(*p)++;
-		r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST, &pad, 1);
-		if (r != 0 && as -> passnum == 2)
-		{
-			register_error(as, l, 2, "Illegal padding value - must be constant on pass 2");
-			return;
-		}
-	}
-
-	while (cn--)
-	{
-		lwasm_emit(as, l, pad);
-	}
-	l -> symaddr = as -> addr;
-}
-
-OPFUNC(pseudo_equ)
-{
-	int r, v;
-
-	if (l -> sym == NULL)
-	{
-		register_error(as, l, 1, "No symbol specified");
-		return;
-	}
-
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r < 0)
-		v = 0;
-
-	l -> symaddr = v & 0xFFFF;
-	l -> addrset = 2;
-	
-	// note: we need to do this because the symbol might have resolved
-	// to a constant!
-	lwasm_register_symbol(as, l, l -> sym, v, (r > 0 ? SYMBOL_COMPLEX: SYMBOL_NORM) | SYMBOL_FORCE | (l -> forceglobal ? SYMBOL_GLOBAL : SYMBOL_NORM));
-}
-
-OPFUNC(pseudo_set)
-{
-	int r, v;
-
-	// set MUST run on both passes as the symbol value changes!
-
-	if (l -> sym == NULL)
-	{
-		register_error(as, l, 1, "No symbol specified");
-		return;
-	}
-
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r < 0)
-		v = 0;
-
-	l -> symaddr = v & 0xFFFF;
-	l -> addrset = 2;
-	
-	lwasm_register_symbol(as, l, l -> sym, v, (r > 0 ? SYMBOL_COMPLEX: SYMBOL_NORM) | SYMBOL_SET);
-}
-
-OPFUNC(pseudo_setdp)
-{
-	int r, v;
-
-	if (as -> outformat == OUTPUT_OBJ)
-	{
-		register_error(as, l, 1, "SETDP not permitted with OBJ target");
-		return;
-	}
-	
-	// setdp is needed on both passes; must resolve to a constant on pass 1
-	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
-	if (r != 0)
-		return;
-
-	if (v < -127 || v > 255)
-	{
-		register_error(as, l, 1, "Byte overflow");
-		return;
-	}
-	
-	l -> symaddr = v & 0xFF;
-	l -> addrset = 2;
-	
-	as -> dpval = v & 0xFF;
-}
-
-// used to get a byte from a string
-// -1 is end of line
-int pseudo_fcc_fetchchar(asmstate_t *as, char **p)
-{
-	int c;
-	
-	// -
-	if (!**p)
-		return -1;
-	
-	c = (unsigned char)(**p);
-	(*p)++;
-	
-	if (as -> pragmas & PRAGMA_CESCAPES && c == '\\')
-	{
-		// decode escapes if needed
-		if (!**p)
-			return c;
-		
-		c = **p;
-		(*p)++;
-		
-		switch (c)
-		{
-		// octal value
-		// 1, 2, or 3 digits
-		// NOTE: \0 for NUL is included in this...
-		case '0':
-		case '1':
-		case '2':
-		case '3':
-		case '4':
-		case '5':
-		case '6':
-		case '7':
-			c -= '0';
-			if (**p < '0' || **p > '9')
-				return c;
-			c = c << 3;
-			c |= **p - '0';
-			(*p)++;
-			if (**p < '0' || **p > '9')
-				return c;
-			c = c << 3;
-			c |= **p - '0';
-			(*p)++;
-			return c;
-
-		// LF
-		case 'n':
-			return 10;
-		
-		// CR
-		case 'r':
-			return 13;
-		
-		// TAB
-		case 't':
-			return 9;
-		
-		// VT
-		case 'v':
-			return 11;
-		
-		// BS
-		case 'b':
-			return 8;
-		
-		// FF
-		case 'f':
-			return 12;
-		
-		// BEL
-		case 'a':
-			return 7;
-		
-		// hex char code (2 chars)
-		case 'x':
-		{
-			int c2;
-			if (!**p)
-				return 'x';
-			c = toupper(**p);
-			(*p)++;
-			if (c < '0' || (c > '9' && c < 'A') || c > 'F')
-				return 0;
-			c -= '0';
-			if (c > 9)
-				c -= 7;
-			c2 = c << 4;
-			if (!**p)
-				return 0;
-			c = toupper(**p);
-			(*p)++;
-			if (c < '0' || (c > '9' && c < 'A') || c > 'F')
-				return 0;
-			c -= '0';
-			if (c > 9)
-				c -= 7;
-			c2 |= c;
-			return c2;
-		}
-		// everything else stands for itself as a fall back or legit		
-		default:
-			return c;
-		}
-	}
-	return c;
-}
-
-OPFUNC(pseudo_fcc)
-{
-	int delim = 0;
-	int c;
-				
-	delim = **p;
-	if (!delim)
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	*p += 1;
-	for (;;)
-	{
-		c = pseudo_fcc_fetchchar(as, p);
-		if (c == delim || c < 0)
-			break;
-
-		lwasm_emit(as, l, c);
-	}
-}
-		
-
-OPFUNC(pseudo_fcs)
-{
-	int delim = 0;
-	int c, lc = -1;
-	
-	delim = **p;
-	if (!delim)
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	*p += 1;
-	for (;;)
-	{
-		c = pseudo_fcc_fetchchar(as, p);
-		if (c == delim || c < 0)
-		{
-			if (lc >= 0)
-				lwasm_emit(as, l, lc | 0x80);
-			break;
-		}
-		if (lc >= 0)
-			lwasm_emit(as, l, lc);
-		lc = c;
-	}
-}
-
-OPFUNC(pseudo_fcn)
-{		
-	int delim = 0;
-	int c;
-	
-	delim = **p;
-	if (!delim)
-	{
-		register_error(as, l, 1, "Bad operand");
-		return;
-	}
-	*p += 1;
-	for (;;)
-	{
-		c = pseudo_fcc_fetchchar(as, p);
-		if (c == delim || c < 0)
-			break;
-
-		lwasm_emit(as, l, c);
-	}
-	lwasm_emit(as, l, 0);
-}
-
-OPFUNC(pseudo_fcb)
-{
-	int r, v;
-	
-fcb_again:
-	r = lwasm_expr_result2(as, l, p, 0, &v, -1);
-	if (r < 0)
-		return;
-
-	if (r > 0)
-	{
-		register_error(as, l, 2, "Illegal external or inter-segment reference");
-		v = 0;
-	}
-
-	if (v < -127 || v > 255)
-	{
-		register_error(as, l, 1, "Byte overflow");
-	}
-	
-	lwasm_emit(as, l, v);
-	if (**p == ',')
-	{
-		(*p)++;
-		goto fcb_again;
-	}
-}
-
-// FIXME: handle external references in an intelligent way
-OPFUNC(pseudo_fdb)
-{			
-	int r, v;
-	int extseen = 0;
-	char *p1;
-	
-fdb_again:
-	p1 = *p;
-	r = lwasm_expr_result2(as, l, p, 0, &v, -1);
-	if (r < 0)
-		return;
-
-	if (r > 0 && extseen == 1)
-	{
-		register_error(as, l, 2, "Illegal external or inter-segment reference (only 1 per FDB line)");
-		v = 0;
-	}
-	else if (r > 0)
-	{
-		l -> relocoff = as -> addr - l -> codeaddr;
-		*p = p1;
-		r = lwasm_expr_result2(as, l, p, 0, &v, 0);
-	}
-
-	lwasm_emit(as, l, v >> 8);
-	lwasm_emit(as, l, v & 0xff);
-	if (**p == ',')
-	{
-		(*p)++;
-		goto fdb_again;
-	}
-}
-
-// FIXME: handle external references in a sensible way
-OPFUNC(pseudo_fqb)
-{	
-	int r, v;
-	
-fqb_again:
-	r = lwasm_expr_result2(as, l, p, 0, &v, -1);
-	if (r < 0)
-		return;
-
-	if (r > 0)
-	{
-		register_error(as, l, 2, "Illegal external or inter-segment reference");
-		v = 0;
-	}
-
-	lwasm_emit(as, l, v >> 24);
-	lwasm_emit(as, l, v >> 16);
-	lwasm_emit(as, l, v >> 8);
-	lwasm_emit(as, l, v & 0xff);
-	if (**p == ',')
-	{
-		(*p)++;
-		goto fqb_again;
-	}
-}
-
-// don't need to do anything if we are executing one of these
-OPFUNC(pseudo_endc)
-{
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount -= 1;
-		if (as -> skipcount <= 0)
-		{
-			as -> skipcond = 0;
-		}
-	}
-	return;
-}
-
-// if "else" executes, we must be going into an "ignore" state
-OPFUNC(pseudo_else)
-{
-	if (as -> skipmacro)
-		return;
-	
-	if (as -> skipcond)
-	{
-		if (as -> skipcount == 1)
-		{
-			as -> skipcount = 0;
-			as -> skipcond = 0;
-		}
-		return;
-	}
-	
-	as -> skipcond = 1;
-	as -> skipcount = 1;
-}
-
-OPFUNC(pseudo_ifne)
-{
-	int v1;
-	int rval;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	rval = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v1, 0);
-	if (rval != 0)
-		return;
-	if (!v1)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-
-OPFUNC(pseudo_ifdef)
-{
-	lwasm_symbol_ent_t *se;
-	char *sym;
-	char *p2;
-	
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	if (as -> passnum != 1)
-	{
-		skip_operand(p);
-		if (!(l -> fsize))
-		{
-			as -> skipcond = 1;
-			as -> skipcount = 1;
-		}
-		return;
-	}
-
-	if (!**p)
-	{
-		register_error(as, l, 1, "Need symbol name");
-		return;
-	}
-	
-	for (p2 = *p; **p && !isspace(**p); (*p)++)
-		/* do nothing */ ;
-	
-	sym = lwasm_alloc(*p - p2 + 1);
-	memcpy(sym, p2, *p - p2);
-	sym[*p - p2] = '\0';
-
-//	fprintf(stderr, "STUFF: %s; '%s'; '%s' (%d)\n", p2, *p, sym, as -> passnum);
-	se = lwasm_find_symbol(as, sym, l -> context);
-	if (!se)
-		se = lwasm_find_symbol(as, sym, -1);
-	
-	lwasm_free(sym);
-	
-	if (!se)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-		l -> fsize = 0;
-	}
-	else
-	{
-		l -> fsize = 1;
-	}
-}
-
-OPFUNC(pseudo_ifndef)
-{
-	lwasm_symbol_ent_t *se;
-	char *sym;
-	char *p2;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	if (as -> passnum != 1)
-	{
-		skip_operand(p);
-		if (l -> fsize)
-		{
-			as -> skipcond = 1;
-			as -> skipcount = 1;
-		}
-		return;
-	}
-
-	if (!**p)
-	{
-		register_error(as, l, 1, "Need symbol name");
-		return;
-	}
-	
-	for (p2 = *p; *p2 && !isspace(*p2); p2++)
-		/* do nothing */ ;
-	
-	sym = lwasm_alloc(p2 - *p + 1);
-	memcpy(sym, *p, p2 - *p);
-	sym[p2 - *p] = '\0';
-	
-	*p = p2;
-
-//	fprintf(stderr, "STUFF2: %s; '%s'; '%s' (%d)\n", *p, p2, sym, as -> passnum);
-	se = lwasm_find_symbol(as, sym, l -> context);
-	if (!se)
-		se = lwasm_find_symbol(as, sym, -1);
-	
-	lwasm_free(sym);
-	
-	if (se)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-		l -> fsize = 0;
-	}
-	else
-	{
-		l -> fsize = 1;
-	}
-}
-
-OPFUNC(pseudo_ifp1)
-{
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	if (as -> passnum != 1)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-	
-OPFUNC(pseudo_ifp2)
-{
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	if (as -> passnum != 2)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-	
-OPFUNC(pseudo_ifeq)
-{
-	int v1;
-	int rval;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	rval = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v1, 0);
-	if (rval != 0)
-		return;
-	if (v1)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-
-OPFUNC(pseudo_iflt)
-{
-	int v1;
-	int rval;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	rval = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v1, 0);
-	if (rval != 0)
-		return;
-	if (v1 >= 0)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-
-OPFUNC(pseudo_ifle)
-{
-	int v1;
-	int rval;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	rval = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v1, 0);
-	if (rval != 0)
-		return;
-	if (v1 > 0)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-
-OPFUNC(pseudo_ifgt)
-{
-	int v1;
-	int rval;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	rval = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v1, 0);
-	if (rval != 0)
-		return;
-	if (v1 <= 0)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-
-OPFUNC(pseudo_ifge)
-{
-	int v1;
-	int rval;
-
-	if (as -> skipcond && !(as -> skipmacro))
-	{
-		as -> skipcount++;
-		skip_operand(p);
-		return;
-	}
-
-	rval = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v1, 0);
-	if (rval != 0)
-		return;
-	if (v1 < 0)
-	{
-		as -> skipcond = 1;
-		as -> skipcount = 1;
-	}
-}
-
-OPFUNC(pseudo_error)
-{
-	register_error(as, l, 1, "User error: %s", *p);
-}
-
-
-OPFUNC(pseudo_section)
-{
-	sectiontab_t *s;
-	char *p2;
-	char *sn;
-	char *opts;
-	
-
-	if (as -> outformat != OUTPUT_OBJ)
-	{
-		register_error(as, l, 1, "Sections only supported for obj target");
-		return;
-	}
-	
-	if (as -> csect)
-	{
-		as -> csect -> offset = as -> addr;
-		as -> csect = NULL;
-	}
-	
-	if (!**p)
-	{
-		register_error(as, l, 1, "Need section name");
-		return;
-	}
-	
-	for (p2 = *p; *p2 && !isspace(*p2); p2++)
-		/* do nothing */ ;
-	
-	sn = lwasm_alloc(p2 - *p + 1);
-	memcpy(sn, *p, p2 - *p);
-	sn[p2 - *p] = '\0';
-	
-	*p = p2;
-	
-	opts = strchr(sn, ',');
-	if (opts)
-	{
-		*opts++ = '\0';
-	}
-	
-	// have we seen the section name already?
-	for (s = as -> sections; s; s = s -> next)
-	{
-		if (!strcmp(s -> name, sn))
-			break;
-	}
-	
-	if (s && as -> passnum == 1)
-	{
-		lwasm_free(sn);
-		if (opts)
-		{
-			register_error(as, l, 1, "Section options can only be specified the first time");
-			return;
-		}
-	}
-	else if (!s)
-	{
-		s = lwasm_alloc(sizeof(sectiontab_t));
-		s -> name = sn;
-		s -> offset = 0;
-		s -> flags = 0;
-		s -> obytes = NULL;
-		s -> oblen = 0;
-		s -> obsize = 0;
-		s -> rl = NULL;
-		s -> exports = NULL;
-		// if name of section is "bss" or ".bss", assume bss flag
-		// which can be overridden with !bss flag
-		if (!strcasecmp(sn, "bss") || !strcasecmp(sn, ".bss"))
-			s -> flags = SECTION_BSS;
-		// parse options; only one "bss"
-		if (opts && as -> passnum == 1)
-		{
-			if (!strcasecmp(opts, "bss"))
-			{
-				s -> flags |= SECTION_BSS;
-			}
-			else if (!strcasecmp(opts, "!bss"))
-			{
-				s -> flags &= ~SECTION_BSS;
-			}
-			else
-			{
-				register_error(as, l, 1, "Unrecognized section option '%s'", opts);
-				lwasm_free(s -> name);
-				lwasm_free(s);
-				return;
-			}
-		}
-		
-		s -> next = as -> sections;
-		as -> sections = s;
-	}
-	as -> addr = s -> offset;
-	as -> csect = s;
-	as -> context = lwasm_next_context(as);
-}
-
-OPFUNC(pseudo_endsection)
-{
-	if (as -> outformat != OUTPUT_OBJ)
-	{
-		register_error(as, l, 1, "Sections only supported for obj target");
-		return;
-	}
-	
-	if (!(as -> csect))
-	{
-		register_error(as, l, 1, "ENDSECTION when not in a section");
-		return;
-	}
-	
-	as -> csect -> offset = as -> addr;
-	as -> addr = 0;
-	as -> csect = 0;
-	as -> context = lwasm_next_context(as);
-	skip_operand(p);
-}
-
-OPFUNC(pseudo_extern)
-{
-	if (as -> passnum != 1)
-		return;
-
-	if (as -> outformat != OUTPUT_OBJ)
-	{
-		register_error(as, l, 1, "External references only supported for obj target");
-		return;
-	}
-	
-	if (as -> csect)
-	{
-		register_error(as, l, 1, "Cannot declare external symbols within a section");
-		return;
-	}
-	
-	if (l -> sym)
-	{
-		lwasm_register_symbol(as, l, l -> sym, 0, SYMBOL_EXTERN);
-		for ( ; **p; (*p)++) ;
-		return;
-	}
-	
-	while (**p)
-	{
-		char *sym2, *sym3;
-		for (sym2 = *p; **p && !isspace(**p) && **p != ','; (*p)++)
-			/* do nothing */ ;
-
-		if (l -> sym)
-			lwasm_free(l -> sym);
-
-		sym3 = lwasm_alloc(*p - sym2 + 1);
-		memcpy(sym3, sym2, *p - sym2);
-		sym3[*p - sym2] = '\0';
-			
-		l -> sym = sym3;
-		debug_message(2, "import symbol: '%s'", sym3);
-		lwasm_register_symbol(as, l, l -> sym, 0, SYMBOL_EXTERN);
-		if (**p && (**p != ','))
-		{
-			register_error(as, l, 1, "Bad import list");
-			return;
-		}
-		if (**p == ',')
-			(*p)++;
-	}
-	if (!(l -> sym))
-		register_error(as, l, 1, "Bad import list");
-}
-
-OPFUNC(pseudo_export)
-{
-	lwasm_symbol_ent_t *se;
-	export_list_t *ex;
-	char *sym2, *sym3;
-	int after = 0;
-
-	if (as -> outformat != OUTPUT_OBJ)
-	{
-		register_error(as, l, 1, "Symbol exports only supported for obj target");
-		return;
-	}
-
-	if (as -> passnum == 1)
-	{
-		skip_operand(p);
-		return;
-	}
-
-	if (l -> sym)
-	{
-		for ( ; **p; (*p)++) ;
-	}
-
-again:
-	if (!(l -> sym) || after == 1)
-	{
-	
-		after = 1;
-		// look for symbol after op
-		if (**p)
-		{
-			for (sym2 = *p; **p && !isspace(**p) && **p != ','; (*p)++)
-				/* do nothing */ ;
-
-			debug_message(2, "export expression: %s", sym2);			
-			if (l -> sym)
-				lwasm_free(l -> sym);
-			sym3 = lwasm_alloc(*p - sym2 + 1);
-			memcpy(sym3, sym2, *p - sym2);
-			sym3[*p - sym2] = '\0';
-			
-			l -> sym = sym3;
-			debug_message(2, "export symbol: '%s'", sym3);
-		}
-	}
-	if (!(l -> sym))
-	{
-		register_error(as, l, 2, "No symbol");
-		return;
-	}
-
-
-	// the symbol better be defined at this point (pass 2)
-	// local symbols cannot be exported nor can "global" symbols
-	se = lwasm_find_symbol(as, l -> sym, -1);
-	if ((!se || (se -> flags & SYMBOL_EXTERN)) && (as -> pragmas & PRAGMA_IMPORTUNDEFEXPORT))
-	{
-		void *p;
-		p = as -> csect;
-		as -> csect = NULL;
-		lwasm_register_symbol(as, l, l -> sym, 0, SYMBOL_EXTERN);
-		as -> csect = p;
-	}
-	else
-	{
-		if (!se)
-		{
-			register_error(as, l, 2, "Exported symbols must be fully defined within a section");
-			return;
-		}
-		if (se -> sect == NULL)
-		{
-			register_error(as, l, 2, "Only non-local symbols within a section can be exported");
-			return;
-		}
-
-		if (se -> flags & SYMBOL_SET)
-		{
-			register_error(as, l, 2, "You cannot export symbols defined with SET");
-			return;
-		}
-
-		// if the symbol is not already a simple value, re-evaluate it
-		// and see if it becomes simple
-	
-
-		if (se -> flags & SYMBOL_COMPLEX)
-		{
-			register_error(as, l, 2, "Exported symbols must be fully resolved on pass 2");
-			return;
-		}
-
-		// search for existing export
-		for (ex = se -> sect -> exports; ex; ex = ex -> next)
-			if (!strcmp(l -> sym, ex -> sym))
-				break;
-		if (ex)
-		{
-			register_error(as, l, 2, "Symbol %s already exported", l -> sym);
-			return;
-		}
-
-		// add an external reference
-		ex = lwasm_alloc(sizeof(export_list_t));
-		ex -> next = se -> sect -> exports;
-		se -> sect -> exports = ex;
-		ex -> offset = se -> value;
-		ex -> sym = lwasm_strdup(se -> sym);
-	}
-next:
-	if (after == 1)
-	{
-		if (**p == ',')
-		{
-			debug_message(2, "Export another symbol: %s", *p);
-			(*p)++;
-			for ( ; **p && isspace(**p); (*p)++)
-				/* do nothing */ ;
-			goto again;
-		}
-	}
-}
--- a/old-trunk/lwasm/old/symbol.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-/*
-symbol.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-for handling the symbol table
-*/
-
-#define __symbol_c_seen__
-#include <config.h>
-#include <string.h>
-
-#include "lwasm.h"
-#include "util.h"
-#include "expr.h"
-
-/*
-Note that this function may accept symbols that the expression evaluator doesn't
-recognize because the expression evaluator must avoid all ambiguity in order
-to achieve predictable results. The checks here are simply a fuzz check.
-*/
-
-/*
-NOTE: complex symbols always take their value from slot 0 on the expression placeholders
-for a line!
-*/
-int lwasm_register_symbol(asmstate_t *as, lwasm_line_t *l, char *sym, int val, int flags)
-{
-	lwasm_symbol_ent_t *se, *se2;
-	char *p;
-	
-	int scontext = -1;
-	
-	// if the symbol is constant, fall back to simple registration!
-	if (flags & SYMBOL_COMPLEX)
-	{
-		if (l -> exprs[0] == NULL)
-		{
-			val = l -> exprvals[0];
-			flags &= ~SYMBOL_COMPLEX;
-		}
-	}
-	
-	// first check if the symbol is valid
-	// the following characters are allowed in a symbol:
-	// [a-zA-Z0-9._$?@] and any byte value larger than 0x7F
-	// although symbols should be restricted to the 7 bit range
-	// symbols must start with [a-zA-Z._]
-	if (!strchr(sym, '$'))
-	{
-		if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._@?", *sym))
-		{
-			register_error(as, l, 1, "Bad symbol: %s", sym);
-			return -1;
-		}
-	
-		if (*sym == '@' && isdigit(sym[1]))
-		{
-			register_error(as, l, 1, "Bad symbol: %s", sym);
-			return -1;
-		}
-	}
-	
-	for (p = sym; *p; p++)
-	{
-		if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._$?@0123456789", *sym))
-		{
-			register_error(as, l, 1, "Bad symbol: %s", sym);
-			return -1;
-		}
-		// flag local symbols while we're at it...
-		if (*p == '?' || *p == '@' || (*p == '$' && !(as -> pragmas & PRAGMA_DOLLARNOTLOCAL)))
-			scontext = as -> context;
-	}
-	
-	debug_message(3, "lwasm_register_symbol(): registering '%s' (%d) at %04X; flags=%d", sym, scontext, val, flags);
-	
-	// now look it for to see if it is a duplicate
-	se = lwasm_find_symbol(as, sym, scontext);
-	if (se)
-	{
-		if (flags & SYMBOL_FORCE && as -> passnum != 2)
-		{
-			register_error(as, l, 1, "Multiply defined symbol: %s", sym);
-			return -1;
-		}
-		if (!(flags & SYMBOL_SET) || (flags & SYMBOL_SET && !(se -> flags & SYMBOL_SET)))
-		{
-			register_error(as, l, 1, "Mulitply defined symbol: %s", sym);
-			return -1;
-		}
-	}
-	if (se)
-	{
-		se -> value = val;
-		if (flags & SYMBOL_COMPLEX)
-		{
-			se -> expr = l -> exprs[0];
-		}
-		else
-		{
-			se -> expr = NULL;
-		}
-		return;
-	}
-
-	// if not a duplicate, register it with the value
-	se = lwasm_alloc(sizeof(lwasm_symbol_ent_t));
-	if (as -> symhead)
-	{
-		se -> prev = NULL;
-		se -> next = as -> symhead;
-		as -> symhead -> prev = se;
-		as -> symhead = se;
-	}
-	else
-	{
-		se -> next = NULL;
-		se -> prev = NULL;
-		as -> symhead = se;
-		as -> symtail = se;
-	}
-	se -> value = val;
-	if (flags & SYMBOL_COMPLEX)
-		se -> expr = l -> exprs[0];
-	se -> sym = lwasm_strdup(sym);
-	se -> context = scontext;
-
-	if (!(flags & SYMBOL_EXTERN) && ((flags & SYMBOL_COMPLEX) || !(flags & SYMBOL_GLOBAL)))
-		se -> sect = as -> csect;
-	else
-		se -> sect = NULL;
-
-	se -> expr = NULL;
-	se -> flags = flags;
-	se -> externalname = NULL;
-
-	return 0;
-}
-
-lwasm_symbol_ent_t *lwasm_find_symbol(asmstate_t *as, char *sym, int scontext)
-{
-	lwasm_symbol_ent_t *se;
-	static int st = 0;
-	
-	for (se = as -> symhead; se; se = se -> next)
-	{
-		if (scontext == se -> context && !strcmp(sym, se -> sym))
-		{
-			return se;
-		}
-	}
-	if (as -> passnum == 2 && st == 0 && scontext == -1 && as -> outformat == OUTPUT_OBJ && as -> pragmas & PRAGMA_UNDEFEXTERN)
-	{
-		// we want undefined symbols to be considered external
-		// we didn't find it on a lookup so register it as external
-		// but we only do so when looking up in global context
-		st = 1;
-		if (lwasm_register_symbol(as, NULL, sym, 0, SYMBOL_EXTERN))
-		{
-			st = 0;
-			return NULL;
-		}
-		st = 0;
-		
-		// find the newly registered symbol and return it
-		for (se = as -> symhead; se; se = se -> next)
-		{
-			if (scontext == se -> context && !strcmp(sym, se -> sym))
-			{
-				return se;
-			}
-		}
-	}
-		
-	return NULL;
-}
-
-// reset the value of a symbol - should not be used normally
-// it is intended for use by such operations as EQU
-// returns -1 if the symbol is not registered
-int lwasm_set_symbol(asmstate_t *as, char *sym, int scontext, int val)
-{
-	lwasm_symbol_ent_t *se;
-	
-	se = lwasm_find_symbol(as, sym, scontext);
-	if (!se)
-		return -1;
-	
-	se -> value = val;
-	return 0;
-}
-
-void lwasm_list_symbols(asmstate_t *as, FILE *lf)
-{
-	lwasm_symbol_ent_t *se;
-	
-	for (se = as -> symhead; se; se = se -> next)
-	{
-		if (se -> expr)
-		{
-			fprintf(lf, "<incompl>");
-		}
-		else if (se -> value > 0xffff || se -> value < -0x8000)
-		{
-			fprintf(lf, "%08X ", se -> value);
-		}
-		else
-		{
-			fprintf(lf, "    %04X ", se -> value);
-		}
-		if (se -> context < 0)
-			fputc('G', lf);
-		else
-			fputc('L', lf);
-		
-		if (se -> flags & SYMBOL_SET)
-			fputc('S', lf);
-		else if (se -> flags & SYMBOL_EXTERN)
-			fputc('E', lf);
-		else
-			fputc(' ', lf);
-		
-		fprintf(lf, " %s", se -> sym);
-		
-		if (se -> context >= 0)
-			fprintf(lf, " (%d)", se -> context);
-		
-		if (se -> sect)
-		{
-			fprintf(lf, " [%s]", se -> sect -> name);
-		}
-		
-		fputc('\n', lf);
-	}
-}
--- a/old-trunk/lwasm/old/util.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-util.c
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Utility functions
-*/
-
-#define __util_c_seen__
-#include <config.h>
-#include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "util.h"
-
-void *lwasm_alloc(int size)
-{
-	void *ptr;
-	
-	ptr = malloc(size);
-	if (!ptr)
-	{
-		// bail out; memory allocation error
-		fprintf(stderr, "Memory allocation error\n");
-		exit(1);
-	}
-	return ptr;
-}
-
-void *lwasm_realloc(void *optr, int size)
-{
-	void *ptr;
-	
-	if (size == 0)
-	{
-		lwasm_free(optr);
-		return;
-	}
-	
-	ptr = realloc(optr, size);
-	if (!ptr)
-	{
-		fprintf(stderr, "lwasm_realloc(): memory allocation error\n");
-		exit(1);
-	}
-}
-
-void lwasm_free(void *ptr)
-{
-	if (ptr)
-		free(ptr);
-}
-
-char *lwasm_strdup(const char *s)
-{
-	char *d;
-	
-	d = strdup(s);
-	if (!d)
-	{
-		fprintf(stderr, "lwasm_strdup(): memory allocation error\n");
-		exit(1);
-	}
-	
-	return d;
-}
--- a/old-trunk/lwasm/old/util.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-expr.h
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Utility functions
-*/
-
-#ifndef __util_h_seen__
-#define __util_h_seen__
-
-#ifndef __util_c_seen__
-#define __util_E__ extern
-#else
-#define __util_E__
-#endif
-
-// allocate memory
-__util_E__ void *lwasm_alloc(int size);
-__util_E__ void lwasm_free(void *ptr);
-__util_E__ void *lwasm_realloc(void *optr, int size);
-
-// string stuff
-__util_E__ char *lwasm_strdup(const char *s);
-
-#undef __util_E__
-
-#endif // __util_h_seen__
--- a/old-trunk/lwasm/pragma.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
-pragma.c
-Copyright © 2009 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-This file contains stuff associated with lwasm specific strangeness
-*/
-#include <config.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include "lwasm.h"
-
-void pseudo_pragma_real(asmstate_t *as, void *cl, char **optr, int error)
-{
-	char pragma[128];
-	int c = 0;
-	
-	while (**optr && isspace(**optr))
-		(*optr)++;
-
-pragmaagain:
-	c = 0;	
-	while (c < 127 && **optr && **optr != ',' && !isspace(**optr))
-	{
-		pragma[c++] = **optr;
-		(*optr)++;
-	}
-	
-	if (c == 0 || (**optr && **optr != ',' && !isspace(**optr)))
-	{
-		if (error)
-		{
-//			register_error(as, cl, 1, "Unrecognized pragma");
-		}
-		if (error == 2)
-		{
-			*optr = NULL;
-		}
-		return;
-	}
-	pragma[c] = 0;
-	if (!strcasecmp(pragma, "noindex0tonone"))
-	{
-		as -> pragmas |= PRAGMA_NOINDEX0TONONE;
-	}
-	else if (!strcasecmp(pragma, "index0tonone"))
-	{
-		as -> pragmas &= ~PRAGMA_NOINDEX0TONONE;
-	}
-	else if (!strcasecmp(pragma, "undefextern"))
-	{
-		as -> pragmas |= PRAGMA_UNDEFEXTERN;
-	}
-	else if (!strcasecmp(pragma, "noundefextern"))
-	{
-		as -> pragmas &= ~PRAGMA_UNDEFEXTERN;
-	}
-	else if (!strcasecmp(pragma, "cescapes"))
-	{
-		as -> pragmas |= PRAGMA_CESCAPES;
-	}
-	else if (!strcasecmp(pragma, "nocescapes"))
-	{
-		as -> pragmas &= ~PRAGMA_CESCAPES;
-	}
-	else if (!strcasecmp(pragma, "importundefexport"))
-	{
-		as -> pragmas |= PRAGMA_IMPORTUNDEFEXPORT;
-	}
-	else if (!strcasecmp(pragma, "noimportundefexport"))
-	{
-		as -> pragmas &= ~PRAGMA_IMPORTUNDEFEXPORT;
-	}
-	else if (!strcasecmp(pragma, "dollarnotlocal") || !strcasecmp(pragma, "nodollarlocal"))
-	{
-		as -> pragmas |= PRAGMA_DOLLARNOTLOCAL;
-	}
-	else if (!strcasecmp(pragma, "dollarlocal") || !strcasecmp(pragma, "nodollarnotlocal"))
-	{
-		as -> pragmas &= ~PRAGMA_DOLLARNOTLOCAL;
-	}
-	else
-	{
-		if (error)
-		{
-//			register_error(as, cl, 1, "Unrecognized pragma");
-			if (error == 2)
-			{
-				*optr = NULL;
-			}
-		}
-	}
-	if (*optr && **optr == ',')
-	{
-		(*optr)++;
-		goto pragmaagain;
-	}
-}
--- a/old-trunk/lwlib/Makefile.am	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-noinst_LIBRARIES = liblw.a
-liblw_a_SOURCES = lw_mem.c
-EXTRA_DIST = lw_mem.h
--- a/old-trunk/lwlib/lw_mem.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-lw_mem.c
-
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-
-void (*lw_mem_error)(size_t s) = NULL;
-
-void *lw_malloc(size_t s)
-{
-	void *r;
-	
-	if (s < 1)
-		s = 1;
-	r = malloc(s);
-	if (!r && lw_mem_error)
-		(*lw_mem_error)(s);
-	return r;
-}
-
-void *lw_calloc(size_t s)
-{
-	void *r;
-	
-	if (s < 1)
-		s = 1;
-	r = calloc(s, 1);
-	if (!r && lw_mem_error)
-		(*lw_mem_error)(s);
-	return r;
-}
-
-void lw_free(void *p)
-{
-	if (p)
-		free(p);
-}
-
-void *lw_realloc(void *p, size_t s)
-{
-	void *r;
-	
-	if (s < 1)
-	{
-		free(p);
-		return NULL;
-	}
-	
-	r = realloc(p, s);
-	if (!r && lw_mem_error)
-		(*lw_mem_error)(s);
-	return r;
-}
--- a/old-trunk/lwlib/lw_mem.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-lw_mem.h
-
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef ___lw_mem_h_seen___
-#define ___lw_mem_h_seen___
-
-extern void (*lw_mem_error)(size_t s);
-
-extern void *lw_malloc(size_t s);
-extern void *lw_calloc(size_t s);
-extern void *lw_realloc(void *p, size_t s);
-extern void lw_free(void *p);
-
-#endif
--- a/old-trunk/lwlib/lw_value.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-lw_value.c
-
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#define ___lw_value_c_seen___
-#include "lw_value.h"
-#undef ___lw_value_c_seen___
--- a/old-trunk/lwlib/lw_value.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-lw_value.h
-
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef ___lw_value_h_seen___
-#define ___lw_value_h_seen___
-
-typedef struct
-{
-	long value;
-	int indet_context;
-	int undef;
-} LW_VALUE;
-
-#endif
--- a/old-trunk/lwlink/Makefile.am	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
-bin_PROGRAMS = lwlink lwobjdump
-lwlink_SOURCES = main.c lwlink.c util.c readfiles.c expr.c script.c link.c output.c map.c
-lwlink_LDADD = -L$(top_builddir)/lib -L$(top_srcdir)/lib -lgnu
-lwobjdump_SOURCES = objdump.c util.c
-lwobjdump_LDADD = -L$(top_builddir)/lib -L$(top_srcdir)/lib -lgnu
-EXTRA_DIST = lwlink.h util.h expr.h
--- a/old-trunk/lwlink/expr.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,370 +0,0 @@
-/*
-expr.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-This file contains the actual expression evaluator
-*/
-
-#define __expr_c_seen__
-#include <config.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "expr.h"
-#include "util.h"
-
-lw_expr_stack_t *lw_expr_stack_create(void)
-{
-	lw_expr_stack_t *s;
-	
-	s = lw_malloc(sizeof(lw_expr_stack_t));
-	s -> head = NULL;
-	s -> tail = NULL;
-	return s;
-}
-
-void lw_expr_stack_free(lw_expr_stack_t *s)
-{
-	while (s -> head)
-	{
-		s -> tail = s -> head;
-		s -> head = s -> head -> next;
-		lw_expr_term_free(s -> tail -> term);
-		lw_free(s -> tail);
-	}
-	lw_free(s);
-}
-
-lw_expr_stack_t *lw_expr_stack_dup(lw_expr_stack_t *s)
-{
-	lw_expr_stack_node_t *t;
-	lw_expr_stack_t *s2;
-		
-	s2 = lw_expr_stack_create();	
-	for (t = s -> head; t; t = t -> next)
-	{
-		lw_expr_stack_push(s2, t -> term);
-	}
-	return s2;
-}
-
-void lw_expr_term_free(lw_expr_term_t *t)
-{
-	if (t)
-	{
-		if (t -> term_type == LW_TERM_SYM)
-			lw_free(t -> symbol);
-		lw_free(t);
-	}
-}
-
-lw_expr_term_t *lw_expr_term_create_oper(int oper)
-{
-	lw_expr_term_t *t;
-
-	t = lw_malloc(sizeof(lw_expr_term_t));
-	t -> term_type = LW_TERM_OPER;
-	t -> value = oper;
-	return t;
-}
-
-lw_expr_term_t *lw_expr_term_create_int(int val)
-{
-	lw_expr_term_t *t;
-	
-	t = lw_malloc(sizeof(lw_expr_term_t));
-	t -> term_type = LW_TERM_INT;
-	t -> value = val;
-	return t;
-}
-
-lw_expr_term_t *lw_expr_term_create_sym(char *sym, int symtype)
-{
-	lw_expr_term_t *t;
-	
-	t = lw_malloc(sizeof(lw_expr_term_t));
-	t -> term_type = LW_TERM_SYM;
-	t -> symbol = lw_strdup(sym);
-	t -> value = symtype;
-	return t;
-}
-
-lw_expr_term_t *lw_expr_term_dup(lw_expr_term_t *t)
-{
-	switch (t -> term_type)
-	{
-	case LW_TERM_INT:
-		return lw_expr_term_create_int(t -> value);
-		
-	case LW_TERM_OPER:
-		return lw_expr_term_create_oper(t -> value);
-		
-	case LW_TERM_SYM:
-		return lw_expr_term_create_sym(t -> symbol, t -> value);
-	
-	default:
-		exit(1);
-	}
-// can't get here
-}
-
-void lw_expr_stack_push(lw_expr_stack_t *s, lw_expr_term_t *t)
-{
-	lw_expr_stack_node_t *n;
-
-	if (!s)
-	{
-		exit(1);
-	}
-	
-	n = lw_malloc(sizeof(lw_expr_stack_node_t));
-	n -> next = NULL;
-	n -> prev = s -> tail;
-	n -> term = lw_expr_term_dup(t);
-	
-	if (s -> head)
-	{
-		s -> tail -> next = n;
-		s -> tail = n;
-	}
-	else
-	{
-		s -> head = n;
-		s -> tail = n;
-	}
-}
-
-lw_expr_term_t *lw_expr_stack_pop(lw_expr_stack_t *s)
-{
-	lw_expr_term_t *t;
-	lw_expr_stack_node_t *n;
-	
-	if (!(s -> tail))
-		return NULL;
-	
-	n = s -> tail;
-	s -> tail = n -> prev;
-	if (!(n -> prev))
-	{
-		s -> head = NULL;
-	}
-	
-	t = n -> term;
-	n -> term = NULL;
-	
-	lw_free(n);
-	
-	return t;
-}
-
-/*
-take an expression stack s and scan for operations that can be completed
-
-return -1 on error, 0 on no error
-
-possible errors are: division by zero or unknown operator
-
-theory of operation:
-
-scan the stack for an operator which has two constants preceding it (binary)
-or 1 constant preceding it (unary) and if found, perform the calculation
-and replace the operator and its operands with the result
-
-repeat the scan until no futher simplications are found or if there are no
-further operators or only a single term remains
-
-*/
-int lw_expr_reval(lw_expr_stack_t *s, lw_expr_stack_t *(*sfunc)(char *sym, int stype, void *state), void *state)
-{
-	lw_expr_stack_node_t *n, *n2;
-	lw_expr_stack_t *ss;
-	int c;
-	
-next_iter_sym:
-	// resolve symbols
-	// symbols that do not resolve to an expression are left alone
-	for (c = 0, n = s -> head; n; n = n -> next)
-	{
-		if (n -> term -> term_type == LW_TERM_SYM)
-		{
-			ss = sfunc(n -> term -> symbol, n -> term -> value, state);
-			if (ss)
-			{
-				c++;
-				// splice in the result stack
-				if (n -> prev)
-				{
-					n -> prev -> next = ss -> head;
-				}
-				else
-				{
-					s -> head = ss -> head;
-				}
-				ss -> head -> prev = n -> prev;
-				ss -> tail -> next = n -> next;
-				if (n -> next)
-				{
-					n -> next -> prev = ss -> tail;
-				}
-				else
-				{
-					s -> tail = ss -> tail;
-				}
-				lw_expr_term_free(n -> term);
-				lw_free(n);
-				n = ss -> tail;
-				
-				ss -> head = NULL;
-				ss -> tail = NULL;
-				lw_expr_stack_free(ss);
-			}
-		}
-	}
-	if (c)
-		goto next_iter_sym;
-
-next_iter:	
-	// a single term
-	if (s -> head == s -> tail)
-		return 0;
-	
-	// search for an operator
-	for (n = s -> head; n; n = n -> next)
-	{
-		if (n -> term -> term_type == LW_TERM_OPER)
-		{
-			if (n -> term -> value == LW_OPER_NEG
-				|| n -> term -> value == LW_OPER_COM
-				)
-			{
-				// unary operator
-				if (n -> prev && n -> prev -> term -> term_type == LW_TERM_INT)
-				{
-					// a unary operator we can resolve
-					// we do the op then remove the term "n" is pointing at
-					if (n -> term -> value == LW_OPER_NEG)
-					{
-						n -> prev -> term -> value = -(n -> prev -> term -> value);
-					}
-					else if (n -> term -> value == LW_OPER_COM)
-					{
-						n -> prev -> term -> value = ~(n -> prev -> term -> value);
-					}
-					n -> prev -> next = n -> next;
-					if (n -> next)
-						n -> next -> prev = n -> prev;
-					else
-						s -> tail = n -> prev;	
-					
-					lw_expr_term_free(n -> term);
-					lw_free(n);
-					break;
-				}
-			}
-			else
-			{
-				// binary operator
-				if (n -> prev && n -> prev -> prev && n -> prev -> term -> term_type == LW_TERM_INT && n -> prev -> prev -> term -> term_type == LW_TERM_INT)
-				{
-					// a binary operator we can resolve
-					switch (n -> term -> value)
-					{
-					case LW_OPER_PLUS:
-						n -> prev -> prev -> term -> value += n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_MINUS:
-						n -> prev -> prev -> term -> value -= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_TIMES:
-						n -> prev -> prev -> term -> value *= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_DIVIDE:
-						if (n -> prev -> term -> value == 0)
-							return -1;
-						n -> prev -> prev -> term -> value /= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_MOD:
-						if (n -> prev -> term -> value == 0)
-							return -1;
-						n -> prev -> prev -> term -> value %= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_INTDIV:
-						if (n -> prev -> term -> value == 0)
-							return -1;
-						n -> prev -> prev -> term -> value /= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_BWAND:
-						n -> prev -> prev -> term -> value &= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_BWOR:
-						n -> prev -> prev -> term -> value |= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_BWXOR:
-						n -> prev -> prev -> term -> value ^= n -> prev -> term -> value;
-						break;
-
-					case LW_OPER_AND:
-						n -> prev -> prev -> term -> value = (n -> prev -> term -> value && n -> prev -> prev -> term -> value) ? 1 : 0;
-						break;
-
-					case LW_OPER_OR:
-						n -> prev -> prev -> term -> value = (n -> prev -> term -> value || n -> prev -> prev -> term -> value) ? 1 : 0;
-						break;
-
-					default:
-						// return error if unknown operator!
-						return -1;
-					}
-
-					// now remove the two unneeded entries from the stack
-					n -> prev -> prev -> next = n -> next;
-					if (n -> next)
-						n -> next -> prev = n -> prev -> prev;
-					else
-						s -> tail = n -> prev -> prev;	
-					
-					lw_expr_term_free(n -> term);
-					lw_expr_term_free(n -> prev -> term);
-					lw_free(n -> prev);
-					lw_free(n);
-					break;
-				}
-			}
-		}
-	}
-	// note for the terminally confused about dynamic memory and pointers:
-	// n will not be NULL even after the lw_free calls above so
-	// this test will still work (n will be a dangling pointer)
-	// (n will only be NULL if we didn't find any operators to simplify)
-	if (n)
-		goto next_iter;
-	
-	return 0;
-}
--- a/old-trunk/lwlink/expr.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-expr.h
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Definitions for expression evaluator
-*/
-
-#ifndef __expr_h_seen__
-#define __expr_h_seen__
-
-#ifndef __expr_c_seen__
-#define __expr_E__ extern
-#else
-#define __expr_E__
-#endif
-
-// term types
-#define LW_TERM_NONE		0
-#define LW_TERM_OPER		1	// an operator
-#define LW_TERM_INT		2	// 32 bit signed integer
-#define LW_TERM_SYM		3	// symbol reference
-
-// operator types
-#define LW_OPER_NONE		0
-#define LW_OPER_PLUS		1	// +
-#define LW_OPER_MINUS	2	// -
-#define LW_OPER_TIMES	3	// *
-#define LW_OPER_DIVIDE	4	// /
-#define LW_OPER_MOD		5	// %
-#define LW_OPER_INTDIV	6	// \ (don't end line with \)
-#define LW_OPER_BWAND	7	// bitwise AND
-#define LW_OPER_BWOR		8	// bitwise OR
-#define LW_OPER_BWXOR	9	// bitwise XOR
-#define LW_OPER_AND		10	// boolean AND
-#define LW_OPER_OR		11	// boolean OR
-#define LW_OPER_NEG		12	// - unary negation (2's complement)
-#define LW_OPER_COM		13	// ^ unary 1's complement
-
-
-// term structure
-typedef struct lw_expr_term_s
-{
-	int term_type;		// type of term (see above)
-	char *symbol;		// name of a symbol
-	int value;			// value of the term (int) or operator number (OPER)
-} lw_expr_term_t;
-
-// type for an expression evaluation stack
-typedef struct lw_expr_stack_node_s lw_expr_stack_node_t;
-struct lw_expr_stack_node_s
-{
-	lw_expr_term_t		*term;
-	lw_expr_stack_node_t	*prev;
-	lw_expr_stack_node_t	*next;	
-};
-
-typedef struct lw_expr_stack_s
-{
-	lw_expr_stack_node_t *head;
-	lw_expr_stack_node_t *tail;
-} lw_expr_stack_t;
-
-__expr_E__ void lw_expr_term_free(lw_expr_term_t *t);
-__expr_E__ lw_expr_term_t *lw_expr_term_create_oper(int oper);
-__expr_E__ lw_expr_term_t *lw_expr_term_create_sym(char *sym, int symtype);
-__expr_E__ lw_expr_term_t *lw_expr_term_create_int(int val);
-__expr_E__ lw_expr_term_t *lw_expr_term_dup(lw_expr_term_t *t);
-
-__expr_E__ void lw_expr_stack_free(lw_expr_stack_t *s);
-__expr_E__ lw_expr_stack_t *lw_expr_stack_create(void);
-__expr_E__ lw_expr_stack_t *lw_expr_stack_dup(lw_expr_stack_t *s);
-
-__expr_E__ void lw_expr_stack_push(lw_expr_stack_t *s, lw_expr_term_t *t);
-__expr_E__ lw_expr_term_t *lw_expr_stack_pop(lw_expr_stack_t *s);
-
-// simplify expression
-__expr_E__ int lw_expr_reval(lw_expr_stack_t *s, lw_expr_stack_t *(*sfunc)(char *sym, int symtype, void *state), void *state);
-
-// useful macros
-// is the expression "simple" (one term)?
-#define lw_expr_is_simple(s) ((s) -> head == (s) -> tail)
-
-// is the expression constant?
-#define lw_expr_is_constant(s) (lw_expr_is_simple(s) && (!((s) -> head) || (s) -> head -> term -> term_type == LW_TERM_INT))
-
-// get the constant value of an expression or 0 if not constant
-#define lw_expr_get_value(s) (lw_expr_is_constant(s) ? ((s) -> head ? (s) -> head -> term -> value : 0) : 0)
-
-#undef __expr_E__
-
-#endif // __expr_h_seen__
--- a/old-trunk/lwlink/link.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,462 +0,0 @@
-/*
-link.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Resolve section and symbol addresses; handle incomplete references
-*/
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "expr.h"
-#include "lwlink.h"
-#include "util.h"
-
-struct section_list *sectlist = NULL;
-int nsects = 0;
-static int nforced = 0;
-
-void check_section_name(char *name, int *base, fileinfo_t *fn)
-{
-	int sn;
-
-	if (fn -> forced == 0)
-		return;
-
-	for (sn = 0; sn < fn -> nsections; sn++)
-	{
-		if (!strcmp(name, fn -> sections[sn].name))
-		{
-			// we have a match
-			sectlist = lw_realloc(sectlist, sizeof(struct section_list) * (nsects + 1));
-			sectlist[nsects].ptr = &(fn -> sections[sn]);
-					
-			fn -> sections[sn].processed = 1;
-			fn -> sections[sn].loadaddress = *base;
-			*base += fn -> sections[sn].codesize;
-			nsects++;
-		}
-	}
-	for (sn = 0; sn < fn -> nsubs; sn++)
-	{
-		check_section_name(name, base, fn -> subs[sn]);
-	}
-}
-
-void add_matching_sections(char *name, int yesflags, int noflags, int *base);
-void check_section_flags(int yesflags, int noflags, int *base, fileinfo_t *fn)
-{
-	int sn;
-
-	if (fn -> forced == 0)
-		return;
-
-	for (sn = 0; sn < fn -> nsections; sn++)
-	{
-		// ignore if the noflags tell us to
-		if (noflags && (fn -> sections[sn].flags & noflags))
-			continue;
-		// ignore unless the yesflags tell us not to
-		if (yesflags && (fn -> sections[sn].flags & yesflags == 0))
-			continue;
-		// ignore it if already processed
-		if (fn -> sections[sn].processed)
-			continue;
-
-		// we have a match - now collect *all* sections of the same name!
-		add_matching_sections(fn -> sections[sn].name, 0, 0, base);
-		
-		// and then continue looking for sections
-	}
-	for (sn = 0; sn < fn -> nsubs; sn++)
-	{
-		check_section_flags(yesflags, noflags, base, fn -> subs[sn]);
-	}
-}
-
-
-
-void add_matching_sections(char *name, int yesflags, int noflags, int *base)
-{
-	int fn;
-	if (name)
-	{
-		// named section
-		// look for all instances of a section by the specified name
-		// and resolve base addresses and add to the list
-		for (fn = 0; fn < ninputfiles; fn++)
-		{
-			check_section_name(name, base, inputfiles[fn]);
-		}
-	}
-	else
-	{
-		// wildcard section
-		// named section
-		// look for all instances of a section by the specified name
-		// and resolve base addresses and add to the list
-		for (fn = 0; fn < ninputfiles; fn++)
-		{
-			check_section_flags(yesflags, noflags, base, inputfiles[fn]);
-		}
-	}
-}
-
-// work out section load order and resolve base addresses for each section
-// make a list of sections to load in order
-void resolve_sections(void)
-{
-	int laddr = 0;
-	int ln, sn, fn;
-	
-	for (ln = 0; ln < linkscript.nlines; ln++)
-	{
-		if (linkscript.lines[ln].loadat >= 0)
-			laddr = linkscript.lines[ln].loadat;
-		add_matching_sections(linkscript.lines[ln].sectname, linkscript.lines[ln].yesflags, linkscript.lines[ln].noflags, &laddr);
-		
-		if (linkscript.lines[ln].sectname)
-		{
-		}
-		else
-		{
-			// wildcard section
-			// look for all sections not yet processed that match flags
-
-			int f = 0;
-			int fn0, sn0;
-			char *sname;
-			
-			// named section
-			// look for all instances of a section by the specified name
-			// and resolve base addresses and add to the list
-			for (fn0 = 0; fn0 < ninputfiles; fn0++)
-			{
-				for (sn0 = 0; sn0 < inputfiles[fn0] -> nsections; sn0++)
-				{
-					// ignore if the "no flags" bit says to
-					if (linkscript.lines[ln].noflags && (inputfiles[fn0] -> sections[sn0].flags & linkscript.lines[ln].noflags))
-						continue;
-					// ignore unless the yes flags tell us not to
-					if (linkscript.lines[ln].yesflags && (inputfiles[fn0] -> sections[sn0].flags & linkscript.lines[ln].yesflags == 0))
-						continue;
-					if (inputfiles[fn0] -> sections[sn0].processed == 0)
-					{
-						sname = inputfiles[fn0] -> sections[sn0].name;
-						for (fn = 0; fn < ninputfiles; fn++)
-						{
-							for (sn = 0; sn < inputfiles[fn] -> nsections; sn++)
-							{
-								if (!strcmp(sname, inputfiles[fn] -> sections[sn].name))
-								{
-									// we have a match
-									sectlist = lw_realloc(sectlist, sizeof(struct section_list) * (nsects + 1));
-									sectlist[nsects].ptr = &(inputfiles[fn] -> sections[sn]);
-						
-									inputfiles[fn] -> sections[sn].processed = 1;
-									if (!f && linkscript.lines[ln].loadat >= 0)
-									{
-										f = 1;
-										sectlist[nsects].forceaddr = 1;
-										laddr = linkscript.lines[ln].loadat;
-									}
-									else
-									{
-										sectlist[nsects].forceaddr = 0;
-									}
-									inputfiles[fn] -> sections[sn].loadaddress = laddr;
-									laddr += inputfiles[fn] -> sections[sn].codesize;
-									nsects++;
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	// theoretically, all the base addresses are set now
-}
-
-lw_expr_stack_t *find_external_sym_recurse(char *sym, fileinfo_t *fn)
-{
-	int sn;
-	lw_expr_stack_t *r;
-	lw_expr_term_t *term;
-	symtab_t *se;
-	int val;
-	
-	for (sn = 0; sn < fn -> nsections; sn++)
-	{
-		for (se = fn -> sections[sn].exportedsyms; se; se = se -> next)
-		{
-			if (!strcmp(sym, se -> sym))
-			{
-				if (!(fn -> forced))
-				{
-					fn -> forced = 1;
-					nforced = 1;
-				}
-				val = se -> offset + fn -> sections[sn].loadaddress;
-				r = lw_expr_stack_create();
-				term = lw_expr_term_create_int(val & 0xffff);
-				lw_expr_stack_push(r, term);
-				lw_expr_term_free(term);
-				return r;
-			}
-		}
-	}
-		
-	for (sn = 0; sn < fn -> nsubs; sn++)
-	{
-		r = find_external_sym_recurse(sym, fn -> subs[sn]);
-		if (r)
-		{
-			if (!(fn -> forced))
-			{
-				nforced = 1;
-				fn -> forced = 1;
-			}
-			return r;
-		}
-	}
-	return NULL;
-}
-
-// resolve all incomplete references now
-// anything that is unresolvable at this stage will throw an error
-// because we know the load address of every section now
-lw_expr_stack_t *resolve_sym(char *sym, int symtype, void *state)
-{
-	section_t *sect = state;
-	lw_expr_term_t *term;
-	int val = 0, i, fn;
-	lw_expr_stack_t *s;
-	symtab_t *se;
-	fileinfo_t *fp;
-
-	if (symtype == 1)
-	{
-		// local symbol
-		if (!sym)
-		{
-			val = sect -> loadaddress;
-			goto out;
-		}
-		
-		// start with this section
-		for (se = sect -> localsyms; se; se = se -> next)
-		{
-			if (!strcmp(se -> sym, sym))
-			{
-				val = se -> offset + sect -> loadaddress;
-				goto out;
-			}
-		}
-		// not in this section - check all sections in this file
-		for (i = 0; i < sect -> file -> nsections; i++)
-		{
-			for (se = sect -> file -> sections[i].localsyms; se; se = se -> next)
-			{
-				if (!strcmp(se -> sym, sym))
-				{
-					val = se -> offset + sect -> file -> sections[i].loadaddress;
-					goto out;
-				}
-			}
-		}
-		// not found
-		symerr = 1;
-		fprintf(stderr, "Local symbol %s not found in %s:%s\n", sym, sect -> file -> filename, sect -> name);
-		goto outerr;
-	}
-	else
-	{
-		// external symbol
-		// read all files in order until found (or not found)
-		if (sect)
-		{
-			for (fp = sect -> file; fp; fp = fp -> parent)
-			{
-				s = find_external_sym_recurse(sym, fp);
-				if (s)
-					return s;
-			}
-		}
-
-		for (fn = 0; fn < ninputfiles; fn++)
-		{
-			s = find_external_sym_recurse(sym, inputfiles[fn]);
-			if (s)
-				return s;
-		}
-		if (sect)
-		{
-			fprintf(stderr, "External symbol %s not found in %s:%s\n", sym, sect -> file -> filename, sect -> name);
-		}
-		else
-		{
-			fprintf(stderr, "External symbol %s not found\n", sym);
-		}
-		symerr = 1;
-		goto outerr;
-	}
-	fprintf(stderr, "Shouldn't ever get here!!!\n");
-	exit(88);
-out:
-	s = lw_expr_stack_create();
-	term = lw_expr_term_create_int(val & 0xffff);
-	lw_expr_stack_push(s, term);
-	lw_expr_term_free(term);
-	return s;
-outerr:
-	return NULL;
-}
-
-void resolve_references(void)
-{
-	int sn;
-	reloc_t *rl;
-	int rval;
-
-	// resolve entry point if required
-	// this must resolve to an *exported* symbol and will resolve to the
-	// first instance of that symbol
-	if (linkscript.execsym)
-	{
-		lw_expr_stack_t *s;
-		
-		s = resolve_sym(linkscript.execsym, 0, NULL);
-		if (!s)
-		{
-			fprintf(stderr, "Cannot resolve exec address '%s'\n", linkscript.execsym);
-			symerr = 1;
-		}
-		else
-		{
-			linkscript.execaddr = lw_expr_get_value(s);
-			lw_expr_stack_free(s);
-		}
-	}
-	
-	for (sn = 0; sn < nsects; sn++)
-	{
-		for (rl = sectlist[sn].ptr -> incompletes; rl; rl = rl -> next)
-		{
-			// do a "simplify" on the expression
-			rval = lw_expr_reval(rl -> expr, resolve_sym, sectlist[sn].ptr);
-
-			// is it constant? error out if not
-			if (rval != 0 || !lw_expr_is_constant(rl -> expr))
-			{
-				fprintf(stderr, "Incomplete reference at %s:%s+%02X\n", sectlist[sn].ptr -> file -> filename, sectlist[sn].ptr -> name, rl -> offset);
-				symerr = 1;
-			}
-			else
-			{
-				// put the value into the relocation address
-				rval = lw_expr_get_value(rl -> expr);
-				if (rl -> flags & RELOC_8BIT)
-				{
-					sectlist[sn].ptr -> code[rl -> offset] = rval & 0xff;
-				}
-				else
-				{
-					sectlist[sn].ptr -> code[rl -> offset] = (rval >> 8) & 0xff;
-					sectlist[sn].ptr -> code[rl -> offset + 1] = rval & 0xff;
-				}
-			}
-		}
-	}
-	
-	if (symerr)
-		exit(1);
-}
-
-/*
-This is just a pared down version of the algo for resolving references.
-*/
-void resolve_files(void)
-{
-	int sn;
-	int fn;
-	reloc_t *rl;
-	lw_expr_stack_t *te;
-	
-	int rval;
-
-	// resolve entry point if required
-	// this must resolve to an *exported* symbol and will resolve to the
-	// first instance of that symbol
-	if (linkscript.execsym)
-	{
-		lw_expr_stack_t *s;
-		
-		s = resolve_sym(linkscript.execsym, 0, NULL);
-		if (!s)
-		{
-			fprintf(stderr, "Cannot resolve exec address '%s'\n", linkscript.execsym);
-			symerr = 1;
-		}
-	}
-	
-	do
-	{
-		nforced = 0;
-		for (fn = 0; fn < ninputfiles; fn++)
-		{
-			if (inputfiles[fn] -> forced == 0)
-				continue;
-	
-			for (sn = 0; sn < inputfiles[fn] -> nsections; sn++)
-			{
-				for (rl = inputfiles[fn] -> sections[sn].incompletes; rl; rl = rl -> next)
-				{
-					// do a "simplify" on the expression
-					te = lw_expr_stack_dup(rl -> expr);
-					rval = lw_expr_reval(te, resolve_sym, &(inputfiles[fn] -> sections[sn]));
-					
-					// is it constant? error out if not
-					if (rval != 0 || !lw_expr_is_constant(te))
-					{
-						fprintf(stderr, "Incomplete reference at %s:%s+%02X\n", inputfiles[fn] -> filename, inputfiles[fn] -> sections[sn].name, rl -> offset);
-						symerr = 1;
-					}
-					lw_expr_stack_free(te);
-				}
-			}
-		}
-	}
-	while (nforced == 1);
-
-	if (symerr)
-		exit(1);
-	
-	// theoretically, all files referenced by other files now have "forced" set to 1
-	for (fn = 0; fn < ninputfiles; fn++)
-	{
-		if (inputfiles[fn] -> forced == 1)
-			continue;
-		
-		fprintf(stderr, "Warning: %s (%d) does not resolve any symbols\n", inputfiles[fn] -> filename, fn);
-	}
-}
--- a/old-trunk/lwlink/lwlink.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
-lwlink.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-
-*/
-
-#include <config.h>
-
-#define __lwlink_c_seen__
-
-#include <argp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwlink.h"
-#include "util.h"
-
-int debug_level = 0;
-int outformat = OUTPUT_DECB;
-char *outfile = NULL;
-char *scriptfile = NULL;
-int symerr = 0;
-char *map_file = NULL;
-
-fileinfo_t **inputfiles = NULL;
-int ninputfiles = 0;
-
-int nlibdirs = 0;
-char **libdirs = NULL;
-
-int nscriptls = 0;
-char **scriptls = NULL;
-
-void add_input_file(char *fn)
-{
-	inputfiles = lw_realloc(inputfiles, sizeof(fileinfo_t *) * (ninputfiles + 1));
-	inputfiles[ninputfiles] = lw_malloc(sizeof(fileinfo_t));
-	memset(inputfiles[ninputfiles], 0, sizeof(fileinfo_t));
-	inputfiles[ninputfiles] -> forced = 1;
-	inputfiles[ninputfiles++] -> filename = lw_strdup(fn);
-}
-
-void add_input_library(char *libname)
-{
-	inputfiles = lw_realloc(inputfiles, sizeof(fileinfo_t *) * (ninputfiles + 1));
-	inputfiles[ninputfiles] = lw_malloc(sizeof(fileinfo_t));
-	memset(inputfiles[ninputfiles], 0, sizeof(fileinfo_t));
-	inputfiles[ninputfiles] -> islib = 1;
-	inputfiles[ninputfiles] -> forced = 0;
-	inputfiles[ninputfiles++] -> filename = lw_strdup(libname);	
-}
-
-void add_library_search(char *libdir)
-{
-	libdirs = lw_realloc(libdirs, sizeof(char*) * (nlibdirs + 1));
-	libdirs[nlibdirs] = lw_strdup(libdir);
-	nlibdirs++;
-}
-
-void add_section_base(char *sectspec)
-{
-	char *base;
-	int baseaddr;
-	char *t;
-	int l;
-	
-	base = strchr(sectspec, '=');
-	if (!base)
-	{
-		l = strlen(sectspec);
-		baseaddr = 0;
-	}
-	else
-	{
-		baseaddr = strtol(base + 1, NULL, 16);
-		l = base - sectspec;
-		*base = '\0';
-	}
-	baseaddr = baseaddr & 0xffff;
-	
-	t = lw_malloc(l + 25);
-	sprintf(t, "section %s load %04X", sectspec, baseaddr);
-	if (base)
-		*base = '=';
-	
-	scriptls = lw_realloc(scriptls, sizeof(char *) * (nscriptls + 1));
-	scriptls[nscriptls++] = t;
-}
--- a/old-trunk/lwlink/lwlink.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-lwlink.h
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-Contains the main defs used by the linker
-*/
-
-
-#ifndef __lwlink_h_seen__
-#define __lwlink_h_seen__
-
-#include "expr.h"
-
-#define OUTPUT_DECB		0	// DECB multirecord format
-#define OUTPUT_RAW		1	// raw sequence of bytes
-#define OUTPUT_LWEX0	2	// LWOS LWEX binary version 0
-
-typedef struct symtab_s symtab_t;
-struct symtab_s
-{
-	unsigned char *sym;		// symbol name
-	int offset;				// local offset
-//	int realval;			// resolved value
-	symtab_t *next;			// next symbol
-};
-
-#define RELOC_NORM	0		// all default (16 bit)
-#define RELOC_8BIT	1		// only use the low 8 bits for the reloc
-typedef struct reloc_s reloc_t;
-struct reloc_s
-{
-	int offset;				// where in the section
-	int flags;				// flags for the relocation
-	lw_expr_stack_t *expr;	// the expression to calculate it
-	reloc_t *next;			// ptr to next relocation
-};
-
-typedef struct fileinfo_s fileinfo_t;
-
-#define SECTION_BSS		1
-typedef struct
-{
-	unsigned char *name;	// name of the section
-	int flags;				// section flags
-	int codesize;			// size of the code
-	unsigned char *code;	// pointer to the code
-	int loadaddress;		// the actual load address of the section
-	int processed;			// was the section processed yet?
-		
-	symtab_t *localsyms;	// local symbol table
-	symtab_t *exportedsyms;	// exported symbols table
-	
-	reloc_t *incompletes;	// table of incomplete references
-	
-	fileinfo_t *file;		// the file we are in
-} section_t;
-
-struct fileinfo_s
-{
-	char *filename;
-	unsigned char *filedata;
-	long filesize;
-	section_t *sections;
-	int nsections;
-	int islib;				// set to true if the file is a "-l" option
-
-	int forced;				// set to true if the file is a "forced" include
-
-	// "sub" files (like in archives or libraries)
-	int nsubs;
-	fileinfo_t **subs;
-	fileinfo_t *parent;
-};
-
-struct section_list
-{
-	section_t *ptr;		// ptr to section structure
-	int forceaddr;		// was this force to an address by the link script?
-};
-
-#ifndef __link_c_seen__
-extern struct section_list *sectlist;
-extern int nsects;
-#endif
-
-
-#ifndef __lwlink_c_seen__
-
-extern int debug_level;
-extern int outformat;
-extern char *outfile;
-extern int ninputfiles;
-extern fileinfo_t **inputfiles;
-extern char *scriptfile;
-
-extern int nlibdirs;
-extern char **libdirs;
-
-extern int nscriptls;
-extern char **scriptls;
-
-extern int symerr;
-
-extern char *map_file;
-
-#define __lwlink_E__ extern
-#else
-#define __lwlink_E__
-#endif // __lwlink_c_seen__
-
-__lwlink_E__ void add_input_file(char *fn);
-__lwlink_E__ void add_input_library(char *fn);
-__lwlink_E__ void add_library_search(char *fn);
-__lwlink_E__ void add_section_base(char *fn);
-
-#undef __lwlink_E__
-
-struct scriptline_s
-{
-	char *sectname;				// name of section, NULL for wildcard
-	int loadat;					// address to load at (or -1)
-	int noflags;				// flags to NOT have
-	int yesflags;				// flags to HAVE
-};
-
-typedef struct
-{
-	int nlines;					// number of lines in the script
-	struct scriptline_s *lines;	// the parsed script lines (section)
-	int padsize;				// the size to pad to, -1 for none
-	char *execsym;				// entry point symbol
-	int execaddr;				// execution address (entry point)
-	int stacksize;				// stack size
-} linkscript_t;
-
-#ifndef __script_c_seen__
-extern linkscript_t linkscript;
-#endif
-
-#endif //__lwlink_h_seen__
--- a/old-trunk/lwlink/main.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-main.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Implements the program startup code
-
-*/
-
-#include <config.h>
-
-#include <argp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "lwlink.h"
-
-char *program_name;
-
-// command line option handling
-const char *argp_program_version = "LWLINK from " PACKAGE_STRING;
-const char *argp_program_bug_address = PACKAGE_BUGREPORT;
-
-static error_t parse_opts(int key, char *arg, struct argp_state *state)
-{
-	switch (key)
-	{
-	case 'o':
-		// output
-		outfile = arg;
-		break;
-	
-	case 's':
-		// script file
-		scriptfile = arg;
-		break;
-
-	case 'd':
-		// debug
-		debug_level++;
-		break;
-	
-	case 'b':
-		// decb output
-		outformat = OUTPUT_DECB;
-		break;
-	
-	case 'r':
-		// raw binary output
-		outformat = OUTPUT_RAW;
-		break;
-	
-	case 'f':
-		// output format
-		if (!strcasecmp(arg, "decb"))
-			outformat = OUTPUT_DECB;
-		else if (!strcasecmp(arg, "raw"))
-			outformat = OUTPUT_RAW;
-		else if (!strcasecmp(arg, "lwex0") || !strcasecmp(arg, "lwex"))
-			outformat = OUTPUT_LWEX0;
-		else
-		{
-			fprintf(stderr, "Invalid output format: %s\n", arg);
-			exit(1);
-		}
-		break;
-	case ARGP_KEY_END:
-		// done; sanity check
-		if (!outfile)
-			outfile = "a.out";
-		break;
-	
-	case 'l':
-		add_input_library(arg);
-		break;
-	
-	case 'L':
-		add_library_search(arg);
-		break;
-	
-	case 0x100:
-		add_section_base(arg);
-		break;
-	
-	case 'm':
-		map_file = arg;
-		break;
-	
-	case ARGP_KEY_ARG:
-		add_input_file(arg);
-		break;
-		
-	default:
-		return ARGP_ERR_UNKNOWN;
-	}
-	return 0;
-}
-
-static struct argp_option options[] =
-{
-	{ "output",		'o',	"FILE",	0,
-				"Output to FILE"},
-	{ "debug",		'd',	0,		0,
-				"Set debug mode"},
-	{ "format",		'f',	"TYPE",	0,
-				"Select output format: decb, raw, lwex"},
-	{ "decb",		'b',	0,		0,
-				"Generate DECB .bin format output, equivalent of --format=decb"},
-	{ "raw",		'r',	0,		0,
-				"Generate raw binary format output, equivalent of --format=raw"},
-	{ "script",		's',	"FILE",		0,
-				"Specify the linking script (overrides the built in defaults)"},
-	{ "library",	'l',	"LIBSPEC",	0,
-				"Read library libLIBSPEC.a from the search path" },
-	{ "library-path", 'L',	"DIR",		0,
-				"Add DIR to the library search path" },
-	{ "section-base", 0x100,	"SECT=BASE",	0,
-				"Load section SECT at BASE" },
-	{ "map",		'm',	"FILE",		0,
-				"Output informaiton about the link" },
-	{ 0 }
-};
-
-static struct argp argp =
-{
-	options,
-	parse_opts,
-	"<input file> ...",
-	"LWLINK, a HD6309 and MC6809 cross-linker"
-};
-
-extern void read_files(void);
-extern void setup_script(void);
-extern void resolve_files(void);
-extern void resolve_sections(void);
-extern void resolve_references(void);
-extern void do_output(void);
-extern void display_map(void);
-
-// main function; parse command line, set up assembler state, and run the
-// assembler on the first file
-int main(int argc, char **argv)
-{
-	program_name = argv[0];
-
-	argp_parse(&argp, argc, argv, 0, 0, NULL);
-	if (ninputfiles == 0)
-	{
-		fprintf(stderr, "No input files\n");
-		exit(1);
-	}
-
-	unlink(outfile);
-
-	// handle the linker script
-	setup_script();
-
-	// read the input files
-	read_files();
-
-	// trace unresolved references and determine which non-forced
-	// objects must be included
-	resolve_files();
-	
-	// resolve section bases and section order
-	resolve_sections();
-	
-	// resolve incomplete references
-	resolve_references();
-	
-	// do the actual output
-	do_output();
-
-	// display/output the link map
-	if (map_file)
-		display_map();
-
-	exit(0);
-}
--- a/old-trunk/lwlink/map.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-map.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Output information about the linking process
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lwlink.h"
-#include "util.h"
-
-struct symliste
-{
-	char *name;
-	char *fn;
-	int addr;
-	int ext;
-	struct symliste *next;
-};
-
-void display_map(void)
-{
-	FILE *of;
-	int sn;
-	int std = 0;
-	struct symliste *slist = NULL;
-	struct symliste *ce, *pe, *ne;
-	symtab_t *sym;
-	int i;
-	
-	if (!strcmp(map_file, "-"))
-	{
-		std = 1;
-		of = stdout;
-	}
-	else
-	{
-		of = fopen(map_file, "w");
-		if (!of)
-		{
-			fprintf(stderr, "Cannot open map file - using stdout\n");
-			std = 1;
-			of = stdout;
-		}
-	}
-
-	// display section list
-	for (sn = 0; sn < nsects; sn++)
-	{
-		fprintf(of, "Section: %s (%s) load at %04X, length %04X\n",
-				sectlist[sn].ptr -> name,
-				sectlist[sn].ptr -> file -> filename,
-				sectlist[sn].ptr -> loadaddress,
-				sectlist[sn].ptr -> codesize
-			);
-	}
-
-	// generate a sorted list of symbols and display it
-	for (sn = 0; sn < nsects; sn++)
-	{
-		for (sym = sectlist[sn].ptr -> localsyms; sym; sym = sym -> next)
-		{
-			for (pe = NULL, ce = slist; ce; ce = ce -> next)
-			{
-				i = strcmp(ce -> name, sym -> sym);
-				if (i == 0)
-				{
-					i = strcmp(ce -> fn, sectlist[sn].ptr -> file -> filename);
-				}
-				if (i > 0)
-					break;
-				pe = ce;
-			}
-			ne = lw_malloc(sizeof(struct symliste));
-			ne -> ext = 0;
-			ne -> addr = sym -> offset + sectlist[sn].ptr -> loadaddress;
-			ne -> next = ce;
-			ne -> name = sym -> sym;
-			ne -> fn = sectlist[sn].ptr -> file -> filename;
-			if (pe)
-				pe -> next = ne;
-			else
-				slist = ne;
-		}
-	}
-	
-	for (ce = slist; ce; ce = ce -> next)
-	{
-		fprintf(of, "Symbol: %s (%s) = %04X\n", ce -> name, ce -> fn, ce -> addr);
-	}
-
-	if (!std)
-		fclose(of);
-}
--- a/old-trunk/lwlink/objdump.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*
-objdump.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-A standalone program to dump an object file in a text form to stdout
-
-*/
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "util.h"
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-void read_lwobj16v0(unsigned char *filedata, long filesize);
-char *program_name;
-
-/*
-The logic of reading the entire file into memory is simple. All the symbol
-names in the file are NUL terminated strings and can be used directly without
-making additional copies.
-*/
-int main(int argc, char **argv)
-{
-	int i;
-	long size;
-	FILE *f;
-	long bread;
-	unsigned char *filedata;
-
-	program_name = argv[0];	
-	if (argc != 2)
-	{
-		fprintf(stderr, "Must specify exactly one input file.\n");
-		exit(1);
-	}
-
-	f = fopen(argv[1], "rb");
-	if (!f)
-	{
-		fprintf(stderr, "Can't open file %s:", argv[1]);
-		perror("");
-		exit(1);
-	}
-	fseek(f, 0, SEEK_END);
-	size = ftell(f);
-	rewind(f);
-		
-	filedata = lw_malloc(size);
-		
-	bread = fread(filedata, 1, size, f);
-	if (bread < size)
-	{
-		fprintf(stderr, "Short read on file %s (%ld/%ld):", argv[1], bread, size);
-		perror("");
-		exit(1);
-	}
-			
-	fclose(f);
-		
-	if (!memcmp(filedata, "LWOBJ16", 8))
-	{
-		// read v0 LWOBJ16 file
-		read_lwobj16v0(filedata, size);
-	}
-	else
-	{
-		fprintf(stderr, "%s: unknown file format\n", argv[1]);
-		exit(1);
-	}
-	exit(0);
-}
-
-// this macro is used to bail out if we run off the end of the file data
-// while parsing - it keeps the code below cleaner
-#define NEXTBYTE()	do { cc++; if (cc > filesize) { fprintf(stderr, "***invalid file format\n"); exit(1); } } while (0)
-// this macro is used to refer to the current byte in the stream
-#define CURBYTE()	(filedata[cc < filesize ? cc : filesize - 1])
-// this one will leave the input pointer past the trailing NUL
-#define CURSTR()	read_lwobj16v0_str(&cc, &filedata, filesize)
-unsigned char *read_lwobj16v0_str(long *cc1, unsigned char **filedata1, long filesize)
-{
-	int cc = *cc1;
-	unsigned char *filedata = *filedata1;
-	unsigned char *fp;
-	fp = &CURBYTE();
-	while (CURBYTE())
-		NEXTBYTE();
-	NEXTBYTE();
-	*cc1 = cc;
-	*filedata1 = filedata;
-	return fp;
-}
-// the function below can be switched to dealing with data coming from a
-// source other than an in-memory byte pool by adjusting the input data
-// in "fn" and the above two macros
-void read_lwobj16v0(unsigned char *filedata, long filesize)
-{
-	unsigned char *fp;
-	long cc;
-	int val;
-	int bss;
-
-	static char *opernames[] = {
-		"?",
-		"PLUS",
-		"MINUS",
-		"TIMES",
-		"DIVIDE",
-		"MOD",
-		"INTDIV",
-		"BWAND",
-		"BWOR",
-		"BWXOR",
-		"AND",
-		"OR",
-		"NEG",
-		"COM"
-	};
-	static const int numopers = 13;
-		
-	// start reading *after* the magic number
-	cc = 8;
-	
-	while (1)
-	{
-		bss = 0;
-		
-		// bail out if no more sections
-		if (!(CURBYTE()))
-			break;
-		
-		fp = CURSTR();
-		
-		printf("SECTION %s\n", fp);
-		
-		// read flags
-		while (CURBYTE())
-		{
-			switch (CURBYTE())
-			{
-			case 0x01:
-				printf("    FLAG: BSS\n");
-				bss = 1;
-				break;
-
-			default:
-				printf("    FLAG: %02X (unknown)\n", CURBYTE());
-				break;
-			}
-			NEXTBYTE();
-		}
-		// skip NUL terminating flags
-		NEXTBYTE();
-		
-		printf("    Local symbols:\n");
-		// now parse the local symbol table
-		while (CURBYTE())
-		{
-			fp = CURSTR();
-
-			// fp is the symbol name
-			val = (CURBYTE()) << 8;
-			NEXTBYTE();
-			val |= (CURBYTE());
-			NEXTBYTE();
-			// val is now the symbol value
-			
-			printf("        %s=%04X\n", fp, val);
-			
-		}
-		// skip terminating NUL
-		NEXTBYTE();
-
-		printf("    Exported symbols\n");
-				
-		// now parse the exported symbol table
-		while (CURBYTE())
-		{
-			fp = CURSTR();
-
-			// fp is the symbol name
-			val = (CURBYTE()) << 8;
-			NEXTBYTE();
-			val |= (CURBYTE());
-			NEXTBYTE();
-			// val is now the symbol value
-			
-			printf("        %s=%04X\n", fp, val);
-		}
-		// skip terminating NUL
-		NEXTBYTE();
-		
-		// now parse the incomplete references and make a list of
-		// external references that need resolution
-		printf("    Incomplete references\n");
-		while (CURBYTE())
-		{
-			printf("        (");
-			// parse the expression
-			while (CURBYTE())
-			{
-				int tt = CURBYTE();
-				NEXTBYTE();
-				switch (tt)
-				{
-				case 0x01:
-					// 16 bit integer
-					tt = CURBYTE() << 8;
-					NEXTBYTE();
-					tt |= CURBYTE();
-					NEXTBYTE();
-					// normalize for negatives...
-					if (tt > 0x7fff)
-						tt -= 0x10000;
-					printf(" I16=%d", tt);
-					break;
-				
-				case 0x02:
-					// external symbol reference
-					printf(" ES=%s", CURSTR());
-					break;
-					
-				case 0x03:
-					// internal symbol reference
-					printf(" IS=%s", CURSTR());
-					break;
-				
-				case 0x04:
-					// operator
-					if (CURBYTE() > 0 && CURBYTE() <= numopers)
-						printf(" OP=%s", opernames[CURBYTE()]);
-					else
-						printf(" OP=?");
-					NEXTBYTE();
-					break;
-
-				case 0x05:
-					// section base reference (NULL internal reference is
-					// the section base address
-					printf(" SB");
-					break;
-				
-				case 0xFF:
-					// section flags
-					printf(" FLAGS=%02X", CURBYTE());
-					NEXTBYTE();
-					break;
-					
-				default:
-					printf(" ERR");
-				}
-			}
-			// skip the NUL
-			NEXTBYTE();
-			
-			// fetch the offset
-			val = CURBYTE() << 8;
-			NEXTBYTE();
-			val |= CURBYTE() & 0xff;
-			NEXTBYTE();
-			printf(" ) @ %04X\n", val);
-		}
-		// skip the NUL terminating the relocations
-		NEXTBYTE();
-				
-		// now set code location and size and verify that the file
-		// contains data going to the end of the code (if !SECTION_BSS)
-		val = CURBYTE() << 8;
-		NEXTBYTE();
-		val |= CURBYTE();
-		NEXTBYTE();
-		
-		printf("    CODE %04X bytes", val);
-		
-		// skip the code if we're not in a BSS section
-		if (!bss)
-		{
-			int i;
-			for (i = 0; i < val; i++)
-			{
-				if (! (i % 16))
-				{
-					printf("\n    %04X ", i);
-				}
-				printf("%02X", CURBYTE());
-				NEXTBYTE();
-			}
-		}
-		printf("\n");
-	}
-}
--- a/old-trunk/lwlink/output.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-/*
-output.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Actually output the binary
-*/
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwlink.h"
-
-// this prevents warnings about not using the return value of fwrite()
-// and, theoretically, can be replaced with a function that handles things
-// better in the future
-#define writebytes(s, l, c, f)	do { int r; r = fwrite((s), (l), (c), (f)); } while (0)
-
-void do_output_decb(FILE *of);
-void do_output_raw(FILE *of);
-void do_output_lwex0(FILE *of);
-
-void do_output(void)
-{
-	FILE *of;
-	
-	of = fopen(outfile, "wb");
-	if (!of)
-	{
-		fprintf(stderr, "Cannot open output file %s: ", outfile);
-		perror("");
-		exit(1);
-	}
-	
-	switch (outformat)
-	{
-	case OUTPUT_DECB:
-		do_output_decb(of);
-		break;
-	
-	case OUTPUT_RAW:
-		do_output_raw(of);
-		break;
-
-	case OUTPUT_LWEX0:
-		do_output_lwex0(of);
-		break;
-	
-	default:
-		fprintf(stderr, "Unknown output format doing output!\n");
-		exit(111);
-	}
-	
-	fclose(of);
-}
-
-void do_output_decb(FILE *of)
-{
-	int sn, sn2;
-	int cloc, olen;
-	unsigned char buf[5];
-	
-	for (sn = 0; sn < nsects; sn++)
-	{
-		if (sectlist[sn].ptr -> flags & SECTION_BSS)
-		{
-			// no output for a BSS section
-			continue;
-		}
-		if (sectlist[sn].ptr -> codesize == 0)
-		{
-			// don't generate output for a zero size section
-			continue;
-		}
-		
-		// calculate the length of this output block
-		cloc = sectlist[sn].ptr -> loadaddress;
-		olen = 0;
-		for (sn2 = sn; sn2 < nsects; sn2++)
-		{
-			// ignore BSS sections
-			if (sectlist[sn2].ptr -> flags & SECTION_BSS)
-				continue;
-			// ignore zero length sections
-			if (sectlist[sn2].ptr -> codesize == 0)
-				continue;
-			if (cloc != sectlist[sn2].ptr -> loadaddress)
-				break;
-			olen += sectlist[sn2].ptr -> codesize;
-			cloc += sectlist[sn2].ptr -> codesize;
-		}
-		
-		// write a preamble
-		buf[0] = 0x00;
-		buf[1] = olen >> 8;
-		buf[2] = olen & 0xff;
-		buf[3] = sectlist[sn].ptr -> loadaddress >> 8;
-		buf[4] = sectlist[sn].ptr -> loadaddress & 0xff;
-		writebytes(buf, 1, 5, of);
-		for (; sn < sn2; sn++)
-		{
-			if (sectlist[sn].ptr -> flags & SECTION_BSS)
-				continue;
-			if (sectlist[sn].ptr -> codesize == 0)
-				continue;
-			writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of);
-		}
-		sn--;
-	}
-	// write a postamble
-	buf[0] = 0xff;
-	buf[1] = 0x00;
-	buf[2] = 0x00;
-	buf[3] = linkscript.execaddr >> 8;
-	buf[4] = linkscript.execaddr & 0xff;
-	writebytes(buf, 1, 5, of);
-}
-
-void do_output_raw(FILE *of)
-{
-	int nskips = 0;		// used to output blanks for BSS inline
-	int sn;
-	
-	for (sn = 0; sn < nsects; sn++)
-	{
-		if (sectlist[sn].ptr -> flags & SECTION_BSS)
-		{
-			// no output for a BSS section
-			nskips += sectlist[sn].ptr -> codesize;
-			continue;
-		}
-		while (nskips > 0)
-		{
-			// the "" is not an error - it turns into a single NUL byte!
-			writebytes("", 1, 1, of);
-			nskips--;
-		}
-		writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of);
-	}
-}
-
-void do_output_lwex0(FILE *of)
-{
-	int nskips = 0;		// used to output blanks for BSS inline
-	int sn;
-	int codedatasize = 0;
-	unsigned char buf[32];
-	
-	// calculate items for the file header
-	for (sn = 0; sn < nsects; sn++)
-	{
-		if (sectlist[sn].ptr -> flags & SECTION_BSS)
-		{
-			// no output for a BSS section
-			nskips += sectlist[sn].ptr -> codesize;
-			continue;
-		}
-		codedatasize += nskips;
-		nskips = 0;
-		codedatasize += sectlist[sn].ptr -> codesize;
-	}
-
-	// output the file header
-	buf[0] = 'L';
-	buf[1] = 'W';
-	buf[2] = 'E';
-	buf[3] = 'X';
-	buf[4] = 0;		// version 0
-	buf[5] = 0;		// low stack
-	buf[6] = linkscript.stacksize / 256;
-	buf[7] = linkscript.stacksize & 0xff;
-	buf[8] = nskips / 256;
-	buf[9] = nskips & 0xff;
-	buf[10] = codedatasize / 256;
-	buf[11] = codedatasize & 0xff;
-	buf[12] = linkscript.execaddr / 256;
-	buf[13] = linkscript.execaddr & 0xff;
-	memset(buf + 14, 0, 18);
-	
-	writebytes(buf, 1, 32, of);
-	// output the data
-	// NOTE: disjoint load addresses will not work correctly!!!!!
-	for (sn = 0; sn < nsects; sn++)
-	{
-		if (sectlist[sn].ptr -> flags & SECTION_BSS)
-		{
-			// no output for a BSS section
-			nskips += sectlist[sn].ptr -> codesize;
-			continue;
-		}
-		while (nskips > 0)
-		{
-			// the "" is not an error - it turns into a single NUL byte!
-			writebytes("", 1, 1, of);
-			nskips--;
-		}
-		writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of);
-	}
-}
--- a/old-trunk/lwlink/readfiles.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,425 +0,0 @@
-/*
-readfiles.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Reads input files
-
-*/
-
-#include <config.h>
-
-#include <argp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwlink.h"
-#include "util.h"
-
-void read_lwobj16v0(fileinfo_t *fn);
-void read_lwar1v(fileinfo_t *fn);
-
-/*
-The logic of reading the entire file into memory is simple. All the symbol
-names in the file are NUL terminated strings and can be used directly without
-making additional copies.
-*/
-void read_file(fileinfo_t *fn)
-{
-	if (!memcmp(fn -> filedata, "LWOBJ16", 8))
-		{
-			// read v0 LWOBJ16 file
-			read_lwobj16v0(fn);
-		}
-		else if (!memcmp(fn -> filedata, "LWAR1V", 6))
-		{
-			// archive file
-			read_lwar1v(fn);
-		}
-		else
-		{
-			fprintf(stderr, "%s: unknown file format\n", fn -> filename);
-			exit(1);
-		}
-}
-
-void read_files(void)
-{
-	int i;
-	long size;
-	FILE *f;
-	long bread;
-	for (i = 0; i < ninputfiles; i++)
-	{
-		if (inputfiles[i] -> islib)
-		{
-			char *tf;
-			int s;
-			int j;
-			
-			f = NULL;
-			
-			for (j = 0; j < nlibdirs; j++)
-			{
-				s = strlen(libdirs[j]) + 7 + strlen(inputfiles[i] -> filename);
-				tf = lw_malloc(s + 1);
-				sprintf(tf, "%s/lib%s.a", libdirs[j], inputfiles[i] -> filename);
-				f = fopen(tf, "rb");
-				if (!f)
-				{
-					free(tf);
-					continue;
-				}
-				free(tf);
-				break;
-			}
-			if (!f)
-			{
-				fprintf(stderr, "Can't open library: -l%s\n", inputfiles[i] -> filename);
-				exit(1);
-			}
-		}
-		else
-		{
-			f = fopen(inputfiles[i] -> filename, "rb");
-			if (!f)
-			{
-				fprintf(stderr, "Can't open file %s:", inputfiles[i] -> filename);
-				perror("");
-				exit(1);
-			}
-		}
-		fseek(f, 0, SEEK_END);
-		size = ftell(f);
-		rewind(f);
-		
-		inputfiles[i] -> filedata = lw_malloc(size);
-		inputfiles[i] -> filesize = size;
-		
-		bread = fread(inputfiles[i] -> filedata, 1, size, f);
-		if (bread < size)
-		{
-			fprintf(stderr, "Short read on file %s (%ld/%ld):", inputfiles[i] -> filename, bread, size);
-			perror("");
-			exit(1);
-		}
-			
-		fclose(f);
-		
-		read_file(inputfiles[i]);
-	}
-}
-
-// this macro is used to bail out if we run off the end of the file data
-// while parsing - it keeps the code below cleaner
-#define NEXTBYTE()	do { cc++; if (cc > fn -> filesize) { fprintf(stderr, "%s: invalid file format\n", fn -> filename); exit(1); } } while (0)
-// this macro is used to refer to the current byte in the stream
-#define CURBYTE()	(fn -> filedata[cc < fn -> filesize ? cc : fn -> filesize - 1])
-// this one will leave the input pointer past the trailing NUL
-#define CURSTR()	read_lwobj16v0_str(&cc, fn)
-unsigned char *read_lwobj16v0_str(long *cc1, fileinfo_t *fn)
-{
-	int cc = *cc1;
-	unsigned char *fp;
-	fp = &CURBYTE();
-	while (CURBYTE())
-		NEXTBYTE();
-	NEXTBYTE();
-	*cc1 = cc;
-	return fp;
-}
-// the function below can be switched to dealing with data coming from a
-// source other than an in-memory byte pool by adjusting the input data
-// in "fn" and the above two macros
-
-void read_lwobj16v0(fileinfo_t *fn)
-{
-	unsigned char *fp;
-	long cc;
-	section_t *s;
-	int val;
-	symtab_t *se;
-	
-	// start reading *after* the magic number
-	cc = 8;
-	
-	// init data
-	fn -> sections = NULL;
-	fn -> nsections = 0;
-
-	while (1)
-	{
-//		NEXTBYTE();
-		// bail out if no more sections
-		if (!(CURBYTE()))
-			break;
-		
-		fp = CURSTR();
-		
-		// we now have a section name in fp
-		// create new section entry
-		fn -> sections = lw_realloc(fn -> sections, sizeof(section_t) * (fn -> nsections + 1));
-		s = &(fn -> sections[fn -> nsections]);
-		fn -> nsections += 1;
-		
-		s -> localsyms = NULL;
-		s -> flags = 0;
-		s -> codesize = 0;
-		s -> name = fp;
-		s -> loadaddress = 0;
-		s -> localsyms = NULL;
-		s -> exportedsyms = NULL;
-		s -> incompletes = NULL;
-		s -> processed = 0;
-		s -> file = fn;
-		
-		// read flags
-		while (CURBYTE())
-		{
-			switch (CURBYTE())
-			{
-			case 0x01:
-				s -> flags |= SECTION_BSS;
-				break;
-
-			default:
-				fprintf(stderr, "%s (%s): unrecognized section flag %02X\n", fn -> filename, s -> name, (int)(CURBYTE()));
-				exit(1);
-			}
-			NEXTBYTE();
-		}
-		// skip NUL terminating flags
-		NEXTBYTE();
-		
-		// now parse the local symbol table
-		while (CURBYTE())
-		{
-			fp = CURSTR();
-
-			// fp is the symbol name
-			val = (CURBYTE()) << 8;
-			NEXTBYTE();
-			val |= (CURBYTE());
-			NEXTBYTE();
-			// val is now the symbol value
-			
-			// create symbol table entry
-			se = lw_malloc(sizeof(symtab_t));
-			se -> next = s -> localsyms;
-			s -> localsyms = se;
-			se -> sym = fp;
-			se -> offset = val;
-		}
-		// skip terminating NUL
-		NEXTBYTE();
-		
-		// now parse the exported symbol table
-		while (CURBYTE())
-		{
-			fp = CURSTR();
-
-			// fp is the symbol name
-			val = (CURBYTE()) << 8;
-			NEXTBYTE();
-			val |= (CURBYTE());
-			NEXTBYTE();
-			// val is now the symbol value
-			
-			// create symbol table entry
-			se = lw_malloc(sizeof(symtab_t));
-			se -> next = s -> exportedsyms;
-			s -> exportedsyms = se;
-			se -> sym = fp;
-			se -> offset = val;
-		}
-		// skip terminating NUL
-		NEXTBYTE();
-		
-		// now parse the incomplete references and make a list of
-		// external references that need resolution
-		while (CURBYTE())
-		{
-			reloc_t *rp;
-			lw_expr_term_t *term;
-			
-			// we have a reference
-			rp = lw_malloc(sizeof(reloc_t));
-			rp -> next = s -> incompletes;
-			s -> incompletes = rp;
-			rp -> offset = 0;
-			rp -> expr = lw_expr_stack_create();
-			rp -> flags = RELOC_NORM;
-			
-			// parse the expression
-			while (CURBYTE())
-			{
-				int tt = CURBYTE();
-				NEXTBYTE();
-				switch (tt)
-				{
-				case 0xFF:
-					// a flag specifier
-					tt = CURBYTE();
-					rp -> flags = tt;
-					NEXTBYTE();
-					term = NULL;
-					break;
-					
-				case 0x01:
-					// 16 bit integer
-					tt = CURBYTE() << 8;
-					NEXTBYTE();
-					tt |= CURBYTE();
-					NEXTBYTE();
-					// normalize for negatives...
-					if (tt > 0x7fff)
-						tt -= 0x10000;
-					term = lw_expr_term_create_int(tt);
-					break;
-				
-				case 0x02:
-					// external symbol reference
-					term = lw_expr_term_create_sym(CURSTR(), 0);
-					break;
-					
-				case 0x03:
-					// internal symbol reference
-					term = lw_expr_term_create_sym(CURSTR(), 1);
-					break;
-				
-				case 0x04:
-					// operator
-					term = lw_expr_term_create_oper(CURBYTE());
-					NEXTBYTE();
-					break;
-
-				case 0x05:
-					// section base reference (NULL internal reference is
-					// the section base address
-					term = lw_expr_term_create_sym(NULL, 1);
-					break;
-					
-				default:
-					fprintf(stderr, "%s (%s): bad relocation expression (%02X)\n", fn -> filename, s -> name, tt);
-					exit(1);
-				}
-				if (term)
-				{
-					lw_expr_stack_push(rp -> expr, term);
-					lw_expr_term_free(term);
-				}
-			}
-			// skip the NUL
-			NEXTBYTE();
-			
-			// fetch the offset
-			rp -> offset = CURBYTE() << 8;
-			NEXTBYTE();
-			rp -> offset |= CURBYTE() & 0xff;
-			NEXTBYTE();
-		}
-		// skip the NUL terminating the relocations
-		NEXTBYTE();
-				
-		// now set code location and size and verify that the file
-		// contains data going to the end of the code (if !SECTION_BSS)
-		s -> codesize = CURBYTE() << 8;
-		NEXTBYTE();
-		s -> codesize |= CURBYTE();
-		NEXTBYTE();
-		
-		s -> code = &(CURBYTE());
-		
-		// skip the code if we're not in a BSS section
-		if (!(s -> flags & SECTION_BSS))
-		{
-			int i;
-			for (i = 0; i < s -> codesize; i++)
-				NEXTBYTE();
-		}
-	}
-}
-
-/*
-Read an archive file - this will create a "sub" record and farm out the
-parsing of the sub files to the regular file parsers
-
-The archive file format consists of the 6 byte magic number followed by a
-series of records as follows:
-
-- NUL terminated file name
-- 32 bit file length in big endian order
-- the file data
-
-An empty file name indicates the end of the file.
-
-*/
-void read_lwar1v(fileinfo_t *fn)
-{
-	unsigned long cc = 6;
-	unsigned long flen;
-	unsigned long l;
-	for (;;)
-	{
-		if (cc >= fn -> filesize || !(fn -> filedata[cc]))
-			return;
-
-		for (l = cc; cc < fn -> filesize && fn -> filedata[cc]; cc++)
-			/* do nothing */ ;
-
-		cc++;
-
-		if (cc >= fn -> filesize)
-		{
-			fprintf(stderr, "Malformed archive file %s.\n", fn -> filename);
-			exit(1);
-		}
-
-		if (cc + 4 > fn -> filesize)
-			return;
-
-		flen = (fn -> filedata[cc++] << 24);
-		flen |= (fn -> filedata[cc++] << 16);
-		flen |= (fn -> filedata[cc++] << 8);
-		flen |= (fn -> filedata[cc++]);
-
-		if (flen == 0)
-			return;
-		
-		if (cc + flen > fn -> filesize)
-		{
-			fprintf(stderr, "Malformed archive file %s.\n", fn -> filename);
-			exit(1);
-		}
-		
-		// add the "sub" input file
-		fn -> subs = lw_realloc(fn -> subs, sizeof(fileinfo_t *) * (fn -> nsubs + 1));
-		fn -> subs[fn -> nsubs] = lw_malloc(sizeof(fileinfo_t));
-		memset(fn -> subs[fn -> nsubs], 0, sizeof(fileinfo_t));
-		fn -> subs[fn -> nsubs] -> filedata = fn -> filedata + cc;
-		fn -> subs[fn -> nsubs] -> filesize = flen;
-		fn -> subs[fn -> nsubs] -> filename = lw_strdup(fn -> filedata + l);
-		fn -> subs[fn -> nsubs] -> parent = fn;
-		fn -> subs[fn -> nsubs] -> forced = fn -> forced;		
-		read_file(fn -> subs[fn -> nsubs]);
-		fn -> nsubs++;
-		cc += flen;
-	}
-}
--- a/old-trunk/lwlink/script.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-/*
-script.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Read and parse linker scripts
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lwlink.h"
-#include "util.h"
-
-// the built-in DECB target linker script
-static char *decb_script =
-	"section init load 2000\n"
-	"section code\n"
-	"section *,!bss\n"
-	"section *,bss\n"
-	"entry 2000\n"
-	;
-
-// the built-in RAW target linker script
-static char *raw_script = 
-	"section init load 0000\n"
-	"section code\n"
-	"section *,!bss\n"
-	"section *,bss\n"
-	;
-
-static char *lwex0_script =
-	"section init load 0100\n"
-	"section .text\n"
-	"section .data\n"
-	"section *,!bss\n"
-	"section *,bss\n"
-	"entry __start\n"
-	"stacksize 0100\n"		// default 256 byte stack
-	;
-
-// the "simple" script
-static char *simple_script = 
-	"section *,!bss\n"
-	"section *,bss\n"
-	;
-
-linkscript_t linkscript = { 0, NULL, -1 };
-
-void setup_script()
-{
-	char *script, *oscript;
-	long size;
-
-	// read the file if needed
-	if (scriptfile)
-	{
-		FILE *f;
-		long bread;
-		
-		f = fopen(scriptfile, "rb");
-		if (!f)
-		{
-			fprintf(stderr, "Can't open file %s:", scriptfile);
-			perror("");
-			exit(1);
-		}
-		fseek(f, 0, SEEK_END);
-		size = ftell(f);
-		rewind(f);
-		
-		script = lw_malloc(size + 2);
-		
-		bread = fread(script, 1, size, f);
-		if (bread < size)
-		{
-			fprintf(stderr, "Short read on file %s (%ld/%ld):", scriptfile, bread, size);
-			perror("");
-			exit(1);
-		}
-		fclose(f);
-		
-		script[size] = '\n';
-		script[size + 1] = '\0';
-	}
-	else
-	{
-		// fetch defaults based on output mode
-		switch (outformat)
-		{
-		case OUTPUT_RAW:
-			script = raw_script;
-			break;
-		
-		case OUTPUT_DECB:
-			script = decb_script;
-			break;
-		
-		case OUTPUT_LWEX0:
-			script = lwex0_script;
-			break;
-			
-		default:
-			script = simple_script;
-			break;
-		}
-		
-		size = strlen(script);
-		if (nscriptls)
-		{
-			char *rscript;
-			int i;
-			// prepend the "extra" script lines
-			for (i = 0; i < nscriptls; i++)
-				size += strlen(scriptls[i]) + 1;
-			
-			rscript = lw_malloc(size + 1);
-			oscript = rscript;
-			for (i = 0; i < nscriptls; i++)
-			{
-				oscript += sprintf(oscript, "%s\n", scriptls[i]);
-			}
-			strcpy(oscript, script);
-			script = rscript;
-		}
-	}
-
-	if (outformat == OUTPUT_LWEX0)
-		linkscript.stacksize = 0x100;
-
-	oscript = script;
-	// now parse the script file
-	while (*script)
-	{
-		char *ptr, *ptr2, *line;
-
-		for (ptr = script; *ptr && *ptr != '\n' && *ptr != '\r'; ptr++)
-			/* do nothing */ ;
-		
-		line = lw_malloc(ptr - script + 1);
-		memcpy(line, script, ptr - script);
-		line[ptr - script] = '\0';
-
-		// skip line terms
-		for (script = ptr + 1; *script == '\n' || *script == '\r'; script++)
-			/* do nothing */ ;
-		
-		// ignore leading whitespace
-		for (ptr = line; *ptr && isspace(*ptr); ptr++)
-			/* do nothing */ ;
-		
-		// ignore blank lines
-		if (!*ptr)
-			continue;
-		
-		for (ptr = line; *ptr && !isspace(*ptr); ptr++)
-			/* do nothing */ ;
-		
-		// now ptr points to the char past the first word
-		// NUL it out
-		if (*ptr)
-			*ptr++ = '\0';
-		
-		// skip spaces after the first word
-		for ( ; *ptr && isspace(*ptr); ptr++)
-			/* do nothing */ ;
-		
-		if (!strcmp(line, "pad"))
-		{
-			// padding
-			// parse the hex number and stow it
-			linkscript.padsize = strtol(ptr, NULL, 16);
-			if (linkscript.padsize < 0)
-				linkscript.padsize = 0;
-		}
-		else if (!strcmp(line, "stacksize"))
-		{
-			// stack size for targets that support it
-			// parse the hex number and stow it
-			linkscript.padsize = strtol(ptr, NULL, 16);
-			if (linkscript.stacksize < 0)
-				linkscript.stacksize = 0x100;
-		}
-		else if (!strcmp(line, "entry"))
-		{
-			int eaddr;
-			
-			eaddr = strtol(ptr, &ptr2, 16);
-			if (*ptr2)
-			{
-				linkscript.execaddr = -1;
-				linkscript.execsym = lw_strdup(ptr);
-			}
-			else
-			{
-				linkscript.execaddr = eaddr;
-				linkscript.execsym = NULL;
-			}
-		}
-		else if (!strcmp(line, "section"))
-		{
-			// section
-			// parse out the section name and flags
-			for (ptr2 = ptr; *ptr2 && !isspace(*ptr2); ptr2++)
-				/* do nothing */ ;
-			
-			if (*ptr2)
-				*ptr2++ = '\0';
-			
-			while (*ptr2 && isspace(*ptr2))
-				ptr2++;
-				
-			// ptr now points to the section name and flags and ptr2
-			// to the first non-space character following
-			
-			// then look for "load <addr>" clause
-			if (*ptr2)
-			{
-				if (!strncmp(ptr2, "load", 4))
-				{
-					ptr2 += 4;
-					while (*ptr2 && isspace(*ptr2))
-						ptr2++;
-					
-				}
-				else
-				{
-					fprintf(stderr, "%s: bad script\n", scriptfile);
-					exit(1);
-				}
-			}
-			
-			// now ptr2 points to the load address if there is one
-			// or NUL if not
-			linkscript.lines = lw_realloc(linkscript.lines, sizeof(struct scriptline_s) * (linkscript.nlines + 1));
-
-			linkscript.lines[linkscript.nlines].noflags = 0;
-			linkscript.lines[linkscript.nlines].yesflags = 0;
-			if (*ptr2)
-				linkscript.lines[linkscript.nlines].loadat = strtol(ptr2, NULL, 16);
-			else
-				linkscript.lines[linkscript.nlines].loadat = -1;
-			for (ptr2 = ptr; *ptr2 && *ptr2 != ','; ptr2++)
-				/* do nothing */ ;
-			if (*ptr2)
-			{
-				*ptr2++ = '\0';
-				if (!strcmp(ptr2, "!bss"))
-				{
-					linkscript.lines[linkscript.nlines].noflags = SECTION_BSS;
-				}
-				else if (!strcmp(ptr2, "bss"))
-				{
-					linkscript.lines[linkscript.nlines].yesflags = SECTION_BSS;
-				}
-				else
-				{
-					fprintf(stderr, "%s: bad script\n", scriptfile);
-					exit(1);
-				}
-			}
-			if (ptr[0] == '*' && ptr[1] == '\0')
-				linkscript.lines[linkscript.nlines].sectname = NULL;
-			else
-				linkscript.lines[linkscript.nlines].sectname = lw_strdup(ptr);
-			linkscript.nlines++;
-		}
-		else
-		{
-			fprintf(stderr, "%s: bad script\n", scriptfile);
-			exit(1);
-		}
-		lw_free(line);
-	}
-	
-	if (scriptfile || nscriptls)
-		lw_free(oscript);
-}
--- a/old-trunk/lwlink/util.c	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
-util.c
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Utility functions
-*/
-
-#define __util_c_seen__
-#include <config.h>
-
-#include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "util.h"
-
-void *lw_malloc(int size)
-{
-	void *ptr;
-	
-	ptr = malloc(size);
-	if (!ptr)
-	{
-		// bail out; memory allocation error
-		fprintf(stderr, "lw_malloc(): Memory allocation error\n");
-		exit(1);
-	}
-	return ptr;
-}
-
-void *lw_realloc(void *optr, int size)
-{
-	void *ptr;
-	
-	if (size == 0)
-	{
-		lw_free(optr);
-		return;
-	}
-	
-	ptr = realloc(optr, size);
-	if (!ptr)
-	{
-		fprintf(stderr, "lw_realloc(): memory allocation error\n");
-		exit(1);
-	}
-}
-
-void lw_free(void *ptr)
-{
-	if (ptr)
-		free(ptr);
-}
-
-char *lw_strdup(const char *s)
-{
-	char *d;
-	
-	if (!s)
-		return NULL;
-
-	d = strdup(s);
-	if (!d)
-	{
-		fprintf(stderr, "lw_strdup(): memory allocation error\n");
-		exit(1);
-	}
-	
-	return d;
-}
--- a/old-trunk/lwlink/util.h	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-util.h
-Copyright © 2009 William Astle
-
-This file is part of LWLINK.
-
-LWLINK is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
-Utility functions
-*/
-
-#ifndef __util_h_seen__
-#define __util_h_seen__
-
-#ifndef __util_c_seen__
-#define __util_E__ extern
-#else
-#define __util_E__
-#endif
-
-// allocate memory
-__util_E__ void *lw_malloc(int size);
-__util_E__ void lw_free(void *ptr);
-__util_E__ void *lw_realloc(void *optr, int size);
-
-// string stuff
-__util_E__ char *lw_strdup(const char *s);
-
-#undef __util_E__
-
-#endif // __util_h_seen__
--- a/old-trunk/m4/gnulib-cache.m4	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
-#
-# This file is free software, distributed under the terms of the GNU
-# General Public License.  As a special exception to the GNU General
-# Public License, this file may be distributed as part of a program
-# that contains a configuration script generated by Autoconf, under
-# the same distribution terms as the rest of that program.
-#
-# Generated by gnulib-tool.
-#
-# This file represents the specification of how gnulib-tool is used.
-# It acts as a cache: It is written and read by gnulib-tool.
-# In projects using CVS, this file is meant to be stored in CVS,
-# like the configure.ac and various Makefile.am files.
-
-
-# Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp
-
-# Specification in the form of a few gnulib-tool.m4 macro invocations:
-gl_LOCAL_DIR([])
-gl_MODULES([
-  argp
-])
-gl_AVOID([])
-gl_SOURCE_BASE([lib])
-gl_M4_BASE([m4])
-gl_PO_BASE([])
-gl_DOC_BASE([doc])
-gl_TESTS_BASE([tests])
-gl_LIB([libgnu])
-gl_MAKEFILE_NAME([])
-gl_MACRO_PREFIX([gl])
-gl_PO_DOMAIN([])
--- a/old-trunk/misc/fileheader	Mon Apr 26 19:30:44 2010 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-Copyright © 2008 William Astle
-
-This file is part of LWASM.
-
-LWASM is free software: you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.