commit 3cc37be5fb46b2e45be54ab13f52765c702edc24 Author: Brian Holman Date: Wed Nov 11 21:00:21 2026 -0700 Add Bone Quest anatomy quiz for CoCo diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1d8da2a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Preserve the exact downloaded SVG bytes pinned by the source receipt. +assets/skeleton-source.svg -text +*.png binary +*.DSK binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa00073 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +build/ +obj/ +test-output/ +.release/ +__pycache__/ +*.pyc +*.o +*.bin +*.d +*.s +*.lst +*.map +*.link +*.dsk +*.DSK +!/BONEQ.DSK +.DS_Store +*.vccgrant +*connection*.json diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..69407b1 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,25 @@ +# Working on Bone Quest + +Bone Quest is a separate CoCo 3 quiz based on Capital Quest. Read README.md and +docs/IMPLEMENTATION.md. Current user instructions take precedence over historical +briefs or reference documents. Keep Capital Quest and the VCC Plus/website repos +unchanged while working here. + +Target a 512 KB CoCo 3 using VCC Plus's documented CMOC/GIME APIs and page swapping. +Use the existing relative Makefile/vccplus-project.json workflow. Ordinary builds +must use the installed app's bundled tools, without asset-generation dependencies. +Keep the original skeleton SVG, attribution, authored data, generated drawing C, +necessary conversion scripts and component notices. Distinguish major bones and +bone groups from a claim to quiz all206 individual bones. + +Preserve users' media and documents. Test isolated disposable machines/disks, +not the normal emulator. Pointer/keyboard desktop automation needs an idle-desktop +grant; headless guest-key playtests do not control the desktop. Keep raw logs, +private inputs and connection grants out of Git. + +Use bounded independent agents when useful, with explicit file ownership and one +integration owner. Avoid simultaneous builds into one output directory. Check +source identity after asynchronous work. Run meaningful logic/geometry and actual +guest play checks; report skips/limitations honestly and retain selected real +screenshots. Keep work reviewable until a commit/push is authorized. Creating a +repository does not authorize a public game release or a visibility change. diff --git a/BONEQ.DSK b/BONEQ.DSK new file mode 100644 index 0000000..db0fc32 Binary files /dev/null and b/BONEQ.DSK differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE @@ -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/Makefile b/Makefile new file mode 100644 index 0000000..474e2a2 --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +# Built by VCC Plus using its bundled CMOC/6809 tools. No emulator source needed. +CMOC ?= cmoc +PERL ?= perl +WRITECOCOFILE ?= writecocofile +INSTALL_LOADER ?= install-coco-boot-loader +VCC_CONFIGURATION ?= Release +ifeq ($(VCC_CONFIGURATION),Debug) +OPTIM = -O2 -fno-omit-frame-pointer +else +OPTIM = -O2 +endif +ifeq ($(VCC_CONFIGURATION),Test) +CPPFLAGS += -DTEST_SEED=2709 +endif +CPPFLAGS += -I. +CFLAGS = --coco --intermediate --stack-space=2048 $(OPTIM) +SOURCES = main.c src/quiz.c src/ui.c src/bones.c src/map_data.c +OBJECTS = $(SOURCES:%.c=obj/%.o) +.PHONY: all build disk clean assets test +all: disk +build: build/BONEQ.bin +disk: build/BONEQ.dsk +build/BONEQ.bin: $(OBJECTS) + @mkdir -p build + "$(CMOC)" --coco --intermediate --org=2000 --limit=7800 -o $@ $(OBJECTS) -lgime -linput -lbcontrol -lhirestxt +# Explicit project headers avoid CMOC .d paths to expired VCC build snapshots. +obj/%.o: %.c quiz.h ui.h map_data.h Makefile + @mkdir -p $(dir $@) + "$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $< +obj/boot.bin: tools/boot.c Makefile + @mkdir -p obj + "$(CMOC)" --dos -O0 --limit=2800 -o $@ $< +build/BONEQ.dsk: build/BONEQ.bin obj/boot.bin + $(PERL) -e 'print chr(255) x (35*18*256)' > $@ + "$(INSTALL_LOADER)" $@ obj/boot.bin + "$(WRITECOCOFILE)" $@ build/BONEQ.bin +assets: + python3 tools/prepare_questions.py + python3 tools/prepare_assets.py +test: + @set -e; quiz_test_dir=$$(mktemp -d "$${TMPDIR:-/tmp}/bone-quest-host.XXXXXX"); \ + trap 'rm -rf "$$quiz_test_dir"' EXIT HUP INT TERM; \ + cc -std=c99 -Wall -Wextra -Werror -DHOST_TEST -I. tests/test_quiz.c src/quiz.c src/bones.c -o "$$quiz_test_dir/test_quiz"; \ + "$$quiz_test_dir/test_quiz" + python3 tests/check_assets.py +clean: + rm -rf obj build diff --git a/README.md b/README.md new file mode 100644 index 0000000..40f8294 --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +# Bone Quest for CoCo + +An anatomy quiz for a 512 KB Color Computer 3, built from Capital Quest's working +quiz foundation. Identify 25 major bones and bone groups on a human skeleton, +choose among four names or type the answer, then review missed questions. + +Download the ready-to-test [BONEQ.DSK](BONEQ.DSK). Both complete quiz modes have +been checked in VCC Plus on emulated MC6809 and HD6309 processors. + +![Bone Quest identifying the neck vertebrae in the full skeleton and enlarged detail view](docs/images/multiple-choice.png) + +## Machine and loading + +Use a CoCo 3 with 512 KB RAM, BASIC, an FD-502 Disk BASIC controller and a keyboard. +RGB is the intended color presentation. Insert a copy of BONEQ.DSK in FD0, +preserve existing guest work, choose Cold Restart, then type DOS at the OK prompt. +The direct loading command is `LOADM"BONEQ.BIN":EXEC`. The game does not save scores +or write to its disk. Use disposable copies while developing. + +## Controls and rules + +- Title: 1 multiple choice, 2 typed answers, C credits, Q quit to BASIC. +- Multiple choice: 1–4 selects an answer. The correct slot is chosen randomly from + the three that were not correct last time; the first question can use any slot. + Feedback advances automatically after its sound and reading pause. +- Typed answers: Enter submits, Backspace edits, Esc/CoCo Break reveals, Space advances + after feedback. Case and extra spaces are ignored. Common names such as + collarbone, shoulder blade, thighbone, kneecap, shinbone and tailbone are accepted. + A close spelling offers R to retry or V to reveal; a corrected answer earns + one point, with corrections counted separately. The entry limit is 33 characters. +- Progress: teal unanswered, purple correct, red missed, yellow current. The full + skeleton keeps context while a detail panel enlarges the selected area. +- Results: R review, N next review page, B back, P play again, Q quit. Each topic is + asked once. One correct answer earns one point; percentage is correct/25×100. + +The quiz covers 25 named major bones/groups shown by the supplied anterior-view +illustration, not every individual bone in an adult skeleton. Paired left/right +counterparts share a question. Finger and toe phalanges are separate topics; +bare "phalanges" is deliberately not a complete answer. See docs/ANATOMY.md. + +## Build + +Open the folder containing Makefile and vccplus-project.json in VCC Plus's +Develop → C Development workspace. Select Release and Build, then use Show Build +Products to locate build/BONEQ.dsk. Normal builds use the installed app's bundled +CMOC/LWTools/Make/Perl and need no Xcode, Homebrew or asset-generation tools. + +Equivalent command-line build: + +```sh +export PATH="/Applications/VCC Plus.app/Contents/Resources/Toolchain/bin:$PATH" +make VCC_CONFIGURATION=Release disk +``` + +Debug uses optimized code with frame pointers; Test uses deterministic seed 2709. +Clean between configurations in one working folder. Generated anatomy/drawing C +is retained for normal builds. Optional asset regeneration needs Python 3, Pillow +and rsvg-convert; optional host logic tests need a host C compiler. +After editing data/bones.json or the skeleton artwork, run make assets to refresh +the retained C tables. make test detects stale question data and invalid geometry. + +## Credits and source + +Based on Capital Quest by Brian Holman, revision +[afa6f3c](https://vccplus-git.brianholman.com/VCCPlusApps/CoCoCapitalQuiz/commit/afa6f3c2a05cbd71c1f22ec3506f4f63421b2bc6), +GPL-3.0-or-later. Bone Quest is a separate project; Capital Quest is unchanged. + +Skeleton artwork: Mariana Ruiz Villarreal (LadyofHats), author's public-domain +release via Wikimedia Commons. The original SVG and source receipt are retained. +Adaptations remove labels, reduce resolution, recolor and encode per-topic masks +and selected detail views. See assets/CREDITS.md and docs/ANATOMY.md. + +The game remains GPL-3.0-or-later; preserve the full LICENSE and component notices. +Pierre Sarrazin's font and boot helper keep their public-domain headers. The +bundled libraries retain their individual terms, including the original BControl +notice. No ROM image or private connection is included here. diff --git a/assets/BCONTROL-NOTICE.txt b/assets/BCONTROL-NOTICE.txt new file mode 100644 index 0000000..a6531d4 --- /dev/null +++ b/assets/BCONTROL-NOTICE.txt @@ -0,0 +1,156 @@ +bcontrol 0.1.6 + +Public domain (upstream dedication) + + +--- Joystick.h --- +/* Joystick.h - Autonomous joystick functions for the CoCo. + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- Joystick_private.h --- +/* Joystick_private.h + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- Keyboard.c --- +/* keyin.c - Autonomous keyboard functions for the CoCo. + By Pierre Sarrazin + This file is in the public domain, except the parts that come from Color Basic. +*/ + +--- Keyboard.h --- +/* Keyboard.h - Autonomous keyboard functions for the CoCo. + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- README.md --- +BControl +======== + +By Pierre Sarrazin . + +This library is in the public domain, except the parts of Keyboard.c +that come from Color Basic. + +This library offers functions similar to Color Basic's INKEY$, +JOYSTK and BUTTON. It does not assume the presence of the Color +Basic interpreter. + + +# Usage + +To use the Keyboard object, instante an instance, then call +`Keyboard_init()` on it. Then call `Keyboard_poll()` the same way +one would call INKEY$ in a Basic program. Call `Keyboard_shutdown()` +when finished with the Keyboard object. + +To read the joystick axis values and button states on a CoCo or +Dragon, call `Joystick_getAxisValues()` and `Joystick_getButtonStates()`. +No initialization step is needed. + +However, to help the portability to OS-9 of a program that uses +the joystick, `Joystick_getAxisValuesAndButtonState()` should be used +instead of the other functions of Joystick.h. + +See Keyboard.h and Joystick.h for details. + + +# Dragon support + +To compile for the Dragon, pass TARGET=dragon to make. + + +# OS-9 support + +To compile for OS-9, pass TARGET=OS9 to make. + + +# Version history + + 0.1.0 2018-11-25 First public release. + 0.1.1 2019-06-03 Partial support for OS-9 added: + setScreenBuffer() not supported. + Removed the (non portable) startInCapsLock parameter + from `Keyboard_init()`. + 0.1.2 2019-09-21 Added missing OS9RawTerminal.h. + 0.1.3 2020-06-27 Added `Joystick_selectAnalogMuxInputs()` and + `Joystick_compareAxis()`, which allow custom, faster + axis polling (but is not usable under OS-9). + 0.1.4 2022-11-12 Fixed the Dragon executable extension in the makefile. + Added `Joystick_getAxisValuesAndButtonState()`, which + targets a single joystick and also works under OS-9. + Include "Joystick.h" to use it. + 0.1.5 2024-08-29 Joystick comparator read routine slightly optimized + with inline asm. (Not applicable to OS-9 version.) + Centralized some function prototypes. + Removed UTF-8 characters from Keyboard.c. + 0.1.6 2026-09-06 Added Joystick_getButtonStates2(). + Optimized Joystick_selectAnalogMuxInputs(). + Optimized Joystick_compareAxis(). + +--- bcontrol.c --- +/* bcontrol.c - Test and demo program. + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- compareAxis.c --- +/* compareAxis.c - Autonomous joystick functions for the CoCo. + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- disableSound.c --- +/* disableSound.c + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- enableSound.c --- +/* enableSound.c + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- getAxisValues.c --- +/* getAxisValues.c + By Pierre Sarrazin + This file is in the public domain. + + The current implementation is based on Color Basic's. + Improvements are welcome. +*/ + +--- getAxisValuesAndButtonState.c --- +/* getAxisValuesAndButtonState.c - Autonomous joystick functions for the CoCo. + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- getButtonStates.c --- +/* getButtonStates.c + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- getButtonStates2.c --- +/* getButtonStates2.c + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- readComparatorMultipleTries.c --- +/* readComparatorMultipleTries.c - Autonomous joystick functions for the CoCo. + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- selectAnalogMuxInputs.c --- +/* selectAnalogMuxInputs.c + By Pierre Sarrazin + This file is in the public domain. +*/ diff --git a/assets/CREDITS.md b/assets/CREDITS.md new file mode 100644 index 0000000..670612a --- /dev/null +++ b/assets/CREDITS.md @@ -0,0 +1,30 @@ +# Bone Quest artwork and component credits + +## Human skeleton + +Original: **Human skeleton front en.svg**, by **Mariana Ruiz Villarreal +(LadyofHats)**, released into the public domain by its author. + +- Description/terms: https://commons.wikimedia.org/wiki/File: Human_skeleton_front_en.svg +- Original SVG: https://upload.wikimedia.org/wikipedia/commons/c/ca/Human_skeleton_front_en.svg +- Retained source: skeleton-source.svg; exact download hash: source-receipt.json. + +The author grants use for any purpose where a public-domain dedication is not +legally possible. Original metadata remains in the retained SVG. Adaptations for +Bone Quest remove the printed labels and leader lines, reduce resolution, +recolor the drawing and encode selected bone/group masks and detail views. +This is an educational front-view diagram; grouped and paired bones are not +individually counted questions. No endorsement by the artist is implied. + +## Game foundation and runtime + +Bone Quest uses the GPL-3.0-or-later Capital Quest foundation by Brian Holman, +revision afa6f3c2a05cbd71c1f22ec3506f4f63421b2bc6: +https://vccplus-git.brianholman.com/VCCPlusApps/CoCoCapitalQuiz +The state/capital dataset and Fla-shop map artwork are not included in Bone Quest. + +Pierre Sarrazin's font5x8 is public domain, from HiresTxt. The disk loader adapts +his public-domain autostart.c 0.1.2 to load BONEQ.BIN; its original header remains. +CMOC, LWTools, GIME and keyboard libraries retain their original authorship and +file-specific terms. Preserve BCONTROL-NOTICE.txt, HIRESTXT-NOTICE.txt and +VCC-Guest-SDK-NOTICE.txt; the game's GPL does not replace those component notices. diff --git a/assets/HIRESTXT-NOTICE.txt b/assets/HIRESTXT-NOTICE.txt new file mode 100644 index 0000000..3b8af61 --- /dev/null +++ b/assets/HIRESTXT-NOTICE.txt @@ -0,0 +1,562 @@ +hirestxt 0.5.1 + +Public domain (upstream dedication) + + +--- README.md --- +hirestxt +======== + +By Pierre Sarrazin + +This library is in the public domain. + +It implements a software 51x24 or 42x24 black-on-green PMODE 4 text +screen (256x192x2), or a 64x24 16-color text screen in the CoCo 3's +320x200x16 graphics mode. It redirects printf() to that screen. + +Useful to get true lowercase, including Latin-1 accented characters, +on all CoCos, on the Dragon, and on NitrOS-9. + +Optionally supports several VT52 terminal sequences. + +A sample program is included. See the *Demo* section in this file. + +This library is intended to be compiled by CMOC. + +See the [CMOC home page](http://sarrazip.com/dev/cmoc.html). + + +## Setup + +The instructions apply when targetting the Color Basic environment. + +Do the following to initialize the 51x24 text screen at $0E00 on a CoCo +or Dragon. + +Put this directive somewhere at the beginning of the C file in question: + + #include "hirestxt.h" + +Then set up PMODE 4 green/black graphics, like this: + + width(32); /* PMODE graphics will only appear from 32x16 (does nothing on CoCo 1&2) */ + pmode(4, (byte *) 0x0E00); + pcls(255); + screen(1, 0); /* green/black */ + +Then define a `HiResTextScreenInit` object: + + struct HiResTextScreenInit init = + { + 51, /* characters per row */ + writeCharAt_51cols, /* must be consistent with previous field */ + 0x0E00, + TRUE /* redirects printf() to the 51x24 text screen */ + (word *) 0x112, /* pointer to a 60 Hz async counter (Color Basic's TIMER) */ + 0, /* default cursor blinking rate */ + NULL, /* use inkey(), i.e., Color Basic's INKEY$ */ + NULL, /* no sound on '\a' */ + }; + +Then call `initHiResTextScreen()` with the address of this object: + + initHiResTextScreen(&init); + +To use the 42x24 mode, replace 51 and `writeCharAt_51cols` with 42 and +`writeCharAt_42cols`. + +Optionally, to get the screen address from Basic instead of assuming +$0E00, use this expression in the `HiResTextScreenInit` struct initializer: + + (byte *) * (byte *) 0x00BC << 8 + +Then, see hirestxt.h for the available functions. + +To compile with this library, pass `-I ` to cmoc, where `` is +the directory where hirestxt.h is. + +To link with this library, specify `-L -lhirestxt` to the cmoc +invocation that does the linking. This specifies where the libhirestxt.a +file can be found. + + +## Demo + +The demo is compiled as `hirestxt.bin` for the CoCo and Dragon Basic +environments, and `hirestxt` for OS-9. + +Under OS-9, the demo must be executed from a 32x16 terminal. + + +## Dragon support + +To compile for the Dragon, pass `TARGET=dragon` to make. + + +## OS-9 support + +To compile for OS-9, pass `TARGET=os9` to make. + +This generates a demo in an OS-9 executable named `hirestxt`. Use the +[ToolShed](https://sourceforge.net/projects/toolshed/) `os9` command +to transfer this executable to an OS-9 virtual hard-disk (for example) +and to give it the execution attributes: + + os9 copy -r hirestxt the-disk.vhd,/CMDS/ + os9 attr -epe the-disk.vhd,/CMDS/hirestxt + +Under OS-9, the demo must be executed from a 32x16 terminal. + +This has been tested with [NitrOS-9](http://www.nitros9.org/battle.html) +EOU 1.0.1 and [CMOC](http://sarrazip.com/dev/cmoc.html) 0.1.89. +The /nil driver must be present. + + +## VT52 Support + +A subset of [VT52](https://en.wikipedia.org/wiki/VT52) terminal sequences +are supported by the code in function processConsoleOutChar() of +processConsoleOutChar.c. + +If this support is not needed, the code for it can be omitted by compiling +the library with HIRESTEXT_NO_VT52. + + +## License + +This library is in the public domain. + + +## Version history + + 0.1.0 - 2016-05-01 - First public release. + 0.1.1 - 2016-09-12 - Adapted to CMOC 0.1.31 re: inline asm. + 0.1.2 - 2016-12-26 - HIRESTEXT_NO_VT52 to avoid VT52 code. + 0.2.0 - 2017-12-01 - Adapted to modular compilation under CMOC 0.1.43. + 0.2.1 - 2018-04-03 - Adapted to modular compilation under CMOC 0.1.51. + 0.3.0 - 2018-09-20 - Added 42x24 text screen and 5x8 font. + Adapted to CMOC 0.1.53. + 0.3.1 - 2018-11-25 - Fixed linking error re: putBitmaskInScreenWord() in 42x24 mode. + Now compilable for the Dragon (make TARGET=dragon). + 0.4.0 - 2023-08-19 - initHiResTextScreen() and closeHiResTextScreen() do not change the + screen mode themselves anymore -- see the next section. + The HiResTextScreenInit struct must now receive a pointer + to a timer word. + It may also receive a pointer to an inkey-like function. + Replaced textScreenPageNum in struct HiResTextScreenInit with + the textScreenBuffer field, which removes a dependency on the SAM chip -- + see the next section. + Stopped exporting the global textScreenBuffer variable. + Removed the setTextScreenAddress() function. + Fixed typo in the name of the internal oldCHROUT global variable. + Merged all library code into a single .a file. + Most functions are now in their own file, to optimize the final executable size. + Most global variables are now fields of a single global struct instance. + Now usable under OS-9 (assumes that the /nil driver is installed). + Slightly optimized character writing routine. + 0.4.1 - 2023-09-02 - Added setInverseVideoMode() and setBoldMode() which allow writing + characters in inverted colors and/or in bold. + Added support for VT52 sequences p and q to turn inverse + video on of off, and E to home the cursor and clear the screen. + 0.4.2 - 2024-11-28 - Added showOS9PMode4Screen(), quitOS9Graphics(), OS9Timer_init(), + OS9Timer_shutdown() and OS9Timer_getTimerAddress() under OS-9. + Fixed a bug in the demo where the column of letters was displayed + too slowly. + 0.5.0 - 2025-03-14 - Added support for writing to a 64x24 text screen on a CoCo 3 320x192x16 + graphics screen. See initHiResTextScreen2(), setForegroundColor() et al. + hirestxt-demo.c gives an example. + The screen is now cleared from top to bottom instead of bottom up. + The demo now plays an audible bell character. + 0.5.1 - 2025-09-27 - Removed UTF-8 non-breaking space character from hirestxt-demo.c and + hirestxt.h, to resolve a compilation issue with GCC 14.2.0. + + +## Using version 0.5.x + +Version 0.5.0 introduced support for a 64x24 text mode in the CoCo 3 320x192x16 graphics mode. +This text mode is slower than using the CoCo 3's hardware 40- or 80-column text screens, but it +allows: + +* using the same hirestxt-based code to display text on a CoCo 1, 2 or 3, on a Dragon, or +on NitrOS-9; +* mixing text and graphics on the same screen, using a narrower font than the byte-aligned + font used by Basic's HPRINT command. + +The hirestxt-demo.c program shows examples of how to use both the CoCo 3 64x24 mode and the +original 51x24 and 42x24 modes on a 256x192x2 (PMODE 4) screen. + + +## Adapting to version 0.4.x + +The instructions apply when targetting the Color Basic environment. + +- Where the `HiResTextScreenInit` is initialized, add these values: + + - A value for the `timer` field, which must be the address of a 16-bit word that + gets incremented 60 times per second. + + - A zero for the `cursorAnimationLowTimerByteMask` field. + + - A NULL value for the `inkeyFuncPtr` field, to have the library use `inkey()`, + as before, to poll the keyboard. + + - A NULL value for the `bellFuncPtr` field, to have a call to Color Basic's + SOUND 1,1, as before, when character 7 is sent to the screen. + +- Execute this code before calling `initHiResTextScreen()`: + + initCoCoSupport(); + width(32); + pmode(4, A); + pcls(255); + screen(1, 0); + + Replace `A` with the address put in the `textScreenBuffer` field of struct + `HiResTextScreenInit`. + + To use the current address where ECB would draw PMODE 4 graphics, use this + expression: `(byte *) * (byte *) 0x00BC << 8` + + (This takes $BC, sees it as a byte pointer, gets that byte, sees it as a + 16-bit address, then shifts this address 8 bits left, to form the actual + address of the screen buffer.) + + Under other platforms, execute platform-specific code to set up a 256x192 + green/black 2-color graphics mode, then put its buffer address in + `textScreenBuffer`. + +- Execute this code after calling `closeHiResTextScreen()`: + + pmode(0, 0); + cls(255); + screen(0, 0); + +- If the program was using the `textScreenBuffer` global variable, it + should now stop using it and use the address that it puts in the + `textScreenBuffer` field of `HiResTextScreenInit` instead. + +- Similarly, the `hiResWidth` global variable has been replaced with + the `numColumns` field of `HiResTextScreenInit`. + +- The `textPosX` and `textPosY` global variables have been removed from + the public interface. Functions `getCursorColumn()` and `getCursorRow()` + have been added. The cursor can be moved with `moveCursor()`. + + +--- animateCursor.c --- +/* animateCursor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- clear.c --- +/* clear.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- clearRowsToEOS.c --- +/* clearRowsToEOS.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- closeHiResTextScreen.c --- +/* closeHiResTextScreen.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- clrscr.c --- +/* clrscr.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- clrtobot.c --- +/* clrtobot.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- clrtoeol.c --- +/* clrtoeol.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- fillNybbles.c --- +/* initHiResTextScreen2.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- font4x8.c --- +/* font4x8.c - ISO-8859-1 font for a 51x24 software text screen. + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- font4x8.h --- +/* font4x8.h - ISO-8859-1 font for a 51x24 software text screen. + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- font5x8.c --- +/* font5x8.c - ISO-8859-1 font for a 42x24 software text screen. + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- font5x8.h --- +/* font5x8.h - ISO-8859-1 font for a 42x24 software text screen. + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- getCursorColumn.c --- +/* getCursorColumn.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- getCursorRow.c --- +/* getCursorRow.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- hirestxt-demo.c --- +/* hirestxt-demo.c - Example program that uses hirestxt.h. + + By Pierre Sarrazin + This file is in the public domain. + + This demo uses VT52 sequences. + The library must NOT have been compiled with HIRESTEXT_NO_VT52. +*/ + +--- hirestxt.h --- +/* hirestxt.h - 51x24 black-on-green PMODE 4 text screen. + + By Pierre Sarrazin + This file is in the public domain. + + Quick Guide: + - Call initHiResTextScreen() first. + - End with a call to closeHiResTextScreen(). + - #define HIRESTEXT_NO_VT52 to avoid compiling the VT52 code. +*/ + +--- hirestxt_private.h --- +/* hirestxt_private.h - 51x24 black-on-green PMODE 4 text screen. + + By Pierre Sarrazin + This file is in the public domain. + +*/ + +--- init.c --- +/* init.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- initHiResTextScreen.c --- +/* initHiResTextScreen.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- initHiResTextScreen2.c --- +/* initHiResTextScreen2.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- initVT52.c --- +/* initVT52.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- invertPixelsAtCursor.c --- +/* invertPixelsAtCursor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- moveCursor.c --- +/* moveCursor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- os9timer.c --- +/* os9timer.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- processConsoleOutChar.c --- +/* processConsoleOutChar.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- putBitmaskInScreenWord.c --- +/* putBitmaskInScreenWord.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- quitOS9Graphics.c --- +/* quitOS9Graphics.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- removeCursor.c --- +/* removeCursor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- scrollTextScreenUp.c --- +/* scrollTextScreenUp.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- setBackgroundColor.c --- +/* setBackgroundColor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- setBoldMode.c --- +/* setBoldMode.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- setForegroundBoldColor.c --- +/* setForegroundBoldColor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- setForegroundColor.c --- +/* setForegroundColor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- setInverseVideoMode.c --- +/* setInverseVideoMode.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- showOS9PMode4Screen.c --- +/* showOS9PMode4Screen.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- waitKeyBlinkingCursor.c --- +/* waitKeyBlinkingCursor.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeCenteredLine.c --- +/* writeCenteredLine.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeChar.c --- +/* writeChar.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeCharAt.c --- +/* writeCharAt.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeCharAt_320x16.c --- +/* writeCharAt_320x16.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeCharAt_42cols.c --- +/* writeCharAt_42cols.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeCharAt_51cols.c --- +/* writeCharAt_51cols.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeDecWord.c --- +/* writeDecWord.c + + By Pierre Sarrazin + This file is in the public domain. +*/ + +--- writeString.c --- +/* writeString.c + + By Pierre Sarrazin + This file is in the public domain. +*/ diff --git a/assets/VCC-Guest-SDK-NOTICE.txt b/assets/VCC-Guest-SDK-NOTICE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/assets/VCC-Guest-SDK-NOTICE.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/assets/generated/chest-preview.png b/assets/generated/chest-preview.png new file mode 100644 index 0000000..272d56d Binary files /dev/null and b/assets/generated/chest-preview.png differ diff --git a/assets/generated/chest-regions.png b/assets/generated/chest-regions.png new file mode 100644 index 0000000..b741803 Binary files /dev/null and b/assets/generated/chest-regions.png differ diff --git a/assets/generated/foot-preview.png b/assets/generated/foot-preview.png new file mode 100644 index 0000000..5ffa7fb Binary files /dev/null and b/assets/generated/foot-preview.png differ diff --git a/assets/generated/foot-regions.png b/assets/generated/foot-regions.png new file mode 100644 index 0000000..0e8f028 Binary files /dev/null and b/assets/generated/foot-regions.png differ diff --git a/assets/generated/hand-preview.png b/assets/generated/hand-preview.png new file mode 100644 index 0000000..26410c6 Binary files /dev/null and b/assets/generated/hand-preview.png differ diff --git a/assets/generated/hand-regions.png b/assets/generated/hand-regions.png new file mode 100644 index 0000000..8bb700d Binary files /dev/null and b/assets/generated/hand-regions.png differ diff --git a/assets/generated/head-preview.png b/assets/generated/head-preview.png new file mode 100644 index 0000000..92d797e Binary files /dev/null and b/assets/generated/head-preview.png differ diff --git a/assets/generated/head-regions.png b/assets/generated/head-regions.png new file mode 100644 index 0000000..10b4573 Binary files /dev/null and b/assets/generated/head-regions.png differ diff --git a/assets/generated/overview-preview.png b/assets/generated/overview-preview.png new file mode 100644 index 0000000..0c35953 Binary files /dev/null and b/assets/generated/overview-preview.png differ diff --git a/assets/generated/overview-regions.png b/assets/generated/overview-regions.png new file mode 100644 index 0000000..750ad95 Binary files /dev/null and b/assets/generated/overview-regions.png differ diff --git a/assets/generated/spine-preview.png b/assets/generated/spine-preview.png new file mode 100644 index 0000000..3a75bc3 Binary files /dev/null and b/assets/generated/spine-preview.png differ diff --git a/assets/generated/spine-regions.png b/assets/generated/spine-regions.png new file mode 100644 index 0000000..38486f9 Binary files /dev/null and b/assets/generated/spine-regions.png differ diff --git a/assets/skeleton-source.svg b/assets/skeleton-source.svg new file mode 100644 index 0000000..e880955 --- /dev/null +++ b/assets/skeleton-source.svg @@ -0,0 +1,5436 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skull + + +Cranium + + +Mandible + + +Clavicle + + +Manubrium + + +Scapula + + +Sternum + + +Ribs + + +Humerus + + +Ulna + + +Radius + + +Pelvic girdle + + +Carpals + + +Metacarpals + + +Phalanges + + +Femur + + +Patella + + +Tibia + + +Fibula + + +Tarsals + + +Metatarsals + + +Phalanges + + +CervicalVertebrae (I-VII) + + +ThoracicVertebrae (T I - T XII) + + +LumbarVertebrae (L I - L V) + + +Sacrum + + +Coccyx + + +Spinal Column + + + \ No newline at end of file diff --git a/assets/source-receipt.json b/assets/source-receipt.json new file mode 100644 index 0000000..f3ca559 --- /dev/null +++ b/assets/source-receipt.json @@ -0,0 +1,11 @@ +{ + "source_url": "https://upload.wikimedia.org/wikipedia/commons/c/ca/Human_skeleton_front_en.svg", + "description_page": "https://commons.wikimedia.org/wiki/File:Human_skeleton_front_en.svg", + "author": "Mariana Ruiz Villarreal (LadyofHats)", + "license": "Public domain dedication by author", + "retrieved": "2026-11-11", + "byte_size": 862210, + "sha256": "501752c94533439a31521a929a10ad1dd1b781f588d44fc87144c426a38b8773", + "foundation_repository": "https://vccplus-git.brianholman.com/VCCPlusApps/CoCoCapitalQuiz", + "foundation_revision": "afa6f3c2a05cbd71c1f22ec3506f4f63421b2bc6" +} diff --git a/data/bones.json b/data/bones.json new file mode 100644 index 0000000..6ddb44d --- /dev/null +++ b/data/bones.json @@ -0,0 +1,221 @@ +[ + { + "code": "CRANIUM", + "name": "Cranium", + "hint": "Head above the lower jaw", + "aliases": [ + "skull" + ] + }, + { + "code": "MANDIBLE", + "name": "Mandible", + "hint": "Lower jaw", + "aliases": [ + "lower jaw", + "jawbone" + ] + }, + { + "code": "CLAVICLE", + "name": "Clavicle", + "hint": "Front of the shoulder", + "aliases": [ + "collarbone", + "collar bone" + ] + }, + { + "code": "SCAPULA", + "name": "Scapula", + "hint": "Back of the shoulder", + "aliases": [ + "shoulder blade", + "shoulderblade" + ] + }, + { + "code": "STERNUM", + "name": "Sternum", + "hint": "Center of the chest", + "aliases": [ + "breastbone", + "breast bone" + ] + }, + { + "code": "RIBS", + "name": "Ribs", + "hint": "Curving around the chest", + "aliases": [ + "rib", + "rib bones" + ] + }, + { + "code": "CERVICAL", + "name": "Cervical vertebrae", + "hint": "Neck section of the spine", + "aliases": [ + "neck vertebrae", + "cervical vertebra" + ] + }, + { + "code": "THORACIC", + "name": "Thoracic vertebrae", + "hint": "Upper and middle back", + "aliases": [ + "thoracic vertebra" + ] + }, + { + "code": "LUMBAR", + "name": "Lumbar vertebrae", + "hint": "Lower back", + "aliases": [ + "lumbar vertebra", + "lower back vertebrae" + ] + }, + { + "code": "SACRUM", + "name": "Sacrum", + "hint": "Base of spine above tailbone", + "aliases": [ + "sacral bone" + ] + }, + { + "code": "COCCYX", + "name": "Coccyx", + "hint": "Small tip below the sacrum", + "aliases": [ + "tailbone", + "tail bone" + ] + }, + { + "code": "PELVIS", + "name": "Pelvic girdle", + "hint": "Hip region, on either side", + "aliases": [ + "hip bones", + "hip girdle", + "coxal bones" + ] + }, + { + "code": "HUMERUS", + "name": "Humerus", + "hint": "Upper arm", + "aliases": [ + "upper arm bone" + ] + }, + { + "code": "RADIUS", + "name": "Radius", + "hint": "Forearm, thumb side", + "aliases": [ + "radius bone" + ] + }, + { + "code": "ULNA", + "name": "Ulna", + "hint": "Forearm, little-finger side", + "aliases": [ + "ulna bone" + ] + }, + { + "code": "CARPALS", + "name": "Carpals", + "hint": "Wrist", + "aliases": [ + "wrist bones", + "carpal bones" + ] + }, + { + "code": "METACARPALS", + "name": "Metacarpals", + "hint": "Palm between wrist and fingers", + "aliases": [ + "palm bones", + "metacarpal bones" + ] + }, + { + "code": "FINGERS", + "name": "Finger phalanges", + "hint": "Digits of the hand", + "aliases": [ + "finger bones", + "hand phalanges" + ] + }, + { + "code": "FEMUR", + "name": "Femur", + "hint": "Thigh", + "aliases": [ + "thighbone", + "thigh bone" + ] + }, + { + "code": "PATELLA", + "name": "Patella", + "hint": "Front of the knee", + "aliases": [ + "kneecap", + "knee cap" + ] + }, + { + "code": "TIBIA", + "name": "Tibia", + "hint": "Lower leg, inner side", + "aliases": [ + "shinbone", + "shin bone" + ] + }, + { + "code": "FIBULA", + "name": "Fibula", + "hint": "Lower leg, outer side", + "aliases": [ + "calf bone", + "calfbone" + ] + }, + { + "code": "TARSALS", + "name": "Tarsals", + "hint": "Rear foot and ankle", + "aliases": [ + "ankle bones", + "tarsal bones" + ] + }, + { + "code": "METATARSALS", + "name": "Metatarsals", + "hint": "Mid-foot behind the toes", + "aliases": [ + "metatarsal bones" + ] + }, + { + "code": "TOES", + "name": "Toe phalanges", + "hint": "Digits of the foot", + "aliases": [ + "toe bones", + "foot phalanges" + ] + } +] diff --git a/data/geometry-manifest.json b/data/geometry-manifest.json new file mode 100644 index 0000000..197ece4 --- /dev/null +++ b/data/geometry-manifest.json @@ -0,0 +1,676 @@ +{ + "schemaVersion": 1, + "source": { + "file": "assets/skeleton-source.svg", + "sha256": "501752c94533439a31521a929a10ad1dd1b781f588d44fc87144c426a38b8773", + "author": "Mariana Ruiz Villarreal (LadyofHats)", + "license": "Public domain dedication", + "page": "https://commons.wikimedia.org/wiki/File:Human_skeleton_front_en.svg" + }, + "coordinateRender": [ + 436, + 842 + ], + "overviewSourceBounds": [ + 59, + 20, + 405, + 822 + ], + "topics": [ + { + "id": 0, + "code": "CRANIUM", + "sourceElements": [ + "Cranium", + "g1297" + ] + }, + { + "id": 1, + "code": "MANDIBLE", + "sourceElements": [ + "Mandible" + ] + }, + { + "id": 2, + "code": "CLAVICLE", + "sourceElements": [ + "ClavicleLeft", + "ClavicleRight" + ] + }, + { + "id": 3, + "code": "SCAPULA", + "sourceElements": [ + "Scapula" + ] + }, + { + "id": 4, + "code": "STERNUM", + "sourceElements": [ + "Sternum", + "Manubrium" + ] + }, + { + "id": 5, + "code": "RIBS", + "sourceElements": [ + "g845", + "g1609" + ] + }, + { + "id": 6, + "code": "CERVICAL", + "sourceElements": [ + "CervicalVertebrae" + ] + }, + { + "id": 7, + "code": "THORACIC", + "sourceElements": [ + "ThoracicVertebrae" + ] + }, + { + "id": 8, + "code": "LUMBAR", + "sourceElements": [ + "LumbarVertebrae" + ] + }, + { + "id": 9, + "code": "SACRUM", + "sourceElements": [ + "Sacrum" + ] + }, + { + "id": 10, + "code": "COCCYX", + "sourceElements": [ + "Coccyx" + ] + }, + { + "id": 11, + "code": "PELVIS", + "sourceElements": [ + "PelvicGirdle", + "g447" + ] + }, + { + "id": 12, + "code": "HUMERUS", + "sourceElements": [ + "HumerusLeft", + "HumerusRight" + ] + }, + { + "id": 13, + "code": "RADIUS", + "sourceElements": [ + "RadiusLeft", + "RadiusRight" + ] + }, + { + "id": 14, + "code": "ULNA", + "sourceElements": [ + "UlnaLeft", + "UlnaRight" + ] + }, + { + "id": 15, + "code": "CARPALS", + "sourceElements": [ + "CarpalsLeft", + "CarpalsRight" + ] + }, + { + "id": 16, + "code": "METACARPALS", + "sourceElements": [ + "MetacarpalsLeft", + "MetacarpalsRight" + ] + }, + { + "id": 17, + "code": "FINGERS", + "sourceElements": [ + "PhalangesLeft", + "PhalangesRight" + ] + }, + { + "id": 18, + "code": "FEMUR", + "sourceElements": [ + "g3760", + "FemurLeft", + "path479", + "path481", + "path513", + "path499" + ] + }, + { + "id": 19, + "code": "PATELLA", + "sourceElements": [ + "PatellaLeft", + "PatellaRight" + ] + }, + { + "id": 20, + "code": "TIBIA", + "sourceElements": [ + "TibiaLeft", + "TibiaRight" + ] + }, + { + "id": 21, + "code": "FIBULA", + "sourceElements": [ + "FibulaLeft", + "FibulaRight" + ] + }, + { + "id": 22, + "code": "TARSALS", + "sourceElements": [ + "TarsalsLeft", + "TarsalsRight" + ] + }, + { + "id": 23, + "code": "METATARSALS", + "sourceElements": [ + "MetatarsalsLeft", + "MetatarsalsRight" + ] + }, + { + "id": 24, + "code": "TOES", + "sourceElements": [ + "PhalangesFootLeft", + "PhalangesFootRight" + ] + } + ], + "paintOrder": [ + 15, + 16, + 17, + 22, + 23, + 24, + 21, + 20, + 18, + 11, + 3, + 10, + 9, + 8, + 5, + 7, + 6, + 0, + 1, + 4, + 2, + 12, + 14, + 13, + 19 + ], + "facialRecesses": "Original source shading thresholds, eyes and nasal recess only", + "pairedSides": "Both sides use one bone-family identity; no left/right questions", + "views": [ + { + "id": 0, + "name": "overview", + "sourceBounds": [ + 59, + 20, + 405, + 822 + ], + "width": 64, + "height": 149, + "spanBytes": 2109, + "offsetBytes": 52, + "pixels": { + "CRANIUM": 134, + "MANDIBLE": 53, + "CLAVICLE": 50, + "SCAPULA": 89, + "STERNUM": 57, + "RIBS": 455, + "CERVICAL": 27, + "THORACIC": 35, + "LUMBAR": 80, + "SACRUM": 42, + "COCCYX": 3, + "PELVIS": 248, + "HUMERUS": 202, + "RADIUS": 103, + "ULNA": 83, + "CARPALS": 25, + "METACARPALS": 69, + "FINGERS": 98, + "FEMUR": 351, + "PATELLA": 39, + "TIBIA": 281, + "FIBULA": 100, + "TARSALS": 32, + "METATARSALS": 59, + "TOES": 55 + } + }, + { + "id": 1, + "name": "head", + "sourceBounds": [ + 163, + 17, + 243, + 154 + ], + "width": 38, + "height": 65, + "spanBytes": 444, + "offsetBytes": 52, + "pixels": { + "CRANIUM": 916, + "MANDIBLE": 281, + "CLAVICLE": 84, + "SCAPULA": 0, + "STERNUM": 0, + "RIBS": 37, + "CERVICAL": 166, + "THORACIC": 28, + "LUMBAR": 0, + "SACRUM": 0, + "COCCYX": 0, + "PELVIS": 0, + "HUMERUS": 0, + "RADIUS": 0, + "ULNA": 0, + "CARPALS": 0, + "METACARPALS": 0, + "FINGERS": 0, + "FEMUR": 0, + "PATELLA": 0, + "TIBIA": 0, + "FIBULA": 0, + "TARSALS": 0, + "METATARSALS": 0, + "TOES": 0 + } + }, + { + "id": 2, + "name": "hand", + "sourceBounds": [ + 313, + 397, + 410, + 500 + ], + "width": 61, + "height": 65, + "spanBytes": 588, + "offsetBytes": 52, + "pixels": { + "CRANIUM": 0, + "MANDIBLE": 0, + "CLAVICLE": 0, + "SCAPULA": 0, + "STERNUM": 0, + "RIBS": 0, + "CERVICAL": 0, + "THORACIC": 0, + "LUMBAR": 0, + "SACRUM": 0, + "COCCYX": 0, + "PELVIS": 0, + "HUMERUS": 0, + "RADIUS": 92, + "ULNA": 46, + "CARPALS": 134, + "METACARPALS": 305, + "FINGERS": 361, + "FEMUR": 0, + "PATELLA": 0, + "TIBIA": 0, + "FIBULA": 0, + "TARSALS": 0, + "METATARSALS": 0, + "TOES": 0 + } + }, + { + "id": 3, + "name": "foot", + "sourceBounds": [ + 199, + 747, + 275, + 825 + ], + "width": 63, + "height": 65, + "spanBytes": 495, + "offsetBytes": 52, + "pixels": { + "CRANIUM": 0, + "MANDIBLE": 0, + "CLAVICLE": 0, + "SCAPULA": 0, + "STERNUM": 0, + "RIBS": 0, + "CERVICAL": 0, + "THORACIC": 0, + "LUMBAR": 0, + "SACRUM": 0, + "COCCYX": 0, + "PELVIS": 0, + "HUMERUS": 0, + "RADIUS": 0, + "ULNA": 0, + "CARPALS": 0, + "METACARPALS": 0, + "FINGERS": 0, + "FEMUR": 0, + "PATELLA": 0, + "TIBIA": 297, + "FIBULA": 81, + "TARSALS": 376, + "METATARSALS": 571, + "TOES": 440 + } + }, + { + "id": 4, + "name": "spine", + "sourceBounds": [ + 169, + 274, + 235, + 400 + ], + "width": 34, + "height": 65, + "spanBytes": 621, + "offsetBytes": 52, + "pixels": { + "CRANIUM": 0, + "MANDIBLE": 0, + "CLAVICLE": 0, + "SCAPULA": 0, + "STERNUM": 0, + "RIBS": 143, + "CERVICAL": 0, + "THORACIC": 59, + "LUMBAR": 544, + "SACRUM": 315, + "COCCYX": 28, + "PELVIS": 429, + "HUMERUS": 0, + "RADIUS": 0, + "ULNA": 0, + "CARPALS": 0, + "METACARPALS": 0, + "FINGERS": 0, + "FEMUR": 0, + "PATELLA": 0, + "TIBIA": 0, + "FIBULA": 0, + "TARSALS": 0, + "METATARSALS": 0, + "TOES": 0 + } + }, + { + "id": 5, + "name": "chest", + "sourceBounds": [ + 107, + 132, + 300, + 308 + ], + "width": 68, + "height": 62, + "spanBytes": 1245, + "offsetBytes": 52, + "pixels": { + "CRANIUM": 0, + "MANDIBLE": 0, + "CLAVICLE": 158, + "SCAPULA": 326, + "STERNUM": 181, + "RIBS": 1573, + "CERVICAL": 67, + "THORACIC": 137, + "LUMBAR": 73, + "SACRUM": 0, + "COCCYX": 0, + "PELVIS": 0, + "HUMERUS": 269, + "RADIUS": 0, + "ULNA": 0, + "CARPALS": 0, + "METACARPALS": 0, + "FINGERS": 0, + "FEMUR": 0, + "PATELLA": 0, + "TIBIA": 0, + "FIBULA": 0, + "TARSALS": 0, + "METATARSALS": 0, + "TOES": 0 + } + } + ], + "geometryROMBytes": 5975, + "detailSelector": [ + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 5, + 4, + 4, + 4, + 4, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 3, + 3, + 3 + ], + "overviewBoxes": { + "CRANIUM": [ + 20, + 0, + 13, + 17 + ], + "MANDIBLE": [ + 20, + 11, + 13, + 9 + ], + "CLAVICLE": [ + 12, + 22, + 30, + 4 + ], + "SCAPULA": [ + 10, + 23, + 34, + 13 + ], + "STERNUM": [ + 24, + 25, + 6, + 17 + ], + "RIBS": [ + 14, + 23, + 26, + 30 + ], + "CERVICAL": [ + 23, + 19, + 8, + 5 + ], + "THORACIC": [ + 24, + 23, + 5, + 27 + ], + "LUMBAR": [ + 23, + 49, + 8, + 14 + ], + "SACRUM": [ + 21, + 60, + 10, + 8 + ], + "COCCYX": [ + 26, + 67, + 2, + 3 + ], + "PELVIS": [ + 13, + 56, + 27, + 18 + ], + "HUMERUS": [ + 1, + 27, + 49, + 27 + ], + "RADIUS": [ + 1, + 52, + 55, + 22 + ], + "ULNA": [ + 1, + 53, + 51, + 21 + ], + "CARPALS": [ + 1, + 72, + 56, + 4 + ], + "METACARPALS": [ + 0, + 73, + 60, + 8 + ], + "FINGERS": [ + 0, + 73, + 64, + 16 + ], + "FEMUR": [ + 11, + 67, + 30, + 40 + ], + "PATELLA": [ + 18, + 104, + 16, + 5 + ], + "TIBIA": [ + 17, + 106, + 18, + 33 + ], + "FIBULA": [ + 17, + 109, + 18, + 29 + ], + "TARSALS": [ + 19, + 138, + 14, + 5 + ], + "METATARSALS": [ + 16, + 140, + 20, + 5 + ], + "TOES": [ + 13, + 143, + 26, + 6 + ] + } +} diff --git a/docs/ANATOMY.md b/docs/ANATOMY.md new file mode 100644 index 0000000..2dc9685 --- /dev/null +++ b/docs/ANATOMY.md @@ -0,0 +1,70 @@ +# Bone Quest anatomy bank + +The quiz identifies **25 major bones or bone groups** in the supplied anterior +skeleton illustration. It does not ask separately about every individual bone +in the adult skeleton. Left and right counterparts share one topic. Vertebrae +are grouped by region; the bones of each wrist, palm, hand digits, rear foot, +mid-foot and toes are also grouped. + +`data/bones.json` is the canonical ordered bank. `src/bones.c` contains three +runtime fields: displayed name, short location hint, and pipe-separated accepted +aliases. Stable codes remain in JSON; fixed topic order binds artwork, history +and questions. `tools/prepare_questions.py` regenerates the C table. Names are at +most 22 characters and hints at most 30 characters. + +## Naming choices + +- **Cranium** follows the illustration's labeled grouping above the separately + drawn mandible. **Skull** is accepted as the familiar introductory term. This + is not a quiz distinguishing all cranial and facial bones. The skull includes + the mandible in complete anatomical descriptions; the game treats the lower + jaw as its own highlighted topic. +- **Pelvic girdle** means the paired hip bones here. The sacrum and coccyx are + separate topics. Bare **pelvis** is deliberately not an accepted alias because + the complete bony pelvis includes those additional bones. +- **Finger phalanges** includes the thumb. **Toe phalanges** is a separate topic. + Bare **phalanges** is not accepted for either because it cannot distinguish + the hand from the foot. **Finger bones / hand phalanges** and **toe bones / + foot phalanges** are accepted respectively. +- **Radius** and **ulna** are distinguished using the anatomical position: the + radius lies on the thumb side and the ulna on the little-finger side. + **Tibia** and **fibula** use the inner and outer sides of the lower leg. +- **Sternum** is the whole breastbone topic, including its manubrium portion; + the manubrium is not a second overlapping answer. +- Common names such as collarbone, shoulder blade, breastbone, kneecap, + thighbone, shinbone and tailbone are accepted. A location hint is not + automatically an accepted answer. Names of body regions such as **forearm** + or **foot bones** are too broad to identify one highlighted topic. + +Canonical names and aliases are unique after lowercasing and collapsing spaces. +Case and extra-space handling belongs to the shared quiz normalization; this +bank supplies no ambiguous duplicate alias. The data contains no treatment, +injury or diagnostic questions. + +## Primary references checked + +The following OpenStax *Anatomy and Physiology 2e* sections were consulted to +verify names, group boundaries and location facts on November 11, 2026: + +- [The skull](https://openstax.org/books/anatomy-and-physiology-2e/pages/7-2-the-skull) +- [The vertebral column](https://openstax.org/books/anatomy-and-physiology-2e/pages/7-3-the-vertebral-column) +- [The thoracic cage](https://openstax.org/books/anatomy-and-physiology-2e/pages/7-4-the-thoracic-cage) +- [The pectoral girdle](https://openstax.org/books/anatomy-and-physiology-2e/pages/8-1-the-pectoral-girdle) +- [Bones of the upper limb](https://openstax.org/books/anatomy-and-physiology-2e/pages/8-2-bones-of-the-upper-limb) +- [The pelvic girdle and pelvis](https://openstax.org/books/anatomy-and-physiology-2e/pages/8-3-the-pelvic-girdle-and-pelvis) +- [Bones of the lower limb](https://openstax.org/books/anatomy-and-physiology-2e/pages/8-4-bones-of-the-lower-limb) + +These are factual verification references. No textbook passages, assessments or +artwork are imported into the game. The concise location hints are written for +this quiz; they are not quotations from the textbook. + +## Diagram provenance + +The visual reference is [Human skeleton front en.svg](https://commons.wikimedia.org/wiki/File:Human_skeleton_front_en.svg) +by **Mariana Ruiz Villarreal (LadyofHats)**. The author released it into the +public domain. The original Wikimedia description distinguishes labels for +individual bones from labels for groups. Bone Quest uses its selected group +names while keeping a single stable topic for paired counterparts. The retained +source SVG and source-receipt.json belong to the artwork workflow; generated +geometry and any simplifications must preserve this attribution and explain +what was adapted. diff --git a/docs/IMPLEMENTATION.md b/docs/IMPLEMENTATION.md new file mode 100644 index 0000000..1e7dfb6 --- /dev/null +++ b/docs/IMPLEMENTATION.md @@ -0,0 +1,18 @@ +# Bone Quest implementation + +Working checklist: + +- [x] Create private VCCPlusApps/BoneQuest repository and separate main checkout. +- [x] Adapt the supplied public-domain SVG into compact per-topic graphics. +- [x] Verify25 major bones/bone groups and accepted answer aliases. +- [x] Implement anatomy-specific layout, two modes, feedback/review/replay. +- [x] Build with stock VCC Plus tools and create BONEQ.DSK. +- [x] Run host/geometry and isolated6809/6309 gameplay checks. +- [x] Retain representative real screenshots and usable build/play instructions. + +Foundation: Capital Quest, revision afa6f3c2a05cbd71c1f22ec3506f4f63421b2bc6, +GPL-3.0-or-later. Its geography assets/manuals are not used by Bone Quest. +Skeleton: Mariana Ruiz Villarreal (LadyofHats), Wikimedia Human_skeleton_front_en.svg, +author's public-domain dedication; original retained under assets/ with hash receipt. +The quiz covers named major bones and groups shown in the diagram, not 206 +individually selectable bones. Paired left/right examples share one question. diff --git a/docs/SCREENSHOTS.json b/docs/SCREENSHOTS.json new file mode 100644 index 0000000..d228469 --- /dev/null +++ b/docs/SCREENSHOTS.json @@ -0,0 +1,54 @@ +[ + { + "file": "docs/images/title.png", + "width": 640, + "height": 480, + "sha256": "c760e20e70c3063f2938acad87c80979ef8f795ff981bfa3eacb6fff5b3db9f3", + "emulator": "VCC Plus 3.6.1 (54)", + "processor": "MC6809", + "ramKB": 512, + "video": "RGB", + "diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66", + "capture": "Unmodified guest frame from isolated keyboard-driven playtest", + "note": "Scripted validation includes deliberate incorrect answers." + }, + { + "file": "docs/images/multiple-choice.png", + "width": 640, + "height": 480, + "sha256": "a0f272e2e0355260e27bfef6b5021e4cb984e054eac9e39a0f910f05af66e3c5", + "emulator": "VCC Plus 3.6.1 (54)", + "processor": "MC6809", + "ramKB": 512, + "video": "RGB", + "diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66", + "capture": "Unmodified guest frame from isolated keyboard-driven playtest", + "note": "Scripted validation includes deliberate incorrect answers." + }, + { + "file": "docs/images/typed-answer.png", + "width": 640, + "height": 480, + "sha256": "f44cd5b9493a2b4704532f444f4666b536db375e4b7a6338683bcade9246444d", + "emulator": "VCC Plus 3.6.1 (54)", + "processor": "MC6809", + "ramKB": 512, + "video": "RGB", + "diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66", + "capture": "Unmodified guest frame from isolated keyboard-driven playtest", + "note": "Scripted validation includes deliberate incorrect answers." + }, + { + "file": "docs/images/results.png", + "width": 640, + "height": 480, + "sha256": "81839f1acdf3511d62c52fc6fdc53df138a5b86048563628b450df6ffe7c6297", + "emulator": "VCC Plus 3.6.1 (54)", + "processor": "MC6809", + "ramKB": 512, + "video": "RGB", + "diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66", + "capture": "Unmodified guest frame from isolated keyboard-driven playtest", + "note": "Scripted validation includes deliberate incorrect answers." + } +] diff --git a/docs/TESTING.md b/docs/TESTING.md new file mode 100644 index 0000000..d2d57b8 --- /dev/null +++ b/docs/TESTING.md @@ -0,0 +1,64 @@ +# Initial Bone Quest verification — November 11, 2026 + +## Built and delivered + +The root BONEQ.DSK is a standard 35-track DECB image, 161,280 bytes, SHA-256: + +`cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66` + +Built with installed VCC Plus 3.6.1 (54), bundled CMOC 0.1.100 and LWTools 4.25. +Release, Debug and Test disk builds passed. Program/static storage ends at +$764E (Release),$7687 (Debug),$7653 (Test), below the $7800 limit and separate +2 KB stack reservation. Two graphics pages retain the public GIME512 KB contract. +Generated skeleton geometry occupies 5,975 bytes; ordinary builds do not run an +SVG renderer or need Python/Pillow/rsvg-convert. + +## Logic and artwork + +make test passed: 50,000 option sets across 2,000 games, all 25 topics once per game, +four distinct choices, no consecutive repeated correct slot, all permitted +slot transitions, replay reset, canonical names/common aliases, known-wrong +name/alias priority, spelling checks, scoring and duplicate-answer guards. +All 25 authoring topics/aliases agree exactly with generated C. The original SVG +hash matches its receipt. Six geometry views have bounded, disjoint spans; +each topic has nonempty overview coverage, with detailed small-bone views. + +## Feedback audio + +Separate bounded correct/incorrect feedback captures contained nonzero 44.1 kHz +stereo PCM (peak 16128). Capture began at the actual feedback phase, before the +tones; no microphone or host audio device was used. This establishes generated +guest signal, not audible listening or comprehensive frequency analysis. + +## Actual gameplay + +The actual Release disk completed a 25-question multiple-choice game AND a +25-question typed game on each emulated MC6809 and HD6309, with512 KB RAM, +CoCo 3 BASIC, FD-502 Disk BASIC and RGB video. Tests used isolated app-owned +machines and disposable disk copies; no personal emulator or desktop input +was controlled. + +The driver decoded displayed text against the matching linked font and checked +the skeleton's actual pixels against the topic masks and answer history. It +verified question numbers, readable choices, current highlighting, purple/red +progress, no consecutive correct-slot repeats, held-key protection, deliberate +wrong answers, common aliases, case/spacing, spelling retry and Backspace, +33-character entry bounds, reveal, scores 20/25 (80%), one correction, paged +review, neutral replay title and clean return to BASIC. Both runs preserved the +disk hash and reported zero guest writes. + +To repeat these developer checks, provide your own ROM paths explicitly: + +```sh +python3 tests/playtest.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom +``` + +The harness uses the installed app's isolated helper and is qualified against +the build identified above; it is not a general alternate MCP server. Private +ROMs, raw captures, result JSON and build outputs stay ignored under test-output/. +Selected unchanged guest frames are retained in docs/images/ and identified by +docs/SCREENSHOTS.json. They are actual game frames, not native-window marketing +captures or mockups. + +No physical CoCo, host Intel, macOS 14 or audible listening qualification is +claimed. Native editor/source-open UI is not exercised by the headless tests. diff --git a/docs/images/multiple-choice.png b/docs/images/multiple-choice.png new file mode 100644 index 0000000..05a5d73 Binary files /dev/null and b/docs/images/multiple-choice.png differ diff --git a/docs/images/results.png b/docs/images/results.png new file mode 100644 index 0000000..f13b808 Binary files /dev/null and b/docs/images/results.png differ diff --git a/docs/images/title.png b/docs/images/title.png new file mode 100644 index 0000000..1720e65 Binary files /dev/null and b/docs/images/title.png differ diff --git a/docs/images/typed-answer.png b/docs/images/typed-answer.png new file mode 100644 index 0000000..0f70ec0 Binary files /dev/null and b/docs/images/typed-answer.png differ diff --git a/main.c b/main.c new file mode 100644 index 0000000..efe496f --- /dev/null +++ b/main.c @@ -0,0 +1,159 @@ +/* Bone Quest — based on Brian Holman's GPL-3.0-or-later Capital Quest. */ +#include +#include +#include +#include "quiz.h" +#include "ui.h" +static char line[54],answer[ANSWER_SIZE]; +static U8 mode,spelling_attempt; +U8 phase,current_bone; +static void present(void) +{ + if(!gime_present()){gime_close();setHighSpeed(FALSE);printf("Graphics timer stopped.\n");exit(1);} +} +static U8 choose(const char *allowed) +{ + U8 c;release_keys(); + do{c=next_key();if(c>='a' && c<='z')c-='a'-'A';}while(!strchr(allowed,c)); + return c; +} +static void credits(void) +{ + phase=5;frame("CREDITS"); + text(8,21,"A JOURNEY THROUGH THE SKELETON",6); + text(8,42,"Skeleton: Mariana Ruiz Villarreal",7); + text(8,54,"(LadyofHats), public-domain artwork.",2); + text(8,70,"Wikimedia Commons:",7); + text(8,82,"Human_skeleton_front_en.svg",2); + text(8,99,"Adapted: labels removed, reduced, recolored;",7); + text(8,110,"bone masks and enlarged details prepared.",7); + text(8,129,"Font / boot: Pierre Sarrazin, public domain.",2); + text(8,143,"Based on Capital Quest by Brian Holman.",7); + text(8,155,"Game GPL-3.0-or-later. See assets/CREDITS.md",2); + text(8,180,"SPACE: back",6);present();choose(" "); +} +static U8 title(void) +{ + U8 c; + do{ + phase=0;frame("HUMAN ANATOMY");show_skeleton(255,0); + text(112,35,"25 BONES + GROUPS",6); + text(112,54,"1 MULTIPLE CHOICE",7); + text(112,75,"2 TYPE THE NAME",7); + text(112,101,"C CREDITS",2);text(112,117,"Q QUIT TO BASIC",2); + text(112,143,"Find the yellow bone.",7); + text(112,155,"Learn from each answer.",2); + text(112,169,"512 KB COCO 3 / RGB",6); + text(8,183,"Release keys between presses. Choose 1 or 2.",2); + present();c=choose("12CQ");if(c=='C')credits(); + }while(c=='C'); + return c; +} +static void question_screen(void) +{ + phase=1;frame(mode==1?"MULTIPLE CHOICE":"TYPE THE NAME"); + sprintf(line,"Question %u/%u Score %u",(unsigned)question+1,BONE_COUNT,(unsigned)score);text(8,19,line,7); + show_skeleton(current_bone,1); + text(112,106,"Name the yellow bone(s).",6); + text(112,118,bones[current_bone].hint,2); + text(8,183,"Teal:new Purple:right Red:miss Yellow:now",2); +} +static U8 multiple_choice(void) +{ + U8 i,c;quiz_options(current_bone);question_screen(); + for(i=0;i<4;++i){sprintf(line,"%u %s",(unsigned)i+1,bones[options[i]].name);text(112,132+i*11,line,7);} + present();c=choose("1234")-'1';strcpy(answer,bones[options[c]].name); + return options[c]==current_bone; +} +static void input_screen(U8 too_long) +{ + gime_fill_rect(108,129,212,48,1);text(112,132,answer,7); + text(112+strlen(answer)*6,132,"_",6); + text(112,146,too_long?"Use Backspace to edit.":"Enter:submit Esc:reveal",2); + text(112,159,"Backspace edits the name.",2); + text(112,171,"Case / spaces ignored.",2);present(); +} +static void input_edit(U8 old_n,U8 new_n) +{ + U8 p,first=old_n='a' && c<='z')||(c>='A' && c<='Z')||c==' '||c=='.'||c=='-'){ + /* 33 visible characters fit beside the full-body overview. */ + if(n<33){old_n=n;answer[n++]=c;answer[n]=0;input_edit(old_n,n);} + else{input_screen(1);input_screen(1);} + } + } +} +static void answer_sound(U8 right) +{ + setHighSpeed(FALSE);if(right){sound(170,2);sound(210,3);}else{sound(100,3);sound(60,4);}setHighSpeed(TRUE); +} +static void feedback(U8 right) +{ + question_screen();phase=3; + text(112,134,right?"CORRECT!":"NOT THIS TIME.",right?6:5); + text(112,147,bones[current_bone].name,7); + text(112,162,mode==1?"Next follows automatically.":"SPACE: next question",2); + present();answer_sound(right);if(mode==1)delay(90);else choose(" "); +} +static U8 results(void) +{ + U8 c,i,page,start,missed=BONE_COUNT-score; + for(;;){ + phase=4;frame("YOUR RESULTS");show_skeleton(255,1); + text(112,35,"SKELETON COMPLETE",6); + sprintf(line,"%u / %u correct %u%%",(unsigned)score,BONE_COUNT,(unsigned)score*100/BONE_COUNT);text(112,55,line,7); + sprintf(line,"%u spelling corrections",(unsigned)corrections);text(112,77,line,2); + sprintf(line,"%u topics to revisit",(unsigned)missed);text(112,93,line,7); + text(112,118,"R REVIEW MISSED BONES",6);text(112,138,"P PLAY AGAIN",7);text(112,158,"Q QUIT TO BASIC",7); + text(8,183,"Every topic once. Keep learning!",2);present();c=choose("RPQ");if(c!='R')return c; + page=0;start=0; + for(;;){ + phase=6;frame("MISSED BONES");sprintf(line,"Review page %u",(unsigned)page+1);text(8,19,line,6);i=start;c=0; + while(i +#else +#include +#endif +U8 order[BONE_COUNT], options[4], question, score, corrections; +U8 answered[BONE_COUNT], correct[BONE_COUNT], corrected[BONE_COUNT]; +char responses[BONE_COUNT][ANSWER_SIZE]; +unsigned random_state; +static U8 distance_rows[3][ANSWER_SIZE]; +static U8 previous_correct_slot=4; +unsigned quiz_random(unsigned bound) +{ + unsigned x, limit; + limit = 65535u - (65535u % bound); + do { + x = random_state; + x ^= x << 7; x &= 65535u; + x ^= x >> 9; + x ^= x << 8; x &= 65535u; + random_state = x; + --x; + } while (x >= limit); + return x % bound; +} +void quiz_start(unsigned seed) +{ + U8 i,j,t; + random_state = seed ? seed : 0xACE1; + question=score=corrections=0; + previous_correct_slot=4; + memset(answered,0,sizeof(answered)); + memset(correct,0,sizeof(correct)); + memset(corrected,0,sizeof(corrected)); + memset(responses,0,sizeof(responses)); + for(i=0;i0;--i) { + j=(U8)quiz_random(i+1);t=order[i];order[i]=order[j];order[j]=t; + } +} +void quiz_options(U8 state) +{ + U8 i,j,c,t,slot; + /* First question: all four slots. Later: equally choose the other three. */ + slot=(U8)quiz_random(previous_correct_slot<4?3:4); + if(previous_correct_slot<4 && slot>=previous_correct_slot) ++slot; + options[0]=state; + for(i=1;i<4;++i) { + do { + c=(U8)quiz_random(BONE_COUNT); + for(j=0;j1;--i) { + j=1+(U8)quiz_random(i);t=options[i];options[i]=options[j];options[j]=t; + } + t=options[slot];options[slot]=state;options[0]=t; + previous_correct_slot=slot; +} +void normalize(const char *in,char *out) +{ + U8 n=0,space=0,c; + while((c=(U8)*in++)!=0 && n='A' && c<='Z') c += 'a'-'A'; + if(n1 && j>1 && a[i-1]==b[j-2] && a[i-2]==b[j-1]) { + d=older[j-2]+1;if(d=9?2:1)?1:0; +} + +void quiz_record(U8 state,const char *answer,U8 right,U8 spelling) +{ + if(answered[state]) return; + answered[state]=1;correct[state]=right;corrected[state]=right && spelling; + strncpy(responses[state],answer,ANSWER_SIZE-1);responses[state][ANSWER_SIZE-1]=0; + if(right) ++score; + if(right && spelling) ++corrections; +} diff --git a/src/ui.c b/src/ui.c new file mode 100644 index 0000000..80aa70c --- /dev/null +++ b/src/ui.c @@ -0,0 +1,74 @@ +/* Bone Quest display/input, adapted from Capital Quest. GPL-3.0-or-later. */ +#include +#include +#include +#include +#include +#include "ui.h" +#include "map_data.h" +static Keyboard keyboard; +static U8 initialized; +unsigned entropy=0xB41D; +void text(unsigned x,unsigned y,const char *s,U8 color) +{ + U8 c,row,col,bits;unsigned left=x; + while((c=(U8)*s++)!=0){ + if(c=='\n'){y+=9;x=left;continue;}if(c<32||c>126)c='?'; + for(row=0;row<8;++row){bits=font5x8[(unsigned)(c-32)*8+row];for(col=0;col<5;++col)if(!(bits&(128>>col)))gime_plot(x+col,y+row,color);} + x+=6; + } +} +void frame(const char *label) +{ + gime_clear(0);gime_fill_rect(0,0,320,13,1);text(8,3,"BONE QUEST",7);text(176,3,label,7);gime_fill_rect(8,29,304,1,2); +} +static void draw_view(U8 view,U8 current,U8 progress,unsigned ox,unsigned oy,U8 scale,U8 cx,U8 cy,U8 cw,U8 ch) +{ + const U8 *data=bone_view_spans[view];const unsigned *off=bone_view_offsets[view]; + U8 b,y,x,n,col;unsigned i,end,left,right; + for(b=0;b=cy+ch)continue; + left=x>cx?x:cx;right=x+n;if(right>cx+cw)right=cx+cw;if(left>=right)continue; + gime_fill_rect(ox+(left-cx)*scale,oy+(unsigned)(y-cy)*scale,(right-left)*scale,scale,col); + } + } +} +void show_skeleton(U8 current,U8 progress) +{ + U8 view,x,y,w,h,scale; + draw_view(0,current,progress,4+(100-bone_view_widths[0])/2,30,1,0,0,bone_view_widths[0],bone_view_heights[0]); + if(current>=BONE_COUNT)return; + gime_fill_rect(108,30,212,73,1);view=bone_detail_view[current]; + if(view){ + w=bone_view_widths[view];h=bone_view_heights[view]; + draw_view(view,current,progress,112+(200-w)/2,34+(65-h)/2,1,0,0,w,h); + }else{ + x=bone_boxes[current][0];y=bone_boxes[current][1];w=bone_boxes[current][2];h=bone_boxes[current][3]; + if(x>2){x-=2;w+=2;}else{x=0;} + if(y>2){y-=2;h+=2;}else{y=0;} + w+=2;h+=2;if(x+w>bone_view_widths[0])w=bone_view_widths[0]-x;if(y+h>bone_view_heights[0])h=bone_view_heights[0]-y; + scale=65/h;if(!scale)scale=1;if(scale>4)scale=4;if(w*scale>200)scale=200/w; + draw_view(0,current,progress,112+(200-w*scale)/2,34+(65-h*scale)/2,scale,x,y,w,h); + } +} +static U8 any_key(void) +{ + return isKeyPressed(0,0x3F)||isKeyPressed(KEY_PROBE_ENTER,KEY_BIT_ENTER)||isKeyPressed(KEY_PROBE_BREAK,KEY_BIT_BREAK)||isKeyPressed(KEY_PROBE_CLEAR,KEY_BIT_CLEAR); +} +void release_keys(void) +{ + unsigned since;if(!initialized){Keyboard_init(&keyboard);initialized=1;}since=getTimer(); + do{Keyboard_poll(&keyboard);if(any_key())since=getTimer();}while((unsigned)(getTimer()-since)<2); +} +U8 next_key(void) +{ + U8 c;if(!initialized){Keyboard_init(&keyboard);initialized=1;} + do{entropy=(entropy<<1)^(entropy>>15)^getTimer()^0x1021;c=Keyboard_poll(&keyboard);}while(!c); + entropy^=(unsigned)c<<8;return c; +} +void close_input(void) +{ + if(initialized){Keyboard_shutdown(&keyboard);initialized=0;} +} diff --git a/tests/check_assets.py b/tests/check_assets.py new file mode 100644 index 0000000..41074e9 --- /dev/null +++ b/tests/check_assets.py @@ -0,0 +1,25 @@ +"""Validate exact generated anatomy/data and compact rendering ownership.""" +import hashlib,json,re,runpy +from pathlib import Path +ROOT=Path(__file__).resolve().parents[1] +module=runpy.run_path(str(ROOT/'tools/prepare_questions.py'));assert module['generated']()==(ROOT/'src/bones.c').read_text() +receipt=json.loads((ROOT/'assets/source-receipt.json').read_text());assert hashlib.sha256((ROOT/'assets/skeleton-source.svg').read_bytes()).hexdigest()==receipt['sha256'] +source=(ROOT/'src/map_data.c').read_text();manifest=json.loads((ROOT/'data/geometry-manifest.json').read_text()) +# Parse every span/offset pair independently of the conversion dependency stack. +arrays={name:[int(v) for v in re.findall(r'\d+',body)] for name,body in re.findall(r'(?:unsigned char|unsigned)\s+(\w+)\s*\[[^]]*\]\s*=\s*\{([^{}]*)\}',source)} +view_names=re.search(r'bone_view_spans\[[^]]*\]\s*=\s*\{([^}]+)\}',source)[1] +view_names=re.findall(r'[A-Za-z_]\w*',view_names) +widths=arrays['bone_view_widths'];heights=arrays['bone_view_heights'];assert len(view_names)==len(widths)==len(heights)==6 +pairs=[] +for name,data in arrays.items(): + if name.endswith('_spans'): + view=view_names.index(name);off=arrays.get(name[:-6]+'_offsets');assert off is not None,(name,'offsets missing');assert len(off)==26 and off[0]==0 and off[-1]==len(data);occupied=set() + for bone in range(25): + assert off[bone]%3==off[bone+1]%3==0 + if name=='bone_spans':assert off[bone+1]>off[bone],bone + for k in range(off[bone],off[bone+1],3): + y,x,n=data[k:k+3];assert n>0 and 0<=yIIBBBBB',v) + if kind==b'IDAT':data+=v + assert depth==8 and ct in (2,6) + ch=3 if ct==2 else 4;stride=w*ch;raw=zlib.decompress(data);prior=bytearray(stride);rows=[];p=0 + for _ in range(h): + f=raw[p];p+=1;row=bytearray(raw[p:p+stride]);p+=stride + for i in range(stride): + a=row[i-ch] if i>=ch else 0;b=prior[i];c=prior[i-ch] if i>=ch else 0 + if f==1:pred=a + elif f==2:pred=b + elif f==3:pred=(a+b)//2 + elif f==4: + v=a+b-c;pa=abs(v-a);pb=abs(v-b);pc=abs(v-c);pred=a if pa<=pb and pa<=pc else b if pb<=pc else c + else:pred=0 + row[i]=(row[i]+pred)&255 + rows.append(row);prior=row + return w,h,ch,rows + +class Screen: + def __init__(self,path,font):self.w,self.h,self.ch,self.rows=png(path);self.font=font + def guest(self,x,y):return tuple(self.rows[50+y*2][x*2*self.ch:x*2*self.ch+3]) + def text(self,x,y,n): + bg=self.guest(x+5,y);out='' + for j in range(n): + bits=[self.guest(x+j*6+c,y+r)!=bg for r in range(8) for c in range(5)] + scores=[] + for k in range(32,127): + expected=[not(self.font[(k-32)*8+r]&(128>>c)) for r in range(8) for c in range(5)] + scores.append((sum(a!=b for a,b in zip(bits,expected)),k)) + d,k=min(scores);out+=chr(k) if d==0 else '?' + return out.rstrip() + +def main(): + p=argparse.ArgumentParser(description=__doc__) + p.add_argument('--app',type=Path,default=Path('/Applications/VCC Plus.app')) + p.add_argument('--rom',type=Path,required=True);p.add_argument('--disk-rom',type=Path,required=True) + p.add_argument('--evidence',type=Path,default=ROOT/'test-output/playtest') + p.add_argument('--cpu',choices=['6809','6309','both'],default='both');args=p.parse_args();out=args.evidence.resolve();out.mkdir(parents=True,exist_ok=True) + rows=json.loads((ROOT/'data/bones.json').read_text());binary=ROOT/'build/BONEQ.bin';disk=ROOT/'build/BONEQ.dsk';sha=hashlib.sha256(disk.read_bytes()).hexdigest() + mp=binary.with_suffix('.map').read_text();symbols={n:int(a,16) for n,a in re.findall(r'Symbol: _(\w+) .*?= ([0-9A-Fa-f]+)',mp)} + blob=binary.read_bytes();memory={};i=0 + while iHH',blob[i+1:i+5]);i+=5 + if kind==255:break + memory.update((a+j,b) for j,b in enumerate(blob[i:i+n]));i+=n + font=bytes(memory[symbols['font5x8']+i] for i in range(768)) + src=(ROOT/'src/map_data.c').read_text();arrays={name:[int(v) for v in re.findall(r'\d+',body)] for name,body in re.findall(r'(?:unsigned char|unsigned)\s+(\w+)\s*\[[^]]*\]\s*=\s*\{([^{}]*)\}',src)} + spans=arrays['bone_spans'];offsets=arrays['bone_offsets'];colors={3:(85,170,170),4:(85,85,170),5:(255,85,85),6:(255,255,0)} + b64=lambda path:base64.b64encode(path.read_bytes()).decode();reports=[] + for cpu in (('6809','6309') if args.cpu=='both' else (args.cpu,)): + proc=subprocess.Popen([str(args.app/'Contents/Helpers/vcc-playtest')],stdin=subprocess.PIPE,stdout=subprocess.PIPE,text=True) + def call(op,**kw): + proc.stdin.write(json.dumps(dict(op=op,**kw))+'\n');proc.stdin.flush();r=json.loads(proc.stdout.readline());assert 'error' not in r,r;return r['result'] + def read(name,n=1):return call('read_memory',address=symbols[name],count=n)['bytes'] + def step(n=600):return call('input',steps=[dict(mask=0,fields=n)]) + def press(mask,settle=600,hold=8):return call('input',steps=[dict(mask=mask,fields=hold),dict(mask=0,fields=settle)]) + def key(bit,settle=600,hold=8):return press(1<1000 + def sound(name): + r=call('audio_capture',fields=120);wav=base64.b64decode(r['audio_wav_base64']);(out/(cpu+'-'+name+'.wav')).write_bytes(wav) + assert any(wav[44:]),'No guest audio samples' + call('init',system_rom=b64(args.rom),disk_rom=b64(args.disk_rom),disk=b64(disk),cpu=cpu,boot_keys=[1< +#include +#include +#include "quiz.h" +static void aliases(U8 bone,U8 target) +{ + const char *p=bones[bone].aliases;char word[ANSWER_SIZE];unsigned n; + while(*p){n=0;while(*p && *p!='|'){assert(n10000);for(j=0;j<4;++j)assert(i==j?transitions[i][j]==0:transitions[i][j]>3000);} + for(seed=1;seed<=32;++seed){quiz_start(seed);quiz_options(order[0]);memcpy(first,options,4);for(i=1;i='a' && name[j]<='z')name[j]-=32; + assert(classify(i,name)==2);aliases(i,i); + for(j=0;j +// This file is in the public domain. +// +// Reference: Roger Schrag, "A Special Use For The DOS Command", +// The Rainbow, November 1984, p.140. +// +// To compile: cmoc --dos autostart.c +// To install on CoCo disk image: install-coco-boot-loader some-image.dsk autostart.bin +// To run on CoCo: type DOS and to automatically run *.BAS. +// +// Version history: +// 0.1.0 2016-01-16 Use of legacy.h discontinued. +// 0.1.1 2018-04-03 Adapted to CMOC 0.1.51 (const). +// 0.1.2 2018-08-04 Basic line now forced to be uppercase. + +#include + +#define ENDFLG 0x00 // STOP/END FLAG: POSITIVE=STOP, NEG=END +#define CINBFL 0x70 // CONSOLE IN BUFFER FLAG: 00=NOT EMPTY, $FF=EMPTY +#define RVEC4 0x016a // RAM hook: CONSOLE IN + + +byte oldHookInstr; +word oldHookAddr; +const char *basicLineReader; + + +void feedKeyboard() +{ + word preservedX; + asm("stx", preservedX); + + * (byte *) CINBFL = 0; // console in buffer now not empty + + char nextBasicByte = (char) toupper(*basicLineReader); + ++basicLineReader; + if (nextBasicByte == 0) // if finished returning Basic line + { + * (byte *) RVEC4 = oldHookInstr; + * (word *) (RVEC4 + 1) = oldHookAddr; + nextBasicByte = '\r'; // return "Enter" to cause execution of Basic line + } + + asm { + lda nextBasicByte + ldx preservedX + tfr u,s // discard stack frame + leas 4,s // discard previous stack frame ptr and return addr + rts // return to caller of CONSOLE IN + } +} + + +int main() +{ + * (byte *) ENDFLG = - * (byte *) ENDFLG; // why? + + basicLineReader = + #ifndef COMMAND + "LOADM\"BONEQ.BIN\":EXEC" + #else + COMMAND + #endif + ; + + // Install function feedKeyboard() as CONSOLE IN routine. + // + oldHookInstr = * (byte *) RVEC4; + oldHookAddr = * (word *) (RVEC4 + 1); + + * (byte *) RVEC4 = 0x7e; // JMP instruction + * (void **) (RVEC4 + 1) = (void *) feedKeyboard; + + * (word *) 0x2600 = 0; // overwrite "OS" marker with two null bytes + + asm("jmp", "$ac7c"); // go interpret a Basic line (which is read from console) + + return 0; // avoids compiler error +} diff --git a/tools/prepare_assets.py b/tools/prepare_assets.py new file mode 100644 index 0000000..80479c3 --- /dev/null +++ b/tools/prepare_assets.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +"""Prepare Bone Quest's compact masks from the retained public-domain SVG. + +Optional authoring dependencies: Python 3, Pillow and rsvg-convert. Normal game +builds use the generated C files and do not run this converter. The SVG remains +unchanged; labels/background are omitted and source bone silhouettes are reduced +into a 25-owner pixel mask. All coordinates below refer to a 436x842 render of the +source's nominal 435.687x841.89 viewBox. No SVG is parsed on the CoCo. +""" +import argparse +import copy +import hashlib +import io +import json +from pathlib import Path +import shutil +import subprocess +import xml.etree.ElementTree as ET +from PIL import Image, ImageChops + +ROOT = Path(__file__).resolve().parents[1] +TOPICS = [ + ('CRANIUM', ['Cranium', 'g1297']), + ('MANDIBLE', ['Mandible']), + ('CLAVICLE', ['ClavicleLeft', 'ClavicleRight']), + ('SCAPULA', ['Scapula']), + ('STERNUM', ['Sternum', 'Manubrium']), + ('RIBS', ['g845', 'g1609']), + ('CERVICAL', ['CervicalVertebrae']), + ('THORACIC', ['ThoracicVertebrae']), + ('LUMBAR', ['LumbarVertebrae']), + ('SACRUM', ['Sacrum']), + ('COCCYX', ['Coccyx']), + ('PELVIS', ['PelvicGirdle', 'g447']), + ('HUMERUS', ['HumerusLeft', 'HumerusRight']), + ('RADIUS', ['RadiusLeft', 'RadiusRight']), + ('ULNA', ['UlnaLeft', 'UlnaRight']), + ('CARPALS', ['CarpalsLeft', 'CarpalsRight']), + ('METACARPALS', ['MetacarpalsLeft', 'MetacarpalsRight']), + ('FINGERS', ['PhalangesLeft', 'PhalangesRight']), + ('FEMUR', ['g3760', 'FemurLeft', 'path479', 'path481', 'path513', 'path499']), + ('PATELLA', ['PatellaLeft', 'PatellaRight']), + ('TIBIA', ['TibiaLeft', 'TibiaRight']), + ('FIBULA', ['FibulaLeft', 'FibulaRight']), + ('TARSALS', ['TarsalsLeft', 'TarsalsRight']), + ('METATARSALS', ['MetatarsalsLeft', 'MetatarsalsRight']), + ('TOES', ['PhalangesFootLeft', 'PhalangesFootRight']), +] +# Front-view occlusion: scapulae/spine are behind chest and limbs; sternum, +# clavicles and knees remain visible. Both sides share each topic identity. +PAINT_ORDER = [15,16,17,22,23,24,21,20,18,11,3,10,9,8,5,7,6,0,1,4,2,12,14,13,19] +DETAIL_VIEW = [1,1,5,5,5,5,1,5,4,4,4,4,0,0,0,2,2,2,0,0,0,0,3,3,3] +VIEWS = [ + ('overview', None, 64, 149), + ('head', (163,17,243,154), 38,65), + ('hand', (313,397,410,500),61,65), + ('foot', (199,747,275,825),63,65), + ('spine', (169,274,235,400),34,65), + ('chest', (107,132,300,308),68,62), +] + + +def selected_svg(source, elements, selected): + root = ET.Element(source.tag, {k:v for k,v in source.attrib.items() + if k in ('version','width','height','viewBox')}) + root.append(copy.deepcopy(elements['defs3096'])) + def prune(element, active=False): + active = active or element.get('id') in selected + result = ET.Element(element.tag, element.attrib) + for child in element: + kept = prune(child, active) + if kept is not None: + result.append(kept) + return result if active or len(result) else None + skeleton = prune(elements['layer3']) + if skeleton is None: + raise ValueError('No skeleton source groups selected') + root.append(skeleton) + return ET.tostring(root) + + +def runs(pixels, width, height): + result, offsets = [], [0] + for topic in range(1,26): + for y in range(height): + x = 0 + while x < width: + if pixels[y*width+x] != topic: + x += 1 + continue + start = x + while x < width and pixels[y*width+x] == topic: + x += 1 + result.extend((y,start,x-start)) + offsets.append(len(result)) + return result, offsets + + +def c_array(name, values, kind='unsigned char', static=False): + lines = ['static ' if static else ''] + prefix = ('static ' if static else '') + 'const '+kind+' '+name+'[] = {\n' + return prefix + ''.join(' '+','.join(map(str,values[n:n+24]))+',\n' + for n in range(0,len(values),24)) + '};\n\n' + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--rsvg-convert', default=shutil.which('rsvg-convert')) + args = parser.parse_args() + if not args.rsvg_convert: + parser.error('Install rsvg-convert for optional asset authoring, or use generated C unchanged.') + source_path = ROOT/'assets/skeleton-source.svg' + source = ET.parse(source_path).getroot() + elements = {e.get('id'):e for e in source.iter() if e.get('id')} + images, masks = [], [] + for code, ids in TOPICS: + if any(name not in elements for name in ids): + raise ValueError('Missing source bone group: '+code) + rendered = subprocess.run([args.rsvg_convert,'-w','436','-h','842'], + input=selected_svg(source,elements,set(ids)),capture_output=True,check=True) + image = Image.open(io.BytesIO(rendered.stdout)).convert('RGBA') + images.append(image) + masks.append(image.getchannel('A')) + combined = masks[0] + for mask in masks[1:]: + combined = ImageChops.lighter(combined,mask) + overall_bounds = combined.getbbox() + if overall_bounds != (59,20,405,822): + raise ValueError('Source geometry bounds changed; review bone mapping before regenerating.') + # Keep actual shaded facial recesses from the original illustration visible + # after flattening its colors. No new anatomical shapes are drawn here. + recess = Image.new('L',(436,842),0) + original = images[0] + for y in range(55,103): + for x in range(175,232): + r,g,b,a = original.getpixel((x,y)) + eye = ((177<=x<198 or 207<=x<231) and 58<=y<80) + nose = 195<=x<212 and 75<=y<101 + luminance = (299*r+587*g+114*b)//1000 + if a>128 and ((eye and luminance<213) or (nose and luminance<130)): + recess.putpixel((x,y),255) + generated = ROOT/'assets/generated'; generated.mkdir(parents=True,exist_ok=True) + view_data, overview_pixels = [], None + code = ['/* Generated by tools/prepare_assets.py from LadyofHats public-domain SVG. */\n', + '#include "map_data.h"\n\n'] + manifest = dict(schemaVersion=1,source=dict(file='assets/skeleton-source.svg', + sha256=hashlib.sha256(source_path.read_bytes()).hexdigest(), + author='Mariana Ruiz Villarreal (LadyofHats)',license='Public domain dedication', + page='https://commons.wikimedia.org/wiki/File:Human_skeleton_front_en.svg'), + coordinateRender=[436,842],overviewSourceBounds=list(overall_bounds), + topics=[dict(id=i,code=topic,sourceElements=ids) for i,(topic,ids) in enumerate(TOPICS)], + paintOrder=PAINT_ORDER,facialRecesses='Original source shading thresholds, eyes and nasal recess only', + pairedSides='Both sides use one bone-family identity; no left/right questions',views=[]) + sizes = 0 + for view_index,(name,box,width,height) in enumerate(VIEWS): + box = box or overall_bounds + pixels = bytearray(width*height) + for topic in PAINT_ORDER: + alpha = masks[topic].crop(box).resize((width,height),Image.Resampling.LANCZOS) + for pos,value in enumerate(alpha.tobytes()): + if value>=64: + pixels[pos]=topic+1 + if name in ('overview','head'): + holes = recess.crop(box).resize((width,height),Image.Resampling.LANCZOS) + for pos,value in enumerate(holes.tobytes()): + if pixels[pos]==1 and value>=64: + pixels[pos]=0 + data,offsets=runs(pixels,width,height) + counts=[pixels.count(i+1) for i in range(25)] + if view_index==0: + overview_pixels=pixels + if not all(counts): + raise ValueError('A bone family disappeared from overview: '+str(counts)) + stem='bone' + else: + stem=name + code.append(c_array(stem+'_spans',data,static=view_index!=0)) + code.append(c_array(stem+'_offsets',offsets,'unsigned',static=view_index!=0)) + sizes += len(data)+len(offsets)*2 + view_data.append((stem,width,height)) + manifest['views'].append(dict(id=view_index,name=name,sourceBounds=list(box), + width=width,height=height,spanBytes=len(data),offsetBytes=len(offsets)*2, + pixels={TOPICS[i][0]:counts[i] for i in range(25)})) + # A developer preview uses the runtime's palette; it is not a native + # emulator capture. The selected sample topic is yellow. + sample = next(i for i,value in enumerate(DETAIL_VIEW) if value==view_index) if view_index else 0 + colors=[(0,0,85)] + [(255,255,0) if i==sample else (85,170,170) for i in range(25)] + preview=Image.new('RGB',(width,height));preview.putdata([colors[value] for value in pixels]) + preview.save(generated/(name+'-preview.png')) + debug=Image.new('RGB',(width,height));palette=[(0,0,85)]+[((i*73+80)%220+35,(i*41)%220+35,(i*109)%220+35) for i in range(25)];debug.putdata([palette[value] for value in pixels]);debug.save(generated/(name+'-regions.png')) + # Independently decode all authored runs to prove disjoint bounds and + # exact reconstruction of every generated view. + decoded=bytearray(width*height) + for topic in range(25): + for p in range(offsets[topic],offsets[topic+1],3): + y,x,length=data[p:p+3] + assert 0<=y6000: + raise ValueError('Geometry exceeds 6000-byte ROM budget: '+str(sizes)) + (ROOT/'src/map_data.c').write_text(''.join(code)) + (ROOT/'map_data.h').write_text('''#ifndef BONE_MAP_DATA_H +#define BONE_MAP_DATA_H +#define BONE_MAP_WIDTH 64 +#define BONE_MAP_HEIGHT 149 +#define BONE_VIEW_COUNT 6 +/* Spans are (y,x,length) triples. Offsets index bytes, 26 entries per view. + bone_boxes is [25][4]: xmin,ymin,width,height in overview pixels. + View IDs: 0 overview,1 head/neck,2 hand,3 foot,4 lower spine/pelvis,5 chest. + A zero detail-view selector asks the UI to magnify the current overview crop. */ +extern const unsigned char bone_spans[]; +extern const unsigned bone_offsets[26]; +extern const unsigned char bone_boxes[25][4]; +extern const unsigned char bone_detail_view[25]; +extern const unsigned char bone_view_widths[6],bone_view_heights[6]; +extern const unsigned char * const bone_view_spans[BONE_VIEW_COUNT]; +extern const unsigned * const bone_view_offsets[BONE_VIEW_COUNT]; +#endif +''') + manifest['geometryROMBytes']=sizes + manifest['detailSelector']=DETAIL_VIEW + manifest['overviewBoxes']={TOPICS[i][0]:boxes[4*i:4*i+4] for i in range(25)} + (ROOT/'data/geometry-manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + print('PASS25 source-group masks; six disjoint bounded views; geometry ROM bytes:',sizes) + + +if __name__=='__main__': + main() diff --git a/tools/prepare_questions.py b/tools/prepare_questions.py new file mode 100644 index 0000000..57fb718 --- /dev/null +++ b/tools/prepare_questions.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +"""Validate authored anatomy facts and regenerate the small CMOC question table.""" +import argparse +import json +from pathlib import Path +ROOT=Path(__file__).resolve().parents[1] +CODES=('CRANIUM','MANDIBLE','CLAVICLE','SCAPULA','STERNUM','RIBS','CERVICAL','THORACIC','LUMBAR','SACRUM','COCCYX','PELVIS','HUMERUS','RADIUS','ULNA','CARPALS','METACARPALS','FINGERS','FEMUR','PATELLA','TIBIA','FIBULA','TARSALS','METATARSALS','TOES') +def generated(): + rows=json.loads((ROOT/'data/bones.json').read_text());assert tuple(r['code'] for r in rows)==CODES + seen=set() + for row in rows: + assert 0