1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-03-12 16:42:08 +00:00

14 Commits
v2.20 ... ver-1

Author SHA1 Message Date
David Schmenk
7aaba1f9ef Update notes to 1.2 2018-05-11 06:17:28 -07:00
David Schmenk
a61da48e5d Update README.md 2018-05-11 06:16:07 -07:00
David Schmenk
45489b3ab8 Update image 2018-05-07 12:41:06 -07:00
David Schmenk
81e40c4c7f Fix unhandled IRQ on IIGS 2018-05-07 10:23:31 -07:00
David Schmenk
6ff3cc2673 Update images 2018-05-02 18:26:37 -07:00
David Schmenk
f964099c24 Stop continuous events when mouse button pressed 2018-05-02 13:27:58 -07:00
David Schmenk
54ecb3eec7 Generate mouse event on button state change 2018-05-02 13:18:00 -07:00
David Schmenk
bb97fe6353 Fix infunc for asm defs 2018-05-01 07:39:51 -07:00
David Schmenk
9e441de1c2 Version 1.2 with IRQ fixes and mouse module 2018-04-29 19:13:03 -07:00
David Schmenk
3d337f4fa8 Change TFTPD text file EOL strategy 2018-04-29 14:50:39 -07:00
David Schmenk
15e4013f97 Fix tftp xlte bug when writing text files. Bunp version 2018-04-29 07:25:43 -07:00
David Schmenk
5f1656b6a1 Backport some fixes from V2 2018-04-27 14:10:26 -07:00
David Schmenk
9809c2b5b2 Add TFTPD to release 1 2018-04-23 13:47:42 -07:00
David Schmenk
c0ddb5d197 Add TFTPD to release 1 2018-04-23 13:46:08 -07:00
466 changed files with 10676 additions and 72100 deletions

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2010-2022 David Schmenk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

674
LICENSE.txt Executable file
View 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>.

BIN
PLASMA-BLD1.PO Normal file

Binary file not shown.

BIN
PLASMA-SYS1.PO Normal file

Binary file not shown.

1473
README.md Normal file → Executable file

File diff suppressed because it is too large Load Diff

BIN
SANDBOX.PO Executable file

Binary file not shown.

View File

