mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-11 23:53:19 +00:00
pdp10-tools: Add GPL License and a README, remove old 'as' prototype
This commit is contained in:
parent
68a213eb76
commit
af1fd536c2
18
8to9/8to9.c
18
8to9/8to9.c
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* 8to9.c
|
||||
* 8to9.c -- convert octet files to nonet files
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* Convert octet files to nonet files.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# 8to9/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
674
COPYING
Normal file
674
COPYING
Normal file
@ -0,0 +1,674 @@
|
||||
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>.
|
||||
18
Makefile
18
Makefile
@ -1,3 +1,21 @@
|
||||
# Makefile for pdp10-tools
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
SUBDIRS= lib 8to9 ar as nm od readelf
|
||||
|
||||
all:
|
||||
|
||||
42
README
Normal file
42
README
Normal file
@ -0,0 +1,42 @@
|
||||
# README for pdp10-tools
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson <mikpelinux@gmail.com>
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
PDP10-TOOLS
|
||||
===========
|
||||
|
||||
pdp10-tools is a collection of utilities for manipulating pdp10-elf
|
||||
binary files.
|
||||
|
||||
ar: an 'ar' clone for pdp10-elf object files
|
||||
as: a pdp10 assembler producing pdp10-elf object files
|
||||
intended primarily as an assembler for GCC output;
|
||||
the syntax is modelled after normal UNIX/ELF syntax
|
||||
rather than classic TOPS-10, TOPS-20, or ITS syntax
|
||||
nm: an 'nm' clone for pdp10-elf object files
|
||||
od: an 'od' clone for binary files with 9-bit bytes (nonets)
|
||||
readelf: a 'readelf' clone for pdp10-elf object files,
|
||||
extended with an option to disassemble .text sections
|
||||
8to9: a utility to convert octet files to nonet files
|
||||
|
||||
pdp10-stdio: a library for reading and writing nonet-based data
|
||||
on an octet-based host
|
||||
pdp10-elf36: a library for reading and writing Elf36 object files
|
||||
|
||||
|
||||
See the TODO file for known omissions and planned improvements.
|
||||
24
TODO
24
TODO
@ -1,3 +1,22 @@
|
||||
# TODO notes for pdp10-tools
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson <mikpelinux@gmail.com>
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
Elf36 Specification:
|
||||
|
||||
- Do we want to adjust SHN_LORESERVE up to SHN_HIRESERVE, including SHN_XINDEX, to
|
||||
@ -20,7 +39,12 @@ Tools:
|
||||
- ld: implement it
|
||||
- readelf: add support for relocs
|
||||
- readelf: add support for program headers
|
||||
- pdp10-opcodes.{h,c}: rewrite completely
|
||||
- as:
|
||||
* add line-comment character, e.g. '#'
|
||||
+ use it in doc/MUUO.txt
|
||||
+ use it in as/tests/*.s
|
||||
+ add license boilerplate to the above files
|
||||
* support .ident:
|
||||
+ change strtab to have a finalizer which returns an image array,
|
||||
+ use standard output_section for strtab
|
||||
|
||||
18
ar/Makefile
18
ar/Makefile
@ -1,3 +1,21 @@
|
||||
# ar/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
18
ar/ar.c
18
ar/ar.c
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* ar.c
|
||||
* ar.c -- ar clone
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* ar clone for PDP10 files with 9-bit bytes
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
OBJS= arrlst.o charbuf.o emalloc.o htab.o main.o parse.o pass1.o scan.o section.o strtab.o token.o
|
||||
|
||||
all: $(OBJS)
|
||||
|
||||
arrlst.o: arrlst.h emalloc.h
|
||||
charbuf.o: charbuf.h emalloc.h
|
||||
emalloc.o: emalloc.h
|
||||
htab.o: emalloc.h htab.h
|
||||
main.o: pass1.h
|
||||
parse.o: emalloc.h parse.h scan.h token.h token.def stmt.h expr.h strtab.h section.h ../include/pdp10-stdint.h ../include/pdp10-elf36.h
|
||||
pass1.o: parse.h pass1.h scan.h section.h stmt.h expr.h token.h ../include/pdp10-elf36.h arrlst.h htab.h strtab.h ../include/pdp10-stdint.h
|
||||
scan.o: charbuf.h scan.h token.h token.def ../include/pdp10-stdint.h
|
||||
section.o: emalloc.h htab.h section.h arrlst.h stmt.h expr.h strtab.h ../include/pdp10-elf36.h ../include/pdp10-stdint.h
|
||||
strtab.o: emalloc.h htab.h strtab.h
|
||||
token.o: ../include/pdp10-inttypes.h token.h token.def
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) a.out core core.*
|
||||
@ -1,52 +0,0 @@
|
||||
* strip whitespace, leave one space before a keyword on a line, compress any
|
||||
other whitespace to a single space
|
||||
* white is blank, tab, /* ... */
|
||||
* target-spec line comment, .e.g. #
|
||||
* symbol = [letter | _ | . | $] [letter | _ | . | $ | digit]*
|
||||
* stmt: {label}* { directive | instruction | empty }
|
||||
|
||||
* %r0..%r15 with %sp == %r15 ? (no, % is also an operator)
|
||||
* $0..$15 with $sp == $15? (yes, these are just symbols)
|
||||
|
||||
|
||||
* PDP10 syntax:
|
||||
|
||||
mnemonic accumulator,address
|
||||
|
||||
movem 1,foo
|
||||
|
||||
mnemonic accumulator,
|
||||
|
||||
popj 17,
|
||||
|
||||
mnemonic address
|
||||
|
||||
setzm foo
|
||||
|
||||
skipe 0(16)
|
||||
|
||||
address prefixed by "@" makes it indirect
|
||||
|
||||
setzm @foo
|
||||
|
||||
address suffixed by "(ixreg)" makes it indexed
|
||||
|
||||
setzm 3(16)
|
||||
|
||||
|
||||
";" is line comment char
|
||||
|
||||
foo ;comment
|
||||
|
||||
radix is 8 by default; a single-digit number is always decimal
|
||||
radix can be changed by the RADIX directive
|
||||
a number can indicate its radix by a ^B, ^O, or ^D prefix (XXX: add ^X for hex)
|
||||
|
||||
symbols can use letters, digits, dot, dollar, and percent signs
|
||||
|
||||
exp1,,exp2 assembles two 18-bit expressions into a 36-bit value
|
||||
|
||||
< expr > parenteses
|
||||
|
||||
there is no "semi-colon" like symbol for putting multiple statements
|
||||
on a single line
|
||||
28
as/0LD/TODO
28
as/0LD/TODO
@ -1,28 +0,0 @@
|
||||
section text
|
||||
* subsection text0
|
||||
** frag0, frag1, ... each being sth that generates object code
|
||||
* subsection test1
|
||||
** frag...
|
||||
section data
|
||||
* subsection data0
|
||||
** frag...
|
||||
|
||||
array of sections (ELF allows user-defined ones)
|
||||
a section is array of subsections, sorted and concatenated during output, ld sees no subsections
|
||||
a subsection is array of fragments
|
||||
a fragment describes a directive, an insn, a label defn
|
||||
|
||||
pass1 parses .s text, creates frags, and appends them to subsections
|
||||
|
||||
pass2 computes labels
|
||||
|
||||
pass3 outputs concatenated data in ELF form
|
||||
|
||||
helpers
|
||||
* string table
|
||||
* symbol table
|
||||
* section table
|
||||
|
||||
copy ELF32 headers and use them throughout, esp. for symbol/section types etc
|
||||
|
||||
Look up section group and comdat in sco elf draft html pages.
|
||||
186
as/0LD/arrlst.c
186
as/0LD/arrlst.c
@ -1,186 +0,0 @@
|
||||
/*
|
||||
* arrlst.c
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "arrlst.h"
|
||||
#include "emalloc.h"
|
||||
|
||||
enum {
|
||||
ARRLST_CHUNK_NRELEM = 128,
|
||||
};
|
||||
|
||||
struct arrlst {
|
||||
void *head;
|
||||
void *tail;
|
||||
unsigned int eltsz;
|
||||
unsigned int tailpos;
|
||||
|
||||
/* We only allow a single iterator per arrlst, so we
|
||||
allocate the iterator in the arrlst itself. */
|
||||
struct {
|
||||
void *chunk;
|
||||
unsigned int chunkpos;
|
||||
unsigned int chunklen;
|
||||
} iter;
|
||||
};
|
||||
|
||||
static void **arrlst_chunk_nextp(const void *chunk)
|
||||
{
|
||||
return (void**)chunk;
|
||||
}
|
||||
|
||||
static unsigned int eltsz_chunk_header_nrelem(unsigned int eltsz)
|
||||
{
|
||||
unsigned int nrelem;
|
||||
|
||||
/* compute how may eltsz elements are needed to cover a void* */
|
||||
nrelem = sizeof(void*) / eltsz;
|
||||
if (nrelem * eltsz < sizeof(void*))
|
||||
++nrelem;
|
||||
|
||||
return nrelem;
|
||||
}
|
||||
|
||||
static unsigned int arrlst_chunk_header_nrelem(const struct arrlst *arrlst)
|
||||
{
|
||||
return eltsz_chunk_header_nrelem(arrlst->eltsz);
|
||||
}
|
||||
|
||||
static void *arrlst_chunk_element(const struct arrlst *arrlst, void *chunk, unsigned int eltnr)
|
||||
{
|
||||
return (char*)chunk + eltnr * arrlst->eltsz;
|
||||
}
|
||||
|
||||
static void *arrlst_alloc_chunk(const struct arrlst *arrlst)
|
||||
{
|
||||
unsigned int nrbytes;
|
||||
void *chunk;
|
||||
|
||||
nrbytes = arrlst->eltsz * ARRLST_CHUNK_NRELEM;
|
||||
chunk = emalloc(nrbytes);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
struct arrlst *arrlst_alloc(size_t eltsz)
|
||||
{
|
||||
struct arrlst *arrlst;
|
||||
|
||||
if (eltsz == 0
|
||||
|| eltsz > (unsigned int)-1
|
||||
|| eltsz_chunk_header_nrelem(eltsz) >= ARRLST_CHUNK_NRELEM)
|
||||
return NULL;
|
||||
|
||||
arrlst = emalloc(sizeof *arrlst);
|
||||
|
||||
/* these fields will be adjusted in the first call to append() */
|
||||
arrlst->head = NULL;
|
||||
arrlst->tail = NULL;
|
||||
arrlst->eltsz = eltsz;
|
||||
arrlst->tailpos = ARRLST_CHUNK_NRELEM;
|
||||
|
||||
return arrlst;
|
||||
}
|
||||
|
||||
void arrlst_free(struct arrlst *arrlst)
|
||||
{
|
||||
void *chunk, *next;
|
||||
|
||||
chunk = arrlst->head;
|
||||
while (chunk) {
|
||||
next = *arrlst_chunk_nextp(chunk);
|
||||
free(chunk);
|
||||
chunk = next;
|
||||
}
|
||||
|
||||
free(arrlst);
|
||||
}
|
||||
|
||||
size_t arrlst_length(const struct arrlst *arrlst)
|
||||
{
|
||||
const void *chunk;
|
||||
size_t length;
|
||||
size_t chunk_header_nrelem;
|
||||
|
||||
chunk = arrlst->head;
|
||||
if (!chunk)
|
||||
return 0;
|
||||
length = 0;
|
||||
chunk_header_nrelem = arrlst_chunk_header_nrelem(arrlst);
|
||||
for (;;) {
|
||||
chunk = *arrlst_chunk_nextp(chunk);
|
||||
if (!chunk)
|
||||
break;
|
||||
length += ARRLST_CHUNK_NRELEM - chunk_header_nrelem;
|
||||
}
|
||||
return length + arrlst->tailpos - chunk_header_nrelem;
|
||||
}
|
||||
|
||||
void *arrlst_append(struct arrlst *arrlst)
|
||||
{
|
||||
void *tail;
|
||||
void *elt;
|
||||
|
||||
tail = arrlst->tail;
|
||||
|
||||
if (arrlst->tailpos >= ARRLST_CHUNK_NRELEM) {
|
||||
void *new_tail;
|
||||
|
||||
new_tail = arrlst_alloc_chunk(arrlst);
|
||||
if (!new_tail)
|
||||
return NULL;
|
||||
|
||||
if (tail)
|
||||
*arrlst_chunk_nextp(tail) = new_tail;
|
||||
else {
|
||||
arrlst->head = new_tail;
|
||||
arrlst->tail = new_tail;
|
||||
}
|
||||
|
||||
arrlst->tailpos = arrlst_chunk_header_nrelem(arrlst);
|
||||
|
||||
tail = new_tail;
|
||||
}
|
||||
|
||||
elt = arrlst_chunk_element(arrlst, tail, arrlst->tailpos);
|
||||
++arrlst->tailpos;
|
||||
|
||||
return elt;
|
||||
}
|
||||
|
||||
void arrlst_iter_rewind(struct arrlst *arrlst)
|
||||
{
|
||||
/* these fields will be adjusted in the first call to next() */
|
||||
arrlst->iter.chunk = NULL;
|
||||
arrlst->iter.chunklen = 0;
|
||||
arrlst->iter.chunkpos = 0;
|
||||
}
|
||||
|
||||
void *arrlst_iter_next(struct arrlst *arrlst)
|
||||
{
|
||||
void *chunk;
|
||||
void *elt;
|
||||
|
||||
chunk = arrlst->iter.chunk;
|
||||
if (arrlst->iter.chunkpos >= arrlst->iter.chunklen) {
|
||||
if (!chunk)
|
||||
chunk = arrlst->head;
|
||||
else
|
||||
chunk = *arrlst_chunk_nextp(chunk);
|
||||
if (!chunk)
|
||||
return NULL;
|
||||
arrlst->iter.chunk = chunk;
|
||||
|
||||
if (*arrlst_chunk_nextp(chunk))
|
||||
arrlst->iter.chunklen = ARRLST_CHUNK_NRELEM;
|
||||
else
|
||||
arrlst->iter.chunklen = arrlst->tailpos;
|
||||
|
||||
arrlst->iter.chunkpos = arrlst_chunk_header_nrelem(arrlst);
|
||||
}
|
||||
|
||||
elt = arrlst_chunk_element(arrlst, chunk, arrlst->iter.chunkpos);
|
||||
++arrlst->iter.chunkpos;
|
||||
|
||||
return elt;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* arrlst.h
|
||||
*/
|
||||
#ifndef ARRLST_H
|
||||
#define ARRLST_H
|
||||
|
||||
#include <stdlib.h> /* size_t */
|
||||
|
||||
struct arrlst;
|
||||
|
||||
struct arrlst *arrlst_alloc(size_t eltsz);
|
||||
void arrlst_free(struct arrlst *arrlst);
|
||||
size_t arrlst_length(const struct arrlst *arrlst);
|
||||
void *arrlst_append(struct arrlst *arrlst);
|
||||
|
||||
/* for now there is only one iterator per arrlst */
|
||||
void arrlst_iter_rewind(struct arrlst *arrlst);
|
||||
void *arrlst_iter_next(struct arrlst *arrlst);
|
||||
|
||||
#endif /* ARRLST_H */
|
||||
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* charbuf.c
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "charbuf.h"
|
||||
#include "emalloc.h"
|
||||
|
||||
void charbuf_init(struct charbuf *charbuf)
|
||||
{
|
||||
charbuf->head.next = NULL;
|
||||
charbuf->tail = &charbuf->head;
|
||||
charbuf->pos = 0;
|
||||
}
|
||||
|
||||
void charbuf_fini(struct charbuf *charbuf)
|
||||
{
|
||||
struct charbuf_chunk *chunk, *next;
|
||||
|
||||
chunk = charbuf->head.next;
|
||||
while (chunk != NULL) {
|
||||
next = chunk->next;
|
||||
free(chunk);
|
||||
chunk = next;
|
||||
}
|
||||
}
|
||||
|
||||
void charbuf_append(struct charbuf *charbuf, int ch)
|
||||
{
|
||||
struct charbuf_chunk *tail, *next;
|
||||
unsigned int pos;
|
||||
|
||||
tail = charbuf->tail;
|
||||
pos = charbuf->pos;
|
||||
if (pos >= sizeof tail->buf) {
|
||||
next = emalloc(sizeof *next);
|
||||
next->next = NULL;
|
||||
tail->next = next;
|
||||
tail = next;
|
||||
charbuf->tail = tail;
|
||||
pos = 0;
|
||||
}
|
||||
tail->buf[pos] = ch;
|
||||
charbuf->pos = pos + 1;
|
||||
}
|
||||
|
||||
int charbuf_strcmp(const struct charbuf *charbuf, const char *string)
|
||||
{
|
||||
const struct charbuf_chunk *chunk;
|
||||
int cmp;
|
||||
|
||||
chunk = &charbuf->head;
|
||||
while (chunk->next != NULL) {
|
||||
cmp = strncmp(chunk->buf, string, sizeof chunk->buf);
|
||||
if (cmp)
|
||||
return cmp;
|
||||
string += sizeof chunk->buf;
|
||||
chunk = chunk->next;
|
||||
}
|
||||
return strncmp(chunk->buf, string, charbuf->pos);
|
||||
}
|
||||
|
||||
char *charbuf_string(const struct charbuf *charbuf)
|
||||
{
|
||||
const struct charbuf_chunk *chunk;
|
||||
size_t nrbytes;
|
||||
char *string, *strp;
|
||||
|
||||
chunk = &charbuf->head;
|
||||
nrbytes = 0;
|
||||
while (chunk->next != NULL) {
|
||||
nrbytes += sizeof chunk->buf;
|
||||
chunk = chunk->next;
|
||||
}
|
||||
nrbytes = nrbytes + charbuf->pos + 1;
|
||||
|
||||
string = emalloc(nrbytes);
|
||||
|
||||
chunk = &charbuf->head;
|
||||
strp = string;
|
||||
while (chunk->next != NULL) {
|
||||
memcpy(strp, chunk->buf, sizeof chunk->buf);
|
||||
strp += sizeof chunk->buf;
|
||||
chunk = chunk->next;
|
||||
}
|
||||
memcpy(strp, chunk->buf, charbuf->pos);
|
||||
strp[charbuf->pos] = '\0';
|
||||
|
||||
return string;
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* charbuf.h
|
||||
*/
|
||||
#ifndef CHARBUF_H
|
||||
#define CHARBUF_H
|
||||
|
||||
struct charbuf_chunk {
|
||||
char buf[128 - sizeof(struct charbuf_chunk*)];
|
||||
struct charbuf_chunk *next;
|
||||
};
|
||||
|
||||
struct charbuf {
|
||||
struct charbuf_chunk head;
|
||||
struct charbuf_chunk *tail; /* INV: tail->next == NULL */
|
||||
unsigned int pos; /* in tail chunk */
|
||||
};
|
||||
|
||||
void charbuf_init(struct charbuf *charbuf);
|
||||
void charbuf_fini(struct charbuf *charbuf);
|
||||
void charbuf_append(struct charbuf *charbuf, int ch);
|
||||
int charbuf_strcmp(const struct charbuf *charbuf, const char *string);
|
||||
char *charbuf_string(const struct charbuf *charbuf);
|
||||
|
||||
#endif /* CHARBUF_H */
|
||||
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* emalloc.c
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "emalloc.h"
|
||||
|
||||
void *emalloc(size_t nrbytes)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = malloc(nrbytes);
|
||||
if (!p) {
|
||||
fprintf(stderr, "malloc(%zu) failed: %s\n", nrbytes, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
/*
|
||||
* emalloc.h
|
||||
*/
|
||||
#ifndef EMALLOC_H
|
||||
#define EMALLOC_H
|
||||
|
||||
#include <stddef.h> /* size_t */
|
||||
|
||||
void *emalloc(size_t nrbytes);
|
||||
|
||||
#endif /* EMALLOC_H */
|
||||
168
as/0LD/expr.c
168
as/0LD/expr.c
@ -1,168 +0,0 @@
|
||||
/*
|
||||
* expr.c
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "pdp10-arith.h"
|
||||
#include "expr.h"
|
||||
|
||||
int eval(const struct expr *expr, struct value *value, int quiet)
|
||||
{
|
||||
switch (expr->tag) {
|
||||
case E_UINTEGER:
|
||||
value->section = SECTION_ABS;
|
||||
value->offset = expr->u.e_uinteger.val;
|
||||
break;
|
||||
case E_SYMBOL:
|
||||
xxx;
|
||||
break;
|
||||
case E_UNARY:
|
||||
if (eval(expr->u.e_unary.expr, value, quiet) < 0)
|
||||
return -1;
|
||||
if (value->section != SECTION_ABS) {
|
||||
if (!quiet)
|
||||
fprintf(stderr, "as: %s(): unary operand is not absolute\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
switch (expr->u.e_unary.unop) {
|
||||
case E_UMINUS:
|
||||
value->offset = pdp10_neg_int36(value->offset);
|
||||
break;
|
||||
case E_NOT:
|
||||
value->offset = pdp10_not_int36(value->offset);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case E_BINARY:
|
||||
{
|
||||
struct value value2;
|
||||
|
||||
if (eval(expr->u.e_binary.expr1, value, quiet) < 0
|
||||
|| eval(expr->u.e_binary.expr2, &value2, quiet) < 0)
|
||||
return -1;
|
||||
|
||||
switch (expr->u.e_binary.binop) {
|
||||
case E_ADD:
|
||||
if (value->section == SECTION_ABS)
|
||||
value->section = value2.section;
|
||||
else if (value2.section == SECTION_ABS)
|
||||
;
|
||||
else if (value->section == value2.section)
|
||||
;
|
||||
else {
|
||||
if (!quiet)
|
||||
fprintf(stderr, "as: %s(): adding operands from different sections\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
value->offset = pdp10_add_int36(value->offset, value2.offset);
|
||||
return 0;
|
||||
case E_SUB:
|
||||
if (value2.section == SECTION_ABS)
|
||||
;
|
||||
else if (value->section == value2.section)
|
||||
value->section = SECTION_ABS;
|
||||
else {
|
||||
if (!quiet)
|
||||
fprintf(stderr, "as: %s(): subtracting operands from different sections\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
value->offset = pdp10_sub_int36(value->offset, value2.offset);
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (value->section != SECTION_ABS
|
||||
|| value2.section != SECTION_ABS) {
|
||||
if (!quiet)
|
||||
fprintf(stderr, "as: %s(): binary sub-<expr> is not absolute\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
switch (expr->u.e_binary.binop) {
|
||||
case E_MUL:
|
||||
value->offset = pdp10_mul_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_DIV:
|
||||
/* XXX: div-by-zero check */
|
||||
value->offset = pdp10_div_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_REM:
|
||||
/* XXX: div-by-zero check */
|
||||
value->offset = pdp10_rem_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_LSHIFT:
|
||||
/* XXX: range check */
|
||||
value->offset = pdp10_asl_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_RSHIFT:
|
||||
/* XXX: range check */
|
||||
value->offset = pdp10_asr_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_OR:
|
||||
value->offset = pdp10_or_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_AND:
|
||||
value->offset = pdp10_and_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_XOR:
|
||||
value->offset = pdp10_xor_int36(value->offset, value2.offset);
|
||||
break;
|
||||
case E_ORNOT:
|
||||
value->offset = pdp10_or_int36(value->offset, pdp10_not_int36(value2.offset));
|
||||
break;
|
||||
case E_EQ:
|
||||
value->offset = pdp10_eq_int36(value->offset, value2.offset) ? PDP10_UINT36_MAX : 0;
|
||||
break;
|
||||
case E_NE:
|
||||
value->offset = pdp10_ne_int36(value->offset, value2.offset) ? PDP10_UINT36_MAX : 0;
|
||||
break;
|
||||
case E_LT:
|
||||
value->offset = pdp10_lt_int36(value->offset, value2.offset) ? PDP10_UINT36_MAX : 0;
|
||||
break;
|
||||
case E_GT:
|
||||
value->offset = pdp10_gt_int36(value->offset, value2.offset) ? PDP10_UINT36_MAX : 0;
|
||||
break;
|
||||
case E_GE:
|
||||
value->offset = pdp10_ge_int36(value->offset, value2.offset) ? PDP10_UINT36_MAX : 0;
|
||||
break;
|
||||
case E_LE:
|
||||
value->offset = pdp10_le_int36(value->offset, value2.offset) ? PDP10_UINT36_MAX : 0;
|
||||
break;
|
||||
case E_ANDAND:
|
||||
value->offset = (pdp10_nonzero_int36(value->offset) && pdp10_nonzero_int36(value2.offset)) ? 1 : 0;
|
||||
break;
|
||||
case E_OROR:
|
||||
value->offset = (pdp10_nonzero_int36(value->offset) || pdp10_nonzero_int36(value2.offset)) ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
/* E_ADD / E_SUB cannot occur here, but the compiler may not see that */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int eval_abs(const struct expr *expr, pdp10_uint36_t *offset, int quiet)
|
||||
{
|
||||
struct value value;
|
||||
|
||||
if (eval(expr, &value, quiet) < 0)
|
||||
return -1;
|
||||
if (value.section != SECTION_ABS) {
|
||||
if (!quiet)
|
||||
fprintf(stderr, "as: non-absolute expression\n");
|
||||
return -1;
|
||||
}
|
||||
*offset = value.offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int eval_abs_verbose(const struct expr *expr, pdp10_uint36_t *offset)
|
||||
{
|
||||
return eval_abs(expr, offset, 0);
|
||||
}
|
||||
|
||||
int eval_abs_quiet(const struct expr *expr, pdp10_uint36_t *offset)
|
||||
{
|
||||
return eval_abs(expr, offset, 1);
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* expr.h
|
||||
*/
|
||||
#ifndef EXPR_H
|
||||
#define EXPR_H
|
||||
|
||||
#include "pdp10-elf36.h"
|
||||
#include "section.h"
|
||||
#include "strtab.h"
|
||||
|
||||
enum expr_tag {
|
||||
E_UINTEGER,
|
||||
E_SYMBOL,
|
||||
E_UNARY,
|
||||
E_BINARY,
|
||||
};
|
||||
|
||||
enum expr_unop {
|
||||
E_UMINUS,
|
||||
E_NOT,
|
||||
};
|
||||
|
||||
enum expr_binop {
|
||||
E_MUL,
|
||||
E_DIV,
|
||||
E_REM,
|
||||
E_LSHIFT,
|
||||
E_RSHIFT,
|
||||
E_OR,
|
||||
E_AND,
|
||||
E_XOR,
|
||||
E_ORNOT,
|
||||
E_ADD,
|
||||
E_SUB,
|
||||
E_EQ,
|
||||
E_NE,
|
||||
E_LT,
|
||||
E_GT,
|
||||
E_GE,
|
||||
E_LE,
|
||||
E_ANDAND,
|
||||
E_OROR,
|
||||
};
|
||||
|
||||
struct expr {
|
||||
enum expr_tag tag;
|
||||
union {
|
||||
struct {
|
||||
pdp10_uint36_t val;
|
||||
} e_uinteger;
|
||||
struct {
|
||||
const struct strnode *name;
|
||||
} e_symbol;
|
||||
struct {
|
||||
enum expr_unop unop;
|
||||
struct expr *expr;
|
||||
} e_unary;
|
||||
struct {
|
||||
enum expr_binop binop;
|
||||
struct expr *expr1;
|
||||
struct expr *expr2;
|
||||
} e_binary;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct value {
|
||||
struct section *section;
|
||||
pdp10_uint36_t offset;
|
||||
};
|
||||
|
||||
int eval(const struct expr *expr, struct value *value, int quiet);
|
||||
int eval_abs(const struct expr *expr, pdp10_uint36_t *offset, int quiet);
|
||||
int eval_abs_verbose(const struct expr *expr, pdp10_uint36_t *offset);
|
||||
int eval_abs_quiet(const struct expr *expr, pdp10_uint36_t *offset);
|
||||
|
||||
#endif /* EXPR_H */
|
||||
1155
as/0LD/parse.c
1155
as/0LD/parse.c
File diff suppressed because it is too large
Load Diff
270
as/0LD/pass1.c
270
as/0LD/pass1.c
@ -1,270 +0,0 @@
|
||||
/*
|
||||
* pass1.c
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "emalloc.h"
|
||||
#include "parse.h"
|
||||
#include "pass1.h"
|
||||
#include "scan.h"
|
||||
#include "section.h"
|
||||
|
||||
struct section_and_subsection {
|
||||
struct section *section;
|
||||
struct subsection *subsection;
|
||||
};
|
||||
|
||||
struct current_and_previous_sections {
|
||||
struct section_and_subsection cursec;
|
||||
struct section_and_subsection prevsec;
|
||||
};
|
||||
|
||||
struct sections_stack_element {
|
||||
struct current_and_previous_sections sects;
|
||||
struct sections_stack_element *next;
|
||||
};
|
||||
|
||||
struct pass1_state {
|
||||
struct current_and_previous_sections sects;
|
||||
struct sections_stack_element *sects_stack;
|
||||
};
|
||||
|
||||
static int pass1_s_popsection(struct pass1_state *state)
|
||||
{
|
||||
struct sections_stack_element *top;
|
||||
|
||||
top = state->sects_stack;
|
||||
if (top == NULL) {
|
||||
fprintf(stderr, "as: %s, line %u: .popsection with no previous .pushsection\n", scan_filename, scan_linenr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
state->sects = top->sects;
|
||||
state->sects_stack = top->next;
|
||||
free(top);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pass1_s_previous(struct pass1_state *state)
|
||||
{
|
||||
struct section_and_subsection prevsec;
|
||||
|
||||
prevsec = state->sects.prevsec;
|
||||
if (prevsec.section == NULL) {
|
||||
fprintf(stderr, "as: %s, line %u: .previous with no previous .section\n", scan_filename, scan_linenr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
state->sects.prevsec = state->sects.cursec;
|
||||
state->sects.cursec = prevsec;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pass1_s_section(struct pass1_state *state, struct stmt *stmt, int push)
|
||||
{
|
||||
struct section *section;
|
||||
struct subsection *subsection;
|
||||
int subsectnr;
|
||||
|
||||
section = section_enter(stmt->u.s_section.name);
|
||||
|
||||
if (stmt->u.s_section.sh_type != 0) {
|
||||
if (section->e_shdr.sh_type == 0)
|
||||
section->e_shdr.sh_type = stmt->u.s_section.sh_type;
|
||||
else if (section->e_shdr.sh_type != stmt->u.s_section.sh_type) {
|
||||
fprintf(stderr, "as: %s, line %u: section type mismatch\n", scan_filename, scan_linenr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
section->e_shdr.sh_flags |= stmt->u.s_section.sh_flags;
|
||||
|
||||
if (stmt->u.s_section.sh_entsize != NULL) {
|
||||
pdp10_uint36_t offset;
|
||||
|
||||
if (eval_abs_verbose(stmt->u.s_section.sh_entsize, &offset) < 0)
|
||||
return -1;
|
||||
if (section->e_shdr.sh_entsize == 0)
|
||||
section->e_shdr.sh_entsize = offset;
|
||||
else if (section->e_shdr.sh_entsize != offset) {
|
||||
fprintf(stderr, "as: %s, line %u: section <entsize> mismatch\n", scan_filename, scan_linenr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (stmt->u.s_section.groupname != NULL) {
|
||||
if (section->groupname == NULL)
|
||||
section->groupname = stmt->u.s_section.groupname;
|
||||
else if (stmt->u.s_section.groupname != section->groupname) {
|
||||
fprintf(stderr, "as: %s, line %u: section <groupname> mismatch\n", scan_filename, scan_linenr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (stmt->u.s_section.linkage != NULL) {
|
||||
if (section->linkage == NULL)
|
||||
section->linkage = stmt->u.s_section.linkage;
|
||||
else if (stmt->u.s_section.linkage != section->linkage) {
|
||||
fprintf(stderr, "as: %s, line %u: section <linkage> mismatch\n", scan_filename, scan_linenr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (push && stmt->u.s_section.subsectnr != NULL) {
|
||||
pdp10_uint36_t offset;
|
||||
|
||||
if (eval_abs_verbose(stmt->u.s_section.subsectnr, &offset) < 0)
|
||||
return -1;
|
||||
subsectnr = offset;
|
||||
} else
|
||||
subsectnr = 0;
|
||||
|
||||
subsection = subsection_enter(section, subsectnr);
|
||||
|
||||
if (push) {
|
||||
struct sections_stack_element *top;
|
||||
|
||||
top = emalloc(sizeof *top);
|
||||
top->sects = state->sects;
|
||||
top->next = state->sects_stack;
|
||||
state->sects_stack = top;
|
||||
}
|
||||
|
||||
state->sects.prevsec = state->sects.cursec;
|
||||
state->sects.cursec.section = section;
|
||||
state->sects.cursec.subsection = subsection;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pass1_s_subsection(struct pass1_state *state, struct stmt *stmt)
|
||||
{
|
||||
pdp10_uint36_t offset;
|
||||
struct subsection *subsection;
|
||||
|
||||
if (eval_abs_verbose(stmt->u.s_subsection.expr, &offset) < 0)
|
||||
return -1;
|
||||
|
||||
subsection = subsection_enter(state->sects.cursec.section, (int)(pdp10_int36_t)offset);
|
||||
|
||||
state->sects.prevsec = state->sects.cursec;
|
||||
state->sects.cursec.subsection = subsection;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pass1_interpret(struct pass1_state *state, struct stmt *stmt)
|
||||
{
|
||||
switch (stmt->tag) {
|
||||
/* in pass1 we have to deal with section-altering directives */
|
||||
case S_POPSECTION:
|
||||
return pass1_s_popsection(state);
|
||||
case S_PREVIOUS:
|
||||
return pass1_s_previous(state);
|
||||
case S_PUSHSECTION:
|
||||
return pass1_s_section(state, stmt, 1);
|
||||
case S_SECTION:
|
||||
return pass1_s_section(state, stmt, 0);
|
||||
case S_SUBSECTION:
|
||||
return pass1_s_subsection(state, stmt);
|
||||
|
||||
/* remaining directives, and the non-directives, enter data
|
||||
into sections or manipulate symbols; delay these for pass2 */
|
||||
XXX;
|
||||
/* XXX: wrong, symbol values, even section-relative, are needed as soon
|
||||
as possible, so all statements must be interpreted right away */
|
||||
case S_ALIGN:
|
||||
case S_ASCII:
|
||||
case S_ASCIZ:
|
||||
case S_BYTE:
|
||||
case S_COMM:
|
||||
case S_FILE:
|
||||
case S_GLOBL:
|
||||
case S_HIDDEN:
|
||||
case S_IDENT:
|
||||
case S_INTERNAL:
|
||||
case S_LOCAL:
|
||||
case S_LONG:
|
||||
case S_ORG:
|
||||
case S_PROTECTED:
|
||||
case S_SET:
|
||||
case S_SHORT:
|
||||
case S_SIZE:
|
||||
case S_SYMVER:
|
||||
case S_TYPE:
|
||||
case S_WEAK:
|
||||
case S_WEAKREF:
|
||||
case S_LABEL:
|
||||
case S_INSN:
|
||||
{
|
||||
struct stmt *stmt2;
|
||||
|
||||
stmt2 = arrlst_append(state->sects.cursec.subsection->stmts);
|
||||
/* XXX: error check */
|
||||
*stmt2 = *stmt;
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "as: %s, line %u: %s(): unknown stmt tag %u\n", scan_filename, scan_linenr, __FUNCTION__, stmt->tag);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void pass1_init_state(struct pass1_state *state)
|
||||
{
|
||||
struct section *text;
|
||||
|
||||
text = section_enter(strtab_enter(".text"));
|
||||
|
||||
text->e_shdr.sh_type = SHT_PROGBITS;
|
||||
text->e_shdr.sh_flags = SHF_ALLOC | SHF_EXECINSTR;
|
||||
text->e_shdr.sh_addralign = 4; /* XXX: PDP10-specific */
|
||||
|
||||
state->sects.cursec.section = text;
|
||||
state->sects.cursec.subsection = subsection_enter(text, 0);
|
||||
|
||||
state->sects.prevsec.section = NULL;
|
||||
state->sects.prevsec.subsection = NULL;
|
||||
|
||||
state->sects_stack = NULL;
|
||||
}
|
||||
|
||||
static void pass1_fini_state(struct pass1_state *state)
|
||||
{
|
||||
struct sections_stack_element *here, *next;
|
||||
|
||||
here = state->sects_stack;
|
||||
while (here != NULL) {
|
||||
next = here->next;
|
||||
free(here);
|
||||
here = next;
|
||||
}
|
||||
}
|
||||
|
||||
int pass1(const char *filename)
|
||||
{
|
||||
struct pass1_state state;
|
||||
struct stmt stmt;
|
||||
int status;
|
||||
|
||||
if (scan_freopen(filename) < 0)
|
||||
return -1;
|
||||
|
||||
pass1_init_state(&state);
|
||||
|
||||
for (;;) {
|
||||
status = parse_stmt(&stmt);
|
||||
if (status < 0)
|
||||
return -1;
|
||||
else if (status == 0)
|
||||
break;
|
||||
else if (pass1_interpret(&state, &stmt) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
pass1_fini_state(&state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
/*
|
||||
* pass1.h
|
||||
*/
|
||||
#ifndef PASS1_H
|
||||
#define PASS1_H
|
||||
|
||||
int pass1(const char *filename);
|
||||
|
||||
#endif /* PASS1_H */
|
||||
636
as/0LD/scan.c
636
as/0LD/scan.c
@ -1,636 +0,0 @@
|
||||
/*
|
||||
* scan.c
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h> /* host stdio since we're dealing with plain text */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "charbuf.h"
|
||||
#include "scan.h"
|
||||
#include "token.h"
|
||||
|
||||
/* XXX: we should have a pdp10-limits.h */
|
||||
#define PDP10_UCHAR_MAX PDP10_UINT9_MAX
|
||||
|
||||
const char *scan_filename = "<stdin>";
|
||||
|
||||
int scan_freopen(const char *filename)
|
||||
{
|
||||
if (filename != NULL) {
|
||||
if (freopen(filename, "r", stdin) == NULL) {
|
||||
fprintf(stderr, "as: Error opening %s: %s\n", filename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
scan_filename = filename;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int scan_linenr;
|
||||
|
||||
static void scan_ungetc(int ch)
|
||||
{
|
||||
if (ch != EOF && ungetc(ch, stdin) == EOF)
|
||||
perror("ungetc");
|
||||
}
|
||||
|
||||
static int scan_getchar(void)
|
||||
{
|
||||
return fgetc(stdin);
|
||||
}
|
||||
|
||||
static void badchar(int ch, const char *context)
|
||||
{
|
||||
char buf[7];
|
||||
|
||||
if (ch == EOF) {
|
||||
buf[0] = '<';
|
||||
buf[1] = 'E';
|
||||
buf[2] = 'O';
|
||||
buf[3] = 'F';
|
||||
buf[4] = '>';
|
||||
buf[5] = '\0';
|
||||
} else if (' ' <= ch && ch <= '~') {
|
||||
buf[0] = '\'';
|
||||
buf[1] = ch;
|
||||
buf[2] = '\'';
|
||||
buf[3] = '\0';
|
||||
} else {
|
||||
buf[0] = '\'';
|
||||
buf[1] = '\\';
|
||||
buf[2] = '0' + ((ch >> 6) & 3);
|
||||
buf[3] = '0' + ((ch >> 3) & 7);
|
||||
buf[4] = '0' + (ch & 7);
|
||||
buf[5] = '\'';
|
||||
buf[6] = '\0';
|
||||
}
|
||||
|
||||
fprintf(stderr, "as: %s, line %u: invalid character %s %s\n", scan_filename, scan_linenr, buf, context);
|
||||
}
|
||||
|
||||
static int is_decimal_digit(char ch)
|
||||
{
|
||||
return '0' <= ch && ch <= '9';
|
||||
}
|
||||
|
||||
static int is_octal_digit(char ch)
|
||||
{
|
||||
return '0' <= ch && ch <= '7';
|
||||
}
|
||||
|
||||
static unsigned int get_chval(int ch)
|
||||
{
|
||||
if ('0' <= ch && ch <= '9')
|
||||
return ch - '0';
|
||||
if ('A' <= ch && ch <= 'F')
|
||||
return ch - ('A' - 10);
|
||||
if ('a' <= ch && ch <= 'f')
|
||||
return ch - ('a' - 10);
|
||||
return -1U;
|
||||
}
|
||||
|
||||
static int do_escape(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case 'n':
|
||||
return '\n';
|
||||
case 't':
|
||||
return '\t';
|
||||
case 'f':
|
||||
return '\f';
|
||||
case 'r':
|
||||
return '\r';
|
||||
case 'b':
|
||||
return '\b';
|
||||
case '\\':
|
||||
return ch;
|
||||
case '\'':
|
||||
return ch;
|
||||
case '"':
|
||||
return ch;
|
||||
case 'x':
|
||||
case 'X':
|
||||
{
|
||||
unsigned int chval;
|
||||
|
||||
ch = scan_getchar();
|
||||
chval = get_chval(ch);
|
||||
if (chval <= 15) {
|
||||
unsigned int val = 0;
|
||||
do {
|
||||
val = val * 16 + chval;
|
||||
ch = scan_getchar();
|
||||
chval = get_chval(ch);
|
||||
} while (chval <= 15);
|
||||
scan_ungetc(ch);
|
||||
if (val > PDP10_UCHAR_MAX)
|
||||
fprintf(stderr, "as: %s, line %u: truncating escaped value from %#x to %#x\n", scan_filename, scan_linenr, val, val & PDP10_UCHAR_MAX);
|
||||
return val & PDP10_UCHAR_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EOF:
|
||||
break;
|
||||
default:
|
||||
if (is_octal_digit(ch)) {
|
||||
unsigned int val = ch - '0';
|
||||
ch = scan_getchar();
|
||||
if (is_octal_digit(ch)) {
|
||||
val = val * 8 + (ch - '0');
|
||||
ch = scan_getchar();
|
||||
if (is_octal_digit(ch))
|
||||
val = val * 8 + (ch - '0');
|
||||
else
|
||||
scan_ungetc(ch);
|
||||
} else
|
||||
scan_ungetc(ch);
|
||||
if (val > PDP10_UCHAR_MAX)
|
||||
fprintf(stderr, "as: %s, line %u: truncating escaped value from %#x to %#x\n", scan_filename, scan_linenr, val, val & PDP10_UCHAR_MAX);
|
||||
return val & PDP10_UCHAR_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
badchar(ch, "in \\ character escape sequence");
|
||||
return ch;
|
||||
}
|
||||
|
||||
static enum token do_char(union token_attribute *token_attr)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '\\':
|
||||
ch = do_escape();
|
||||
if (ch == EOF)
|
||||
return T_ERROR;
|
||||
break;
|
||||
case '\'':
|
||||
case EOF:
|
||||
badchar(ch, "in character literal");
|
||||
return T_ERROR;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
token_attr->uint = ch;
|
||||
ch = scan_getchar();
|
||||
if (ch != '\'') {
|
||||
badchar(ch, "after character literal");
|
||||
return T_ERROR;
|
||||
}
|
||||
return T_UINTEGER;
|
||||
}
|
||||
|
||||
/* XXX: strings should be sequences of uint9_t not sequences of unsigned char */
|
||||
|
||||
static enum token do_string(union token_attribute *token_attr, struct charbuf *charbuf)
|
||||
{
|
||||
int ch;
|
||||
|
||||
for (;;) {
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '"':
|
||||
token_attr->text = charbuf_string(charbuf);
|
||||
return T_STRING;
|
||||
case '\\':
|
||||
ch = do_escape();
|
||||
if (ch == EOF)
|
||||
return T_ERROR;
|
||||
break;
|
||||
case EOF:
|
||||
case '\n':
|
||||
badchar(ch, "in string literal");
|
||||
if (ch == '\n')
|
||||
++scan_linenr;
|
||||
return T_ERROR;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
charbuf_append(charbuf, ch);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct {
|
||||
enum token token;
|
||||
const char *name;
|
||||
} directives[] = {
|
||||
{ T_DOT_ALIGN, ".align" },
|
||||
{ T_DOT_ASCII, ".ascii" },
|
||||
{ T_DOT_ASCIZ, ".asciz" },
|
||||
{ T_DOT_BALIGN, ".balign" },
|
||||
{ T_DOT_BSS, ".bss" },
|
||||
{ T_DOT_BYTE, ".byte" },
|
||||
{ T_DOT_COMM, ".comm" },
|
||||
{ T_DOT_DATA, ".data" },
|
||||
{ T_DOT_FILE, ".file" },
|
||||
{ T_DOT_GLOBL, ".globl" },
|
||||
{ T_DOT_HIDDEN, ".hidden" },
|
||||
{ T_DOT_IDENT, ".ident" },
|
||||
{ T_DOT_INTERNAL, ".internal" },
|
||||
{ T_DOT_LOCAL, ".local" },
|
||||
{ T_DOT_LONG, ".long" },
|
||||
{ T_DOT_ORG, ".org" },
|
||||
{ T_DOT_P2ALIGN, ".p2align" },
|
||||
{ T_DOT_POPSECTION, ".popsection" },
|
||||
{ T_DOT_PREVIOUS, ".previous" },
|
||||
{ T_DOT_PROTECTED, ".protected" },
|
||||
{ T_DOT_PUSHSECTION, ".pushsection" },
|
||||
{ T_DOT_RODATA, ".rodata" },
|
||||
{ T_DOT_SECTION, ".section" },
|
||||
{ T_DOT_SET, ".set" },
|
||||
{ T_DOT_SHORT, ".short" },
|
||||
{ T_DOT_SIZE, ".size" },
|
||||
{ T_DOT_SUBSECTION, ".subsection" },
|
||||
{ T_DOT_SYMVER, ".symver" },
|
||||
{ T_DOT_TEXT, ".text" },
|
||||
{ T_DOT_TYPE, ".type" },
|
||||
{ T_DOT_WEAK, ".weak" },
|
||||
{ T_DOT_WEAKREF, ".weakref" },
|
||||
};
|
||||
|
||||
static enum token mk_symbol(union token_attribute *token_attr, const struct charbuf *charbuf)
|
||||
{
|
||||
if (charbuf->head.buf[0] == '.') { /* check for <.directive> */
|
||||
unsigned int low, high;
|
||||
|
||||
low = 0;
|
||||
high = sizeof directives / sizeof directives[0];
|
||||
|
||||
while (low < high) {
|
||||
unsigned int middle;
|
||||
int cmp;
|
||||
|
||||
middle = (low + high) / 2;
|
||||
cmp = charbuf_strcmp(charbuf, directives[middle].name);
|
||||
|
||||
if (cmp < 0)
|
||||
high = middle;
|
||||
else if (cmp > 0)
|
||||
low = middle + 1;
|
||||
else
|
||||
return directives[middle].token;
|
||||
}
|
||||
} else if (charbuf->head.buf[0] == '$'
|
||||
&& charbuf->head.next == NULL) { /* check for $<reg> */
|
||||
if (charbuf->pos == 2
|
||||
&& is_decimal_digit(charbuf->head.buf[1])) {
|
||||
token_attr->uint = charbuf->head.buf[1] - '0';
|
||||
return T_REGISTER;
|
||||
} else if (charbuf->pos == 3) {
|
||||
if (is_decimal_digit(charbuf->head.buf[1])
|
||||
&& is_decimal_digit(charbuf->head.buf[2])) {
|
||||
unsigned int val;
|
||||
|
||||
val = (charbuf->head.buf[1] - '0') * 10 + (charbuf->head.buf[2] - '0');
|
||||
if (val < 16) {
|
||||
token_attr->uint = val;
|
||||
return T_REGISTER;
|
||||
}
|
||||
} else if (charbuf->head.buf[1] == 's'
|
||||
&& charbuf->head.buf[2] == 'p') {
|
||||
token_attr->uint = 15;
|
||||
return T_REGISTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
token_attr->text = charbuf_string(charbuf);
|
||||
return T_SYMBOL;
|
||||
}
|
||||
|
||||
static int is_symbol_internal_char(int ch)
|
||||
{
|
||||
return
|
||||
('A' <= ch && ch <= 'Z')
|
||||
|| ('a' <= ch && ch <= 'z')
|
||||
|| ('0' <= ch && ch <= '9')
|
||||
|| ch == '_'
|
||||
|| ch == '$'
|
||||
|| ch == '.';
|
||||
}
|
||||
|
||||
static enum token do_symbol(union token_attribute *token_attr, int ch, struct charbuf *charbuf)
|
||||
{
|
||||
do {
|
||||
charbuf_append(charbuf, ch);
|
||||
ch = scan_getchar();
|
||||
} while (is_symbol_internal_char(ch));
|
||||
scan_ungetc(ch);
|
||||
return mk_symbol(token_attr, charbuf);
|
||||
}
|
||||
|
||||
static enum token do_number(union token_attribute *token_attr, int ch)
|
||||
{
|
||||
unsigned int base, chval;
|
||||
pdp10_uint36_t numval;
|
||||
|
||||
base = (ch == '0') ? 8 : 10;
|
||||
numval = ch - '0';
|
||||
|
||||
ch = scan_getchar();
|
||||
/* handle 0x<first hexdig> */
|
||||
if (ch == 'x' || ch == 'X') {
|
||||
base = 16;
|
||||
/* must have at least one hex digit after 0x */
|
||||
ch = scan_getchar();
|
||||
chval = get_chval(ch);
|
||||
if (chval <= 15)
|
||||
numval = chval;
|
||||
else {
|
||||
badchar(ch, "after 0x in hexadecimal literal");
|
||||
return T_ERROR;
|
||||
}
|
||||
ch = scan_getchar();
|
||||
}
|
||||
/* the number is non-empty, consume and accumulate trailing
|
||||
characters as long as they are valid in the base */
|
||||
for (;;) {
|
||||
chval = get_chval(ch);
|
||||
if (chval >= base)
|
||||
break;
|
||||
numval = numval * base + chval;
|
||||
ch = scan_getchar();
|
||||
}
|
||||
/* check for <local label>{b,f} */
|
||||
if (base <= 10 && (ch == 'b' || ch == 'f')) {
|
||||
/* represent the local label + direction in sign-magnitude with
|
||||
the sign in the least significant bit; using sign-magnitude
|
||||
allows to distinguish 0f from 0b (i.e., +0 from -0); storing
|
||||
the sign in the least significant bit makes us independent of
|
||||
word size */
|
||||
token_attr->uint = (numval << 1) | (ch == 'f' ? 1 : 0);
|
||||
return T_LOCAL_LABEL;
|
||||
}
|
||||
/* plain integer literal */
|
||||
scan_ungetc(ch);
|
||||
token_attr->uint = numval;
|
||||
return T_UINTEGER;
|
||||
}
|
||||
|
||||
static enum token do_eq(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '=':
|
||||
return T_EQEQ;
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_EQ;
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_ampersand(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '&':
|
||||
return T_ANDAND;
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_AND;
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_bar(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '|':
|
||||
return T_OROR;
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_OR;
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_gt(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '>':
|
||||
return T_RSHIFT;
|
||||
case '=':
|
||||
return T_GE;
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_GT;
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_lt(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '<':
|
||||
return T_LSHIFT;
|
||||
case '=':
|
||||
return T_LE;
|
||||
case '>': /* <> is the same as != */
|
||||
return T_NEQ;
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_LT;
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_c_comment(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
for (;;) {
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case EOF:
|
||||
badchar(ch, "in /**/-style comment");
|
||||
return T_ERROR;
|
||||
case '*':
|
||||
for (;;) {
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '*':
|
||||
continue;
|
||||
case '/':
|
||||
return T_EOF; /* fake token for a C comment */
|
||||
case EOF:
|
||||
badchar(ch, "in /**/-style comment");
|
||||
return T_ERROR;
|
||||
case '\n':
|
||||
++scan_linenr;
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case '\n':
|
||||
++scan_linenr;
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_slash(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '*':
|
||||
return do_c_comment();
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_DIV;
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_bang(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '=':
|
||||
return T_NEQ;
|
||||
default:
|
||||
scan_ungetc(ch);
|
||||
return T_BANG;
|
||||
}
|
||||
}
|
||||
|
||||
static int do_line_comment(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
for (;;) {
|
||||
ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
++scan_linenr;
|
||||
return 0;
|
||||
case EOF:
|
||||
badchar(ch, "in line comment");
|
||||
return -1;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static enum token do_scan(union token_attribute *token_attr, struct charbuf *charbuf)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = scan_getchar();
|
||||
|
||||
for (;; ch = scan_getchar()) {
|
||||
switch (ch) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\f':
|
||||
continue;
|
||||
case '\n':
|
||||
++scan_linenr;
|
||||
return T_NEWLINE;
|
||||
case '#':
|
||||
if (do_line_comment() != 0)
|
||||
return T_ERROR;
|
||||
return T_NEWLINE;
|
||||
case ';':
|
||||
return T_NEWLINE;
|
||||
case EOF:
|
||||
return T_EOF;
|
||||
case '@':
|
||||
return T_AT;
|
||||
case ':':
|
||||
return T_COLON;
|
||||
case ',':
|
||||
return T_COMMA;
|
||||
case '(':
|
||||
return T_LPAREN;
|
||||
case ')':
|
||||
return T_RPAREN;
|
||||
case '~':
|
||||
return T_TILDE;
|
||||
case '*':
|
||||
return T_MUL;
|
||||
case '/': /* "/""*", "/" */
|
||||
switch (do_slash()) {
|
||||
case T_DIV:
|
||||
return T_DIV;
|
||||
case T_EOF: /* fake token for a C comment */
|
||||
continue;
|
||||
default: /* error, eof in comment */
|
||||
return T_ERROR;
|
||||
}
|
||||
case '%':
|
||||
return T_REM;
|
||||
case '<': /* <<, <=, < */
|
||||
return do_lt();
|
||||
case '>': /* >>, >=, > */
|
||||
return do_gt();
|
||||
case '|': /* ||, | */
|
||||
return do_bar();
|
||||
case '&': /* &&, & */
|
||||
return do_ampersand();
|
||||
case '^':
|
||||
return T_CARET;
|
||||
case '!': /* !=, ! */
|
||||
return do_bang();
|
||||
case '+':
|
||||
return T_PLUS;
|
||||
case '-':
|
||||
return T_MINUS;
|
||||
case '=': /* ==, = */
|
||||
return do_eq();
|
||||
case '"':
|
||||
return do_string(token_attr, charbuf);
|
||||
case '\'':
|
||||
return do_char(token_attr);
|
||||
case '.':
|
||||
/* Dot may start a floating point literal, but tests show that
|
||||
gcc always outputs floating point values as integer literals,
|
||||
so we shouldn't have to support floating point literals at all. */
|
||||
case '$':
|
||||
case '_':
|
||||
return do_symbol(token_attr, ch, charbuf);
|
||||
default:
|
||||
if ('0' <= ch && ch <= '9') /* number or <decimal>{b,f} */
|
||||
return do_number(token_attr, ch);
|
||||
if (('A' <= ch && ch <= 'Z') ||
|
||||
('a' <= ch && ch <= 'z'))
|
||||
return do_symbol(token_attr, ch, charbuf);
|
||||
}
|
||||
badchar(ch, "");
|
||||
return T_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
enum token scan(union token_attribute *token_attr)
|
||||
{
|
||||
struct charbuf charbuf;
|
||||
enum token token;
|
||||
|
||||
charbuf_init(&charbuf);
|
||||
token = do_scan(token_attr, &charbuf);
|
||||
charbuf_fini(&charbuf);
|
||||
|
||||
return token;
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* section.c
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "emalloc.h"
|
||||
#include "htab.h"
|
||||
#include "section.h"
|
||||
|
||||
static struct section *section_from_hnode(const struct hnode *hnode)
|
||||
{
|
||||
/* hnode is first in section, so no need to mess with offsetof() */
|
||||
return (struct section*)hnode;
|
||||
}
|
||||
|
||||
static struct htab section_htab;
|
||||
|
||||
void section_init(void)
|
||||
{
|
||||
htab_init(§ion_htab, 8, NULL);
|
||||
}
|
||||
|
||||
struct section *section_enter(const struct strnode *strnode)
|
||||
{
|
||||
struct section *section;
|
||||
|
||||
section = section_from_hnode(htab_lookup(§ion_htab, (uintptr_t)strnode, NULL));
|
||||
|
||||
if (section == NULL) {
|
||||
section = emalloc(sizeof *section);
|
||||
memset(section, '\0', sizeof *section);
|
||||
section->hnode.hval = (uintptr_t)strnode;
|
||||
htab_init(§ion->subsects, 4, NULL);
|
||||
htab_insert(§ion_htab, §ion->hnode);
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
static struct subsection *subsection_from_hnode(const struct hnode *hnode)
|
||||
{
|
||||
/* hnode is first in subsection, so no need to mess with offsetof() */
|
||||
return (struct subsection*)hnode;
|
||||
}
|
||||
|
||||
struct subsection *subsection_enter(struct section *section, int subsectnr)
|
||||
{
|
||||
struct subsection *subsection;
|
||||
|
||||
subsection = subsection_from_hnode(htab_lookup(§ion->subsects, (uintptr_t)subsectnr, NULL));
|
||||
|
||||
if (subsection == NULL) {
|
||||
subsection = emalloc(sizeof *subsection);
|
||||
subsection->hnode.hval = (uintptr_t)subsectnr;
|
||||
subsection->stmts = arrlst_alloc(sizeof(struct stmt));
|
||||
htab_insert(§ion->subsects, &subsection->hnode);
|
||||
}
|
||||
|
||||
return subsection;
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* section.h
|
||||
*/
|
||||
#ifndef SECTION_H
|
||||
#define SECTION_H
|
||||
|
||||
#include "pdp10-elf36.h"
|
||||
|
||||
#include "arrlst.h"
|
||||
#include "htab.h"
|
||||
#include "stmt.h"
|
||||
#include "strtab.h"
|
||||
|
||||
struct subsection {
|
||||
struct hnode hnode; /* hnode.hval == subsect nr */
|
||||
struct arrlst *stmts;
|
||||
};
|
||||
|
||||
struct section {
|
||||
struct hnode hnode; /* hnode.hval == struct strnode* */
|
||||
Elf36_Shdr e_shdr;
|
||||
struct htab subsects;
|
||||
const struct strnode *groupname;
|
||||
const struct strnode *linkage;
|
||||
unsigned int dot; /* Elf36_Off? */
|
||||
};
|
||||
|
||||
#define SECTION_ABS ((struct section*)0)
|
||||
#define SECTION_UNDEF ((struct section*)1)
|
||||
|
||||
void section_init(void);
|
||||
struct section *section_enter(const struct strnode *strnode);
|
||||
struct subsection *subsection_enter(struct section *section, int subsectnr);
|
||||
|
||||
#endif /* SECTION_H */
|
||||
122
as/0LD/stmt.h
122
as/0LD/stmt.h
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* stmt.h
|
||||
*/
|
||||
#ifndef STMT_H
|
||||
#define STMT_H
|
||||
|
||||
#include "pdp10-elf36.h"
|
||||
#include "expr.h"
|
||||
#include "strtab.h"
|
||||
|
||||
struct expr_list {
|
||||
struct expr *expr;
|
||||
struct expr_list *next;
|
||||
};
|
||||
|
||||
struct string_list {
|
||||
const struct strnode *string;
|
||||
struct string_list *next;
|
||||
};
|
||||
|
||||
enum stmt_tag {
|
||||
/* directives */
|
||||
S_ALIGN, /* .align, .balign, and .p2align map to this */
|
||||
S_ASCII,
|
||||
S_ASCIZ,
|
||||
S_BYTE,
|
||||
S_COMM,
|
||||
S_FILE,
|
||||
S_GLOBL,
|
||||
S_HIDDEN,
|
||||
S_IDENT,
|
||||
S_INTERNAL,
|
||||
S_LOCAL,
|
||||
S_LONG,
|
||||
S_ORG,
|
||||
S_POPSECTION, /* no attribute */
|
||||
S_PREVIOUS, /* no attribute */
|
||||
S_PROTECTED,
|
||||
S_PUSHSECTION,
|
||||
S_SECTION, /* .bss, .data, .rodata, and .text also map to this */
|
||||
S_SET,
|
||||
S_SHORT,
|
||||
S_SIZE,
|
||||
S_SUBSECTION,
|
||||
S_SYMVER,
|
||||
S_TYPE,
|
||||
S_WEAK,
|
||||
S_WEAKREF,
|
||||
/* non-directives */
|
||||
S_LABEL,
|
||||
S_INSN,
|
||||
};
|
||||
|
||||
struct stmt {
|
||||
enum stmt_tag tag;
|
||||
union {
|
||||
struct {
|
||||
unsigned char flags; /* p2 vs b, none/w/l */
|
||||
struct expr *balign;
|
||||
struct expr *fill;
|
||||
struct expr *maxskip;
|
||||
} s_align;
|
||||
struct {
|
||||
struct string_list *list;
|
||||
} s_string_list;
|
||||
struct {
|
||||
struct expr_list *list;
|
||||
} s_expr_list;
|
||||
struct {
|
||||
const struct strnode *name;
|
||||
struct expr *length;
|
||||
struct expr *balign;
|
||||
} s_comm;
|
||||
struct {
|
||||
const struct strnode *string;
|
||||
} s_string;
|
||||
struct {
|
||||
struct expr *newlc;
|
||||
struct expr *fill;
|
||||
} s_org;
|
||||
struct {
|
||||
const struct strnode *name;
|
||||
struct expr *subsectnr;
|
||||
Elf36_Word sh_flags;
|
||||
Elf36_Word sh_type;
|
||||
struct expr *sh_entsize;
|
||||
const struct strnode *groupname;
|
||||
const struct strnode *linkage;
|
||||
} s_section;
|
||||
struct {
|
||||
const struct strnode *name;
|
||||
struct expr *expr;
|
||||
} s_setsize;
|
||||
struct {
|
||||
struct expr *expr;
|
||||
} s_subsection;
|
||||
struct {
|
||||
const struct strnode *name1;
|
||||
const struct strnode *name2;
|
||||
const struct strnode *name3;
|
||||
unsigned char nrats; /* 1, 2, or 3 */
|
||||
} s_symver;
|
||||
struct {
|
||||
const struct strnode *name;
|
||||
unsigned char st_type;
|
||||
} s_type;
|
||||
struct {
|
||||
const struct strnode *alias;
|
||||
const struct strnode *target;
|
||||
} s_weakref;
|
||||
struct {
|
||||
const struct strnode *name;
|
||||
unsigned int accumulator;
|
||||
int at;
|
||||
struct expr *expr;
|
||||
unsigned int indexreg;
|
||||
} s_insn;
|
||||
|
||||
} u;
|
||||
};
|
||||
|
||||
#endif /* STMT_H */
|
||||
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* strtab.c
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "emalloc.h"
|
||||
#include "htab.h"
|
||||
#include "strtab.h"
|
||||
|
||||
static struct strnode *strnode_from_hnode(const struct hnode *hnode)
|
||||
{
|
||||
/* hnode is first in strnode, so no need to mess with offsetof() */
|
||||
return (struct strnode*)hnode;
|
||||
}
|
||||
|
||||
static int strtab_cmpfn(const struct hnode *hnode, const void *data)
|
||||
{
|
||||
const struct strnode *strnode = strnode_from_hnode(hnode);
|
||||
const char *string = data;
|
||||
|
||||
return strcmp(strnode->string, string);
|
||||
}
|
||||
|
||||
static struct htab strtab_htab;
|
||||
|
||||
void strtab_init(void)
|
||||
{
|
||||
htab_init(&strtab_htab, 64, strtab_cmpfn);
|
||||
}
|
||||
|
||||
static uintptr_t strtab_hash(const char *string)
|
||||
{
|
||||
const unsigned char *s;
|
||||
uintptr_t h;
|
||||
unsigned char c;
|
||||
|
||||
s = (const unsigned char*)string;
|
||||
h = 0;
|
||||
|
||||
for (;;) {
|
||||
c = *s++;
|
||||
if (c == '\0')
|
||||
break;
|
||||
h = (h << 5) + h + c;
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
const struct strnode *strtab_enter(const char *string)
|
||||
{
|
||||
uintptr_t hval;
|
||||
struct strnode *strnode;
|
||||
|
||||
hval = strtab_hash(string);
|
||||
strnode = strnode_from_hnode(htab_lookup(&strtab_htab, hval, string));
|
||||
|
||||
if (strnode == NULL) {
|
||||
strnode = emalloc(offsetof(struct strnode, string) + strlen(string) + 1);
|
||||
strnode->hnode.hval = hval;
|
||||
strcpy(strnode->string, string);
|
||||
htab_insert(&strtab_htab, &strnode->hnode);
|
||||
}
|
||||
|
||||
return strnode;
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* strtab.h
|
||||
*/
|
||||
#ifndef STRTAB_H
|
||||
#define STRTAB_H
|
||||
|
||||
#include "htab.h"
|
||||
|
||||
struct strnode {
|
||||
struct hnode hnode;
|
||||
char string[];
|
||||
};
|
||||
|
||||
void strtab_init(void);
|
||||
const struct strnode *strtab_enter(const char *string);
|
||||
|
||||
#endif /* STRTAB */
|
||||
18
as/Makefile
18
as/Makefile
@ -1,3 +1,21 @@
|
||||
# as/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* assemble.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* assemble.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ASSEMBLE_H
|
||||
#define ASSEMBLE_H
|
||||
|
||||
16
as/hashtab.c
16
as/hashtab.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* hashtab.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
16
as/hashtab.h
16
as/hashtab.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* hashtab.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HASHTAB_H
|
||||
#define HASHTAB_H
|
||||
|
||||
16
as/input.c
16
as/input.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* input.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
16
as/input.h
16
as/input.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* input.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
18
as/main.c
18
as/main.c
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* main.c
|
||||
* main.c -- as clone for pdp10-elf
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* as clone for PDP10 with Elf36 object files.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
16
as/output.c
16
as/output.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* output.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
16
as/output.h
16
as/output.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* output.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef OUTPUT_H
|
||||
#define OUTPUT_H
|
||||
|
||||
16
as/parse.c
16
as/parse.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* parse.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
16
as/parse.h
16
as/parse.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* parse.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PARSE_H
|
||||
#define PARSE_H
|
||||
|
||||
16
as/scan.c
16
as/scan.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* scan.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <limits.h> /* XXX: for UCHAR_MAX, deleteme */
|
||||
|
||||
16
as/scan.h
16
as/scan.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* scan.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SCAN_H
|
||||
#define SCAN_H
|
||||
|
||||
@ -1,3 +1,22 @@
|
||||
/*
|
||||
* test1.s
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
.text
|
||||
.globl start
|
||||
start:
|
||||
|
||||
@ -1 +1,21 @@
|
||||
/*
|
||||
* test2.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
int foo(void) { return 27; }
|
||||
|
||||
@ -1,3 +1,23 @@
|
||||
/*
|
||||
* test2.s
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
.file "z.c"
|
||||
.text
|
||||
.globl foo
|
||||
|
||||
16
as/token.c
16
as/token.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* token.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "pdp10-inttypes.h"
|
||||
|
||||
20
as/token.def
20
as/token.def
@ -1,6 +1,24 @@
|
||||
/*
|
||||
* token.def
|
||||
* token.def -- token definitions for PDP10 assembler
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TOKEN(T_<name>, <print name>, <attribute fmt>)
|
||||
*/
|
||||
|
||||
|
||||
16
as/token.h
16
as/token.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* token.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TOKEN_H
|
||||
#define TOKEN_H
|
||||
|
||||
16
as/tunit.c
16
as/tunit.c
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* tunit.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
16
as/tunit.h
16
as/tunit.h
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* tunit.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TUNIT_H
|
||||
#define TUNIT_H
|
||||
|
||||
20
doc/MUUO.txt
20
doc/MUUO.txt
@ -1,3 +1,23 @@
|
||||
/*
|
||||
* MUUO.txt
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
.text
|
||||
.globl start
|
||||
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-ar.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* This is essentially the standard SVR4/GNU AR format, with 'char'
|
||||
* replaced by 'pdp10_uint9_t' throughout.
|
||||
* Groups of 4 bytes in the symbol table denote pdp10_uint36_t
|
||||
|
||||
@ -1,8 +1,21 @@
|
||||
/*
|
||||
* pdp10-arith.h
|
||||
* pdp10-arith.h -- arithmetic on PDP10 integer types
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* Provide functions for performing arithmetic operations on PDP10 integer types.
|
||||
* Currently only 36-bit signed operations are supported.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PDP10_ARITH_H
|
||||
#define PDP10_ARITH_H
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-elf36.h
|
||||
* pdp10-elf36.h -- ELF definitions for PDP10
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* This is essentially the standard Elf32 declarations with 8/16/32-bit
|
||||
* primitive types replaced by 9/18/36-bit primitive types, and Elf32
|
||||
* replaced by Elf36.
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-extint.h
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Provide types and procedures for converting 18 and 36-bit integers
|
||||
* to and from arrays of 9-bit bytes (nonets). Use these together with
|
||||
* pdp10_fread() and pdp10_fwrite() to convert 18 and 36-bit integers
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-inttypes.h
|
||||
* pdp10-inttypes.h -- inttypes.h clone for PDP10
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Provide format conversions for 18 and 36-bit integers.
|
||||
* For 9-bit integers, pdp_uint9_t, just use the regular
|
||||
* int-sized d/o/u/x formats.
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-stdint.h
|
||||
* pdp10-stdint.h -- stdint.h clone for PDP10
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Provide stdint.h-like type names and macros for 9, 18, and 36-bit unsigned
|
||||
* integer types.
|
||||
*
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-stdio.h
|
||||
* pdp10-stdio.h -- I/O of nonet-based files on octet-based hosts
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Provide stdio.h-like interface for I/O to and from files with 9-bit logical bytes (nonets),
|
||||
* represented by native files with 8-bit physical bytes (octets).
|
||||
*/
|
||||
|
||||
18
lib/Makefile
18
lib/Makefile
@ -1,3 +1,21 @@
|
||||
# lib/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* pdp10-elf36.c
|
||||
* pdp10-elf36.c -- I/O of Elf36 files
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* Procedures for reading and writing ELf36 files.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pdp10-elf36.h"
|
||||
#include "pdp10-extint.h"
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-extint.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Provide types and procedures for converting 18 and 36-bit integers
|
||||
* to and from arrays of 9-bit bytes (nonets). Use these together with
|
||||
* pdp10_fread() and pdp10_fwrite() to convert 18 and 36-bit integers
|
||||
|
||||
@ -1,6 +1,23 @@
|
||||
/*
|
||||
* pdp10-stdio.h
|
||||
* pdp10-stdio.c
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Provide stdio.h-like interface for I/O to and from files with 9-bit logical bytes (nonets),
|
||||
* represented by native files with 8-bit physical bytes (octets).
|
||||
*
|
||||
|
||||
18
nm/Makefile
18
nm/Makefile
@ -1,3 +1,21 @@
|
||||
# nm/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
20
nm/nm.c
20
nm/nm.c
@ -1,7 +1,23 @@
|
||||
/*
|
||||
* nm.c
|
||||
* nm.c -- nm clone for PDP10 Elf36 files
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* nm clone for PDP10 Elf36 files.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* This is essentially a copy of readelf.c, adjusted to
|
||||
* process the symbol table differently.
|
||||
*/
|
||||
|
||||
18
od/Makefile
18
od/Makefile
@ -1,3 +1,21 @@
|
||||
# od/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
18
od/od.c
18
od/od.c
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* od.c
|
||||
* od.c -- od clone for binary files with 9-bit bytes
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* od clone for PDP10 files with 9-bit bytes
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# readelf/Makefile
|
||||
# Copyright (C) 2013-2015 Mikael Pettersson
|
||||
#
|
||||
# This file is part of pdp10-tools.
|
||||
#
|
||||
# pdp10-tools 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.
|
||||
#
|
||||
# pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-O2 -g -Wall
|
||||
CPPFLAGS=-I../include
|
||||
|
||||
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* gen-test1.c
|
||||
* gen-test1.c -- generate test1.o for readelf
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* Generate test1.o for PDP10 Elf36 readelf.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1,7 +1,21 @@
|
||||
/*
|
||||
* readelf.c
|
||||
* readelf.c -- readelf clone for PDP10 Elf36 files
|
||||
* Copyright (C) 2013-2015 Mikael Pettersson
|
||||
*
|
||||
* readelf/objdump clone for PDP10 Elf36 files.
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools 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.
|
||||
*
|
||||
* pdp10-tools 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 pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#define _GNU_SOURCE /* for getopt_long() */
|
||||
#include <errno.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user