diff --git a/27c512 mod original docs/.DS_Store b/27c512 mod original docs/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/27c512 mod original docs/.DS_Store differ diff --git a/27c512 mod original docs/CO.512.SuperBrain_Board AppleSoftInteger.BIN b/27c512 mod original docs/CO.512.SuperBrain_Board AppleSoftInteger.BIN new file mode 100644 index 0000000..b695fa2 Binary files /dev/null and b/27c512 mod original docs/CO.512.SuperBrain_Board AppleSoftInteger.BIN differ diff --git a/27c512 mod original docs/Combined.BIN b/27c512 mod original docs/Combined.BIN new file mode 100644 index 0000000..b695fa2 Binary files /dev/null and b/27c512 mod original docs/Combined.BIN differ diff --git a/27c512 mod original docs/High.BIN b/27c512 mod original docs/High.BIN new file mode 100644 index 0000000..18599cf Binary files /dev/null and b/27c512 mod original docs/High.BIN differ diff --git a/27c512 mod original docs/Low.BIN b/27c512 mod original docs/Low.BIN new file mode 100644 index 0000000..d13a083 Binary files /dev/null and b/27c512 mod original docs/Low.BIN differ diff --git a/27c512 mod original docs/RIkN1pKg.jpeg b/27c512 mod original docs/RIkN1pKg.jpeg new file mode 100644 index 0000000..0a9681d Binary files /dev/null and b/27c512 mod original docs/RIkN1pKg.jpeg differ diff --git a/27c512 mod original docs/bCC7Tqfg.jpeg b/27c512 mod original docs/bCC7Tqfg.jpeg new file mode 100644 index 0000000..3111233 Binary files /dev/null and b/27c512 mod original docs/bCC7Tqfg.jpeg differ diff --git a/27c512 mod original docs/ruMNci0g.jpeg b/27c512 mod original docs/ruMNci0g.jpeg new file mode 100644 index 0000000..f8917de Binary files /dev/null and b/27c512 mod original docs/ruMNci0g.jpeg differ diff --git a/Forum Pack/Beta_4_gerbers.zip b/Forum Pack/Beta_4_gerbers.zip new file mode 100644 index 0000000..47e6a94 Binary files /dev/null and b/Forum Pack/Beta_4_gerbers.zip differ diff --git a/Forum Pack/BrainBoard_512_Beta_4.zip b/Forum Pack/BrainBoard_512_Beta_4.zip new file mode 100644 index 0000000..4f6fc96 Binary files /dev/null and b/Forum Pack/BrainBoard_512_Beta_4.zip differ diff --git a/Forum Pack/CO.512.SuperBrain_Board AppleSoftInteger.BIN b/Forum Pack/CO.512.SuperBrain_Board AppleSoftInteger.BIN new file mode 100644 index 0000000..b695fa2 Binary files /dev/null and b/Forum Pack/CO.512.SuperBrain_Board AppleSoftInteger.BIN differ diff --git a/Source and Serial Driver/.DS_Store b/Source and Serial Driver/.DS_Store new file mode 100644 index 0000000..aab49b9 Binary files /dev/null and b/Source and Serial Driver/.DS_Store differ diff --git a/Source and Serial Driver/a2a1emulv5_1/COPYING.txt b/Source and Serial Driver/a2a1emulv5_1/COPYING.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/Source and Serial Driver/a2a1emulv5_1/COPYING.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/Source and Serial Driver/a2a1emulv5_1/a1basic-universal.asm b/Source and Serial Driver/a2a1emulv5_1/a1basic-universal.asm new file mode 100755 index 0000000..9b404d1 --- /dev/null +++ b/Source and Serial Driver/a2a1emulv5_1/a1basic-universal.asm @@ -0,0 +1,2249 @@ + PROCESSOR 6502 + LIST ON +; +;------------------------------------------------------------------------ +; Apple 1 Basic by Steve Wozniak +; +; This source was derived from BASIC disassembly done by Eric Smith. +; This derivation is reproduced and distributed with permission of +; Eric Smith +; +; Eric Smith's disassembly can be found at +; http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ +; +; Do not reproduce or distribute without permission +; +; copyright 2010, Mike Willegal +; copyright 2003, Eric Smith +; +;------------------------------------------------------------------------ +; Disassembly of Apple 1 BASIC +; 17-Sep-2003 +; Apple 1 BASIC was written by Steve Wozniak +; This disassembly is copyright 2003 Eric Smith +; http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ +;------------------------------------------------------------------------ + +;------------------------------------------------------------------------ +; build with 6502 assembler called DASM using the following command line +; +; Huston's version of Basic (may be latest version available) +; http://www.apple1notes.com/Home/Programs.html +;./dasm a1basic.asm -DHUSTNBASIC=0 -oa1hbas.o -la1hbas.lst +; +; Sander's version of Basic (same as Eric Smith's original disassembly) +; http://www.apple1notes.com/Home/Programs.html +;./dasm a1basic.asm -DSNDERBASIC=0 -oa1sbas.o -la1sbas.lst +; +; Vince Briel's version of Basic +; (can't find the link right now) +;./dasm a1basic.asm -DBRIELBASIC=0 -oa1bbas.o -la1bbas.lst +; +; Pagetable version of Basic (only PIA address different from Briel's version) +; http://www.pagetable.com/?p=32 +;./dasm a1basic.asm -DPAGETBASIC=0 -oa1pbas.o -la1pbas.lst +; +;------------------------------------------------------------------------ +;------------------------------------------------------------------------- +; Defines - this code can be built one of four ways +; 1. clone/real Apple 1 HW +; 2. runs in ram of real or virtual Apple 2 +; 3. runs in virtual apple 2 as ROM +; 4. runs in plug in board of real Apple 2 +; +; select one of these three options +;------------------------------------------------------------------------- + +;BLD4APPLE1 EQU 0 ;ACTUAL APPLE 1 or CLONE +;BLD4RAM EQU 0 ;RAM of virtual or real A2 +;BLD4EMULROM EQU 0 ;ROM of virtual A2 +;BLD4ROMBD EQU 0 ;ROM board in Real A2 + + +;------------------------------------------------------------------------ +; BASIC source taken from http://www.brouhaha.com +; IFCONST added to allow building Apple 1 basic version found +; on Vince Briels site +;------------------------------------------------------------------------ +; up to four versions of Apple 1 Basic Known +; use defines to control which one we build +;SNDERBASIC EQU 0 ;from Wendell Sander's site (DEFAULT) +;SMITHBASIC EQU 0 ;original source from brouhaha.com +;BRIELBASIC EQU 0 ;version used in Replica 1 +;HUSTNBASIC EQU 0 ;huston version from Wendell's site + + +;------------------------------------------------------------------------ +; Disassembly of Apple 1 BASIC +; 17-Sep-2003 +; Apple 1 BASIC was written by Steve Wozniak +; This disassembly is copyright 2003 Eric Smith +; http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ +;------------------------------------------------------------------------ + +LOCZERO EQU $00 +Z1d EQU $1d +ch EQU $24 +cv EQU $25 +zp48 EQU $48 +zp49 EQU $49 +lomem EQU $4a +zp4b EQU $4b +himem EQU $4c +zp4d EQU $4d +rnd EQU $4e +noun_stk_l EQU $50 +syn_stk_h EQU $58 +zp60 EQU $60 +noun_stk_h_str EQU $78 +syn_stk_l EQU $80 +zp85 EQU $85 +noun_stk_h_int EQU $a0 +txtndxstk EQU $a8 +text_index EQU $c8 +leadbl EQU $c9 +pp EQU $ca +zpcb EQU $cb +pv EQU $cc +acc EQU $ce +zpcf EQU $cf +srch EQU $d0 +tokndxstk EQU $d1 +srch2 EQU $d2 +if_flag EQU $d4 +cr_flag EQU $d5 +current_verb EQU $d6 +precedence EQU $d7 +x_save EQU $d8 +run_flag EQU $d9 +aux EQU $da +pline EQU $dc +pverb EQU $e0 +p1 EQU $e2 +p2 EQU $e4 +p3 EQU $e6 +token_index EQU $f1 +pcon EQU $f2 +auto_inc EQU $f4 +auto_ln EQU $f6 +auto_flag EQU $f8 +char EQU $f9 +leadzr EQU $fa +for_nest_count EQU $fb +gosub_nest_count EQU $fc +synstkdx EQU $fd +synpag EQU $fe +gstk_pverbl EQU $0100 +gstk_pverbh EQU $0108 +gstk_plinel EQU $0110 +gstk_plineh EQU $0118 +fstk_varl EQU $0120 +fstk_varh EQU $0128 +fstk_stepl EQU $0130 +fstk_steph EQU $0138 +fstk_plinel EQU $0140 +fstk_plineh EQU $0148 +fstk_pverbl EQU $0150 +fstk_pverbh EQU $0158 +fstk_tol EQU $0160 +fstk_toh EQU $0168 +buffer EQU $0200 + + IFCONST BLD4APPLE1 + IFCONST SMITHBASIC +DSP EQU $D0F2 ;DISPLAY port in PIA +KBDCR EQU $D0F1 ;Keyboard control port +KBD EQU $D0F0 ;KEYBOARD data port + ENDIF + IFCONST BRIELBASIC +DSP EQU $D012 ;DISPLAY port in PIA +KBDCR EQU $D011 ;Keyboard control port (WS BASIC) +KBD EQU $D010 ;KEYBOARD data port + ENDIF + IFCONST SNDERBASIC +DSP EQU $D0F2 ;DISPLAY port in PIA +KBDCR EQU $D011 ;Keyboard control port (WS BASIC) +KBD EQU $D010 ;KEYBOARD data port + ENDIF + IFCONST HUSTNBASIC +DSP EQU $D0F2 ;DISPLAY port in PIA +KBDCR EQU $D011 ;Keyboard control port (WS BASIC) +KBD EQU $D010 ;KEYBOARD data port + ENDIF + + ENDIF + IFCONST BLD4RAM + ORG $7000 + ELSE + ORG $E000 + ENDIF + +Pe000: JMP cold + +rdkey: + IFCONST BLD4APPLE1 + LDA KBDCR ;Wait for key press + BPL rdkey ;No key yet! + LDA KBD ;Clear strobe + ELSE + JSR A2GETCHAR + NOP + NOP + NOP + NOP + NOP + ENDIF + RTS + +Se00c: TXA + AND #$20 ; 32 + BEQ Le034 + +Se011: LDA #$a0 ; 160 + STA p2 + JMP cout + +Se018: LDA #$20 ; 32 + +Se01a: CMP ch + BCS nextbyte + LDA #$8d ; 141 . + LDY #$07 ; 7 . +Le022: JSR cout + LDA #$a0 ; 160 + DEY + BNE Le022 + +nextbyte: LDY #$00 ; 0 . + LDA (p1),Y + INC p1 + BNE Le034 + INC p1+1 +Le034: RTS + +list_comman: JSR get16bit + JSR find_line2 +Le03b: LDA p1 + CMP p3 + LDA p1+1 + SBC p3+1 + BCS Le034 + JSR list_line + JMP Le03b + +list_all: LDA pp + STA p1 + LDA pp+1 + STA p1+1 + LDA himem + STA p3 + LDA himem+1 + STA p3+1 + BNE Le03b + +list_cmd: JSR get16bit + JSR find_line + LDA p2 + STA p1 + LDA p2+1 + STA p1+1 + BCS Le034 + +list_line: STX x_save + LDA #$a0 ; 160 + STA leadzr + JSR nextbyte + TYA +list_int: STA p2 + JSR nextbyte + TAX + JSR nextbyte + JSR prdec +Le083: JSR Se018 + STY leadzr + TAX + BPL list_token + ASL + BPL list_int + LDA p2 + BNE Le095 + JSR Se011 +Le095: TXA +Le096: JSR cout +Le099: LDA #$25 ; 37 % + JSR Se01a + TAX + BMI Le096 + STA p2 +list_token: CMP #$01 ; 1 . + BNE Le0ac + LDX x_save + JMP crout +Le0ac: PHA + STY acc + LDX #[syntabl2>>8] ; $ED, when from ROM, $AD from RAM + STX acc+1 + CMP #$51 ; 81 Q + BCC Le0bb + DEC acc+1 + SBC #$50 ; 80 P +Le0bb: PHA + LDA (acc),Y +Le0be: TAX + DEY + LDA (acc),Y + BPL Le0be + CPX #$c0 ; 192 @ + BCS Le0cc + CPX #$00 ; 0 . + BMI Le0be +Le0cc: TAX + PLA + SBC #$01 ; 1 . + BNE Le0bb + BIT p2 + BMI Le0d9 + JSR Seff8 +Le0d9: LDA (acc),Y + BPL Le0ed + TAX + AND #$3f ; 63 ? + STA p2 + CLC + ADC #$a0 ; 160 + JSR cout + DEY + CPX #$c0 ; 192 @ + BCC Le0d9 +Le0ed: JSR Se00c + PLA + CMP #$5d ; 93 ] + BEQ Le099 + CMP #$28 ; 40 ( + BNE Le083 + BEQ Le099 + +paren_substr: JSR Se118 + STA noun_stk_l,X + CMP noun_stk_h_str,X +Le102: BCC Le115 +string_err: LDY #$2b ; 43 + +go_errmess_1: JMP print_err_msg + +comma_substr: JSR getbyte + CMP noun_stk_l,X + BCC string_err + JSR Sefe4 + STA noun_stk_h_str,X +Le115: JMP left_paren + +Se118: JSR getbyte + BEQ string_err + SEC + SBC #$01 ; 1 . + RTS + +str_arr_dest: JSR Se118 + STA noun_stk_l,X + CLC + SBC noun_stk_h_str,X + JMP Le102 +Le12c: LDY #$14 ; 20 . + BNE go_errmess_1 + +dim_str: JSR Se118 + INX +Le134: LDA noun_stk_l,X + STA aux + ADC acc + PHA + TAY + LDA noun_stk_h_str,X + STA aux+1 + ADC acc+1 + PHA + CPY pp + SBC pp+1 + BCS Le12c + LDA aux + ADC #$fe ; 254 ~ + STA aux + LDA #$ff ; 255 . + TAY + ADC aux+1 + STA aux+1 +Le156: INY + LDA (aux),Y + CMP pv,Y + BNE Le16d + TYA + BEQ Le156 +Le161: PLA + STA (aux),Y + STA pv,Y + DEY + BPL Le161 + INX + RTS + NOP ; "j" +Le16d: LDY #$80 ; 128 . +Le16f: BNE go_errmess_1 + +input_str: LDA #$00 ; 0 . + JSR push_a_noun_stk + LDY #$02 ; 2 . + STY noun_stk_h_str,X + JSR push_a_noun_stk + LDA #$bf ; 191 ? + JSR cout + LDY #$00 ; 0 . + JSR read_line + STY noun_stk_h_str,X + NOP + NOP + NOP + +string_lit: LDA noun_stk_l+1,X + STA acc + LDA noun_stk_h_str+1,X + STA acc+1 + INX + INX + JSR Se1bc +Le199: LDA rnd,X + CMP syn_stk_h+30,X + BCS Le1b4 + INC rnd,X + TAY + LDA (acc),Y + LDY noun_stk_l,X + CPY p2 + BCC Le1ae + LDY #$83 ; 131 . + BNE Le16f +Le1ae: STA (aux),Y + INC noun_stk_l,X + BCC Le199 +Le1b4: LDY noun_stk_l,X + TXA + STA (aux),Y + INX + INX + RTS + +Se1bc: LDA noun_stk_l+1,X + STA aux + SEC + SBC #$02 ; 2 . + STA p2 + LDA noun_stk_h_str+1,X + STA aux+1 + SBC #$00 ; 0 . + STA p2+1 + LDY #$00 ; 0 . + LDA (p2),Y + CLC + SBC aux + STA p2 + RTS + +string_eq: LDA noun_stk_l+3,X + STA acc + LDA noun_stk_h_str+3,X + STA acc+1 + LDA noun_stk_l+1,X + STA aux + LDA noun_stk_h_str+1,X + STA aux+1 + INX + INX + INX + LDY #$00 ; 0 . + STY noun_stk_h_str,X + STY noun_stk_h_int,X + INY + STY noun_stk_l,X +Le1f3: LDA himem+1,X + CMP syn_stk_h+29,X + PHP + PHA + LDA rnd+1,X + CMP syn_stk_h+31,X + BCC Le206 + PLA + PLP + BCS Le205 +Le203: LSR noun_stk_l,X +Le205: RTS +Le206: TAY + LDA (acc),Y + STA p2 + PLA + TAY + PLP + BCS Le203 + LDA (aux),Y + CMP p2 + BNE Le203 + INC rnd+1,X + INC himem+1,X + BCS Le1f3 + +string_neq: JSR string_eq + JMP not_op + +mult_op: JSR Se254 +Le225: ASL acc + ROL acc+1 + BCC Le238 + CLC + LDA p3 + ADC aux + STA p3 + LDA p3+1 + ADC aux+1 + STA p3+1 +Le238: DEY + BEQ Le244 + ASL p3 + ROL p3+1 + BPL Le225 + JMP Le77e +Le244: LDA p3 + JSR push_ya_noun_stk + LDA p3+1 + STA noun_stk_h_int,X + ASL p2+1 + BCC Le279 + JMP negate + +Se254: LDA #$55 ; 85 U + STA p2+1 + JSR Se25b + +Se25b: LDA acc + STA aux + LDA acc+1 + STA aux+1 + JSR get16bit + STY p3 + STY p3+1 + LDA acc+1 + BPL Le277 + DEX + ASL p2+1 + JSR negate + JSR get16bit +Le277: LDY #$10 ; 16 . +Le279: RTS + +mod_op: JSR See6c + BEQ Le244 + DC.B $ff ; "." +Le280: CMP #$84 ; 132 . + BNE Le286 + LSR auto_flag +Le286: CMP #$df ; 223 _ + BEQ Le29b + CMP #$9b ; 155 . + BEQ Le294 + STA buffer,Y + INY + BPL read_line +Le294: LDY #$8b ; 139 . + JSR Se3c4 + +Se299: LDY #$01 ; 1 . +Le29b: DEY + BMI Le294 + +read_line: JSR rdkey + NOP + NOP + JSR cout + CMP #$8d ; 141 . + BNE Le280 + LDA #$df ; 223 _ + STA buffer,Y + RTS +cold: JSR mem_init_4k +warm: JSR crout +Le2b6: LSR run_flag + LDA #$be ; 190 > + JSR cout + LDY #$00 ; 0 . + STY leadzr + BIT auto_flag + BPL Le2d1 + LDX auto_ln + LDA auto_ln+1 + JSR prdec + LDA #$a0 ; 160 + JSR cout +Le2d1: LDX #$ff ; 255 . + TXS + JSR read_line + STY token_index + TXA + STA text_index + LDX #$20 ; 32 + JSR Se491 + LDA text_index + ADC #$00 ; 0 . + STA pverb + LDA #$00 ; 0 . + TAX + ADC #$02 ; 2 . + STA pverb+1 + LDA (pverb,X) + AND #$f0 ; 240 p + CMP #$b0 ; 176 0 + BEQ Le2f9 + JMP Le883 +Le2f9: LDY #$02 ; 2 . +Le2fb: LDA (pverb),Y + STA pv+1,Y + DEY + BNE Le2fb + JSR Se38a + LDA token_index + SBC text_index + CMP #$04 ; 4 . + BEQ Le2b6 + STA (pverb),Y + LDA pp + SBC (pverb),Y + STA p2 + LDA pp+1 + SBC #$00 ; 0 . + STA p2+1 + LDA p2 + CMP pv + LDA p2+1 + SBC pv+1 + BCC Le36b +Le326: LDA pp + SBC (pverb),Y + STA p3 + LDA pp+1 + SBC #$00 ; 0 . + STA p3+1 + LDA (pp),Y + STA (p3),Y + INC pp + BNE Le33c + INC pp+1 +Le33c: LDA p1 + CMP pp + LDA p1+1 + SBC pp+1 + BCS Le326 +Le346: LDA p2,X + STA pp,X + DEX + BPL Le346 + LDA (pverb),Y + TAY +Le350: DEY + LDA (pverb),Y + STA (p3),Y + TYA + BNE Le350 + BIT auto_flag + BPL Le365 +Le35c: LDA auto_ln+1,X + ADC auto_inc+1,X + STA auto_ln+1,X + INX + BEQ Le35c +Le365: BPL Le3e5 + BRK + BRK + BRK + BRK ; "..." +Le36b: LDY #$14 ; 20 . + BNE print_err_msg + +del_comma: JSR get16bit + LDA p1 + STA p3 + LDA p1+1 + STA p3+1 + JSR find_line1 + LDA p1 + STA p2 + LDA p1+1 + STA p2+1 + BNE Le395 + +del_cmd: JSR get16bit + +Se38a: JSR find_line + LDA p3 + STA p1 + LDA p3+1 + STA p1+1 +Le395: LDY #$00 ; 0 . +Le397: LDA pp + CMP p2 + LDA pp+1 + SBC p2+1 + BCS Le3b7 + LDA p2 + BNE Le3a7 + DEC p2+1 +Le3a7: DEC p2 + LDA p3 + BNE Le3af + DEC p3+1 +Le3af: DEC p3 + LDA (p2),Y + STA (p3),Y + BCC Le397 +Le3b7: LDA p3 + STA pp + LDA p3+1 + STA pp+1 + RTS +Le3c0: JSR cout + INY + +Se3c4: LDA error_msg_tbl,Y + BMI Le3c0 + +cout: CMP #$8d ; 141 . + BNE Le3d3 + +crout: LDA #$00 ; 0 . + STA ch + LDA #$8d ; 141 . +Le3d3: INC ch +Le3d5: + IFCONST BLD4APPLE1 + BIT DSP + BMI Le3d5 + STA DSP + ELSE + JSR ECHO ; use monitor function to output + nop + nop + nop + nop + nop + ENDIF + + RTS +too_long_err: LDY #$06 ; 6 +print_err_msg: JSR print_err_msg2 + BIT run_flag +Le3e5: BMI Le3ea + JMP Le2b6 +Le3ea: JMP Leb9a +Le3ed: ROL + ADC #$a0 ; 160 + CMP buffer,X + BNE Le448 + LDA (synpag),Y + ASL + BMI Le400 + DEY + LDA (synpag),Y + BMI Le428 + INY +Le400: STX text_index + TYA + PHA + LDX #$00 ; 0 . + LDA (synpag,X) + TAX +Le409: LSR + EOR #$48 ; 72 H + ORA (synpag),Y + CMP #$c0 ; 192 @ + BCC Le413 + INX +Le413: INY + BNE Le409 + PLA + TAY + TXA + JMP Le4c0 + +put_token: INC token_index + LDX token_index + BEQ too_long_err + STA buffer,X +Le425: RTS +Le426: LDX text_index +Le428: LDA #$a0 ; 160 +Le42a: INX + CMP buffer,X + BCS Le42a + LDA (synpag),Y + AND #$3f ; 63 ? + LSR + BNE Le3ed + LDA buffer,X + BCS Le442 + ADC #$3f ; 63 ? + CMP #$1a ; 26 . + BCC Le4b1 +Le442: ADC #$4f ; 79 O + CMP #$0a ; 10 . + BCC Le4b1 +Le448: LDX synstkdx +Le44a: INY + LDA (synpag),Y + AND #$e0 ; 224 ` + CMP #$20 ; 32 + BEQ Le4cd + LDA txtndxstk,X + STA text_index + LDA tokndxstk,X + STA token_index +Le45b: DEY + LDA (synpag),Y + ASL + BPL Le45b + DEY + BCS Le49c + ASL + BMI Le49c + LDY syn_stk_h,X + STY synpag+1 + LDY syn_stk_l,X + INX + BPL Le44a +Le470: BEQ Le425 + CMP #$7e ; 126 ~ + BCS Le498 + DEX + BPL Le47d + LDY #$06 ; 6 . + BPL go_errmess_2 +Le47d: STY syn_stk_l,X + LDY synpag+1 + STY syn_stk_h,X + LDY text_index + STY txtndxstk,X + LDY token_index + STY tokndxstk,X + AND #$1f ; 31 . + TAY + LDA syntabl_index,Y + +Se491: ASL + TAY +; when running from a000, shifts to AC or AD +; when running from e000 shifts to EC or ED + LDA #[syntabl_index>>9] + ROL + STA synpag+1 +Le498: BNE Le49b + INY +Le49b: INY +Le49c: STX synstkdx + LDA (synpag),Y + BMI Le426 + BNE Le4a9 + LDY #$0e ; 14 . +go_errmess_2: JMP print_err_msg +Le4a9: CMP #$03 ; 3 . + BCS Le470 + LSR + LDX text_index + INX +Le4b1: LDA buffer,X + BCC Le4ba + CMP #$a2 ; 162 " + BEQ Le4c4 +Le4ba: CMP #$df ; 223 _ + BEQ Le4c4 + STX text_index +Le4c0: JSR put_token + INY +Le4c4: DEY + LDX synstkdx +Le4c7: LDA (synpag),Y + DEY + ASL + BPL Le49c +Le4cd: LDY syn_stk_h,X + STY synpag+1 + LDY syn_stk_l,X + INX + LDA (synpag),Y + AND #$9f ; 159 . + BNE Le4c7 + STA pcon + STA pcon+1 + TYA + PHA + STX synstkdx + LDY srch,X + STY leadbl + CLC +Le4e7: LDA #$0a ; 10 . + STA char + LDX #$00 ; 0 . + INY + LDA buffer,Y + AND #$0f ; 15 . +Le4f3: ADC pcon + PHA + TXA + ADC pcon+1 + BMI Le517 + TAX + PLA + DEC char + BNE Le4f3 + STA pcon + STX pcon+1 + CPY token_index + BNE Le4e7 + LDY leadbl + INY + STY token_index + JSR put_token + PLA + TAY + LDA pcon+1 + BCS Le4c0 +Le517: LDY #$00 ; 0 . + BPL go_errmess_2 + +prdec: STA pcon+1 + STX pcon + LDX #$04 ; 4 . + STX leadbl +Le523: LDA #$b0 ; 176 0 + STA char +Le527: LDA pcon + CMP dectabl,X + LDA pcon+1 + SBC dectabh,X + BCC Le540 + STA pcon+1 + LDA pcon + SBC dectabl,X + STA pcon + INC char + BNE Le527 +Le540: LDA char + INX + DEX + BEQ Le554 + CMP #$b0 ; 176 0 + BEQ Le54c + STA leadbl +Le54c: BIT leadbl + BMI Le554 + LDA leadzr + BEQ Le55f +Le554: JSR cout + BIT auto_flag + BPL Le55f + STA buffer,Y + INY +Le55f: DEX + BPL Le523 + RTS +dectabl: DC.B $01,$0a,$64,$e8,$10 ; "..dh." +dectabh: DC.B $00,$00,$00,$03,$27 ; "....'" + +find_line: LDA pp + STA p3 + LDA pp+1 + STA p3+1 + +find_line1: INX + +find_line2: LDA p3+1 + STA p2+1 + LDA p3 + STA p2 + CMP himem + LDA p2+1 + SBC himem+1 + BCS Le5ac + LDY #$01 ; 1 . + LDA (p2),Y + SBC acc + INY + LDA (p2),Y + SBC acc+1 + BCS Le5ac + LDY #$00 ; 0 . + LDA p3 + ADC (p2),Y + STA p3 + BCC Le5a0 + INC p3+1 + CLC +Le5a0: INY + LDA acc + SBC (p2),Y + INY + LDA acc+1 + SBC (p2),Y + BCS find_line2 +Le5ac: RTS + +new_cmd: LSR auto_flag + LDA himem + STA pp + LDA himem+1 + STA pp+1 + +clr: LDA lomem + STA pv + LDA lomem+1 + STA pv+1 + LDA #$00 ; 0 . + STA for_nest_count + STA gosub_nest_count + STA synpag + LDA #$00 ; 0 . + STA Z1d + RTS +Le5cc: LDA srch + ADC #$05 ; 5 . + STA srch2 + LDA tokndxstk + ADC #$00 ; 0 . + STA srch2+1 + LDA srch2 + CMP pp + LDA srch2+1 + SBC pp+1 + BCC Le5e5 + JMP Le36b +Le5e5: LDA acc + STA (srch),Y + LDA acc+1 + INY + STA (srch),Y + LDA srch2 + INY + STA (srch),Y + LDA srch2+1 + INY + STA (srch),Y + LDA #$00 ; 0 . + INY + STA (srch),Y + INY + STA (srch),Y + LDA srch2 + STA pv + LDA srch2+1 + STA pv+1 + LDA srch + BCC Le64f +execute_var: STA acc + STY acc+1 + JSR get_next_prog_byte + BMI Le623 + CMP #$40 ; 64 @ + BEQ Le623 + JMP Le628 + DC.B $06,$c9,$49,$d0,$07,$a9,$49 ; ".IIP.)I" +Le623: STA acc+1 + JSR get_next_prog_byte +Le628: LDA lomem+1 + STA tokndxstk + LDA lomem +Le62e: STA srch + CMP pv + LDA tokndxstk + SBC pv+1 + BCS Le5cc + LDA (srch),Y + INY + CMP acc + BNE Le645 + LDA (srch),Y + CMP acc+1 + BEQ Le653 +Le645: INY + LDA (srch),Y + PHA + INY + LDA (srch),Y + STA tokndxstk + PLA +Le64f: LDY #$00 ; 0 . + BEQ Le62e +Le653: LDA srch + ADC #$03 ; 3 . + JSR push_a_noun_stk + LDA tokndxstk + ADC #$00 ; 0 . + STA noun_stk_h_str,X + LDA acc+1 + CMP #$40 ; 64 @ + BNE fetch_prog_byte + DEY + TYA + JSR push_a_noun_stk + DEY + STY noun_stk_h_str,X + LDY #$03 ; 3 . +Le670: INC noun_stk_h_str,X + INY + LDA (srch),Y + BMI Le670 + BPL fetch_prog_byte + +execute_stmt: LDA #$00 ; 0 . + STA if_flag + STA cr_flag + LDX #$20 ; 32 +push_old_verb: PHA +fetch_prog_byte: LDY #$00 ; 0 . + LDA (pverb),Y +Le686: BPL execute_token + ASL + BMI execute_var + JSR get_next_prog_byte + JSR push_ya_noun_stk + JSR get_next_prog_byte + STA noun_stk_h_int,X +Le696: BIT if_flag + BPL Le69b + DEX +Le69b: JSR get_next_prog_byte + BCS Le686 +execute_token: CMP #$28 ; 40 ( + BNE execute_verb + LDA pverb + JSR push_a_noun_stk + LDA pverb+1 + STA noun_stk_h_str,X + BIT if_flag + BMI Le6bc + LDA #$01 ; 1 . + JSR push_a_noun_stk + LDA #$00 ; 0 . + STA noun_stk_h_str,X +Le6ba: INC noun_stk_h_str,X +Le6bc: JSR get_next_prog_byte + BMI Le6ba + BCS Le696 +execute_verb: BIT if_flag + BPL Le6cd + CMP #$04 ; 4 . + BCS Le69b + LSR if_flag +Le6cd: TAY + STA current_verb + LDA verb_prec_tbl,Y + AND #$55 ; 85 U + ASL + STA precedence +Le6d8: PLA + TAY + LDA verb_prec_tbl,Y + AND #$aa ; 170 * + CMP precedence + BCS do_verb + TYA + PHA + JSR get_next_prog_byte + LDA current_verb + BCC push_old_verb +do_verb: LDA verb_adr_l,Y + STA acc + LDA verb_adr_h,Y + STA acc+1 + JSR Se6fc + JMP Le6d8 + +Se6fc: JMP (acc) + +get_next_prog_byte: INC pverb + BNE Le705 + INC pverb+1 +Le705: LDA (pverb),Y + RTS + +push_ya_noun_stk: STY syn_stk_h+31,X + +push_a_noun_stk: DEX + BMI Le710 + STA noun_stk_l,X + RTS +Le710: LDY #$66 ; 102 f +go_errmess_3: JMP print_err_msg + +get16bit: LDY #$00 ; 0 . + LDA noun_stk_l,X + STA acc + LDA noun_stk_h_int,X + STA acc+1 + LDA noun_stk_h_str,X + BEQ Le731 + STA acc+1 + LDA (acc),Y + PHA + INY + LDA (acc),Y + STA acc+1 + PLA + STA acc + DEY +Le731: INX + RTS + +eq_op: JSR neq_op + +not_op: JSR get16bit + TYA + JSR push_ya_noun_stk + STA noun_stk_h_int,X + CMP acc + BNE Le749 + CMP acc+1 + BNE Le749 + INC noun_stk_l,X +Le749: RTS + +neq_op: JSR subtract + JSR sgn_fn + +abs_fn: JSR get16bit + BIT acc+1 + BMI Se772 +Le757: DEX +Le758: RTS + +sgn_fn: JSR get16bit + LDA acc+1 + BNE Le764 + LDA acc + BEQ Le757 +Le764: LDA #$ff ; 255 . + JSR push_ya_noun_stk + STA noun_stk_h_int,X + BIT acc+1 + BMI Le758 + +negate: JSR get16bit + +Se772: TYA + SEC + SBC acc + JSR push_ya_noun_stk + TYA + SBC acc+1 + BVC Le7a1 +Le77e: LDY #$00 ; 0 . + BPL go_errmess_3 + +subtract: JSR negate + +add: JSR get16bit + LDA acc + STA aux + LDA acc+1 + STA aux+1 + JSR get16bit + +Se793: CLC + LDA acc + ADC aux + JSR push_ya_noun_stk + LDA acc+1 + ADC aux+1 + BVS Le77e +Le7a1: STA noun_stk_h_int,X + +unary_pos: RTS + +tab_fn: JSR get16bit + LDY acc + BEQ Le7b0 + DEY + LDA acc+1 + BEQ Le7bc +Le7b0: RTS + +tabout: LDA ch + ORA #$07 ; 7 . + TAY + INY +Le7b7: LDA #$a0 ; 160 + JSR cout +Le7bc: CPY ch + BCS Le7b7 + RTS + +print_com_num: JSR tabout + +print_num: JSR get16bit + LDA acc+1 + BPL Le7d5 + LDA #$ad ; 173 - + JSR cout + JSR Se772 + BVC print_num +Le7d5: DEY + STY cr_flag + STX acc+1 + LDX acc + JSR prdec + LDX acc+1 + RTS + +auto_cmd: JSR get16bit + LDA acc + STA auto_ln + LDA acc+1 + STA auto_ln+1 + DEY + STY auto_flag + INY + LDA #$0a ; 10 . +Le7f3: STA auto_inc + STY auto_inc+1 + RTS + +auto_com: JSR get16bit + LDA acc + LDY acc+1 + BPL Le7f3 + +var_assign: JSR get16bit + LDA noun_stk_l,X + STA aux + LDA noun_stk_h_str,X + STA aux+1 + LDA acc + STA (aux),Y + INY + LDA acc+1 + STA (aux),Y + INX + +Te816: RTS + +begin_line: PLA + PLA + +colon: BIT cr_flag + BPL Le822 + +print_cr: JSR crout + +print_semi: LSR cr_flag +Le822: RTS + +left_paren: LDY #$ff ; 255 . + STY precedence + +right_paren: RTS + +if_stmt: JSR Sefcd + BEQ Le834 + LDA #$25 ; 37 % + STA current_verb + DEY + STY if_flag +Le834: INX + RTS +run_warm: LDA pp + LDY pp+1 + BNE Le896 + +gosub_stmt: LDY #$41 ; 65 A + LDA gosub_nest_count + CMP #$08 ; 8 . + BCS go_errmess_4 + TAY + INC gosub_nest_count + LDA pverb + STA gstk_pverbl,Y + LDA pverb+1 + STA gstk_pverbh,Y + LDA pline + STA gstk_plinel,Y + LDA pline+1 + STA gstk_plineh,Y + +goto_stmt: JSR get16bit + JSR find_line + BCC Le867 + LDY #$37 ; 55 7 + BNE go_errmess_4 +Le867: LDA p2 + LDY p2+1 +run_loop: STA pline + STY pline+1 + IFCONST BLD4APPLE1 + BIT KBDCR + ELSE + BIT KBD + ENDIF + BMI Le8c3 + CLC + ADC #$03 ; 3 . + BCC Le87a + INY +Le87a: LDX #$ff ; 255 . + STX run_flag + TXS + STA pverb + STY pverb+1 +Le883: JSR execute_stmt + BIT run_flag + BPL end_stmt + CLC + LDY #$00 ; 0 . + LDA pline + ADC (pline),Y + LDY pline+1 + BCC Le896 + INY +Le896: CMP himem + BNE run_loop + CPY himem+1 + BNE run_loop + LDY #$34 ; 52 4 + LSR run_flag +go_errmess_4: JMP print_err_msg + +return_stmt: LDY #$4a ; 74 J + LDA gosub_nest_count + BEQ go_errmess_4 + DEC gosub_nest_count + TAY + LDA gstk_plinel-1,Y + STA pline + LDA gstk_plineh-1,Y + STA pline+1 + + DC.B $be,$ff,$00 +; LDX synpag+1,Y + + LDA gstk_pverbh-1,Y +Le8be: TAY + TXA + JMP Le87a +Le8c3: LDY #$63 ; 99 c + JSR Se3c4 + LDY #$01 ; 1 . + LDA (pline),Y + TAX + INY + LDA (pline),Y + JSR prdec + +end_stmt: JMP warm +Le8d6: DEC for_nest_count + +next_stmt: LDY #$5b ; 91 [ + LDA for_nest_count +Le8dc: BEQ go_errmess_4 + TAY + LDA noun_stk_l,X + CMP fstk_varl-1,Y + BNE Le8d6 + LDA noun_stk_h_str,X + CMP fstk_varh-1,Y + BNE Le8d6 + LDA fstk_stepl-1,Y + STA aux + LDA fstk_steph-1,Y + STA aux+1 + JSR get16bit + DEX + JSR Se793 + JSR var_assign + DEX + LDY for_nest_count + LDA fstk_toh-1,Y + STA syn_stk_l+31,X + LDA fstk_tol-1,Y + LDY #$00 ; 0 . + JSR push_ya_noun_stk + JSR subtract + JSR sgn_fn + JSR get16bit + LDY for_nest_count + LDA acc + BEQ Le925 + EOR fstk_steph-1,Y + BPL Le937 +Le925: LDA fstk_plinel-1,Y + STA pline + LDA fstk_plineh-1,Y + STA pline+1 + LDX fstk_pverbl-1,Y + LDA fstk_pverbh-1,Y + BNE Le8be +Le937: DEC for_nest_count + RTS + +for_stmt: LDY #$54 ; 84 T + LDA for_nest_count + CMP #$08 ; 8 . + BEQ Le8dc + INC for_nest_count + TAY + LDA noun_stk_l,X + STA fstk_varl,Y + LDA noun_stk_h_str,X + STA fstk_varh,Y + RTS + +to_clause: JSR get16bit + LDY for_nest_count + LDA acc + STA fstk_tol-1,Y + LDA acc+1 + STA fstk_toh-1,Y + LDA #$01 ; 1 . + STA fstk_stepl-1,Y + LDA #$00 ; 0 . +Le966: STA fstk_steph-1,Y + LDA pline + STA fstk_plinel-1,Y + LDA pline+1 + STA fstk_plineh-1,Y + LDA pverb + STA fstk_pverbl-1,Y + LDA pverb+1 + STA fstk_pverbh-1,Y + RTS + +Te97e: JSR get16bit + LDY for_nest_count + LDA acc + STA fstk_stepl-1,Y + LDA acc+1 + JMP Le966 + DC.B $00,$00,$00,$00,$00,$00,$00,$00 ; "........" + DC.B $00,$00,$00 ; "..." +verb_prec_tbl: DC.B $00,$00,$00,$ab,$03,$03,$03,$03 ; "...+...." + DC.B $03,$03,$03,$03,$03,$03,$03,$03 ; "........" + DC.B $03,$03,$3f,$3f,$c0,$c0,$3c,$3c ; "..??@@<<" + DC.B $3c,$3c,$3c,$3c,$3c,$30,$0f,$c0 ; "<<<<<0.@" + IFCONST HUSTNBASIC + DC.B $c3,$ff,$55,$00,$ab,$ab,$03,$03 ; "L.U.++.." + ELSE + DC.B $cc,$ff,$55,$00,$ab,$ab,$03,$03 ; "L.U.++.." + ENDIF + DC.B $ff,$ff,$55,$ff,$ff,$55,$cf,$cf ; "..U..UOO" + DC.B $cf,$cf,$cf,$ff,$55,$c3,$c3,$c3 ; "OOO.UCCC" + DC.B $55,$f0,$f0,$cf,$56,$56,$56,$55 ; "UppOVVVU" + DC.B $ff,$ff,$55,$03,$03,$03,$03,$03 ; "..U....." + DC.B $03,$03,$ff,$ff,$ff,$03,$03,$03 ; "........" + DC.B $03,$03,$03,$03,$03,$03,$03,$03 ; "........" + DC.B $03,$03,$03,$03,$03,$00,$ab,$03 ; "......+." + DC.B $57,$03,$03,$03,$03,$07,$03,$03 ; "W......." + DC.B $03,$03,$03,$03,$03,$03,$03,$03 ; "........" + DC.B $03,$03,$aa,$ff,$ff,$ff,$ff,$ff ; "..*....." + + +verb_adr_l: + DC.B begin_line,$ff,$ff,>colon,>list_cmd,>list_comman,>list_all,>Teff2 + DC.B >Tefec,>del_cmd,>del_comma,>new_cmd,>clr,>auto_cmd,>auto_com,>man_cmd + DC.B >Tef80,>Tef96,>add,> subtract,>mult_op,>divide,>eq_op,>neq_op + DC.B >Tec13,> Tec06,> Tec0b,>neq_op,>Tec01,> Tec40,> Tec47,>mod_op + IFCONST HUSTNBASIC + DC.B >bogus_eea6,$ff,>left_paren,>comma_substr,>goto_stmt,>Te816,>string_input,>input_num_comma + ELSE + DC.B $0,$ff,>left_paren,>comma_substr,>goto_stmt,>Te816,>string_input,>input_num_comma + ENDIF + DC.B $ff,$ff,>paren_substr,$ff,$ff,>num_array_subs,>peek_fn,>rnd_fn + DC.B >sgn_fn,>abs_fn,$00,$ff,>left_paren,>unary_pos,>negate,>not_op + DC.B >left_paren,>string_eq,>string_neq,>len_fn,>bogus_eec2,>Teeae,>Teeba,>left_paren + DC.B $ff,$ff,>str_arr_dest,>dim_str,>dim_num,>print_str,>print_num,>print_semi + DC.B >print_str_comma,>print_com_num,$ff,$ff,$ff,>call_stmt,>dim_str,>dim_num + DC.B >tab_fn,>end_stmt,>string_input,>input_prompt,>input_num_stmt,>for_stmt,>var_assign,>to_clause + DC.B >Te97e,>next_stmt,>next_stmt,>return_stmt,>gosub_stmt,$ff,>Te816,>goto_stmt + DC.B >if_stmt,>print_str,>print_num,>print_cr,>poke_stmt,>Tef0c,>Tee4e,>poke_stmt + DC.B >plot_comma,>poke_stmt,>bogus_eea6,>Teeb0,>poke_stmt,>Teebc,>Teec6,>vtab_stmt + DC.B >string_lit,>var_assign,>right_paren,$ff,$ff,$ff,$ff,$ff +error_msg_tbl: DC.B $be,$b3,$b2,$b7,$b6,$37,$d4,$cf ; ">32767TO" + DC.B $cf,$a0,$cc,$cf,$ce,$47,$d3,$d9 ; "O LONGSY" + DC.B $ce,$d4,$c1,$58,$cd,$c5,$cd,$a0 ; "NTAXMEM " + DC.B $c6,$d5,$cc,$4c,$d4,$cf,$cf,$a0 ; "FULLTOO " + DC.B $cd,$c1,$ce,$d9,$a0,$d0,$c1,$d2 ; "MANY PAR" + DC.B $c5,$ce,$53,$d3,$d4,$d2,$c9,$ce ; "ENSSTRIN" + DC.B $47,$ce,$cf,$a0,$c5,$ce,$44,$c2 ; "GNO ENDB" + DC.B $c1,$c4,$a0,$c2,$d2,$c1,$ce,$c3 ; "AD BRANC" + DC.B $48,$be,$b8,$a0,$c7,$cf,$d3,$d5 ; "H>8 GOSU" + DC.B $c2,$53,$c2,$c1,$c4,$a0,$d2,$c5 ; "BSBAD RE" + DC.B $d4,$d5,$d2,$4e,$be,$b8,$a0,$c6 ; "TURN>8 F" + DC.B $cf,$d2,$53,$c2,$c1,$c4,$a0,$ce ; "ORSBAD N" + DC.B $c5,$d8,$54,$d3,$d4,$cf,$d0,$d0 ; "EXTSTOPP" + DC.B $c5,$c4,$a0,$c1,$d4,$20,$aa,$aa ; "ED AT **" + DC.B $aa,$20,$a0,$c5,$d2,$d2,$0d,$be ; "* ERR.>" + DC.B $b2,$b5,$35,$d2,$c1,$ce,$c7,$45 ; "255RANGE" + DC.B $c4,$c9,$4d,$d3,$d4,$d2,$a0,$cf ; "DIMSTR O" + DC.B $d6,$c6,$4c,$dc,$0d,$d2,$c5,$d4 ; "VFL\.RET" + DC.B $d9,$d0,$c5,$a0,$cc,$c9,$ce,$c5 ; "YPE LINE" + DC.B $8d,$3f ; ".?" +Leb9a: LSR run_flag + BCC Leba1 + JMP Le8c3 +Leba1: LDX acc+1 + TXS + LDX acc + LDY #$8d ; 141 . + BNE Lebac + +input_num_stmt: LDY #$99 ; 153 . +Lebac: JSR Se3c4 + STX acc + TSX + STX acc+1 + LDY #$fe ; 254 ~ + STY run_flag + INY + STY text_index + JSR Se299 + STY token_index + LDX #$20 ; 32 + LDA #$30 ; 48 0 + JSR Se491 + INC run_flag + LDX acc + +input_num_comma: LDY text_index + ASL +Lebce: STA acc + INY + LDA buffer,Y + CMP #$74 ; 116 t + BEQ input_num_stmt + EOR #$b0 ; 176 0 + CMP #$0a ; 10 . + BCS Lebce + INY + INY + STY text_index + LDA buffer,Y + PHA + LDA buffer-1,Y + LDY #$00 ; 0 . + JSR push_ya_noun_stk + PLA + STA noun_stk_h_int,X + LDA acc + CMP #$c7 ; 199 G + BNE Lebfa + JSR negate +Lebfa: JMP var_assign + DC.B $ff,$ff,$ff,$50 ; "...P" + +Tec01: JSR Tec13 + BNE Lec1b + +Tec06: JSR Tec0b + BNE Lec1b + +Tec0b: JSR subtract + JSR negate + BVC Lec16 + +Tec13: JSR subtract +Lec16: JSR sgn_fn + LSR noun_stk_l,X +Lec1b: JMP not_op + DC.B $ff,$ff ; ".." +syntabl_index: DC.B $c1,$ff,$7f,$d1,$cc,$c7,$cf,$ce ; "A..QLGON" + DC.B $c5,$9a,$98,$8b,$96,$95,$93,$bf ; "E......?" + DC.B $b2,$32,$2d,$2b,$bc,$b0,$ac,$be ; "22-+<0,>" + DC.B $35,$8e,$61,$ff,$ff,$ff,$dd,$fb ; "5.a...]{" + +Tec40: JSR Sefc9 + ORA rnd+1,X + BPL Lec4c + +Tec47: JSR Sefc9 + AND rnd+1,X +Lec4c: STA noun_stk_l,X + BPL Lec1b + JMP Sefc9 + DC.B $40,$60,$8d,$60,$8b,$00,$7e,$8c ; "@`.`..~." + DC.B $33,$00,$00,$60,$03,$bf,$12,$00 ; "3..`.?.." + DC.B $40,$89,$c9,$47,$9d,$17,$68,$9d ; "@.IG..h." + DC.B $0a,$00,$40,$60,$8d,$60,$8b,$00 ; "..@`.`.." + DC.B $7e,$8c,$3c,$00,$00,$60,$03,$bf ; "~.<..`.?" + DC.B $1b,$4b,$67,$b4,$a1,$07,$8c,$07 ; ".Kg4!..." + DC.B $ae,$a9,$ac,$a8,$67,$8c,$07,$b4 ; ".),(g..4" + DC.B $af,$ac,$b0,$67,$9d,$b2,$af,$ac ; "/,0g.2/," + DC.B $af,$a3,$67,$8c,$07,$a5,$ab,$af ; "/#g..%+/" + DC.B $b0,$f4,$ae,$a9,$b2,$b0,$7f,$0e ; "0t.)20.." + DC.B $27,$b4,$ae,$a9,$b2,$b0,$7f,$0e ; "'4.)20.." + DC.B $28,$b4,$ae,$a9,$b2,$b0,$64,$07 ; "(4.)20d." + DC.B $a6,$a9,$67,$af,$b4,$af,$a7,$78 ; "&)g/4/'x" + DC.B $b4,$a5,$ac,$78,$7f,$02,$ad,$a5 ; "4%,x..-%" + DC.B $b2,$67,$a2,$b5,$b3,$af,$a7,$ee ; "2g"53/'n" + DC.B $b2,$b5,$b4,$a5,$b2,$7e,$8c,$39 ; "254%2~.9" + DC.B $b4,$b8,$a5,$ae,$67,$b0,$a5,$b4 ; "48%.g0%4" + DC.B $b3,$27,$af,$b4,$07,$9d,$19,$b2 ; "3'/4...2" + DC.B $af,$a6,$7f,$05,$37,$b4,$b5,$b0 ; "/&..7450" + DC.B $ae,$a9,$7f,$05,$28,$b4,$b5,$b0 ; ".)..(450" + DC.B $ae,$a9,$7f,$05,$2a,$b4,$b5,$b0 ; ".)..*450" + DC.B $ae,$a9,$e4,$ae,$a5,$00,$ff,$ff ; ".)d.%..." +syntabl2: DC.B $47,$a2,$a1,$b4,$7f,$0d,$30,$ad ; "G"!4..0-" + DC.B $a9,$a4,$7f,$0d,$23,$ad,$a9,$a4 ; ")$..#-)$" + DC.B $67,$ac,$ac,$a1,$a3,$00,$40,$80 ; "g,,!#.@." + DC.B $c0,$c1,$80,$00,$47,$8c,$68,$8c ; "@A..G.h." + DC.B $db,$67,$9b,$68,$9b,$50,$8c,$63 ; "[g.h.P.c" + DC.B $8c,$7f,$01,$51,$07,$88,$29,$84 ; "...Q..)." + DC.B $80,$c4,$80,$57,$71,$07,$88,$14 ; ".D.Wq..." + DC.B $ed,$a5,$ad,$af,$ac,$ed,$a5,$ad ; "m%-/,m%-" + DC.B $a9,$a8,$f2,$af,$ac,$af,$a3,$71 ; ")(r/,/#q" + DC.B $08,$88,$ae,$a5,$ac,$68,$83,$08 ; "...%,h.." + DC.B $68,$9d,$08,$71,$07,$88,$60,$76 ; "h..q..`v" + DC.B $b4,$af,$ae,$76,$8d,$76,$8b,$51 ; "4/.v.v.Q" + DC.B $07,$88,$19,$b8,$a4,$ae,$b2,$f2 ; "...8$.2r" + DC.B $b3,$b5,$f3,$a2,$a1,$ee,$a7,$b3 ; "35s"!n'3" + DC.B $e4,$ae,$b2,$eb,$a5,$a5,$b0,$51 ; "d.2k%%0Q" + DC.B $07,$88,$39,$81,$c1,$4f,$7f,$0f ; "..9.AO.." + DC.B $2f,$00,$51,$06,$88,$29,$c2,$0c ; "/.Q..)B." + DC.B $82,$57,$8c,$6a,$8c,$42,$ae,$a5 ; ".W.j.B.%" + DC.B $a8,$b4,$60,$ae,$a5,$a8,$b4,$4f ; "(4`.%(4O" + DC.B $7e,$1e,$35,$8c,$27,$51,$07,$88 ; "~.5.'Q.." + DC.B $09,$8b,$fe,$e4,$af,$ad,$f2,$af ; "..~d/-r/" + DC.B $e4,$ae,$a1,$dc,$de,$9c,$dd,$9c ; "d.!\^.]." + DC.B $de,$dd,$9e,$c3,$dd,$cf,$ca,$cd ; "^].C]OJM" + DC.B $cb,$00,$47,$9d,$ad,$a5,$ad,$af ; "K.G.-%-/" + DC.B $ac,$76,$9d,$ad,$a5,$ad,$a9,$a8 ; ",v.-%-)(" + DC.B $e6,$a6,$af,$60,$8c,$20,$af,$b4 ; "f&/`. /4" + DC.B $b5,$a1,$f2,$ac,$a3,$f2,$a3,$b3 ; "5!r,#r#3" + DC.B $60,$8c,$20,$ac,$a5,$a4,$ee,$b5 ; "`. ,%$n5" + DC.B $b2,$60,$ae,$b5,$b2,$f4,$b3,$a9 ; "2`.52t3)" + DC.B $ac,$60,$8c,$20,$b4,$b3,$a9,$ac ; ",`. 43)," + DC.B $7a,$7e,$9a,$22,$20,$00,$60,$03 ; "z~." .`." + DC.B $bf,$60,$03,$bf,$1f ; "?`.?." + +print_str_comma: JSR tabout + +print_str: INX + INX + LDA rnd+1,X + STA aux + LDA syn_stk_h+31,X + STA aux+1 + LDY rnd,X +Lee0f: TYA + CMP syn_stk_h+30,X + BCS Lee1d + LDA (aux),Y + JSR cout + INY + JMP Lee0f +Lee1d: LDA #$ff ; 255 . + STA cr_flag + RTS + +len_fn: INX + LDA #$00 ; 0 . + STA noun_stk_h_str,X + STA noun_stk_h_int,X + LDA syn_stk_h+31,X + SEC + SBC rnd+1,X + STA noun_stk_l,X + JMP left_paren + DC.B $ff ; "." + +getbyte: JSR get16bit + LDA acc+1 + BNE gr_255_err + LDA acc +Tee3d + RTS +plot_comma: + IFCONST HUSTNBASIC + JSR push_ya_noun_stk + STY $a0,X +Tee43 + LDA $D0 + BNE Tee4b + DEC $D1 + BMI Tee3d +Tee4b + DEC $D0 +; LDA $D2 + DC.b $a5 +Tee4e: ;MJW wrong address, so we have to break this instruction + DC.b $d2 + + LDY #$00 + JSR push_ya_noun_stk +man_cmd + LDA $D3 +; STA $A0,X + DC.b $95 +vtab_stmt: + DC.b $a0 + JSR mult_op + JMP Tee43 + ELSE + + JSR getbyte + LDY text_index + CMP #$30 ; 48 0 + BCS range_err + CPY #$28 ; 40 ( + BCS range_err + RTS + NOP + NOP + + +Tee4e: JSR getbyte + RTS + ENDIF +; + IFCONST SNDERBASIC ;WSANDER BASIC HERE + NOP + NOP + +man_cmd: LSR auto_flag + RTS + +vtab_stmt: JSR getbyte + CMP #$18 ; 24 . + BCS range_err + STA cv + RTS + NOP + NOP + ELSE ;OTHER BASIC + IFNCONST HUSTNBASIC ; omit next 12 bytes if Hustn basic + nop +Lee53 + txa +man_cmd: + ldx #$1 +Lee56 +; ldy acc,x + DC.b $B4 +vtab_stmt: ;wrong address MJW + DC.b acc + + sty himem,x + ldy zp48,x + sty pp,x + + dex + IFCONST BRIELBASIC ;BRIEL BASIC HERE + beq Lee56 + ELSE + beq man_cmd + ENDIF + tax + rts + ELSE ;HUSTNBASIC + STA cv + RTS + NOP + NOP + ENDIF + ENDIF +gr_255_err: LDY #$77 ; 119 w +go_errmess_5: JMP print_err_msg +range_err: LDY #$7b ; 123 { + BNE go_errmess_5 + +See6c: JSR Se254 + LDA aux + BNE Lee7a + LDA aux+1 + BNE Lee7a + JMP Le77e +Lee7a: ASL acc + ROL acc+1 + ROL p3 + ROL p3+1 + LDA p3 + CMP aux + LDA p3+1 + SBC aux+1 + BCC Lee96 + STA p3+1 + LDA p3 + SBC aux + STA p3 + INC acc +Lee96: DEY + BNE Lee7a + RTS + DC.B $ff,$ff,$ff,$ff,$ff,$ff ; "......" + +call_stmt: JSR get16bit + JMP (acc) + IFCONST BRIELBASIC ;BRIEL BASIC +bogus_eea6: + LDA himem + BNE Leeac + dec zp4d +Leeac: + dec himem +Teeae: + lda zp48 +Teeb0: + bne Leeb4 + dec zp49 +Leeb4: + dec zp48 +Leeb6: + ldy #$00 + lda (himem),y +Teeba: + sta (zp48),y +Teebc: + lda pp + cmp himem + lda zpcb +bogus_eec2: + sbc zp4d + bcc bogus_eea6 +Teec6: jmp Lee53 + + + + ELSE ;SANDER/HUSTON (NOT BREIL) BASIC HERE + + +bogus_eea6: ;DC.B $20,$34,$ee,$c5,$c8,$90,$bb,$85 ; " 4nEH.;." + IFCONST SNDERBASIC ;WSANDER BASIC HERE + JSR getbyte + CMP text_index + BCC range_err +; sta LOCZERO + DC.b $85 + +Teeae: LDA himem+1 + +Teeb0: PHA + LDA himem + JSR push_ya_noun_stk +Leeb6 + PLA + STA noun_stk_h_int,X + RTS + +Teeba: LDA lomem+1 + +Teebc: PHA + LDA lomem + JMP Lefb3 +bogus_eec2: + LDA zp85 + DC.b $2D,$60 +Teec6: JSR getbyte + ELSE ;HUSTON BASIC HERE + JSR get16bit + LDA zpcf + BPL Leeb5 + TYA +Teeae + DEX +; JSR push_ya_noun_stk + DC.b $20 +Teeb0 + DC.b $08,$e7 + + STY noun_stk_h_int,x + rts +Leeb5 +; STA tokndxstk + DC.b $85 +Leeb6 + DC.b $d1 + + LDA acc +; STA srch + DC.b $85 +Teeba + DC.b $d0 + +; JSR get16bit + DC.b $20 +Teebc + DC.b $15, $e7 + + LDA acc + STA srch2 +bogus_eec2: + LDA zpcf + STA $d3 +Teec6 + LDA #$01 + JMP plot_comma + ENDIF + ENDIF + IFNCONST HUSTNBASIC ; omit next 2 bytes if Hustn basic + CMP #$28 ; 40 ( + ENDIF +Leecb: BCS range_err + TAY + LDA text_index + RTS + NOP + NOP + +print_err_msg2: TYA + TAX + LDY #$6e ; 110 n + JSR Se3c4 + TXA + TAY + JSR Se3c4 + LDY #$72 ; 114 r + JMP Se3c4 + +Seee4: JSR get16bit +Leee7: ASL acc + ROL acc+1 + BMI Leee7 + BCS Leecb + BNE Leef5 + CMP acc + BCS Leecb +Leef5: RTS + +peek_fn: + IFCONST BLD4APPLE1 + JSR get16bit + ELSE + JMP A2PEEK + ENDIF + LDA (acc),Y + STY syn_stk_l+31,X + JMP push_ya_noun_stk + +poke_stmt: + IFCONST BLD4APPLE1 + JSR getbyte + ELSE + JMP A2POKE + ENDIF + LDA acc + PHA + JSR get16bit + PLA + STA (acc),Y + +Tef0c: RTS + DC.B $ff,$ff,$ff ; "..." + +divide: JSR See6c + LDA acc + STA p3 + LDA acc+1 + STA p3+1 + JMP Le244 + +dim_num: JSR Seee4 + JMP Le134 + +num_array_subs: JSR Seee4 + LDY noun_stk_h_str,X + LDA noun_stk_l,X + ADC #$fe ; 254 ~ + BCS Lef30 + DEY +Lef30: STA aux + STY aux+1 + CLC + ADC acc + STA noun_stk_l,X + TYA + ADC acc+1 + STA noun_stk_h_str,X + LDY #$00 ; 0 . + LDA noun_stk_l,X + CMP (aux),Y + INY + LDA noun_stk_h_str,X + SBC (aux),Y + BCS Leecb + JMP left_paren + +rnd_fn: JSR get16bit + LDA rnd + JSR push_ya_noun_stk + LDA rnd+1 + BNE Lef5e + CMP rnd + ADC #$00 ; 0 . +Lef5e: AND #$7f ; 127 . + STA rnd+1 + STA noun_stk_h_int,X + LDY #$11 ; 17 . +Lef66: LDA rnd+1 + ASL + CLC + ADC #$40 ; 64 @ + ASL + ROL rnd + ROL rnd+1 + DEY + BNE Lef66 + LDA acc + JSR push_ya_noun_stk + LDA acc+1 + STA noun_stk_h_int,X + JMP mod_op + +Tef80: JSR get16bit + LDY acc + IFCONST SNDERBASIC ;SANDER BASIC HERE + CPY lomem + LDA acc+1 + SBC lomem+1 + BCC Lefab_efad + STY himem + LDA acc+1 + STA himem+1 +Lef93: JMP new_cmd + +Tef96: JSR get16bit + LDY acc + CPY himem + LDA acc+1 + SBC himem+1 + BCS Lefab_efad + STY lomem + LDA acc+1 + STA lomem+1 + BCC Lef93 +Lefab_efad: JMP Leecb + ;DC.B ;$a5,$4d,$48,$a5,$4c ; "%MH%L" + lda zp4d + pha + lda himem + ELSE + IFCONST HUSTNBASIC + CPY lomem + LDA zpcf + SBC zp4b + BCC Lefab + STY himem + LDA zpcf + STA zp4d +Lef93 + JMP new_cmd +Tef96 + JSR get16bit + LDY acc + CPY himem + LDA zpcf + SBC zp4d + BCS Lefab + STY lomem + LDA zpcf + sta zp4b + bcc Lef93 +Lefab + JMP Leecb + LDA zp4d + PHA + LDA himem + ELSE + cpy himem + lda zpcf + sbc zp4d + bcc Lefac + sty zp48 + lda zpcf + sta zp49 + jmp Leeb6 +Tef96: + jsr get16bit + ldy acc + cpy pp + lda zpcf + sbc zpcb + bcs Lefac + sty lomem + lda zpcf + sta zp4b + jmp clr +Lefac + jmp Leecb + +Lefab_efad: + nop + nop + nop + nop + ENDIF + ENDIF +Lefb3: JSR Sefc9 + +string_input: JSR input_str + JMP Lefbf + +input_prompt: JSR print_str +Lefbf: LDA #$ff ; 255 . + STA text_index + LDA #$74 ; 116 t + STA buffer + RTS + +Sefc9: JSR not_op + INX + +Sefcd: JSR not_op + LDA noun_stk_l,X + RTS + +mem_init_4k: LDA #$00 ; 0 . + STA lomem + STA himem + LDA #$08 ; 8 . + STA lomem+1 + LDA #$10 ; 16 . + STA himem+1 + JMP new_cmd + +Sefe4: CMP noun_stk_h_str,X + BNE Lefe9 + CLC +Lefe9: JMP Le102 + +Tefec: JSR clr + JMP run_warm + +Teff2: JSR clr + JMP goto_stmt + +Seff8: CPX #$80 ; 128 . + BNE Leffd + DEY +Leffd: JMP Se00c + + + + diff --git a/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.asm b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.asm new file mode 100644 index 0000000..b5e7cc8 --- /dev/null +++ b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.asm @@ -0,0 +1,1963 @@ + PROCESSOR 6502 + LIST ON +; +;-----------------------------------------------------------------------; +; The Wozanium Pack ; +; This file is part one of the Wozanium Pack. ; +; Apple 1 basic is the other part ; +;-----------------------------------------------------------------------; +; Copyright 2010,2011 Mike Willegal +; A1 monitor and A1 apple cassette interface derived from +; original Apple 1 implemenations by Steve Wozniak +; +; The Wozanium Pack 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. +; +; The Wozanium Pack 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 the Wozanium Pack. If not, see . +; +;-----------------------------------------------------------------------; +;------------------------------------------------------------------------- +; Defines - this code can be built one of four ways +; 1. clone/real Apple 1 HW +; 2. runs in ram of real or virtual Apple 2 +; 3. runs in virtual apple 2 as ROM +; 4. runs in plug in board of real Apple 2 +; +; select one of these three options +;------------------------------------------------------------------------- +; Build with dasm 6502 assembler and the following command line +;dasm a2a1emulv5_1.asm -DBLD4ROMBD=0 -DHUSTNBASIC=0 -oa2a1rbh.o -la2a1rbh.lst +; + +;BLD4APPLE1 EQU 0 ;ACTUAL APPLE 1 or CLONE +;BLD4RAM EQU 0 ;RAM of virtual or real A2 +;BLD4EMULROM EQU 0 ;ROM of virtual A2 +;BLD4ROMBD EQU 0 ;ROM board in Real A2 + +;------------------------------------------------------------------------- +; Constants +;------------------------------------------------------------------------- + +BS EQU $DF ;Backspace key, arrow left key +CR EQU $8D ;Carriage Return +ESC EQU $9B ;ESC key +PROMPT EQU "\" ;Prompt character + +;------------------------------------------------------------------------- +; scratchpad memory - uses last 1k of apple ii 48k +;------------------------------------------------------------------------- + MAC STORAGE +TURBO DS.b 1 ; any bit non-zero is turbo mode +TURBOUSR EQU $01 ; USER TURBO MODE +TURBOCMP EQU $02 ; COMPUTER DRIVEN TURBO MODE + +RDCONVERT DS.b 1 +READVECTOR DS.w 1 ;allows user override of default keyboard read function +WRITVECTOR DS.w 1 ;allows user override of default video out function + +savey DS.b 1 +savex DS.b 1 +POWERUPINIT DS.b 1 +SCRNCLRD DS.b 1 +CHAR DS.b 1 +TMP1 DS.b 1 +CURROW DS.b 1 +CURCOL DS.b 1 +COUNTER0 DS.b 1 +COUNTER1 DS.b 1 +CURSOR DS.b 1 +RDSTRTL DS.b 1 +RDSTRTH DS.b 1 +HEX2LB DS.b 1 ;Begin address of dump block +HEX2HB DS.b 1 + +;;; zero page back up so graphics routines can use them +TMPG0 DS.b 16 +PG0SAVD DS.b 1 + ENDM + IFNCONST BLD4APPLE1 + IFNCONST BLD4RAM + ORG $bc00 + STORAGE + ENDIF + ENDIF + + + + + + +;------------------------------------------------------------------------- +; Memory declaration +;------------------------------------------------------------------------- + + +HEX1L EQU $24 ;End address of dump block +HEX1H EQU $25 +HEX2L EQU $26 ;Begin address of dump block +HEX2H EQU $27 + +SAVEINDEX EQU $28 ;Save index in input buffer +LASTSTATE EQU $29 ;Last input state + +IN EQU $0200 ;Input buffer + IFCONST BLD4APPLE1 +FLIP EQU $C000 ;Output flip-flop +TAPEIN EQU $C081 ;Tape input +KBD EQU $D010 ;PIA.A keyboard input +KBDCR EQU $D011 ;PIA.A keyboard control register + ELSE +FLIP EQU $C020 ;Output flip-flop +TAPEIN EQU $C060 ;Tape input +KBD EQU $C000 ;keyboard input +KBDCR EQU $C010 ;keybaord strobe clear + ENDIF + +;------------------------------------------------------------------------- +; Constants +;------------------------------------------------------------------------- + +CR EQU $8D ;Carriage Return +ESC EQU $9B ;ASCII ESC +CNTSTRT EQU $E0 + +;--------------------------------------------------------------------------- +; build in ACI Driver +;--------------------------------------------------------------------------- + IFCONST BLD4EMULROM + ORG $D000 ; EMULATOR ROM image + ELSE + IFCONST BLD4RAM + ORG $6000 ; build for memory + ELSE + ORG $C100 ; real apple 1 or plug in ROM board for A2 + ENDIF + ENDIF + +;------------------------------------------------------------------------- +; +; The WOZ Apple Cassette Interface for the Apple 1 +; Written by Steve Wozniak somewhere around 1976 +; +;------------------------------------------------------------------------- +WOZACI + + LDA #$aa ;Print the Tape prompt + IFNCONST BLD4APPLE1 + JMP A2ACIDRIVER ;If not actual Apple 1, use A2 driver + ELSE + JSR ECHO + ENDIF + LDA #CR ;And drop the cursor one line + JSR ECHO + + LDY #-1 ;Reset the input buffer index +ACINEXTCHAR INY + + +ACIWAITCHAR LDA KBDCR ;Wait for key press + BPL ACIWAITCHAR ;No key yet! + LDA KBD ;Clear strobe + STA IN,Y ;Save it into buffer + JSR ECHO ;And type it on the screen + CMP #ESC + BEQ WOZACI ;Start from scratch if ESC! + CMP #CR + BNE ACINEXTCHAR ;Read keys until CR + + LDX #-1 ;Initialize parse buffer pointer + +;------------------------------------------------------------------------- +; Start parsing first or a new tape command +;------------------------------------------------------------------------- + +NEXTCMD LDA #0 ;Clear begin and end values + STA HEX1L + STA HEX1H + STA HEX2L + STA HEX2H + +NEXTCHR INX ;Increment input pointer + LDA IN,X ;Get next char from input line + CMP #$d2 ;Read command? + BEQ READ ;Yes! + CMP #$d7 ;Write command? + BEQ WRITE ;Yes! (note: CY=1) + CMP #$ae ;Separator? + BEQ SEP ;Yes! + CMP #CR ;End of line? + BEQ GOESC ;Escape to monitor! We're done + CMP #$a0 ;Ignore spaces + BEQ NEXTCHR + EOR #$b0 ;Map digits to 0-9 + CMP #9+1 ;Is it a decimal digit? + BCC ACIDIG ;Yes! + ADC #$88 ;Map letter "A"-"F" to $FA-$FF + CMP #$FA ;Hex letter? + BCC WOZACI ;No! Character not hex! + +ACIDIG ASL ;Hex digit to MSD of A + ASL + ASL + ASL + + LDY #4 ;Shift count +ACIHEXSHIFT ASL ;Hex digit left, MSB to carry + ROL HEX1L ;Rotate into LSD + ROL HEX1H ;Rotate into MSD + DEY ;Done 4 shifts? + BNE ACIHEXSHIFT ;No! Loop + BEQ NEXTCHR ;Handle next character + +;------------------------------------------------------------------------- +; Return to monitor, prints \ first +;------------------------------------------------------------------------- + +GOESC JMP ESCAPE ;Escape back to monitor + +;------------------------------------------------------------------------- +; Separating . found. Copy HEX1 to Hex2. Doesn't clear HEX1!!! +;------------------------------------------------------------------------- + +SEP LDA HEX1L ;Copy hex value 1 to hex value 2 + STA HEX2L + LDA HEX1H + STA HEX2H + BCS NEXTCHR ;Always taken! + +;------------------------------------------------------------------------- +; Write a block of memory to tape +;------------------------------------------------------------------------- + +WRITE + LDA #64 ;Write 10 second header + JSR WHEADER +WRNEXT DEY ;Compensate timing for extra work + LDX #0 ;Get next byte to write + LDA (HEX2L,X) + + LDX #8*2 ;Shift 8 bits (decremented twice) +WBITLOOP ASL ;Shift MSB to carry + JSR WRITEBIT ;Write this bit + BNE WBITLOOP ;Do all 8 bits! + + JSR INCADDR ;Increment address + LDY #30 ;Compensate timer for extra work + BCC WRNEXT ;Not done yet! Write next byte + +RESTIDX + LDX SAVEINDEX ;Restore index in input line + BCS NEXTCMD ;Always taken! + +;------------------------------------------------------------------------- +; For case when ACI must fit in c100-c1ff - the read function must be moved +; because the standard read doesn't fit with the extra mask instruction +; required for the Apple II hardware +;------------------------------------------------------------------------- + +READ: + JSR FULLCYCLE ;Wait until full cycle is detected + LDA #22 ;Introduce some delay to allow + JSR WHEADER ; the tape speed to stabilize + JSR FULLCYCLE ;Synchronize with full cycle +NOTSTART + LDY #31 ;Try to detect the much shorter + JSR CMPLEVEL ; start bit + BCS NOTSTART ;Start bit not detected yet! + JSR CMPLEVEL ;Wait for 2nd phase of start bit + + LDY #58 ;Set threshold value in middle +RDBYTE LDX #8 ;Receiver 8 bits +RDBIT PHA + JSR FULLCYCLE ;Detect a full cycle + PLA + ROL ;Roll new bit into result + LDY #57 ;Set threshold value in middle + DEX ;Decrement bit counter + BNE RDBIT ;Read next bit! + STA (HEX2L,X) ;Save new byte + + JSR INCADDR ;Increment address + LDY #53 ;Compensate threshold with workload + BCC RDBYTE ;Do next byte if not done yet! + BCS RESTIDX ;Always taken! Restore parse index + +FULLCYCLE JSR CMPLEVEL ;Wait for two level changes +CMPLEVEL DEY ;Decrement time counter + LDA TAPEIN ;Get Tape In data + +;------------------------------------------------------------------------- +; the next instruction must be added for apple II +; since it doesn't fit in the 256 bytes allowed in the +; original PROM, a substitute A2 read function is called instead +; (READ_APPLE2_VERSION)which is located in a different bank +; +; AND #$80 ;CLEAR floating bits +;------------------------------------------------------------------------- + CMP LASTSTATE ;Same as before? + BEQ CMPLEVEL ;Yes! + STA LASTSTATE ;Save new data + + CPY #128 ;Compare threshold + RTS +;------------------------------------------------------------------------- +; Write header to tape +; +; The header consists of an asymmetric cycle, starting with one phase of +; approximately (66+47)x5=565us, followed by a second phase of +; approximately (44+47)x5=455us. +; Total cycle duration is approximately 1020us ~ 1kHz. The actual +; frequencywill be a bit lower because of the additional workload between +; the twoloops. +; The header ends with a short phase of (30+47)x5=385us and a normal +; phase of (44+47)x5=455us. This start bit must be detected by the read +; routine to trigger the reading of the actual data. +;------------------------------------------------------------------------- + +WHEADER STX SAVEINDEX ;Save index in input line +HCOUNT LDY #66 ;Extra long delay + JSR WDELAY ;CY is constantly 1, writing a 1 + BNE HCOUNT ;Do this 64 * 256 time! + ADC #-2 ;Decrement A (CY=1 all the time) + BCS HCOUNT ;Not all done! + LDY #30 ;Write a final short bit (start) + +;------------------------------------------------------------------------- +; Write a full bit cycle +; +; Upon entry Y contains a compensated value for the first phase of 0 +; bit length. All subsequent loops don't have to be time compensated. +;------------------------------------------------------------------------- + +WRITEBIT JSR WDELAY ;Do two equal phases + LDY #44 ;Load 250us counter - compensation + +WDELAY DEY ;Delay 250us (one phase of 2kHz) + BNE WDELAY + BCC WRITE1 ;Write a '1' (2kHz) + + LDY #47 ;Additional delay for '0' (1kHz) +WDELAY0 DEY ; (delay 250us) + BNE WDELAY0 + +WRITE1 + LDY FLIP,X ;Flip the output bit + LDY #41 ;Reload 250us cntr (compensation) + DEX ;Decrement bit counter + RTS + +;------------------------------------------------------------------------- +; Increment current address and compare with last address +;------------------------------------------------------------------------- +INCADDR LDA HEX2L ;Compare current address with + CMP HEX1L ; end address + LDA HEX2H + SBC HEX1H + INC HEX2L ;And increment current address + BNE NOCARRY ;No carry to MSB! + INC HEX2H +NOCARRY RTS + + +;--------------------------------------------------------------------------- +; all the following code is needed for the A2 version +; skip to Basic for the real thing +;--------------------------------------------------------------------------- + IFNCONST BLD4APPLE1 +;--------------------------------------------------------------------------- +; build in an A2 ACI driver for ROM version +; if using an A2, the version at C100 jumps to this version +; and this version is at D000 (so slots 0 & 2-7 can be used) +;--------------------------------------------------------------------------- + IFNCONST BLD4EMULROM + IFNCONST BLD4RAM + ORG $D000 ; A2 ROM or image + ENDIF + ENDIF + +;------------------------------------------------------------------------- +; ACI DRIVER +;------------------------------------------------------------------------- +A2ACIDRIVER + LDA #$aa ;Print the Tape prompt + JSR ECHO + LDA #CR ;And drop the cursor one line + JSR ECHO + + LDY #-1 ;Reset the input buffer index +RB_ACINEXTCHAR + INY + + JSR A2GETCHAR + + STA IN,Y ;Save it into buffer + JSR ECHO ;And type it on the screen + CMP #ESC + BEQ A2ACIDRIVER ;Start from scratch if ESC! + CMP #CR + BNE RB_ACINEXTCHAR ;Read keys until CR + + LDX #-1 ;Initialize parse buffer pointer + +;------------------------------------------------------------------------- +; Start parsing first or a new tape command +;------------------------------------------------------------------------- + +RB_NEXTCMD + LDA #0 ;Clear begin and end values + STA HEX1L + STA HEX1H + STA HEX2L + STA HEX2H + +RB_NEXTCHR + INX ;Increment input pointer + LDA IN,X ;Get next char from input line + CMP #$d2 ;Read command? + BEQ RB_READ ;Yes! + CMP #$d7 ;Write command? + BEQ RB_WRITE ;Yes! (note: CY=1) + CMP #$ae ;Separator? + BEQ RB_SEP ;Yes! + CMP #CR ;End of line? + BEQ RB_GOESC ;Escape to monitor! We're done + CMP #$a0 ;Ignore spaces + BEQ RB_NEXTCHR + EOR #$b0 ;Map digits to 0-9 + CMP #9+1 ;Is it a decimal digit? + BCC RB_ACIDIG ;Yes! + ADC #$88 ;Map letter "A"-"F" to $FA-$FF + CMP #$FA ;Hex letter? + BCC A2ACIDRIVER ;No! Character not hex! + +RB_ACIDIG + ASL ;Hex digit to MSD of A + ASL + ASL + ASL + + LDY #4 ;Shift count +RB_ACIHEXSHIFT + ASL ;Hex digit left, MSB to carry + ROL HEX1L ;Rotate into LSD + ROL HEX1H ;Rotate into MSD + DEY ;Done 4 shifts? + BNE RB_ACIHEXSHIFT ;No! Loop + BEQ RB_NEXTCHR ;Handle next character + +;------------------------------------------------------------------------- +; Return to monitor, prints \ first +;------------------------------------------------------------------------- + +RB_GOESC JMP ESCAPE ;Escape back to monitor + +;------------------------------------------------------------------------- +; Separating . found. Copy HEX1 to Hex2. Doesn't clear HEX1!!! +;------------------------------------------------------------------------- + +RB_SEP LDA HEX1L ;Copy hex value 1 to hex value 2 + STA HEX2L + LDA HEX1H + STA HEX2H + BCS RB_NEXTCHR ;Always taken! + +;------------------------------------------------------------------------- +; Write a block of memory to tape +;------------------------------------------------------------------------- + +RB_WRITE +;------------------------------------------------------------------------- +; save write start addresses +; so we can check for keyboard +; or console write sequences +; and dynamicly modify code to +; use original A1 driver +; and then revert later on +;------------------------------------------------------------------------- + LDA HEX2L + STA RDSTRTL + LDA HEX2H + STA RDSTRTH + STX SAVEINDEX ;Save index in input line + JSR A2_WRITECONVERT ; convert I/O to A1 compatible format +;------------------------------------------------------------------------- +; now start write of this block +;------------------------------------------------------------------------- + + LDA #64 ;Write 10 second header + JSR RB_WHEADER + +RB_WRNEXT DEY ;Compensate timing for extra work + LDX #0 ;Get next byte to write + LDA (HEX2L,X) + + LDX #8*2 ;Shift 8 bits (decremented twice) +RB_WBITLOOP ASL ;Shift MSB to carry + JSR RB_WRITEBIT ;Write this bit + BNE RB_WBITLOOP ;Do all 8 bits! + + JSR A2_INCADDR ;Increment address + LDY #30 ;Compensate timer for extra work + BCC RB_WRNEXT ;Not done yet! Write next byte + +RB_RESTIDX + JSR A2_READCONVERT ; convert buffer to A2 I/O + LDX SAVEINDEX ;Restore index in input line + JMP RB_NEXTCMD ;Always taken! + +;------------------------------------------------------------------------- +; For case when ACI must fit in c100-c1ff - the read function must be moved +; because the standard read doesn't fit with the extra mask instruction +; required for the Apple II hardware +;------------------------------------------------------------------------- + +RB_READ: +;------------------------------------------------------------------------- +; save read start addresses +; so we can check for keyboard +; or console write sequences +; and dynamicly modify code to +; use A2 driver +;------------------------------------------------------------------------- + LDA HEX2L + STA RDSTRTL + LDA HEX2H + STA RDSTRTH + + JSR A2_FULLCYCLE ;Wait until full cycle is detected + STX SAVEINDEX ;Save index in input line + LDA #22 ;Introduce some delay to allow + JSR RB_WHEADER ; the tape speed to stabilize + +;------------------------------------------------------------------------- +; +; This read function will optionally convert and A1 keyboard reads +; to calls to use our driver to read from A2 hardware by scanning +; read data looking for one of three code sequences +;------------------------------------------------------------------------- +; +; Normal start +; + JSR A2_FULLCYCLE ;Synchronize with full cycle +A2_NOTSTART LDY #28 ;Try to detect the much shorter + JSR A2_CMPLEVEL ; start bit + BCS A2_NOTSTART ;Start bit not detected yet! + JSR A2_CMPLEVEL ;Wait for 2nd phase of start bit + + LDY #53 ;Set threshold value in middle +A2_RDBYTE LDX #8 ;Receiver 8 bits +A2_RDBIT PHA + JSR A2_FULLCYCLE ;Detect a full cycle + PLA + ROL ;Roll new bit into result + LDY #52 ;Set threshold value in middle + DEX ;Decrement bit counter + BNE A2_RDBIT ;Read next bit! + STA (HEX2L,X) ;Save new byte + + JSR A2_INCADDR ;Increment address + LDY #46 ;Compensate threshold with workload + BCC A2_RDBYTE ;Do next byte if not done yet! + + JMP RB_RESTIDX + + + +;------------------------------------------------------------------------- +; Write header to tape +; +; The header consists of an asymmetric cycle, starting with one phase of +; approximately (66+47)x5=565us, followed by a second phase of +; approximately (44+47)x5=455us. +; Total cycle duration is approximately 1020us ~ 1kHz. The actual +; frequencywill be a bit lower because of the additional workload between +; the twoloops. +; The header ends with a short phase of (30+47)x5=385us and a normal +; phase of (44+47)x5=455us. This start bit must be detected by the read +; routine to trigger the reading of the actual data. +;------------------------------------------------------------------------- + +RB_WHEADER +RB_HCOUNT LDY #72 ;Extra long delay + JSR RB_WDELAY ;CY is constantly 1, writing a 1 + BNE RB_HCOUNT ;Do this 64 * 256 time! + ADC #-2 ;Decrement A (CY=1 all the time) + BCS RB_HCOUNT ;Not all done! + LDY #32 ;Write a final short bit (start) + +;------------------------------------------------------------------------- +; Write a full bit cycle +; +; Upon entry Y contains a compensated value for the first phase of 0 +; bit length. All subsequent loops don't have to be time compensated. +;------------------------------------------------------------------------- + +RB_WRITEBIT + + JSR RB_WDELAY ;Do two equal phases + LDY #47 ;Load 250us counter - compensation + +RB_WDELAY DEY ;Delay 250us (one phase of 2kHz) + BNE RB_WDELAY + BCC RB_WRITE1 ;Write a '1' (2kHz) + + LDY #50 ;Additional delay for '0' (1kHz) +RB_WDELAY0 DEY ; (delay 250us) + BNE RB_WDELAY0 + +RB_WRITE1 + + LDY FLIP ;Flip the output bit + + LDY #46 ;Reload 250us cntr (compensation) + DEX ;Decrement bit counter + RTS + +;------------------------------------------------------------------------- +; Wait for FULL cycle (cmplevel- waits till level transisiton) +;------------------------------------------------------------------------- +A2_FULLCYCLE JSR A2_CMPLEVEL ;Wait for two level changes +A2_CMPLEVEL DEY ;Decrement time counter + LDA TAPEIN ;Get Tape In data + +; the next instruction must be added for apple II + AND #$80 ;CLEAR floating bits + CMP LASTSTATE ;Same as before? + BEQ A2_CMPLEVEL ;Yes! + STA LASTSTATE ;Save new data + + CPY #128 ;Compare threshold + RTS +;------------------------------------------------------------------------- +; Increment current address and compare with last address +;------------------------------------------------------------------------- +A2_INCADDR LDA HEX2L ;Compare current address with + CMP HEX1L ; end address + LDA HEX2H + SBC HEX1H + INC HEX2L ;And increment current address + BNE A2_NOCARRY ;No carry to MSB! + INC HEX2H +A2_NOCARRY RTS + +;------------------------------------------------------------------------- +; one block read +; modify A1 code that touches PIA to A2 version as it is loaded +; these are keyboard and display functions +; +; APPLE 1 version +;ACIWAITCHAR +; ad 11 d0 LDA KBDCR ;Wait for key press +; 30 FB BPL ACIWAITCHAR ;No key yet! +; ad 10 d0 LDA KBD ;Clear strobe +; converted to our version +; 20 3a d1 JSR A2GETCHAR +; ea NOP +; ea NOP +; ea NOP +; ea NOP +; ea NOP +; +; instead if BPL is not present or has mismatching branch offset +; ad 11 d0 LDA KBDCR +; is converted to +; ad 00 c0 LDA KBD +; +; +; +; ad 10 d0 LDA KBD +; is converted to +; 8d 10 c0 STA KBDCR ;Clear strobe +; +; finally there are some cases where presence of character is +; determined with the bit command +; 2c 11 d0 BIT KBDCR +; is converted to +; 2c 00 c00 BIT KBD +; +; +; +;------------------------------------------------------------------------- + +CNVRTTERM EQU $77 ; UNIQUE CHAR NEEDED TO TERMINATE CONVERSION STRINGS + +A2_READCONVERT + LDA #0 ; RDCONVERT can be turned off + CMP RDCONVERT + BNE A2_READCONVERTDONE ; not zero, then skip conversion + LDX #0 + LDY #0 +; +; check next string through all of memory +; + +A2_READCONVERT_1 ; for this string, scan all of read memory + STY savey ;save compare string starting point + + LDA CNVRT_IN,Y + CMP #CNVRTTERM ; Termination character? + BEQ A2_READCONVERTDONE ;all done checking, exit + + LDA RDSTRTL ; start of memory load + STA HEX2L + LDA RDSTRTH + STA HEX2H + +; +; restart currnet string +; +A2_READCONVERT_8 + LDA HEX2L ;save memory starting point + STA HEX2LB + LDA HEX2H + STA HEX2HB + LDY savey + +A2_READCONVERT1 + LDA (HEX2L),X ; fetch byte from memory + CMP CNVRT_IN,Y ; compare + BEQ A2_READCONVERT1_2 ; this byte does match, process +; +; mo match, restart match string +; + JSR A2_INCADDR + BCC A2_READCONVERT_8 ; not end of memory - restart scan for current string + +; +; end of memory block - go to next string +; +A2_READCONVERT1_3 + INY + LDA CNVRT_IN,Y + CMP #CNVRTTERM ; Termination character? + BNE A2_READCONVERT1_3 ; not end of block, keep looking + INY ; found end, move to start of next block + JMP A2_READCONVERT_1 ; rescan memory with next string +; +; match - keep going until mismatch or end of string +; +A2_READCONVERT1_2 + INY + LDA CNVRT_IN,Y + CMP #CNVRTTERM ; Termination character? + BEQ A2_READCONVERT3 ; end of string - this is match do substitute + JSR A2_INCADDR ; next memory address + BCC A2_READCONVERT1 ; not done - keep scanning + + JMP A2_READCONVERT1_3 ; not a complete match - try next string + +;------------------------------------------------------------------------- +; Finished with READ +;------------------------------------------------------------------------- +A2_READCONVERTDONE + RTS + +;------------------------------------------------------------------------- +; Substitute string here +;------------------------------------------------------------------------- + +A2_READCONVERT3 ; match - substitute here + LDY savey + + LDA HEX2LB ;restore memory starting point + STA HEX2L + LDA HEX2HB + STA HEX2H +A2_READCONVERT4 + LDA CNVRT_IN,Y + CMP #CNVRTTERM ; Termination character? + BEQ A2_READCONVERT_8 ; done with sustibute, continue checking + LDA CNVRT_OUT,Y + INY + STA (HEX2L),X + JSR A2_INCADDR + JMP A2_READCONVERT4 + +;------------------------------------------------------------------------- +; conversion strings +; IN(what we are looking for +; OUT (what we change it to) +;------------------------------------------------------------------------- + +CNVRT_IN +CI1 LDA $d011 + BPL CI1 + LDA $d010 + DC.b CNVRTTERM + LDA $d011 + DC.b CNVRTTERM + LDA $d010 + DC.b CNVRTTERM + BIT $d011 + DC.b CNVRTTERM +CI2 + BIT $D012 + BMI CI2 + STA $D012 + DC.b CNVRTTERM + IFCONST BLD4RAM + JSR $FFEF + DC.b CNVRTTERM + ENDIF + DC.b CNVRTTERM + +CNVRT_OUT + JSR A2GETCHAR + NOP + NOP + NOP + NOP + NOP + DC.b CNVRTTERM + LDA KBD + DC.b CNVRTTERM + STA KBDCR + DC.b CNVRTTERM + BIT KBD + DC.b CNVRTTERM + JSR ECHO + NOP + NOP + NOP + NOP + NOP + DC.b CNVRTTERM + IFCONST BLD4RAM + JSR ECHO + DC.b CNVRTTERM + ENDIF + DC.b CNVRTTERM + + +;------------------------------------------------------------------------- +; one block write +; undo read convert when writing to tape so tape +; can be loaded and run on a real actual A1 +;------------------------------------------------------------------------- +A2_WRITECONVERT + LDA #0 ; RDCONVERT can be turned off + CMP RDCONVERT + BNE A2_WRITECONVERTDONE ; not zero, then skip conversion + LDX #0 + LDY #0 +; +; check next string through all of memory +; + +A2_WRITECONVERT_1 ; for this string, scan all of read memory + STY savey ;save compare string starting point + + LDA CNVRT_OUT,Y + CMP #CNVRTTERM ; Termination character? + BEQ A2_WRITECONVERTDONE ;all done checking, exit + + LDA RDSTRTL ; reset block address + STA HEX2L + LDA RDSTRTH + STA HEX2H + +; +; restart currnet string +; +A2_WRITECONVERT_8 + LDA HEX2L ;save memory starting point + STA HEX2LB + LDA HEX2H + STA HEX2HB + LDY savey + +A2_WRITECONVERT1 + LDA (HEX2L),X ; fetch byte from memory + CMP CNVRT_OUT,Y ; compare + BEQ A2_WRITECONVERT1_2 ; this byte does match, process +; +; mo match, restart match string +; + JSR A2_INCADDR + BCC A2_WRITECONVERT_8 ; not end of memory - restart scan for current string + +; +; end of memory block - go to next string +; +A2_WRITECONVERT1_3 + INY + LDA CNVRT_OUT,Y + CMP #CNVRTTERM ; Termination character? + BNE A2_WRITECONVERT1_3 ; not end of block, keep looking + INY ; found end, move to start of next block + JMP A2_WRITECONVERT_1 ; rescan memory with next string +; +; match - keep going until mismatch or end of string +; +A2_WRITECONVERT1_2 + INY + LDA CNVRT_OUT,Y + CMP #CNVRTTERM ; Termination character? + BEQ A2_WRITECONVERT3 ; end of string - this is match do substitute + JSR A2_INCADDR ; next memory address + BCC A2_WRITECONVERT1 ; not done - keep scanning + + JMP A2_WRITECONVERT1_3 ; not a complete match - try next string + +;------------------------------------------------------------------------- +; Finished with WRITE CONVERSION +;------------------------------------------------------------------------- +A2_WRITECONVERTDONE + LDA RDSTRTL ; reset block address + STA HEX2L + LDA RDSTRTH + STA HEX2H + + RTS +;------------------------------------------------------------------------- +; Substitute string here +;------------------------------------------------------------------------- + +A2_WRITECONVERT3 ; match - substitute here + LDY savey + + LDA HEX2LB ;restore memory starting point + STA HEX2L + LDA HEX2HB + STA HEX2H +A2_WRITECONVERT4 + LDA CNVRT_OUT,Y + CMP #CNVRTTERM ; Termination character? + BEQ A2_WRITECONVERT_8 ; done with sustibute, continue checking + LDA CNVRT_IN,Y + INY + STA (HEX2L),X + JSR A2_INCADDR + JMP A2_WRITECONVERT4 + +;------------------------------------------------------------------------- +; output driver - uses hires memory +;------------------------------------------------------------------------- + +A2GETCHAR: + JMP (READVECTOR) ;Allow user override of default get char function +A2GETCHAR2: + JSR TOGGLE + LDA KBD ;Wait for key press + BPL A2GETCHAR ;No key yet! + STA KBDCR ;Clear strobe + CMP #$88 ; left arrow + BNE A2_GC_NOT_BS ; brnch no + LDA #BS ; convert to _ +A2_GC_NOT_BS: + CMP #$95 ; right arrow + BNE A2_GC_RET ; no, exit + JSR CLEAR ; yes, clear screen and + + JMP A2GETCHAR ; get next char (this is a special HW emulation + ; function so skip call to READVECTOR) +A2_GC_RET: + RTS + + +;------------------------------------------------------------------------- +; output driver - uses hires memory +;------------------------------------------------------------------------- +;;; Magic Numbers +SCRINIT EQU $f0 +PG0SAVEFLG EQU $f0 +;;; Definitions +HRPG1 EQU $C054 +HRPG2 EQU $C055 +LORES EQU $C056 +HIRES EQU $C057 +TXTCLR EQU $C050 +TXTMOD EQU $C051 +MIXCLR EQU $C052 +GETCHAR EQU $FD0C + +;;; Page Zero Temps (8 locations reserved) +TRGLOW EQU $00 +TRGHIGH EQU $01 +SRCLOW EQU $02 +SRCHIGH EQU $03 +CNT2 EQU $05 +CNT3 EQU $06 + +; Last location of low res +LASTLOCATION EQU $7F8 + +;;; Entry point for testing +START JSR INIT +L0 JSR GETCHAR + JSR PUTCH + JMP L0 + BRK + +;;; Move the cursor +MVCSR INC CURCOL + LDA CURCOL + CMP #40 + BPL NXTROW +MD + LDA #0 + CMP TURBO + BNE MR + + LDY #0 +ML0 LDX #12 ; speed fine tuning +ML1 INX + BNE ML1 + INY + CPY #$9 + BNE ML0 +MR RTS +NXTROW + LDA #0 + STA CURCOL + + LDA CURROW ; don't increment current row until in case + ; we are already at bottom of screen + CMP #23 ; if a reset comes in, it could leave us on an illegal row + BMI NXTROW2 + + JSR SCROLL ; scrolling bottom line, do not advance CURROW + JMP MD + +NXTROW2 + INC CURROW ; not at bottom of screen advance to next row (CURROW) + JMP MD + +;;; Toggle the cursor +TOGGLE + + INC COUNTER0 + BNE DT + INC COUNTER1 + BNE DT + PHA + LDA #CNTSTRT + STA COUNTER1 +; +; if screen has not been cleared- toggle betweeen hi res pages +; + LDA SCRNCLRD + BMI TOGGLE2 +; +; toggle from hi-res to low-res +; + LDA CURSOR + BNE TOGGLE1 + LDA #32 + STA CURSOR + LDA HRPG1 + JMP TOGGLE4 + +TOGGLE1 + LDA #0 + STA CURSOR + LDA HRPG2 + JMP TOGGLE4 +; +; else toggle cursor +; +TOGGLE2 + STX savex + STY savey + JSR SAVPG0 + + LDA CURSOR + BNE SETSPC + LDA #32 + JMP DRWCUR +SETSPC LDA #0 +DRWCUR STA CURSOR + LDX CURCOL + LDY CURROW + JSR GETBLOK + LDX CURSOR + JSR GETCHB + JSR DRAWCH + JSR LODPG0 + LDX savex + LDY savey +TOGGLE4 + PLA +DT RTS + +;;; Scrolls the screen at the end +SCROLL +;------------------------------------------------------------------------------------------------------------ +; +; HIRES is organized +; into three blocks, offset by 0x28 bytes each, starting at 2000 +; each block holds 8 lines of text, offset by 0x80 bytes +; each line of text is split into 8 rows of pixels offset by 0x400 bytes +; +; this function starts at second from top row copy all pixels to row above it and continues down the screen +; +;------------------------------------------------------------------------------------------------------------ +; first block -set up starting addresses +; + ldx #0 ;index into graphics table - starts at zero +; top loop - 24 lines of characters per page - copy bottom 23 lines (first line scrolls off top) + LDA #23 + STA CNT2 + +; +; next line of text +; +scr1 + LDA PG1ROWS,x ; target + STA TRGHIGH + inx + LDA PG1ROWS,x ; target + STA TRGLOW + inx + LDA PG1ROWS,x ; src + STA SRCHIGH + inx + LDA PG1ROWS,x ; scr + STA SRCLOW + DEX ;next pass target is current source + LDA #8 + STA CNT3 + JMP scr2.1 +; +; adjust address to next line of pixels +; +scr2 + + LDA #$4 + CLC + ADC SRCHIGH + STA SRCHIGH + LDA #$4 + CLC + ADC TRGHIGH + STA TRGHIGH +scr2.1 + LDY #39 +;copy 40 characters that make up a line of pixels +scr3 + LDA (SRCLOW),y + STA (TRGLOW),y + DEY + BPL scr3 ; repeat for 40 characters that make line of pixels + DEC CNT3 + BNE scr2 ; done with this line of pixels =- goto to next liine of pixels + DEC CNT2 + BNE scr1 ; done with this line of characters - goto next line of chars + + JSR CLEAR_LINE + RTS + +; +; clear line - X contains line # +; +CLEAR_LINE + LDA PG1ROWS,x ; target (was last source) + STA TRGHIGH + inx + LDA PG1ROWS,x ; target + STA TRGLOW + + LDA #8 + STA CNT3 + JMP CL4.1 +; +; adjust address to next line of pixels +; +CL4 + LDA #$4 + CLC + ADC TRGHIGH + STA TRGHIGH +CL4.1 + LDY #39 + lda #$0 +;copy 40 characters that make up a line of pixels +CL5 + STA (TRGLOW),y + DEY + BPL CL5 ; repeat for 40 characters that make line of pixels + DEC CNT3 + BNE CL4 ; done with this line of pixels =- goto to next liine of pixels + RTS + + +;;; Initialize the graphics system, set cursor and clear the screen +INIT +; +; Initialize default keyboard in and video out routines + LDA #PUTCH2 + STA WRITVECTOR+1 + + LDA #A2GETCHAR2 + STA READVECTOR+1 + + LDA TURBO ;clear computer driven turbo mode + AND #TURBOUSR ;but save user turbo mode + STA TURBO +; +; reset could have occurred during video driver operations +; attempt to restore page 0 if possible +; there is a case where we were in the process of saving +; or restoring page zero variables when reset occurred +; we cannot recover from that case +; + JSR LODPG0 ;restore page zero variables +; +; determine whether we should emulate power up screen +; + LDA #SCRINIT + CMP POWERUPINIT ;have we initialized power up screen + BNE INITSCREEN ;no, let's do it + CMP SCRNCLRD ;has user cleared the screen? + BNE INITEXIT ;no, leave graphics mode alone + +; +; clear screen already done - set HGR PG 2 mode +; + STA HIRES ; set high res pg 2 graphics mode + STA HRPG2 ; if this is power up, this will be changed below + STA TXTCLR + STA MIXCLR +INITEXIT + RTS +; +; initialize lowres page 1 as startup screen +; + +INITSCREEN + LDA #$04 ;START ADDRESS + STA HEX2H + LDA #$0 + STA HEX2L + + LDA #$0B ;END ADDRESS + STA HEX1H + LDA #$F8 + STA HEX1L + + LDY #0 + +INIT1 + LDA #$DF ; underbar + STA (HEX2L),y + JSR A2_INCADDR + BCS INIT2 + LDA #$08 ; check address range <800 use at sign + BIT HEX2H ; >800 use space + BNE INIT1_1 + LDA #$C0 ; at sign + BMI INIT1_2 +INIT1_1 + LDA #$A0 ; space +INIT1_2 + STA (HEX2L),y ; save it + JSR A2_INCADDR + BCC INIT1 + +INIT2 + + LDA #0 + STA SCRNCLRD ; now indicate that screen has been not cleared + STA CURROW + STA CURCOL + STA TURBO ; default not turbo mode + STA RDCONVERT ; default convert cassette reads + LDA #CNTSTRT + STA COUNTER1 + + STA LORES ; set lowres pg 1 graphics mode for start up screen + STA HRPG1 ; use page 1 + STA TXTMOD + STA MIXCLR + + LDA #SCRINIT + STA POWERUPINIT ; indicate power on init done + + RTS + +;;; Clears hires page 1 +CLEAR + STY savey + STX savex + JSR SAVPG0 + + LDX #0 + +CLEAR2 + JSR CLEAR_LINE + INX + CPX #48 + BNE CLEAR2 + ;; page cleared + + LDA #SCRINIT + STA SCRNCLRD ;indicate screen cleared + + STA HIRES ; set high res pg 2 graphics mode + STA HRPG2 + STA TXTCLR + STA MIXCLR + + LDA #$00 +; +; cursor to top left +; + STA CURROW + STA CURCOL + + JSR LODPG0 + LDY savey + LDX savex + RTS + +;;; Prints character from A to the screen +PUTCH + JMP (WRITVECTOR) ;allow user override of default video out routine +PUTCH2: + PHA + STY savey + STX savex + + LDY SCRNCLRD + BPL PUTCH_DROP ;if plus, screen has not been cleared, so drop + + JSR SAVPG0 + ;; drop the high bit + AND #$7F + ;; check for return + CMP #$0D + BEQ ENTERKY + ;; it's a regular key + JSR GETCODE + STA CHAR + ;; get the block address + LDX CURCOL + LDY CURROW + JSR GETBLOK + ;; get block bytes + LDX CHAR + JSR GETCHB + ;; render the char to the block + JSR DRAWCH + ;; restore state and exit +PD JSR MVCSR + JSR LODPG0 + +PUTCH_DROP + LDY savey + LDX savex + PLA + RTS + +ENTERKY ; print spaces until end of line (use turbo mode) + LDA TURBO + ORA #TURBOCMP ; set computer turbo mode + STA TURBO ; turbo mode to clear end of line +ENTERKY1 + LDY CURROW + LDX CURCOL + CPX #40 + BEQ ENTERKY_EXIT + JSR GETBLOK + LDX #0 ; space key + JSR GETCHB + JSR DRAWCH + INC CURCOL + JMP ENTERKY1 + +ENTERKY_EXIT + LDA TURBO + AND #TURBOUSR ; reset computer turbo mode, saving user mode + STA TURBO ; + JMP PD + +;;; Draws character to block +DRAWCH LDX #0 +L6 TXA + TAY + LDA (SRCLOW),Y + LDY #0 + STA (TRGLOW),Y + INX + LDA TRGHIGH + CLC + ADC #$4 + STA TRGHIGH + CPX #8 + BMI L6 + RTS + +;;; Get byte for char in X +GETCHB LDY #SPCODE + STY SRCHIGH +L5 CPX #0 + BEQ D + DEX + LDA #8 + CLC + ADC SRCLOW + STA SRCLOW + BCS AC + JMP L5 +AC LDA #0 + ADC SRCHIGH + STA SRCHIGH + JMP L5 +D RTS + +;;; Gets the block address at X,Y +GETBLOK TYA + JSR GETROW + ;; add the column + TXA + CLC + ADC TRGLOW + STA TRGLOW + BCS A1 + RTS +A1 LDA #0 + ADC TRGHIGH + RTS + +;;; Gets the row (A) address +GETROW ASL ; multiply row by two, there are two bytes per address + TAY + LDA PG1ROWS,Y + STA TRGHIGH + INY + LDA PG1ROWS,Y + STA TRGLOW + RTS + +;;; Converts ASCII code to table index +GETCODE SEC + SBC #$20 + BMI NC + CMP #$40 + BPL NC + RTS +NC LDA #0 + RTS + +;;; Store page zero data +SAVPG0 PHA + STX TMP1 + + LDA #PG0SAVEFLG ;check saved flag + CMP PG0SAVD + BEQ SD ;already saved, just exit + + LDX #0 +L1 LDA $00,X + STA TMPG0,X + INX + CPX #$8 + BNE L1 + + LDA #PG0SAVEFLG ;set save flag to saved after completely saved + STA PG0SAVD ;this way, if a reset comes in before we are done + ;we will not corrupt zero page + ;as the reset code restores zero page if flag set + +SD LDX TMP1 + PLA + RTS + +;;; Restore page zero data +LODPG0 + PHA + STX TMP1 + + LDA #PG0SAVEFLG ;checked saved flag + CMP PG0SAVD + BNE LD ;not saved, exit + + LDX #0 +L2 LDA TMPG0,X + STA $00,X + INX + CPX #$8 + BNE L2 + + LDA #<(~PG0SAVEFLG) ;clear saved flag to not saved after completely restored + ;this way, if a reset comes in before we are done + STA PG0SAVD ;as the reset code restores zero page if flag set + +LD LDX TMP1 + PLA + RTS + + +;;; tables +PG1ROWS HEX 4000 4080 4100 4180 4200 4280 4300 4380 4028 40A8 4128 41A8 4228 42A8 4328 43A8 4050 40D0 4150 41D0 4250 42D0 4350 43D0 +SPCODE HEX 00 00 00 00 00 00 00 00 +EXPCODE HEX 00 08 08 08 08 08 00 08 +QUOCODE HEX 00 14 14 14 00 00 00 00 +NUMCODE HEX 00 14 14 3e 14 3e 14 14 +STRCODE HEX 00 08 3c 0a 1c 28 1e 08 +PERCODE HEX 00 06 26 10 08 04 32 30 +AMPCODE HEX 00 04 0a 0a 04 2a 12 2c +SQCODE HEX 00 08 08 08 00 00 00 00 +RPCODE HEX 00 08 04 02 02 02 04 08 +LPCODE HEX 00 08 10 20 20 20 10 08 +STACODE HEX 00 08 2a 1c 08 1c 2a 08 +PLSCODE HEX 00 00 08 08 3e 08 08 00 +CMACODE HEX 00 00 00 00 00 08 08 04 +MINCODE HEX 00 00 00 00 3e 00 00 00 +DOTCODE HEX 00 00 00 00 00 00 00 08 +FSCODE HEX 00 00 20 10 08 04 02 00 +0CODE HEX 00 1c 22 32 2a 26 22 1c +1CODE HEX 00 08 0c 08 08 08 08 1c +2CODE HEX 00 1c 22 20 18 04 02 3e +3CODE HEX 00 3e 20 10 18 20 22 1c +4CODE HEX 00 10 18 14 12 3e 10 10 +5CODE HEX 00 3e 02 1e 20 20 22 1c +6CODE HEX 00 38 04 02 1e 22 22 1c +7CODE HEX 00 3e 20 10 08 04 04 04 +8CODE HEX 00 1c 22 22 1c 22 22 1c +9CODE HEX 00 1c 22 22 3c 20 10 0e +COLCODE HEX 00 00 00 08 00 08 00 00 +SEMCODE HEX 00 00 00 08 00 08 08 04 +LTCODE HEX 00 10 08 04 02 04 08 10 +EQCODE HEX 00 00 00 3e 00 3e 00 00 +GTCODE HEX 00 04 08 10 20 10 08 04 +QESCODE HEX 00 1c 22 10 08 08 00 08 +ATCODE HEX 00 1C 22 2A 3A 1A 02 3C +ACODE HEX 00 08 14 22 22 3e 22 22 +BCODE HEX 00 1e 22 22 1e 22 22 1e +CCODE HEX 00 1c 22 02 02 02 22 1c +DCODE HEX 00 1e 22 22 22 22 22 1e +ECODE HEX 00 3e 02 02 1e 02 02 3e +FCODE HEX 00 3e 02 02 1e 02 02 02 +GCODE HEX 00 3c 02 02 02 32 22 3c +HCODE HEX 00 22 22 22 3e 22 22 22 +ICODE HEX 00 1c 08 08 08 08 08 1c +JCODE HEX 00 20 20 20 20 20 22 1c +KCODE HEX 00 22 12 0a 06 0a 12 22 +LCODE HEX 00 02 02 02 02 02 02 3e +MCODE HEX 00 22 36 2a 2a 22 22 22 +NCODE HEX 00 22 22 26 2a 32 22 22 +OCODE HEX 00 1c 22 22 22 22 22 1c +PCODE HEX 00 1e 22 22 1e 02 02 02 +QCODE HEX 00 1c 22 22 22 2a 12 2c +RCODE HEX 00 1e 22 22 1e 0a 12 22 +SCODE HEX 00 1c 22 02 1c 20 22 1c +TCODE HEX 00 3e 08 08 08 08 08 08 +UCODE HEX 00 22 22 22 22 22 22 1c +VCODE HEX 00 22 22 22 22 22 14 08 +WCODE HEX 00 22 22 22 2a 2a 36 22 +XCODE HEX 00 22 22 14 08 14 22 22 +YCODE HEX 00 22 22 14 08 08 08 08 +ZCODE HEX 00 3e 20 10 08 04 02 3e +LBCODE HEX 00 3e 06 06 06 06 06 3e +BSCODE HEX 00 00 02 04 08 10 20 00 +RBCODE HEX 00 3e 30 30 30 30 30 3e +CRTCODE HEX 00 00 00 08 14 22 00 00 +UNDCODE HEX 00 00 00 00 00 00 00 3e + + + +;------------------------------------------------------------------------ +; BASIC SUPPORT FUNCTIONs +; peek and poke of the PIA is emulated +; using A2 hardware drivers +;------------------------------------------------------------------------ +;------------------------------------------------------------------------ +; POKE of D012 is emulated by calling +; A2 putchar routine +;------------------------------------------------------------------------ +ACC EQU $ce ; must be same as basic "acc" +A2POKE + JSR getbyte + LDA ACC + PHA + JSR get16bit + LDA #$D0 + CMP ACC+1 + BEQ A2POKE2 +A2POKE1 + PLA + STA (ACC),Y + RTS +A2POKE2 + LDA #$12 + CMP ACC + BNE A2POKE1 +;------------------------------------------------------------------------ +; Poke D012 == A2 ECHO CALL +;------------------------------------------------------------------------ + PLA + JMP ECHO + +;------------------------------------------------------------------------ +; PEEK of D012, D011 and D010 is emulated by using +; equivalent A2 functionality +;------------------------------------------------------------------------ + +A2PEEK + JSR get16bit + LDA #$D0 + CMP ACC+1 + BEQ A2PEEK3 +A2PEEK1 + LDA (ACC),Y +A2PEEK2 + STY syn_stk_l+31,X + JMP push_ya_noun_stk + +;------------------------------------------------------------------------ +; Peek D012 == determine if terminal is ready for output +; in the A2 memory mapped video driver case - the answer +; is always yes -so return positive number(or zero in this case) +;------------------------------------------------------------------------ +A2PEEK3 + LDA #$12 + CMP ACC + BNE A2PEEK4 + LDA #$00 + JMP A2PEEK2 +;------------------------------------------------------------------------ +; Peek D011 == A2 read c000 (does keyboard have char, yes if MSB set) +;------------------------------------------------------------------------ +A2PEEK4 + LDA #$11 + CMP ACC + BNE A2PEEK5 + LDA KBD + JMP A2PEEK2 +;------------------------------------------------------------------------ +; Peek D010 == A2 getchar (also clears strobe) +;------------------------------------------------------------------------ +A2PEEK5 + LDA #$10 + CMP ACC + BNE A2PEEK1 + LDA KBD + STA KBDCR + JMP A2PEEK2 + + IFCONST BLD4RAM + STORAGE + ENDIF + ENDIF ; end of A2 driver code +;------------------------------------------------------------------------ +; VERSION +;------------------------------------------------------------------------ + IFCONST BLD4RAM + ORG $6FFE + ELSE + ORG $DFFE + ENDIF + DC.w $0105 + +;------------------------------------------------------------------------ +; BASIC +;------------------------------------------------------------------------ + INCLUDE a1basic-universal.asm + +;------------------------------------------------------------------------- +; +; The WOZ Monitor for the Apple 1 +; Written by Steve Wozniak 1976 +; +;------------------------------------------------------------------------- + + + IFNCONST BLD4RAM + ORG $FF00 + ENDIF + +;------------------------------------------------------------------------- +; Memory declaration +;------------------------------------------------------------------------- + + + + + +XAML EQU $24 ;Last "opened" location Low +XAMH EQU $25 ;Last "opened" location High +STL EQU $26 ;Store address Low +STH EQU $27 ;Store address High +L EQU $28 ;Hex value parsing Low +H EQU $29 ;Hex value parsing High +YSAV EQU $2A ;Used to see if hex value is given +MODE EQU $2B ;$00=XAM, $7F=STOR, $AE=BLOCK XAM + +IN EQU $0200 ;Input buffer + + IFCONST BLD4APPLE1 +MONDSP EQU $D012 ;PIA.B display output register +MONDSPCR EQU $D013 ;PIA.B display control register + ENDIF + +; KBD b7..b0 are inputs, b6..b0 is ASCII input, b7 is constant high +; Programmed to respond to low to high KBD strobe +; DSP b6..b0 are outputs, b7 is input +; CB2 goes low when data is written, returns high when CB1 goes high +; Interrupts are enabled, though not used. KBD can be jumpered to IRQ, +; whereas DSP can be jumpered to NMI. + + + +;------------------------------------------------------------------------- +; Let's get started +; +; Remark the RESET routine is only to be entered by asserting the RESET +; line of the system. This ensures that the data direction registers +; are selected. +;------------------------------------------------------------------------- + +RESET CLD ;Clear decimal arithmetic mode + CLI + IFNCONST BLD4APPLE1 + JSR INIT ;init display driver + ENDIF + LDY #$7f ;Mask for DSP data direction reg + IFCONST BLD4APPLE1 + STY MONDSP ; (DDR mode is assumed after reset) + ENDIF + LDA #$a7 ;KBD and DSP control register mask + IFCONST BLD4APPLE1 + STA KBDCR ;Enable interrupts, set CA1, CB1 for + STA MONDSPCR ; positive edge sense/output mode. + ELSE + NOP + NOP + NOP + NOP + NOP + NOP + ENDIF + +; Program falls through to the GETLINE routine to save some program bytes +; Please note that Y still holds $7F, which will cause an automatic Escape + +;------------------------------------------------------------------------- +; The GETLINE process +;------------------------------------------------------------------------- + +NOTCR CMP #BS ;Backspace key? + BEQ BACKSPACE ;Yes + CMP #ESC ;ESC? + BEQ ESCAPE ;Yes + INY ;Advance text index + BPL NEXTCHAR ;Auto ESC if line longer than 127 + +ESCAPE LDA #PROMPT ;Print prompt character + JSR ECHO ;Output it. + +GETLINE LDA #CR ;Send CR + JSR ECHO + + LDY #0+1 ;Start a new input line +BACKSPACE DEY ;Backup text index + BMI GETLINE ;Oops, line's empty, reinitialize + +NEXTCHAR + IFCONST BLD4APPLE1 + LDA KBDCR ;Wait for key press + BPL NEXTCHAR ;No key yet! + LDA KBD ;Clear strobe + ELSE + JSR A2GETCHAR + NOP + NOP + NOP + NOP + NOP + ENDIF + STA IN,Y ;Add to text buffer + JSR ECHO ;Display character + CMP #CR + BNE NOTCR ;It's not CR! + +; Line received, now let's parse it + + LDY #-1 ;Reset text index + LDA #0 ;Default mode is XAM + TAX ;X=0 + +SETSTOR ASL ;Leaves $7B if setting STOR mode + +SETMODE STA MODE ;Set mode flags + +BLSKIP INY ;Advance text index + +NEXTITEM LDA IN,Y ;Get character + CMP #CR + BEQ GETLINE ;We're done if it's CR! + CMP #$AE ;"." + BCC BLSKIP ;Ignore everything below "."! + BEQ SETMODE ;Set BLOCK XAM mode ("." = $AE) + CMP #$BA ;":" + BEQ SETSTOR ;Set STOR mode! $BA will become $7B + CMP #$d2 ;"R" + BEQ RUN ;Run the program! Forget the rest + STX L ;Clear input value (X=0) + STX H + STY YSAV ;Save Y for comparison + +; Here we're trying to parse a new hex value + +NEXTHEX LDA IN,Y ;Get character for hex test + EOR #$B0 ;Map digits to 0-9 + CMP #9+1 ;Is it a decimal digit? + BCC DIG ;Yes! + ADC #$88 ;Map letter "A"-"F" to $FA-FF + CMP #$FA ;Hex letter? + BCC NOTHEX ;No! Character not hex + +DIG ASL + ASL ;Hex digit to MSD of A + ASL + ASL + + LDX #4 ;Shift count +HEXSHIFT ASL ;Hex digit left, MSB to carry + ROL L ;Rotate into LSD + ROL H ;Rotate into MSD's + DEX ;Done 4 shifts? + BNE HEXSHIFT ;No, loop + INY ;Advance text index + BNE NEXTHEX ;Always taken + +NOTHEX CPY YSAV ;Was at least 1 hex digit given? + BEQ ESCAPE ;No! Ignore all, start from scratch + + BIT MODE ;Test MODE byte + BVC NOTSTOR ;B6=0 is STOR, 1 is XAM or BLOCK XAM + +; STOR mode, save LSD of new hex byte + + LDA L ;LSD's of hex data + STA (STL,X) ;Store current 'store index'(X=0) + INC STL ;Increment store index. + BNE NEXTITEM ;No carry! + INC STH ;Add carry to 'store index' high +TONEXTITEM JMP NEXTITEM ;Get next command item. + +;------------------------------------------------------------------------- +; RUN user's program from last opened location +;------------------------------------------------------------------------- + +RUN JMP (XAML) ;Run user's program + +;------------------------------------------------------------------------- +; We're not in Store mode +;------------------------------------------------------------------------- + +NOTSTOR BMI XAMNEXT ;B7 = 0 for XAM, 1 for BLOCK XAM + +; We're in XAM mode now + + LDX #2 ;Copy 2 bytes +SETADR LDA L-1,X ;Copy hex data to + STA STL-1,X ; 'store index' + STA XAML-1,X ; and to 'XAM index' + DEX ;Next of 2 bytes + BNE SETADR ;Loop unless X = 0 + +; Print address and data from this address, fall through next BNE. + +NXTPRNT BNE PRDATA ;NE means no address to print + LDA #CR ;Print CR first + JSR ECHO + LDA XAMH ;Output high-order byte of address + JSR PRBYTE + LDA XAML ;Output low-order byte of address + JSR PRBYTE + LDA #":" ;Print colon + JSR ECHO + +PRDATA LDA #" " ;Print space + JSR ECHO + LDA (XAML,X) ;Get data from address (X=0) + JSR PRBYTE ;Output it in hex format +XAMNEXT STX MODE ;0 -> MODE (XAM mode). + LDA XAML ;See if there's more to print + CMP L + LDA XAMH + SBC H + BCS TONEXTITEM ;Not less! No more data to output + + INC XAML ;Increment 'examine index' + BNE MOD8CHK ;No carry! + INC XAMH + +MOD8CHK LDA XAML ;If address MOD 8 = 0 start new line + AND #$07 + BPL NXTPRNT ;Always taken. + +;------------------------------------------------------------------------- +; Subroutine to print a byte in A in hex form (destructive) +;------------------------------------------------------------------------- + +PRBYTE PHA ;Save A for LSD + LSR + LSR + LSR ;MSD to LSD position + LSR + JSR PRHEX ;Output hex digit + PLA ;Restore A + +; Fall through to print hex routine + +;------------------------------------------------------------------------- +; Subroutine to print a hexadecimal digit +;------------------------------------------------------------------------- + +PRHEX AND #$0F ;Mask LSD for hex print + ORA #"0" ;Add "0" + CMP #"9"+1 ;Is it a decimal digit? + BCC ECHO ;Yes! output it + ADC #6 ;Add offset for letter A-F + +; Fall through to print routine + +;------------------------------------------------------------------------- +; Subroutine to print a character to the terminal +;------------------------------------------------------------------------- +ECHO + IFCONST BLD4APPLE1 + BIT MONDSP ;DA bit (B7) cleared yet? + BMI ECHO ;No! Wait for display ready + STA MONDSP ;Output character. Sets DA + RTS + ELSE + CMP #$20 + BMI ECHO1 + ORA #$80 +ECHO1 + JMP PUTCH ; use hi-res screen + ENDIF + +;------------------------------------------------------------------------- +; Vector area +;------------------------------------------------------------------------- + IFNCONST BLD4RAM + ORG $fff8 + DC.W $0000 ;Unused, what a pity +NMI_VEC DC.W $0F00 ;NMI vector +RESET_VEC DC.W RESET ;RESET vector +IRQ_VEC DC.W $0000 ;IRQ vector + ENDIF + +;------------------------------------------------------------------------- + + diff --git a/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.lst b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.lst new file mode 100644 index 0000000..a2a2a49 --- /dev/null +++ b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.lst @@ -0,0 +1,4242 @@ +------- FILE a2a1emulv5_1.asm LEVEL 1 PASS 2 + 1 10000 PROCESSOR 6502 + 2 10000 ???? LIST ON + 3 10000 ???? ; + 4 10000 ???? ;-----------------------------------------------------------------------; + 5 10000 ???? ; The Wozanium Pack ; + 6 10000 ???? ; This file is part one of the Wozanium Pack. ; + 7 10000 ???? ; Apple 1 basic is the other part ; + 8 10000 ???? ;-----------------------------------------------------------------------; + 9 10000 ???? ; Copyright 2010,2011 Mike Willegal + 10 10000 ???? ; A1 monitor and A1 apple cassette interface derived from + 11 10000 ???? ; original Apple 1 implemenations by Steve Wozniak + 12 10000 ???? ; + 13 10000 ???? ; The Wozanium Pack is free software: + 14 10000 ???? ; you can redistribute it and/or modify + 15 10000 ???? ; it under the terms of the GNU General Public License as published by + 16 10000 ???? ; the Free Software Foundation, either version 3 of the License, or + 17 10000 ???? ; (at your option) any later version. + 18 10000 ???? ; + 19 10000 ???? ; The Wozanium Pack is distributed in the hope that it will be useful, + 20 10000 ???? ; but WITHOUT ANY WARRANTY; without even the implied warranty of + 21 10000 ???? ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + 22 10000 ???? ; GNU General Public License for more details. + 23 10000 ???? ; + 24 10000 ???? ; You should have received a copy of the GNU General Public License + 25 10000 ???? ; along with the Wozanium Pack. If not, see . + 26 10000 ???? ; + 27 10000 ???? ;-----------------------------------------------------------------------; + 28 10000 ???? ;------------------------------------------------------------------------- + 29 10000 ???? ; Defines - this code can be built one of four ways + 30 10000 ???? ; 1. clone/real Apple 1 HW + 31 10000 ???? ; 2. runs in ram of real or virtual Apple 2 + 32 10000 ???? ; 3. runs in virtual apple 2 as ROM + 33 10000 ???? ; 4. runs in plug in board of real Apple 2 + 34 10000 ???? ; + 35 10000 ???? ; select one of these three options + 36 10000 ???? ;------------------------------------------------------------------------- + 37 10000 ???? ; Build with dasm 6502 assembler and the following command line + 38 10000 ???? ;dasm a2a1emulv5_1.asm -DBLD4ROMBD=0 -DHUSTNBASIC=0 -oa2a1rbh.o -la2a1rbh.lst + 39 10000 ???? ; + 40 10000 ???? + 41 10000 ???? ;BLD4APPLE1 EQU 0 ;ACTUAL APPLE 1 or CLONE + 42 10000 ???? ;BLD4RAM EQU 0 ;RAM of virtual or real A2 + 43 10000 ???? ;BLD4EMULROM EQU 0 ;ROM of virtual A2 + 44 10000 ???? ;BLD4ROMBD EQU 0 ;ROM board in Real A2 + 45 10000 ???? + 46 10000 ???? ;------------------------------------------------------------------------- + 47 10000 ???? ; Constants + 48 10000 ???? ;------------------------------------------------------------------------- + 49 10000 ???? + 50 10000 ???? 00 df BS EQU $DF ;Backspace key, arrow left key + 51 10000 ???? 00 8d CR EQU $8D ;Carriage Return + 52 10000 ???? 00 9b ESC EQU $9B ;ESC key + 53 10000 ???? 00 5c PROMPT EQU "\" ;Prompt character + 54 10000 ???? + 55 10000 ???? ;------------------------------------------------------------------------- + 56 10000 ???? ; scratchpad memory - uses last 1k of apple ii 48k + 57 10000 ???? ;------------------------------------------------------------------------- + 58 10000 ???? MAC storage + 59 10000 ???? TURBO DS.b 1 ; any bit non-zero is turbo mode + 60 10000 ???? TURBOUSR EQU $01 ; USER TURBO MODE + 61 10000 ???? TURBOCMP EQU $02 ; COMPUTER DRIVEN TURBO MODE + 62 10000 ???? + 63 10000 ???? RDCONVERT DS.b 1 + 64 10000 ???? READVECTOR DS.w 1 ;allows user override of default keyboard read function + 65 10000 ???? WRITVECTOR DS.w 1 ;allows user override of default video out function + 66 10000 ???? + 67 10000 ???? savey DS.b 1 + 68 10000 ???? savex DS.b 1 + 69 10000 ???? POWERUPINIT DS.b 1 + 70 10000 ???? SCRNCLRD DS.b 1 + 71 10000 ???? CHAR DS.b 1 + 72 10000 ???? TMP1 DS.b 1 + 73 10000 ???? CURROW DS.b 1 + 74 10000 ???? CURCOL DS.b 1 + 75 10000 ???? COUNTER0 DS.b 1 + 76 10000 ???? COUNTER1 DS.b 1 + 77 10000 ???? CURSOR DS.b 1 + 78 10000 ???? RDSTRTL DS.b 1 + 79 10000 ???? RDSTRTH DS.b 1 + 80 10000 ???? HEX2LB DS.b 1 ;Begin address of dump block + 81 10000 ???? HEX2HB DS.b 1 + 82 10000 ???? + 83 10000 ???? ;;; zero page back up so graphics routines can use them + 84 10000 ???? TMPG0 DS.b 16 + 85 10000 ???? PG0SAVD DS.b 1 + 86 10000 ???? ENDM + 87 10000 ???? IFNCONST BLD4APPLE1 + 88 10000 ???? IFNCONST BLD4RAM + 89 bc00 ORG $bc00 + 0 bc00 STORAGE + 1 bc00 00 TURBO DS.b 1 + 2 bc00 00 01 TURBOUSR EQU $01 + 3 bc00 00 02 TURBOCMP EQU $02 + 4 bc01 + 5 bc01 00 RDCONVERT DS.b 1 + 6 bc02 00 00 READVECTOR DS.w 1 + 7 bc04 00 00 WRITVECTOR DS.w 1 + 8 bc06 + 9 bc06 00 savey DS.b 1 + 10 bc07 00 savex DS.b 1 + 11 bc08 00 POWERUPINIT DS.b 1 + 12 bc09 00 SCRNCLRD DS.b 1 + 13 bc0a 00 CHAR DS.b 1 + 14 bc0b 00 TMP1 DS.b 1 + 15 bc0c 00 CURROW DS.b 1 + 16 bc0d 00 CURCOL DS.b 1 + 17 bc0e 00 COUNTER0 DS.b 1 + 18 bc0f 00 COUNTER1 DS.b 1 + 19 bc10 00 CURSOR DS.b 1 + 20 bc11 00 RDSTRTL DS.b 1 + 21 bc12 00 RDSTRTH DS.b 1 + 22 bc13 00 HEX2LB DS.b 1 + 23 bc14 00 HEX2HB DS.b 1 + 24 bc15 + 25 bc15 + 26 bc15 00 00 00 00*TMPG0 DS.b 16 + 27 bc25 00 PG0SAVD DS.b 1 + 91 bc26 ENDIF + 92 bc26 ENDIF + 93 bc26 + 94 bc26 + 95 bc26 + 96 bc26 + 97 bc26 + 98 bc26 + 99 bc26 ;------------------------------------------------------------------------- + 100 bc26 ; Memory declaration + 101 bc26 ;------------------------------------------------------------------------- + 102 bc26 + 103 bc26 + 104 bc26 00 24 HEX1L EQU $24 ;End address of dump block + 105 bc26 00 25 HEX1H EQU $25 + 106 bc26 00 26 HEX2L EQU $26 ;Begin address of dump block + 107 bc26 00 27 HEX2H EQU $27 + 108 bc26 + 109 bc26 00 28 SAVEINDEX EQU $28 ;Save index in input buffer + 110 bc26 00 29 LASTSTATE EQU $29 ;Last input state + 111 bc26 + 112 bc26 02 00 IN EQU $0200 ;Input buffer + 113 bc26 - IFCONST BLD4APPLE1 + 114 bc26 -FLIP EQU $C000 ;Output flip-flop + 115 bc26 -TAPEIN EQU $C081 ;Tape input + 116 bc26 -KBD EQU $D010 ;PIA.A keyboard input + 117 bc26 -KBDCR EQU $D011 ;PIA.A keyboard control register + 118 bc26 ELSE + 119 bc26 c0 20 FLIP EQU $C020 ;Output flip-flop + 120 bc26 c0 60 TAPEIN EQU $C060 ;Tape input + 121 bc26 c0 00 KBD EQU $C000 ;keyboard input + 122 bc26 c0 10 KBDCR EQU $C010 ;keybaord strobe clear + 123 bc26 ENDIF + 124 bc26 + 125 bc26 ;------------------------------------------------------------------------- + 126 bc26 ; Constants + 127 bc26 ;------------------------------------------------------------------------- + 128 bc26 + 129 bc26 00 8d CR EQU $8D ;Carriage Return + 130 bc26 00 9b ESC EQU $9B ;ASCII ESC + 131 bc26 00 e0 CNTSTRT EQU $E0 + 132 bc26 + 133 bc26 ;--------------------------------------------------------------------------- + 134 bc26 ; build in ACI Driver + 135 bc26 ;--------------------------------------------------------------------------- + 136 bc26 - IFCONST BLD4EMULROM + 137 bc26 - ORG $D000 ; EMULATOR ROM image + 138 bc26 ELSE + 139 bc26 - IFCONST BLD4RAM + 140 bc26 - ORG $6000 ; build for memory + 141 bc26 ELSE + 142 c100 ORG $C100 ; real apple 1 or plug in ROM board for A2 + 143 c100 ENDIF + 144 c100 ENDIF + 145 c100 + 146 c100 ;------------------------------------------------------------------------- + 147 c100 ; + 148 c100 ; The WOZ Apple Cassette Interface for the Apple 1 + 149 c100 ; Written by Steve Wozniak somewhere around 1976 + 150 c100 ; + 151 c100 ;------------------------------------------------------------------------- + 152 c100 WOZACI + 153 c100 + 154 c100 a9 aa LDA #$aa ;Print the Tape prompt + 155 c102 IFNCONST BLD4APPLE1 + 156 c102 4c 00 d0 JMP A2ACIDRIVER ;If not actual Apple 1, use A2 driver + 157 c105 - ELSE + 158 c105 - JSR ECHO + 159 c105 ENDIF + 160 c105 a9 8d LDA #CR ;And drop the cursor one line + 161 c107 20 ef ff JSR ECHO + 162 c10a + 163 c10a a0 ff LDY #-1 ;Reset the input buffer index + 164 c10c c8 ACINEXTCHAR INY + 165 c10d + 166 c10d + 167 c10d ad 10 c0 ACIWAITCHAR LDA KBDCR ;Wait for key press + 168 c110 10 fb BPL ACIWAITCHAR ;No key yet! + 169 c112 ad 00 c0 LDA KBD ;Clear strobe + 170 c115 99 00 02 STA IN,Y ;Save it into buffer + 171 c118 20 ef ff JSR ECHO ;And type it on the screen + 172 c11b c9 9b CMP #ESC + 173 c11d f0 e1 BEQ WOZACI ;Start from scratch if ESC! + 174 c11f c9 8d CMP #CR + 175 c121 d0 e9 BNE ACINEXTCHAR ;Read keys until CR + 176 c123 + 177 c123 a2 ff LDX #-1 ;Initialize parse buffer pointer + 178 c125 + 179 c125 ;------------------------------------------------------------------------- + 180 c125 ; Start parsing first or a new tape command + 181 c125 ;------------------------------------------------------------------------- + 182 c125 + 183 c125 a9 00 NEXTCMD LDA #0 ;Clear begin and end values + 184 c127 85 24 STA HEX1L + 185 c129 85 25 STA HEX1H + 186 c12b 85 26 STA HEX2L + 187 c12d 85 27 STA HEX2H + 188 c12f + 189 c12f e8 NEXTCHR INX ;Increment input pointer + 190 c130 bd 00 02 LDA IN,X ;Get next char from input line + 191 c133 c9 d2 CMP #$d2 ;Read command? + 192 c135 f0 56 BEQ READ ;Yes! + 193 c137 c9 d7 CMP #$d7 ;Write command? + 194 c139 f0 35 BEQ WRITE ;Yes! (note: CY=1) + 195 c13b c9 ae CMP #$ae ;Separator? + 196 c13d f0 27 BEQ SEP ;Yes! + 197 c13f c9 8d CMP #CR ;End of line? + 198 c141 f0 20 BEQ GOESC ;Escape to monitor! We're done + 199 c143 c9 a0 CMP #$a0 ;Ignore spaces + 200 c145 f0 e8 BEQ NEXTCHR + 201 c147 49 b0 EOR #$b0 ;Map digits to 0-9 + 202 c149 c9 0a CMP #9+1 ;Is it a decimal digit? + 203 c14b 90 06 BCC ACIDIG ;Yes! + 204 c14d 69 88 ADC #$88 ;Map letter "A"-"F" to $FA-$FF + 205 c14f c9 fa CMP #$FA ;Hex letter? + 206 c151 90 ad BCC WOZACI ;No! Character not hex! + 207 c153 + 208 c153 0a ACIDIG ASL ;Hex digit to MSD of A + 209 c154 0a ASL + 210 c155 0a ASL + 211 c156 0a ASL + 212 c157 + 213 c157 a0 04 LDY #4 ;Shift count + 214 c159 0a ACIHEXSHIFT ASL ;Hex digit left, MSB to carry + 215 c15a 26 24 ROL HEX1L ;Rotate into LSD + 216 c15c 26 25 ROL HEX1H ;Rotate into MSD + 217 c15e 88 DEY ;Done 4 shifts? + 218 c15f d0 f8 BNE ACIHEXSHIFT ;No! Loop + 219 c161 f0 cc BEQ NEXTCHR ;Handle next character + 220 c163 + 221 c163 ;------------------------------------------------------------------------- + 222 c163 ; Return to monitor, prints \ first + 223 c163 ;------------------------------------------------------------------------- + 224 c163 + 225 c163 4c 1a ff GOESC JMP ESCAPE ;Escape back to monitor + 226 c166 + 227 c166 ;------------------------------------------------------------------------- + 228 c166 ; Separating . found. Copy HEX1 to Hex2. Doesn't clear HEX1!!! + 229 c166 ;------------------------------------------------------------------------- + 230 c166 + 231 c166 a5 24 SEP LDA HEX1L ;Copy hex value 1 to hex value 2 + 232 c168 85 26 STA HEX2L + 233 c16a a5 25 LDA HEX1H + 234 c16c 85 27 STA HEX2H + 235 c16e b0 bf BCS NEXTCHR ;Always taken! + 236 c170 + 237 c170 ;------------------------------------------------------------------------- + 238 c170 ; Write a block of memory to tape + 239 c170 ;------------------------------------------------------------------------- + 240 c170 + 241 c170 WRITE + 242 c170 a9 40 LDA #64 ;Write 10 second header + 243 c172 20 cc c1 JSR WHEADER + 244 c175 88 WRNEXT DEY ;Compensate timing for extra work + 245 c176 a2 00 LDX #0 ;Get next byte to write + 246 c178 a1 26 LDA (HEX2L,X) + 247 c17a + 248 c17a a2 10 LDX #8*2 ;Shift 8 bits (decremented twice) + 249 c17c 0a WBITLOOP ASL ;Shift MSB to carry + 250 c17d 20 db c1 JSR WRITEBIT ;Write this bit + 251 c180 d0 fa BNE WBITLOOP ;Do all 8 bits! + 252 c182 + 253 c182 20 f1 c1 JSR INCADDR ;Increment address + 254 c185 a0 1e LDY #30 ;Compensate timer for extra work + 255 c187 90 ec BCC WRNEXT ;Not done yet! Write next byte + 256 c189 + 257 c189 RESTIDX + 258 c189 a6 28 LDX SAVEINDEX ;Restore index in input line + 259 c18b b0 98 BCS NEXTCMD ;Always taken! + 260 c18d + 261 c18d ;------------------------------------------------------------------------- + 262 c18d ; For case when ACI must fit in c100-c1ff - the read function must be moved + 263 c18d ; because the standard read doesn't fit with the extra mask instruction + 264 c18d ; required for the Apple II hardware + 265 c18d ;------------------------------------------------------------------------- + 266 c18d + 267 c18d READ + 268 c18d 20 bc c1 JSR FULLCYCLE ;Wait until full cycle is detected + 269 c190 a9 16 LDA #22 ;Introduce some delay to allow + 270 c192 20 cc c1 JSR WHEADER ; the tape speed to stabilize + 271 c195 20 bc c1 JSR FULLCYCLE ;Synchronize with full cycle + 272 c198 NOTSTART + 273 c198 a0 1f LDY #31 ;Try to detect the much shorter + 274 c19a 20 bf c1 JSR CMPLEVEL ; start bit + 275 c19d b0 f9 BCS NOTSTART ;Start bit not detected yet! + 276 c19f 20 bf c1 JSR CMPLEVEL ;Wait for 2nd phase of start bit + 277 c1a2 + 278 c1a2 a0 3a LDY #58 ;Set threshold value in middle + 279 c1a4 a2 08 RDBYTE LDX #8 ;Receiver 8 bits + 280 c1a6 48 RDBIT PHA + 281 c1a7 20 bc c1 JSR FULLCYCLE ;Detect a full cycle + 282 c1aa 68 PLA + 283 c1ab 2a ROL ;Roll new bit into result + 284 c1ac a0 39 LDY #57 ;Set threshold value in middle + 285 c1ae ca DEX ;Decrement bit counter + 286 c1af d0 f5 BNE RDBIT ;Read next bit! + 287 c1b1 81 26 STA (HEX2L,X) ;Save new byte + 288 c1b3 + 289 c1b3 20 f1 c1 JSR INCADDR ;Increment address + 290 c1b6 a0 35 LDY #53 ;Compensate threshold with workload + 291 c1b8 90 ea BCC RDBYTE ;Do next byte if not done yet! + 292 c1ba b0 cd BCS RESTIDX ;Always taken! Restore parse index + 293 c1bc + 294 c1bc 20 bf c1 FULLCYCLE JSR CMPLEVEL ;Wait for two level changes + 295 c1bf 88 CMPLEVEL DEY ;Decrement time counter + 296 c1c0 ad 60 c0 LDA TAPEIN ;Get Tape In data + 297 c1c3 + 298 c1c3 ;------------------------------------------------------------------------- + 299 c1c3 ; the next instruction must be added for apple II + 300 c1c3 ; since it doesn't fit in the 256 bytes allowed in the + 301 c1c3 ; original PROM, a substitute A2 read function is called instead + 302 c1c3 ; (READ_APPLE2_VERSION)which is located in a different bank + 303 c1c3 ; + 304 c1c3 ; AND #$80 ;CLEAR floating bits + 305 c1c3 ;------------------------------------------------------------------------- + 306 c1c3 c5 29 CMP LASTSTATE ;Same as before? + 307 c1c5 f0 f8 BEQ CMPLEVEL ;Yes! + 308 c1c7 85 29 STA LASTSTATE ;Save new data + 309 c1c9 + 310 c1c9 c0 80 CPY #128 ;Compare threshold + 311 c1cb 60 RTS + 312 c1cc ;------------------------------------------------------------------------- + 313 c1cc ; Write header to tape + 314 c1cc ; + 315 c1cc ; The header consists of an asymmetric cycle, starting with one phase of + 316 c1cc ; approximately (66+47)x5=565us, followed by a second phase of + 317 c1cc ; approximately (44+47)x5=455us. + 318 c1cc ; Total cycle duration is approximately 1020us ~ 1kHz. The actual + 319 c1cc ; frequencywill be a bit lower because of the additional workload between + 320 c1cc ; the twoloops. + 321 c1cc ; The header ends with a short phase of (30+47)x5=385us and a normal + 322 c1cc ; phase of (44+47)x5=455us. This start bit must be detected by the read + 323 c1cc ; routine to trigger the reading of the actual data. + 324 c1cc ;------------------------------------------------------------------------- + 325 c1cc + 326 c1cc 86 28 WHEADER STX SAVEINDEX ;Save index in input line + 327 c1ce a0 42 HCOUNT LDY #66 ;Extra long delay + 328 c1d0 20 e0 c1 JSR WDELAY ;CY is constantly 1, writing a 1 + 329 c1d3 d0 f9 BNE HCOUNT ;Do this 64 * 256 time! + 330 c1d5 69 fe ADC #-2 ;Decrement A (CY=1 all the time) + 331 c1d7 b0 f5 BCS HCOUNT ;Not all done! + 332 c1d9 a0 1e LDY #30 ;Write a final short bit (start) + 333 c1db + 334 c1db ;------------------------------------------------------------------------- + 335 c1db ; Write a full bit cycle + 336 c1db ; + 337 c1db ; Upon entry Y contains a compensated value for the first phase of 0 + 338 c1db ; bit length. All subsequent loops don't have to be time compensated. + 339 c1db ;------------------------------------------------------------------------- + 340 c1db + 341 c1db 20 e0 c1 WRITEBIT JSR WDELAY ;Do two equal phases + 342 c1de a0 2c LDY #44 ;Load 250us counter - compensation + 343 c1e0 + 344 c1e0 88 WDELAY DEY ;Delay 250us (one phase of 2kHz) + 345 c1e1 d0 fd BNE WDELAY + 346 c1e3 90 05 BCC WRITE1 ;Write a '1' (2kHz) + 347 c1e5 + 348 c1e5 a0 2f LDY #47 ;Additional delay for '0' (1kHz) + 349 c1e7 88 WDELAY0 DEY ; (delay 250us) + 350 c1e8 d0 fd BNE WDELAY0 + 351 c1ea + 352 c1ea WRITE1 + 353 c1ea bc 20 c0 LDY FLIP,X ;Flip the output bit + 354 c1ed a0 29 LDY #41 ;Reload 250us cntr (compensation) + 355 c1ef ca DEX ;Decrement bit counter + 356 c1f0 60 RTS + 357 c1f1 + 358 c1f1 ;------------------------------------------------------------------------- + 359 c1f1 ; Increment current address and compare with last address + 360 c1f1 ;------------------------------------------------------------------------- + 361 c1f1 a5 26 INCADDR LDA HEX2L ;Compare current address with + 362 c1f3 c5 24 CMP HEX1L ; end address + 363 c1f5 a5 27 LDA HEX2H + 364 c1f7 e5 25 SBC HEX1H + 365 c1f9 e6 26 INC HEX2L ;And increment current address + 366 c1fb d0 02 BNE NOCARRY ;No carry to MSB! + 367 c1fd e6 27 INC HEX2H + 368 c1ff 60 NOCARRY RTS + 369 c200 + 370 c200 + 371 c200 ;--------------------------------------------------------------------------- + 372 c200 ; all the following code is needed for the A2 version + 373 c200 ; skip to Basic for the real thing + 374 c200 ;--------------------------------------------------------------------------- + 375 c200 IFNCONST BLD4APPLE1 + 376 c200 ;--------------------------------------------------------------------------- + 377 c200 ; build in an A2 ACI driver for ROM version + 378 c200 ; if using an A2, the version at C100 jumps to this version + 379 c200 ; and this version is at D000 (so slots 0 & 2-7 can be used) + 380 c200 ;--------------------------------------------------------------------------- + 381 c200 IFNCONST BLD4EMULROM + 382 c200 IFNCONST BLD4RAM + 383 d000 ORG $D000 ; A2 ROM or image + 384 d000 ENDIF + 385 d000 ENDIF + 386 d000 + 387 d000 ;------------------------------------------------------------------------- + 388 d000 ; ACI DRIVER + 389 d000 ;------------------------------------------------------------------------- + 390 d000 A2ACIDRIVER + 391 d000 a9 aa LDA #$aa ;Print the Tape prompt + 392 d002 20 ef ff JSR ECHO + 393 d005 a9 8d LDA #CR ;And drop the cursor one line + 394 d007 20 ef ff JSR ECHO + 395 d00a + 396 d00a a0 ff LDY #-1 ;Reset the input buffer index + 397 d00c RB_ACINEXTCHAR + 398 d00c c8 INY + 399 d00d + 400 d00d 20 4d d2 JSR A2GETCHAR + 401 d010 + 402 d010 99 00 02 STA IN,Y ;Save it into buffer + 403 d013 20 ef ff JSR ECHO ;And type it on the screen + 404 d016 c9 9b CMP #ESC + 405 d018 f0 e6 BEQ A2ACIDRIVER ;Start from scratch if ESC! + 406 d01a c9 8d CMP #CR + 407 d01c d0 ee BNE RB_ACINEXTCHAR ;Read keys until CR + 408 d01e + 409 d01e a2 ff LDX #-1 ;Initialize parse buffer pointer + 410 d020 + 411 d020 ;------------------------------------------------------------------------- + 412 d020 ; Start parsing first or a new tape command + 413 d020 ;------------------------------------------------------------------------- + 414 d020 + 415 d020 RB_NEXTCMD + 416 d020 a9 00 LDA #0 ;Clear begin and end values + 417 d022 85 24 STA HEX1L + 418 d024 85 25 STA HEX1H + 419 d026 85 26 STA HEX2L + 420 d028 85 27 STA HEX2H + 421 d02a + 422 d02a RB_NEXTCHR + 423 d02a e8 INX ;Increment input pointer + 424 d02b bd 00 02 LDA IN,X ;Get next char from input line + 425 d02e c9 d2 CMP #$d2 ;Read command? + 426 d030 f0 69 BEQ RB_READ ;Yes! + 427 d032 c9 d7 CMP #$d7 ;Write command? + 428 d034 f0 35 BEQ RB_WRITE ;Yes! (note: CY=1) + 429 d036 c9 ae CMP #$ae ;Separator? + 430 d038 f0 27 BEQ RB_SEP ;Yes! + 431 d03a c9 8d CMP #CR ;End of line? + 432 d03c f0 20 BEQ RB_GOESC ;Escape to monitor! We're done + 433 d03e c9 a0 CMP #$a0 ;Ignore spaces + 434 d040 f0 e8 BEQ RB_NEXTCHR + 435 d042 49 b0 EOR #$b0 ;Map digits to 0-9 + 436 d044 c9 0a CMP #9+1 ;Is it a decimal digit? + 437 d046 90 06 BCC RB_ACIDIG ;Yes! + 438 d048 69 88 ADC #$88 ;Map letter "A"-"F" to $FA-$FF + 439 d04a c9 fa CMP #$FA ;Hex letter? + 440 d04c 90 b2 BCC A2ACIDRIVER ;No! Character not hex! + 441 d04e + 442 d04e RB_ACIDIG + 443 d04e 0a ASL ;Hex digit to MSD of A + 444 d04f 0a ASL + 445 d050 0a ASL + 446 d051 0a ASL + 447 d052 + 448 d052 a0 04 LDY #4 ;Shift count + 449 d054 RB_ACIHEXSHIFT + 450 d054 0a ASL ;Hex digit left, MSB to carry + 451 d055 26 24 ROL HEX1L ;Rotate into LSD + 452 d057 26 25 ROL HEX1H ;Rotate into MSD + 453 d059 88 DEY ;Done 4 shifts? + 454 d05a d0 f8 BNE RB_ACIHEXSHIFT ;No! Loop + 455 d05c f0 cc BEQ RB_NEXTCHR ;Handle next character + 456 d05e + 457 d05e ;------------------------------------------------------------------------- + 458 d05e ; Return to monitor, prints \ first + 459 d05e ;------------------------------------------------------------------------- + 460 d05e + 461 d05e 4c 1a ff RB_GOESC JMP ESCAPE ;Escape back to monitor + 462 d061 + 463 d061 ;------------------------------------------------------------------------- + 464 d061 ; Separating . found. Copy HEX1 to Hex2. Doesn't clear HEX1!!! + 465 d061 ;------------------------------------------------------------------------- + 466 d061 + 467 d061 a5 24 RB_SEP LDA HEX1L ;Copy hex value 1 to hex value 2 + 468 d063 85 26 STA HEX2L + 469 d065 a5 25 LDA HEX1H + 470 d067 85 27 STA HEX2H + 471 d069 b0 bf BCS RB_NEXTCHR ;Always taken! + 472 d06b + 473 d06b ;------------------------------------------------------------------------- + 474 d06b ; Write a block of memory to tape + 475 d06b ;------------------------------------------------------------------------- + 476 d06b + 477 d06b RB_WRITE + 478 d06b ;------------------------------------------------------------------------- + 479 d06b ; save write start addresses + 480 d06b ; so we can check for keyboard + 481 d06b ; or console write sequences + 482 d06b ; and dynamicly modify code to + 483 d06b ; use original A1 driver + 484 d06b ; and then revert later on + 485 d06b ;------------------------------------------------------------------------- + 486 d06b a5 26 LDA HEX2L + 487 d06d 8d 11 bc STA RDSTRTL + 488 d070 a5 27 LDA HEX2H + 489 d072 8d 12 bc STA RDSTRTH + 490 d075 86 28 STX SAVEINDEX ;Save index in input line + 491 d077 20 ce d1 JSR A2_WRITECONVERT ; convert I/O to A1 compatible format + 492 d07a ;------------------------------------------------------------------------- + 493 d07a ; now start write of this block + 494 d07a ;------------------------------------------------------------------------- + 495 d07a + 496 d07a a9 40 LDA #64 ;Write 10 second header + 497 d07c 20 d7 d0 JSR RB_WHEADER + 498 d07f + 499 d07f 88 RB_WRNEXT DEY ;Compensate timing for extra work + 500 d080 a2 00 LDX #0 ;Get next byte to write + 501 d082 a1 26 LDA (HEX2L,X) + 502 d084 + 503 d084 a2 10 LDX #8*2 ;Shift 8 bits (decremented twice) + 504 d086 0a RB_WBITLOOP ASL ;Shift MSB to carry + 505 d087 20 e4 d0 JSR RB_WRITEBIT ;Write this bit + 506 d08a d0 fa BNE RB_WBITLOOP ;Do all 8 bits! + 507 d08c + 508 d08c 20 0c d1 JSR A2_INCADDR ;Increment address + 509 d08f a0 1e LDY #30 ;Compensate timer for extra work + 510 d091 90 ec BCC RB_WRNEXT ;Not done yet! Write next byte + 511 d093 + 512 d093 RB_RESTIDX + 513 d093 20 1b d1 JSR A2_READCONVERT ; convert buffer to A2 I/O + 514 d096 a6 28 LDX SAVEINDEX ;Restore index in input line + 515 d098 4c 20 d0 JMP RB_NEXTCMD ;Always taken! + 516 d09b + 517 d09b ;------------------------------------------------------------------------- + 518 d09b ; For case when ACI must fit in c100-c1ff - the read function must be moved + 519 d09b ; because the standard read doesn't fit with the extra mask instruction + 520 d09b ; required for the Apple II hardware + 521 d09b ;------------------------------------------------------------------------- + 522 d09b + 523 d09b RB_READ + 524 d09b ;------------------------------------------------------------------------- + 525 d09b ; save read start addresses + 526 d09b ; so we can check for keyboard + 527 d09b ; or console write sequences + 528 d09b ; and dynamicly modify code to + 529 d09b ; use A2 driver + 530 d09b ;------------------------------------------------------------------------- + 531 d09b a5 26 LDA HEX2L + 532 d09d 8d 11 bc STA RDSTRTL + 533 d0a0 a5 27 LDA HEX2H + 534 d0a2 8d 12 bc STA RDSTRTH + 535 d0a5 + 536 d0a5 20 fa d0 JSR A2_FULLCYCLE ;Wait until full cycle is detected + 537 d0a8 86 28 STX SAVEINDEX ;Save index in input line + 538 d0aa a9 16 LDA #22 ;Introduce some delay to allow + 539 d0ac 20 d7 d0 JSR RB_WHEADER ; the tape speed to stabilize + 540 d0af + 541 d0af ;------------------------------------------------------------------------- + 542 d0af ; + 543 d0af ; This read function will optionally convert and A1 keyboard reads + 544 d0af ; to calls to use our driver to read from A2 hardware by scanning + 545 d0af ; read data looking for one of three code sequences + 546 d0af ;------------------------------------------------------------------------- + 547 d0af ; + 548 d0af ; Normal start + 549 d0af ; + 550 d0af 20 fa d0 JSR A2_FULLCYCLE ;Synchronize with full cycle + 551 d0b2 a0 1c A2_NOTSTART LDY #28 ;Try to detect the much shorter + 552 d0b4 20 fd d0 JSR A2_CMPLEVEL ; start bit + 553 d0b7 b0 f9 BCS A2_NOTSTART ;Start bit not detected yet! + 554 d0b9 20 fd d0 JSR A2_CMPLEVEL ;Wait for 2nd phase of start bit + 555 d0bc + 556 d0bc a0 35 LDY #53 ;Set threshold value in middle + 557 d0be a2 08 A2_RDBYTE LDX #8 ;Receiver 8 bits + 558 d0c0 48 A2_RDBIT PHA + 559 d0c1 20 fa d0 JSR A2_FULLCYCLE ;Detect a full cycle + 560 d0c4 68 PLA + 561 d0c5 2a ROL ;Roll new bit into result + 562 d0c6 a0 34 LDY #52 ;Set threshold value in middle + 563 d0c8 ca DEX ;Decrement bit counter + 564 d0c9 d0 f5 BNE A2_RDBIT ;Read next bit! + 565 d0cb 81 26 STA (HEX2L,X) ;Save new byte + 566 d0cd + 567 d0cd 20 0c d1 JSR A2_INCADDR ;Increment address + 568 d0d0 a0 2e LDY #46 ;Compensate threshold with workload + 569 d0d2 90 ea BCC A2_RDBYTE ;Do next byte if not done yet! + 570 d0d4 + 571 d0d4 4c 93 d0 JMP RB_RESTIDX + 572 d0d7 + 573 d0d7 + 574 d0d7 + 575 d0d7 ;------------------------------------------------------------------------- + 576 d0d7 ; Write header to tape + 577 d0d7 ; + 578 d0d7 ; The header consists of an asymmetric cycle, starting with one phase of + 579 d0d7 ; approximately (66+47)x5=565us, followed by a second phase of + 580 d0d7 ; approximately (44+47)x5=455us. + 581 d0d7 ; Total cycle duration is approximately 1020us ~ 1kHz. The actual + 582 d0d7 ; frequencywill be a bit lower because of the additional workload between + 583 d0d7 ; the twoloops. + 584 d0d7 ; The header ends with a short phase of (30+47)x5=385us and a normal + 585 d0d7 ; phase of (44+47)x5=455us. This start bit must be detected by the read + 586 d0d7 ; routine to trigger the reading of the actual data. + 587 d0d7 ;------------------------------------------------------------------------- + 588 d0d7 + 589 d0d7 RB_WHEADER + 590 d0d7 a0 48 RB_HCOUNT LDY #72 ;Extra long delay + 591 d0d9 20 e9 d0 JSR RB_WDELAY ;CY is constantly 1, writing a 1 + 592 d0dc d0 f9 BNE RB_HCOUNT ;Do this 64 * 256 time! + 593 d0de 69 fe ADC #-2 ;Decrement A (CY=1 all the time) + 594 d0e0 b0 f5 BCS RB_HCOUNT ;Not all done! + 595 d0e2 a0 20 LDY #32 ;Write a final short bit (start) + 596 d0e4 + 597 d0e4 ;------------------------------------------------------------------------- + 598 d0e4 ; Write a full bit cycle + 599 d0e4 ; + 600 d0e4 ; Upon entry Y contains a compensated value for the first phase of 0 + 601 d0e4 ; bit length. All subsequent loops don't have to be time compensated. + 602 d0e4 ;------------------------------------------------------------------------- + 603 d0e4 + 604 d0e4 RB_WRITEBIT + 605 d0e4 + 606 d0e4 20 e9 d0 JSR RB_WDELAY ;Do two equal phases + 607 d0e7 a0 2f LDY #47 ;Load 250us counter - compensation + 608 d0e9 + 609 d0e9 88 RB_WDELAY DEY ;Delay 250us (one phase of 2kHz) + 610 d0ea d0 fd BNE RB_WDELAY + 611 d0ec 90 05 BCC RB_WRITE1 ;Write a '1' (2kHz) + 612 d0ee + 613 d0ee a0 32 LDY #50 ;Additional delay for '0' (1kHz) + 614 d0f0 88 RB_WDELAY0 DEY ; (delay 250us) + 615 d0f1 d0 fd BNE RB_WDELAY0 + 616 d0f3 + 617 d0f3 RB_WRITE1 + 618 d0f3 + 619 d0f3 ac 20 c0 LDY FLIP ;Flip the output bit + 620 d0f6 + 621 d0f6 a0 2e LDY #46 ;Reload 250us cntr (compensation) + 622 d0f8 ca DEX ;Decrement bit counter + 623 d0f9 60 RTS + 624 d0fa + 625 d0fa ;------------------------------------------------------------------------- + 626 d0fa ; Wait for FULL cycle (cmplevel- waits till level transisiton) + 627 d0fa ;------------------------------------------------------------------------- + 628 d0fa 20 fd d0 A2_FULLCYCLE JSR A2_CMPLEVEL ;Wait for two level changes + 629 d0fd 88 A2_CMPLEVEL DEY ;Decrement time counter + 630 d0fe ad 60 c0 LDA TAPEIN ;Get Tape In data + 631 d101 + 632 d101 ; the next instruction must be added for apple II + 633 d101 29 80 AND #$80 ;CLEAR floating bits + 634 d103 c5 29 CMP LASTSTATE ;Same as before? + 635 d105 f0 f6 BEQ A2_CMPLEVEL ;Yes! + 636 d107 85 29 STA LASTSTATE ;Save new data + 637 d109 + 638 d109 c0 80 CPY #128 ;Compare threshold + 639 d10b 60 RTS + 640 d10c ;------------------------------------------------------------------------- + 641 d10c ; Increment current address and compare with last address + 642 d10c ;------------------------------------------------------------------------- + 643 d10c a5 26 A2_INCADDR LDA HEX2L ;Compare current address with + 644 d10e c5 24 CMP HEX1L ; end address + 645 d110 a5 27 LDA HEX2H + 646 d112 e5 25 SBC HEX1H + 647 d114 e6 26 INC HEX2L ;And increment current address + 648 d116 d0 02 BNE A2_NOCARRY ;No carry to MSB! + 649 d118 e6 27 INC HEX2H + 650 d11a 60 A2_NOCARRY RTS + 651 d11b + 652 d11b ;------------------------------------------------------------------------- + 653 d11b ; one block read + 654 d11b ; modify A1 code that touches PIA to A2 version as it is loaded + 655 d11b ; these are keyboard and display functions + 656 d11b ; + 657 d11b ; APPLE 1 version + 658 d11b ;ACIWAITCHAR + 659 d11b ; ad 11 d0 LDA KBDCR ;Wait for key press + 660 d11b ; 30 FB BPL ACIWAITCHAR ;No key yet! + 661 d11b ; ad 10 d0 LDA KBD ;Clear strobe + 662 d11b ; converted to our version + 663 d11b ; 20 3a d1 JSR A2GETCHAR + 664 d11b ; ea NOP + 665 d11b ; ea NOP + 666 d11b ; ea NOP + 667 d11b ; ea NOP + 668 d11b ; ea NOP + 669 d11b ; + 670 d11b ; instead if BPL is not present or has mismatching branch offset + 671 d11b ; ad 11 d0 LDA KBDCR + 672 d11b ; is converted to + 673 d11b ; ad 00 c0 LDA KBD + 674 d11b ; + 675 d11b ; + 676 d11b ; + 677 d11b ; ad 10 d0 LDA KBD + 678 d11b ; is converted to + 679 d11b ; 8d 10 c0 STA KBDCR ;Clear strobe + 680 d11b ; + 681 d11b ; finally there are some cases where presence of character is + 682 d11b ; determined with the bit command + 683 d11b ; 2c 11 d0 BIT KBDCR + 684 d11b ; is converted to + 685 d11b ; 2c 00 c00 BIT KBD + 686 d11b ; + 687 d11b ; + 688 d11b ; + 689 d11b ;------------------------------------------------------------------------- + 690 d11b + 691 d11b 00 77 CNVRTTERM EQU $77 ; UNIQUE CHAR NEEDED TO TERMINATE CONVERSION STRINGS + 692 d11b + 693 d11b A2_READCONVERT + 694 d11b a9 00 LDA #0 ; RDCONVERT can be turned off + 695 d11d cd 01 bc CMP RDCONVERT + 696 d120 d0 4d BNE A2_READCONVERTDONE ; not zero, then skip conversion + 697 d122 a2 00 LDX #0 + 698 d124 a0 00 LDY #0 + 699 d126 ; + 700 d126 ; check next string through all of memory + 701 d126 ; + 702 d126 + 703 d126 A2_READCONVERT_1 ; for this string, scan all of read memory + 704 d126 8c 06 bc STY savey ;save compare string starting point + 705 d129 + 706 d129 b9 90 d1 LDA CNVRT_IN,Y + 707 d12c c9 77 CMP #CNVRTTERM ; Termination character? + 708 d12e f0 3f BEQ A2_READCONVERTDONE ;all done checking, exit + 709 d130 + 710 d130 ad 11 bc LDA RDSTRTL ; start of memory load + 711 d133 85 26 STA HEX2L + 712 d135 ad 12 bc LDA RDSTRTH + 713 d138 85 27 STA HEX2H + 714 d13a + 715 d13a ; + 716 d13a ; restart currnet string + 717 d13a ; + 718 d13a A2_READCONVERT_8 + 719 d13a a5 26 LDA HEX2L ;save memory starting point + 720 d13c 8d 13 bc STA HEX2LB + 721 d13f a5 27 LDA HEX2H + 722 d141 8d 14 bc STA HEX2HB + 723 d144 ac 06 bc LDY savey + 724 d147 + 725 d147 A2_READCONVERT1 + 726 d147 a1 26 LDA (HEX2L),X ; fetch byte from memory + 727 d149 d9 90 d1 CMP CNVRT_IN,Y ; compare + 728 d14c f0 11 BEQ A2_READCONVERT1_2 ; this byte does match, process + 729 d14e ; + 730 d14e ; mo match, restart match string + 731 d14e ; + 732 d14e 20 0c d1 JSR A2_INCADDR + 733 d151 90 e7 BCC A2_READCONVERT_8 ; not end of memory - restart scan for current string + 734 d153 + 735 d153 ; + 736 d153 ; end of memory block - go to next string + 737 d153 ; + 738 d153 A2_READCONVERT1_3 + 739 d153 c8 INY + 740 d154 b9 90 d1 LDA CNVRT_IN,Y + 741 d157 c9 77 CMP #CNVRTTERM ; Termination character? + 742 d159 d0 f8 BNE A2_READCONVERT1_3 ; not end of block, keep looking + 743 d15b c8 INY ; found end, move to start of next block + 744 d15c 4c 26 d1 JMP A2_READCONVERT_1 ; rescan memory with next string + 745 d15f ; + 746 d15f ; match - keep going until mismatch or end of string + 747 d15f ; + 748 d15f A2_READCONVERT1_2 + 749 d15f c8 INY + 750 d160 b9 90 d1 LDA CNVRT_IN,Y + 751 d163 c9 77 CMP #CNVRTTERM ; Termination character? + 752 d165 f0 09 BEQ A2_READCONVERT3 ; end of string - this is match do substitute + 753 d167 20 0c d1 JSR A2_INCADDR ; next memory address + 754 d16a 90 db BCC A2_READCONVERT1 ; not done - keep scanning + 755 d16c + 756 d16c 4c 53 d1 JMP A2_READCONVERT1_3 ; not a complete match - try next string + 757 d16f + 758 d16f ;------------------------------------------------------------------------- + 759 d16f ; Finished with READ + 760 d16f ;------------------------------------------------------------------------- + 761 d16f A2_READCONVERTDONE + 762 d16f 60 RTS + 763 d170 + 764 d170 ;------------------------------------------------------------------------- + 765 d170 ; Substitute string here + 766 d170 ;------------------------------------------------------------------------- + 767 d170 + 768 d170 A2_READCONVERT3 ; match - substitute here + 769 d170 ac 06 bc LDY savey + 770 d173 + 771 d173 ad 13 bc LDA HEX2LB ;restore memory starting point + 772 d176 85 26 STA HEX2L + 773 d178 ad 14 bc LDA HEX2HB + 774 d17b 85 27 STA HEX2H + 775 d17d A2_READCONVERT4 + 776 d17d b9 90 d1 LDA CNVRT_IN,Y + 777 d180 c9 77 CMP #CNVRTTERM ; Termination character? + 778 d182 f0 b6 BEQ A2_READCONVERT_8 ; done with sustibute, continue checking + 779 d184 b9 af d1 LDA CNVRT_OUT,Y + 780 d187 c8 INY + 781 d188 81 26 STA (HEX2L),X + 782 d18a 20 0c d1 JSR A2_INCADDR + 783 d18d 4c 7d d1 JMP A2_READCONVERT4 + 784 d190 + 785 d190 ;------------------------------------------------------------------------- + 786 d190 ; conversion strings + 787 d190 ; IN(what we are looking for + 788 d190 ; OUT (what we change it to) + 789 d190 ;------------------------------------------------------------------------- + 790 d190 + 791 d190 CNVRT_IN + 792 d190 ad 11 d0 CI1 LDA $d011 + 793 d193 10 fb BPL CI1 + 794 d195 ad 10 d0 LDA $d010 + 795 d198 77 DC.b CNVRTTERM + 796 d199 ad 11 d0 LDA $d011 + 797 d19c 77 DC.b CNVRTTERM + 798 d19d ad 10 d0 LDA $d010 + 799 d1a0 77 DC.b CNVRTTERM + 800 d1a1 2c 11 d0 BIT $d011 + 801 d1a4 77 DC.b CNVRTTERM + 802 d1a5 CI2 + 803 d1a5 2c 12 d0 BIT $D012 + 804 d1a8 30 fb BMI CI2 + 805 d1aa 8d 12 d0 STA $D012 + 806 d1ad 77 DC.b CNVRTTERM + 807 d1ae - IFCONST BLD4RAM + 808 d1ae - JSR $FFEF + 809 d1ae - DC.b CNVRTTERM + 810 d1ae ENDIF + 811 d1ae 77 DC.b CNVRTTERM + 812 d1af + 813 d1af CNVRT_OUT + 814 d1af 20 4d d2 JSR A2GETCHAR + 815 d1b2 ea NOP + 816 d1b3 ea NOP + 817 d1b4 ea NOP + 818 d1b5 ea NOP + 819 d1b6 ea NOP + 820 d1b7 77 DC.b CNVRTTERM + 821 d1b8 ad 00 c0 LDA KBD + 822 d1bb 77 DC.b CNVRTTERM + 823 d1bc 8d 10 c0 STA KBDCR + 824 d1bf 77 DC.b CNVRTTERM + 825 d1c0 2c 00 c0 BIT KBD + 826 d1c3 77 DC.b CNVRTTERM + 827 d1c4 20 ef ff JSR ECHO + 828 d1c7 ea NOP + 829 d1c8 ea NOP + 830 d1c9 ea NOP + 831 d1ca ea NOP + 832 d1cb ea NOP + 833 d1cc 77 DC.b CNVRTTERM + 834 d1cd - IFCONST BLD4RAM + 835 d1cd - JSR ECHO + 836 d1cd - DC.b CNVRTTERM + 837 d1cd ENDIF + 838 d1cd 77 DC.b CNVRTTERM + 839 d1ce + 840 d1ce + 841 d1ce ;------------------------------------------------------------------------- + 842 d1ce ; one block write + 843 d1ce ; undo read convert when writing to tape so tape + 844 d1ce ; can be loaded and run on a real actual A1 + 845 d1ce ;------------------------------------------------------------------------- + 846 d1ce A2_WRITECONVERT + 847 d1ce a9 00 LDA #0 ; RDCONVERT can be turned off + 848 d1d0 cd 01 bc CMP RDCONVERT + 849 d1d3 d0 4d BNE A2_WRITECONVERTDONE ; not zero, then skip conversion + 850 d1d5 a2 00 LDX #0 + 851 d1d7 a0 00 LDY #0 + 852 d1d9 ; + 853 d1d9 ; check next string through all of memory + 854 d1d9 ; + 855 d1d9 + 856 d1d9 A2_WRITECONVERT_1 ; for this string, scan all of read memory + 857 d1d9 8c 06 bc STY savey ;save compare string starting point + 858 d1dc + 859 d1dc b9 af d1 LDA CNVRT_OUT,Y + 860 d1df c9 77 CMP #CNVRTTERM ; Termination character? + 861 d1e1 f0 3f BEQ A2_WRITECONVERTDONE ;all done checking, exit + 862 d1e3 + 863 d1e3 ad 11 bc LDA RDSTRTL ; reset block address + 864 d1e6 85 26 STA HEX2L + 865 d1e8 ad 12 bc LDA RDSTRTH + 866 d1eb 85 27 STA HEX2H + 867 d1ed + 868 d1ed ; + 869 d1ed ; restart currnet string + 870 d1ed ; + 871 d1ed A2_WRITECONVERT_8 + 872 d1ed a5 26 LDA HEX2L ;save memory starting point + 873 d1ef 8d 13 bc STA HEX2LB + 874 d1f2 a5 27 LDA HEX2H + 875 d1f4 8d 14 bc STA HEX2HB + 876 d1f7 ac 06 bc LDY savey + 877 d1fa + 878 d1fa A2_WRITECONVERT1 + 879 d1fa a1 26 LDA (HEX2L),X ; fetch byte from memory + 880 d1fc d9 af d1 CMP CNVRT_OUT,Y ; compare + 881 d1ff f0 11 BEQ A2_WRITECONVERT1_2 ; this byte does match, process + 882 d201 ; + 883 d201 ; mo match, restart match string + 884 d201 ; + 885 d201 20 0c d1 JSR A2_INCADDR + 886 d204 90 e7 BCC A2_WRITECONVERT_8 ; not end of memory - restart scan for current string + 887 d206 + 888 d206 ; + 889 d206 ; end of memory block - go to next string + 890 d206 ; + 891 d206 A2_WRITECONVERT1_3 + 892 d206 c8 INY + 893 d207 b9 af d1 LDA CNVRT_OUT,Y + 894 d20a c9 77 CMP #CNVRTTERM ; Termination character? + 895 d20c d0 f8 BNE A2_WRITECONVERT1_3 ; not end of block, keep looking + 896 d20e c8 INY ; found end, move to start of next block + 897 d20f 4c d9 d1 JMP A2_WRITECONVERT_1 ; rescan memory with next string + 898 d212 ; + 899 d212 ; match - keep going until mismatch or end of string + 900 d212 ; + 901 d212 A2_WRITECONVERT1_2 + 902 d212 c8 INY + 903 d213 b9 af d1 LDA CNVRT_OUT,Y + 904 d216 c9 77 CMP #CNVRTTERM ; Termination character? + 905 d218 f0 13 BEQ A2_WRITECONVERT3 ; end of string - this is match do substitute + 906 d21a 20 0c d1 JSR A2_INCADDR ; next memory address + 907 d21d 90 db BCC A2_WRITECONVERT1 ; not done - keep scanning + 908 d21f + 909 d21f 4c 06 d2 JMP A2_WRITECONVERT1_3 ; not a complete match - try next string + 910 d222 + 911 d222 ;------------------------------------------------------------------------- + 912 d222 ; Finished with WRITE CONVERSION + 913 d222 ;------------------------------------------------------------------------- + 914 d222 A2_WRITECONVERTDONE + 915 d222 ad 11 bc LDA RDSTRTL ; reset block address + 916 d225 85 26 STA HEX2L + 917 d227 ad 12 bc LDA RDSTRTH + 918 d22a 85 27 STA HEX2H + 919 d22c + 920 d22c 60 RTS + 921 d22d ;------------------------------------------------------------------------- + 922 d22d ; Substitute string here + 923 d22d ;------------------------------------------------------------------------- + 924 d22d + 925 d22d A2_WRITECONVERT3 ; match - substitute here + 926 d22d ac 06 bc LDY savey + 927 d230 + 928 d230 ad 13 bc LDA HEX2LB ;restore memory starting point + 929 d233 85 26 STA HEX2L + 930 d235 ad 14 bc LDA HEX2HB + 931 d238 85 27 STA HEX2H + 932 d23a A2_WRITECONVERT4 + 933 d23a b9 af d1 LDA CNVRT_OUT,Y + 934 d23d c9 77 CMP #CNVRTTERM ; Termination character? + 935 d23f f0 ac BEQ A2_WRITECONVERT_8 ; done with sustibute, continue checking + 936 d241 b9 90 d1 LDA CNVRT_IN,Y + 937 d244 c8 INY + 938 d245 81 26 STA (HEX2L),X + 939 d247 20 0c d1 JSR A2_INCADDR + 940 d24a 4c 3a d2 JMP A2_WRITECONVERT4 + 941 d24d + 942 d24d ;------------------------------------------------------------------------- + 943 d24d ; output driver - uses hires memory + 944 d24d ;------------------------------------------------------------------------- + 945 d24d + 946 d24d A2GETCHAR + 947 d24d 6c 02 bc JMP (READVECTOR) ;Allow user override of default get char function + 948 d250 A2GETCHAR2 + 949 d250 20 af d2 JSR TOGGLE + 950 d253 ad 00 c0 LDA KBD ;Wait for key press + 951 d256 10 f5 BPL A2GETCHAR ;No key yet! + 952 d258 8d 10 c0 STA KBDCR ;Clear strobe + 953 d25b c9 88 CMP #$88 ; left arrow + 954 d25d d0 02 BNE A2_GC_NOT_BS ; brnch no + 955 d25f a9 df LDA #BS ; convert to _ + 956 d261 A2_GC_NOT_BS + 957 d261 c9 95 CMP #$95 ; right arrow + 958 d263 d0 06 BNE A2_GC_RET ; no, exit + 959 d265 20 11 d4 JSR CLEAR ; yes, clear screen and + 960 d268 + 961 d268 4c 4d d2 JMP A2GETCHAR ; get next char (this is a special HW emulation + 962 d26b ; function so skip call to READVECTOR) + 963 d26b A2_GC_RET + 964 d26b 60 RTS + 965 d26c + 966 d26c + 967 d26c ;------------------------------------------------------------------------- + 968 d26c ; output driver - uses hires memory + 969 d26c ;------------------------------------------------------------------------- + 970 d26c ;;; Magic Numbers + 971 d26c 00 f0 SCRINIT EQU $f0 + 972 d26c 00 f0 PG0SAVEFLG EQU $f0 + 973 d26c ;;; Definitions + 974 d26c c0 54 HRPG1 EQU $C054 + 975 d26c c0 55 HRPG2 EQU $C055 + 976 d26c c0 56 LORES EQU $C056 + 977 d26c c0 57 HIRES EQU $C057 + 978 d26c c0 50 TXTCLR EQU $C050 + 979 d26c c0 51 TXTMOD EQU $C051 + 980 d26c c0 52 MIXCLR EQU $C052 + 981 d26c fd 0c GETCHAR EQU $FD0C + 982 d26c + 983 d26c ;;; Page Zero Temps (8 locations reserved) + 984 d26c 00 00 TRGLOW EQU $00 + 985 d26c 00 01 TRGHIGH EQU $01 + 986 d26c 00 02 SRCLOW EQU $02 + 987 d26c 00 03 SRCHIGH EQU $03 + 988 d26c 00 05 CNT2 EQU $05 + 989 d26c 00 06 CNT3 EQU $06 + 990 d26c + 991 d26c ; Last location of low res + 992 d26c 07 f8 LASTLOCATION EQU $7F8 + 993 d26c + 994 d26c ;;; Entry point for testing + 995 d26c 20 83 d3 START JSR INIT + 996 d26f 20 0c fd L0 JSR GETCHAR + 997 d272 20 47 d4 JSR PUTCH + 998 d275 4c 6f d2 JMP L0 + 999 d278 00 BRK + 1000 d279 + 1001 d279 ;;; Move the cursor + 1002 d279 ee 0d bc MVCSR INC CURCOL + 1003 d27c ad 0d bc LDA CURCOL + 1004 d27f c9 28 CMP #40 + 1005 d281 10 14 BPL NXTROW + 1006 d283 MD + 1007 d283 a9 00 LDA #0 + 1008 d285 cd 00 bc CMP TURBO + 1009 d288 d0 0c BNE MR + 1010 d28a + 1011 d28a a0 00 LDY #0 + 1012 d28c a2 0c ML0 LDX #12 ; speed fine tuning + 1013 d28e e8 ML1 INX + 1014 d28f d0 fd BNE ML1 + 1015 d291 c8 INY + 1016 d292 c0 09 CPY #$9 + 1017 d294 d0 f6 BNE ML0 + 1018 d296 60 MR RTS + 1019 d297 NXTROW + 1020 d297 a9 00 LDA #0 + 1021 d299 8d 0d bc STA CURCOL + 1022 d29c + 1023 d29c ad 0c bc LDA CURROW ; don't increment current row until in case + 1024 d29f ; we are already at bottom of screen + 1025 d29f c9 17 CMP #23 ; if a reset comes in, it could leave us on an illegal row + 1026 d2a1 30 06 BMI NXTROW2 + 1027 d2a3 + 1028 d2a3 20 14 d3 JSR SCROLL ; scrolling bottom line, do not advance CURROW + 1029 d2a6 4c 83 d2 JMP MD + 1030 d2a9 + 1031 d2a9 NXTROW2 + 1032 d2a9 ee 0c bc INC CURROW ; not at bottom of screen advance to next row (CURROW) + 1033 d2ac 4c 83 d2 JMP MD + 1034 d2af + 1035 d2af ;;; Toggle the cursor + 1036 d2af TOGGLE + 1037 d2af + 1038 d2af ee 0e bc INC COUNTER0 + 1039 d2b2 d0 5f BNE DT + 1040 d2b4 ee 0f bc INC COUNTER1 + 1041 d2b7 d0 5a BNE DT + 1042 d2b9 48 PHA + 1043 d2ba a9 e0 LDA #CNTSTRT + 1044 d2bc 8d 0f bc STA COUNTER1 + 1045 d2bf ; + 1046 d2bf ; if screen has not been cleared- toggle betweeen hi res pages + 1047 d2bf ; + 1048 d2bf ad 09 bc LDA SCRNCLRD + 1049 d2c2 30 1b BMI TOGGLE2 + 1050 d2c4 ; + 1051 d2c4 ; toggle from hi-res to low-res + 1052 d2c4 ; + 1053 d2c4 ad 10 bc LDA CURSOR + 1054 d2c7 d0 0b BNE TOGGLE1 + 1055 d2c9 a9 20 LDA #32 + 1056 d2cb 8d 10 bc STA CURSOR + 1057 d2ce ad 54 c0 LDA HRPG1 + 1058 d2d1 4c 12 d3 JMP TOGGLE4 + 1059 d2d4 + 1060 d2d4 TOGGLE1 + 1061 d2d4 a9 00 LDA #0 + 1062 d2d6 8d 10 bc STA CURSOR + 1063 d2d9 ad 55 c0 LDA HRPG2 + 1064 d2dc 4c 12 d3 JMP TOGGLE4 + 1065 d2df ; + 1066 d2df ; else toggle cursor + 1067 d2df ; + 1068 d2df TOGGLE2 + 1069 d2df 8e 07 bc STX savex + 1070 d2e2 8c 06 bc STY savey + 1071 d2e5 20 1a d5 JSR SAVPG0 + 1072 d2e8 + 1073 d2e8 ad 10 bc LDA CURSOR + 1074 d2eb d0 05 BNE SETSPC + 1075 d2ed a9 20 LDA #32 + 1076 d2ef 4c f4 d2 JMP DRWCUR + 1077 d2f2 a9 00 SETSPC LDA #0 + 1078 d2f4 8d 10 bc DRWCUR STA CURSOR + 1079 d2f7 ae 0d bc LDX CURCOL + 1080 d2fa ac 0c bc LDY CURROW + 1081 d2fd 20 ed d4 JSR GETBLOK + 1082 d300 ae 10 bc LDX CURSOR + 1083 d303 20 ca d4 JSR GETCHB + 1084 d306 20 b3 d4 JSR DRAWCH + 1085 d309 20 3b d5 JSR LODPG0 + 1086 d30c ae 07 bc LDX savex + 1087 d30f ac 06 bc LDY savey + 1088 d312 TOGGLE4 + 1089 d312 68 PLA + 1090 d313 60 DT RTS + 1091 d314 + 1092 d314 ;;; Scrolls the screen at the end + 1093 d314 SCROLL + 1094 d314 ;------------------------------------------------------------------------------------------------------------ + 1095 d314 ; + 1096 d314 ; HIRES is organized + 1097 d314 ; into three blocks, offset by 0x28 bytes each, starting at 2000 + 1098 d314 ; each block holds 8 lines of text, offset by 0x80 bytes + 1099 d314 ; each line of text is split into 8 rows of pixels offset by 0x400 bytes + 1100 d314 ; + 1101 d314 ; this function starts at second from top row copy all pixels to row above it and continues down the screen + 1102 d314 ; + 1103 d314 ;------------------------------------------------------------------------------------------------------------ + 1104 d314 ; first block -set up starting addresses + 1105 d314 ; + 1106 d314 a2 00 ldx #0 ;index into graphics table - starts at zero + 1107 d316 ; top loop - 24 lines of characters per page - copy bottom 23 lines (first line scrolls off top) + 1108 d316 a9 17 LDA #23 + 1109 d318 85 05 STA CNT2 + 1110 d31a + 1111 d31a ; + 1112 d31a ; next line of text + 1113 d31a ; + 1114 d31a scr1 + 1115 d31a bd 5c d5 LDA PG1ROWS,x ; target + 1116 d31d 85 01 STA TRGHIGH + 1117 d31f e8 inx + 1118 d320 bd 5c d5 LDA PG1ROWS,x ; target + 1119 d323 85 00 STA TRGLOW + 1120 d325 e8 inx + 1121 d326 bd 5c d5 LDA PG1ROWS,x ; src + 1122 d329 85 03 STA SRCHIGH + 1123 d32b e8 inx + 1124 d32c bd 5c d5 LDA PG1ROWS,x ; scr + 1125 d32f 85 02 STA SRCLOW + 1126 d331 ca DEX ;next pass target is current source + 1127 d332 a9 08 LDA #8 + 1128 d334 85 06 STA CNT3 + 1129 d336 4c 47 d3 JMP scr2.1 + 1130 d339 ; + 1131 d339 ; adjust address to next line of pixels + 1132 d339 ; + 1133 d339 scr2 + 1134 d339 + 1135 d339 a9 04 LDA #$4 + 1136 d33b 18 CLC + 1137 d33c 65 03 ADC SRCHIGH + 1138 d33e 85 03 STA SRCHIGH + 1139 d340 a9 04 LDA #$4 + 1140 d342 18 CLC + 1141 d343 65 01 ADC TRGHIGH + 1142 d345 85 01 STA TRGHIGH + 1143 d347 scr2.1 + 1144 d347 a0 27 LDY #39 + 1145 d349 ;copy 40 characters that make up a line of pixels + 1146 d349 scr3 + 1147 d349 b1 02 LDA (SRCLOW),y + 1148 d34b 91 00 STA (TRGLOW),y + 1149 d34d 88 DEY + 1150 d34e 10 f9 BPL scr3 ; repeat for 40 characters that make line of pixels + 1151 d350 c6 06 DEC CNT3 + 1152 d352 d0 e5 BNE scr2 ; done with this line of pixels =- goto to next liine of pixels + 1153 d354 c6 05 DEC CNT2 + 1154 d356 d0 c2 BNE scr1 ; done with this line of characters - goto next line of chars + 1155 d358 + 1156 d358 20 5c d3 JSR CLEAR_LINE + 1157 d35b 60 RTS + 1158 d35c + 1159 d35c ; + 1160 d35c ; clear line - X contains line # + 1161 d35c ; + 1162 d35c CLEAR_LINE + 1163 d35c bd 5c d5 LDA PG1ROWS,x ; target (was last source) + 1164 d35f 85 01 STA TRGHIGH + 1165 d361 e8 inx + 1166 d362 bd 5c d5 LDA PG1ROWS,x ; target + 1167 d365 85 00 STA TRGLOW + 1168 d367 + 1169 d367 a9 08 LDA #8 + 1170 d369 85 06 STA CNT3 + 1171 d36b 4c 75 d3 JMP CL4.1 + 1172 d36e ; + 1173 d36e ; adjust address to next line of pixels + 1174 d36e ; + 1175 d36e CL4 + 1176 d36e a9 04 LDA #$4 + 1177 d370 18 CLC + 1178 d371 65 01 ADC TRGHIGH + 1179 d373 85 01 STA TRGHIGH + 1180 d375 CL4.1 + 1181 d375 a0 27 LDY #39 + 1182 d377 a9 00 lda #$0 + 1183 d379 ;copy 40 characters that make up a line of pixels + 1184 d379 CL5 + 1185 d379 91 00 STA (TRGLOW),y + 1186 d37b 88 DEY + 1187 d37c 10 fb BPL CL5 ; repeat for 40 characters that make line of pixels + 1188 d37e c6 06 DEC CNT3 + 1189 d380 d0 ec BNE CL4 ; done with this line of pixels =- goto to next liine of pixels + 1190 d382 60 RTS + 1191 d383 + 1192 d383 + 1193 d383 ;;; Initialize the graphics system, set cursor and clear the screen + 1194 d383 INIT + 1195 d383 ; + 1196 d383 ; Initialize default keyboard in and video out routines + 1197 d383 a9 4a LDA #PUTCH2 + 1200 d38a 8d 05 bc STA WRITVECTOR+1 + 1201 d38d + 1202 d38d a9 50 LDA #A2GETCHAR2 + 1205 d394 8d 03 bc STA READVECTOR+1 + 1206 d397 + 1207 d397 ad 00 bc LDA TURBO ;clear computer driven turbo mode + 1208 d39a 29 01 AND #TURBOUSR ;but save user turbo mode + 1209 d39c 8d 00 bc STA TURBO + 1210 d39f ; + 1211 d39f ; reset could have occurred during video driver operations + 1212 d39f ; attempt to restore page 0 if possible + 1213 d39f ; there is a case where we were in the process of saving + 1214 d39f ; or restoring page zero variables when reset occurred + 1215 d39f ; we cannot recover from that case + 1216 d39f ; + 1217 d39f 20 3b d5 JSR LODPG0 ;restore page zero variables + 1218 d3a2 ; + 1219 d3a2 ; determine whether we should emulate power up screen + 1220 d3a2 ; + 1221 d3a2 a9 f0 LDA #SCRINIT + 1222 d3a4 cd 08 bc CMP POWERUPINIT ;have we initialized power up screen + 1223 d3a7 d0 12 BNE INITSCREEN ;no, let's do it + 1224 d3a9 cd 09 bc CMP SCRNCLRD ;has user cleared the screen? + 1225 d3ac d0 0c BNE INITEXIT ;no, leave graphics mode alone + 1226 d3ae + 1227 d3ae ; + 1228 d3ae ; clear screen already done - set HGR PG 2 mode + 1229 d3ae ; + 1230 d3ae 8d 57 c0 STA HIRES ; set high res pg 2 graphics mode + 1231 d3b1 8d 55 c0 STA HRPG2 ; if this is power up, this will be changed below + 1232 d3b4 8d 50 c0 STA TXTCLR + 1233 d3b7 8d 52 c0 STA MIXCLR + 1234 d3ba INITEXIT + 1235 d3ba 60 RTS + 1236 d3bb ; + 1237 d3bb ; initialize lowres page 1 as startup screen + 1238 d3bb ; + 1239 d3bb + 1240 d3bb INITSCREEN + 1241 d3bb a9 04 LDA #$04 ;START ADDRESS + 1242 d3bd 85 27 STA HEX2H + 1243 d3bf a9 00 LDA #$0 + 1244 d3c1 85 26 STA HEX2L + 1245 d3c3 + 1246 d3c3 a9 0b LDA #$0B ;END ADDRESS + 1247 d3c5 85 25 STA HEX1H + 1248 d3c7 a9 f8 LDA #$F8 + 1249 d3c9 85 24 STA HEX1L + 1250 d3cb + 1251 d3cb a0 00 LDY #0 + 1252 d3cd + 1253 d3cd INIT1 + 1254 d3cd a9 df LDA #$DF ; underbar + 1255 d3cf 91 26 STA (HEX2L),y + 1256 d3d1 20 0c d1 JSR A2_INCADDR + 1257 d3d4 b0 13 BCS INIT2 + 1258 d3d6 a9 08 LDA #$08 ; check address range <800 use at sign + 1259 d3d8 24 27 BIT HEX2H ; >800 use space + 1260 d3da d0 04 BNE INIT1_1 + 1261 d3dc a9 c0 LDA #$C0 ; at sign + 1262 d3de 30 02 BMI INIT1_2 + 1263 d3e0 INIT1_1 + 1264 d3e0 a9 a0 LDA #$A0 ; space + 1265 d3e2 INIT1_2 + 1266 d3e2 91 26 STA (HEX2L),y ; save it + 1267 d3e4 20 0c d1 JSR A2_INCADDR + 1268 d3e7 90 e4 BCC INIT1 + 1269 d3e9 + 1270 d3e9 INIT2 + 1271 d3e9 + 1272 d3e9 a9 00 LDA #0 + 1273 d3eb 8d 09 bc STA SCRNCLRD ; now indicate that screen has been not cleared + 1274 d3ee 8d 0c bc STA CURROW + 1275 d3f1 8d 0d bc STA CURCOL + 1276 d3f4 8d 00 bc STA TURBO ; default not turbo mode + 1277 d3f7 8d 01 bc STA RDCONVERT ; default convert cassette reads + 1278 d3fa a9 e0 LDA #CNTSTRT + 1279 d3fc 8d 0f bc STA COUNTER1 + 1280 d3ff + 1281 d3ff 8d 56 c0 STA LORES ; set lowres pg 1 graphics mode for start up screen + 1282 d402 8d 54 c0 STA HRPG1 ; use page 1 + 1283 d405 8d 51 c0 STA TXTMOD + 1284 d408 8d 52 c0 STA MIXCLR + 1285 d40b + 1286 d40b a9 f0 LDA #SCRINIT + 1287 d40d 8d 08 bc STA POWERUPINIT ; indicate power on init done + 1288 d410 + 1289 d410 60 RTS + 1290 d411 + 1291 d411 ;;; Clears hires page 1 + 1292 d411 CLEAR + 1293 d411 8c 06 bc STY savey + 1294 d414 8e 07 bc STX savex + 1295 d417 20 1a d5 JSR SAVPG0 + 1296 d41a + 1297 d41a a2 00 LDX #0 + 1298 d41c + 1299 d41c CLEAR2 + 1300 d41c 20 5c d3 JSR CLEAR_LINE + 1301 d41f e8 INX + 1302 d420 e0 30 CPX #48 + 1303 d422 d0 f8 BNE CLEAR2 + 1304 d424 ;; page cleared + 1305 d424 + 1306 d424 a9 f0 LDA #SCRINIT + 1307 d426 8d 09 bc STA SCRNCLRD ;indicate screen cleared + 1308 d429 + 1309 d429 8d 57 c0 STA HIRES ; set high res pg 2 graphics mode + 1310 d42c 8d 55 c0 STA HRPG2 + 1311 d42f 8d 50 c0 STA TXTCLR + 1312 d432 8d 52 c0 STA MIXCLR + 1313 d435 + 1314 d435 a9 00 LDA #$00 + 1315 d437 ; + 1316 d437 ; cursor to top left + 1317 d437 ; + 1318 d437 8d 0c bc STA CURROW + 1319 d43a 8d 0d bc STA CURCOL + 1320 d43d + 1321 d43d 20 3b d5 JSR LODPG0 + 1322 d440 ac 06 bc LDY savey + 1323 d443 ae 07 bc LDX savex + 1324 d446 60 RTS + 1325 d447 + 1326 d447 ;;; Prints character from A to the screen + 1327 d447 PUTCH + 1328 d447 6c 04 bc JMP (WRITVECTOR) ;allow user override of default video out routine + 1329 d44a PUTCH2 + 1330 d44a 48 PHA + 1331 d44b 8c 06 bc STY savey + 1332 d44e 8e 07 bc STX savex + 1333 d451 + 1334 d451 ac 09 bc LDY SCRNCLRD + 1335 d454 10 27 BPL PUTCH_DROP ;if plus, screen has not been cleared, so drop + 1336 d456 + 1337 d456 20 1a d5 JSR SAVPG0 + 1338 d459 ;; drop the high bit + 1339 d459 29 7f AND #$7F + 1340 d45b ;; check for return + 1341 d45b c9 0d CMP #$0D + 1342 d45d f0 26 BEQ ENTERKY + 1343 d45f ;; it's a regular key + 1344 d45f 20 0d d5 JSR GETCODE + 1345 d462 8d 0a bc STA CHAR + 1346 d465 ;; get the block address + 1347 d465 ae 0d bc LDX CURCOL + 1348 d468 ac 0c bc LDY CURROW + 1349 d46b 20 ed d4 JSR GETBLOK + 1350 d46e ;; get block bytes + 1351 d46e ae 0a bc LDX CHAR + 1352 d471 20 ca d4 JSR GETCHB + 1353 d474 ;; render the char to the block + 1354 d474 20 b3 d4 JSR DRAWCH + 1355 d477 ;; restore state and exit + 1356 d477 20 79 d2 PD JSR MVCSR + 1357 d47a 20 3b d5 JSR LODPG0 + 1358 d47d + 1359 d47d PUTCH_DROP + 1360 d47d ac 06 bc LDY savey + 1361 d480 ae 07 bc LDX savex + 1362 d483 68 PLA + 1363 d484 60 RTS + 1364 d485 + 1365 d485 ENTERKY ; print spaces until end of line (use turbo mode) + 1366 d485 ad 00 bc LDA TURBO + 1367 d488 09 02 ORA #TURBOCMP ; set computer turbo mode + 1368 d48a 8d 00 bc STA TURBO ; turbo mode to clear end of line + 1369 d48d ENTERKY1 + 1370 d48d ac 0c bc LDY CURROW + 1371 d490 ae 0d bc LDX CURCOL + 1372 d493 e0 28 CPX #40 + 1373 d495 f0 11 BEQ ENTERKY_EXIT + 1374 d497 20 ed d4 JSR GETBLOK + 1375 d49a a2 00 LDX #0 ; space key + 1376 d49c 20 ca d4 JSR GETCHB + 1377 d49f 20 b3 d4 JSR DRAWCH + 1378 d4a2 ee 0d bc INC CURCOL + 1379 d4a5 4c 8d d4 JMP ENTERKY1 + 1380 d4a8 + 1381 d4a8 ENTERKY_EXIT + 1382 d4a8 ad 00 bc LDA TURBO + 1383 d4ab 29 01 AND #TURBOUSR ; reset computer turbo mode, saving user mode + 1384 d4ad 8d 00 bc STA TURBO ; + 1385 d4b0 4c 77 d4 JMP PD + 1386 d4b3 + 1387 d4b3 ;;; Draws character to block + 1388 d4b3 a2 00 DRAWCH LDX #0 + 1389 d4b5 8a L6 TXA + 1390 d4b6 a8 TAY + 1391 d4b7 b1 02 LDA (SRCLOW),Y + 1392 d4b9 a0 00 LDY #0 + 1393 d4bb 91 00 STA (TRGLOW),Y + 1394 d4bd e8 INX + 1395 d4be a5 01 LDA TRGHIGH + 1396 d4c0 18 CLC + 1397 d4c1 69 04 ADC #$4 + 1398 d4c3 85 01 STA TRGHIGH + 1399 d4c5 e0 08 CPX #8 + 1400 d4c7 30 ec BMI L6 + 1401 d4c9 60 RTS + 1402 d4ca + 1403 d4ca ;;; Get byte for char in X + 1404 d4ca a0 8c GETCHB LDY #SPCODE + 1407 d4d0 84 03 STY SRCHIGH + 1408 d4d2 e0 00 L5 CPX #0 + 1409 d4d4 f0 16 BEQ D + 1410 d4d6 ca DEX + 1411 d4d7 a9 08 LDA #8 + 1412 d4d9 18 CLC + 1413 d4da 65 02 ADC SRCLOW + 1414 d4dc 85 02 STA SRCLOW + 1415 d4de b0 03 BCS AC + 1416 d4e0 4c d2 d4 JMP L5 + 1417 d4e3 a9 00 AC LDA #0 + 1418 d4e5 65 03 ADC SRCHIGH + 1419 d4e7 85 03 STA SRCHIGH + 1420 d4e9 4c d2 d4 JMP L5 + 1421 d4ec 60 D RTS + 1422 d4ed + 1423 d4ed ;;; Gets the block address at X,Y + 1424 d4ed 98 GETBLOK TYA + 1425 d4ee 20 ff d4 JSR GETROW + 1426 d4f1 ;; add the column + 1427 d4f1 8a TXA + 1428 d4f2 18 CLC + 1429 d4f3 65 00 ADC TRGLOW + 1430 d4f5 85 00 STA TRGLOW + 1431 d4f7 b0 01 BCS A1 + 1432 d4f9 60 RTS + 1433 d4fa a9 00 A1 LDA #0 + 1434 d4fc 65 01 ADC TRGHIGH + 1435 d4fe 60 RTS + 1436 d4ff + 1437 d4ff ;;; Gets the row (A) address + 1438 d4ff 0a GETROW ASL ; multiply row by two, there are two bytes per address + 1439 d500 a8 TAY + 1440 d501 b9 5c d5 LDA PG1ROWS,Y + 1441 d504 85 01 STA TRGHIGH + 1442 d506 c8 INY + 1443 d507 b9 5c d5 LDA PG1ROWS,Y + 1444 d50a 85 00 STA TRGLOW + 1445 d50c 60 RTS + 1446 d50d + 1447 d50d ;;; Converts ASCII code to table index + 1448 d50d 38 GETCODE SEC + 1449 d50e e9 20 SBC #$20 + 1450 d510 30 05 BMI NC + 1451 d512 c9 40 CMP #$40 + 1452 d514 10 01 BPL NC + 1453 d516 60 RTS + 1454 d517 a9 00 NC LDA #0 + 1455 d519 60 RTS + 1456 d51a + 1457 d51a ;;; Store page zero data + 1458 d51a 48 SAVPG0 PHA + 1459 d51b 8e 0b bc STX TMP1 + 1460 d51e + 1461 d51e a9 f0 LDA #PG0SAVEFLG ;check saved flag + 1462 d520 cd 25 bc CMP PG0SAVD + 1463 d523 f0 11 BEQ SD ;already saved, just exit + 1464 d525 + 1465 d525 a2 00 LDX #0 + 1466 d527 b5 00 L1 LDA $00,X + 1467 d529 9d 15 bc STA TMPG0,X + 1468 d52c e8 INX + 1469 d52d e0 08 CPX #$8 + 1470 d52f d0 f6 BNE L1 + 1471 d531 + 1472 d531 a9 f0 LDA #PG0SAVEFLG ;set save flag to saved after completely saved + 1473 d533 8d 25 bc STA PG0SAVD ;this way, if a reset comes in before we are done + 1474 d536 ;we will not corrupt zero page + 1475 d536 ;as the reset code restores zero page if flag set + 1476 d536 + 1477 d536 ae 0b bc SD LDX TMP1 + 1478 d539 68 PLA + 1479 d53a 60 RTS + 1480 d53b + 1481 d53b ;;; Restore page zero data + 1482 d53b LODPG0 + 1483 d53b 48 PHA + 1484 d53c 8e 0b bc STX TMP1 + 1485 d53f + 1486 d53f a9 f0 LDA #PG0SAVEFLG ;checked saved flag + 1487 d541 cd 25 bc CMP PG0SAVD + 1488 d544 d0 11 BNE LD ;not saved, exit + 1489 d546 + 1490 d546 a2 00 LDX #0 + 1491 d548 bd 15 bc L2 LDA TMPG0,X + 1492 d54b 95 00 STA $00,X + 1493 d54d e8 INX + 1494 d54e e0 08 CPX #$8 + 1495 d550 d0 f6 BNE L2 + 1496 d552 + 1497 d552 a9 0f LDA #<(~PG0SAVEFLG) ;clear saved flag to not saved after completely restored + 1498 d554 ;this way, if a reset comes in before we are done + 1499 d554 8d 25 bc STA PG0SAVD ;as the reset code restores zero page if flag set + 1500 d557 + 1501 d557 ae 0b bc LD LDX TMP1 + 1502 d55a 68 PLA + 1503 d55b 60 RTS + 1504 d55c + 1505 d55c + 1506 d55c ;;; tables + 1507 d55c 40 00 40 80*PG1ROWS HEX 4000 4080 4100 4180 4200 4280 4300 4380 4028 40A8 4128 41A8 4228 42A8 4328 43A8 4050 40D0 4150 41D0 4250 42D0 4350 43D0 + 1508 d58c 00 00 00 00*SPCODE HEX 00 00 00 00 00 00 00 00 + 1509 d594 00 08 08 08*EXPCODE HEX 00 08 08 08 08 08 00 08 + 1510 d59c 00 14 14 14*QUOCODE HEX 00 14 14 14 00 00 00 00 + 1511 d5a4 00 14 14 3e*NUMCODE HEX 00 14 14 3e 14 3e 14 14 + 1512 d5ac 00 08 3c 0a*STRCODE HEX 00 08 3c 0a 1c 28 1e 08 + 1513 d5b4 00 06 26 10*PERCODE HEX 00 06 26 10 08 04 32 30 + 1514 d5bc 00 04 0a 0a*AMPCODE HEX 00 04 0a 0a 04 2a 12 2c + 1515 d5c4 00 08 08 08*SQCODE HEX 00 08 08 08 00 00 00 00 + 1516 d5cc 00 08 04 02*RPCODE HEX 00 08 04 02 02 02 04 08 + 1517 d5d4 00 08 10 20*LPCODE HEX 00 08 10 20 20 20 10 08 + 1518 d5dc 00 08 2a 1c*STACODE HEX 00 08 2a 1c 08 1c 2a 08 + 1519 d5e4 00 00 08 08*PLSCODE HEX 00 00 08 08 3e 08 08 00 + 1520 d5ec 00 00 00 00*CMACODE HEX 00 00 00 00 00 08 08 04 + 1521 d5f4 00 00 00 00*MINCODE HEX 00 00 00 00 3e 00 00 00 + 1522 d5fc 00 00 00 00*DOTCODE HEX 00 00 00 00 00 00 00 08 + 1523 d604 00 00 20 10*FSCODE HEX 00 00 20 10 08 04 02 00 + 1524 d60c 00 1c 22 32*0CODE HEX 00 1c 22 32 2a 26 22 1c + 1525 d614 00 08 0c 08*1CODE HEX 00 08 0c 08 08 08 08 1c + 1526 d61c 00 1c 22 20*2CODE HEX 00 1c 22 20 18 04 02 3e + 1527 d624 00 3e 20 10*3CODE HEX 00 3e 20 10 18 20 22 1c + 1528 d62c 00 10 18 14*4CODE HEX 00 10 18 14 12 3e 10 10 + 1529 d634 00 3e 02 1e*5CODE HEX 00 3e 02 1e 20 20 22 1c + 1530 d63c 00 38 04 02*6CODE HEX 00 38 04 02 1e 22 22 1c + 1531 d644 00 3e 20 10*7CODE HEX 00 3e 20 10 08 04 04 04 + 1532 d64c 00 1c 22 22*8CODE HEX 00 1c 22 22 1c 22 22 1c + 1533 d654 00 1c 22 22*9CODE HEX 00 1c 22 22 3c 20 10 0e + 1534 d65c 00 00 00 08*COLCODE HEX 00 00 00 08 00 08 00 00 + 1535 d664 00 00 00 08*SEMCODE HEX 00 00 00 08 00 08 08 04 + 1536 d66c 00 10 08 04*LTCODE HEX 00 10 08 04 02 04 08 10 + 1537 d674 00 00 00 3e*EQCODE HEX 00 00 00 3e 00 3e 00 00 + 1538 d67c 00 04 08 10*GTCODE HEX 00 04 08 10 20 10 08 04 + 1539 d684 00 1c 22 10*QESCODE HEX 00 1c 22 10 08 08 00 08 + 1540 d68c 00 1c 22 2a*ATCODE HEX 00 1C 22 2A 3A 1A 02 3C + 1541 d694 00 08 14 22*ACODE HEX 00 08 14 22 22 3e 22 22 + 1542 d69c 00 1e 22 22*BCODE HEX 00 1e 22 22 1e 22 22 1e + 1543 d6a4 00 1c 22 02*CCODE HEX 00 1c 22 02 02 02 22 1c + 1544 d6ac 00 1e 22 22*DCODE HEX 00 1e 22 22 22 22 22 1e + 1545 d6b4 00 3e 02 02*ECODE HEX 00 3e 02 02 1e 02 02 3e + 1546 d6bc 00 3e 02 02*FCODE HEX 00 3e 02 02 1e 02 02 02 + 1547 d6c4 00 3c 02 02*GCODE HEX 00 3c 02 02 02 32 22 3c + 1548 d6cc 00 22 22 22*HCODE HEX 00 22 22 22 3e 22 22 22 + 1549 d6d4 00 1c 08 08*ICODE HEX 00 1c 08 08 08 08 08 1c + 1550 d6dc 00 20 20 20*JCODE HEX 00 20 20 20 20 20 22 1c + 1551 d6e4 00 22 12 0a*KCODE HEX 00 22 12 0a 06 0a 12 22 + 1552 d6ec 00 02 02 02*LCODE HEX 00 02 02 02 02 02 02 3e + 1553 d6f4 00 22 36 2a*MCODE HEX 00 22 36 2a 2a 22 22 22 + 1554 d6fc 00 22 22 26*NCODE HEX 00 22 22 26 2a 32 22 22 + 1555 d704 00 1c 22 22*OCODE HEX 00 1c 22 22 22 22 22 1c + 1556 d70c 00 1e 22 22*PCODE HEX 00 1e 22 22 1e 02 02 02 + 1557 d714 00 1c 22 22*QCODE HEX 00 1c 22 22 22 2a 12 2c + 1558 d71c 00 1e 22 22*RCODE HEX 00 1e 22 22 1e 0a 12 22 + 1559 d724 00 1c 22 02*SCODE HEX 00 1c 22 02 1c 20 22 1c + 1560 d72c 00 3e 08 08*TCODE HEX 00 3e 08 08 08 08 08 08 + 1561 d734 00 22 22 22*UCODE HEX 00 22 22 22 22 22 22 1c + 1562 d73c 00 22 22 22*VCODE HEX 00 22 22 22 22 22 14 08 + 1563 d744 00 22 22 22*WCODE HEX 00 22 22 22 2a 2a 36 22 + 1564 d74c 00 22 22 14*XCODE HEX 00 22 22 14 08 14 22 22 + 1565 d754 00 22 22 14*YCODE HEX 00 22 22 14 08 08 08 08 + 1566 d75c 00 3e 20 10*ZCODE HEX 00 3e 20 10 08 04 02 3e + 1567 d764 00 3e 06 06*LBCODE HEX 00 3e 06 06 06 06 06 3e + 1568 d76c 00 00 02 04*BSCODE HEX 00 00 02 04 08 10 20 00 + 1569 d774 00 3e 30 30*RBCODE HEX 00 3e 30 30 30 30 30 3e + 1570 d77c 00 00 00 08*CRTCODE HEX 00 00 00 08 14 22 00 00 + 1571 d784 00 00 00 00*UNDCODE HEX 00 00 00 00 00 00 00 3e + 1572 d78c + 1573 d78c + 1574 d78c + 1575 d78c ;------------------------------------------------------------------------ + 1576 d78c ; BASIC SUPPORT FUNCTIONs + 1577 d78c ; peek and poke of the PIA is emulated + 1578 d78c ; using A2 hardware drivers + 1579 d78c ;------------------------------------------------------------------------ + 1580 d78c ;------------------------------------------------------------------------ + 1581 d78c ; POKE of D012 is emulated by calling + 1582 d78c ; A2 putchar routine + 1583 d78c ;------------------------------------------------------------------------ + 1584 d78c 00 ce ACC EQU $ce ; must be same as basic "acc" + 1585 d78c A2POKE + 1586 d78c 20 34 ee JSR getbyte + 1587 d78f a5 ce LDA ACC + 1588 d791 48 PHA + 1589 d792 20 15 e7 JSR get16bit + 1590 d795 a9 d0 LDA #$D0 + 1591 d797 c5 cf CMP ACC+1 + 1592 d799 f0 04 BEQ A2POKE2 + 1593 d79b A2POKE1 + 1594 d79b 68 PLA + 1595 d79c 91 ce STA (ACC),Y + 1596 d79e 60 RTS + 1597 d79f A2POKE2 + 1598 d79f a9 12 LDA #$12 + 1599 d7a1 c5 ce CMP ACC + 1600 d7a3 d0 f6 BNE A2POKE1 + 1601 d7a5 ;------------------------------------------------------------------------ + 1602 d7a5 ; Poke D012 == A2 ECHO CALL + 1603 d7a5 ;------------------------------------------------------------------------ + 1604 d7a5 68 PLA + 1605 d7a6 4c ef ff JMP ECHO + 1606 d7a9 + 1607 d7a9 ;------------------------------------------------------------------------ + 1608 d7a9 ; PEEK of D012, D011 and D010 is emulated by using + 1609 d7a9 ; equivalent A2 functionality + 1610 d7a9 ;------------------------------------------------------------------------ + 1611 d7a9 + 1612 d7a9 A2PEEK + 1613 d7a9 20 15 e7 JSR get16bit + 1614 d7ac a9 d0 LDA #$D0 + 1615 d7ae c5 cf CMP ACC+1 + 1616 d7b0 f0 07 BEQ A2PEEK3 + 1617 d7b2 A2PEEK1 + 1618 d7b2 b1 ce LDA (ACC),Y + 1619 d7b4 A2PEEK2 + 1620 d7b4 94 9f STY syn_stk_l+31,X + 1621 d7b6 4c 08 e7 JMP push_ya_noun_stk + 1622 d7b9 + 1623 d7b9 ;------------------------------------------------------------------------ + 1624 d7b9 ; Peek D012 == determine if terminal is ready for output + 1625 d7b9 ; in the A2 memory mapped video driver case - the answer + 1626 d7b9 ; is always yes -so return positive number(or zero in this case) + 1627 d7b9 ;------------------------------------------------------------------------ + 1628 d7b9 A2PEEK3 + 1629 d7b9 a9 12 LDA #$12 + 1630 d7bb c5 ce CMP ACC + 1631 d7bd d0 05 BNE A2PEEK4 + 1632 d7bf a9 00 LDA #$00 + 1633 d7c1 4c b4 d7 JMP A2PEEK2 + 1634 d7c4 ;------------------------------------------------------------------------ + 1635 d7c4 ; Peek D011 == A2 read c000 (does keyboard have char, yes if MSB set) + 1636 d7c4 ;------------------------------------------------------------------------ + 1637 d7c4 A2PEEK4 + 1638 d7c4 a9 11 LDA #$11 + 1639 d7c6 c5 ce CMP ACC + 1640 d7c8 d0 06 BNE A2PEEK5 + 1641 d7ca ad 00 c0 LDA KBD + 1642 d7cd 4c b4 d7 JMP A2PEEK2 + 1643 d7d0 ;------------------------------------------------------------------------ + 1644 d7d0 ; Peek D010 == A2 getchar (also clears strobe) + 1645 d7d0 ;------------------------------------------------------------------------ + 1646 d7d0 A2PEEK5 + 1647 d7d0 a9 10 LDA #$10 + 1648 d7d2 c5 ce CMP ACC + 1649 d7d4 d0 dc BNE A2PEEK1 + 1650 d7d6 ad 00 c0 LDA KBD + 1651 d7d9 8d 10 c0 STA KBDCR + 1652 d7dc 4c b4 d7 JMP A2PEEK2 + 1653 d7df + 1654 d7df - IFCONST BLD4RAM + 1655 d7df - STORAGE + 1656 d7df ENDIF + 1657 d7df ENDIF ; end of A2 driver code + 1658 d7df ;------------------------------------------------------------------------ + 1659 d7df ; VERSION + 1660 d7df ;------------------------------------------------------------------------ + 1661 d7df - IFCONST BLD4RAM + 1662 d7df - ORG $6FFE + 1663 d7df ELSE + 1664 dffe ORG $DFFE + 1665 dffe ENDIF + 1666 dffe 05 01 DC.w $0105 + 1667 e000 + 1668 e000 ;------------------------------------------------------------------------ + 1669 e000 ; BASIC + 1670 e000 ;------------------------------------------------------------------------ +------- FILE a1basic-universal.asm LEVEL 2 PASS 2 + 0 e000 INCLUDE a1basic-universal.asm + 1 e000 PROCESSOR 6502 + 2 e000 LIST ON + 3 e000 ; + 4 e000 ;------------------------------------------------------------------------ + 5 e000 ; Apple 1 Basic by Steve Wozniak + 6 e000 ; + 7 e000 ; This source was derived from BASIC disassembly done by Eric Smith. + 8 e000 ; This derivation is reproduced and distributed with permission of + 9 e000 ; Eric Smith + 10 e000 ; + 11 e000 ; Eric Smith's disassembly can be found at + 12 e000 ; http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ + 13 e000 ; + 14 e000 ; Do not reproduce or distribute without permission + 15 e000 ; + 16 e000 ; copyright 2010, Mike Willegal + 17 e000 ; copyright 2003, Eric Smith + 18 e000 ; + 19 e000 ;------------------------------------------------------------------------ + 20 e000 ; Disassembly of Apple 1 BASIC + 21 e000 ; 17-Sep-2003 + 22 e000 ; Apple 1 BASIC was written by Steve Wozniak + 23 e000 ; This disassembly is copyright 2003 Eric Smith + 24 e000 ; http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ + 25 e000 ;------------------------------------------------------------------------ + 26 e000 + 27 e000 ;------------------------------------------------------------------------ + 28 e000 ; build with 6502 assembler called DASM using the following command line + 29 e000 ; + 30 e000 ; Huston's version of Basic (may be latest version available) + 31 e000 ; http://www.apple1notes.com/Home/Programs.html + 32 e000 ;./dasm a1basic.asm -DHUSTNBASIC=0 -oa1hbas.o -la1hbas.lst + 33 e000 ; + 34 e000 ; Sander's version of Basic (same as Eric Smith's original disassembly) + 35 e000 ; http://www.apple1notes.com/Home/Programs.html + 36 e000 ;./dasm a1basic.asm -DSNDERBASIC=0 -oa1sbas.o -la1sbas.lst + 37 e000 ; + 38 e000 ; Vince Briel's version of Basic + 39 e000 ; (can't find the link right now) + 40 e000 ;./dasm a1basic.asm -DBRIELBASIC=0 -oa1bbas.o -la1bbas.lst + 41 e000 ; + 42 e000 ; Pagetable version of Basic (only PIA address different from Briel's version) + 43 e000 ; http://www.pagetable.com/?p=32 + 44 e000 ;./dasm a1basic.asm -DPAGETBASIC=0 -oa1pbas.o -la1pbas.lst + 45 e000 ; + 46 e000 ;------------------------------------------------------------------------ + 47 e000 ;------------------------------------------------------------------------- + 48 e000 ; Defines - this code can be built one of four ways + 49 e000 ; 1. clone/real Apple 1 HW + 50 e000 ; 2. runs in ram of real or virtual Apple 2 + 51 e000 ; 3. runs in virtual apple 2 as ROM + 52 e000 ; 4. runs in plug in board of real Apple 2 + 53 e000 ; + 54 e000 ; select one of these three options + 55 e000 ;------------------------------------------------------------------------- + 56 e000 + 57 e000 ;BLD4APPLE1 EQU 0 ;ACTUAL APPLE 1 or CLONE + 58 e000 ;BLD4RAM EQU 0 ;RAM of virtual or real A2 + 59 e000 ;BLD4EMULROM EQU 0 ;ROM of virtual A2 + 60 e000 ;BLD4ROMBD EQU 0 ;ROM board in Real A2 + 61 e000 + 62 e000 + 63 e000 ;------------------------------------------------------------------------ + 64 e000 ; BASIC source taken from http://www.brouhaha.com + 65 e000 ; IFCONST added to allow building Apple 1 basic version found + 66 e000 ; on Vince Briels site + 67 e000 ;------------------------------------------------------------------------ + 68 e000 ; up to four versions of Apple 1 Basic Known + 69 e000 ; use defines to control which one we build + 70 e000 ;SNDERBASIC EQU 0 ;from Wendell Sander's site (DEFAULT) + 71 e000 ;SMITHBASIC EQU 0 ;original source from brouhaha.com + 72 e000 ;BRIELBASIC EQU 0 ;version used in Replica 1 + 73 e000 ;HUSTNBASIC EQU 0 ;huston version from Wendell's site + 74 e000 + 75 e000 + 76 e000 ;------------------------------------------------------------------------ + 77 e000 ; Disassembly of Apple 1 BASIC + 78 e000 ; 17-Sep-2003 + 79 e000 ; Apple 1 BASIC was written by Steve Wozniak + 80 e000 ; This disassembly is copyright 2003 Eric Smith + 81 e000 ; http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ + 82 e000 ;------------------------------------------------------------------------ + 83 e000 + 84 e000 00 00 LOCZERO EQU $00 + 85 e000 00 1d Z1d EQU $1d + 86 e000 00 24 ch EQU $24 + 87 e000 00 25 cv EQU $25 + 88 e000 00 48 zp48 EQU $48 + 89 e000 00 49 zp49 EQU $49 + 90 e000 00 4a lomem EQU $4a + 91 e000 00 4b zp4b EQU $4b + 92 e000 00 4c himem EQU $4c + 93 e000 00 4d zp4d EQU $4d + 94 e000 00 4e rnd EQU $4e + 95 e000 00 50 noun_stk_l EQU $50 + 96 e000 00 58 syn_stk_h EQU $58 + 97 e000 00 60 zp60 EQU $60 + 98 e000 00 78 noun_stk_h_str EQU $78 + 99 e000 00 80 syn_stk_l EQU $80 + 100 e000 00 85 zp85 EQU $85 + 101 e000 00 a0 noun_stk_h_int EQU $a0 + 102 e000 00 a8 txtndxstk EQU $a8 + 103 e000 00 c8 text_index EQU $c8 + 104 e000 00 c9 leadbl EQU $c9 + 105 e000 00 ca pp EQU $ca + 106 e000 00 cb zpcb EQU $cb + 107 e000 00 cc pv EQU $cc + 108 e000 00 ce acc EQU $ce + 109 e000 00 cf zpcf EQU $cf + 110 e000 00 d0 srch EQU $d0 + 111 e000 00 d1 tokndxstk EQU $d1 + 112 e000 00 d2 srch2 EQU $d2 + 113 e000 00 d4 if_flag EQU $d4 + 114 e000 00 d5 cr_flag EQU $d5 + 115 e000 00 d6 current_verb EQU $d6 + 116 e000 00 d7 precedence EQU $d7 + 117 e000 00 d8 x_save EQU $d8 + 118 e000 00 d9 run_flag EQU $d9 + 119 e000 00 da aux EQU $da + 120 e000 00 dc pline EQU $dc + 121 e000 00 e0 pverb EQU $e0 + 122 e000 00 e2 p1 EQU $e2 + 123 e000 00 e4 p2 EQU $e4 + 124 e000 00 e6 p3 EQU $e6 + 125 e000 00 f1 token_index EQU $f1 + 126 e000 00 f2 pcon EQU $f2 + 127 e000 00 f4 auto_inc EQU $f4 + 128 e000 00 f6 auto_ln EQU $f6 + 129 e000 00 f8 auto_flag EQU $f8 + 130 e000 00 f9 char EQU $f9 + 131 e000 00 fa leadzr EQU $fa + 132 e000 00 fb for_nest_count EQU $fb + 133 e000 00 fc gosub_nest_count EQU $fc + 134 e000 00 fd synstkdx EQU $fd + 135 e000 00 fe synpag EQU $fe + 136 e000 01 00 gstk_pverbl EQU $0100 + 137 e000 01 08 gstk_pverbh EQU $0108 + 138 e000 01 10 gstk_plinel EQU $0110 + 139 e000 01 18 gstk_plineh EQU $0118 + 140 e000 01 20 fstk_varl EQU $0120 + 141 e000 01 28 fstk_varh EQU $0128 + 142 e000 01 30 fstk_stepl EQU $0130 + 143 e000 01 38 fstk_steph EQU $0138 + 144 e000 01 40 fstk_plinel EQU $0140 + 145 e000 01 48 fstk_plineh EQU $0148 + 146 e000 01 50 fstk_pverbl EQU $0150 + 147 e000 01 58 fstk_pverbh EQU $0158 + 148 e000 01 60 fstk_tol EQU $0160 + 149 e000 01 68 fstk_toh EQU $0168 + 150 e000 02 00 buffer EQU $0200 + 151 e000 + 152 e000 - IFCONST BLD4APPLE1 + 153 e000 - IFCONST SMITHBASIC + 154 e000 -DSP EQU $D0F2 ;DISPLAY port in PIA + 155 e000 -KBDCR EQU $D0F1 ;Keyboard control port + 156 e000 -KBD EQU $D0F0 ;KEYBOARD data port + 157 e000 - ENDIF + 158 e000 - IFCONST BRIELBASIC + 159 e000 -DSP EQU $D012 ;DISPLAY port in PIA + 160 e000 -KBDCR EQU $D011 ;Keyboard control port (WS BASIC) + 161 e000 -KBD EQU $D010 ;KEYBOARD data port + 162 e000 - ENDIF + 163 e000 - IFCONST SNDERBASIC + 164 e000 -DSP EQU $D0F2 ;DISPLAY port in PIA + 165 e000 -KBDCR EQU $D011 ;Keyboard control port (WS BASIC) + 166 e000 -KBD EQU $D010 ;KEYBOARD data port + 167 e000 - ENDIF + 168 e000 - IFCONST HUSTNBASIC + 169 e000 -DSP EQU $D0F2 ;DISPLAY port in PIA + 170 e000 -KBDCR EQU $D011 ;Keyboard control port (WS BASIC) + 171 e000 -KBD EQU $D010 ;KEYBOARD data port + 172 e000 - ENDIF + 173 e000 - + 174 e000 ENDIF + 175 e000 - IFCONST BLD4RAM + 176 e000 - ORG $7000 + 177 e000 ELSE + 178 e000 ORG $E000 + 179 e000 ENDIF + 180 e000 + 181 e000 4c b0 e2 Pe000 JMP cold + 182 e003 + 183 e003 rdkey + 184 e003 - IFCONST BLD4APPLE1 + 185 e003 - LDA KBDCR ;Wait for key press + 186 e003 - BPL rdkey ;No key yet! + 187 e003 - LDA KBD ;Clear strobe + 188 e003 ELSE + 189 e003 20 4d d2 JSR A2GETCHAR + 190 e006 ea NOP + 191 e007 ea NOP + 192 e008 ea NOP + 193 e009 ea NOP + 194 e00a ea NOP + 195 e00b ENDIF + 196 e00b 60 RTS + 197 e00c + 198 e00c 8a Se00c TXA + 199 e00d 29 20 AND #$20 ; 32 + 200 e00f f0 23 BEQ Le034 + 201 e011 + 202 e011 a9 a0 Se011 LDA #$a0 ; 160 + 203 e013 85 e4 STA p2 + 204 e015 4c c9 e3 JMP cout + 205 e018 + 206 e018 a9 20 Se018 LDA #$20 ; 32 + 207 e01a + 208 e01a c5 24 Se01a CMP ch + 209 e01c b0 0c BCS nextbyte + 210 e01e a9 8d LDA #$8d ; 141 . + 211 e020 a0 07 LDY #$07 ; 7 . + 212 e022 20 c9 e3 Le022 JSR cout + 213 e025 a9 a0 LDA #$a0 ; 160 + 214 e027 88 DEY + 215 e028 d0 f8 BNE Le022 + 216 e02a + 217 e02a a0 00 nextbyte LDY #$00 ; 0 . + 218 e02c b1 e2 LDA (p1),Y + 219 e02e e6 e2 INC p1 + 220 e030 d0 02 BNE Le034 + 221 e032 e6 e3 INC p1+1 + 222 e034 60 Le034 RTS + 223 e035 + 224 e035 20 15 e7 list_comman JSR get16bit + 225 e038 20 76 e5 JSR find_line2 + 226 e03b a5 e2 Le03b LDA p1 + 227 e03d c5 e6 CMP p3 + 228 e03f a5 e3 LDA p1+1 + 229 e041 e5 e7 SBC p3+1 + 230 e043 b0 ef BCS Le034 + 231 e045 20 6d e0 JSR list_line + 232 e048 4c 3b e0 JMP Le03b + 233 e04b + 234 e04b a5 ca list_all LDA pp + 235 e04d 85 e2 STA p1 + 236 e04f a5 cb LDA pp+1 + 237 e051 85 e3 STA p1+1 + 238 e053 a5 4c LDA himem + 239 e055 85 e6 STA p3 + 240 e057 a5 4d LDA himem+1 + 241 e059 85 e7 STA p3+1 + 242 e05b d0 de BNE Le03b + 243 e05d + 244 e05d 20 15 e7 list_cmd JSR get16bit + 245 e060 20 6d e5 JSR find_line + 246 e063 a5 e4 LDA p2 + 247 e065 85 e2 STA p1 + 248 e067 a5 e5 LDA p2+1 + 249 e069 85 e3 STA p1+1 + 250 e06b b0 c7 BCS Le034 + 251 e06d + 252 e06d 86 d8 list_line STX x_save + 253 e06f a9 a0 LDA #$a0 ; 160 + 254 e071 85 fa STA leadzr + 255 e073 20 2a e0 JSR nextbyte + 256 e076 98 TYA + 257 e077 85 e4 list_int STA p2 + 258 e079 20 2a e0 JSR nextbyte + 259 e07c aa TAX + 260 e07d 20 2a e0 JSR nextbyte + 261 e080 20 1b e5 JSR prdec + 262 e083 20 18 e0 Le083 JSR Se018 + 263 e086 84 fa STY leadzr + 264 e088 aa TAX + 265 e089 10 18 BPL list_token + 266 e08b 0a ASL + 267 e08c 10 e9 BPL list_int + 268 e08e a5 e4 LDA p2 + 269 e090 d0 03 BNE Le095 + 270 e092 20 11 e0 JSR Se011 + 271 e095 8a Le095 TXA + 272 e096 20 c9 e3 Le096 JSR cout + 273 e099 a9 25 Le099 LDA #$25 ; 37 % + 274 e09b 20 1a e0 JSR Se01a + 275 e09e aa TAX + 276 e09f 30 f5 BMI Le096 + 277 e0a1 85 e4 STA p2 + 278 e0a3 c9 01 list_token CMP #$01 ; 1 . + 279 e0a5 d0 05 BNE Le0ac + 280 e0a7 a6 d8 LDX x_save + 281 e0a9 4c cd e3 JMP crout + 282 e0ac 48 Le0ac PHA + 283 e0ad 84 ce STY acc + 284 e0af a2 ed LDX #[syntabl2>>8] ; $ED, when from ROM, $AD from RAM + 285 e0b1 86 cf STX acc+1 + 286 e0b3 c9 51 CMP #$51 ; 81 Q + 287 e0b5 90 04 BCC Le0bb + 288 e0b7 c6 cf DEC acc+1 + 289 e0b9 e9 50 SBC #$50 ; 80 P + 290 e0bb 48 Le0bb PHA + 291 e0bc b1 ce LDA (acc),Y + 292 e0be aa Le0be TAX + 293 e0bf 88 DEY + 294 e0c0 b1 ce LDA (acc),Y + 295 e0c2 10 fa BPL Le0be + 296 e0c4 e0 c0 CPX #$c0 ; 192 @ + 297 e0c6 b0 04 BCS Le0cc + 298 e0c8 e0 00 CPX #$00 ; 0 . + 299 e0ca 30 f2 BMI Le0be + 300 e0cc aa Le0cc TAX + 301 e0cd 68 PLA + 302 e0ce e9 01 SBC #$01 ; 1 . + 303 e0d0 d0 e9 BNE Le0bb + 304 e0d2 24 e4 BIT p2 + 305 e0d4 30 03 BMI Le0d9 + 306 e0d6 20 f8 ef JSR Seff8 + 307 e0d9 b1 ce Le0d9 LDA (acc),Y + 308 e0db 10 10 BPL Le0ed + 309 e0dd aa TAX + 310 e0de 29 3f AND #$3f ; 63 ? + 311 e0e0 85 e4 STA p2 + 312 e0e2 18 CLC + 313 e0e3 69 a0 ADC #$a0 ; 160 + 314 e0e5 20 c9 e3 JSR cout + 315 e0e8 88 DEY + 316 e0e9 e0 c0 CPX #$c0 ; 192 @ + 317 e0eb 90 ec BCC Le0d9 + 318 e0ed 20 0c e0 Le0ed JSR Se00c + 319 e0f0 68 PLA + 320 e0f1 c9 5d CMP #$5d ; 93 ] + 321 e0f3 f0 a4 BEQ Le099 + 322 e0f5 c9 28 CMP #$28 ; 40 ( + 323 e0f7 d0 8a BNE Le083 + 324 e0f9 f0 9e BEQ Le099 + 325 e0fb + 326 e0fb 20 18 e1 paren_substr JSR Se118 + 327 e0fe 95 50 STA noun_stk_l,X + 328 e100 d5 78 CMP noun_stk_h_str,X + 329 e102 90 11 Le102 BCC Le115 + 330 e104 a0 2b string_err LDY #$2b ; 43 + + 331 e106 4c e0 e3 go_errmess_1 JMP print_err_msg + 332 e109 + 333 e109 20 34 ee comma_substr JSR getbyte + 334 e10c d5 50 CMP noun_stk_l,X + 335 e10e 90 f4 BCC string_err + 336 e110 20 e4 ef JSR Sefe4 + 337 e113 95 78 STA noun_stk_h_str,X + 338 e115 4c 23 e8 Le115 JMP left_paren + 339 e118 + 340 e118 20 34 ee Se118 JSR getbyte + 341 e11b f0 e7 BEQ string_err + 342 e11d 38 SEC + 343 e11e e9 01 SBC #$01 ; 1 . + 344 e120 60 RTS + 345 e121 + 346 e121 20 18 e1 str_arr_dest JSR Se118 + 347 e124 95 50 STA noun_stk_l,X + 348 e126 18 CLC + 349 e127 f5 78 SBC noun_stk_h_str,X + 350 e129 4c 02 e1 JMP Le102 + 351 e12c a0 14 Le12c LDY #$14 ; 20 . + 352 e12e d0 d6 BNE go_errmess_1 + 353 e130 + 354 e130 20 18 e1 dim_str JSR Se118 + 355 e133 e8 INX + 356 e134 b5 50 Le134 LDA noun_stk_l,X + 357 e136 85 da STA aux + 358 e138 65 ce ADC acc + 359 e13a 48 PHA + 360 e13b a8 TAY + 361 e13c b5 78 LDA noun_stk_h_str,X + 362 e13e 85 db STA aux+1 + 363 e140 65 cf ADC acc+1 + 364 e142 48 PHA + 365 e143 c4 ca CPY pp + 366 e145 e5 cb SBC pp+1 + 367 e147 b0 e3 BCS Le12c + 368 e149 a5 da LDA aux + 369 e14b 69 fe ADC #$fe ; 254 ~ + 370 e14d 85 da STA aux + 371 e14f a9 ff LDA #$ff ; 255 . + 372 e151 a8 TAY + 373 e152 65 db ADC aux+1 + 374 e154 85 db STA aux+1 + 375 e156 c8 Le156 INY + 376 e157 b1 da LDA (aux),Y + 377 e159 d9 cc 00 CMP pv,Y + 378 e15c d0 0f BNE Le16d + 379 e15e 98 TYA + 380 e15f f0 f5 BEQ Le156 + 381 e161 68 Le161 PLA + 382 e162 91 da STA (aux),Y + 383 e164 99 cc 00 STA pv,Y + 384 e167 88 DEY + 385 e168 10 f7 BPL Le161 + 386 e16a e8 INX + 387 e16b 60 RTS + 388 e16c ea NOP ; "j" + 389 e16d a0 80 Le16d LDY #$80 ; 128 . + 390 e16f d0 95 Le16f BNE go_errmess_1 + 391 e171 + 392 e171 a9 00 input_str LDA #$00 ; 0 . + 393 e173 20 0a e7 JSR push_a_noun_stk + 394 e176 a0 02 LDY #$02 ; 2 . + 395 e178 94 78 STY noun_stk_h_str,X + 396 e17a 20 0a e7 JSR push_a_noun_stk + 397 e17d a9 bf LDA #$bf ; 191 ? + 398 e17f 20 c9 e3 JSR cout + 399 e182 a0 00 LDY #$00 ; 0 . + 400 e184 20 9e e2 JSR read_line + 401 e187 94 78 STY noun_stk_h_str,X + 402 e189 ea NOP + 403 e18a ea NOP + 404 e18b ea NOP + 405 e18c + 406 e18c b5 51 string_lit LDA noun_stk_l+1,X + 407 e18e 85 ce STA acc + 408 e190 b5 79 LDA noun_stk_h_str+1,X + 409 e192 85 cf STA acc+1 + 410 e194 e8 INX + 411 e195 e8 INX + 412 e196 20 bc e1 JSR Se1bc + 413 e199 b5 4e Le199 LDA rnd,X + 414 e19b d5 76 CMP syn_stk_h+30,X + 415 e19d b0 15 BCS Le1b4 + 416 e19f f6 4e INC rnd,X + 417 e1a1 a8 TAY + 418 e1a2 b1 ce LDA (acc),Y + 419 e1a4 b4 50 LDY noun_stk_l,X + 420 e1a6 c4 e4 CPY p2 + 421 e1a8 90 04 BCC Le1ae + 422 e1aa a0 83 LDY #$83 ; 131 . + 423 e1ac d0 c1 BNE Le16f + 424 e1ae 91 da Le1ae STA (aux),Y + 425 e1b0 f6 50 INC noun_stk_l,X + 426 e1b2 90 e5 BCC Le199 + 427 e1b4 b4 50 Le1b4 LDY noun_stk_l,X + 428 e1b6 8a TXA + 429 e1b7 91 da STA (aux),Y + 430 e1b9 e8 INX + 431 e1ba e8 INX + 432 e1bb 60 RTS + 433 e1bc + 434 e1bc b5 51 Se1bc LDA noun_stk_l+1,X + 435 e1be 85 da STA aux + 436 e1c0 38 SEC + 437 e1c1 e9 02 SBC #$02 ; 2 . + 438 e1c3 85 e4 STA p2 + 439 e1c5 b5 79 LDA noun_stk_h_str+1,X + 440 e1c7 85 db STA aux+1 + 441 e1c9 e9 00 SBC #$00 ; 0 . + 442 e1cb 85 e5 STA p2+1 + 443 e1cd a0 00 LDY #$00 ; 0 . + 444 e1cf b1 e4 LDA (p2),Y + 445 e1d1 18 CLC + 446 e1d2 e5 da SBC aux + 447 e1d4 85 e4 STA p2 + 448 e1d6 60 RTS + 449 e1d7 + 450 e1d7 b5 53 string_eq LDA noun_stk_l+3,X + 451 e1d9 85 ce STA acc + 452 e1db b5 7b LDA noun_stk_h_str+3,X + 453 e1dd 85 cf STA acc+1 + 454 e1df b5 51 LDA noun_stk_l+1,X + 455 e1e1 85 da STA aux + 456 e1e3 b5 79 LDA noun_stk_h_str+1,X + 457 e1e5 85 db STA aux+1 + 458 e1e7 e8 INX + 459 e1e8 e8 INX + 460 e1e9 e8 INX + 461 e1ea a0 00 LDY #$00 ; 0 . + 462 e1ec 94 78 STY noun_stk_h_str,X + 463 e1ee 94 a0 STY noun_stk_h_int,X + 464 e1f0 c8 INY + 465 e1f1 94 50 STY noun_stk_l,X + 466 e1f3 b5 4d Le1f3 LDA himem+1,X + 467 e1f5 d5 75 CMP syn_stk_h+29,X + 468 e1f7 08 PHP + 469 e1f8 48 PHA + 470 e1f9 b5 4f LDA rnd+1,X + 471 e1fb d5 77 CMP syn_stk_h+31,X + 472 e1fd 90 07 BCC Le206 + 473 e1ff 68 PLA + 474 e200 28 PLP + 475 e201 b0 02 BCS Le205 + 476 e203 56 50 Le203 LSR noun_stk_l,X + 477 e205 60 Le205 RTS + 478 e206 a8 Le206 TAY + 479 e207 b1 ce LDA (acc),Y + 480 e209 85 e4 STA p2 + 481 e20b 68 PLA + 482 e20c a8 TAY + 483 e20d 28 PLP + 484 e20e b0 f3 BCS Le203 + 485 e210 b1 da LDA (aux),Y + 486 e212 c5 e4 CMP p2 + 487 e214 d0 ed BNE Le203 + 488 e216 f6 4f INC rnd+1,X + 489 e218 f6 4d INC himem+1,X + 490 e21a b0 d7 BCS Le1f3 + 491 e21c + 492 e21c 20 d7 e1 string_neq JSR string_eq + 493 e21f 4c 36 e7 JMP not_op + 494 e222 + 495 e222 20 54 e2 mult_op JSR Se254 + 496 e225 06 ce Le225 ASL acc + 497 e227 26 cf ROL acc+1 + 498 e229 90 0d BCC Le238 + 499 e22b 18 CLC + 500 e22c a5 e6 LDA p3 + 501 e22e 65 da ADC aux + 502 e230 85 e6 STA p3 + 503 e232 a5 e7 LDA p3+1 + 504 e234 65 db ADC aux+1 + 505 e236 85 e7 STA p3+1 + 506 e238 88 Le238 DEY + 507 e239 f0 09 BEQ Le244 + 508 e23b 06 e6 ASL p3 + 509 e23d 26 e7 ROL p3+1 + 510 e23f 10 e4 BPL Le225 + 511 e241 4c 7e e7 JMP Le77e + 512 e244 a5 e6 Le244 LDA p3 + 513 e246 20 08 e7 JSR push_ya_noun_stk + 514 e249 a5 e7 LDA p3+1 + 515 e24b 95 a0 STA noun_stk_h_int,X + 516 e24d 06 e5 ASL p2+1 + 517 e24f 90 28 BCC Le279 + 518 e251 4c 6f e7 JMP negate + 519 e254 + 520 e254 a9 55 Se254 LDA #$55 ; 85 U + 521 e256 85 e5 STA p2+1 + 522 e258 20 5b e2 JSR Se25b + 523 e25b + 524 e25b a5 ce Se25b LDA acc + 525 e25d 85 da STA aux + 526 e25f a5 cf LDA acc+1 + 527 e261 85 db STA aux+1 + 528 e263 20 15 e7 JSR get16bit + 529 e266 84 e6 STY p3 + 530 e268 84 e7 STY p3+1 + 531 e26a a5 cf LDA acc+1 + 532 e26c 10 09 BPL Le277 + 533 e26e ca DEX + 534 e26f 06 e5 ASL p2+1 + 535 e271 20 6f e7 JSR negate + 536 e274 20 15 e7 JSR get16bit + 537 e277 a0 10 Le277 LDY #$10 ; 16 . + 538 e279 60 Le279 RTS + 539 e27a + 540 e27a 20 6c ee mod_op JSR See6c + 541 e27d f0 c5 BEQ Le244 + 542 e27f ff DC.B $ff ; "." + 543 e280 c9 84 Le280 CMP #$84 ; 132 . + 544 e282 d0 02 BNE Le286 + 545 e284 46 f8 LSR auto_flag + 546 e286 c9 df Le286 CMP #$df ; 223 _ + 547 e288 f0 11 BEQ Le29b + 548 e28a c9 9b CMP #$9b ; 155 . + 549 e28c f0 06 BEQ Le294 + 550 e28e 99 00 02 STA buffer,Y + 551 e291 c8 INY + 552 e292 10 0a BPL read_line + 553 e294 a0 8b Le294 LDY #$8b ; 139 . + 554 e296 20 c4 e3 JSR Se3c4 + 555 e299 + 556 e299 a0 01 Se299 LDY #$01 ; 1 . + 557 e29b 88 Le29b DEY + 558 e29c 30 f6 BMI Le294 + 559 e29e + 560 e29e 20 03 e0 read_line JSR rdkey + 561 e2a1 ea NOP + 562 e2a2 ea NOP + 563 e2a3 20 c9 e3 JSR cout + 564 e2a6 c9 8d CMP #$8d ; 141 . + 565 e2a8 d0 d6 BNE Le280 + 566 e2aa a9 df LDA #$df ; 223 _ + 567 e2ac 99 00 02 STA buffer,Y + 568 e2af 60 RTS + 569 e2b0 20 d3 ef cold JSR mem_init_4k + 570 e2b3 20 cd e3 warm JSR crout + 571 e2b6 46 d9 Le2b6 LSR run_flag + 572 e2b8 a9 be LDA #$be ; 190 > + 573 e2ba 20 c9 e3 JSR cout + 574 e2bd a0 00 LDY #$00 ; 0 . + 575 e2bf 84 fa STY leadzr + 576 e2c1 24 f8 BIT auto_flag + 577 e2c3 10 0c BPL Le2d1 + 578 e2c5 a6 f6 LDX auto_ln + 579 e2c7 a5 f7 LDA auto_ln+1 + 580 e2c9 20 1b e5 JSR prdec + 581 e2cc a9 a0 LDA #$a0 ; 160 + 582 e2ce 20 c9 e3 JSR cout + 583 e2d1 a2 ff Le2d1 LDX #$ff ; 255 . + 584 e2d3 9a TXS + 585 e2d4 20 9e e2 JSR read_line + 586 e2d7 84 f1 STY token_index + 587 e2d9 8a TXA + 588 e2da 85 c8 STA text_index + 589 e2dc a2 20 LDX #$20 ; 32 + 590 e2de 20 91 e4 JSR Se491 + 591 e2e1 a5 c8 LDA text_index + 592 e2e3 69 00 ADC #$00 ; 0 . + 593 e2e5 85 e0 STA pverb + 594 e2e7 a9 00 LDA #$00 ; 0 . + 595 e2e9 aa TAX + 596 e2ea 69 02 ADC #$02 ; 2 . + 597 e2ec 85 e1 STA pverb+1 + 598 e2ee a1 e0 LDA (pverb,X) + 599 e2f0 29 f0 AND #$f0 ; 240 p + 600 e2f2 c9 b0 CMP #$b0 ; 176 0 + 601 e2f4 f0 03 BEQ Le2f9 + 602 e2f6 4c 83 e8 JMP Le883 + 603 e2f9 a0 02 Le2f9 LDY #$02 ; 2 . + 604 e2fb b1 e0 Le2fb LDA (pverb),Y + 605 e2fd 99 cd 00 STA pv+1,Y + 606 e300 88 DEY + 607 e301 d0 f8 BNE Le2fb + 608 e303 20 8a e3 JSR Se38a + 609 e306 a5 f1 LDA token_index + 610 e308 e5 c8 SBC text_index + 611 e30a c9 04 CMP #$04 ; 4 . + 612 e30c f0 a8 BEQ Le2b6 + 613 e30e 91 e0 STA (pverb),Y + 614 e310 a5 ca LDA pp + 615 e312 f1 e0 SBC (pverb),Y + 616 e314 85 e4 STA p2 + 617 e316 a5 cb LDA pp+1 + 618 e318 e9 00 SBC #$00 ; 0 . + 619 e31a 85 e5 STA p2+1 + 620 e31c a5 e4 LDA p2 + 621 e31e c5 cc CMP pv + 622 e320 a5 e5 LDA p2+1 + 623 e322 e5 cd SBC pv+1 + 624 e324 90 45 BCC Le36b + 625 e326 a5 ca Le326 LDA pp + 626 e328 f1 e0 SBC (pverb),Y + 627 e32a 85 e6 STA p3 + 628 e32c a5 cb LDA pp+1 + 629 e32e e9 00 SBC #$00 ; 0 . + 630 e330 85 e7 STA p3+1 + 631 e332 b1 ca LDA (pp),Y + 632 e334 91 e6 STA (p3),Y + 633 e336 e6 ca INC pp + 634 e338 d0 02 BNE Le33c + 635 e33a e6 cb INC pp+1 + 636 e33c a5 e2 Le33c LDA p1 + 637 e33e c5 ca CMP pp + 638 e340 a5 e3 LDA p1+1 + 639 e342 e5 cb SBC pp+1 + 640 e344 b0 e0 BCS Le326 + 641 e346 b5 e4 Le346 LDA p2,X + 642 e348 95 ca STA pp,X + 643 e34a ca DEX + 644 e34b 10 f9 BPL Le346 + 645 e34d b1 e0 LDA (pverb),Y + 646 e34f a8 TAY + 647 e350 88 Le350 DEY + 648 e351 b1 e0 LDA (pverb),Y + 649 e353 91 e6 STA (p3),Y + 650 e355 98 TYA + 651 e356 d0 f8 BNE Le350 + 652 e358 24 f8 BIT auto_flag + 653 e35a 10 09 BPL Le365 + 654 e35c b5 f7 Le35c LDA auto_ln+1,X + 655 e35e 75 f5 ADC auto_inc+1,X + 656 e360 95 f7 STA auto_ln+1,X + 657 e362 e8 INX + 658 e363 f0 f7 BEQ Le35c + 659 e365 10 7e Le365 BPL Le3e5 + 660 e367 00 BRK + 661 e368 00 BRK + 662 e369 00 BRK + 663 e36a 00 BRK ; "..." + 664 e36b a0 14 Le36b LDY #$14 ; 20 . + 665 e36d d0 71 BNE print_err_msg + 666 e36f + 667 e36f 20 15 e7 del_comma JSR get16bit + 668 e372 a5 e2 LDA p1 + 669 e374 85 e6 STA p3 + 670 e376 a5 e3 LDA p1+1 + 671 e378 85 e7 STA p3+1 + 672 e37a 20 75 e5 JSR find_line1 + 673 e37d a5 e2 LDA p1 + 674 e37f 85 e4 STA p2 + 675 e381 a5 e3 LDA p1+1 + 676 e383 85 e5 STA p2+1 + 677 e385 d0 0e BNE Le395 + 678 e387 + 679 e387 20 15 e7 del_cmd JSR get16bit + 680 e38a + 681 e38a 20 6d e5 Se38a JSR find_line + 682 e38d a5 e6 LDA p3 + 683 e38f 85 e2 STA p1 + 684 e391 a5 e7 LDA p3+1 + 685 e393 85 e3 STA p1+1 + 686 e395 a0 00 Le395 LDY #$00 ; 0 . + 687 e397 a5 ca Le397 LDA pp + 688 e399 c5 e4 CMP p2 + 689 e39b a5 cb LDA pp+1 + 690 e39d e5 e5 SBC p2+1 + 691 e39f b0 16 BCS Le3b7 + 692 e3a1 a5 e4 LDA p2 + 693 e3a3 d0 02 BNE Le3a7 + 694 e3a5 c6 e5 DEC p2+1 + 695 e3a7 c6 e4 Le3a7 DEC p2 + 696 e3a9 a5 e6 LDA p3 + 697 e3ab d0 02 BNE Le3af + 698 e3ad c6 e7 DEC p3+1 + 699 e3af c6 e6 Le3af DEC p3 + 700 e3b1 b1 e4 LDA (p2),Y + 701 e3b3 91 e6 STA (p3),Y + 702 e3b5 90 e0 BCC Le397 + 703 e3b7 a5 e6 Le3b7 LDA p3 + 704 e3b9 85 ca STA pp + 705 e3bb a5 e7 LDA p3+1 + 706 e3bd 85 cb STA pp+1 + 707 e3bf 60 RTS + 708 e3c0 20 c9 e3 Le3c0 JSR cout + 709 e3c3 c8 INY + 710 e3c4 + 711 e3c4 b9 00 eb Se3c4 LDA error_msg_tbl,Y + 712 e3c7 30 f7 BMI Le3c0 + 713 e3c9 + 714 e3c9 c9 8d cout CMP #$8d ; 141 . + 715 e3cb d0 06 BNE Le3d3 + 716 e3cd + 717 e3cd a9 00 crout LDA #$00 ; 0 . + 718 e3cf 85 24 STA ch + 719 e3d1 a9 8d LDA #$8d ; 141 . + 720 e3d3 e6 24 Le3d3 INC ch + 721 e3d5 Le3d5 + 722 e3d5 - IFCONST BLD4APPLE1 + 723 e3d5 - BIT DSP + 724 e3d5 - BMI Le3d5 + 725 e3d5 - STA DSP + 726 e3d5 ELSE + 727 e3d5 20 ef ff JSR ECHO ; use monitor function to output + 728 e3d8 ea nop + 729 e3d9 ea nop + 730 e3da ea nop + 731 e3db ea nop + 732 e3dc ea nop + 733 e3dd ENDIF + 734 e3dd + 735 e3dd 60 RTS + 736 e3de a0 06 too_long_err LDY #$06 ; 6 + 737 e3e0 20 d3 ee print_err_msg JSR print_err_msg2 + 738 e3e3 24 d9 BIT run_flag + 739 e3e5 30 03 Le3e5 BMI Le3ea + 740 e3e7 4c b6 e2 JMP Le2b6 + 741 e3ea 4c 9a eb Le3ea JMP Leb9a + 742 e3ed 2a Le3ed ROL + 743 e3ee 69 a0 ADC #$a0 ; 160 + 744 e3f0 dd 00 02 CMP buffer,X + 745 e3f3 d0 53 BNE Le448 + 746 e3f5 b1 fe LDA (synpag),Y + 747 e3f7 0a ASL + 748 e3f8 30 06 BMI Le400 + 749 e3fa 88 DEY + 750 e3fb b1 fe LDA (synpag),Y + 751 e3fd 30 29 BMI Le428 + 752 e3ff c8 INY + 753 e400 86 c8 Le400 STX text_index + 754 e402 98 TYA + 755 e403 48 PHA + 756 e404 a2 00 LDX #$00 ; 0 . + 757 e406 a1 fe LDA (synpag,X) + 758 e408 aa TAX + 759 e409 4a Le409 LSR + 760 e40a 49 48 EOR #$48 ; 72 H + 761 e40c 11 fe ORA (synpag),Y + 762 e40e c9 c0 CMP #$c0 ; 192 @ + 763 e410 90 01 BCC Le413 + 764 e412 e8 INX + 765 e413 c8 Le413 INY + 766 e414 d0 f3 BNE Le409 + 767 e416 68 PLA + 768 e417 a8 TAY + 769 e418 8a TXA + 770 e419 4c c0 e4 JMP Le4c0 + 771 e41c + 772 e41c e6 f1 put_token INC token_index + 773 e41e a6 f1 LDX token_index + 774 e420 f0 bc BEQ too_long_err + 775 e422 9d 00 02 STA buffer,X + 776 e425 60 Le425 RTS + 777 e426 a6 c8 Le426 LDX text_index + 778 e428 a9 a0 Le428 LDA #$a0 ; 160 + 779 e42a e8 Le42a INX + 780 e42b dd 00 02 CMP buffer,X + 781 e42e b0 fa BCS Le42a + 782 e430 b1 fe LDA (synpag),Y + 783 e432 29 3f AND #$3f ; 63 ? + 784 e434 4a LSR + 785 e435 d0 b6 BNE Le3ed + 786 e437 bd 00 02 LDA buffer,X + 787 e43a b0 06 BCS Le442 + 788 e43c 69 3f ADC #$3f ; 63 ? + 789 e43e c9 1a CMP #$1a ; 26 . + 790 e440 90 6f BCC Le4b1 + 791 e442 69 4f Le442 ADC #$4f ; 79 O + 792 e444 c9 0a CMP #$0a ; 10 . + 793 e446 90 69 BCC Le4b1 + 794 e448 a6 fd Le448 LDX synstkdx + 795 e44a c8 Le44a INY + 796 e44b b1 fe LDA (synpag),Y + 797 e44d 29 e0 AND #$e0 ; 224 ` + 798 e44f c9 20 CMP #$20 ; 32 + 799 e451 f0 7a BEQ Le4cd + 800 e453 b5 a8 LDA txtndxstk,X + 801 e455 85 c8 STA text_index + 802 e457 b5 d1 LDA tokndxstk,X + 803 e459 85 f1 STA token_index + 804 e45b 88 Le45b DEY + 805 e45c b1 fe LDA (synpag),Y + 806 e45e 0a ASL + 807 e45f 10 fa BPL Le45b + 808 e461 88 DEY + 809 e462 b0 38 BCS Le49c + 810 e464 0a ASL + 811 e465 30 35 BMI Le49c + 812 e467 b4 58 LDY syn_stk_h,X + 813 e469 84 ff STY synpag+1 + 814 e46b b4 80 LDY syn_stk_l,X + 815 e46d e8 INX + 816 e46e 10 da BPL Le44a + 817 e470 f0 b3 Le470 BEQ Le425 + 818 e472 c9 7e CMP #$7e ; 126 ~ + 819 e474 b0 22 BCS Le498 + 820 e476 ca DEX + 821 e477 10 04 BPL Le47d + 822 e479 a0 06 LDY #$06 ; 6 . + 823 e47b 10 29 BPL go_errmess_2 + 824 e47d 94 80 Le47d STY syn_stk_l,X + 825 e47f a4 ff LDY synpag+1 + 826 e481 94 58 STY syn_stk_h,X + 827 e483 a4 c8 LDY text_index + 828 e485 94 a8 STY txtndxstk,X + 829 e487 a4 f1 LDY token_index + 830 e489 94 d1 STY tokndxstk,X + 831 e48b 29 1f AND #$1f ; 31 . + 832 e48d a8 TAY + 833 e48e b9 20 ec LDA syntabl_index,Y + 834 e491 + 835 e491 0a Se491 ASL + 836 e492 a8 TAY + 837 e493 ; when running from a000, shifts to AC or AD + 838 e493 ; when running from e000 shifts to EC or ED + 839 e493 a9 76 LDA #[syntabl_index>>9] + 840 e495 2a ROL + 841 e496 85 ff STA synpag+1 + 842 e498 d0 01 Le498 BNE Le49b + 843 e49a c8 INY + 844 e49b c8 Le49b INY + 845 e49c 86 fd Le49c STX synstkdx + 846 e49e b1 fe LDA (synpag),Y + 847 e4a0 30 84 BMI Le426 + 848 e4a2 d0 05 BNE Le4a9 + 849 e4a4 a0 0e LDY #$0e ; 14 . + 850 e4a6 4c e0 e3 go_errmess_2 JMP print_err_msg + 851 e4a9 c9 03 Le4a9 CMP #$03 ; 3 . + 852 e4ab b0 c3 BCS Le470 + 853 e4ad 4a LSR + 854 e4ae a6 c8 LDX text_index + 855 e4b0 e8 INX + 856 e4b1 bd 00 02 Le4b1 LDA buffer,X + 857 e4b4 90 04 BCC Le4ba + 858 e4b6 c9 a2 CMP #$a2 ; 162 " + 859 e4b8 f0 0a BEQ Le4c4 + 860 e4ba c9 df Le4ba CMP #$df ; 223 _ + 861 e4bc f0 06 BEQ Le4c4 + 862 e4be 86 c8 STX text_index + 863 e4c0 20 1c e4 Le4c0 JSR put_token + 864 e4c3 c8 INY + 865 e4c4 88 Le4c4 DEY + 866 e4c5 a6 fd LDX synstkdx + 867 e4c7 b1 fe Le4c7 LDA (synpag),Y + 868 e4c9 88 DEY + 869 e4ca 0a ASL + 870 e4cb 10 cf BPL Le49c + 871 e4cd b4 58 Le4cd LDY syn_stk_h,X + 872 e4cf 84 ff STY synpag+1 + 873 e4d1 b4 80 LDY syn_stk_l,X + 874 e4d3 e8 INX + 875 e4d4 b1 fe LDA (synpag),Y + 876 e4d6 29 9f AND #$9f ; 159 . + 877 e4d8 d0 ed BNE Le4c7 + 878 e4da 85 f2 STA pcon + 879 e4dc 85 f3 STA pcon+1 + 880 e4de 98 TYA + 881 e4df 48 PHA + 882 e4e0 86 fd STX synstkdx + 883 e4e2 b4 d0 LDY srch,X + 884 e4e4 84 c9 STY leadbl + 885 e4e6 18 CLC + 886 e4e7 a9 0a Le4e7 LDA #$0a ; 10 . + 887 e4e9 85 f9 STA char + 888 e4eb a2 00 LDX #$00 ; 0 . + 889 e4ed c8 INY + 890 e4ee b9 00 02 LDA buffer,Y + 891 e4f1 29 0f AND #$0f ; 15 . + 892 e4f3 65 f2 Le4f3 ADC pcon + 893 e4f5 48 PHA + 894 e4f6 8a TXA + 895 e4f7 65 f3 ADC pcon+1 + 896 e4f9 30 1c BMI Le517 + 897 e4fb aa TAX + 898 e4fc 68 PLA + 899 e4fd c6 f9 DEC char + 900 e4ff d0 f2 BNE Le4f3 + 901 e501 85 f2 STA pcon + 902 e503 86 f3 STX pcon+1 + 903 e505 c4 f1 CPY token_index + 904 e507 d0 de BNE Le4e7 + 905 e509 a4 c9 LDY leadbl + 906 e50b c8 INY + 907 e50c 84 f1 STY token_index + 908 e50e 20 1c e4 JSR put_token + 909 e511 68 PLA + 910 e512 a8 TAY + 911 e513 a5 f3 LDA pcon+1 + 912 e515 b0 a9 BCS Le4c0 + 913 e517 a0 00 Le517 LDY #$00 ; 0 . + 914 e519 10 8b BPL go_errmess_2 + 915 e51b + 916 e51b 85 f3 prdec STA pcon+1 + 917 e51d 86 f2 STX pcon + 918 e51f a2 04 LDX #$04 ; 4 . + 919 e521 86 c9 STX leadbl + 920 e523 a9 b0 Le523 LDA #$b0 ; 176 0 + 921 e525 85 f9 STA char + 922 e527 a5 f2 Le527 LDA pcon + 923 e529 dd 63 e5 CMP dectabl,X + 924 e52c a5 f3 LDA pcon+1 + 925 e52e fd 68 e5 SBC dectabh,X + 926 e531 90 0d BCC Le540 + 927 e533 85 f3 STA pcon+1 + 928 e535 a5 f2 LDA pcon + 929 e537 fd 63 e5 SBC dectabl,X + 930 e53a 85 f2 STA pcon + 931 e53c e6 f9 INC char + 932 e53e d0 e7 BNE Le527 + 933 e540 a5 f9 Le540 LDA char + 934 e542 e8 INX + 935 e543 ca DEX + 936 e544 f0 0e BEQ Le554 + 937 e546 c9 b0 CMP #$b0 ; 176 0 + 938 e548 f0 02 BEQ Le54c + 939 e54a 85 c9 STA leadbl + 940 e54c 24 c9 Le54c BIT leadbl + 941 e54e 30 04 BMI Le554 + 942 e550 a5 fa LDA leadzr + 943 e552 f0 0b BEQ Le55f + 944 e554 20 c9 e3 Le554 JSR cout + 945 e557 24 f8 BIT auto_flag + 946 e559 10 04 BPL Le55f + 947 e55b 99 00 02 STA buffer,Y + 948 e55e c8 INY + 949 e55f ca Le55f DEX + 950 e560 10 c1 BPL Le523 + 951 e562 60 RTS + 952 e563 01 0a 64 e8*dectabl DC.B $01,$0a,$64,$e8,$10 ; "..dh." + 953 e568 00 00 00 03*dectabh DC.B $00,$00,$00,$03,$27 ; "....'" + 954 e56d + 955 e56d a5 ca find_line LDA pp + 956 e56f 85 e6 STA p3 + 957 e571 a5 cb LDA pp+1 + 958 e573 85 e7 STA p3+1 + 959 e575 + 960 e575 e8 find_line1 INX + 961 e576 + 962 e576 a5 e7 find_line2 LDA p3+1 + 963 e578 85 e5 STA p2+1 + 964 e57a a5 e6 LDA p3 + 965 e57c 85 e4 STA p2 + 966 e57e c5 4c CMP himem + 967 e580 a5 e5 LDA p2+1 + 968 e582 e5 4d SBC himem+1 + 969 e584 b0 26 BCS Le5ac + 970 e586 a0 01 LDY #$01 ; 1 . + 971 e588 b1 e4 LDA (p2),Y + 972 e58a e5 ce SBC acc + 973 e58c c8 INY + 974 e58d b1 e4 LDA (p2),Y + 975 e58f e5 cf SBC acc+1 + 976 e591 b0 19 BCS Le5ac + 977 e593 a0 00 LDY #$00 ; 0 . + 978 e595 a5 e6 LDA p3 + 979 e597 71 e4 ADC (p2),Y + 980 e599 85 e6 STA p3 + 981 e59b 90 03 BCC Le5a0 + 982 e59d e6 e7 INC p3+1 + 983 e59f 18 CLC + 984 e5a0 c8 Le5a0 INY + 985 e5a1 a5 ce LDA acc + 986 e5a3 f1 e4 SBC (p2),Y + 987 e5a5 c8 INY + 988 e5a6 a5 cf LDA acc+1 + 989 e5a8 f1 e4 SBC (p2),Y + 990 e5aa b0 ca BCS find_line2 + 991 e5ac 60 Le5ac RTS + 992 e5ad + 993 e5ad 46 f8 new_cmd LSR auto_flag + 994 e5af a5 4c LDA himem + 995 e5b1 85 ca STA pp + 996 e5b3 a5 4d LDA himem+1 + 997 e5b5 85 cb STA pp+1 + 998 e5b7 + 999 e5b7 a5 4a clr LDA lomem + 1000 e5b9 85 cc STA pv + 1001 e5bb a5 4b LDA lomem+1 + 1002 e5bd 85 cd STA pv+1 + 1003 e5bf a9 00 LDA #$00 ; 0 . + 1004 e5c1 85 fb STA for_nest_count + 1005 e5c3 85 fc STA gosub_nest_count + 1006 e5c5 85 fe STA synpag + 1007 e5c7 a9 00 LDA #$00 ; 0 . + 1008 e5c9 85 1d STA Z1d + 1009 e5cb 60 RTS + 1010 e5cc a5 d0 Le5cc LDA srch + 1011 e5ce 69 05 ADC #$05 ; 5 . + 1012 e5d0 85 d2 STA srch2 + 1013 e5d2 a5 d1 LDA tokndxstk + 1014 e5d4 69 00 ADC #$00 ; 0 . + 1015 e5d6 85 d3 STA srch2+1 + 1016 e5d8 a5 d2 LDA srch2 + 1017 e5da c5 ca CMP pp + 1018 e5dc a5 d3 LDA srch2+1 + 1019 e5de e5 cb SBC pp+1 + 1020 e5e0 90 03 BCC Le5e5 + 1021 e5e2 4c 6b e3 JMP Le36b + 1022 e5e5 a5 ce Le5e5 LDA acc + 1023 e5e7 91 d0 STA (srch),Y + 1024 e5e9 a5 cf LDA acc+1 + 1025 e5eb c8 INY + 1026 e5ec 91 d0 STA (srch),Y + 1027 e5ee a5 d2 LDA srch2 + 1028 e5f0 c8 INY + 1029 e5f1 91 d0 STA (srch),Y + 1030 e5f3 a5 d3 LDA srch2+1 + 1031 e5f5 c8 INY + 1032 e5f6 91 d0 STA (srch),Y + 1033 e5f8 a9 00 LDA #$00 ; 0 . + 1034 e5fa c8 INY + 1035 e5fb 91 d0 STA (srch),Y + 1036 e5fd c8 INY + 1037 e5fe 91 d0 STA (srch),Y + 1038 e600 a5 d2 LDA srch2 + 1039 e602 85 cc STA pv + 1040 e604 a5 d3 LDA srch2+1 + 1041 e606 85 cd STA pv+1 + 1042 e608 a5 d0 LDA srch + 1043 e60a 90 43 BCC Le64f + 1044 e60c 85 ce execute_var STA acc + 1045 e60e 84 cf STY acc+1 + 1046 e610 20 ff e6 JSR get_next_prog_byte + 1047 e613 30 0e BMI Le623 + 1048 e615 c9 40 CMP #$40 ; 64 @ + 1049 e617 f0 0a BEQ Le623 + 1050 e619 4c 28 e6 JMP Le628 + 1051 e61c 06 c9 49 d0* DC.B $06,$c9,$49,$d0,$07,$a9,$49 ; ".IIP.)I" + 1052 e623 85 cf Le623 STA acc+1 + 1053 e625 20 ff e6 JSR get_next_prog_byte + 1054 e628 a5 4b Le628 LDA lomem+1 + 1055 e62a 85 d1 STA tokndxstk + 1056 e62c a5 4a LDA lomem + 1057 e62e 85 d0 Le62e STA srch + 1058 e630 c5 cc CMP pv + 1059 e632 a5 d1 LDA tokndxstk + 1060 e634 e5 cd SBC pv+1 + 1061 e636 b0 94 BCS Le5cc + 1062 e638 b1 d0 LDA (srch),Y + 1063 e63a c8 INY + 1064 e63b c5 ce CMP acc + 1065 e63d d0 06 BNE Le645 + 1066 e63f b1 d0 LDA (srch),Y + 1067 e641 c5 cf CMP acc+1 + 1068 e643 f0 0e BEQ Le653 + 1069 e645 c8 Le645 INY + 1070 e646 b1 d0 LDA (srch),Y + 1071 e648 48 PHA + 1072 e649 c8 INY + 1073 e64a b1 d0 LDA (srch),Y + 1074 e64c 85 d1 STA tokndxstk + 1075 e64e 68 PLA + 1076 e64f a0 00 Le64f LDY #$00 ; 0 . + 1077 e651 f0 db BEQ Le62e + 1078 e653 a5 d0 Le653 LDA srch + 1079 e655 69 03 ADC #$03 ; 3 . + 1080 e657 20 0a e7 JSR push_a_noun_stk + 1081 e65a a5 d1 LDA tokndxstk + 1082 e65c 69 00 ADC #$00 ; 0 . + 1083 e65e 95 78 STA noun_stk_h_str,X + 1084 e660 a5 cf LDA acc+1 + 1085 e662 c9 40 CMP #$40 ; 64 @ + 1086 e664 d0 1c BNE fetch_prog_byte + 1087 e666 88 DEY + 1088 e667 98 TYA + 1089 e668 20 0a e7 JSR push_a_noun_stk + 1090 e66b 88 DEY + 1091 e66c 94 78 STY noun_stk_h_str,X + 1092 e66e a0 03 LDY #$03 ; 3 . + 1093 e670 f6 78 Le670 INC noun_stk_h_str,X + 1094 e672 c8 INY + 1095 e673 b1 d0 LDA (srch),Y + 1096 e675 30 f9 BMI Le670 + 1097 e677 10 09 BPL fetch_prog_byte + 1098 e679 + 1099 e679 a9 00 execute_stmt LDA #$00 ; 0 . + 1100 e67b 85 d4 STA if_flag + 1101 e67d 85 d5 STA cr_flag + 1102 e67f a2 20 LDX #$20 ; 32 + 1103 e681 48 push_old_verb PHA + 1104 e682 a0 00 fetch_prog_byte LDY #$00 ; 0 . + 1105 e684 b1 e0 LDA (pverb),Y + 1106 e686 10 18 Le686 BPL execute_token + 1107 e688 0a ASL + 1108 e689 30 81 BMI execute_var + 1109 e68b 20 ff e6 JSR get_next_prog_byte + 1110 e68e 20 08 e7 JSR push_ya_noun_stk + 1111 e691 20 ff e6 JSR get_next_prog_byte + 1112 e694 95 a0 STA noun_stk_h_int,X + 1113 e696 24 d4 Le696 BIT if_flag + 1114 e698 10 01 BPL Le69b + 1115 e69a ca DEX + 1116 e69b 20 ff e6 Le69b JSR get_next_prog_byte + 1117 e69e b0 e6 BCS Le686 + 1118 e6a0 c9 28 execute_token CMP #$28 ; 40 ( + 1119 e6a2 d0 1f BNE execute_verb + 1120 e6a4 a5 e0 LDA pverb + 1121 e6a6 20 0a e7 JSR push_a_noun_stk + 1122 e6a9 a5 e1 LDA pverb+1 + 1123 e6ab 95 78 STA noun_stk_h_str,X + 1124 e6ad 24 d4 BIT if_flag + 1125 e6af 30 0b BMI Le6bc + 1126 e6b1 a9 01 LDA #$01 ; 1 . + 1127 e6b3 20 0a e7 JSR push_a_noun_stk + 1128 e6b6 a9 00 LDA #$00 ; 0 . + 1129 e6b8 95 78 STA noun_stk_h_str,X + 1130 e6ba f6 78 Le6ba INC noun_stk_h_str,X + 1131 e6bc 20 ff e6 Le6bc JSR get_next_prog_byte + 1132 e6bf 30 f9 BMI Le6ba + 1133 e6c1 b0 d3 BCS Le696 + 1134 e6c3 24 d4 execute_verb BIT if_flag + 1135 e6c5 10 06 BPL Le6cd + 1136 e6c7 c9 04 CMP #$04 ; 4 . + 1137 e6c9 b0 d0 BCS Le69b + 1138 e6cb 46 d4 LSR if_flag + 1139 e6cd a8 Le6cd TAY + 1140 e6ce 85 d6 STA current_verb + 1141 e6d0 b9 98 e9 LDA verb_prec_tbl,Y + 1142 e6d3 29 55 AND #$55 ; 85 U + 1143 e6d5 0a ASL + 1144 e6d6 85 d7 STA precedence + 1145 e6d8 68 Le6d8 PLA + 1146 e6d9 a8 TAY + 1147 e6da b9 98 e9 LDA verb_prec_tbl,Y + 1148 e6dd 29 aa AND #$aa ; 170 * + 1149 e6df c5 d7 CMP precedence + 1150 e6e1 b0 09 BCS do_verb + 1151 e6e3 98 TYA + 1152 e6e4 48 PHA + 1153 e6e5 20 ff e6 JSR get_next_prog_byte + 1154 e6e8 a5 d6 LDA current_verb + 1155 e6ea 90 95 BCC push_old_verb + 1156 e6ec b9 10 ea do_verb LDA verb_adr_l,Y + 1157 e6ef 85 ce STA acc + 1158 e6f1 b9 88 ea LDA verb_adr_h,Y + 1159 e6f4 85 cf STA acc+1 + 1160 e6f6 20 fc e6 JSR Se6fc + 1161 e6f9 4c d8 e6 JMP Le6d8 + 1162 e6fc + 1163 e6fc 6c ce 00 Se6fc JMP (acc) + 1164 e6ff + 1165 e6ff e6 e0 get_next_prog_byte INC pverb + 1166 e701 d0 02 BNE Le705 + 1167 e703 e6 e1 INC pverb+1 + 1168 e705 b1 e0 Le705 LDA (pverb),Y + 1169 e707 60 RTS + 1170 e708 + 1171 e708 94 77 push_ya_noun_stk STY syn_stk_h+31,X + 1172 e70a + 1173 e70a ca push_a_noun_stk DEX + 1174 e70b 30 03 BMI Le710 + 1175 e70d 95 50 STA noun_stk_l,X + 1176 e70f 60 RTS + 1177 e710 a0 66 Le710 LDY #$66 ; 102 f + 1178 e712 4c e0 e3 go_errmess_3 JMP print_err_msg + 1179 e715 + 1180 e715 a0 00 get16bit LDY #$00 ; 0 . + 1181 e717 b5 50 LDA noun_stk_l,X + 1182 e719 85 ce STA acc + 1183 e71b b5 a0 LDA noun_stk_h_int,X + 1184 e71d 85 cf STA acc+1 + 1185 e71f b5 78 LDA noun_stk_h_str,X + 1186 e721 f0 0e BEQ Le731 + 1187 e723 85 cf STA acc+1 + 1188 e725 b1 ce LDA (acc),Y + 1189 e727 48 PHA + 1190 e728 c8 INY + 1191 e729 b1 ce LDA (acc),Y + 1192 e72b 85 cf STA acc+1 + 1193 e72d 68 PLA + 1194 e72e 85 ce STA acc + 1195 e730 88 DEY + 1196 e731 e8 Le731 INX + 1197 e732 60 RTS + 1198 e733 + 1199 e733 20 4a e7 eq_op JSR neq_op + 1200 e736 + 1201 e736 20 15 e7 not_op JSR get16bit + 1202 e739 98 TYA + 1203 e73a 20 08 e7 JSR push_ya_noun_stk + 1204 e73d 95 a0 STA noun_stk_h_int,X + 1205 e73f c5 ce CMP acc + 1206 e741 d0 06 BNE Le749 + 1207 e743 c5 cf CMP acc+1 + 1208 e745 d0 02 BNE Le749 + 1209 e747 f6 50 INC noun_stk_l,X + 1210 e749 60 Le749 RTS + 1211 e74a + 1212 e74a 20 82 e7 neq_op JSR subtract + 1213 e74d 20 59 e7 JSR sgn_fn + 1214 e750 + 1215 e750 20 15 e7 abs_fn JSR get16bit + 1216 e753 24 cf BIT acc+1 + 1217 e755 30 1b BMI Se772 + 1218 e757 ca Le757 DEX + 1219 e758 60 Le758 RTS + 1220 e759 + 1221 e759 20 15 e7 sgn_fn JSR get16bit + 1222 e75c a5 cf LDA acc+1 + 1223 e75e d0 04 BNE Le764 + 1224 e760 a5 ce LDA acc + 1225 e762 f0 f3 BEQ Le757 + 1226 e764 a9 ff Le764 LDA #$ff ; 255 . + 1227 e766 20 08 e7 JSR push_ya_noun_stk + 1228 e769 95 a0 STA noun_stk_h_int,X + 1229 e76b 24 cf BIT acc+1 + 1230 e76d 30 e9 BMI Le758 + 1231 e76f + 1232 e76f 20 15 e7 negate JSR get16bit + 1233 e772 + 1234 e772 98 Se772 TYA + 1235 e773 38 SEC + 1236 e774 e5 ce SBC acc + 1237 e776 20 08 e7 JSR push_ya_noun_stk + 1238 e779 98 TYA + 1239 e77a e5 cf SBC acc+1 + 1240 e77c 50 23 BVC Le7a1 + 1241 e77e a0 00 Le77e LDY #$00 ; 0 . + 1242 e780 10 90 BPL go_errmess_3 + 1243 e782 + 1244 e782 20 6f e7 subtract JSR negate + 1245 e785 + 1246 e785 20 15 e7 add JSR get16bit + 1247 e788 a5 ce LDA acc + 1248 e78a 85 da STA aux + 1249 e78c a5 cf LDA acc+1 + 1250 e78e 85 db STA aux+1 + 1251 e790 20 15 e7 JSR get16bit + 1252 e793 + 1253 e793 18 Se793 CLC + 1254 e794 a5 ce LDA acc + 1255 e796 65 da ADC aux + 1256 e798 20 08 e7 JSR push_ya_noun_stk + 1257 e79b a5 cf LDA acc+1 + 1258 e79d 65 db ADC aux+1 + 1259 e79f 70 dd BVS Le77e + 1260 e7a1 95 a0 Le7a1 STA noun_stk_h_int,X + 1261 e7a3 + 1262 e7a3 60 unary_pos RTS + 1263 e7a4 + 1264 e7a4 20 15 e7 tab_fn JSR get16bit + 1265 e7a7 a4 ce LDY acc + 1266 e7a9 f0 05 BEQ Le7b0 + 1267 e7ab 88 DEY + 1268 e7ac a5 cf LDA acc+1 + 1269 e7ae f0 0c BEQ Le7bc + 1270 e7b0 60 Le7b0 RTS + 1271 e7b1 + 1272 e7b1 a5 24 tabout LDA ch + 1273 e7b3 09 07 ORA #$07 ; 7 . + 1274 e7b5 a8 TAY + 1275 e7b6 c8 INY + 1276 e7b7 a9 a0 Le7b7 LDA #$a0 ; 160 + 1277 e7b9 20 c9 e3 JSR cout + 1278 e7bc c4 24 Le7bc CPY ch + 1279 e7be b0 f7 BCS Le7b7 + 1280 e7c0 60 RTS + 1281 e7c1 + 1282 e7c1 20 b1 e7 print_com_num JSR tabout + 1283 e7c4 + 1284 e7c4 20 15 e7 print_num JSR get16bit + 1285 e7c7 a5 cf LDA acc+1 + 1286 e7c9 10 0a BPL Le7d5 + 1287 e7cb a9 ad LDA #$ad ; 173 - + 1288 e7cd 20 c9 e3 JSR cout + 1289 e7d0 20 72 e7 JSR Se772 + 1290 e7d3 50 ef BVC print_num + 1291 e7d5 88 Le7d5 DEY + 1292 e7d6 84 d5 STY cr_flag + 1293 e7d8 86 cf STX acc+1 + 1294 e7da a6 ce LDX acc + 1295 e7dc 20 1b e5 JSR prdec + 1296 e7df a6 cf LDX acc+1 + 1297 e7e1 60 RTS + 1298 e7e2 + 1299 e7e2 20 15 e7 auto_cmd JSR get16bit + 1300 e7e5 a5 ce LDA acc + 1301 e7e7 85 f6 STA auto_ln + 1302 e7e9 a5 cf LDA acc+1 + 1303 e7eb 85 f7 STA auto_ln+1 + 1304 e7ed 88 DEY + 1305 e7ee 84 f8 STY auto_flag + 1306 e7f0 c8 INY + 1307 e7f1 a9 0a LDA #$0a ; 10 . + 1308 e7f3 85 f4 Le7f3 STA auto_inc + 1309 e7f5 84 f5 STY auto_inc+1 + 1310 e7f7 60 RTS + 1311 e7f8 + 1312 e7f8 20 15 e7 auto_com JSR get16bit + 1313 e7fb a5 ce LDA acc + 1314 e7fd a4 cf LDY acc+1 + 1315 e7ff 10 f2 BPL Le7f3 + 1316 e801 + 1317 e801 20 15 e7 var_assign JSR get16bit + 1318 e804 b5 50 LDA noun_stk_l,X + 1319 e806 85 da STA aux + 1320 e808 b5 78 LDA noun_stk_h_str,X + 1321 e80a 85 db STA aux+1 + 1322 e80c a5 ce LDA acc + 1323 e80e 91 da STA (aux),Y + 1324 e810 c8 INY + 1325 e811 a5 cf LDA acc+1 + 1326 e813 91 da STA (aux),Y + 1327 e815 e8 INX + 1328 e816 + 1329 e816 60 Te816 RTS + 1330 e817 + 1331 e817 68 begin_line PLA + 1332 e818 68 PLA + 1333 e819 + 1334 e819 24 d5 colon BIT cr_flag + 1335 e81b 10 05 BPL Le822 + 1336 e81d + 1337 e81d 20 cd e3 print_cr JSR crout + 1338 e820 + 1339 e820 46 d5 print_semi LSR cr_flag + 1340 e822 60 Le822 RTS + 1341 e823 + 1342 e823 a0 ff left_paren LDY #$ff ; 255 . + 1343 e825 84 d7 STY precedence + 1344 e827 + 1345 e827 60 right_paren RTS + 1346 e828 + 1347 e828 20 cd ef if_stmt JSR Sefcd + 1348 e82b f0 07 BEQ Le834 + 1349 e82d a9 25 LDA #$25 ; 37 % + 1350 e82f 85 d6 STA current_verb + 1351 e831 88 DEY + 1352 e832 84 d4 STY if_flag + 1353 e834 e8 Le834 INX + 1354 e835 60 RTS + 1355 e836 a5 ca run_warm LDA pp + 1356 e838 a4 cb LDY pp+1 + 1357 e83a d0 5a BNE Le896 + 1358 e83c + 1359 e83c a0 41 gosub_stmt LDY #$41 ; 65 A + 1360 e83e a5 fc LDA gosub_nest_count + 1361 e840 c9 08 CMP #$08 ; 8 . + 1362 e842 b0 5e BCS go_errmess_4 + 1363 e844 a8 TAY + 1364 e845 e6 fc INC gosub_nest_count + 1365 e847 a5 e0 LDA pverb + 1366 e849 99 00 01 STA gstk_pverbl,Y + 1367 e84c a5 e1 LDA pverb+1 + 1368 e84e 99 08 01 STA gstk_pverbh,Y + 1369 e851 a5 dc LDA pline + 1370 e853 99 10 01 STA gstk_plinel,Y + 1371 e856 a5 dd LDA pline+1 + 1372 e858 99 18 01 STA gstk_plineh,Y + 1373 e85b + 1374 e85b 20 15 e7 goto_stmt JSR get16bit + 1375 e85e 20 6d e5 JSR find_line + 1376 e861 90 04 BCC Le867 + 1377 e863 a0 37 LDY #$37 ; 55 7 + 1378 e865 d0 3b BNE go_errmess_4 + 1379 e867 a5 e4 Le867 LDA p2 + 1380 e869 a4 e5 LDY p2+1 + 1381 e86b 85 dc run_loop STA pline + 1382 e86d 84 dd STY pline+1 + 1383 e86f - IFCONST BLD4APPLE1 + 1384 e86f - BIT KBDCR + 1385 e86f ELSE + 1386 e86f 2c 00 c0 BIT KBD + 1387 e872 ENDIF + 1388 e872 30 4f BMI Le8c3 + 1389 e874 18 CLC + 1390 e875 69 03 ADC #$03 ; 3 . + 1391 e877 90 01 BCC Le87a + 1392 e879 c8 INY + 1393 e87a a2 ff Le87a LDX #$ff ; 255 . + 1394 e87c 86 d9 STX run_flag + 1395 e87e 9a TXS + 1396 e87f 85 e0 STA pverb + 1397 e881 84 e1 STY pverb+1 + 1398 e883 20 79 e6 Le883 JSR execute_stmt + 1399 e886 24 d9 BIT run_flag + 1400 e888 10 49 BPL end_stmt + 1401 e88a 18 CLC + 1402 e88b a0 00 LDY #$00 ; 0 . + 1403 e88d a5 dc LDA pline + 1404 e88f 71 dc ADC (pline),Y + 1405 e891 a4 dd LDY pline+1 + 1406 e893 90 01 BCC Le896 + 1407 e895 c8 INY + 1408 e896 c5 4c Le896 CMP himem + 1409 e898 d0 d1 BNE run_loop + 1410 e89a c4 4d CPY himem+1 + 1411 e89c d0 cd BNE run_loop + 1412 e89e a0 34 LDY #$34 ; 52 4 + 1413 e8a0 46 d9 LSR run_flag + 1414 e8a2 4c e0 e3 go_errmess_4 JMP print_err_msg + 1415 e8a5 + 1416 e8a5 a0 4a return_stmt LDY #$4a ; 74 J + 1417 e8a7 a5 fc LDA gosub_nest_count + 1418 e8a9 f0 f7 BEQ go_errmess_4 + 1419 e8ab c6 fc DEC gosub_nest_count + 1420 e8ad a8 TAY + 1421 e8ae b9 0f 01 LDA gstk_plinel-1,Y + 1422 e8b1 85 dc STA pline + 1423 e8b3 b9 17 01 LDA gstk_plineh-1,Y + 1424 e8b6 85 dd STA pline+1 + 1425 e8b8 + 1426 e8b8 be ff 00 DC.B $be,$ff,$00 + 1427 e8bb ; LDX synpag+1,Y + 1428 e8bb + 1429 e8bb b9 07 01 LDA gstk_pverbh-1,Y + 1430 e8be a8 Le8be TAY + 1431 e8bf 8a TXA + 1432 e8c0 4c 7a e8 JMP Le87a + 1433 e8c3 a0 63 Le8c3 LDY #$63 ; 99 c + 1434 e8c5 20 c4 e3 JSR Se3c4 + 1435 e8c8 a0 01 LDY #$01 ; 1 . + 1436 e8ca b1 dc LDA (pline),Y + 1437 e8cc aa TAX + 1438 e8cd c8 INY + 1439 e8ce b1 dc LDA (pline),Y + 1440 e8d0 20 1b e5 JSR prdec + 1441 e8d3 + 1442 e8d3 4c b3 e2 end_stmt JMP warm + 1443 e8d6 c6 fb Le8d6 DEC for_nest_count + 1444 e8d8 + 1445 e8d8 a0 5b next_stmt LDY #$5b ; 91 [ + 1446 e8da a5 fb LDA for_nest_count + 1447 e8dc f0 c4 Le8dc BEQ go_errmess_4 + 1448 e8de a8 TAY + 1449 e8df b5 50 LDA noun_stk_l,X + 1450 e8e1 d9 1f 01 CMP fstk_varl-1,Y + 1451 e8e4 d0 f0 BNE Le8d6 + 1452 e8e6 b5 78 LDA noun_stk_h_str,X + 1453 e8e8 d9 27 01 CMP fstk_varh-1,Y + 1454 e8eb d0 e9 BNE Le8d6 + 1455 e8ed b9 2f 01 LDA fstk_stepl-1,Y + 1456 e8f0 85 da STA aux + 1457 e8f2 b9 37 01 LDA fstk_steph-1,Y + 1458 e8f5 85 db STA aux+1 + 1459 e8f7 20 15 e7 JSR get16bit + 1460 e8fa ca DEX + 1461 e8fb 20 93 e7 JSR Se793 + 1462 e8fe 20 01 e8 JSR var_assign + 1463 e901 ca DEX + 1464 e902 a4 fb LDY for_nest_count + 1465 e904 b9 67 01 LDA fstk_toh-1,Y + 1466 e907 95 9f STA syn_stk_l+31,X + 1467 e909 b9 5f 01 LDA fstk_tol-1,Y + 1468 e90c a0 00 LDY #$00 ; 0 . + 1469 e90e 20 08 e7 JSR push_ya_noun_stk + 1470 e911 20 82 e7 JSR subtract + 1471 e914 20 59 e7 JSR sgn_fn + 1472 e917 20 15 e7 JSR get16bit + 1473 e91a a4 fb LDY for_nest_count + 1474 e91c a5 ce LDA acc + 1475 e91e f0 05 BEQ Le925 + 1476 e920 59 37 01 EOR fstk_steph-1,Y + 1477 e923 10 12 BPL Le937 + 1478 e925 b9 3f 01 Le925 LDA fstk_plinel-1,Y + 1479 e928 85 dc STA pline + 1480 e92a b9 47 01 LDA fstk_plineh-1,Y + 1481 e92d 85 dd STA pline+1 + 1482 e92f be 4f 01 LDX fstk_pverbl-1,Y + 1483 e932 b9 57 01 LDA fstk_pverbh-1,Y + 1484 e935 d0 87 BNE Le8be + 1485 e937 c6 fb Le937 DEC for_nest_count + 1486 e939 60 RTS + 1487 e93a + 1488 e93a a0 54 for_stmt LDY #$54 ; 84 T + 1489 e93c a5 fb LDA for_nest_count + 1490 e93e c9 08 CMP #$08 ; 8 . + 1491 e940 f0 9a BEQ Le8dc + 1492 e942 e6 fb INC for_nest_count + 1493 e944 a8 TAY + 1494 e945 b5 50 LDA noun_stk_l,X + 1495 e947 99 20 01 STA fstk_varl,Y + 1496 e94a b5 78 LDA noun_stk_h_str,X + 1497 e94c 99 28 01 STA fstk_varh,Y + 1498 e94f 60 RTS + 1499 e950 + 1500 e950 20 15 e7 to_clause JSR get16bit + 1501 e953 a4 fb LDY for_nest_count + 1502 e955 a5 ce LDA acc + 1503 e957 99 5f 01 STA fstk_tol-1,Y + 1504 e95a a5 cf LDA acc+1 + 1505 e95c 99 67 01 STA fstk_toh-1,Y + 1506 e95f a9 01 LDA #$01 ; 1 . + 1507 e961 99 2f 01 STA fstk_stepl-1,Y + 1508 e964 a9 00 LDA #$00 ; 0 . + 1509 e966 99 37 01 Le966 STA fstk_steph-1,Y + 1510 e969 a5 dc LDA pline + 1511 e96b 99 3f 01 STA fstk_plinel-1,Y + 1512 e96e a5 dd LDA pline+1 + 1513 e970 99 47 01 STA fstk_plineh-1,Y + 1514 e973 a5 e0 LDA pverb + 1515 e975 99 4f 01 STA fstk_pverbl-1,Y + 1516 e978 a5 e1 LDA pverb+1 + 1517 e97a 99 57 01 STA fstk_pverbh-1,Y + 1518 e97d 60 RTS + 1519 e97e + 1520 e97e 20 15 e7 Te97e JSR get16bit + 1521 e981 a4 fb LDY for_nest_count + 1522 e983 a5 ce LDA acc + 1523 e985 99 2f 01 STA fstk_stepl-1,Y + 1524 e988 a5 cf LDA acc+1 + 1525 e98a 4c 66 e9 JMP Le966 + 1526 e98d 00 00 00 00* DC.B $00,$00,$00,$00,$00,$00,$00,$00 ; "........" + 1527 e995 00 00 00 DC.B $00,$00,$00 ; "..." + 1528 e998 00 00 00 ab*verb_prec_tbl DC.B $00,$00,$00,$ab,$03,$03,$03,$03 ; "...+...." + 1529 e9a0 03 03 03 03* DC.B $03,$03,$03,$03,$03,$03,$03,$03 ; "........" + 1530 e9a8 03 03 3f 3f* DC.B $03,$03,$3f,$3f,$c0,$c0,$3c,$3c ; "..??@@<<" + 1531 e9b0 3c 3c 3c 3c* DC.B $3c,$3c,$3c,$3c,$3c,$30,$0f,$c0 ; "<<<<<0.@" + 1532 e9b8 IFCONST HUSTNBASIC + 1533 e9b8 c3 ff 55 00* DC.B $c3,$ff,$55,$00,$ab,$ab,$03,$03 ; "L.U.++.." + 1534 e9c0 - ELSE + 1535 e9c0 - DC.B $cc,$ff,$55,$00,$ab,$ab,$03,$03 ; "L.U.++.." + 1536 e9c0 ENDIF + 1537 e9c0 ff ff 55 ff* DC.B $ff,$ff,$55,$ff,$ff,$55,$cf,$cf ; "..U..UOO" + 1538 e9c8 cf cf cf ff* DC.B $cf,$cf,$cf,$ff,$55,$c3,$c3,$c3 ; "OOO.UCCC" + 1539 e9d0 55 f0 f0 cf* DC.B $55,$f0,$f0,$cf,$56,$56,$56,$55 ; "UppOVVVU" + 1540 e9d8 ff ff 55 03* DC.B $ff,$ff,$55,$03,$03,$03,$03,$03 ; "..U....." + 1541 e9e0 03 03 ff ff* DC.B $03,$03,$ff,$ff,$ff,$03,$03,$03 ; "........" + 1542 e9e8 03 03 03 03* DC.B $03,$03,$03,$03,$03,$03,$03,$03 ; "........" + 1543 e9f0 03 03 03 03* DC.B $03,$03,$03,$03,$03,$00,$ab,$03 ; "......+." + 1544 e9f8 57 03 03 03* DC.B $57,$03,$03,$03,$03,$07,$03,$03 ; "W......." + 1545 ea00 03 03 03 03* DC.B $03,$03,$03,$03,$03,$03,$03,$03 ; "........" + 1546 ea08 03 03 aa ff* DC.B $03,$03,$aa,$ff,$ff,$ff,$ff,$ff ; "..*....." + 1547 ea10 + 1548 ea10 + 1549 ea10 verb_adr_l + 1550 ea10 17 ff ff 19* DC.B begin_line,$ff,$ff,>colon,>list_cmd,>list_comman,>list_all,>Teff2 + 1571 ea90 ef e3 e3 e5* DC.B >Tefec,>del_cmd,>del_comma,>new_cmd,>clr,>auto_cmd,>auto_com,>man_cmd + 1572 ea98 ef ef e7 e7* DC.B >Tef80,>Tef96,>add,> subtract,>mult_op,>divide,>eq_op,>neq_op + 1573 eaa0 ec ec ec e7* DC.B >Tec13,> Tec06,> Tec0b,>neq_op,>Tec01,> Tec40,> Tec47,>mod_op + 1574 eaa8 IFCONST HUSTNBASIC + 1575 eaa8 ee ff e8 e1* DC.B >bogus_eea6,$ff,>left_paren,>comma_substr,>goto_stmt,>Te816,>string_input,>input_num_comma + 1576 eab0 - ELSE + 1577 eab0 - DC.B $0,$ff,>left_paren,>comma_substr,>goto_stmt,>Te816,>string_input,>input_num_comma + 1578 eab0 ENDIF + 1579 eab0 ff ff e0 ff* DC.B $ff,$ff,>paren_substr,$ff,$ff,>num_array_subs,>peek_fn,>rnd_fn + 1580 eab8 e7 e7 00 ff* DC.B >sgn_fn,>abs_fn,$00,$ff,>left_paren,>unary_pos,>negate,>not_op + 1581 eac0 e8 e1 e2 ee* DC.B >left_paren,>string_eq,>string_neq,>len_fn,>bogus_eec2,>Teeae,>Teeba,>left_paren + 1582 eac8 ff ff e1 e1* DC.B $ff,$ff,>str_arr_dest,>dim_str,>dim_num,>print_str,>print_num,>print_semi + 1583 ead0 ee e7 ff ff* DC.B >print_str_comma,>print_com_num,$ff,$ff,$ff,>call_stmt,>dim_str,>dim_num + 1584 ead8 e7 e8 ef ef* DC.B >tab_fn,>end_stmt,>string_input,>input_prompt,>input_num_stmt,>for_stmt,>var_assign,>to_clause + 1585 eae0 e9 e8 e8 e8* DC.B >Te97e,>next_stmt,>next_stmt,>return_stmt,>gosub_stmt,$ff,>Te816,>goto_stmt + 1586 eae8 e8 ee e7 e8* DC.B >if_stmt,>print_str,>print_num,>print_cr,>poke_stmt,>Tef0c,>Tee4e,>poke_stmt + 1587 eaf0 ee ef ee ee* DC.B >plot_comma,>poke_stmt,>bogus_eea6,>Teeb0,>poke_stmt,>Teebc,>Teec6,>vtab_stmt + 1588 eaf8 e1 e8 e8 ff* DC.B >string_lit,>var_assign,>right_paren,$ff,$ff,$ff,$ff,$ff + 1589 eb00 be b3 b2 b7*error_msg_tbl DC.B $be,$b3,$b2,$b7,$b6,$37,$d4,$cf ; ">32767TO" + 1590 eb08 cf a0 cc cf* DC.B $cf,$a0,$cc,$cf,$ce,$47,$d3,$d9 ; "O LONGSY" + 1591 eb10 ce d4 c1 58* DC.B $ce,$d4,$c1,$58,$cd,$c5,$cd,$a0 ; "NTAXMEM " + 1592 eb18 c6 d5 cc 4c* DC.B $c6,$d5,$cc,$4c,$d4,$cf,$cf,$a0 ; "FULLTOO " + 1593 eb20 cd c1 ce d9* DC.B $cd,$c1,$ce,$d9,$a0,$d0,$c1,$d2 ; "MANY PAR" + 1594 eb28 c5 ce 53 d3* DC.B $c5,$ce,$53,$d3,$d4,$d2,$c9,$ce ; "ENSSTRIN" + 1595 eb30 47 ce cf a0* DC.B $47,$ce,$cf,$a0,$c5,$ce,$44,$c2 ; "GNO ENDB" + 1596 eb38 c1 c4 a0 c2* DC.B $c1,$c4,$a0,$c2,$d2,$c1,$ce,$c3 ; "AD BRANC" + 1597 eb40 48 be b8 a0* DC.B $48,$be,$b8,$a0,$c7,$cf,$d3,$d5 ; "H>8 GOSU" + 1598 eb48 c2 53 c2 c1* DC.B $c2,$53,$c2,$c1,$c4,$a0,$d2,$c5 ; "BSBAD RE" + 1599 eb50 d4 d5 d2 4e* DC.B $d4,$d5,$d2,$4e,$be,$b8,$a0,$c6 ; "TURN>8 F" + 1600 eb58 cf d2 53 c2* DC.B $cf,$d2,$53,$c2,$c1,$c4,$a0,$ce ; "ORSBAD N" + 1601 eb60 c5 d8 54 d3* DC.B $c5,$d8,$54,$d3,$d4,$cf,$d0,$d0 ; "EXTSTOPP" + 1602 eb68 c5 c4 a0 c1* DC.B $c5,$c4,$a0,$c1,$d4,$20,$aa,$aa ; "ED AT **" + 1603 eb70 aa 20 a0 c5* DC.B $aa,$20,$a0,$c5,$d2,$d2,$0d,$be ; "* ERR.>" + 1604 eb78 b2 b5 35 d2* DC.B $b2,$b5,$35,$d2,$c1,$ce,$c7,$45 ; "255RANGE" + 1605 eb80 c4 c9 4d d3* DC.B $c4,$c9,$4d,$d3,$d4,$d2,$a0,$cf ; "DIMSTR O" + 1606 eb88 d6 c6 4c dc* DC.B $d6,$c6,$4c,$dc,$0d,$d2,$c5,$d4 ; "VFL\.RET" + 1607 eb90 d9 d0 c5 a0* DC.B $d9,$d0,$c5,$a0,$cc,$c9,$ce,$c5 ; "YPE LINE" + 1608 eb98 8d 3f DC.B $8d,$3f ; ".?" + 1609 eb9a 46 d9 Leb9a LSR run_flag + 1610 eb9c 90 03 BCC Leba1 + 1611 eb9e 4c c3 e8 JMP Le8c3 + 1612 eba1 a6 cf Leba1 LDX acc+1 + 1613 eba3 9a TXS + 1614 eba4 a6 ce LDX acc + 1615 eba6 a0 8d LDY #$8d ; 141 . + 1616 eba8 d0 02 BNE Lebac + 1617 ebaa + 1618 ebaa a0 99 input_num_stmt LDY #$99 ; 153 . + 1619 ebac 20 c4 e3 Lebac JSR Se3c4 + 1620 ebaf 86 ce STX acc + 1621 ebb1 ba TSX + 1622 ebb2 86 cf STX acc+1 + 1623 ebb4 a0 fe LDY #$fe ; 254 ~ + 1624 ebb6 84 d9 STY run_flag + 1625 ebb8 c8 INY + 1626 ebb9 84 c8 STY text_index + 1627 ebbb 20 99 e2 JSR Se299 + 1628 ebbe 84 f1 STY token_index + 1629 ebc0 a2 20 LDX #$20 ; 32 + 1630 ebc2 a9 30 LDA #$30 ; 48 0 + 1631 ebc4 20 91 e4 JSR Se491 + 1632 ebc7 e6 d9 INC run_flag + 1633 ebc9 a6 ce LDX acc + 1634 ebcb + 1635 ebcb a4 c8 input_num_comma LDY text_index + 1636 ebcd 0a ASL + 1637 ebce 85 ce Lebce STA acc + 1638 ebd0 c8 INY + 1639 ebd1 b9 00 02 LDA buffer,Y + 1640 ebd4 c9 74 CMP #$74 ; 116 t + 1641 ebd6 f0 d2 BEQ input_num_stmt + 1642 ebd8 49 b0 EOR #$b0 ; 176 0 + 1643 ebda c9 0a CMP #$0a ; 10 . + 1644 ebdc b0 f0 BCS Lebce + 1645 ebde c8 INY + 1646 ebdf c8 INY + 1647 ebe0 84 c8 STY text_index + 1648 ebe2 b9 00 02 LDA buffer,Y + 1649 ebe5 48 PHA + 1650 ebe6 b9 ff 01 LDA buffer-1,Y + 1651 ebe9 a0 00 LDY #$00 ; 0 . + 1652 ebeb 20 08 e7 JSR push_ya_noun_stk + 1653 ebee 68 PLA + 1654 ebef 95 a0 STA noun_stk_h_int,X + 1655 ebf1 a5 ce LDA acc + 1656 ebf3 c9 c7 CMP #$c7 ; 199 G + 1657 ebf5 d0 03 BNE Lebfa + 1658 ebf7 20 6f e7 JSR negate + 1659 ebfa 4c 01 e8 Lebfa JMP var_assign + 1660 ebfd ff ff ff 50 DC.B $ff,$ff,$ff,$50 ; "...P" + 1661 ec01 + 1662 ec01 20 13 ec Tec01 JSR Tec13 + 1663 ec04 d0 15 BNE Lec1b + 1664 ec06 + 1665 ec06 20 0b ec Tec06 JSR Tec0b + 1666 ec09 d0 10 BNE Lec1b + 1667 ec0b + 1668 ec0b 20 82 e7 Tec0b JSR subtract + 1669 ec0e 20 6f e7 JSR negate + 1670 ec11 50 03 BVC Lec16 + 1671 ec13 + 1672 ec13 20 82 e7 Tec13 JSR subtract + 1673 ec16 20 59 e7 Lec16 JSR sgn_fn + 1674 ec19 56 50 LSR noun_stk_l,X + 1675 ec1b 4c 36 e7 Lec1b JMP not_op + 1676 ec1e ff ff DC.B $ff,$ff ; ".." + 1677 ec20 c1 ff 7f d1*syntabl_index DC.B $c1,$ff,$7f,$d1,$cc,$c7,$cf,$ce ; "A..QLGON" + 1678 ec28 c5 9a 98 8b* DC.B $c5,$9a,$98,$8b,$96,$95,$93,$bf ; "E......?" + 1679 ec30 b2 32 2d 2b* DC.B $b2,$32,$2d,$2b,$bc,$b0,$ac,$be ; "22-+<0,>" + 1680 ec38 35 8e 61 ff* DC.B $35,$8e,$61,$ff,$ff,$ff,$dd,$fb ; "5.a...]{" + 1681 ec40 + 1682 ec40 20 c9 ef Tec40 JSR Sefc9 + 1683 ec43 15 4f ORA rnd+1,X + 1684 ec45 10 05 BPL Lec4c + 1685 ec47 + 1686 ec47 20 c9 ef Tec47 JSR Sefc9 + 1687 ec4a 35 4f AND rnd+1,X + 1688 ec4c 95 50 Lec4c STA noun_stk_l,X + 1689 ec4e 10 cb BPL Lec1b + 1690 ec50 4c c9 ef JMP Sefc9 + 1691 ec53 40 60 8d 60* DC.B $40,$60,$8d,$60,$8b,$00,$7e,$8c ; "@`.`..~." + 1692 ec5b 33 00 00 60* DC.B $33,$00,$00,$60,$03,$bf,$12,$00 ; "3..`.?.." + 1693 ec63 40 89 c9 47* DC.B $40,$89,$c9,$47,$9d,$17,$68,$9d ; "@.IG..h." + 1694 ec6b 0a 00 40 60* DC.B $0a,$00,$40,$60,$8d,$60,$8b,$00 ; "..@`.`.." + 1695 ec73 7e 8c 3c 00* DC.B $7e,$8c,$3c,$00,$00,$60,$03,$bf ; "~.<..`.?" + 1696 ec7b 1b 4b 67 b4* DC.B $1b,$4b,$67,$b4,$a1,$07,$8c,$07 ; ".Kg4!..." + 1697 ec83 ae a9 ac a8* DC.B $ae,$a9,$ac,$a8,$67,$8c,$07,$b4 ; ".),(g..4" + 1698 ec8b af ac b0 67* DC.B $af,$ac,$b0,$67,$9d,$b2,$af,$ac ; "/,0g.2/," + 1699 ec93 af a3 67 8c* DC.B $af,$a3,$67,$8c,$07,$a5,$ab,$af ; "/#g..%+/" + 1700 ec9b b0 f4 ae a9* DC.B $b0,$f4,$ae,$a9,$b2,$b0,$7f,$0e ; "0t.)20.." + 1701 eca3 27 b4 ae a9* DC.B $27,$b4,$ae,$a9,$b2,$b0,$7f,$0e ; "'4.)20.." + 1702 ecab 28 b4 ae a9* DC.B $28,$b4,$ae,$a9,$b2,$b0,$64,$07 ; "(4.)20d." + 1703 ecb3 a6 a9 67 af* DC.B $a6,$a9,$67,$af,$b4,$af,$a7,$78 ; "&)g/4/'x" + 1704 ecbb b4 a5 ac 78* DC.B $b4,$a5,$ac,$78,$7f,$02,$ad,$a5 ; "4%,x..-%" + 1705 ecc3 b2 67 a2 b5* DC.B $b2,$67,$a2,$b5,$b3,$af,$a7,$ee ; "2g"53/'n" + 1706 eccb b2 b5 b4 a5* DC.B $b2,$b5,$b4,$a5,$b2,$7e,$8c,$39 ; "254%2~.9" + 1707 ecd3 b4 b8 a5 ae* DC.B $b4,$b8,$a5,$ae,$67,$b0,$a5,$b4 ; "48%.g0%4" + 1708 ecdb b3 27 af b4* DC.B $b3,$27,$af,$b4,$07,$9d,$19,$b2 ; "3'/4...2" + 1709 ece3 af a6 7f 05* DC.B $af,$a6,$7f,$05,$37,$b4,$b5,$b0 ; "/&..7450" + 1710 eceb ae a9 7f 05* DC.B $ae,$a9,$7f,$05,$28,$b4,$b5,$b0 ; ".)..(450" + 1711 ecf3 ae a9 7f 05* DC.B $ae,$a9,$7f,$05,$2a,$b4,$b5,$b0 ; ".)..*450" + 1712 ecfb ae a9 e4 ae* DC.B $ae,$a9,$e4,$ae,$a5,$00,$ff,$ff ; ".)d.%..." + 1713 ed03 47 a2 a1 b4*syntabl2 DC.B $47,$a2,$a1,$b4,$7f,$0d,$30,$ad ; "G"!4..0-" + 1714 ed0b a9 a4 7f 0d* DC.B $a9,$a4,$7f,$0d,$23,$ad,$a9,$a4 ; ")$..#-)$" + 1715 ed13 67 ac ac a1* DC.B $67,$ac,$ac,$a1,$a3,$00,$40,$80 ; "g,,!#.@." + 1716 ed1b c0 c1 80 00* DC.B $c0,$c1,$80,$00,$47,$8c,$68,$8c ; "@A..G.h." + 1717 ed23 db 67 9b 68* DC.B $db,$67,$9b,$68,$9b,$50,$8c,$63 ; "[g.h.P.c" + 1718 ed2b 8c 7f 01 51* DC.B $8c,$7f,$01,$51,$07,$88,$29,$84 ; "...Q..)." + 1719 ed33 80 c4 80 57* DC.B $80,$c4,$80,$57,$71,$07,$88,$14 ; ".D.Wq..." + 1720 ed3b ed a5 ad af* DC.B $ed,$a5,$ad,$af,$ac,$ed,$a5,$ad ; "m%-/,m%-" + 1721 ed43 a9 a8 f2 af* DC.B $a9,$a8,$f2,$af,$ac,$af,$a3,$71 ; ")(r/,/#q" + 1722 ed4b 08 88 ae a5* DC.B $08,$88,$ae,$a5,$ac,$68,$83,$08 ; "...%,h.." + 1723 ed53 68 9d 08 71* DC.B $68,$9d,$08,$71,$07,$88,$60,$76 ; "h..q..`v" + 1724 ed5b b4 af ae 76* DC.B $b4,$af,$ae,$76,$8d,$76,$8b,$51 ; "4/.v.v.Q" + 1725 ed63 07 88 19 b8* DC.B $07,$88,$19,$b8,$a4,$ae,$b2,$f2 ; "...8$.2r" + 1726 ed6b b3 b5 f3 a2* DC.B $b3,$b5,$f3,$a2,$a1,$ee,$a7,$b3 ; "35s"!n'3" + 1727 ed73 e4 ae b2 eb* DC.B $e4,$ae,$b2,$eb,$a5,$a5,$b0,$51 ; "d.2k%%0Q" + 1728 ed7b 07 88 39 81* DC.B $07,$88,$39,$81,$c1,$4f,$7f,$0f ; "..9.AO.." + 1729 ed83 2f 00 51 06* DC.B $2f,$00,$51,$06,$88,$29,$c2,$0c ; "/.Q..)B." + 1730 ed8b 82 57 8c 6a* DC.B $82,$57,$8c,$6a,$8c,$42,$ae,$a5 ; ".W.j.B.%" + 1731 ed93 a8 b4 60 ae* DC.B $a8,$b4,$60,$ae,$a5,$a8,$b4,$4f ; "(4`.%(4O" + 1732 ed9b 7e 1e 35 8c* DC.B $7e,$1e,$35,$8c,$27,$51,$07,$88 ; "~.5.'Q.." + 1733 eda3 09 8b fe e4* DC.B $09,$8b,$fe,$e4,$af,$ad,$f2,$af ; "..~d/-r/" + 1734 edab e4 ae a1 dc* DC.B $e4,$ae,$a1,$dc,$de,$9c,$dd,$9c ; "d.!\^.]." + 1735 edb3 de dd 9e c3* DC.B $de,$dd,$9e,$c3,$dd,$cf,$ca,$cd ; "^].C]OJM" + 1736 edbb cb 00 47 9d* DC.B $cb,$00,$47,$9d,$ad,$a5,$ad,$af ; "K.G.-%-/" + 1737 edc3 ac 76 9d ad* DC.B $ac,$76,$9d,$ad,$a5,$ad,$a9,$a8 ; ",v.-%-)(" + 1738 edcb e6 a6 af 60* DC.B $e6,$a6,$af,$60,$8c,$20,$af,$b4 ; "f&/`. /4" + 1739 edd3 b5 a1 f2 ac* DC.B $b5,$a1,$f2,$ac,$a3,$f2,$a3,$b3 ; "5!r,#r#3" + 1740 eddb 60 8c 20 ac* DC.B $60,$8c,$20,$ac,$a5,$a4,$ee,$b5 ; "`. ,%$n5" + 1741 ede3 b2 60 ae b5* DC.B $b2,$60,$ae,$b5,$b2,$f4,$b3,$a9 ; "2`.52t3)" + 1742 edeb ac 60 8c 20* DC.B $ac,$60,$8c,$20,$b4,$b3,$a9,$ac ; ",`. 43)," + 1743 edf3 7a 7e 9a 22* DC.B $7a,$7e,$9a,$22,$20,$00,$60,$03 ; "z~." .`." + 1744 edfb bf 60 03 bf* DC.B $bf,$60,$03,$bf,$1f ; "?`.?." + 1745 ee00 + 1746 ee00 20 b1 e7 print_str_comma JSR tabout + 1747 ee03 + 1748 ee03 e8 print_str INX + 1749 ee04 e8 INX + 1750 ee05 b5 4f LDA rnd+1,X + 1751 ee07 85 da STA aux + 1752 ee09 b5 77 LDA syn_stk_h+31,X + 1753 ee0b 85 db STA aux+1 + 1754 ee0d b4 4e LDY rnd,X + 1755 ee0f 98 Lee0f TYA + 1756 ee10 d5 76 CMP syn_stk_h+30,X + 1757 ee12 b0 09 BCS Lee1d + 1758 ee14 b1 da LDA (aux),Y + 1759 ee16 20 c9 e3 JSR cout + 1760 ee19 c8 INY + 1761 ee1a 4c 0f ee JMP Lee0f + 1762 ee1d a9 ff Lee1d LDA #$ff ; 255 . + 1763 ee1f 85 d5 STA cr_flag + 1764 ee21 60 RTS + 1765 ee22 + 1766 ee22 e8 len_fn INX + 1767 ee23 a9 00 LDA #$00 ; 0 . + 1768 ee25 95 78 STA noun_stk_h_str,X + 1769 ee27 95 a0 STA noun_stk_h_int,X + 1770 ee29 b5 77 LDA syn_stk_h+31,X + 1771 ee2b 38 SEC + 1772 ee2c f5 4f SBC rnd+1,X + 1773 ee2e 95 50 STA noun_stk_l,X + 1774 ee30 4c 23 e8 JMP left_paren + 1775 ee33 ff DC.B $ff ; "." + 1776 ee34 + 1777 ee34 20 15 e7 getbyte JSR get16bit + 1778 ee37 a5 cf LDA acc+1 + 1779 ee39 d0 28 BNE gr_255_err + 1780 ee3b a5 ce LDA acc + 1781 ee3d Tee3d + 1782 ee3d 60 RTS + 1783 ee3e plot_comma + 1784 ee3e IFCONST HUSTNBASIC + 1785 ee3e 20 08 e7 JSR push_ya_noun_stk + 1786 ee41 94 a0 STY $a0,X + 1787 ee43 Tee43 + 1788 ee43 a5 d0 LDA $D0 + 1789 ee45 d0 04 BNE Tee4b + 1790 ee47 c6 d1 DEC $D1 + 1791 ee49 30 f2 BMI Tee3d + 1792 ee4b Tee4b + 1793 ee4b c6 d0 DEC $D0 + 1794 ee4d ; LDA $D2 + 1795 ee4d a5 DC.b $a5 + 1796 ee4e Tee4e ;MJW wrong address, so we have to break this instruction + 1797 ee4e d2 DC.b $d2 + 1798 ee4f + 1799 ee4f a0 00 LDY #$00 + 1800 ee51 20 08 e7 JSR push_ya_noun_stk + 1801 ee54 man_cmd + 1802 ee54 a5 d3 LDA $D3 + 1803 ee56 ; STA $A0,X + 1804 ee56 95 DC.b $95 + 1805 ee57 vtab_stmt + 1806 ee57 a0 DC.b $a0 + 1807 ee58 20 22 e2 JSR mult_op + 1808 ee5b 4c 43 ee JMP Tee43 + 1809 ee5e - ELSE + 1810 ee5e - + 1811 ee5e - JSR getbyte + 1812 ee5e - LDY text_index + 1813 ee5e - CMP #$30 ; 48 0 + 1814 ee5e - BCS range_err + 1815 ee5e - CPY #$28 ; 40 ( + 1816 ee5e - BCS range_err + 1817 ee5e - RTS + 1818 ee5e - NOP + 1819 ee5e - NOP + 1820 ee5e - + 1821 ee5e - + 1822 ee5e -Tee4e JSR getbyte + 1823 ee5e - RTS + 1824 ee5e ENDIF + 1825 ee5e ; + 1826 ee5e - IFCONST SNDERBASIC ;WSANDER BASIC HERE + 1827 ee5e - NOP + 1828 ee5e - NOP + 1829 ee5e - + 1830 ee5e -man_cmd LSR auto_flag + 1831 ee5e - RTS + 1832 ee5e - + 1833 ee5e -vtab_stmt JSR getbyte + 1834 ee5e - CMP #$18 ; 24 . + 1835 ee5e - BCS range_err + 1836 ee5e - STA cv + 1837 ee5e - RTS + 1838 ee5e - NOP + 1839 ee5e - NOP + 1840 ee5e ELSE ;OTHER BASIC + 1841 ee5e - IFNCONST HUSTNBASIC ; omit next 12 bytes if Hustn basic + 1842 ee5e - nop + 1843 ee5e -Lee53 + 1844 ee5e - txa + 1845 ee5e -man_cmd + 1846 ee5e - ldx #$1 + 1847 ee5e -Lee56 + 1848 ee5e - ; ldy acc,x + 1849 ee5e - DC.b $B4 + 1850 ee5e -vtab_stmt ;wrong address MJW + 1851 ee5e - DC.b acc + 1852 ee5e - + 1853 ee5e - sty himem,x + 1854 ee5e - ldy zp48,x + 1855 ee5e - sty pp,x + 1856 ee5e - + 1857 ee5e - dex + 1858 ee5e - IFCONST BRIELBASIC ;BRIEL BASIC HERE + 1859 ee5e - beq Lee56 + 1860 ee5e - ELSE + 1861 ee5e - beq man_cmd + 1862 ee5e - ENDIF + 1863 ee5e - tax + 1864 ee5e - rts + 1865 ee5e ELSE ;HUSTNBASIC + 1866 ee5e 85 25 STA cv + 1867 ee60 60 RTS + 1868 ee61 ea NOP + 1869 ee62 ea NOP + 1870 ee63 ENDIF + 1871 ee63 ENDIF + 1872 ee63 a0 77 gr_255_err LDY #$77 ; 119 w + 1873 ee65 4c e0 e3 go_errmess_5 JMP print_err_msg + 1874 ee68 a0 7b range_err LDY #$7b ; 123 { + 1875 ee6a d0 f9 BNE go_errmess_5 + 1876 ee6c + 1877 ee6c 20 54 e2 See6c JSR Se254 + 1878 ee6f a5 da LDA aux + 1879 ee71 d0 07 BNE Lee7a + 1880 ee73 a5 db LDA aux+1 + 1881 ee75 d0 03 BNE Lee7a + 1882 ee77 4c 7e e7 JMP Le77e + 1883 ee7a 06 ce Lee7a ASL acc + 1884 ee7c 26 cf ROL acc+1 + 1885 ee7e 26 e6 ROL p3 + 1886 ee80 26 e7 ROL p3+1 + 1887 ee82 a5 e6 LDA p3 + 1888 ee84 c5 da CMP aux + 1889 ee86 a5 e7 LDA p3+1 + 1890 ee88 e5 db SBC aux+1 + 1891 ee8a 90 0a BCC Lee96 + 1892 ee8c 85 e7 STA p3+1 + 1893 ee8e a5 e6 LDA p3 + 1894 ee90 e5 da SBC aux + 1895 ee92 85 e6 STA p3 + 1896 ee94 e6 ce INC acc + 1897 ee96 88 Lee96 DEY + 1898 ee97 d0 e1 BNE Lee7a + 1899 ee99 60 RTS + 1900 ee9a ff ff ff ff* DC.B $ff,$ff,$ff,$ff,$ff,$ff ; "......" + 1901 eea0 + 1902 eea0 20 15 e7 call_stmt JSR get16bit + 1903 eea3 6c ce 00 JMP (acc) + 1904 eea6 - IFCONST BRIELBASIC ;BRIEL BASIC + 1905 eea6 -bogus_eea6 + 1906 eea6 - LDA himem + 1907 eea6 - BNE Leeac + 1908 eea6 - dec zp4d + 1909 eea6 -Leeac + 1910 eea6 - dec himem + 1911 eea6 -Teeae + 1912 eea6 - lda zp48 + 1913 eea6 -Teeb0 + 1914 eea6 - bne Leeb4 + 1915 eea6 - dec zp49 + 1916 eea6 -Leeb4 + 1917 eea6 - dec zp48 + 1918 eea6 -Leeb6 + 1919 eea6 - ldy #$00 + 1920 eea6 - lda (himem),y + 1921 eea6 -Teeba + 1922 eea6 - sta (zp48),y + 1923 eea6 -Teebc + 1924 eea6 - lda pp + 1925 eea6 - cmp himem + 1926 eea6 - lda zpcb + 1927 eea6 -bogus_eec2 + 1928 eea6 - sbc zp4d + 1929 eea6 - bcc bogus_eea6 + 1930 eea6 -Teec6 jmp Lee53 + 1931 eea6 - + 1932 eea6 - + 1933 eea6 - + 1934 eea6 ELSE ;SANDER/HUSTON (NOT BREIL) BASIC HERE + 1935 eea6 + 1936 eea6 + 1937 eea6 bogus_eea6 ;DC.B $20,$34,$ee,$c5,$c8,$90,$bb,$85 ; " 4nEH.;." + 1938 eea6 - IFCONST SNDERBASIC ;WSANDER BASIC HERE + 1939 eea6 - JSR getbyte + 1940 eea6 - CMP text_index + 1941 eea6 - BCC range_err + 1942 eea6 - ; sta LOCZERO + 1943 eea6 - DC.b $85 + 1944 eea6 - + 1945 eea6 -Teeae LDA himem+1 + 1946 eea6 - + 1947 eea6 -Teeb0 PHA + 1948 eea6 - LDA himem + 1949 eea6 - JSR push_ya_noun_stk + 1950 eea6 -Leeb6 + 1951 eea6 - PLA + 1952 eea6 - STA noun_stk_h_int,X + 1953 eea6 - RTS + 1954 eea6 - + 1955 eea6 -Teeba LDA lomem+1 + 1956 eea6 - + 1957 eea6 -Teebc PHA + 1958 eea6 - LDA lomem + 1959 eea6 - JMP Lefb3 + 1960 eea6 -bogus_eec2 + 1961 eea6 - LDA zp85 + 1962 eea6 - DC.b $2D,$60 + 1963 eea6 -Teec6 JSR getbyte + 1964 eea6 ELSE ;HUSTON BASIC HERE + 1965 eea6 20 15 e7 JSR get16bit + 1966 eea9 a5 cf LDA zpcf + 1967 eeab 10 08 BPL Leeb5 + 1968 eead 98 TYA + 1969 eeae Teeae + 1970 eeae ca DEX + 1971 eeaf ; JSR push_ya_noun_stk + 1972 eeaf 20 DC.b $20 + 1973 eeb0 Teeb0 + 1974 eeb0 08 e7 DC.b $08,$e7 + 1975 eeb2 + 1976 eeb2 94 a0 STY noun_stk_h_int,x + 1977 eeb4 60 rts + 1978 eeb5 Leeb5 + 1979 eeb5 ; STA tokndxstk + 1980 eeb5 85 DC.b $85 + 1981 eeb6 Leeb6 + 1982 eeb6 d1 DC.b $d1 + 1983 eeb7 + 1984 eeb7 a5 ce LDA acc + 1985 eeb9 ; STA srch + 1986 eeb9 85 DC.b $85 + 1987 eeba Teeba + 1988 eeba d0 DC.b $d0 + 1989 eebb + 1990 eebb ; JSR get16bit + 1991 eebb 20 DC.b $20 + 1992 eebc Teebc + 1993 eebc 15 e7 DC.b $15, $e7 + 1994 eebe + 1995 eebe a5 ce LDA acc + 1996 eec0 85 d2 STA srch2 + 1997 eec2 bogus_eec2 + 1998 eec2 a5 cf LDA zpcf + 1999 eec4 85 d3 STA $d3 + 2000 eec6 Teec6 + 2001 eec6 a9 01 LDA #$01 + 2002 eec8 4c 3e ee JMP plot_comma + 2003 eecb ENDIF + 2004 eecb ENDIF + 2005 eecb - IFNCONST HUSTNBASIC ; omit next 2 bytes if Hustn basic + 2006 eecb - CMP #$28 ; 40 ( + 2007 eecb ENDIF + 2008 eecb b0 9b Leecb BCS range_err + 2009 eecd a8 TAY + 2010 eece a5 c8 LDA text_index + 2011 eed0 60 RTS + 2012 eed1 ea NOP + 2013 eed2 ea NOP + 2014 eed3 + 2015 eed3 98 print_err_msg2 TYA + 2016 eed4 aa TAX + 2017 eed5 a0 6e LDY #$6e ; 110 n + 2018 eed7 20 c4 e3 JSR Se3c4 + 2019 eeda 8a TXA + 2020 eedb a8 TAY + 2021 eedc 20 c4 e3 JSR Se3c4 + 2022 eedf a0 72 LDY #$72 ; 114 r + 2023 eee1 4c c4 e3 JMP Se3c4 + 2024 eee4 + 2025 eee4 20 15 e7 Seee4 JSR get16bit + 2026 eee7 06 ce Leee7 ASL acc + 2027 eee9 26 cf ROL acc+1 + 2028 eeeb 30 fa BMI Leee7 + 2029 eeed b0 dc BCS Leecb + 2030 eeef d0 04 BNE Leef5 + 2031 eef1 c5 ce CMP acc + 2032 eef3 b0 d6 BCS Leecb + 2033 eef5 60 Leef5 RTS + 2034 eef6 + 2035 eef6 peek_fn + 2036 eef6 - IFCONST BLD4APPLE1 + 2037 eef6 - JSR get16bit + 2038 eef6 ELSE + 2039 eef6 4c a9 d7 JMP A2PEEK + 2040 eef9 ENDIF + 2041 eef9 b1 ce LDA (acc),Y + 2042 eefb 94 9f STY syn_stk_l+31,X + 2043 eefd 4c 08 e7 JMP push_ya_noun_stk + 2044 ef00 + 2045 ef00 poke_stmt + 2046 ef00 - IFCONST BLD4APPLE1 + 2047 ef00 - JSR getbyte + 2048 ef00 ELSE + 2049 ef00 4c 8c d7 JMP A2POKE + 2050 ef03 ENDIF + 2051 ef03 a5 ce LDA acc + 2052 ef05 48 PHA + 2053 ef06 20 15 e7 JSR get16bit + 2054 ef09 68 PLA + 2055 ef0a 91 ce STA (acc),Y + 2056 ef0c + 2057 ef0c 60 Tef0c RTS + 2058 ef0d ff ff ff DC.B $ff,$ff,$ff ; "..." + 2059 ef10 + 2060 ef10 20 6c ee divide JSR See6c + 2061 ef13 a5 ce LDA acc + 2062 ef15 85 e6 STA p3 + 2063 ef17 a5 cf LDA acc+1 + 2064 ef19 85 e7 STA p3+1 + 2065 ef1b 4c 44 e2 JMP Le244 + 2066 ef1e + 2067 ef1e 20 e4 ee dim_num JSR Seee4 + 2068 ef21 4c 34 e1 JMP Le134 + 2069 ef24 + 2070 ef24 20 e4 ee num_array_subs JSR Seee4 + 2071 ef27 b4 78 LDY noun_stk_h_str,X + 2072 ef29 b5 50 LDA noun_stk_l,X + 2073 ef2b 69 fe ADC #$fe ; 254 ~ + 2074 ef2d b0 01 BCS Lef30 + 2075 ef2f 88 DEY + 2076 ef30 85 da Lef30 STA aux + 2077 ef32 84 db STY aux+1 + 2078 ef34 18 CLC + 2079 ef35 65 ce ADC acc + 2080 ef37 95 50 STA noun_stk_l,X + 2081 ef39 98 TYA + 2082 ef3a 65 cf ADC acc+1 + 2083 ef3c 95 78 STA noun_stk_h_str,X + 2084 ef3e a0 00 LDY #$00 ; 0 . + 2085 ef40 b5 50 LDA noun_stk_l,X + 2086 ef42 d1 da CMP (aux),Y + 2087 ef44 c8 INY + 2088 ef45 b5 78 LDA noun_stk_h_str,X + 2089 ef47 f1 da SBC (aux),Y + 2090 ef49 b0 80 BCS Leecb + 2091 ef4b 4c 23 e8 JMP left_paren + 2092 ef4e + 2093 ef4e 20 15 e7 rnd_fn JSR get16bit + 2094 ef51 a5 4e LDA rnd + 2095 ef53 20 08 e7 JSR push_ya_noun_stk + 2096 ef56 a5 4f LDA rnd+1 + 2097 ef58 d0 04 BNE Lef5e + 2098 ef5a c5 4e CMP rnd + 2099 ef5c 69 00 ADC #$00 ; 0 . + 2100 ef5e 29 7f Lef5e AND #$7f ; 127 . + 2101 ef60 85 4f STA rnd+1 + 2102 ef62 95 a0 STA noun_stk_h_int,X + 2103 ef64 a0 11 LDY #$11 ; 17 . + 2104 ef66 a5 4f Lef66 LDA rnd+1 + 2105 ef68 0a ASL + 2106 ef69 18 CLC + 2107 ef6a 69 40 ADC #$40 ; 64 @ + 2108 ef6c 0a ASL + 2109 ef6d 26 4e ROL rnd + 2110 ef6f 26 4f ROL rnd+1 + 2111 ef71 88 DEY + 2112 ef72 d0 f2 BNE Lef66 + 2113 ef74 a5 ce LDA acc + 2114 ef76 20 08 e7 JSR push_ya_noun_stk + 2115 ef79 a5 cf LDA acc+1 + 2116 ef7b 95 a0 STA noun_stk_h_int,X + 2117 ef7d 4c 7a e2 JMP mod_op + 2118 ef80 + 2119 ef80 20 15 e7 Tef80 JSR get16bit + 2120 ef83 a4 ce LDY acc + 2121 ef85 - IFCONST SNDERBASIC ;SANDER BASIC HERE + 2122 ef85 - CPY lomem + 2123 ef85 - LDA acc+1 + 2124 ef85 - SBC lomem+1 + 2125 ef85 - BCC Lefab_efad + 2126 ef85 - STY himem + 2127 ef85 - LDA acc+1 + 2128 ef85 - STA himem+1 + 2129 ef85 -Lef93 JMP new_cmd + 2130 ef85 - + 2131 ef85 -Tef96 JSR get16bit + 2132 ef85 - LDY acc + 2133 ef85 - CPY himem + 2134 ef85 - LDA acc+1 + 2135 ef85 - SBC himem+1 + 2136 ef85 - BCS Lefab_efad + 2137 ef85 - STY lomem + 2138 ef85 - LDA acc+1 + 2139 ef85 - STA lomem+1 + 2140 ef85 - BCC Lef93 + 2141 ef85 -Lefab_efad JMP Leecb + 2142 ef85 - ;DC.B ;$a5,$4d,$48,$a5,$4c ; "%MH%L" + 2143 ef85 - lda zp4d + 2144 ef85 - pha + 2145 ef85 - lda himem + 2146 ef85 ELSE + 2147 ef85 IFCONST HUSTNBASIC + 2148 ef85 c4 4a CPY lomem + 2149 ef87 a5 cf LDA zpcf + 2150 ef89 e5 4b SBC zp4b + 2151 ef8b 90 1e BCC Lefab + 2152 ef8d 84 4c STY himem + 2153 ef8f a5 cf LDA zpcf + 2154 ef91 85 4d STA zp4d + 2155 ef93 Lef93 + 2156 ef93 4c ad e5 JMP new_cmd + 2157 ef96 Tef96 + 2158 ef96 20 15 e7 JSR get16bit + 2159 ef99 a4 ce LDY acc + 2160 ef9b c4 4c CPY himem + 2161 ef9d a5 cf LDA zpcf + 2162 ef9f e5 4d SBC zp4d + 2163 efa1 b0 08 BCS Lefab + 2164 efa3 84 4a STY lomem + 2165 efa5 a5 cf LDA zpcf + 2166 efa7 85 4b sta zp4b + 2167 efa9 90 e8 bcc Lef93 + 2168 efab Lefab + 2169 efab 4c cb ee JMP Leecb + 2170 efae a5 4d LDA zp4d + 2171 efb0 48 PHA + 2172 efb1 a5 4c LDA himem + 2173 efb3 - ELSE + 2174 efb3 - cpy himem + 2175 efb3 - lda zpcf + 2176 efb3 - sbc zp4d + 2177 efb3 - bcc Lefac + 2178 efb3 - sty zp48 + 2179 efb3 - lda zpcf + 2180 efb3 - sta zp49 + 2181 efb3 - jmp Leeb6 + 2182 efb3 -Tef96 + 2183 efb3 - jsr get16bit + 2184 efb3 - ldy acc + 2185 efb3 - cpy pp + 2186 efb3 - lda zpcf + 2187 efb3 - sbc zpcb + 2188 efb3 - bcs Lefac + 2189 efb3 - sty lomem + 2190 efb3 - lda zpcf + 2191 efb3 - sta zp4b + 2192 efb3 - jmp clr + 2193 efb3 -Lefac + 2194 efb3 - jmp Leecb + 2195 efb3 - + 2196 efb3 -Lefab_efad + 2197 efb3 - nop + 2198 efb3 - nop + 2199 efb3 - nop + 2200 efb3 - nop + 2201 efb3 ENDIF + 2202 efb3 ENDIF + 2203 efb3 20 c9 ef Lefb3 JSR Sefc9 + 2204 efb6 + 2205 efb6 20 71 e1 string_input JSR input_str + 2206 efb9 4c bf ef JMP Lefbf + 2207 efbc + 2208 efbc 20 03 ee input_prompt JSR print_str + 2209 efbf a9 ff Lefbf LDA #$ff ; 255 . + 2210 efc1 85 c8 STA text_index + 2211 efc3 a9 74 LDA #$74 ; 116 t + 2212 efc5 8d 00 02 STA buffer + 2213 efc8 60 RTS + 2214 efc9 + 2215 efc9 20 36 e7 Sefc9 JSR not_op + 2216 efcc e8 INX + 2217 efcd + 2218 efcd 20 36 e7 Sefcd JSR not_op + 2219 efd0 b5 50 LDA noun_stk_l,X + 2220 efd2 60 RTS + 2221 efd3 + 2222 efd3 a9 00 mem_init_4k LDA #$00 ; 0 . + 2223 efd5 85 4a STA lomem + 2224 efd7 85 4c STA himem + 2225 efd9 a9 08 LDA #$08 ; 8 . + 2226 efdb 85 4b STA lomem+1 + 2227 efdd a9 10 LDA #$10 ; 16 . + 2228 efdf 85 4d STA himem+1 + 2229 efe1 4c ad e5 JMP new_cmd + 2230 efe4 + 2231 efe4 d5 78 Sefe4 CMP noun_stk_h_str,X + 2232 efe6 d0 01 BNE Lefe9 + 2233 efe8 18 CLC + 2234 efe9 4c 02 e1 Lefe9 JMP Le102 + 2235 efec + 2236 efec 20 b7 e5 Tefec JSR clr + 2237 efef 4c 36 e8 JMP run_warm + 2238 eff2 + 2239 eff2 20 b7 e5 Teff2 JSR clr + 2240 eff5 4c 5b e8 JMP goto_stmt + 2241 eff8 + 2242 eff8 e0 80 Seff8 CPX #$80 ; 128 . + 2243 effa d0 01 BNE Leffd + 2244 effc 88 DEY + 2245 effd 4c 0c e0 Leffd JMP Se00c + 2246 f000 + 2247 f000 + 2248 f000 + 2249 f000 +------- FILE a2a1emulv5_1.asm + 1672 f000 + 1673 f000 ;------------------------------------------------------------------------- + 1674 f000 ; + 1675 f000 ; The WOZ Monitor for the Apple 1 + 1676 f000 ; Written by Steve Wozniak 1976 + 1677 f000 ; + 1678 f000 ;------------------------------------------------------------------------- + 1679 f000 + 1680 f000 + 1681 f000 IFNCONST BLD4RAM + 1682 ff00 ORG $FF00 + 1683 ff00 ENDIF + 1684 ff00 + 1685 ff00 ;------------------------------------------------------------------------- + 1686 ff00 ; Memory declaration + 1687 ff00 ;------------------------------------------------------------------------- + 1688 ff00 + 1689 ff00 + 1690 ff00 + 1691 ff00 + 1692 ff00 + 1693 ff00 00 24 XAML EQU $24 ;Last "opened" location Low + 1694 ff00 00 25 XAMH EQU $25 ;Last "opened" location High + 1695 ff00 00 26 STL EQU $26 ;Store address Low + 1696 ff00 00 27 STH EQU $27 ;Store address High + 1697 ff00 00 28 L EQU $28 ;Hex value parsing Low + 1698 ff00 00 29 H EQU $29 ;Hex value parsing High + 1699 ff00 00 2a YSAV EQU $2A ;Used to see if hex value is given + 1700 ff00 00 2b MODE EQU $2B ;$00=XAM, $7F=STOR, $AE=BLOCK XAM + 1701 ff00 + 1702 ff00 02 00 IN EQU $0200 ;Input buffer + 1703 ff00 + 1704 ff00 - IFCONST BLD4APPLE1 + 1705 ff00 -MONDSP EQU $D012 ;PIA.B display output register + 1706 ff00 -MONDSPCR EQU $D013 ;PIA.B display control register + 1707 ff00 ENDIF + 1708 ff00 + 1709 ff00 ; KBD b7..b0 are inputs, b6..b0 is ASCII input, b7 is constant high + 1710 ff00 ; Programmed to respond to low to high KBD strobe + 1711 ff00 ; DSP b6..b0 are outputs, b7 is input + 1712 ff00 ; CB2 goes low when data is written, returns high when CB1 goes high + 1713 ff00 ; Interrupts are enabled, though not used. KBD can be jumpered to IRQ, + 1714 ff00 ; whereas DSP can be jumpered to NMI. + 1715 ff00 + 1716 ff00 + 1717 ff00 + 1718 ff00 ;------------------------------------------------------------------------- + 1719 ff00 ; Let's get started + 1720 ff00 ; + 1721 ff00 ; Remark the RESET routine is only to be entered by asserting the RESET + 1722 ff00 ; line of the system. This ensures that the data direction registers + 1723 ff00 ; are selected. + 1724 ff00 ;------------------------------------------------------------------------- + 1725 ff00 + 1726 ff00 d8 RESET CLD ;Clear decimal arithmetic mode + 1727 ff01 58 CLI + 1728 ff02 IFNCONST BLD4APPLE1 + 1729 ff02 20 83 d3 JSR INIT ;init display driver + 1730 ff05 ENDIF + 1731 ff05 a0 7f LDY #$7f ;Mask for DSP data direction reg + 1732 ff07 - IFCONST BLD4APPLE1 + 1733 ff07 - STY MONDSP ; (DDR mode is assumed after reset) + 1734 ff07 ENDIF + 1735 ff07 a9 a7 LDA #$a7 ;KBD and DSP control register mask + 1736 ff09 - IFCONST BLD4APPLE1 + 1737 ff09 - STA KBDCR ;Enable interrupts, set CA1, CB1 for + 1738 ff09 - STA MONDSPCR ; positive edge sense/output mode. + 1739 ff09 ELSE + 1740 ff09 ea NOP + 1741 ff0a ea NOP + 1742 ff0b ea NOP + 1743 ff0c ea NOP + 1744 ff0d ea NOP + 1745 ff0e ea NOP + 1746 ff0f ENDIF + 1747 ff0f + 1748 ff0f ; Program falls through to the GETLINE routine to save some program bytes + 1749 ff0f ; Please note that Y still holds $7F, which will cause an automatic Escape + 1750 ff0f + 1751 ff0f ;------------------------------------------------------------------------- + 1752 ff0f ; The GETLINE process + 1753 ff0f ;------------------------------------------------------------------------- + 1754 ff0f + 1755 ff0f c9 df NOTCR CMP #BS ;Backspace key? + 1756 ff11 f0 13 BEQ BACKSPACE ;Yes + 1757 ff13 c9 9b CMP #ESC ;ESC? + 1758 ff15 f0 03 BEQ ESCAPE ;Yes + 1759 ff17 c8 INY ;Advance text index + 1760 ff18 10 0f BPL NEXTCHAR ;Auto ESC if line longer than 127 + 1761 ff1a + 1762 ff1a a9 5c ESCAPE LDA #PROMPT ;Print prompt character + 1763 ff1c 20 ef ff JSR ECHO ;Output it. + 1764 ff1f + 1765 ff1f a9 8d GETLINE LDA #CR ;Send CR + 1766 ff21 20 ef ff JSR ECHO + 1767 ff24 + 1768 ff24 a0 01 LDY #0+1 ;Start a new input line + 1769 ff26 88 BACKSPACE DEY ;Backup text index + 1770 ff27 30 f6 BMI GETLINE ;Oops, line's empty, reinitialize + 1771 ff29 + 1772 ff29 NEXTCHAR + 1773 ff29 - IFCONST BLD4APPLE1 + 1774 ff29 - LDA KBDCR ;Wait for key press + 1775 ff29 - BPL NEXTCHAR ;No key yet! + 1776 ff29 - LDA KBD ;Clear strobe + 1777 ff29 ELSE + 1778 ff29 20 4d d2 JSR A2GETCHAR + 1779 ff2c ea NOP + 1780 ff2d ea NOP + 1781 ff2e ea NOP + 1782 ff2f ea NOP + 1783 ff30 ea NOP + 1784 ff31 ENDIF + 1785 ff31 99 00 02 STA IN,Y ;Add to text buffer + 1786 ff34 20 ef ff JSR ECHO ;Display character + 1787 ff37 c9 8d CMP #CR + 1788 ff39 d0 d4 BNE NOTCR ;It's not CR! + 1789 ff3b + 1790 ff3b ; Line received, now let's parse it + 1791 ff3b + 1792 ff3b a0 ff LDY #-1 ;Reset text index + 1793 ff3d a9 00 LDA #0 ;Default mode is XAM + 1794 ff3f aa TAX ;X=0 + 1795 ff40 + 1796 ff40 0a SETSTOR ASL ;Leaves $7B if setting STOR mode + 1797 ff41 + 1798 ff41 85 2b SETMODE STA MODE ;Set mode flags + 1799 ff43 + 1800 ff43 c8 BLSKIP INY ;Advance text index + 1801 ff44 + 1802 ff44 b9 00 02 NEXTITEM LDA IN,Y ;Get character + 1803 ff47 c9 8d CMP #CR + 1804 ff49 f0 d4 BEQ GETLINE ;We're done if it's CR! + 1805 ff4b c9 ae CMP #$AE ;"." + 1806 ff4d 90 f4 BCC BLSKIP ;Ignore everything below "."! + 1807 ff4f f0 f0 BEQ SETMODE ;Set BLOCK XAM mode ("." = $AE) + 1808 ff51 c9 ba CMP #$BA ;":" + 1809 ff53 f0 eb BEQ SETSTOR ;Set STOR mode! $BA will become $7B + 1810 ff55 c9 d2 CMP #$d2 ;"R" + 1811 ff57 f0 3b BEQ RUN ;Run the program! Forget the rest + 1812 ff59 86 28 STX L ;Clear input value (X=0) + 1813 ff5b 86 29 STX H + 1814 ff5d 84 2a STY YSAV ;Save Y for comparison + 1815 ff5f + 1816 ff5f ; Here we're trying to parse a new hex value + 1817 ff5f + 1818 ff5f b9 00 02 NEXTHEX LDA IN,Y ;Get character for hex test + 1819 ff62 49 b0 EOR #$B0 ;Map digits to 0-9 + 1820 ff64 c9 0a CMP #9+1 ;Is it a decimal digit? + 1821 ff66 90 06 BCC DIG ;Yes! + 1822 ff68 69 88 ADC #$88 ;Map letter "A"-"F" to $FA-FF + 1823 ff6a c9 fa CMP #$FA ;Hex letter? + 1824 ff6c 90 11 BCC NOTHEX ;No! Character not hex + 1825 ff6e + 1826 ff6e 0a DIG ASL + 1827 ff6f 0a ASL ;Hex digit to MSD of A + 1828 ff70 0a ASL + 1829 ff71 0a ASL + 1830 ff72 + 1831 ff72 a2 04 LDX #4 ;Shift count + 1832 ff74 0a HEXSHIFT ASL ;Hex digit left, MSB to carry + 1833 ff75 26 28 ROL L ;Rotate into LSD + 1834 ff77 26 29 ROL H ;Rotate into MSD's + 1835 ff79 ca DEX ;Done 4 shifts? + 1836 ff7a d0 f8 BNE HEXSHIFT ;No, loop + 1837 ff7c c8 INY ;Advance text index + 1838 ff7d d0 e0 BNE NEXTHEX ;Always taken + 1839 ff7f + 1840 ff7f c4 2a NOTHEX CPY YSAV ;Was at least 1 hex digit given? + 1841 ff81 f0 97 BEQ ESCAPE ;No! Ignore all, start from scratch + 1842 ff83 + 1843 ff83 24 2b BIT MODE ;Test MODE byte + 1844 ff85 50 10 BVC NOTSTOR ;B6=0 is STOR, 1 is XAM or BLOCK XAM + 1845 ff87 + 1846 ff87 ; STOR mode, save LSD of new hex byte + 1847 ff87 + 1848 ff87 a5 28 LDA L ;LSD's of hex data + 1849 ff89 81 26 STA (STL,X) ;Store current 'store index'(X=0) + 1850 ff8b e6 26 INC STL ;Increment store index. + 1851 ff8d d0 b5 BNE NEXTITEM ;No carry! + 1852 ff8f e6 27 INC STH ;Add carry to 'store index' high + 1853 ff91 4c 44 ff TONEXTITEM JMP NEXTITEM ;Get next command item. + 1854 ff94 + 1855 ff94 ;------------------------------------------------------------------------- + 1856 ff94 ; RUN user's program from last opened location + 1857 ff94 ;------------------------------------------------------------------------- + 1858 ff94 + 1859 ff94 6c 24 00 RUN JMP (XAML) ;Run user's program + 1860 ff97 + 1861 ff97 ;------------------------------------------------------------------------- + 1862 ff97 ; We're not in Store mode + 1863 ff97 ;------------------------------------------------------------------------- + 1864 ff97 + 1865 ff97 30 2b NOTSTOR BMI XAMNEXT ;B7 = 0 for XAM, 1 for BLOCK XAM + 1866 ff99 + 1867 ff99 ; We're in XAM mode now + 1868 ff99 + 1869 ff99 a2 02 LDX #2 ;Copy 2 bytes + 1870 ff9b b5 27 SETADR LDA L-1,X ;Copy hex data to + 1871 ff9d 95 25 STA STL-1,X ; 'store index' + 1872 ff9f 95 23 STA XAML-1,X ; and to 'XAM index' + 1873 ffa1 ca DEX ;Next of 2 bytes + 1874 ffa2 d0 f7 BNE SETADR ;Loop unless X = 0 + 1875 ffa4 + 1876 ffa4 ; Print address and data from this address, fall through next BNE. + 1877 ffa4 + 1878 ffa4 d0 14 NXTPRNT BNE PRDATA ;NE means no address to print + 1879 ffa6 a9 8d LDA #CR ;Print CR first + 1880 ffa8 20 ef ff JSR ECHO + 1881 ffab a5 25 LDA XAMH ;Output high-order byte of address + 1882 ffad 20 dc ff JSR PRBYTE + 1883 ffb0 a5 24 LDA XAML ;Output low-order byte of address + 1884 ffb2 20 dc ff JSR PRBYTE + 1885 ffb5 a9 3a LDA #":" ;Print colon + 1886 ffb7 20 ef ff JSR ECHO + 1887 ffba + 1888 ffba a9 20 PRDATA LDA #" " ;Print space + 1889 ffbc 20 ef ff JSR ECHO + 1890 ffbf a1 24 LDA (XAML,X) ;Get data from address (X=0) + 1891 ffc1 20 dc ff JSR PRBYTE ;Output it in hex format + 1892 ffc4 86 2b XAMNEXT STX MODE ;0 -> MODE (XAM mode). + 1893 ffc6 a5 24 LDA XAML ;See if there's more to print + 1894 ffc8 c5 28 CMP L + 1895 ffca a5 25 LDA XAMH + 1896 ffcc e5 29 SBC H + 1897 ffce b0 c1 BCS TONEXTITEM ;Not less! No more data to output + 1898 ffd0 + 1899 ffd0 e6 24 INC XAML ;Increment 'examine index' + 1900 ffd2 d0 02 BNE MOD8CHK ;No carry! + 1901 ffd4 e6 25 INC XAMH + 1902 ffd6 + 1903 ffd6 a5 24 MOD8CHK LDA XAML ;If address MOD 8 = 0 start new line + 1904 ffd8 29 07 AND #$07 + 1905 ffda 10 c8 BPL NXTPRNT ;Always taken. + 1906 ffdc + 1907 ffdc ;------------------------------------------------------------------------- + 1908 ffdc ; Subroutine to print a byte in A in hex form (destructive) + 1909 ffdc ;------------------------------------------------------------------------- + 1910 ffdc + 1911 ffdc 48 PRBYTE PHA ;Save A for LSD + 1912 ffdd 4a LSR + 1913 ffde 4a LSR + 1914 ffdf 4a LSR ;MSD to LSD position + 1915 ffe0 4a LSR + 1916 ffe1 20 e5 ff JSR PRHEX ;Output hex digit + 1917 ffe4 68 PLA ;Restore A + 1918 ffe5 + 1919 ffe5 ; Fall through to print hex routine + 1920 ffe5 + 1921 ffe5 ;------------------------------------------------------------------------- + 1922 ffe5 ; Subroutine to print a hexadecimal digit + 1923 ffe5 ;------------------------------------------------------------------------- + 1924 ffe5 + 1925 ffe5 29 0f PRHEX AND #$0F ;Mask LSD for hex print + 1926 ffe7 09 30 ORA #"0" ;Add "0" + 1927 ffe9 c9 3a CMP #"9"+1 ;Is it a decimal digit? + 1928 ffeb 90 02 BCC ECHO ;Yes! output it + 1929 ffed 69 06 ADC #6 ;Add offset for letter A-F + 1930 ffef + 1931 ffef ; Fall through to print routine + 1932 ffef + 1933 ffef ;------------------------------------------------------------------------- + 1934 ffef ; Subroutine to print a character to the terminal + 1935 ffef ;------------------------------------------------------------------------- + 1936 ffef ECHO + 1937 ffef - IFCONST BLD4APPLE1 + 1938 ffef - BIT MONDSP ;DA bit (B7) cleared yet? + 1939 ffef - BMI ECHO ;No! Wait for display ready + 1940 ffef - STA MONDSP ;Output character. Sets DA + 1941 ffef - RTS + 1942 ffef ELSE + 1943 ffef c9 20 CMP #$20 + 1944 fff1 30 02 BMI ECHO1 + 1945 fff3 09 80 ORA #$80 + 1946 fff5 ECHO1 + 1947 fff5 4c 47 d4 JMP PUTCH ; use hi-res screen + 1948 fff8 ENDIF + 1949 fff8 + 1950 fff8 ;------------------------------------------------------------------------- + 1951 fff8 ; Vector area + 1952 fff8 ;------------------------------------------------------------------------- + 1953 fff8 IFNCONST BLD4RAM + 1954 fff8 ORG $fff8 + 1955 fff8 00 00 DC.W $0000 ;Unused, what a pity + 1956 fffa 00 0f NMI_VEC DC.W $0F00 ;NMI vector + 1957 fffc 00 ff RESET_VEC DC.W RESET ;RESET vector + 1958 fffe 00 00 IRQ_VEC DC.W $0000 ;IRQ vector + 1959 10000 ENDIF + 1960 10000 + 1961 10000 ;------------------------------------------------------------------------- + 1962 10000 + 1963 10000 diff --git a/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.o b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.o new file mode 100644 index 0000000..a075af6 Binary files /dev/null and b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.o differ diff --git a/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.rom b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.rom new file mode 100644 index 0000000..645265c Binary files /dev/null and b/Source and Serial Driver/a2a1emulv5_1/a2a1emulv5_1.rom differ diff --git a/Source and Serial Driver/serial6000.605BR_6000R.aif b/Source and Serial Driver/serial6000.605BR_6000R.aif new file mode 100644 index 0000000..aa151ad Binary files /dev/null and b/Source and Serial Driver/serial6000.605BR_6000R.aif differ diff --git a/bb-v5_1.pdf b/bb-v5_1.pdf new file mode 100644 index 0000000..83595d2 Binary files /dev/null and b/bb-v5_1.pdf differ diff --git a/brainboard.htm b/brainboard.htm new file mode 100644 index 0000000..68f7f6d --- /dev/null +++ b/brainboard.htm @@ -0,0 +1,262 @@ + + + + + Brain Board + + + +

The Brain Board with Wozanium Pack

+

The Brainboard

+

The Brain Board

+ See my firmware board page for + information on a prototype version of this board.
+
+ The brain board is a firmware board for your Apple II/Apple II plus + or Apple IIe computer. The board uses inexpensive and readily + available 27c128 or 27c256 PROMs. Because of the denser PROMs used, + 6 sockets are replaced with one and the resulting size of the board + is reduced to under 3 by 4 inches. The original Apple firmware board + was able to replace motherboard ROM functionality with it’s own + ROM’s. This allowed an Apple II to have Applesoft in ROM or an Apple + II plus to have Integer basic in ROM. A softswitch (flip-flop) is + included which allows for switching between the firmware card and + motherboard ROMs through software control. The board also includes a + little known and seldom used capability that allows multiple + firmware cards to coexist in the same system as long as they are in + adjacent slots. Firmware cards were normally located in slot 0, but + they could be located in any slot.
+
+ Later on in time, a 16K ram (language) card was developed that had + the same functionality, except the appropriate BASIC was loaded into + the language card from disk when DOS was booted. The multiple card + support was dropped.
+
+ The base design of the Brain Board includes all the capability of + the Applesoft/Integer Basic Firmware ROM board that Apple Computer + released around 1978 including:
+
    +
  • a switch for enable/disable
  • +
  • a software controlled switch (soft switch) for changing + between motherboard ROMs
  • +
  • firmware board ROMs jumper for enabling monitor ROM F8 - this + was a solder pad jumper in the Apple design
  • +
  • daisy chain enable functionality via DMA bus connections for + multiple card support
  • +
+ In addition, I have added several enhancements in order to maximize + usefulness of the board.
+
    +
  • The modified design will allow booting a ROM-less motherboard + into DOS, which is not possible with the original firmware board + 27C256 PROMs allow support of two complete ROM images on the + Brain Board. Images of both Applesoft and Integer BASIC with + matching monitors could be installed and used from the single + PROM.
  • +
  • An extra soft switch is used to select whether the high or low + half of the PROM is in use. This soft switch can be configured + by external switch, through software control or by jumper.
  • +
  • The Apple II peripheral bus I/O select signal is connected to + the lowest 256 bytes of the PROM bank that is currently selected + by the bank select flip flop. I/O select is connected to a + different address depending upon the slot the board is located + in. Slot 0 does not have a I/O select signal, so this feature + cannot be used if the Brain Board is installed in slot 0. The + starting address for these 256 bytes is computed by multiplying + 0x100 by the slot number and adding 0xC000. Thus slot 1 is + 0xC100, slot 2 is 0xC200, etc.
    +
  • +
+

+
+

Wozanium Pack

+
+ The low bank of the PROM provided with the Brain Board optionally + includes a special program that will transform your Apple II into a + operating facsimile of an original Apple 1 with 16K of expanded + memory. This expanded memory was an authentic modification made to a + number of original Apple 1s. If the Brain Board is installed in slot + 1, you will also obtain access to an authentic Apple Cassette + Interface (ACI) driver located at address C100, just like the + original Apple 1. Input and output to your transformed Apple is now + limited to the keyboard, video and cassette interfaces, also just + like an original Apple 1. Software in PROM is limited to a ported + version of the orignal Apple 1 monitor and the latest known version + of Apple 1 BASIC (the so called Huston Basic) which is located at + the same address in memory (E000) as it would be located at, in an + actual Apple 1.
+
+ Your transformed Apple will be able to run most original Apple 1 + assembly and BASIC programs. Programs must either be keyed in + through the monitor or loaded via the ACI (Apple Cassette + Interface). No other options are standard, though you could add + drivers for serial ports or other expansion cards, if you wished to. + More details are provided in the manual.
+
+
+

Example Wozanium Pack - User + Driver

+ The Wozanium Pack provides a  capability for user device + drivers for input and output.  Applications that directly + access the Apple 1 PIA for keyboard input may or may not access the + hooks that are used to enable these drivers depending upon how they + are implemented.   Here is a simple example driver for the + Super Serial Board (slot 2 only).  This driver should be loaded + into locations 6000. 605B using the cassette interface.  Once + loaded type 6000R to initialize the driver.  Here is an AIF encoded version of this + driver ready for loading onto your digital music player.  
+
+     PROCESSOR 6502
+     LIST    ON
+ ACIASTAT EQU    $C0A9
+ ACIADATA EQU    $C0A8
+ ACIACMD     EQU    $C0AA
+ ACIACTRL EQU    $C0AB
+
+ READVECTOR EQU    $BC02
+ WRITEVECTOR EQU    $BC04
+ RETTOMON EQU    $FF1F
+
+     ORG    $6000
+
+ INIT
+     LDA #$2B        + ;ODD PARITY, NO ECHO, RTS LOW/W NO INT, IRQ DISABLED, DTR LOW
+     STA    + ACIACMD        ;
+
+     LDA #$3E        + ;1 STOP BIT, 7 DATA BITS, 9600 BAUD
+     STA    + ACIACTRL        ;
+    
+ ;SAVE OLD VECTORS
+     LDA READVECTOR
+     STA READRET
+     LDA READVECTOR+1
+     STA READRET+1
+    
+     LDA WRITEVECTOR
+     STA WRITERET
+     LDA WRITEVECTOR+1
+     STA WRITERET+1
+
+ ;OVERWRITE VECTORS WITH NEW FUNCTIONS
+     LDA #<READ
+     STA READVECTOR
+
+     LDA #>READ
+     STA READVECTOR+1
+
+     LDA #<WRITE
+     STA WRITEVECTOR
+
+     LDA #>WRITE
+     STA WRITEVECTOR+1
+     JMP    RETTOMON
+
+ WRITE:
+     PHA        +     ;SAVE BYTE TO WRITE
+ WRITE2:
+     LDA    + ACIASTAT    ;READ STATUS REGISTER
+     AND    #$10    +     ;TRANSMIT REGISTER EMPTY?
+     BEQ    + WRITE2        ;WAIT FOR EMPTRY
+     PLA        +     ;CHARACTER TO WRITE
+     STA ACIADATA    ;WRITE IT
+ ;    RTS        +     ; RETURN, WITHOUT DISPLAY
+     JMP (WRITERET)    ; RETURN, + AND DISPLAY
+    
+ READ2
+     JMP    + (READRET)    ;ALLOW KEYBOARD INPUT TO OCCUR
+ READ
+     LDA ACIASTAT    ;READ STATUS + REGISTER
+     AND #$08        + ;READ READISTER FULL
+     BEQ    READ2    +     ;NO, WAIT FOR CHAR TO ARRIVE
+     LDA    + ACIADATA    ;FETCH CHARACTER
+     ORA    #$80    +     ;SET MS BIT - APPLE 1 ASSUMES THIS
+ READ3
+     RTS        +     ;RETURN
+    
+ WRITERET DC.W    1
+ READRET  DC.W    1
+

Video Demo of the Wozanium Pack

+ See the  first public demo of the "BRAIN BOARD" on my video + podcast #24
+ http://www.willegal.net/feed.xml
+
+

Follow My Blog Posts Related to the Brain Board/Wozanium Pack

+ http://www.willegal.net/blog/?cat=14
+
+

Brain Board with Wozanium Pack + Assembly and Operations Guide

+ Click here to download Version 5.3.1 of + the manual in PDF format.
+
+

Wozanium Pack Source Code

+ Build with the 6502 DASM cross assembler.
+ Use the following command line:dasm a2a1emulv5_1.asm -DBLD4ROMBD=0 + -DHUSTNBASIC=0 -oa2a1rbh.o -la2a1rbh.lst
+ Included in this zip is
+
    +
  • a1basic-universal.asm  - Apple 1 BASIC modified to + run on Brainboard/Wozanium (note copyright at beginning of this + file)
  • +
  • COPYING.txt - GNU lincense
  • +
  • a2a1emulv5_1.asm - Wozanium source code
  • +
  • a2a1emulv5_1.lst - Listing
  • +
  • a2a1emulv5_1.o - Object file
  • +
  • a2a1emulv5_1.rom - 12K rom file that can be used with A2 + emulators, such as Virtual II.
  • +
+ Click a2a1emulv5_1.zip to download + Version 5.1.
+
+ Also included in this zip package, is a ROM file suitable for + emulators, such as Virtual II. This allows you to run and debug + Apple 1 software in the Apple II emulator environment. Just select + the .ROM file as the ROM for your machine and reset your virtual + machine. Just as in the Brain Board, right arrow will clear the + screen.  Using the emulated cassette interface built into + Virtual II, you can download AIF files of A1 basic and assembly + language programs and run them in your emulated Apple II.  Note + that this ROM version does not include the ACI driver at C100, so + you must enter the cassette driver by entering “D000R”, instead.
+

Obtaining Your Own Brain Board Kit

+ I no longer sell Brain Board kits, but you can get your own boards + made with the design files that can be downloaded.  I will + assume no liability for any use of the files.  You are on your + own.   Do be aware of this grounding issue + which I never resolved.
+ download Gerber Files
+ download Osmond PCB File
+
+
+ +

+ + +