@@ -1,222 +0,0 @@
# LISP 1.5 implemented in PLASMA
LISP interpreted on a bytecode VM running on a 1 MHz 6502 is going to be sssllllooooowwwww. So I called this implementation DRAWL in keeping with the speech theme. DRAWL represents an exploration REPL language for the PLASMA environment. It isn't meant to be a full-blown programming language, more of an interactive sandbox for playing with S-expressions.
## Missing features of LISP 1.5 in DRAWL
- Minimal I/O facilities
- Property lists. Only DEFINE() and CSETQ()/CSET() property functions supported
- General recursion. The 6502 architecture limits recursion (but see tail recursion below), so don't expect too much here
- Many of the built-in functions from the LISP 1.5 manual. Most can be coded in LISP and loaded at startup
However, the code is partitioned to allow for easy extension so some of these missing features could be implemented.
## Features of DRAWL
- 32 bit integers and 80 bit floating point with transcendental math operators by way of the SANE library
- Tail recursion handles deep recursion. Check out [loop.lisp](https://github.com/dschmenk/PLASMA/blob/master/src/lisp/loop.lisp)
- Fully garbage collected behind the scenes
- Optionally read LISP source file at startup
- Arrays of up to four dimensions
- Bit-wise logic operations on 32 bit integers
- FUNCTION operation with bound variables
- The PROG Alogol-like programming construct
- Additional testing/looping constructs: IF and FOR
- Hexadecimal input/output
- LoRes Apple II graphics
- Ctrl-C break into running program
- MACROs for meta-programming. See [defun.lisp](https://github.com/dschmenk/PLASMA/blob/master/src/lisp/defun.lisp)
- End-of-line comment using ';'
- String handling functions
The DRAWL implementation comes with the following built-in functions:
### Constants
- T = True
- F = False
- NIL = NULL
- CSET() = Set constant value
- CSETQ() = Set constant value
- :=() = Alias got CSETQ()
- DEFINE() = Define function
### Function types
- LAMBDA(...)
- FUNARG() = List constructed by FUNCTION()
- FUNCTION()
- MACRO(...) = Operate on non-evaluated argument list
### Predicates
- ATOM()
- EQ()
- NOT()
- AND(...)
- OR(...)
- NULL()
- NUMBER?()
- STRING?()
### Misc
- SET = Used in array access to set element value
- QUOTE()
- ARRAY() = Arrays up to four dimensions
- EVAL() = Evaluate S-expression
- TRACE() = Turn tracing on/off
- GC() = Run garbage collector and return free memory amount
- QUIT() = Exit REPL
### List manipulation
- CAR()
- CDR()
- CONS()
- LIST(...)
### Conditionals
- COND(...)
- IF() = IF THEN w/ optional ELSE
### Output
- PRHEX() = Turn hexadecimal output on/off
- PRI(...) = Print without newline
- PRINT(...) = Print with newline
- FMTFPI() = Floating point format integer digits
- FMTFPF() = Floating point format fractional digits
- PRINTER() = Turn printer echo on/off on slot#
### Looping
- FOR(...)
### Associations
- LABEL()
- SET()
- SETQ()
- =() = Alias got SETQ()
### Program feature
- PROG(...) = Algol like programming in LISP
- SET() = Update variable value
- SETQ() = Update variable value
- = = Alias for SETQ
- COND(...) = Fall-through COND()
- IF() = Fall-through IF THEN w/ optional ELSE
- GO() = Goto label inside PROG
- RETURN() = Return from PROG with value
### Numbers
- +(...)
- -()
- \*(...)
- /()
- REM()
- NEG()
- ABS()
- \>()
- <()
- MIN(...)
- MAX(...)
- NUMBER?()
### Integers
- BITNOT() = Bit-wise NOT
- ~() = Alias for BITNOT()
- BITAND() = Bit-wise AND
- &() = Alias for BITAND()
- BITOR() = Bit-wise OR
- |() = Alias for BITOR()
- BITXOR = Bit-wise XOR
- ^() = Alias for BITXOR()
- ARITHSHIFT() = Bit-wise arithmetic SHIFT (positive = left, negative = right)
- <<-() = Alias for ARITHSHIFT()
- LOGICSHIFT() = Bit-wise logicalal SHIFT (positive = left, negative = right)
- <<() = Alias for LOGICSHIFT()
- ROTATE() = Bit-wise ROTATE (positive = left, negative = right)
- <<<() = Alias for ROTATE()
### Floating Point (from the SANE library)
- *PI* = Constant value of pi
- *E* = Constant value of e
- NUMBER() = Convert atom to number (symbol and array return NIL)
- INTEGER() = Convert number to integer
- LOGB()
- SCALEB()
- TRUNCATE()
- ROUND()
- SQRT()
- COS()
- SIN()
- TAN()
- ATAN()
- LOG2()
- LOG2_1()
- LN()
- LN_1()
- POW2()
- POW2_1()
- POWE()
- POWE_1()
- POW_I()
- POW()
- COMP()
- ANNUITY()
### Strings
- STRING() = Convert atom to string
- SUBS() = SUB String offset length
- CATS(...) = conCATenate Strings
- LENS() = LENgth String
- CHARS(...) = CHARacter String from integer values
- ASCII() = ASCII value of first character in string
### I/O functions
- HOME()
- GOTOXY()
- KEYPRESSED?()
- READKEY()
- READ()
- READFILE()
- READSTRING()
### Lo-Res Graphics
- GR() = Turn lo-res graphics mode on/off
- COLOR() = Set plotting color
- PLOT() = Plot pixel at X,Y coordinate
LISP is one of the earliest computer languages. As such, it holds a special place in the anals of computer science. I've always wanted to learn why LISP is held in such high regard by so many, so I went about learning LISP by actually implementing a LISP interpreter in PLASMA. PLASMA is well suited to implement other languages due to its rich syntax, performance and libraries.
## Links
Here are some links to get you started.
LISP 1.5 Manual: https://archive.org/details/bitsavers_mitrlelisprammersManual2ed1985_9279667
LISP 1.5 Primer: https://www.softwarepreservation.org/projects/LISP/book/Weismann_LISP1.5_Primer_1967.pdf
Personal LISP on Apple II Manual (PDF): https://archive.org/details/gLISP/gnosisLISPManual
Personal LISP on Apple II Manual (web archive): https://web.archive.org/web/20190603120105/http://jeffshrager.org/llisp/
Apple Numerics Manual (SANE): https://vintageapple.org/inside_o/pdf/Apple_Numerics_Manual_Second_Edition_1988.pdf
Part 1 of DRAWL in action (S-expressions): https://youtu.be/wBMivg6xfSg
Part 2 of DRAWL in action (The rest of LISP 1.5): https://youtu.be/MdKZIrfPN7s
Preconfigured PLASMA ProDOS boot floppy for DRAWL: https://github.com/dschmenk/PLASMA/blob/master/images/apple/DRAWL.po
My blog post about LISP 1.5 and DRAWL: http://schmenk.is-a-geek.com/wordpress/?p=365

View File

@@ -1,10 +1,9 @@
WELCOME TO THE PLEIADES EDITOR!
===============================
WELCOME TO THE PLASMA EDITOR!
=============================
FIRST THINGS FIRST:
TO NAVIGATE, USE THE ARROW KEYS.
ON THE APPLE ][:
TO NAVIGATE, USE THE ARROW KEYS. ON THE
APPLE ][:
CTRL-K = UP
CTRL-J = DOWN.
@@ -19,19 +18,22 @@ TO JUMP AROUND THE TEXT FILE USE:
CTRL-Q = JUMP BEGINNING
CTRL-E = JUMP END
THE 'ESCAPE' KEY WILL PUT YOU IN
COMMAND MODE. FROM THERE YOU CAN
EXIT BY ENTERING 'Q' AND 'RETURN'.
YOU CAN ALSO RETURN TO THE EDITOR BY
JUST PRESSING 'RETURN'.
THE 'ESCAPE' KEY WILL PUT YOU IN COMMAND
MODE. FROM THERE YOU CAN EXIT BY
ENTERING 'Q' AND 'RETURN'. YOU CAN ALSO
RETURN TO THE EDITOR BY JUST PRESSING
'RETURN'.
-------------------------------------------------------------------------
-------
THE PLEIADES EDITOR IS A SIMPLE TEXT EDITOR FOR ENTERING AND MANIPULATING
TEXT AND SOURCE CODE FILES. THE EDITOR SUPPORTS FROM 40 TO 128 COLUMN MODE
WITH LINES THAT CAN BE UP TO 127 CHARACTERS LONG. THE SCREEN WILL SCROLL
HORIZONTALLY AS THE CURSOR MOVES, IF NEDED. THERE IS ABOUT 16K TO 30K OF
MEMORY FOR THE TEXT BUFFER, DEPENDING ON YOUR CONFIGURATION.
THE PLASMA EDITOR IS A SIMPLE TEXT
EDITOR FOR ENTERING AND MANIPULATING
TEXT AND SOURCE CODE FILES. THE EDITOR
ONLY SUPPORTS 40 COLUMN TEXT ALTHOUGH
LINES CAN BE UP TO 79 CHARACTERS LONG.
THE SCREEN WILL SCROLL HORIZONTALLY
AS THE CURSOR MOVES. THERE IS 16K OF
MEMORY FOR THE TEXT BUFFER.
IT HAS TWO MODES, COMMAND AND EDIT.
@@ -50,17 +52,13 @@ EDIT COMMANDS:
CTRL-Q = JUMP BEGIN
CTRL-E = JUMP END
CTRL-D = DELETE CHAR
CTRL-B = BEGIN SELECTION
CTRL-C = COPY SELECTION INTO CLIPBOARD
CTRL-X = CUT SELECTION INTO CLIPBOARD
CTRL-V = PASTE CLIPBOARD
CTRL-X = DELETE/CUT LINE
CTRL-V = COPY DELETED LINE
CTRL-O = OPEN NEW LINE
CTRL-F = OPEN A FOLLOWING NEW LINE
CTRL-Y = JOIN LINES
CTRL-T = TOGGLE INSERT/OVERWRITE
CTRL-T = JOIN LINES
CTRL-B = TOGGLE INSERT/OVERWRITE
TAB/CTRL-I = INSERT SPACES TO NEXT TAB
= INDENT SELECTION IF INSERT MODE
= UNDENT SELECTION IF OVERWITE MODE
ESCAPE = SWITCH TO COMMAND MODE
DELETE = DELETE CHAR LEFT
@@ -76,46 +74,46 @@ EDIT COMMANDS:
CTRL-L = SHIFT LOCK
SHIFT-LEFT ARROW = DELETE (SHIFT-MOD)
WITH THE SHIFT-KEY MOD ON AN APPLE ][, UPPER AND LOWER CASE ENTRY WORKS
AS EXPECTED.
WITH THE SHIFT-KEY MOD ON AN
APPLE ][, UPPER AND LOWER CASE
ENTRY WORKS AS EXPECTED.
ESC T C = FORCE LOWER-CASE CHARS
CTRL-C = FORCE LOWER-CASE CHARS
If you have a lower-case character generator installed, you can force
lower-case display. Otherwise, upper case will be displayed normally
but lower-case will be displayed in inverse. This is the default.
If you have a lower-case character
generator installed, you can force
lower-case display. Otherwise,
upper case will be displayed normally
but lower-case will be displayed in
inverse. This is the default.
Apple //e AND //c FEATURES:
---------------------------
The 'SOLID-APPLE' key will modify these keys:
The 'SOLID-APPLE' key will modify
theese keys:
SA-RETURN = OPEN FOLLOWING LINE
SA-RETURN = OPEN LINE
SA-LEFT ARROW = JUMP LEFT
SA-RIGHT ARROW = JUMP RIGHT
SA-UP ARROR = JUMP UP
SA-DOWN ARROW = JUMP DOWN
SA-TAB = DETAB
Apple /// FEATURES:
-------------------
The 'OPEN-APPLE' key will modify these keys:
The 'OPEN-APPLE' key will modify
these keys:
OA-\ = DELETE CHAR LEFT
OA-RETURN = OPEN FOLLOWING LINE
OA-RETURN = OPEN LINE
OA-LEFT ARROW = JUMP LEFT
OA-RIGHT ARROW = JUMP RIGHT
OA-UP ARROR = JUMP UP
OA-DOWN ARROW = JUMP DOWN
OA-TAB = DETAB
Apple //e Platinum IIGS & /// FEATURES:
---------------------------------------
On the keypad, 'OPTION' on //e Platinum & IIGS
or 'OPEN-APPLE' on the /// allows the keys for
navigation and misc operations:
On the keypad, 'OPEN-APPLE' allows
the keys for navigation and misc:
OA-4 = MOVE CHAR LEFT
OA-6 = MOVE CHAR RIGHT
@@ -125,15 +123,11 @@ EDIT COMMANDS:
OA-3 = JUMP DOWN
OA-7 = JUMP BEGIN
OA-1 = JUMP END
OA-5 = SELECT/DESELECT
OA-- = CUT SELECTION INTO CLIPBOARD
OA-+ = COPY SELECTION INTO CLIPBOARD
OA-0 = DELETE CHARACTER
OA-/ = INSERT/OVERWRITE
OA-* = OPEN CURRENT LINE
OA-ENTER = OPEN NEXT LINE
OA-. = PASTE CLIPBOARD
OA-= = NUMLOCK (NUMBER KEYS ACT LIKE OA/OPTION PRESSED)
OA-5 = DELETE CHAR
OA-- = DELETE/CUT LINE
OA-0 = COPY DELETED LINE
OA-ENTER = OPEN NEW LINE
OA-. = TOGGLE INSERT/OVERWRITE
COMMAND MODE:
@@ -148,10 +142,5 @@ COMMAND MODE:
P <PREFIX> = SET PREFIX
H [SLOT] = HARDCOPY TO DEVICE IN SLOT (DEFAULT 1)
N = CLEAR TEXT IN MEMORY
T G = TOGGLE GUTTER VIEW
T C = TOGGLE LOWER-CASE SUPPORT (APPLE ][)
F [STRING] = FIND STRING
E = EDIT MODE
'RETURN' = EDIT MODE
1..999 = GO TO LINE #

File diff suppressed because it is too large Load Diff

View File

@@ -1,158 +0,0 @@
# FORTH PLASMA + PLFORTH !
PLFORTH represents a REPL and scripting language for the PLASMA environment. Or, what I did over the Holiday break.
The goals of PLFORTH are pretty straight forward:
**Interactivity** and **debugging**.
PLFORTH is a PLASMA module written in PLASMA itself. As a first class citizen of the PLASMA environment, it has instant access to all the PLASMA modules, from floating point to high-res graphics libraries and everything in between.
## Missing words in PLFORTH
There are quite a few missing word that a standard FORTH would have. Mostly due to deliberately keeping PLFORTH as minimal as possible to reduce the memory footpring and load time. Most of the missing words can be synthesized using existing PLASMA modules and some glue words. The double word have mostly been made avialable through PLASMA's 32 bit integer module, `INT32` by way of the `int32.4th` script. You can always petition to get your favorite FORTH word included in the default vocabulary. Speaking of `VOCABULARY`, PLFORTH only has one.
## PLFORTH built-in words
Compile only: LITERAL ; EXIT POSTPONE
COMPILE, [ DOES> REPEAT WHILE UNTIL
AGAIN BEGIN J I +LOOP LOOP UNLOOP LEAVE
DO ENDCASE ENDOF OF CASE THEN ELSE IF
RECURSE
Interpret only: PBC ITC BRKOFF BRKON
SEE CONT ] IS DEFER :NONAME : FORGET
CONSTANT VARIABLE PLASMA
Both: WORDS BRK STEPOFF STEPON TROFF
TRON .RS .S BYE ( COLD ?ABORT"
(?ABORT") ?ABORT QUIT ENDSRC ?ENDSRC
SRC" SRC .( ." (.") " CHAR BL TYPE
SPACES SPACE CR EMIT C%. %. C$. $. . ?
COMPARE -TRAILING NUM? WORD ACCEPT KEY
KEY? ' FIND COUNT IMMEDIATE INTERPONLY
COMPONLY STATE C, , CREATE ALLOT PAD
HERE LATEST FILL CMOVE LOOKUP R@ R> >R
EXECUTE @ C@ +! ! C! MAX MIN ABS 0<> 0=
0> 0< U< U> < > <> = RSHIFT LSHIFT NOT
COMPLEMENT XOR OR AND NEGATE MOD /MOD /
* - 2- 1- 2+ 1+ + ROT OVER ?DUP DUP2
DUP SWAP DROP2 DROP
## PLFORTH specific words
### Words for looking at internal structures:
`.RS`: Displays the return stack. Note: PLFORTH uses a software defined return stack, this is not the hardware stack
### Words for tracing and single stepping execution:
`TRON`: Turn tracing on
`TROFF`: Turn tracing off (will also turn off single stepping if enabled)
`STEPON`: Turn single stepping on
`STEPOFF`: Turn single stepping off
While running code, `<CTRL-T>` will toggle tracing on and off as well
### Words for breakpoints:
`BRK`: Used inside compiled word to effect a runtime break
`BRKON xxxx`: Enable breakpoint whenever word `xxxx` is executed
`BRKOFF`: Disable the breakpoint. Note: only one breakpoint is currently supported
While running code, `<CTRL-C>` will break out and return to the interpreter.
`CONT`: Continue running from the last break point
### Words for PLASMA linkage:
`LOOKUP yyyy`: Lookup symbol `yyyy` in PLASMA symbol table and return its address
`PLASMA zzzz`: Create word `zzzz` with code address from `LOOKUP`
### Words to run a script:
`SRC`: Source filename on stack as input. Can be nested
`SRC" ssss"`: Source file `ssss` as input. Can be nested
`?ENDSRC`: End sourcing file as input if stack flag non-zero
`ENDSRC`: End sourcing file as input
### Words for compiler modes:
`PBC`: Compile into PLASMA Byte Code
`ITC`: Compile into Indirect Threaded Code
### Word for converting string to number:
`NUM?`: Convert string and length to number, returning number and valid flag
Numbers entered with a preceeding `$` will be interpreted as hex values
Numbers entered with a preceeding `%` will be interpreted as binary values
### Words for displaying hex numbers
`$.`: Display TOS word in hex with leading `$`
`C$.`: Display TOS byte in hex with leading `$`
Hex numbers can be entered when preceded by `$`
### Words for displaying binary numbers
`%.`: Display TOS word in binary with leading `%`
`C%.`: Display TOS byte in binary with leading `%`
Binary numbers can be entered when preceded by `%`
## Debugging vs Performance
PLFORTH defaults to compiling using ITC (Indirect Threaded Code). This supports a list of inspection and debugging features while developing programs and scripts. However, the compiler can easily switch to PBC (PLASMA Byte Code) to greatly improve performance, but most of the debugging tools are lost. ITC compiled words and PBC compiled words can be intermingled and call each other seemlessly. PLASMA Byte Code is a direct match to many low-level FORTH constructs.
## Graphics
Due to the way the Apple II implements Hi-Res, Lo-Res and Double Lo-Res graphics, a stub loader is required to reserve the pages used.
`HRFORTH`: Reserve HGR page 1 before launching PLFORTH
`HR2FORTH`: Reserve HGR pages 1 and 2 before launching PLFORTH
`TX2FORTH`: Reserve GR and DGR pages 1 and 2 before launching PLFORTH
## Scripts
There are a few useful scripts located in the `scripts` directory. By far the most useful is `plasma.4th`
### plasma.4th useful words
`CAT`: Display files in current ProDOS directory
`CAT" pppp"`: Display files in `pppp` ProDOS directory
`PFX" pppp"`: Set current ProDOS prefix to `pppp`
`PFX.`: Display current ProDOS prefix
`EDIT" ssss"`: Edit file `ssss`
## Command line options
`-F`: Fast flag (like `PCB` as first command)
`-T`: Trace flag (like `TRON` as first command)
`SCRIPT NAME`: Soure filename to execute
## Links
Here is a (worse than usual) video running through some examples. This was a preliminary release so the final is a bit different: https://youtu.be/picPyXAk77I?si=Td2En5Z3oxVTzh0z
A pre-configured ProDOS floppy image able to run and a few utilities is available here: https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.po

Binary file not shown.

View File

@@ -1,94 +0,0 @@
PLASMA goes ROGUE
=================
Introduction
------------
This version of ROGUE is somewhat different than others. It is very simple in most ways, but I have developed a (I think) unique visibility algorithm that runs extremely fast. Fast enough to run interpreted by the PLASMA VM on a 1 MHz 6502, and space efficient enough to allow for large (in the future) dungeons. The unique feature of this ROGUE is that lighting becomes critical and strategic. You are in dark catacombs, after all. You enter with a lit lamp, throwing off a circle of light. There are also torches throughout the catacombs that light up a small surrounding circle of light. Other items in the catacombs are mana (health+energy increase), a key, a raft, and gold. You will also encounter a number of enemies that will track you down to try and kill you. You will also encounter doors, locked doors, windows, water, and crevasses.
Strategy
--------
As you travel through the catacombs, you must watch your health, energy, and lamp oil levels. Once health reaches zero, you are dead. As energy reaches zero, your vision will narrow and you will no longer be able to run. When the lamp oil runs out, you will be cast into darkness. If you see any torches in your field of vision, you can navigate to them. Taking the torch will extinguish the torch and replenish some of your lamp oil. Note that as you travel through the catacombs, your map of what you have seen will automatically fill in. But, if you are in the dark, you cannot read your map. You must turn on your lamp or get next to a torch before you can read the map again. If you are in the dark and cant see any torches in your field of vision, you are in complete darkness. It is easy to lose your bearings. As such, the absolute direction movements no longer work (NSEW) - you will end up in a random direction if you try. However, the relative turns, left/right and forward/backward controls continue to work (that you can do in the dark).
Being in the dark can be advantageous, however. All the enemies in the catacombs can see you if you are in light, just as you can see them. If you are in darkness, they can't see you, and you can move around without being tracked. Don't run into them! Also, don't fall off a crevasse. You will hear certain noises giving you feedback on what is going on. A simple beep when you run into walls. A groan when an enemy moves towards you. A bleep when you pick an item up. Other noises when you fall over an edge or win a battle. These can be used strategically when moving in the dark.
Health will slowly improve as you move around. However, energy is depleted as you move. Mana will increase both health and energy. If health is already at 100, it wont go any higher. Same for energy, but it is important to keep both high. When energy goes low, you can no longer move quickly and your field-of-vision narrows. When health goes to zero, you are dead.
Tile Description
----------------
As ROGUE uses the text screen for display, a little creativity is required to interpret the map. These are the characters you will see and what the represent. Once you get the hang of it, it will be just like looking at the unencoded Matrix.
Screen Character Represents
# Wall
. Floor
: Window (barred opening)
+ Door
% Locked Door (need key to open)
' ' space Crevasse (pit - don't fall in)
= Exit
- Entrance
*,X Torch
& Mana
, Key (yep, hard to spot)
@ Raft (need to cross water)
((( Water
))) Water (you will drown without raft)
$ Gold
Flashing Entity
T Thief
O Ogre
Z Zombie
R Rogue
Player Facing Direction
^ North
\ NE
> East
/ SE
v South
\ SW
< West
/ NW
Tiles in light are inverse. Entities are displayed only when lit and in field of view. The map is only visible when lit, i.e lamp is on or standing next to a torch.
Interaction
-----------
Keyboard commands Action
Q Run (Quick)
W up-arrow Forward
S down-arrow Backward
A left-arrow Turn left
D right-arrow Turn right
I Move N
J Move W
K Move E
M Move S
< , Turn lamp down
> . Turn lamp up/on
O Turn lamp off
Space-bar Open door
Return Pick up item
X Exit (die)
Whenever you and an enemy end up on the same tile, battle commences. As you win fights, your skill increases, improving your attack effectiveness. As you advance through the catacombs, the enemies become more powerful. You will need to replenish health and energy with mana. Don't forget, the alternative to fighting is stealth in the darkness. During battle, you have the option to run. If you have low energy, you won't get very far. Also, when fighting, you get turned around so you can't depend on the direction you were facing before fighting. Running ('Q'uick) will get you away from enemies but will use much more energy.
If you should die, restart the game by typing:
+rogue
Map Levels
----------
Level maps are up to 62x62 in size (plus a wall boundary for an effective 64x64 map size). They can be smaller than this. The game will end when it tries to load an non-existent level. Levels start at file name “LEVEL0“ and can go all the way to “LEVEL9“, but must be sequential.
There are two levels included on the disk, and an empty level for you to use as a template. You can edit the map levels, and add your own. They are simple ASCII text files. The included editor can edit the maps right on the disk. type:
+ed level.empty
after exiting from ROGUE. Make your changes and save it as LEVEL0" to "LEVEL9". The next free level is currently "LEVEL2". You may also edit an existing level:
+ed level0
for instance.

View File

@@ -81,13 +81,13 @@ If you should die, restart the game by typing:
Level maps are up to 62x62 in size (plus a wall boundary for an effective 64x64 map size). They can be smaller than this. The game will end when it tries to load an non-existent level. Levels start at file name “LEVEL0“ and can go all the way to “LEVEL9“, but must be sequential.
There are two levels included on the disk, and an empty level for you to use as a template. You can edit the map levels, and add your own. They are simple ASCII text files. The included editor can edit the maps right on the disk. type:
There are two levels included on the disk, and an empty level for you to use as a template. You can edit the map levels, and add your own. They are simple ASCII text files. The included sandbox editor can edit the maps right on the disk. type:
```
+ed level.empty
-sandbox level.empty
```
after exiting from ROGUE. Make your changes and save it as LEVEL0" to "LEVEL9". The next free level is currently "LEVEL2". You may also edit an existing level:
```
+ed level0
-sandbox level0
```
for instance.

View File

@@ -1,310 +0,0 @@
# PLASMA Version 2.1
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
Download the five disk images:
[PLASMA 2.1 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1.2mg?raw=true)
[PLASMA 2.1 ProDOS Boot & Install](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-INST.po?raw=true)
[PLASMA 2.1 System Libraries](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-SYS.po?raw=true)
[PLASMA 2.1 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-BLD.po?raw=true)
[PLASMA 2.1 Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-DEMOS.po?raw=true)
[PLASMA 2.1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-INET.po?raw=true)
[PLASMA 2.1 Apple /// SOS Mame Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA-2.1-FPSOS.po?raw=true)
[PLASMA 2.1 Apple /// SOS Mame Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-A3MAME.PO?raw=true)
[PLASMA 2.1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?raw=true)
[PLASMA 2.1 PLFORTH stand-alone boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO?raw=true)
PLASMA now has a ProDOS hard disk install script. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice) if you want to copy files yourself:
Boot & System Files => /HARDISK/PLASMA/
Build Files => /HARDISK/PLASMA/BLD/
Demo Files => /HARDISK/PLASMA/DEMOS/
Floating Point SANE Files => /HARDISK/PLASMA/SYS
INET Files => /HARDDISK/PLASMA/SYS
Use the System Utilities to copy the floppy images into the above mentioned directories.
## Apple 1
The Apple 1 is a very constrained system compared to the ][ and ///. It is required to have the CFFA1 disk adapter installed to provide file storage and a full 32K od RAM. To get the files onto the CF card required the use of [CiderPress](http://a2ciderpress.com) and they must be placed in one directory. Most PLASMA programs won't work on the Apple 1 due to limited filesystem support, video/graphics capabilities, and lack of audio output. It does, however, make a good place to start when porting PLASMA to a new platform.
## Apple ][
To boot directly into PLASMA, you will need to put the system files in the root prefix of the boot device and make sure PLASMA.SYSTEM is the first SYSTEM file in the directory. Otherwise, start PLASMA.SYSTEM from your program launcher of choice. All Apple ][ models with 64K and two floppy drives are supported up to a maxed out IIGS with accelerator and hard drive.
#### 65802/65816 Support
PLASMA can utilize the 16 bit features of the 65802 and 65816 processors to improve performance of the PLASMA VM operation. This is transparent to the programmer/user and doesn't make any additional memory or capabilities available to PLASMA. PLASMA will automatically run the most optimal VM for your configuration.
## Apple ///
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-A3MAME.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
## PLASMA Command Line Shell
PLASMA incorporates a very basic command line shell to facilitate navigating the filesystem and executing both SYSTEM/SOS programs and PLASMA modules. It has a few built-in commands:
| Command | Operation |
|:----------------------------:|-------------------------|
| C [PREFIX] | Catalog prefix
| P \<PREFIX\> | change to Prefix
| / | change to parent prefix
| V | show online Volumes
| S \<PREFIX\> | set System prefix*
| +SOS \<SOS.INTERP\> [PREFIX] | launch SOS interpreter*
| -\<SYSTEM PROGRAM\> [PARAMS] | launch SYSTEM program**
| +\<PLASMA MODULE\> [PARAMS] | exec PLASMA module
```
[Optional parameters]
<Required parameters>
* Apple /// only
** Apple ][ only
```
The shell is very brief with error messages. It is meant solely as a way to run programs that accept command line parameters and take up as little memory as possible. It does, however, provide a rich runtime for PLASMA modules.
## Included Modules
PLASMA comes with many library modules used by the tools, demos and sample code. The PLASMA system volume must remain in place for the duration of PLASMAs run otherwise it won't be able to find CMD or the system libraries. Probably the most useful included module is the editor. It is used for editing PLASMA source file, assembly source files, or any text file. Execute it with:
```
+ED [TEXT FILE] [GOTO LINE NUMBER]
```
The file manipulation utilities to copy, delete, rename, create directories, and change file type and aux type remove the need for external programs to do the same. PLASMA can now be installed with the tools included on the PLASMA2-SYS boot floppy. They are:
```
+COPY [-R] <SRCPATH>+ <DSTPATH>
+DEL [-R] <FILEPATH>
+REN <FILENAME> <NEWNAME>
+NEWDIR <NEWDIRECTORY>
+TYPE <FILENAME> [NEWTYPE [NEWAUX]]
+CAT [-R] <FILEPATH]
```
The ```-R``` option will operate on the directories recursively. Wildcard filenames can be specified with ```'*'``` matching zero or more characters, and ```'?'``` matching any character. When copying files to the current directory, ```=``` can be used as a shortcut.
## Compiler Modules
The build disk includes sample source, include files for the system modules, and the PLASMA compiler+optimizer modules. The compiler is invoked with:
```
+PLASM [-[W][O[2]] <SOURCE FILE> [OUTPUT FILE]
```
Compiler warnings are enabled with `-W`. The optional optimizer is enabled with `-O` and extra optimizations are enabled with `-O2`. The source code for a few sample programs are included. The big one, `RPNCALC.PLA`, is the sample RPN calculator that uses many of PLASMA's advanced features. The self-hosted compiler is the same compiler as the cross-compiler, just transcribed from C to PLASMA (yes, the self-hosted PLASMA compiler is written in PLASMA). It requires patience when compiling: it is a fairly large and extensive program.
## Demos
There are some demo programs included for your perusal. Check out `ROGUE` for some diversion. You can find the documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/Rogue%20Instructions.md. A music sequencer to play through a MockingBoard if it is detected, or the built-in speaker if not. A minimal Web server if you have an Uthernet2 card (required). Try `SPIDERS`for some hires shoot'em-up action. Bug reports appreciated.
## Source Code
Most sample source code is included from the project. They build without alteration and should be a good starting point for further explorations. The header files for the included library modules are in the INC directory.
## Video Playlist
There is a [YouTube playlist](https://www.youtube.com/playlist?list=PLlPKgUMQbJ79VJvZRfv1CJQf4SP2Gw3yU) created for learning PLASMA. It is a WIP, with updates every week or so
## Issues
- All the modules and runtime are written mostly in PLASMA; the compiler and editor as well. This means that there may be some startup delay as the PLASMA module loader reads in the module dependencies and performs dynamic linking. But a 1 MHz, 8 bit CPU interpreting bytecodes is never going to match a modern computer. As noted earlier, an accelerator and mass storage are your (and PLASMA's) friend.
- All the project modules are included. They have been lightly tested.
- The Apple /// may not always report errors properly or at all.
- The documentation is sparse and incomplete. Yep, could use your help...
# Changes in PLASMA for 2.0 Release
1. Fix command line buffer overflow
2. Use VBlank to blink editor cursor so not CPU speed dependent
3. Add ```=``` for ```+COPY``` current destination
4. Add //c support for DGRLIB and GRLIB wait-for-VBlank routines
# Changes in PLASMA for 2.0 Beta
1. Compilers allows for including self imported defines
2. Compilers fixed for local constants
3. Floating point string formatting fixes and improvements
4. Fiber library exports number of active fibers
# Changes in PLASMA for 2.0 Alpha 2
1. Self hosted compiler fixes for invalid array size constants
2. Ensure IDs in self hosted compiler are 31 characters significant
3. Fix bug COPY file parsing and move common routine into MATCHFILES
# Changes in PLASMA for 2.0 Alpha 1
1. Improved entry/exit for 128K Apple IIe //c
2. Improved entry for Apple ///
3. Improved entry and function calls for 16 bit VM
# Changes in PLASMA for 2.0 DP 4
1. Improved editor auto-indenting
2. Compiler fix for terneray operator precedence
3. Machine check for HGR library
# Changes in PLASMA for 2.0 DP 3
1. File manipulation utilities fixed for Apple /// SOS vs ProDOS differences
2. More optimizations for HiRes graphics libraries
3. Spiders From Mars hires demo game
# Changes in PLASMA for 2.0 DP 2
1. Many file manipulaition utilities (COPY, REName, NEWDIRectory, DELete, CATalog, TYPE)
2. New and updated libraries for lo-res. double lo-res and hi-res graphics w/ sprites
3. 32 bit integer library for those times when 16 bits just isn't enough
4. Apple /// improvements to other SOS.INTERP launching with SOS utility
5. Apple /// JIT VM for speed and non JIT version to free up global memory
6. Editor improvements
7. A couple small compiler optimizations
8. Needed to break out TCP/IP modules into seperate floppy image
9. Library changes require full install
# Changes in PLASMA for 2.0 DP 1z
1. Many fixes for the value zero - especially in 65802/65816 divide routine
# Changes in PLASMA for 2.0 DP 1 E+C
1. Greatly improved code editor and additional compiler stats
# Changes in PLASMA for 2.0 DP 1a
1. Fix interaction with JIT compiler and module load/unload
# Changes in PLASMA for 2.0 DP 1
1. Expanded bytecode for more efficient size/performance of programs
2. Just-In-Time Compiler for native code performance (6502 and 65816) for frequently called routines
3. Automatically identify and run most optimal VM for configuration
# Changes in PLASMA for 1.2
1. Add TFTPD TFTP server
2. Fix Uthernet 1 driver
3. Add mouse module
4. Fix IRQ issues for interrupt driven mouse driver
# Changes in PLASMA for 1.1
1. All known bugs are fixed
2. PLASM compiler received a little performance boost with an assembly language helper for ID/keyword lexical scanner
# Changes in PLASMA for 1.0
If you have been programming in PLASMA before, the 1.0 version has some major and minor changes that you should be aware of:
1. Case is no longer significant. Imported symbols were always upper case. Now, all symbols are treated as if they were upper case. You may find that some symbols clash with previously defined symbols of different case. Hey, we didn't need lower case in 1977 and we don't need it now. You kids, get off my lawn!
2. Modules are now first class citizens. Translation: importing a module adds a symbol with the module name. You can simply refer to a module's address with it's name. This is how a module's API table is accessed (instead of adding a variable of the same name in the IMPORT section).
3. Bytecode changes means previously compiled modules will crash. Rebuild.
4. `BYTE` and `WORD` have aliases that may improve readability of the code. `CHAR` (character) and `RES` (reserve) are synonyms for `BYTE`. `VAR` (variable) is a synonym for `WORD`. These aliases add no functionality. They are simply syntactic sugar to add context to the source code, but may cause problems if you've previously used the same names for identifiers.
5. When declaring variables, a base size can come after the type, and an array size can folllow the identifier. For instance:
```
res[10] a, b, c
```
will reserve three variables of 10 bytes each. Additionally:
```
res[10] v[5], w[3]
```
will reserve a total of 80 bytes (10 * 5 + 10 * 3). This would be useful when combined with a structure definition. One could:
```
res[t_record] patients[20]
```
to reserve an array of 20 patient records.
6. Ternary operator. Just like C and descendants, `??` and `::` allow for an if-then-else inside an expression:
```
puts(truth == TRUE ?? "TRUE" :: "FALSE")
```
7. Multiple value assignements. Multiple values can be returned from functions and listed on variable assignments:
```
def func#3 // Return 3 values
return 10, 20, 30
end
a, b, c = 1, 2, 3
c, d, f = func()
x, y = y, x // Swap x and y
```
8. `DROP` allows for explicit dropping of values. In the above `func()` example, if the middle value was the only one desired, the others can be ignored with:
```
drop, h, drop = func()
```
9. The compiler tracks parameter and return counts for functions. If the above `func()` were used without assigning all the return values, they would be dropped:
```
a = func() // Two values silently dropped
```
To generate compiler warning for this issue, and a few others, use the `-W` option when compiling.
10. Lambda (Anonymous) Functions. The ability to code a quick function in-line can be very powerful when used properly. Look here, https://en.wikipedia.org/wiki/Anonymous_function, for more information.
11. SANE (Standard Apple Numerics Environment) Floating Point Library. An extensive library (two, actually) of extended floating point (80 bit IEEE precision) functionality is suported. A wrapper library has been written to greatly simplify the interface to SANE. Look at the `RPNCALC.PLA` source code as an example.
12. Library Documentation. Preliminary documentation is available on the Wiki: https://github.com/dschmenk/PLASMA/wiki
13. Significant effort has gone into VM tuning and speeding up module loading/dynamic linking.
14. The VM zero page usage has changed. If you write assembly language routines, you will need to rebuild.
# Thanks
I wish to thank the people who have contributed the the PLASMA project. They have greatly improved the development of the language and documentation:
- Martin Haye: PLASMA programmer extraordinaire. Mr. Lawless Legends has requested many of the crucial features that set PLASMA apart.
- Steve F (ZornsLemma): Has taken the optimizer to new levels and his work on porting PLASMA to the Beeb are amazing: http://stardot.org.uk/forums/viewtopic.php?f=55&t=12306&sid=5a503c593f0698ebc31e590ac61b09fc
- Peter Ferrie: Assembly optimizer extraordinaire. He has made significant improvements into the code footprint in PLASMA so all the functionality can exist in just a few bytes.
- David Schmidt (DaveX): His help in documentation have made it much more accessible and professional. Of course any errors are all his. Just kidding, they're mine ;-)
- Andy Werner (6502.org): Catching the grammatical errors that I ain't no good at.
- John Brooks: Apple II Guru par excellence. His insights got 10% performance increase out of the VM.
Dave Schmenk
http://schmenk.is-a-geek.com

View File

@@ -1,352 +0,0 @@
# PLASMA Version 2.11
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
Version 2.11 is a minor update to address the relocating loader for EDASM generated modules with 8 bit fixups. All modules up to now have been generated by PLASM and only use 16 bit fixups. Mostly usefull for future modules built with EDASM. Check out the Assembly Language Toolkit below.
If you already have 2.1 installed, here are the updated files:
[PLASMA 2.11 Update](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.11-UPD.po)
Download the full 2.11 disk image set:
[PLASMA 2.11 HD Full System](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA2.2mg)
[PLASMA 2.11 800K Full System](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1.po)
[PLASMA 2.11 ProDOS Boot & Install](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-INST.po)
[PLASMA 2.1 System Libraries](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-SYS.po)
[PLASMA 2.11 Build Tools](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-BLD.po)
[PLASMA 2.1 Demos](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-DEMOS.po)
[PLASMA 2.1 TCP/IP network modules](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-INET.po)
[PLASMA 2.11 Apple /// SOS and SANE floating point modules](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.1-FPSOS.po)
[PLASMA 2.11 Apple /// SOS Mame Boot](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA2-A3MAME.PO)
[PLASMA 2.11 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/raw/master/images/apple/apple3.hd)
[PLASMA 2.11 PLFORTH stand-alone boot](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLFORTH.PO)
[PLASMA 2.11 Assembly Language Toolkit](https://github.com/dschmenk/PLASMA/raw/master/images/apple/ASM-TK.po)
PLASMA now has a ProDOS hard disk install script. Mass storage is the recommended installation that looks like (replacing HARDISK with your volume name of choice) if you want to copy files yourself:
Boot & System Files => /HARDISK/PLASMA/
Build Files => /HARDISK/PLASMA/BLD/
Demo Files => /HARDISK/PLASMA/DEMOS/
Floating Point SANE Files => /HARDISK/PLASMA/SYS
INET Files => /HARDDISK/PLASMA/SYS
Use the System Utilities to copy the floppy images into the above mentioned directories.
## Apple 1
The Apple 1 is a very constrained system compared to the ][ and ///. It is required to have the CFFA1 disk adapter installed to provide file storage and a full 32K od RAM. To get the files onto the CF card required the use of [CiderPress](http://a2ciderpress.com) and they must be placed in one directory. Most PLASMA programs won't work on the Apple 1 due to limited filesystem support, video/graphics capabilities, and lack of audio output. It does, however, make a good place to start when porting PLASMA to a new platform.
## Apple ][
To boot directly into PLASMA, you will need to put the system files in the root prefix of the boot device and make sure PLASMA.SYSTEM is the first SYSTEM file in the directory. Otherwise, start PLASMA.SYSTEM from your program launcher of choice. All Apple ][ models with 64K and two floppy drives are supported up to a maxed out IIGS with accelerator and hard drive.
#### 65802/65816 Support
PLASMA can utilize the 16 bit features of the 65802 and 65816 processors to improve performance of the PLASMA VM operation. This is transparent to the programmer/user and doesn't make any additional memory or capabilities available to PLASMA. PLASMA will automatically run the most optimal VM for your configuration.
## Apple ///
The Apple /// gets the environment it always wanted: The ability to navigate the filesystem with a command line interface. The Apple /// always boots from the floppy drive, even if a hard disk is installed. `PLASMA2-A3MAME.PO` is an Apple 3 bootable disk containing the SOS.DRIVER configured for the [Apple 3 Ready-To-Run Mame environment](https://github.com/datajerk/apple3rtr). `apple3.hd` is the pre-installed PLASMA hard disk image set up for [Apple 3 Ready-to-Run](https://github.com/datajerk/apple3rtr). For a physical Apple 3, the PLASMA2-FPSOS.PO floppy should be updated with the SOS.DRIVER configured for the machine. Once booted, type `S /HARDISK/PLASMA` (or your install directory of choice) to change to, and set, the system directory. This can be automated by creating an `AUTORUN` file on the boot floppy with the above command in it.
## PLASMA Command Line Shell
PLASMA incorporates a very basic command line shell to facilitate navigating the filesystem and executing both SYSTEM/SOS programs and PLASMA modules. It has a few built-in commands:
| Command | Operation |
|:----------------------------:|-------------------------|
| C [PREFIX] | Catalog prefix
| P \<PREFIX\> | change to Prefix
| / | change to parent prefix
| V | show online Volumes
| S \<PREFIX\> | set System prefix*
| +SOS \<SOS.INTERP\> [PREFIX] | launch SOS interpreter*
| -\<SYSTEM PROGRAM\> [PARAMS] | launch SYSTEM program**
| +\<PLASMA MODULE\> [PARAMS] | exec PLASMA module
```
[Optional parameters]
<Required parameters>
* Apple /// only
** Apple ][ only
```
The shell is very brief with error messages. It is meant solely as a way to run programs that accept command line parameters and take up as little memory as possible. It does, however, provide a rich runtime for PLASMA modules.
## Included Modules
PLASMA comes with many library modules used by the tools, demos and sample code. The PLASMA system volume must remain in place for the duration of PLASMAs run otherwise it won't be able to find CMD or the system libraries. Probably the most useful included module is the editor. It is used for editing PLASMA source file, assembly source files, or any text file. Execute it with:
```
+ED [TEXT FILE] [GOTO LINE NUMBER]
```
The file manipulation utilities to copy, delete, rename, create directories, and change file type and aux type remove the need for external programs to do the same. PLASMA can now be installed with the tools included on the PLASMA2-SYS boot floppy. They are:
```
+COPY [-R] <SRCPATH>+ <DSTPATH>
+DEL [-R] <FILEPATH>
+REN <FILENAME> <NEWNAME>
+NEWDIR <NEWDIRECTORY>
+TYPE <FILENAME> [NEWTYPE [NEWAUX]]
+CAT [-R] <FILEPATH]
```
The ```-R``` option will operate on the directories recursively. Wildcard filenames can be specified with ```'*'``` matching zero or more characters, and ```'?'``` matching any character. When copying files to the current directory, ```=``` can be used as a shortcut.
## Compiler Modules
The build disk includes sample source, include files for the system modules, and the PLASMA compiler+optimizer modules. The compiler is invoked with:
```
+PLASM [-[W][O[2]] <SOURCE FILE> [OUTPUT FILE]
```
Compiler warnings are enabled with `-W`. The optional optimizer is enabled with `-O` and extra optimizations are enabled with `-O2`. The source code for a few sample programs are included. The big one, `RPNCALC.PLA`, is the sample RPN calculator that uses many of PLASMA's advanced features. The self-hosted compiler is the same compiler as the cross-compiler, just transcribed from C to PLASMA (yes, the self-hosted PLASMA compiler is written in PLASMA). It requires patience when compiling: it is a fairly large and extensive program.
## Assembly Toolkit
New for 2.11 is the assembly language toolkit. The PLASMA module was originally architected around the REL file generated by the ProDOS toolkit assembler, EDASM. This minor update fixes the PLASMA relocating loader to handle 8 bit fixups. PLASM generated modules only use 16 bit fixups, so not an issue for existing modules. Download the toolkit that includes the ProDOS EDASM assembler and sample code. Also the 2.11 updates (if you have 2.1 already installed) here:
[PLASMA 2.11 Assembly Language Toolkit](https://github.com/dschmenk/PLASMA/raw/master/images/apple/ASM-TK.po)
[PLASMA 2.11 Update](https://github.com/dschmenk/PLASMA/raw/master/images/apple/PLASMA-2.11-UPD.po)
## FORTH Module
New for version 2.1 is a FORTH language module capable of interpreting script files and interactive programming. Further documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/PLFORTH.md. Samples scripts are in /HARDISK/BLD/SCRIPTS
## Demos
There are some demo programs included for your perusal. Check out `ROGUE` for some diversion. You can find the documentation here: https://github.com/dschmenk/PLASMA/blob/master/doc/Rogue%20Instructions.md. A music sequencer to play through a MockingBoard if it is detected, or the built-in speaker if not. A minimal Web server if you have an Uthernet2 card (required). Try `SPIDERS`for some hires shoot'em-up action. Bug reports appreciated.
## Source Code
Most sample source code is included from the project. They build without alteration and should be a good starting point for further explorations. The header files for the included library modules are in the INC directory.
## Video Playlist
There is a [YouTube playlist](https://www.youtube.com/playlist?list=PLlPKgUMQbJ79VJvZRfv1CJQf4SP2Gw3yU) created for learning PLASMA.
## Issues
- All the modules and runtime are written mostly in PLASMA; the compiler and editor as well. This means that there may be some startup delay as the PLASMA module loader reads in the module dependencies and performs dynamic linking. But a 1 MHz, 8 bit CPU interpreting bytecodes is never going to match a modern computer. As noted earlier, an accelerator and mass storage are your (and PLASMA's) friend.
- All the project modules are included. They have been lightly tested.
- The Apple /// may not always report errors properly or at all.
- The documentation is sparse and incomplete. Yep, could use your help...
# Changes in PLASMA for 2.11 Release
1. Minor update to load modules generated by EDASM with 8 bit fixups
# Changes in PLASMA for 2.1 Release
1. Lots of small bug fixes in floating point, file copy and graphics libraries
2. MULT opcode speedup improvements
3. Overhaul 65802/65814 VM for better speed and compatibility with PLFORTH compilation
4. Many Apple /// improvements and bug fixes
5. Low memory fixes and tests
6. FORTH language support as a PLASMA module. Full accessabilit to PLASMA modules and libraries
7. Install script for ProDOS mass storage
# Changes in PLASMA for 2.0 Release
1. Fix command line buffer overflow
2. Use VBlank to blink editor cursor so not CPU speed dependent
3. Add ```=``` for ```+COPY``` current destination
4. Add //c support for DGRLIB and GRLIB wait-for-VBlank routines
# Changes in PLASMA for 2.0 Beta
1. Compilers allows for including self imported defines
2. Compilers fixed for local constants
3. Floating point string formatting fixes and improvements
4. Fiber library exports number of active fibers
# Changes in PLASMA for 2.0 Alpha 2
1. Self hosted compiler fixes for invalid array size constants
2. Ensure IDs in self hosted compiler are 31 characters significant
3. Fix bug COPY file parsing and move common routine into MATCHFILES
# Changes in PLASMA for 2.0 Alpha 1
1. Improved entry/exit for 128K Apple IIe //c
2. Improved entry for Apple ///
3. Improved entry and function calls for 16 bit VM
# Changes in PLASMA for 2.0 DP 4
1. Improved editor auto-indenting
2. Compiler fix for terneray operator precedence
3. Machine check for HGR library
# Changes in PLASMA for 2.0 DP 3
1. File manipulation utilities fixed for Apple /// SOS vs ProDOS differences
2. More optimizations for HiRes graphics libraries
3. Spiders From Mars hires demo game
# Changes in PLASMA for 2.0 DP 2
1. Many file manipulaition utilities (COPY, REName, NEWDIRectory, DELete, CATalog, TYPE)
2. New and updated libraries for lo-res. double lo-res and hi-res graphics w/ sprites
3. 32 bit integer library for those times when 16 bits just isn't enough
4. Apple /// improvements to other SOS.INTERP launching with SOS utility
5. Apple /// JIT VM for speed and non JIT version to free up global memory
6. Editor improvements
7. A couple small compiler optimizations
8. Needed to break out TCP/IP modules into seperate floppy image
9. Library changes require full install
# Changes in PLASMA for 2.0 DP 1z
1. Many fixes for the value zero - especially in 65802/65816 divide routine
# Changes in PLASMA for 2.0 DP 1 E+C
1. Greatly improved code editor and additional compiler stats
# Changes in PLASMA for 2.0 DP 1a
1. Fix interaction with JIT compiler and module load/unload
# Changes in PLASMA for 2.0 DP 1
1. Expanded bytecode for more efficient size/performance of programs
2. Just-In-Time Compiler for native code performance (6502 and 65816) for frequently called routines
3. Automatically identify and run most optimal VM for configuration
# Changes in PLASMA for 1.2
1. Add TFTPD TFTP server
2. Fix Uthernet 1 driver
3. Add mouse module
4. Fix IRQ issues for interrupt driven mouse driver
# Changes in PLASMA for 1.1
1. All known bugs are fixed
2. PLASM compiler received a little performance boost with an assembly language helper for ID/keyword lexical scanner
# Changes in PLASMA for 1.0
If you have been programming in PLASMA before, the 1.0 version has some major and minor changes that you should be aware of:
1. Case is no longer significant. Imported symbols were always upper case. Now, all symbols are treated as if they were upper case. You may find that some symbols clash with previously defined symbols of different case. Hey, we didn't need lower case in 1977 and we don't need it now. You kids, get off my lawn!
2. Modules are now first class citizens. Translation: importing a module adds a symbol with the module name. You can simply refer to a module's address with it's name. This is how a module's API table is accessed (instead of adding a variable of the same name in the IMPORT section).
3. Bytecode changes means previously compiled modules will crash. Rebuild.
4. `BYTE` and `WORD` have aliases that may improve readability of the code. `CHAR` (character) and `RES` (reserve) are synonyms for `BYTE`. `VAR` (variable) is a synonym for `WORD`. These aliases add no functionality. They are simply syntactic sugar to add context to the source code, but may cause problems if you've previously used the same names for identifiers.
5. When declaring variables, a base size can come after the type, and an array size can folllow the identifier. For instance:
```
res[10] a, b, c
```
will reserve three variables of 10 bytes each. Additionally:
```
res[10] v[5], w[3]
```
will reserve a total of 80 bytes (10 * 5 + 10 * 3). This would be useful when combined with a structure definition. One could:
```
res[t_record] patients[20]
```
to reserve an array of 20 patient records.
6. Ternary operator. Just like C and descendants, `??` and `::` allow for an if-then-else inside an expression:
```
puts(truth == TRUE ?? "TRUE" :: "FALSE")
```
7. Multiple value assignements. Multiple values can be returned from functions and listed on variable assignments:
```
def func#3 // Return 3 values
return 10, 20, 30
end
a, b, c = 1, 2, 3
c, d, f = func()
x, y = y, x // Swap x and y
```
8. `DROP` allows for explicit dropping of values. In the above `func()` example, if the middle value was the only one desired, the others can be ignored with:
```
drop, h, drop = func()
```
9. The compiler tracks parameter and return counts for functions. If the above `func()` were used without assigning all the return values, they would be dropped:
```
a = func() // Two values silently dropped
```
To generate compiler warning for this issue, and a few others, use the `-W` option when compiling.
10. Lambda (Anonymous) Functions. The ability to code a quick function in-line can be very powerful when used properly. Look here, https://en.wikipedia.org/wiki/Anonymous_function, for more information.
11. SANE (Standard Apple Numerics Environment) Floating Point Library. An extensive library (two, actually) of extended floating point (80 bit IEEE precision) functionality is suported. A wrapper library has been written to greatly simplify the interface to SANE. Look at the `RPNCALC.PLA` source code as an example.
12. Library Documentation. Preliminary documentation is available on the Wiki: https://github.com/dschmenk/PLASMA/wiki
13. Significant effort has gone into VM tuning and speeding up module loading/dynamic linking.
14. The VM zero page usage has changed. If you write assembly language routines, you will need to rebuild.
# Thanks
I wish to thank the people who have contributed the the PLASMA project. They have greatly improved the development of the language and documentation:
- Martin Haye: PLASMA programmer extraordinaire. Mr. Lawless Legends has requested many of the crucial features that set PLASMA apart.
- Steve F (ZornsLemma): Has taken the optimizer to new levels and his work on porting PLASMA to the Beeb are amazing: http://stardot.org.uk/forums/viewtopic.php?f=55&t=12306&sid=5a503c593f0698ebc31e590ac61b09fc
- Peter Ferrie: Assembly optimizer extraordinaire. He has made significant improvements into the code footprint in PLASMA so all the functionality can exist in just a few bytes.
- David Schmidt (DaveX): His help in documentation have made it much more accessible and professional. Of course any errors are all his. Just kidding, they're mine ;-)
- Andy Werner (6502.org): Catching the grammatical errors that I ain't no good at.
- John Brooks: Apple II Guru par excellence. His insights got 10% performance increase out of the VM.
Dave Schmenk
http://schmenk.is-a-geek.com

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,20 +0,0 @@
include "inc/cmdsys.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
include "inc/sndseq.plh"
sysflags resxtxt1|reshgr1|resxhgr1
var strWidth, strHeight
char darthstr = "DartH GRaphics"
dcgrFont(fontRead("trade54.fon"))
strWidth, strHeight = dcgrStrExtents(@darthstr)
dhgrMode(DHGR_COLOR_MODE)
screenRead("darth.dhgr")
musicPlay(musicRead("imperial.seq"), FALSE)
musicGetKey(0, NULL)
dcgrColor(CLR_WHITE)
dcgrStr((140 - strWidth) / 2, (strHeight * 7) / 8, @darthstr)
getc
dhgrMode(DHGR_TEXT_MODE)
done

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -1,134 +0,0 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
const FRAME_WIDTH = 40
const FRAME_HEIGHT = 40
const FRAME_SIZE = FRAME_WIDTH * FRAME_HEIGHT / 2
var arg
byte xTV = 3
byte yTV = 100
def greasy2dcgr(pixptr, grptr)#0
byte i, j, cl, ch
for j = 0 to 39 step 2
for i = 0 to 39 step 2
cl = ^(grptr + i)
ch = ^(grptr + i + 1)
^(pixptr + i / 2) = (cl & $0F) | (ch << 4)
^(pixptr + i / 2 + 20) = (cl >> 4) | (ch & $F0)
next
pixptr = pixptr + 40
grptr = grptr + 40
next
end
def greasyImport(filename)#2
var pixmapbase, pixmapptr, frameptr
byte refnum, numframes, i
pixmapbase = NULL
numframes = 0
refnum = fileio:open(filename)
if refnum
fileio:read(refnum, @numframes, 1)
pixmapbase = heapalloc(FRAME_SIZE * numframes)
if pixmapbase
frameptr = heapalloc(FRAME_SIZE)
pixmapptr = pixmapbase
for i = 1 to numframes
fileio:read(refnum, frameptr, FRAME_SIZE)
greasy2dcgr(pixmapptr, frameptr)
pixmapptr = pixmapptr + FRAME_SIZE
next
fin
fileio:close(refnum)
heaprelease(frameptr)
fin
return pixmapbase, numframes
end
def delay_getkey#0
var busywait
for busywait = 0 to 3000
if ^$C000 > 127
break
fin
next
end
def dblHeight(w, h, pixptr)#0
byte i, span
span = (w + 1) / 2
h = (h - 1) * 2
for i = 0 to h step 2
dcgrPixMap(0, i, w, 1, pixptr)
dcgrPixMap(0, i + 1, w, 1, pixptr)
pixptr = pixptr + span
next
end
def frameAnimate(filename)#0
var frames, frameptr, framesize
var frame7ptr, frame7span
byte numframes, i
frames, numframes = greasyImport(filename)
if frames == NULL; return; fin
frame7ptr, frame7span = dhgrAllocBl7Mem(FRAME_WIDTH, FRAME_HEIGHT*2)
dhgrSurfMem(OP_SRC, FRAME_HEIGHT, frame7ptr, frame7span)
dhgrScrBl7(xTV, yTV, frame7span >> 2, FRAME_HEIGHT*2)
dhgrSurfScr(OP_SRC)
while ^$C000 < 128
frameptr = frames
for i = 1 to numframes
dhgrSurfMem(OP_SRC, FRAME_HEIGHT*2, frame7ptr, frame7span)
//dcgrPixMap(0, 0, FRAME_WIDTH, FRAME_HEIGHT, frameptr)
dblHeight(FRAME_WIDTH, FRAME_HEIGHT, frameptr)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(xTV,yTV,frame7span>>2,FRAME_HEIGHT*2,frame7ptr,frame7span)
frameptr = frameptr + FRAME_SIZE
//delay_getkey
next
loop
^$C010
end
arg = argNext(argFirst)
if ^arg
while ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'X' // Set X coord
if ^arg > 2
xTV = ^(arg + 3) - '0'
if ^arg > 3
xTV = xTV * 10 + ^(arg + 4) - '0'
fin
fin
break
is 'Y' // Set Y coord
if ^arg > 2
yTV = ^(arg + 3) - '0'
if ^arg > 3
yTV = yTV * 10 + ^(arg + 4) - '0'
fin
fin
break
wend
arg = argNext(arg)
loop
dhgrMode(DHGR_COLOR_MODE)
screenRead("PENGUIN.DHGR")
frameAnimate(arg)
dhgrMode(DHGR_TEXT_MODE)
return 0
fin
puts("Usage: DCGRDEMO <GREASYFILE>\n")
done

View File

@@ -1,217 +0,0 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "inc/vblank.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
//
// Pattern fill
//
const PAT_WIDTH = SCR_WIDTH
const PAT_HEIGHT = 2
word pattern
//
// Polygon variables
//
word leftedge, rightedge // Edge arrays
byte polytop, polybottom // Poly top and bottom extents
byte startvx, startvy // Starting poly vertex
byte polyvx, polyvy // Current poly vertex
byte sin90[] // first 90 degrees of sin in fixed s.15 format
byte = 0>>7, 571>>7, 1143>>7, 1714>>7, 2285>>7, 2855>>7, 3425>>7, 3993>>7
byte = 4560>>7, 5126>>7, 5690>>7, 6252>>7, 6812>>7, 7371>>7, 7927>>7, 8480>>7
byte = 9032>>7, 9580>>7, 10125>>7, 10668>>7, 11207>>7, 11743>>7, 12275>>7, 12803>>7
byte = 13327>>7, 13848>>7, 14364>>7, 14876>>7, 15383>>7, 15886>>7, 16383>>7, 16876>>7
byte = 17364>>7, 17846>>7, 18323>>7, 18794>>7, 19260>>7, 19720>>7, 20173>>7, 20621>>7
byte = 21062>>7, 21497>>7, 21926>>7, 22347>>7, 22762>>7, 23170>>7, 23571>>7, 23964>>7
byte = 24351>>7, 24730>>7, 25101>>7, 25465>>7, 25821>>7, 26169>>7, 26509>>7, 26841>>7
byte = 27165>>7, 27481>>7, 27788>>7, 28087>>7, 28377>>7, 28659>>7, 28932>>7, 29196>>7
byte = 29451>>7, 29697>>7, 29935>>7, 30163>>7, 30381>>7, 30591>>7, 30791>>7, 30982>>7
byte = 31164>>7, 31336>>7, 31498>>7, 31651>>7, 31794>>7, 31928>>7, 32051>>7, 32165>>7
byte = 32270>>7, 32364>>7, 32449>>7, 32523>>7, 32588>>7, 32643>>7, 32688>>7, 32723>>7
byte = 32748>>7, 32763>>7, 32767>>7
//
// Sin and Cos
//
def sinext(deg)#1
return (sin90[deg] << 7) | (sin90[deg] >> 1)
end
def sin(deg)#1
while deg > 360; deg = deg - 360; loop
while deg < 0; deg = deg + 360; loop
if deg <= 90
return sinext(deg)
elsif deg <= 180
return sinext(180 - deg)
elsif deg <= 270
return -sinext(deg - 180)
fin
return -sinext(360 - deg)
end
def cos(deg)#1
return sin(deg + 90)
end
//
// Create pattern pixmap for filling
//
export def setPattern(clr1, clr2, dither)#0
word patfill, clr
if not pattern
pattern = heapalloc(SCR_WIDTH * PAT_HEIGHT)
fin
//
// Even scanlines
//
clr = dither & 1 ?? clr2 :: clr1
patfill = clr | (clr << 8)
clr = dither & 2 ?? clr2 :: clr1
patfill = patfill | (clr << 4) | (clr << 12)
memset(pattern, patfill, SCR_WIDTH/2)
patfill = (patfill << 4) | clr // Rotate pattern for odd pixel
memset(pattern + SCR_WIDTH, patfill, SCR_WIDTH/2)
//
// Odd scanlines
//
clr = dither & 4 ?? clr2 :: clr1
patfill = clr | (clr << 8)
clr = dither & 8 ?? clr2 :: clr1
patfill = patfill | (clr << 4) | (clr << 12)
memset(pattern + SCR_WIDTH/2, patfill, SCR_WIDTH/2)
patfill = (patfill << 4) | clr // Rotate pattern for odd pixel
memset(pattern + SCR_WIDTH + SCR_WIDTH/2, patfill, SCR_WIDTH/2)
end
export def patrnRect(left, top, right, bottom)#0
word patscan
byte width, y
width = right - left + 1
patscan = pattern + (left & 1 ?? SCR_WIDTH :: 0)
for y = top to bottom
dcgrPixMap(left, y, width, 1, patscan + (y & 1 ?? (SCR_WIDTH/2) :: 0))
next
end
export def solidRect(left, top, right, bottom)#0
byte l7, r7, x
l7 = (left | 7) / 7
r7 = right / 7
if l7 < r7
dhgrClearBl7(l7, top, r7 - l7, bottom - top + 1)
fin
l7 = l7 * 7
if l7 > left
for x = l7-1 downto left
dcgrVLin(top, bottom, x)
next
fin
r7 = r7 * 7
if r7 < right
for x = r7 to right
dcgrVLin(top, bottom, x)
next
fin
end
//
// Convex polygon
//
def setEdge(x, y)#0
if x < leftedge->[y]; leftedge->[y] = x; fin
if x > rightedge->[y]; rightedge->[y] = x; fin
end
export def startPoly(x, y)#0
setlineplot(@setEdge)
leftedge = heapalloc(SCR_HEIGHT)
rightedge = heapalloc(SCR_HEIGHT)
memset(leftedge, $FFFF, SCR_HEIGHT)
memset(rightedge, $0000, SCR_HEIGHT)
polytop = y
polybottom = y
startvx = x
startvy = y
polyvx = x
polyvy = y
end
export def addVertex(x, y)#0
if y < polytop; polytop = y; fin
if y > polybottom; polybottom = y; fin
line(polyvx, polyvy, x, y)
polyvx = x
polyvy = y
end
export def patrnPoly(x, y)#0
var width
byte left
if y < polytop; polytop = y; fin
if y > polybottom; polybottom = y; fin
line(polyvx, polyvy, x, y)
line(x, y, startvx, startvy)
for y = polytop to polybottom
left = leftedge->[y]
width = rightedge->[y] - left + 1
if width > 0
dcgrPixMap(left, y, width, 1, \
pattern + (left & 1 ?? SCR_WIDTH :: 0) \
+ (y & 1 ?? (SCR_WIDTH/2) :: 0))
fin
next
heaprelease(leftedge)
end
export def solidPoly(x, y)#0
byte left, right
if y < polytop; polytop = y; fin
if y > polybottom; polybottom = y; fin
line(polyvx, polyvy, x, y)
line(x, y, startvx, startvy)
for y = polytop to polybottom
left = leftedge->[y]
right = rightedge->[y]
if right >= left
dcgrHLin(left, right, y)
fin
next
heaprelease(leftedge)
end
//
// Ellipse
//
export def solidEllip(xorg, yorg, width, height)#0
var x, y, angle
for angle = 0 to 90 step 90 / height
x = ((cos(angle) >> 8) * width) >> 8
y = ((sin(angle) >> 8) * height) >> 8
dcgrHLin(xorg - x, xorg + x, yorg + y)
dcgrHLin(xorg - x, xorg + x, yorg - y)
next
end
export def patrnEllip(xorg, yorg, width, height)#0
var x, y, angle, left, len, scan
for angle = 0 to 90 step 90 / height
x = ((cos(angle) >> 8) * width) >> 8
y = ((sin(angle) >> 8) * height) >> 8
left = xorg - x
len = x * 2
if len == 0; len = 1; fin
scan = yorg + y
dcgrPixMap(left, scan, len, 1, \
pattern + (left & 1 ?? SCR_WIDTH :: 0) \
+ (scan & 1 ?? (SCR_WIDTH/2) :: 0))
scan = yorg - y
dcgrPixMap(left, scan, len, 1, \
pattern + (left & 1 ?? SCR_WIDTH :: 0) \
+ (scan & 1 ?? (SCR_WIDTH/2) :: 0))
next
end
export def frame(left, top, right, bottom, thickness)#0
while thickness
thickness--
dcgrHLin(left + thickness, right - thickness, top + thickness)
dcgrHLin(left + thickness, right - thickness, bottom - thickness)
dcgrVLin(top + thickness, bottom - thickness, left + thickness)
dcgrVLin(top + thickness, bottom - thickness, right - thickness)
loop
end

View File

@@ -1,353 +0,0 @@
include "inc/cmdsys.plh"
//include "inc/lines.plh"
include "inc/vblank.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
import fillshape
//
// Dither matrices
//
const DITHER0 = $00
const DITHER25 = $04
const DITHER50 = $06
const DITHER75 = $07
const DITHER100 = $0F
predef setPattern(clr1, clr2, dither)#0
predef patrnRect(left, top, right, bottom)#0
predef solidRect(left, top, right, bottom)#0
predef startPoly(x, y)#0
predef addVertex(x, y)#0
predef patrnPoly(x, y)#0
predef solidPoly(x, y)#0
predef solidEllip(xorg, yorg, width, height)#0
predef patrnEllip(xorg, yorg, width, height)#0
predef frame(left, top, right, bottom, thickness)#0
end
sysflags resxtxt1|reshgr1|resxhgr1
//
// ViewScreen coordinates
//
const VIEW_LEFT7 = 3
const VIEW_RIGHT7 = 17
const VIEW_WIDTH7 = VIEW_RIGHT7 - VIEW_LEFT7
const VIEW_LEFT = VIEW_LEFT7 * 7 // 21
const VIEW_RIGHT = VIEW_RIGHT7 * 7 // 119
const VIEW_WIDTH = VIEW_RIGHT - VIEW_LEFT
const VIEW_TOP = 24
const VIEW_BOTTOM = 122
const VIEW_HEIGHT = VIEW_BOTTOM - VIEW_TOP
const VIEW_ORGX = (VIEW_LEFT+VIEW_RIGHT)/2
const VIEW_ORGY = (VIEW_TOP+VIEW_BOTTOM)/2
//
// Enterprise sprites
//
struc t_sprite
var spr_xorg
var spr_yorg
var spr_width
var spr_height
var spr_pixmap
var spr_bl7
end
res[t_sprite * 8] ncc1701
char[12] sprFile = "ENT.UP.SPR"
char[12] = "ENT.UR.SPR"
char[12] = "ENT.RT.SPR"
char[12] = "ENT.DR.SPR"
char[12] = "ENT.DN.SPR"
char[12] = "ENT.DL.SPR"
char[12] = "ENT.LT.SPR"
char[12] = "ENT.UL.SPR"
const ENT_W7 = 5
const ENT_H = 43
const ENT_SZ = ENT_W7*4*ENT_H
//
// Random seed
//
var rndseed = $A64D
def random#1
rndseed = (rndseed << 8) ^ ((rndseed & $7FFF) >> 7) + $62B3
return rndseed
end
//
// Draw components
//
def drawSurround#0
//
// Viewscreen surround
//
dcgrColor(CLR_GREY)
dhgrClearBl7(0, 0, SCR_WIDTH7, VIEW_TOP)
dhgrClearBl7(0, VIEW_BOTTOM, SCR_WIDTH7, VIEW_TOP)
dhgrClearBl7(0, VIEW_TOP, VIEW_LEFT7, VIEW_HEIGHT)
dhgrClearBl7(VIEW_RIGHT7, VIEW_TOP, VIEW_LEFT7, VIEW_HEIGHT)
setPattern(CLR_BLACK, CLR_GREY, DITHER50)
patrnRect(0, VIEW_BOTTOM+VIEW_TOP, SCR_WIDTH-1, SCR_HEIGHT-1)
//
// Above viewscreen ceiling
//
setPattern(CLR_BLACK, CLR_GREY, DITHER50)
startPoly(0, 0)
addVertex(SCR_WIDTH-1, 0)
addVertex(VIEW_RIGHT+3-1, VIEW_TOP-6)
patrnPoly(VIEW_LEFT-3, VIEW_TOP-6)
//
// Below viewscreen bump-out
//
setPattern(CLR_GREY, CLR_WHITE, DITHER50)
startPoly(VIEW_LEFT-3, VIEW_BOTTOM+5)
addVertex(VIEW_RIGHT+3-1, VIEW_BOTTOM+5)
addVertex(SCR_WIDTH-1, VIEW_BOTTOM+VIEW_TOP-1)
patrnPoly(0, VIEW_BOTTOM+VIEW_TOP-1)
//
// Viewscreen frame
//
dcgrColor(CLR_DRKBLUE)
frame(VIEW_LEFT-3, VIEW_TOP-3, VIEW_RIGHT+3-1, VIEW_BOTTOM+3-1, 3)
dcgrColor(CLR_MEDBLUE)
frame(VIEW_LEFT-2, VIEW_TOP-2, VIEW_RIGHT+2-1, VIEW_BOTTOM+2-1, 1)
end
def drawRails#0
dcgrColor(CLR_ORANGE)
dhgrClearBl7(0, 132, 40/7, 1)
dhgrClearBl7(107/7, 132, 40/7, 1)
dcgrColor(CLR_MAGENTA)
dhgrClearBl7(0, 133, 40/7, 7)
dhgrClearBl7(107/7, 133, 40/7, 7)
dcgrColor(CLR_BLACK)
solidRect( 20, 140, 24, 191)
solidRect(115, 140, 119, 191)
end
def drawAlerts#0
dcgrColor(CLR_ORANGE)
frame( 1*7-2, 40-2, 2*7+2-1, 80+2-1, 2)
frame(18*7-2, 40-2, 19*7+2-1, 80+2-1, 2)
dcgrColor(CLR_BLACK)
dhgrClearBl7( 1, 40, 1, 40)
dhgrClearBl7(18, 40, 1, 40)
end
def drawConsoles#0
dcgrColor(CLR_MAGENTA)
startPoly(70-30, 160)
addVertex(70-30, SCR_HEIGHT-1)
solidPoly(70-40, SCR_HEIGHT-1)
startPoly(70+30-1, 160)
addVertex(70+30-1, SCR_HEIGHT-1)
solidPoly(70+40-1, SCR_HEIGHT-1)
setPattern(CLR_BLACK, CLR_BROWN, DITHER50)
startPoly(0, 160)
addVertex(70-30, 160)
addVertex(70-40, SCR_HEIGHT-1)
patrnPoly(0, SCR_HEIGHT-1)
startPoly(70+30-1, 160)
addVertex(SCR_WIDTH-1, 160)
addVertex(SCR_WIDTH-1, SCR_HEIGHT-1)
patrnPoly(70+40-1, SCR_HEIGHT-1)
dcgrColor(CLR_BLACK)
startPoly(0, 170)
addVertex(70-40, 170)
addVertex(70-51, SCR_HEIGHT-1)
solidPoly(0, SCR_HEIGHT-1)
startPoly(70+40-1, 170)
addVertex(SCR_WIDTH-1, 170)
addVertex(SCR_WIDTH-1, SCR_HEIGHT-1)
solidPoly(70+51-1, SCR_HEIGHT-1)
end
def drawNavigation#0
dcgrColor(CLR_WHITE)
startPoly(70-20, 150)
addVertex(70+20-1, 150)
addVertex(70+30-1, SCR_HEIGHT-1)
solidPoly(70-30, SCR_HEIGHT-1)
setPattern(CLR_GREY, CLR_BROWN, DITHER50)
patrnEllip(70, 170, 40, 35)
end
//
// Read Enterprise sprites
//
def readEnterprise#0
var xorg, yorg, width, height, pixptr, t_ptr, f_ptr
byte i
t_ptr = @ncc1701
f_ptr = @sprFile
for i = 0 to 7
xorg, yorg, width, height, pixptr = spriteRead(f_ptr)
t_ptr=>spr_xorg = xorg
t_ptr=>spr_yorg = yorg
t_ptr=>spr_width = width
t_ptr=>spr_height = height
t_ptr=>spr_pixmap = pixptr
t_ptr=>spr_bl7 = heapalloc(ENT_SZ)
dhgrSurfMem(OP_SRC, ENT_H, t_ptr=>spr_bl7, ENT_W7*4)
dcgrColor(CLR_BLACK)
dhgrClearBl7(0, 0, ENT_W7, ENT_H)
dcgrPixmap(ENT_W7*7/2 - xorg,ENT_H/2 - yorg, width, height, pixptr)
t_ptr = t_ptr + t_sprite
f_ptr = f_ptr + 12
next
end
//
// Animate stuff
//
def keypressed#1
return ^$C000 & $80
end
def idleViewPlot(x)#0
x = (x&63)+70-32
dcgrHLin(x - 1, x + 1, VIEW_BOTTOM+3)
dcgrHlin(x - 1, x + 1, VIEW_BOTTOM+4)
end
def newStar#3
return 15 - (random & 30), 15 - (random & 30), random & 15
end
def idleStars#0
byte xpos, star, nstars
var starx, stary, starincx, starincy, starclr
var x, y, incx, incy
waitVBL; nstars = waitVBL / 50
starx = heapalloc(nstars*2)
stary = heapalloc(nstars*2)
starincx = heapalloc(nstars*2)
starincy = heapalloc(nstars*2)
starclr = heapalloc(nstars)
nstars--
for star = 0 to nstars
repeat
incx, incy, starclr->[star] = newstar
until incx <> 0 and incy <> 0
if starclr->[star] == 0; starclr->[star] = 15; fin
starx=>[star] = incx * (VIEW_WIDTH-1)/2
stary=>[star] = incy * (VIEW_HEIGHT-1)/2
starincx=>[star] = incx
starincy=>[star] = incy
next
xpos = 8
star = 0
while not keypressed
dcgrColor(CLR_WHITE)
idleViewPlot(xpos)
dcgrColor(CLR_YELLOW)
idleViewPlot(xpos-4)
dcgrColor(CLR_ORANGE)
idleViewPlot(xpos-8)
dcgrColor(CLR_GREY)
idleViewPlot(xpos-12)
xpos = xpos + 4
for star = 0 to nstars
x = starx=>[star]
y = stary=>[star]
incx = x + starincx=>[star]
incy = y + starincy=>[star]
if incx > (VIEW_WIDTH-1)*8 or incx < -VIEW_WIDTH*8 \
or incy > (VIEW_HEIGHT-1)*8 or incy < -VIEW_HEIGHT*8
repeat
incx, incy, starclr->[star] = newStar
until incx <> 0 and incy <> 0
if starclr->[star] == 0; starclr->[star] = 15; fin
starx=>[star] = incx << 5
stary=>[star] = incy << 5
starincx=>[star] = incx
starincy=>[star] = incy
else
starx=>[star] = incx
stary=>[star] = incy
incx = starincx=>[star]
incy = starincy=>[star]
starincx=>[star] = incx + ((incx > 0 ?? incx + 7 :: incx - 7) >> 3)
starincy=>[star] = incy + ((incy > 0 ?? incy + 7 :: incy - 7) >> 3)
fin
dcgrColor(CLR_BLACK)
dcgrPixel((x >> 4) + VIEW_ORGX, (y >> 4) + VIEW_ORGY)
dcgrColor(starclr->[star])
dcgrPixel((starx=>[star] >> 4) + VIEW_ORGX, (stary=>[star] >> 4) + VIEW_ORGY)
next
loop
getc
heaprelease(starx)
end
def idleSpin#0
var viewbuf, viewspan
var i, k, oi, oj
byte xpos
//
// Use back buffer
//
viewbuf, viewspan = dhgrAllocBl7Mem(VIEW_WIDTH, VIEW_HEIGHT)
i = @ncc1701
k = 0
xpos = 0
while not keypressed
//
// Rotate Enterprise
//
dhgrSurfMem(OP_SRC, VIEW_HEIGHT, viewbuf, viewspan)
dcgrColor(CLR_DRKBLUE)
dhgrClearBl7(0, 0, VIEW_WIDTH7, VIEW_HEIGHT)
dcgrColor(CLR_GREEN)
for oi = (xpos/4)&31 to VIEW_WIDTH-1 step 32
dcgrVLin(0, VIEW_HEIGHT-1, oi)
next
for oi = (xpos/4)&63 to VIEW_HEIGHT-1 step 64
dcgrHLin(0, VIEW_WIDTH-1, oi)
next
dhgrOp(OP_OR)
dhgrMemBl7((VIEW_WIDTH7 - ENT_W7 + 1)/2, (VIEW_HEIGHT-ENT_H + 1)/2, \
ENT_W7, ENT_H, \
i=>spr_bl7, ENT_W7*4)
dhgrSurfScr(OP_SRC)
//waitVBL
dhgrMemBl7(VIEW_LEFT7, VIEW_TOP, \
VIEW_WIDTH7, VIEW_HEIGHT, \
viewbuf, viewspan)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
//
// Animate useless view screen lights
//
dcgrColor(CLR_WHITE)
idleViewPlot(xpos)
dcgrColor(CLR_YELLOW)
idleViewPlot(xpos-4)
dcgrColor(CLR_ORANGE)
idleViewPlot(xpos-8)
dcgrColor(CLR_GREY)
idleViewPlot(xpos-12)
xpos = xpos + 4
loop
heaprelease(viewbuf)
getc
end
//
// Read sprites
//
readEnterprise
//
// Initialize
//
dhgrMode(DHGR_COLOR_MODE)
//
// Draw bridge
//
drawSurround
drawRails
drawAlerts
drawConsoles
drawNavigation
//
// Animate stars waiting for keypress
//
idleStars
idleSpin
//
// All done
//
dhgrMode(DHGR_TEXT_MODE)
done

View File

@@ -1,54 +0,0 @@
import dhgrlib
const DST_SCREEN = 0
const DST_MEMORY = 1
const SCR_WIDTH7 = 20
const SCR_WIDTH = 140
const SCR_HEIGHT = 192
const OP_SRC = 0
const OP_XOR = 1
const OP_AND = 2
const OP_OR = 3
const CLR_BLACK = 0
const CLR_MAGENTA = 1
const CLR_DRKBLUE = 2
const CLR_PURPLE = 3
const CLR_DRKGREEN = 4
const CLR_GREY1 = 5
const CLR_XPARENT = 5
const CLR_MEDBLUE = 6
const CLR_LTBLUE = 7
const CLR_BROWN = 8
const CLR_ORANGE = 9
const CLR_GREY2 = 10
const CLR_GREY = 10
const CLR_PINK = 11
const CLR_GREEN = 12
const CLR_YELLOW = 13
const CLR_AQUA = 14
const CLR_WHITE = 15
const DHGR_MONO_MODE = 2
const DHGR_COLOR_MODE = 0
const DHGR_MIXED_MODE = 1
const DHGR_TEXT_MODE = -1
predef dcgrColor(c)#0
predef dcgrPixel(x, y)#0
predef dcgrGetPixel(x, y)#1
predef dcgrHLin(x1, x2, y)#0
predef dcgrVLin(y1, y2, x)#0
predef dcgrBitMap(x, y, bitw, bith, bitptr)#0
predef dcgrPixMap(x, y, pixw, pixh, pixptr)#0
predef dcgrRleMap(x, y, pixw, pixh, pixptr)#0
predef dhgrScrBl7(x7, y, w7, h)#0
predef dhgrMemBl7(x7, y, w7, h, memptr, memspan)#0
predef dhgrClearBl7(x7, y, w7, h)#0
predef dhgrTiles(x7, y8, strptr, strlen, tileset)#0
predef dhgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
predef dhgrSet(dhx, y)#0
predef dhgrUnset(dhx, y)#0
predef dhgrOp(op)#0
predef dhgrSurfScr(op)#0
predef dhgrSurfMem(op, memh, memptr, memspan)#0
predef dhgrMode(mode)#1
end

View File

@@ -1,32 +0,0 @@
import dhgrutils
//
// Font type bits
//
const FONT_MONO = $00
const FONT_PROP = $80
const FONT_AA = $40
//
// Default fonts
//
const FONT_DEFAULT = 0
const FONT_DEF_THIN = 1
const FONT_DEF_SLIM = 2
//
// Exported functions
//
predef dhgrAllocBl7Mem(w, h)#2
predef dcgrStr(x, y, strptr)#2
predef dcgrStrExtents(strptr)#2
predef dcgrBoldStr(clr, x, y, strptr)#2
predef dcgrFont(font)#1
predef fontRead(filename)#1
predef fontGlyphDim(ch)#2
predef fontType#1
predef dcgrRect(x, y, w, h)#0
predef dcgrGetPixMap(x, y, w, h)#1
predef dcgrEncPixMap(w, h, pixmap, rlemap)#1
predef spriteRead(filestr)#5
predef spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1
predef screenRead(filestr)#1
predef screenWrite(filestr)#1
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,434 +0,0 @@
include "inc/cmdsys.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
const page1m = $C054
const page1x = $C055
//
// Font header
//
struc t_font
byte[] fnt_typelen
char fnt_name[16]
byte fnt_first
byte fnt_last
byte fnt_width
byte fnt_height
var fnt_glyptrs[]
end
//
// Variable pitch glyphs
//
struc t_glyph
var gly_left
var gly_top
byte gly_width
byte gly_height
byte gly_adv
byte gly_strike[]
end
//
// Current and default font pointers
//
var fontPtr, fontDefault, fontDefThin, fontDefSlim
//
// Function pointers
//
export asm dcgrStr(x, y, strptr)#2
JMP $2000
end
//
// Utility functions
//
export def dhgrAllocBl7Mem(w, h)#2
word memblk, span
span = (w+13)/14 << 3
memblk = heapalloc(span * h)
return memblk, span
end
def bitMonoGlyphStr(x, y, strptr)#2
byte first, last, width, height, size, i, ch
var strikes
first = fontPtr->fnt_first
last = fontPtr->fnt_last
width = fontPtr->fnt_width
height = fontPtr->fnt_height
strikes = fontPtr + fnt_glyptrs
size = (width + 7) / 8 * height
for i = 1 to ^strptr
ch = ^(strptr + i)
if ch >= first and ch <= last
dcgrBitmap(x, y - height, width, height, \
strikes + (^(strptr + i) - first) * size)
x = x + width
fin
next
return x, y
end
def pixPropGlyphStr(x, y, strptr)#2
var glyptrs, glyph
byte first, last, i, ch
first = fontPtr->fnt_first
last = fontPtr->fnt_last
glyptrs = fontPtr + fnt_glyptrs
x = x * 4
for i = 1 to ^strptr
ch = ^(strptr + i)
if ch >= first and ch <= last
glyph = glyptrs=>[ch - first]
dcgrPixmap((x + glyph=>gly_left) / 4, \
y + glyph=>gly_top, \
glyph->gly_width, \
glyph->gly_height, \
glyph + gly_strike)
x = x + glyph->gly_adv
fin
next
return x / 4, y
end
def bitPropGlyphStr(x, y, strptr)#2
var glyptrs, glyph
byte first, last, i, ch
first = fontPtr->fnt_first
last = fontPtr->fnt_last
glyptrs = fontPtr + fnt_glyptrs
for i = 1 to ^strptr
ch = ^(strptr + i)
if ch >= first and ch <= last
glyph = glyptrs=>[ch - first]
dcgrBitmap(x + glyph=>gly_left, \
y + glyph=>gly_top, \
glyph->gly_width, \
glyph->gly_height, \
glyph + gly_strike)
x = x + glyph->gly_adv
fin
next
return x, y
end
export def dcgrStrExtents(strptr)#2
var glyptrs, xext, yext
byte first, last, width, i, ch
first = fontPtr->fnt_first
last = fontPtr->fnt_last
if ^fontPtr & FONT_PROP
glyptrs = fontPtr + fnt_glyptrs
xext = -glyptrs=>[^(strptr + 1) - first]=>gly_left
if ^strptr > 1
for i = 1 to ^strptr-1
ch = ^(strptr + i)
if ch >= first and ch <= last
xext = xext + glyptrs=>[ch - first]->gly_adv
fin
next
fin
xext = xext + glyptrs=>[^(strptr + ^strptr) - first]->gly_width
if ^fontPtr & FONT_AA
xext = xext / 4
fin
else
xext = fontPtr->fnt_width * ^strptr
fin
return xext, fontPtr->fnt_height
end
export def dcgrBoldStr(clr, x, y, strptr)#2
byte h, v
for v = y - 1 to y + 1
for h = x - 1 to x + 1
dcgrStr(h, v, strptr)
next
next
dcgrColor(clr)
return dcgrStr(x, y, strptr)
end
export def fontRead(filename)#1
var glyph, strksize, left, top
byte refnum, num, i, width, height, adv
byte roundup, pixbyte
var font_header, gly_ptr
byte[64] sysfont
font_header = NULL
if filename and ^filename
refnum = fileio:open(filename)
if not refnum // Look for system font
strcpy(@sysfont, cmdsys:syspath)
strcat(@sysfont, "fonts/")
strcat(@sysfont, filename)
refnum = fileio:open(@sysfont)
if not refnum
strcpy(@sysfont, cmdsys:syspath)
strcat(@sysfont, "fonts/apple2.fon")
refnum = fileio:open(@sysfont)
fin
fin
if refnum
font_header = heapalloc(t_font)
fileio:read(refnum, font_header, t_font)
num = font_header->fnt_last - font_header->fnt_first
if font_header->fnt_typelen & FONT_PROP
gly_ptr = heapalloc(num * 2) // Allocate glyph ptrs right after
if font_header->fnt_typelen & FONT_AA
roundup = 1
pixbyte = 2
else
roundup = 7
pixbyte = 8
fin
for i = 1 to num
fileio:read(refnum, @left, 1); left = sext(left)
fileio:read(refnum, @top, 1); top = sext(top)
fileio:read(refnum, @width, 1)
fileio:read(refnum, @height, 1)
fileio:read(refnum, @adv, 1)
strksize = (width + roundup) / pixbyte * height
if strksize
*gly_ptr = heapalloc(strksize + t_glyph)
glyph = *gly_ptr
if glyph and fileio:read(refnum, glyph + gly_strike, strksize) == strksize
glyph=>gly_left = left
glyph=>gly_top = top
glyph->gly_width = width
glyph->gly_height = height
glyph->gly_adv = adv
else
heaprelease(font_header)
font_header = NULL
break
fin
else
*gly_ptr = NULL
fin
gly_ptr = gly_ptr + 2
next
else // FONT_MONO
strksize = (font_header->fnt_width + 7) / 8 * font_header->fnt_height * num
glyph = heapalloc(strksize) // Allocate glyphs right after
if not glyph or fileio:read(refnum, glyph, strksize) <> strksize
heaprelease(font_header)
font_header = NULL
fin
fin
fileio:close(refnum)
fin
fin
return font_header
end
export def dcgrFont(font)#1
var rows, pWide, pThin, prevFont
if font == FONT_DEFAULT // Will also capture NULL font pointers
if not fontDefault
fontDefault = fontRead("apple2.fon")
if not fontDefault
return fontPtr
fin
fin
font = fontDefault
elsif font == FONT_DEF_THIN // Thin version of Apple2 font
if not fontDefThin
fontDefThin = fontRead("apple2thin.fon")
if not fontDefThin
return fontPtr
fin
fin
font = fontDefThin
elsif font == FONT_DEF_SLIM // Proportional version of thin font
if not fontDefSlim
fontDefSlim = fontRead("a2slim8.fon")
if not fontDefSlim
return fontPtr
fin
fin
font = fontDefSlim
fin
prevFont = fontPtr
fontPtr = font
if fontPtr->fnt_typelen & FONT_PROP
if fontPtr->fnt_typelen & FONT_AA
dcgrStr:1 = @pixPropGlyphStr
else
dcgrStr:1 = @bitPropGlyphStr
fin
else // FONT_MONO
dcgrStr:1 = @bitMonoGlyphStr
fin
return prevFont
end
def dcgrLoadDefFont(x, y, strptr)#2 // Default if no font selected
dcgrFont(FONT_DEFAULT)
if fontDefault // Ensure it got loaded
return dcgrStr(x, y, strptr)
fin
return 0, 0
end
export def fontGlyphDim(ch)#2
byte width, height, first
width = fontPtr->fnt_width
height = fontPtr->fnt_height
if fontPtr->fnt_typelen & FONT_PROP
first = fontPtr->fnt_first
if ch >= first and ch <= fontPtr->fnt_last
width = fontPtr=>fnt_glyptrs=>[ch - first]->gly_adv / 4
fin
fin
return width, height
end
export def fontType#1
return ^fontPtr & $F0
end
export def dcgrRect(x, y, w, h)#0
byte x2, y2, v
x2 = x + w - 1
y2 = y + h - 1
for v = y to y2
dcgrHLin(x, x2, v)
next
end
export def dcgrGetPixMap(x, y, w, h)#1
var pixmap, pixptr
byte i, j
pixmap = heapalloc((w + 1)/2 * h)
pixptr = pixmap
w--; h--
for j = 0 to h
for i = 0 to w step 2
^pixptr = dcgrGetPixel(i+x,j+y)|(dcgrGetPixel(i+x+1,j+y)<<4)
pixptr++
next
next
return pixmap
end
export def dcgrEncPixMap(w, h, pixmap, rlemap)#1
var rleptr
byte i, j, run, pixrun
rleptr = rlemap
w--; h--
for j = 0 to h
run = 0
for i = 0 to w step 2
if run and ^pixmap == pixrun
run++
else
if run
*rleptr = run*2 | (pixrun << 8)
//puth(*rleptr); putc(',')
rleptr = rleptr + 2
fin
run = 1
pixrun = ^pixmap
fin
pixmap++
next
*rleptr = run*2 | (pixrun << 8)
//puth(*rleptr); putln
rleptr = rleptr + 2
next
return rleptr - rlemap
end
export def spriteRead(filestr)#5
var sprptr, sprsize, xorg, yorg
byte refnum, width, height
width = 0
height = 0
sprptr = 0
refnum = fileio:open(filestr)
if refnum
fileio:read(refnum, @xorg, 1); xorg = sext(xorg)
fileio:read(refnum, @yorg, 1); yorg = sext(yorg)
fileio:read(refnum, @width, 1)
fileio:read(refnum, @height, 1)
if width <= 40 and height <= 48
sprsize = (width + 1) / 2 * height
sprptr = heapalloc(sprsize)
if sprptr
if fileio:read(refnum, sprptr, sprsize) <> sprsize
heaprelease(sprptr)
sprptr = NULL
fin
fin
fin
fileio:close(refnum)
fin
return xorg, yorg, width, height, sprptr
end
export def spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1
var sprsize
byte refnum, i, result
sprsize = (width + 1) / 2 * height
fileio:destroy(filestr)
result = fileio:create(filestr, $06, $0000)
if result == FILE_ERR_OK
refnum = fileio:open(filestr)
if refnum
fileio:write(refnum, @xorg, 1)
fileio:write(refnum, @yorg, 1)
fileio:write(refnum, @width, 1)
fileio:write(refnum, @height, 1)
sprsize = (width + 1) / 2 * height
fileio:write(refnum, sprptr, sprsize)
result = perr
fileio:close(refnum)
else
result = perr
fin
fin
return result
end
export def screenRead(filestr)#1
byte refnum
refnum = fileio:open(filestr)
if refnum
^page1x // Read AUX bytes
fileio:read(refnum, $2000, $2000)
^page1m // Read MAIN bytes
fileio:read(refnum, $2000, $2000)
fileio:close(refnum)
fin
return perr
end
export def screenWrite(filestr)#1
byte refnum, result
fileio:destroy(filestr)
result = fileio:create(filestr, $06, $2000)
if result == FILE_ERR_OK
refnum = fileio:open(filestr)
if refnum
^page1x // Write AUX bytes
if fileio:write(refnum, $2000, $2000) == $2000
^page1m // Write MAIN bytes
fileio:write(refnum, $2000, $2000)
fin
result = perr
fileio:close(refnum)
else
result = perr
fin
fin
return result
end
//
// Fixups
//
dcgrStr:1 = @dcgrLoadDefFont
//
// Keep module in memory
//
return modkeep
done

View File

@@ -1,177 +0,0 @@
.SUFFIXES =
AFLAGS = -o $@
DHGRLIB = dhgr.tk/libs/DHGRLIB.REL
DHGRUTILS = dhgr.tk/libs//DHGRUTILS.REL
DHGRTEST = dhgr.tk/test/DHGRTEST.REL
FONTTEST = dhgr.tk/test/FONTTEST.REL
DHGRSPRED = dhgr.tk/utils/DHGRSPRED.REL
DHGREASY = dhgr.tk/utils/DHGREASY.REL
DHGRRGB = dhgr.tk/utils/DHGRRGB.REL
DHGRSHOW = dhgr.tk/utils/DHGRSHOW.REL
DLGRCONV = dhgr.tk/utils/DLGRCONV.REL
DHGRRGB_C = dhgr.tk/utils/dhgrrgb
TTFCONV = dhgr.tk/utils/ttfconv
IIGSCONV = dhgr.tk/utils/gsfonconv
A2CONV = dhgr.tk/utils/a2fonconv
A2DEFAULT = dhgr.tk/utils/a2fondef
DDCONV = dhgr.tk/utils/ddfonconv
PENGUINS = dhgr.tk/demos/penguins/PENGUINS.REL
DARTHGR = dhgr.tk/demos/darthgr/DARTHGR.REL
STARTREK = dhgr.tk/demos/startrek/STARTREK.REL
FILLSHAPE = dhgr.tk/demos/startrek/FILLSHAPE.REL
DROGUE = dhgr.tk/drogue/DROGUE.REL
DROGUE.MAP = dhgr.tk/drogue/DROGUE.MAP.REL
DROGUE.COMBAT = dhgr.tk/drogue/DROGUE.COMBAT.REL
libs: $(DHGRLIB) $(DHGRUTILS)
cp $(DHGRLIB) prodos/sys
cp $(DHGRUTILS) prodos/sys
-mkdir prodos/sys/fonts
cp dhgr.tk/utils/fonts/APPLE2.FON.BIN prodos/sys/fonts
cp dhgr.tk/utils/fonts/APPLE2THIN.FON.BIN prodos/sys/fonts
cp dhgr.tk/utils/fonts/A2SLIM8.FON.BIN prodos/sys/fonts
test: $(DHGRTEST) $(FONTTEST)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/test
cp dhgr.tk/test/*.REL prodos/dhgr.tk/test
cp dhgr.tk/test/*.BIN prodos/dhgr.tk/test
utils: $(DHGRSPRED) $(DHGREASY) $(DHGRRGB) $(DHGRRGB_C) $(DHGRSHOW) $(DLGRCONV)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/utils
-mkdir prodos/dhgr.tk/utils/samples
cp dhgr.tk/utils/*.REL prodos/dhgr.tk/utils
cp dhgr.tk/utils/samples/* prodos/dhgr.tk/utils/samples
demos: $(PENGUINS) $(DARTHGR) $(STARTREK) $(FILLSHAPE)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/demos/
-mkdir prodos/dhgr.tk/demos/penguins/
-mkdir prodos/dhgr.tk/demos/darthgr/
-mkdir prodos/dhgr.tk/demos/startrek/
cp $(PENGUINS) prodos/dhgr.tk/demos/penguins/
cp dhgr.tk/demos/penguins/*.BIN prodos/dhgr.tk/demos/penguins/
cp $(DARTHGR) prodos/dhgr.tk/demos/darthgr/
cp dhgr.tk/demos/darthgr/*.BIN prodos/dhgr.tk/demos/darthgr/
cp $(STARTREK) prodos/dhgr.tk/demos/startrek/
cp $(FILLSHAPE) prodos/dhgr.tk/demos/startrek/
cp dhgr.tk/demos/startrek/*.BIN prodos/dhgr.tk/demos/startrek/
drogue: $(DROGUE) $(DROGUE.MAP) $(DROGUE.COMBAT)
-mkdir prodos/dhgr.tk/demos
-mkdir prodos/dhgr.tk/demos/drogue
cp dhgr.tk/drogue/DROGUE.REL prodos/dhgr.tk/demos/drogue
cp dhgr.tk/drogue/DROGUE.MAP.REL prodos/dhgr.tk/demos/drogue/DROGUEMAP.REL
cp dhgr.tk/drogue/DROGUE.COMBAT.REL prodos/dhgr.tk/demos/drogue/DROGUECOMBAT.REL
cp samplesrc/LEVEL0#040000 prodos/dhgr.tk/demos/drogue/LEVEL0.TXT
cp samplesrc/LEVEL1#040000 prodos/dhgr.tk/demos/drogue/LEVEL1.TXT
bld: $(DHGRLIB) $(DHGRUTILS) $(DHGRTEST) $(DHGRRGB) $(DHGRSHOW) $(STARTREK)
-mkdir prodos/bld/dhgr.tk/
-mkdir prodos/bld/dhgr.tk/inc/
cp dhgr.tk/inc/dhgrlib.plh prodos/bld/dhgr.tk/inc/DHGRLIB.PLH.TXT
cp dhgr.tk/inc/dhgrutils.plh prodos/bld/dhgr.tk/inc/DHGRUTILS.PLH.TXT
cp dhgr.tk/test/dhgrtest.pla prodos/bld/dhgr.tk/DHGRTEST.PLA.TXT
cp dhgr.tk/test/fonttest.pla prodos/bld/dhgr.tk/FONTTEST.PLA.TXT
cp dhgr.tk/demos/darthgr/darthgr.pla prodos/bld/dhgr.tk/DARTHGR.PLA.TXT
cp dhgr.tk/demos/startrek/startrek.pla prodos/bld/dhgr.tk/STARTREK.PLA.TXT
cp dhgr.tk/demos/startrek/fillshape.pla prodos/bld/dhgr.tk/FILLSHAPE.PLA.TXT
cp dhgr.tk/utils/dhgrrgb.pla prodos/bld/dhgr.tk/DHGRRGB.PLA.TXT
cp dhgr.tk/utils/dhgrshow.pla prodos/bld/dhgr.tk/DHGRSHOW.PLA.TXT
fontconv: $(TTFCONV) $(IIGSCONV) $(A2CONV) $(A2DEFAULT) $(DDCONV)
all: libs test utils demos bld
clean:
-rm dhgr.tk/demos/pengiuns/*.o dhgr.tk/demos/pengiuns/*.REL dhgr.tk/demos/pengiuns/*.a
-rm dhgr.tk/demos/darthgr/*.o dhgr.tk/demos/darthgr/*.REL dhgr.tk/demos/darthgr/*.a
-rm dhgr.tk/demos/startrek/*.o dhgr.tk/demos/startrek/*.REL dhgr.tk/demos/startrek/*.a
-rm dhgr.tk/test/*.o dhgr.tk/test/*.REL dhgr.tk/test/*.a
-rm dhgr.tk/utils/*.o dhgr.tk/utils/*.REL dhgr.tk/utils/*.a
$(TTFCONV): dhgr.tk/utils/ttfconv.c
cc `pkg-config --cflags freetype2` dhgr.tk/utils/ttfconv.c -o dhgr.tk/utils/ttfconv -lfreetype
$(IIGSCONV): dhgr.tk/utils/gsfonconv.c
cc dhgr.tk/utils/gsfonconv.c -o dhgr.tk/utils/gsfonconv
$(A2CONV): dhgr.tk/utils/a2fonconv.c
cc dhgr.tk/utils/a2fonconv.c -o dhgr.tk/utils/a2fonconv
$(A2DEFAULT): dhgr.tk/utils/a2fondef.c
cc dhgr.tk/utils/a2fondef.c -o dhgr.tk/utils/a2fondef
$(DDCONV): dhgr.tk/utils/ddfonconv.c
cc dhgr.tk/utils/ddfonconv.c -o dhgr.tk/utils/ddfonconv
$(DHGRLIB): dhgr.tk/libs/dhgrlib.pla dhgr.tk/inc/dhgrlib.plh
./xplasm -AMOW dhgr.tk/libs/dhgrlib.pla
acme --setpc 4094 -o $(DHGRLIB) dhgr.tk/libs/dhgrlib.a
$(DHGRUTILS): dhgr.tk/libs/dhgrutils.pla $(DHGRLIB) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/libs/dhgrutils.pla
acme --setpc 4094 -o $(DHGRUTILS) dhgr.tk/libs/dhgrutils.a
$(DHGRTEST): dhgr.tk/test/dhgrtest.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/test/dhgrtest.pla
acme --setpc 4094 -o $(DHGRTEST) dhgr.tk/test/dhgrtest.a
$(FONTTEST): dhgr.tk/test/fonttest.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/test/fonttest.pla
acme --setpc 4094 -o $(FONTTEST) dhgr.tk/test/fonttest.a
$(DHGRSPRED): dhgr.tk/utils/dhgrspred.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgrspred.pla
acme --setpc 4094 -o $(DHGRSPRED) dhgr.tk/utils/dhgrspred.a
$(DHGREASY): dhgr.tk/utils/dhgreasy.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgreasy.pla
acme --setpc 4094 -o $(DHGREASY) dhgr.tk/utils/dhgreasy.a
$(DHGRSHOW): dhgr.tk/utils/dhgrshow.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgrshow.pla
acme --setpc 4094 -o $(DHGRSHOW) dhgr.tk/utils/dhgrshow.a
$(DLGRCONV): dhgr.tk/utils/dlgrconv.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dlgrconv.pla
acme --setpc 4094 -o $(DLGRCONV) dhgr.tk/utils/dlgrconv.a
$(DHGRRGB): dhgr.tk/utils/dhgrrgb.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/utils/dhgrrgb.pla
acme --setpc 4094 -o $(DHGRRGB) dhgr.tk/utils/dhgrrgb.a
$(DHGRRGB_C): dhgr.tk/utils/dhgrrgb.c
cc dhgr.tk/utils/dhgrrgb.c -o dhgr.tk/utils/dhgrrgb -lm
$(PENGUINS): dhgr.tk/demos/penguins/penguins.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/penguins/penguins.pla
acme --setpc 4094 -o $(PENGUINS) dhgr.tk/demos/penguins/penguins.a
$(DARTHGR): dhgr.tk/demos/darthgr/darthgr.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/darthgr/darthgr.pla
acme --setpc 4094 -o $(DARTHGR) dhgr.tk/demos/darthgr/darthgr.a
$(STARTREK): dhgr.tk/demos/startrek/startrek.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/startrek/startrek.pla
acme --setpc 4094 -o $(STARTREK) dhgr.tk/demos/startrek/startrek.a
$(FILLSHAPE): dhgr.tk/demos/startrek/fillshape.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/demos/startrek/fillshape.pla
acme --setpc 4094 -o $(FILLSHAPE) dhgr.tk/demos/startrek/fillshape.a
$(DROGUE): dhgr.tk/drogue/drogue.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/drogue/drogue.pla
acme --setpc 4094 -o $(DROGUE) dhgr.tk/drogue/drogue.a
$(DROGUE.MAP): dhgr.tk/drogue/drogue.map.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/drogue/drogue.map.pla
acme --setpc 4094 -o $(DROGUE.MAP) dhgr.tk/drogue/drogue.map.a
$(DROGUE.COMBAT): dhgr.tk/drogue/drogue.combat.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./xplasm -AMOW dhgr.tk/drogue/drogue.combat.pla
acme --setpc 4094 -o $(DROGUE.COMBAT) dhgr.tk/drogue/drogue.combat.a

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,458 +0,0 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
//
// Test sprite
//
const SPR_W = 16
const SPR_H = 16
byte[] sprite = $55,$55,$55,$05,$50,$55,$55,$55
byte[] = $55,$55,$00,$00,$00,$00,$55,$55
byte[] = $55,$00,$00,$AA,$AA,$00,$00,$55
byte[] = $05,$00,$AA,$AA,$AA,$AA,$00,$50
byte[] = $00,$A0,$AA,$FF,$FF,$AA,$0A,$00
byte[] = $00,$AA,$FF,$FF,$FF,$FF,$AA,$00
byte[] = $00,$AA,$1F,$12,$12,$F2,$AA,$00
byte[] = $00,$AA,$2F,$21,$21,$F1,$AA,$00
byte[] = $00,$AA,$1F,$12,$12,$F2,$AA,$00
byte[] = $00,$AA,$2F,$21,$21,$F1,$AA,$00
byte[] = $00,$AA,$FF,$FF,$FF,$FF,$AA,$00
byte[] = $00,$A0,$AA,$FF,$FF,$AA,$0A,$00
byte[] = $05,$00,$AA,$AA,$AA,$AA,$00,$50
byte[] = $55,$00,$00,$AA,$AA,$00,$00,$55
byte[] = $55,$55,$00,$00,$00,$00,$55,$55
byte[] = $55,$55,$55,$05,$50,$55,$55,$55
byte[] rlesprt = 7,$55,2,$00,7,$55
byte[] = 4,$55,8,$00,4,$55
byte[] = 2,$55,4,$00,4,$AA,4,$00,2,$55
byte[] = 1,$05,3,$00,8,$AA,3,$00,1,$55
byte[] = 3,$00,3,$AA,4,$FF,3,$AA,3,$00
byte[] = 2,$00,2,$AA,8,$FF,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$1F,4,$12,2,$F2,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$2F,4,$21,2,$F1,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$1F,4,$12,2,$F2,2,$AA,2,$00
byte[] = 2,$00,2,$AA,2,$2F,4,$21,2,$F1,2,$AA,2,$00
byte[] = 2,$00,2,$AA,8,$FF,2,$AA,2,$00
byte[] = 3,$00,3,$AA,4,$FF,3,$AA,3,$00
byte[] = 1,$05,3,$00,8,$AA,3,$00,1,$55
byte[] = 2,$55,4,$00,4,$AA,4,$00,2,$55
byte[] = 4,$55,8,$00,4,$55
byte[] = 7,$55,2,$00,7,$55
word rlesprptr
word sprite7msk[7]
word sprite7[7]
word sprite7span,sprite7w
//
// Dither matrices
//
byte[] dither25 = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] = $55,$55,$00,$00,$AA,$AA,$00,$00
byte[] dither50 = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] = $55,$55,$AA,$AA,$55,$55,$AA,$AA
byte[] dither75 = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
byte[] = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
byte[] = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
byte[] = $55,$55,$FF,$FF,$AA,$AA,$FF,$FF
word[] dither = @dither25,@dither50,@dither75
//
// Sliding sprite Y coordinate
//
const SLIDE_Y = 170
//
// Enterprise sprites
//
struc t_sprite
var spr_xorg
var spr_yorg
var spr_width
var spr_height
var spr_pixmap
var spr_bl7
end
res[t_sprite * 8] ncc1701
char[12] sprFile = "ENT.UP.SPR"
char[12] = "ENT.UR.SPR"
char[12] = "ENT.RT.SPR"
char[12] = "ENT.DR.SPR"
char[12] = "ENT.DN.SPR"
char[12] = "ENT.DL.SPR"
char[12] = "ENT.LT.SPR"
char[12] = "ENT.UL.SPR"
const ENT_W7 = 5
const ENT_H = 43
const ENT_SZ = ENT_W7*4*ENT_H
def dcgrCompSprite(offset)#0
byte i
for i = 0 to 6
sprite7[i],sprite7span = dhgrAllocBl7Mem(SPR_W+offset,SPR_H)
sprite7w = sprite7span >> 2
dhgrSurfMem(OP_SRC,SPR_H,sprite7[i],sprite7span)
dcgrColor(CLR_BLACK)
dhgrClearBl7(0,0,sprite7w,SPR_H)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
//dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,rlesprptr)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(0,i*SPR_H,sprite7w,SPR_H,sprite7[i],sprite7span)
next
end
def dcgrCompMask(offset)#0
byte i
for i = 0 to 6
sprite7msk[i],sprite7span = dhgrAllocBl7Mem(SPR_W + offset,SPR_H)
sprite7w = sprite7span >> 2
dhgrSurfMem(OP_SRC,SPR_H,sprite7msk[i],sprite7span)
dcgrColor(CLR_WHITE)
dhgrClearBl7(0,0,sprite7w,SPR_H)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dhgrOp(OP_XOR)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(sprite7w,i * SPR_H,sprite7w,SPR_H,sprite7msk[i],sprite7span)
next
end
def readEnterprise#0
var xorg,yorg,width,height,pixptr,t_ptr,f_ptr
byte i
t_ptr = @ncc1701
f_ptr = @sprFile
for i = 0 to 7
xorg,yorg,width,height,pixptr = spriteRead(f_ptr)
t_ptr=>spr_xorg = xorg
t_ptr=>spr_yorg = yorg
t_ptr=>spr_width = width
t_ptr=>spr_height = height
t_ptr=>spr_pixmap = pixptr
t_ptr=>spr_bl7 = heapalloc(ENT_SZ)
dhgrSurfMem(OP_SRC,ENT_H,t_ptr=>spr_bl7,ENT_W7*4)
dcgrColor(CLR_BLACK)
dhgrClearBl7(0,0,ENT_W7,ENT_H)
dcgrPixmap(ENT_W7*7/2 - xorg,ENT_H/2 - yorg,width,height,pixptr)
t_ptr = t_ptr + t_sprite
f_ptr = f_ptr + 12
next
end
//////////////////////////////////////////
// //
// Test Harness //
// //
//////////////////////////////////////////
def dhgrTest#0
word i
//
// Double Hires Lines
//
dhgrSurfScr(OP_OR)
setlineplot(@dhgrSet)
for i = 559 downto 0 step 20
line(0,0,i,191)
next
getc
end
def dcgrTest#0
word i,j,k,oi,oj,i7,im7,k7,km7,s7w,inci,incj,inck
word backblk,backspan
word restrblk,restrspan,restr7w,restrw
byte mode
byte[40] tilestr
//
// Use back buffer for tile set buffer
//
backblk,backspan = dhgrAllocBl7Mem(SCR_WIDTH,SPR_H)
j = 0
while ^$C000 < 128
//
// Convert compiled sprite into tile set
//
dhgrMemBl7Tile(0,0,sprite7[j],sprite7span,backblk)
dhgrMemBl7Tile(1,0,sprite7[j],sprite7span,backblk + 32)
dhgrMemBl7Tile(2,0,sprite7[j],sprite7span,backblk + 64)
dhgrMemBl7Tile(3,0,sprite7[j],sprite7span,backblk + 96)
dhgrMemBl7Tile(0,8,sprite7[j],sprite7span,backblk + 128)
dhgrMemBl7Tile(1,8,sprite7[j],sprite7span,backblk + 160)
dhgrMemBl7Tile(2,8,sprite7[j],sprite7span,backblk + 192)
dhgrMemBl7Tile(3,8,sprite7[j],sprite7span,backblk + 224)
//
// Fill screen wil tiles matching compiled sprite
//
for i = 0 to 19
tilestr[i] = i & $03
next
for i = 0 to 19
tilestr[i + 20] = (i & $03) + 4
next
dhgrSurfScr(OP_SRC)
for i = 0 to 12 step 2
dhgrTiles(10,i, @tilestr, 10,backblk)
dhgrTiles(10,i + 1,@tilestr + 20,10,backblk)
next
j++
if j == 7; j = 0; fin
loop
getc
//
// Lines
//
dhgrSurfScr(OP_SRC)
setlineplot(@dcgrPixel)
setlinespans(@dcgrHLin,@dcgrVLin)
for i = 0 to 191 step 2
dcgrColor(i)
linespans(0,0,139,i)
next
for i = 139 downto 0 step 2
dcgrColor(i)
linespans(0,0,i,191)
next
dcgrColor(CLR_BLACK)
dhgrClearBl7(21/7,30,100/7,132)
dcgrColor(CLR_WHITE)
dcgrHLin((21/7)*7-1,(21/7)*7+(100/7)*7,29)
dcgrHLin((21/7)*7-1,(21/7)*7+(100/7)*7,29+133)
dcgrVLin(29,29+133,(21/7)*7-1)
dcgrVLin(29,29+133,(21/7)*7+(100/7)*7)
dcgrColor(CLR_BLACK) // Outline color
dcgrBoldStr(CLR_WHITE,48,14,"Hello!")
dcgrFont(FONT_DEF_THIN)
dcgrColor(CLR_WHITE) // Outline color
dcgrBoldStr(CLR_BLACK,42,24,"from DCGRTEST")
i = 64; j = 64; k = 86
k7 = k/7
inci = 1; incj = 1; inck = 2
dhgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dhgrScrBl7(0,SLIDE_Y,backspan >> 2,SPR_H)
dhgrSurfScr(OP_SRC)
dcgrColor(CLR_WHITE)
dcgrHLin(0,139,SLIDE_Y)
dcgrHLin(0,139,SLIDE_Y+SPR_H-1)
dcgrVLin(SLIDE_Y,SLIDE_Y+SPR_H-1,0)
dcgrVLin(SLIDE_Y,SLIDE_Y+SPR_H-1,139)
getc
dhgrMemBl7(0,SLIDE_Y,backspan >> 2,SPR_H,backblk,backspan)
restrblk,restrspan = dhgrAllocBl7Mem(SPR_W,SPR_H)
restr7w = restrspan >> 2
restrw = restr7w * 7
mode = 1
while mode
if ^$C000 >= 128
mode = (^$C010 & $7F) - '0'
fin
k7,km7 = divmod(k,7)
i7,im7 = divmod(i,7)
if i7 + sprite7w < (21/7)+(100/7)
s7w = sprite7w
else
s7w = (21/7)+(100/7) - i7
fin
when mode
is 1
dhgrSurfScr(OP_SRC)
dhgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
is 2
if k < 0 and km7 // Handle off left edge special case
k7--
km7 = 7 + km7
fin
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dhgrOp(OP_AND)
dhgrMemBl7(0,0,sprite7w,SPR_H,sprite7msk[km7],sprite7span)
dhgrOp(OP_XOR)
dhgrMemBl7(0,0,sprite7w,SPR_H,sprite7[km7],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 3
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
is 4
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrPixMap(km7 + 2,0,SPR_W,SPR_H,@sprite)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 5
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
is 6
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrColor(CLR_BLACK)
dcgrRect(km7 + 2,3,16 + 2,10)
dcgrColor(CLR_WHITE)
dcgrStr(km7 + 3,13,"DCGR")
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 7
dhgrSurfScr(OP_SRC)
dhgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
break
is 8
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
break
is 9
dhgrSurfScr(OP_XOR)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
dcgrPixMap(oi,oj,SPR_W,SPR_H,@sprite)
break
wend
if k > 136 or k < -16; inck = -inck; fin
k = k + inck
oi = i; oj = j
if i > 102 or i < 22; inci = -inci; fin
i = i + inci
if j > 145 or j < 32; incj = -incj; fin
j = j + incj
loop
//
// Rotate Enterprise
//
dhgrSurfScr(OP_SRC)
dcgrColor(CLR_BLACK)
dhgrClearBl7(21/7,30,100/7,132)
dhgrOp(OP_XOR)
k = 0
i = @ncc1701
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
while ^$C000 < 128
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
loop
getc
dhgrOp(OP_SRC)
while ^$C000 < 128
dcgrColor(CLR_BLACK)
dhgrClearBl7(60/7,75,5,43)
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
loop
getc
while ^$C000 < 128
dhgrMemBl7(60/7,75,ENT_W7,ENT_H,i=>spr_bl7,ENT_W7*4)
i = i + t_sprite
k++
if k > 7
k = 0
i = @ncc1701
fin
loop
getc
//
// Re-use the back buffer for a stipple pattern to mask the screen
//
for k = 0 to 2
dhgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dcgrColor(CLR_WHITE)
dhgrClearBl7(0,0,SCR_WIDTH7,SPR_H)
dcgrColor(CLR_BLACK)
for i = 0 to 139 step 16
dcgrBitMap(i,0,16,16,dither[k])
next
dhgrSurfScr(OP_AND)
for j = 0 to 95 step 16
dhgrMemBl7(0,j,SCR_WIDTH7,16,backblk,backspan)
dhgrMemBl7(0,175 - j,SCR_WIDTH7,16,backblk,backspan)
next
next
dhgrSurfScr(OP_SRC)
dhgrClearBl7(0,0,SCR_WIDTH7,SCR_HEIGHT)
//
// Create color patterns
//
for i = 0 to 15
dcgrColor(i)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
dcgrColor(oj)
oi = 0
for i = 0 to 111 step 14
dcgrBitMap(i,j,14,12,@dither25)
oi++
next
oj++
next
getc
for i = 0 to 15
dcgrColor(i)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
dcgrColor(oj)
oi = 0
for i = 0 to 111 step 14
dcgrBitMap(i,j,14,12,@dither50)
oi++
next
oj++
next
getc
for i = 0 to 15
dcgrColor(i)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
dcgrColor(oj)
oi = 0
for i = 0 to 111 step 14
dcgrBitMap(i,j,14,12,@dither75)
oi++
next
oj++
next
getc
end
rlesprptr = heapmark
heapalloc(dcgrEncPixMap(SPR_W,SPR_H,@sprite,rlesprptr))
dhgrMode(DHGR_COLOR_MODE)
dhgrTest
screenRead("splash.dhgr")
dhgrOp(OP_SRC)
dcgrPixMap(10,10,20,20,dcgrGetPixMap(60,66,20,20))
getc
readEnterprise
dcgrCompSprite(2)
dcgrCompMask(2)
dcgrTest
dhgrMode(DHGR_TEXT_MODE)
done

View File

@@ -1,36 +0,0 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
var arg
var xPen = 60
var yPen = 30
var fontWidth, fontHeight
char hello = "Hello, world"
var msg = @hello
arg = argNext(argFirst)
dhgrMode(DHGR_COLOR_MODE)
screenRead("scroll.dhgr")
while arg and ^arg
if ^(arg + 1) == '-'
msg = arg + 1
^msg = ^arg - 1
else
dcgrFont(fontRead(arg))
fontWidth, fontHeight = fontGlyphDim('a')
fontHeight++
dcgrColor(CLR_BLACK)
dcgrStr(xPen, yPen + (fontHeight * 7) / 8, msg)
yPen = yPen + fontHeight
fin
arg = argNext(arg)
loop
getc
dhgrMode(DHGR_TEXT_MODE)
done

View File

@@ -1,189 +0,0 @@
/*
* Apple 2 font converter
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <stdbit.h>
#include <stdint.h>
#include <ctype.h>
#define FONT_WIDTH 32
#define FONT_HEIGHT 12
#define GLYPH_FIRST 32
#define GLYPH_LAST 127
#define GLYPH_COUNT (GLYPH_LAST-GLYPH_FIRST+1)
#define FONT_BITMAP 0
#define FONT_PIXMAP 1
int fontFormat = FONT_BITMAP;
//
// Apple //e hires character font
//
uint8_t Apple2Glyphs[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00,
0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00,0x14,0x14,0x3E,0x14,0x3E,0x14,0x14,0x00,
0x08,0x3C,0x0A,0x1C,0x28,0x1E,0x08,0x00,0x06,0x26,0x10,0x08,0x04,0x32,0x30,0x00,
0x04,0x0A,0x0A,0x04,0x2A,0x12,0x2C,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,
0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00,0x08,0x10,0x20,0x20,0x20,0x10,0x08,0x00,
0x08,0x2A,0x1C,0x08,0x1C,0x2A,0x08,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
0x1C,0x22,0x32,0x2A,0x26,0x22,0x1C,0x00,0x08,0x0C,0x08,0x08,0x08,0x08,0x1C,0x00,
0x1C,0x22,0x20,0x18,0x04,0x02,0x3E,0x00,0x3E,0x20,0x10,0x18,0x20,0x22,0x1C,0x00,
0x10,0x18,0x14,0x12,0x3E,0x10,0x10,0x00,0x3E,0x02,0x1E,0x20,0x20,0x22,0x1C,0x00,
0x38,0x04,0x02,0x1E,0x22,0x22,0x1C,0x00,0x3E,0x20,0x10,0x08,0x04,0x04,0x04,0x00,
0x1C,0x22,0x22,0x1C,0x22,0x22,0x1C,0x00,0x1C,0x22,0x22,0x3C,0x20,0x10,0x0E,0x00,
0x00,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x08,0x04,0x00,
0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00,0x00,0x00,0x3E,0x00,0x3E,0x00,0x00,0x00,
0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x1C,0x22,0x10,0x08,0x08,0x00,0x08,0x00,
0x1C,0x22,0x2A,0x3A,0x1A,0x02,0x3C,0x00,0x08,0x14,0x22,0x22,0x3E,0x22,0x22,0x00,
0x1E,0x22,0x22,0x1E,0x22,0x22,0x1E,0x00,0x1C,0x22,0x02,0x02,0x02,0x22,0x1C,0x00,
0x1E,0x22,0x22,0x22,0x22,0x22,0x1E,0x00,0x3E,0x02,0x02,0x1E,0x02,0x02,0x3E,0x00,
0x3E,0x02,0x02,0x1E,0x02,0x02,0x02,0x00,0x3C,0x02,0x02,0x02,0x32,0x22,0x3C,0x00,
0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,
0x20,0x20,0x20,0x20,0x20,0x22,0x1C,0x00,0x22,0x12,0x0A,0x06,0x0A,0x12,0x22,0x00,
0x02,0x02,0x02,0x02,0x02,0x02,0x3E,0x00,0x22,0x36,0x2A,0x2A,0x22,0x22,0x22,0x00,
0x22,0x22,0x26,0x2A,0x32,0x22,0x22,0x00,0x1C,0x22,0x22,0x22,0x22,0x22,0x1C,0x00,
0x1E,0x22,0x22,0x1E,0x02,0x02,0x02,0x00,0x1C,0x22,0x22,0x22,0x2A,0x12,0x2C,0x00,
0x1E,0x22,0x22,0x1E,0x0A,0x12,0x22,0x00,0x1C,0x22,0x02,0x1C,0x20,0x22,0x1C,0x00,
0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1C,0x00,
0x22,0x22,0x22,0x22,0x22,0x14,0x08,0x00,0x22,0x22,0x22,0x2A,0x2A,0x36,0x22,0x00,
0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x00,
0x3E,0x20,0x10,0x08,0x04,0x02,0x3E,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x3E,0x00,
0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x3E,0x00,
0x00,0x00,0x08,0x14,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,
0x04,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x20,0x3C,0x22,0x3C,0x00,
0x02,0x02,0x1E,0x22,0x22,0x22,0x1E,0x00,0x00,0x00,0x3C,0x02,0x02,0x02,0x3C,0x00,
0x20,0x20,0x3C,0x22,0x22,0x22,0x3C,0x00,0x00,0x00,0x1C,0x22,0x3E,0x02,0x3C,0x00,
0x18,0x24,0x04,0x1E,0x04,0x04,0x04,0x00,0x00,0x00,0x1C,0x22,0x22,0x3C,0x20,0x1C,
0x02,0x02,0x1E,0x22,0x22,0x22,0x22,0x00,0x08,0x00,0x0C,0x08,0x08,0x08,0x1C,0x00,
0x10,0x00,0x18,0x10,0x10,0x10,0x12,0x0C,0x02,0x02,0x22,0x12,0x0E,0x12,0x22,0x00,
0x0C,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x36,0x2A,0x2A,0x22,0x22,0x00,
0x00,0x00,0x1E,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x1C,0x22,0x22,0x22,0x1C,0x00,
0x00,0x00,0x1E,0x22,0x22,0x1E,0x02,0x02,0x00,0x00,0x3C,0x22,0x22,0x3C,0x20,0x20,
0x00,0x00,0x3A,0x06,0x02,0x02,0x02,0x00,0x00,0x00,0x3C,0x02,0x1C,0x20,0x1E,0x00,
0x04,0x04,0x1E,0x04,0x04,0x24,0x18,0x00,0x00,0x00,0x22,0x22,0x22,0x32,0x2C,0x00,
0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00,0x00,0x00,0x22,0x22,0x2A,0x2A,0x36,0x00,
0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00,0x00,0x00,0x22,0x22,0x22,0x3C,0x20,0x1C,
0x00,0x00,0x3E,0x10,0x08,0x04,0x3E,0x00,0x38,0x0C,0x0C,0x06,0x0C,0x0C,0x38,0x00,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0E,0x18,0x18,0x30,0x18,0x18,0x0E,0x00,
0x00,0x2C,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x14,0x2A,0x14,0x2A,0x00,0x00,
};
void write_glyph(FILE *fp, int c)
{
uint8_t glyphdef[5], *glyphBits;
uint8_t strike[9];
int i, left, top, width, height, rowOR;
glyphBits = (uint8_t *)Apple2Glyphs + (c - GLYPH_FIRST) * 8;
height = 8;
width = 4;
left = 0;
top = 7;
rowOR = 0;
for (i = 0; i < 8; i++)
{
strike[i] = ((*glyphBits ) & 0x02)
| ((*glyphBits | *glyphBits >> 1 | *glyphBits >> 2) & 0x04)
| (( *glyphBits >> 2) & 0x08);
glyphBits++;
rowOR |= strike[i];
}
if ((rowOR & 0x08) == 0)
width--;
if ((rowOR & 0x02) == 0)
{
for (i = 0; i < 8; i++)
strike[i] >>= 1;
width--;
}
for (i = 7; i >= 0; i--)
{
if (strike[i] == 0)
{
height--;
if (i < top)
top--;
}
else
break;
}
while ((height > 0) && (strike[0] == 0))
{
height--;
top--;
for (i = 0; i < height; i++)
strike[i] = strike[i + 1];
}
if (height <= 0)
height = 1;
if (top <= 0)
top = 1;
glyphdef[0] = left;
glyphdef[1] = -top;
glyphdef[2] = width;
glyphdef[3] = height;
glyphdef[4] = width + left;
fwrite(glyphdef, 1, 5, fp);
fwrite(strike, 1, height, fp);
}
void write_font_file(char *filename, char *fontname)
{
FILE *fp;
unsigned char ch;
char font_header[16];
int glyph_width, glyph_height, c;
if ((fp = fopen(filename, "wb")))
{
memset(font_header, 0, 16);
strncpy(&font_header[1], fontname, 15);
ch = strlen(fontname);
font_header[0] = (ch < 16 ? ch : 15) | 0x80; // FONT_PROP
fwrite(font_header, 1, 16, fp);
glyph_width = 4;
glyph_height = 8;
ch = GLYPH_FIRST;
fwrite(&ch, 1, 1, fp);
ch = GLYPH_LAST;
fwrite(&ch, 1, 1, fp);
ch = fontFormat == glyph_width;
fwrite(&ch, 1, 1, fp);
ch = glyph_height;
fwrite(&ch, 1, 1, fp);
for (c = GLYPH_FIRST; c <= GLYPH_LAST; c++)
write_glyph(fp, c);
fclose(fp);
}
}
void die(char *str)
{
fprintf(stderr,"error: %s\n", str);
exit(-1);
}
int main(int argc, char **argv)
{
char *font_file;
int i;
font_file = NULL;
while (*++argv)
{
if (argv[0][0] == '-')
{
}
else
{
if (!font_file)
font_file = *argv;
else
fprintf(stderr, "? %s\n", *argv);
}
}
if (!font_file)
die( "Missing font file");
write_font_file(font_file, "Apple2");
return 0;
}

View File

@@ -1,272 +0,0 @@
/*
* GS font converter
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <stdbit.h>
#include <stdint.h>
#define FONT_WIDTH 32
#define FONT_HEIGHT 12
#define GLYPH_FIRST 32
#define GLYPH_LAST 127
#define GLYPH_COUNT (GLYPH_LAST-GLYPH_FIRST+1)
struct macfont {
uint16_t fontType;
uint16_t firstChar;
uint16_t lastChar;
uint16_t widMax;
uint16_t kernMax;
uint16_t nDescent;
uint16_t rectWidth;
uint16_t rectHeight;
uint16_t owTLoc;
uint16_t ascent;
uint16_t descent;
uint16_t leading;
uint16_t rowWords;
uint16_t bitImage; // [rowWords * rectHeight] (fonstStrike)
//uint16_t rlocTable; // lastChar - firstChar + 3 : pixel offset of glyph in bitImage
//uint16_t owTable; lastChar - firstChar + 3 : offset/width table
};
struct gsfont *gsf;
struct macfont *macf;
int16_t *locTable;
uint16_t *owTable;
/*
* Bit reversals
*/
unsigned char bitReverse[256];
unsigned char clrSwap[256];
unsigned char clrRot[] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,
0x01,0x03,0x05,0x07,0x09,0x0B,0x0D,0x0F};
void write_glyph(FILE *fp, int c)
{
uint8_t glyphdef[5], *swapbuf, *glyphBits;
uint32_t rowbits;
int pixOffset, pixWidth, byteWidth, byteOffset, bitShift, bitWidth, glyphSpan, i;
int left, top, width, height;
if (c < macf->firstChar || c > macf->lastChar)
{
memset(glyphdef, 0, 5);
fwrite(&glyphdef, 1, 5, fp);
return;
}
c -= macf->firstChar;
glyphBits = (uint8_t *)&(macf->bitImage),
glyphSpan = macf->rowWords * 2;
height = macf->rectHeight;
width = owTable[c] & 0xFF;
left = owTable[c] >> 8;
top = macf->ascent;
glyphdef[0] = left;
glyphdef[1] = -top;
#if PIXFONT
glyphdef[2] = (width + 3) / 4;
#else
glyphdef[2] = width;
#endif
glyphdef[3] = height;
glyphdef[4] = width + left;
fwrite(&glyphdef, 1, 5, fp);
pixOffset = locTable[c];
pixWidth = locTable[c+1] - locTable[c];
byteOffset = pixOffset / 8;
bitShift = pixOffset & 7;
bitWidth = bitShift + pixWidth;
byteWidth = (width + 7) / 8;
rowbits = 0;
while (height--)
{
if (pixWidth > 0)
{
rowbits = bitReverse[glyphBits[byteOffset]];
if (bitWidth > 8)
{
rowbits |= bitReverse[glyphBits[byteOffset + 1]] << 8;
if (bitWidth > 16)
{
rowbits |= bitReverse[glyphBits[byteOffset + 2]] << 16;
if (bitWidth > 24)
rowbits |= bitReverse[glyphBits[byteOffset + 3]] << 24;
}
}
rowbits >>= bitShift;
rowbits &= 0xFFFFFFFF >> (32 - pixWidth);
}
#if PIXFONT
glyphdef[0] = clrSwap[rowbits & 0xFF];
glyphdef[1] = clrSwap[(rowbits >> 8) & 0xFF];
glyphdef[2] = clrSwap[(rowbits >> 16) & 0xFF];
glyphdef[3] = clrSwap[(rowbits >> 24) & 0xFF];
#else
glyphdef[0] = rowbits;
glyphdef[1] = rowbits >> 8;
glyphdef[2] = rowbits >> 16;
glyphdef[3] = rowbits >> 24;
#endif
fwrite(&glyphdef, 1, byteWidth, fp);
glyphBits += glyphSpan;
}
}
void write_font_file(char *filename, char *fontfile)
{
FILE *fp;
unsigned char ch;
char *fontname, *scanname, font_header[16];
int glyph_width, glyph_height, c;
if ((fp = fopen(filename, "wb")))
{
fontname = scanname = fontfile;
while (*scanname) // Strip leading directory names
{
if (*scanname == '/')
fontname = scanname + 1;
scanname++;
}
while (scanname > fontfile)
{
if (*scanname == '.')
{
*scanname = '\0';
}
scanname--;
}
memset(font_header, 0, 16);
strncpy(&font_header[1], fontname, 15);
ch = strlen(fontname);
font_header[0] = ch < 16 ? ch : 15;
#if PIXFONT
font_header[0] |= 0x80 | 0x40; // FONT_PROP | FONT_PIXMAP
#else
font_header[0] |= 0x80; // FONT_PROP
#endif
fwrite(font_header, 1, 16, fp);
glyph_width = macf->rectWidth;
glyph_height = macf->rectHeight;
ch = GLYPH_FIRST;
fwrite(&ch, 1, 1, fp);
ch = GLYPH_LAST;
fwrite(&ch, 1, 1, fp);
#if PIXFONT
ch = (glyph_width + 3) / 4;
#else
ch = glyph_width;
#endif
fwrite(&ch, 1, 1, fp);
ch = glyph_height;
fwrite(&ch, 1, 1, fp);
for (c = GLYPH_FIRST; c <= GLYPH_LAST; c++)
write_glyph(fp, c);
fclose(fp);
}
}
void die(char *str)
{
fprintf(stderr,"error: %s\n", str);
exit(-1);
}
void dispGlyph(uint8_t *glyphBits, int glyphSpan, int width, int height)
{
uint32_t rowbits;
int byteOffset, bitShift, bitWidth, i;
while (height--)
{
rowbits = glyphBits[0];
if (width > 8)
{
rowbits |= glyphBits[1] << 8;
if (width > 16)
{
rowbits |= glyphBits[2] << 16;
if (width > 24)
rowbits |= glyphBits[3] << 24;
}
}
for (i = 0; i < width; i++)
{
putchar(rowbits & 1 ? '*' : ' ');
rowbits >>= 1;
}
puts("");
glyphBits += glyphSpan;
}
}
void load_dazzledraw_file(char *filename)
{
FILE *fp;
uint8_t *fontdef;
int fontdefsize, c, i, s;
char msg[] = "Hello, world";
if ((fp = fopen(filename, "rb")))
{
fontdef = malloc(65536);
fontdefsize = fread(fontdef, 1, 65536, fp);
fclose(fp);
}
else
die("Unable to open DazzleDraw font file");
locTable = (int16_t *)fontdef;
for (c = 32; c < 127; c++)
{
i = locTable[c] - 0x1000 + 0x100;
printf("%c[%3d]: $%04X - $%04X (%d)\n", c, c, i, locTable[c + 1] - 1, locTable[c + 1] - locTable[c]);
printf("\t$%02X, %d, %d [%d]\n", fontdef[i], fontdef[i + 1], fontdef[i + 2], (fontdef[i] & 0x0F) * fontdef[i + 1] + 3);
dispGlyph(fontdef + i + 4, fontdef[i + 1], fontdef[i + 2], fontdef[i] & 0x0F);
}
}
int main(int argc, char **argv)
{
char *dd_file, *font_file;
int glyph_width, glyph_height;
int i;
font_file = NULL;
if (argc > 1)
{
dd_file = argv[1];
if (argc > 2)
font_file = argv[2];
if (argc > 3)
glyph_width = atoi(argv[3]);
else
glyph_width = FONT_WIDTH;
if (argc > 4)
glyph_height = atoi(argv[4]);
else
glyph_height = FONT_HEIGHT;
}
else
die( "Missing font file");
/*
* Bit/color reversal
*/
for (i = 0; i < 256; i++)
{
bitReverse[i] = ((i & 0x01) << 7)
| ((i & 0x02) << 5)
| ((i & 0x04) << 3)
| ((i & 0x08) << 1)
| ((i & 0x10) >> 1)
| ((i & 0x20) >> 3)
| ((i & 0x40) >> 5)
| ((i & 0x80) >> 7);
clrSwap[i] = clrRot[i & 0x0F]
| (clrRot[i >> 4] << 4);
}
/*
* Load IIGS font file header.
*/
load_dazzledraw_file(dd_file);
//write_font_file(font_file, "DazzleDraw");
return 0;
}

View File

@@ -1,148 +0,0 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags restxt1|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages
const PAUSE = 1
const HEIGHT_X2 = 2
char[64] greasyfile = ""
byte[40*96/2] frame
byte flags
byte frameHeight = 40
var arg
def greasy2dcgr(pGreasy)#0
byte i, j, cl, ch
var pPixmap
pPixmap = @frame
for j = 0 to frameHeight-1 step 2
for i = 0 to 39 step 2
cl = ^(pGreasy + i)
ch = ^(pGreasy + i + 1)
^(pPixmap + i / 2) = (cl & $0F) | (ch << 4)
if flags & HEIGHT_X2
^(pPixmap + i / 2 + 20) = (cl & $0F) | (ch << 4)
^(pPixmap + i / 2 + 40) = (cl >> 4) | (ch & $F0)
^(pPixmap + i / 2 + 60) = (cl >> 4) | (ch & $F0)
else
^(pPixmap + i / 2 + 20) = (cl >> 4) | (ch & $F0)
fin
next
if flags & HEIGHT_X2
pPixmap = pPixmap + 80
else
pPixmap = pPixmap + 40
fin
pGreasy = pGreasy + 40
next
end
def greasyRead(filestr, frame)#1
var sprptr, sprsize
byte refnum, numframes
sprptr = 0
refnum = fileio:open(filestr)
if refnum
sprsize = 40 * frameHeight / 2
sprptr = heapalloc(sprsize)
if sprptr and fileio:read(refnum, @numframes, 1)
if numframes < frame
heaprelease(sprptr)
sprptr = NULL
fin
fin
if sprptr
if fileio:setmark(refnum, (frame - 1) * sprsize + 1, 0)
heaprelease(sprptr)
sprptr = NULL
elsif fileio:read(refnum, sprptr, sprsize) <> sprsize
heaprelease(sprptr)
sprptr = NULL
fin
fin
fileio:close(refnum)
fin
return sprptr
end
def importGreasy#0
var grptr
byte screennum, framenum, i, j, numrows
char[64] screenfile
screennum = 1
framenum = 1
dhgrMode(DHGR_COLOR_MODE)
numrows = 192 / frameHeight
if flags & HEIGHT_X2
numrows = numrows / 2
fin
numrows--
while framenum
dcgrColor(CLR_GREY1)
dhgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
for j = 0 to numrows
for i = 0 to 2
grptr = greasyRead(@greasyfile, framenum)
if grptr
greasy2dcgr(grptr)
heaprelease(grptr)
if flags & HEIGHT_X2
dcgrPixMap(i*42+8, j*(frameHeight+1)*2+2, 40, frameHeight*2, @frame)
else
dcgrPixMap(i*42+8, j*(frameHeight+2)+2, 40, frameHeight, @frame)
fin
framenum++
else
framenum = 0
break
fin
next
if framenum == 0; break; fin
next
strcpy(@screenfile, @greasyfile)
strcat(@screenfile, ".SCR")
screenfile++
screenfile[screenfile] = '0' + screennum
screennum++
if screenWrite(@screenfile)
dhgrMode(DHGR_TEXT_MODE)
puts("Error writing: "); puts(@screenfile); putln
return
fin
if flags & PAUSE; getc; fin
loop
dhgrMode(DHGR_TEXT_MODE)
end
arg = argNext(argFirst)
if ^arg
while arg and ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'P'
flags = flags | PAUSE
break
is '2'
flags = flags | HEIGHT_X2
break
is 'T'
frameHeight = 48
break
wend
arg = argNext(arg)
loop
if ^arg
strcpy(@greasyfile, arg)
importGreasy
return 0
fin
fin
puts("Usage: DHGRGREASY [-P] [-2] [-T] FRAMEFILE\n")
done

Some files were not shown because too many files have changed in this diff Show More