Complete Bone Quest high-resolution anatomy quiz
No files matched your search
@@ -2,3 +2,4 @@
|
||||
assets/skeleton-source.svg -text
|
||||
*.png binary
|
||||
*.DSK binary
|
||||
*.DAT binary
|
||||
@@ -14,7 +14,7 @@ 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
|
||||
SOURCES = main.c src/quiz.c src/ui.c src/bones.c src/map_data.c src/graphics.c src/geometry.c
|
||||
OBJECTS = $(SOURCES:%.c=obj/%.o)
|
||||
.PHONY: all build disk clean assets test
|
||||
all: disk
|
||||
@@ -22,18 +22,19 @@ 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
|
||||
"$(CMOC)" --coco --intermediate --org=2000 --limit=7800 -o $@ $(OBJECTS) -linput -lbcontrol -lhirestxt -lbank -ldecbfile
|
||||
# Explicit project headers avoid CMOC .d paths to expired VCC build snapshots.
|
||||
obj/%.o: %.c quiz.h ui.h map_data.h Makefile
|
||||
obj/%.o: %.c quiz.h ui.h map_data.h graphics.h geometry.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
|
||||
build/BONEQ.dsk: build/BONEQ.bin obj/boot.bin assets/generated/BONES.DAT
|
||||
$(PERL) -e 'print chr(255) x (35*18*256)' > $@
|
||||
"$(INSTALL_LOADER)" $@ obj/boot.bin
|
||||
"$(WRITECOCOFILE)" $@ build/BONEQ.bin
|
||||
"$(WRITECOCOFILE)" --binary $@ assets/generated/BONES.DAT
|
||||
assets:
|
||||
python3 tools/prepare_questions.py
|
||||
python3 tools/prepare_assets.py
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
# 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,
|
||||
quiz foundation. Identify 28 skeletal structures on a human skeleton,
|
||||
choose among four names or type the answer, then review missed questions.
|
||||
The skeleton uses native 640 × 225 graphics with four colors and page swapping.
|
||||
|
||||
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.
|
||||
|
||||

|
||||

|
||||
|
||||
## Machine and loading
|
||||
|
||||
@@ -19,23 +20,30 @@ 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.
|
||||
- At any screen, Q, Escape or CoCo Break quits to BASIC, including during
|
||||
a question or the automatic feedback pause.
|
||||
- Title: 1 multiple choice, 2 typed answers, C credits.
|
||||
- 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
|
||||
- Typed answers: Enter submits, Backspace edits, blank Enter 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.
|
||||
one point, with corrections counted separately. A blank answer or reveal counts
|
||||
as a miss. The entry limit is 33 characters.
|
||||
- Progress: white bones, red missed structures, yellow current. Correct answers
|
||||
return to white; feedback and the score confirm success. The full skeleton keeps
|
||||
context while a detail panel enlarges the selected area. Dark linework separates
|
||||
neighboring bones and individual ribs. Unquizzed anatomy stays white for context.
|
||||
- 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.
|
||||
asked once. One correct answer earns one point; percentage is correct/28×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;
|
||||
The quiz follows the 28 labels in the supplied reference: bones, bone groups,
|
||||
bone parts and two facial cavities. It does not cover every individual bone
|
||||
in an adult skeleton. Paired left/right counterparts share a question. The
|
||||
manubrium, sternum body and xiphoid process are separate topics, as are the
|
||||
ilium and pubis. Finger and toe phalanges are separate topics;
|
||||
bare "phalanges" is deliberately not a complete answer. See docs/ANATOMY.md.
|
||||
|
||||
## Build
|
||||
@@ -53,11 +61,11 @@ 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
|
||||
Clean between configurations in one working folder. Generated anatomy metadata
|
||||
and BONES.DAT are 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.
|
||||
the retained metadata and drawing data. make test detects stale question data and invalid geometry.
|
||||
|
||||
## Credits and source
|
||||
|
||||
@@ -67,8 +75,8 @@ 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.
|
||||
Adaptations remove labels, fit the CoCo pixel aspect, preserve bone/rib linework,
|
||||
recolor and encode per-topic masks and enlarged 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
|
||||
|
||||
@@ -12,7 +12,14 @@ Original: **Human skeleton front en.svg**, by **Mariana Ruiz Villarreal
|
||||
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.
|
||||
recolor the drawing and encode selected structure masks and detail views.
|
||||
The 28-topic adaptation retains source-derived linework and rib spaces, uses a black canvas for outer contours, and separates the sternum and hip parts by artist-coordinate
|
||||
regions. Orbital and nasal cavity highlights use the original facial recesses. The left
|
||||
thumb chain is rotated toward the palm as a pose adaptation, preserving its
|
||||
relative bone lengths and joints; the retained SVG remains byte-identical.
|
||||
See data/geometry-manifest.json for exact segmentation and conversion details.
|
||||
The additional user-supplied raster reference guides the topic list and linework
|
||||
style; its pixels are not included in the game.
|
||||
This is an educational front-view diagram; grouped and paired bones are not
|
||||
individually counted questions. No endorsement by the artist is implied.
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 600 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 563 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 698 B After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 3.2 KiB |
@@ -1,56 +1,12 @@
|
||||
[
|
||||
{
|
||||
"code": "CRANIUM",
|
||||
"name": "Cranium",
|
||||
"hint": "Head above the lower jaw",
|
||||
"code": "SKULL",
|
||||
"name": "Skull",
|
||||
"hint": "Head, including 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"
|
||||
]
|
||||
"cranium"
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "CERVICAL",
|
||||
@@ -59,15 +15,36 @@
|
||||
"aliases": [
|
||||
"neck vertebrae",
|
||||
"cervical vertebra"
|
||||
]
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "THORACIC",
|
||||
"name": "Thoracic vertebrae",
|
||||
"hint": "Upper and middle back",
|
||||
"code": "MANUBRIUM",
|
||||
"name": "Manubrium",
|
||||
"hint": "Upper breastbone section",
|
||||
"aliases": [
|
||||
"thoracic vertebra"
|
||||
]
|
||||
"manubrium sterni"
|
||||
],
|
||||
"kind": "bone_part"
|
||||
},
|
||||
{
|
||||
"code": "STERNUM",
|
||||
"name": "Body of sternum",
|
||||
"hint": "Middle breastbone section",
|
||||
"aliases": [
|
||||
"sternal body",
|
||||
"sternum body"
|
||||
],
|
||||
"kind": "bone_part"
|
||||
},
|
||||
{
|
||||
"code": "XIPHOID",
|
||||
"name": "Xiphoid process",
|
||||
"hint": "Small tip of the breastbone",
|
||||
"aliases": [
|
||||
"xiphoid"
|
||||
],
|
||||
"kind": "bone_part"
|
||||
},
|
||||
{
|
||||
"code": "LUMBAR",
|
||||
@@ -76,7 +53,15 @@
|
||||
"aliases": [
|
||||
"lumbar vertebra",
|
||||
"lower back vertebrae"
|
||||
]
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "ILIUM",
|
||||
"name": "Ilium",
|
||||
"hint": "Upper flared part of the hip",
|
||||
"aliases": [],
|
||||
"kind": "bone_part"
|
||||
},
|
||||
{
|
||||
"code": "SACRUM",
|
||||
@@ -84,7 +69,8 @@
|
||||
"hint": "Base of spine above tailbone",
|
||||
"aliases": [
|
||||
"sacral bone"
|
||||
]
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "COCCYX",
|
||||
@@ -93,68 +79,17 @@
|
||||
"aliases": [
|
||||
"tailbone",
|
||||
"tail bone"
|
||||
]
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "PELVIS",
|
||||
"name": "Pelvic girdle",
|
||||
"hint": "Hip region, on either side",
|
||||
"code": "PUBIS",
|
||||
"name": "Pubis",
|
||||
"hint": "Front lower part of the hip",
|
||||
"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"
|
||||
]
|
||||
"pubic bone"
|
||||
],
|
||||
"kind": "bone_part"
|
||||
},
|
||||
{
|
||||
"code": "FEMUR",
|
||||
@@ -163,7 +98,8 @@
|
||||
"aliases": [
|
||||
"thighbone",
|
||||
"thigh bone"
|
||||
]
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "PATELLA",
|
||||
@@ -172,42 +108,29 @@
|
||||
"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"
|
||||
]
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "TARSALS",
|
||||
"name": "Tarsals",
|
||||
"hint": "Rear foot and ankle",
|
||||
"aliases": [
|
||||
"tarsus",
|
||||
"ankle bones",
|
||||
"tarsal bones"
|
||||
]
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "METATARSALS",
|
||||
"name": "Metatarsals",
|
||||
"hint": "Mid-foot behind the toes",
|
||||
"aliases": [
|
||||
"metatarsus",
|
||||
"metatarsal bones"
|
||||
]
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "TOES",
|
||||
@@ -216,6 +139,135 @@
|
||||
"aliases": [
|
||||
"toe bones",
|
||||
"foot phalanges"
|
||||
]
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "ORBIT",
|
||||
"name": "Orbital cavity",
|
||||
"hint": "Bony space around the eye",
|
||||
"aliases": [
|
||||
"eye socket",
|
||||
"orbit"
|
||||
],
|
||||
"kind": "cavity"
|
||||
},
|
||||
{
|
||||
"code": "NASAL",
|
||||
"name": "Nasal cavity",
|
||||
"hint": "Space behind the nose",
|
||||
"aliases": [
|
||||
"nose cavity"
|
||||
],
|
||||
"kind": "cavity"
|
||||
},
|
||||
{
|
||||
"code": "CLAVICLE",
|
||||
"name": "Clavicle",
|
||||
"hint": "Front of the shoulder",
|
||||
"aliases": [
|
||||
"collarbone",
|
||||
"collar bone"
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "SCAPULA",
|
||||
"name": "Scapula",
|
||||
"hint": "Back of the shoulder",
|
||||
"aliases": [
|
||||
"shoulder blade",
|
||||
"shoulderblade"
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "RIBS",
|
||||
"name": "Ribs",
|
||||
"hint": "Curving around the chest",
|
||||
"aliases": [
|
||||
"rib",
|
||||
"rib bones"
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "HUMERUS",
|
||||
"name": "Humerus",
|
||||
"hint": "Upper arm",
|
||||
"aliases": [
|
||||
"upper arm bone"
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "ULNA",
|
||||
"name": "Ulna",
|
||||
"hint": "Forearm, little-finger side",
|
||||
"aliases": [
|
||||
"ulna bone"
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "RADIUS",
|
||||
"name": "Radius",
|
||||
"hint": "Forearm, thumb side",
|
||||
"aliases": [
|
||||
"radius bone"
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "CARPALS",
|
||||
"name": "Carpals",
|
||||
"hint": "Wrist",
|
||||
"aliases": [
|
||||
"carpus",
|
||||
"wrist bones",
|
||||
"carpal bones"
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "METACARPALS",
|
||||
"name": "Metacarpals",
|
||||
"hint": "Palm between wrist and fingers",
|
||||
"aliases": [
|
||||
"metacarpus",
|
||||
"palm bones",
|
||||
"metacarpal bones"
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "FINGERS",
|
||||
"name": "Finger phalanges",
|
||||
"hint": "Digits of the hand",
|
||||
"aliases": [
|
||||
"finger bones",
|
||||
"hand phalanges"
|
||||
],
|
||||
"kind": "bone_group"
|
||||
},
|
||||
{
|
||||
"code": "FIBULA",
|
||||
"name": "Fibula",
|
||||
"hint": "Lower leg, outer side",
|
||||
"aliases": [
|
||||
"calf bone",
|
||||
"calfbone"
|
||||
],
|
||||
"kind": "bone"
|
||||
},
|
||||
{
|
||||
"code": "TIBIA",
|
||||
"name": "Tibia",
|
||||
"hint": "Lower leg, inner side",
|
||||
"aliases": [
|
||||
"shinbone",
|
||||
"shin bone"
|
||||
],
|
||||
"kind": "bone"
|
||||
}
|
||||
]
|
||||
@@ -1,45 +1,96 @@
|
||||
# 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.
|
||||
The quiz now follows the **28 labels in the user-supplied human skeletal-system
|
||||
reference**, in its numbered order. These topics are bones, bone groups, parts of
|
||||
bones, and two cavities. They are not 28 individual bones or a claim to quiz every
|
||||
individual bone in the adult skeleton. Paired left/right counterparts share a
|
||||
topic. The orbital and nasal cavities are anatomical spaces, not bones.
|
||||
|
||||
`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.
|
||||
`data/bones.json` is the canonical ordered bank. Its stable code and `kind` remain
|
||||
in authoring data. `src/bones.c` contains only the three runtime fields: displayed
|
||||
name, short location hint, and pipe-separated accepted aliases. Fixed topic order
|
||||
binds artwork, history and questions. `tools/prepare_questions.py` regenerates
|
||||
that compact table and its `--check` option detects stale C. Names are at most
|
||||
18 characters, aliases at most 33, and hints at most 30.
|
||||
|
||||
## Naming choices
|
||||
## Reference order and corrected terminology
|
||||
|
||||
- **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
|
||||
| Reference | Stable code | Displayed answer | Topic kind |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | SKULL | Skull | Bone group |
|
||||
| 2 | CERVICAL | Cervical vertebrae | Bone group |
|
||||
| 3 | MANUBRIUM | Manubrium | Part of sternum |
|
||||
| 4 | STERNUM | Body of sternum | Part of sternum |
|
||||
| 5 | XIPHOID | Xiphoid process | Part of sternum |
|
||||
| 6 | LUMBAR | Lumbar vertebrae | Bone group |
|
||||
| 7 | ILIUM | Ilium | Part of hip bone |
|
||||
| 8 | SACRUM | Sacrum | Bone |
|
||||
| 9 | COCCYX | Coccyx | Bone |
|
||||
| 10 | PUBIS | Pubis | Part of hip bone |
|
||||
| 11 | FEMUR | Femur | Bone |
|
||||
| 12 | PATELLA | Patella | Bone |
|
||||
| 13 | TARSALS | Tarsals | Bone group |
|
||||
| 14 | METATARSALS | Metatarsals | Bone group |
|
||||
| 15 | TOES | Toe phalanges | Bone group |
|
||||
| 16 | ORBIT | Orbital cavity | Cavity |
|
||||
| 17 | NASAL | Nasal cavity | Cavity |
|
||||
| 18 | CLAVICLE | Clavicle | Bone |
|
||||
| 19 | SCAPULA | Scapula | Bone |
|
||||
| 20 | RIBS | Ribs | Bone group |
|
||||
| 21 | HUMERUS | Humerus | Bone |
|
||||
| 22 | ULNA | Ulna | Bone |
|
||||
| 23 | RADIUS | Radius | Bone |
|
||||
| 24 | CARPALS | Carpals | Bone group |
|
||||
| 25 | METACARPALS | Metacarpals | Bone group |
|
||||
| 26 | FINGERS | Finger phalanges | Bone group |
|
||||
| 27 | FIBULA | Fibula | Bone |
|
||||
| 28 | TIBIA | Tibia | Bone |
|
||||
|
||||
The reference's **Illium** is corrected to **Ilium**. Its **Manubri sterni** label
|
||||
is represented by **Manubrium**, with the correct expanded term **manubrium
|
||||
sterni** accepted. **Shoulder blade** remains an alias for Scapula. The regional
|
||||
terms **tarsus**, **metatarsus**, **carpus**, and **metacarpus** are accepted for
|
||||
the corresponding groups. These spellings and aliases preserve the intended
|
||||
anatomy without treating a printed spelling error as a second canonical answer.
|
||||
|
||||
## Naming and grouping choices
|
||||
|
||||
- **Skull** replaces the previous separate cranium and mandible questions. It
|
||||
is a combined topic, not an assertion that the skull is one adult bone.
|
||||
**Cranium** is accepted as a familiar alternative term in this overview.
|
||||
- The sternum is divided into **Manubrium**, **Body of sternum**, and **Xiphoid
|
||||
process**. **Sternal body / sternum body** identifies its middle part. Bare
|
||||
**sternum** or **breastbone** is not an exact alias for just that middle part.
|
||||
- **Ilium** and **Pubis** replace the broad pelvic-girdle question. The sacrum
|
||||
and coccyx remain separate topics. **Pelvis**, **hip bone**, and **pelvic
|
||||
girdle** are not aliases for either selected hip-bone part. The ischium is
|
||||
not a separate question in this reference set.
|
||||
- **Orbital cavity** accepts **eye socket** and **orbit**. **Nasal cavity**
|
||||
accepts **nose cavity**. Both are spaces bounded by skull structures; neither
|
||||
is a bone. Prompts and educational copy must use **structure/topic** when
|
||||
describing the whole question set rather than calling all 28 targets bones.
|
||||
- **Finger phalanges** includes the thumb. **Toe phalanges** is separate. Bare
|
||||
**phalanges** is deliberately not accepted 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.
|
||||
- **Radius** and **ulna** are distinguished in the anatomical position: the
|
||||
radius is on the thumb side, the ulna on the little-finger side. **Tibia**
|
||||
and **fibula** are on the inner and outer sides of the lower leg respectively.
|
||||
- Common names such as collarbone, shoulder blade, thighbone, kneecap, shinbone
|
||||
and tailbone remain accepted. A location hint is not automatically an answer.
|
||||
|
||||
The previous standalone **Mandible** and **Thoracic vertebrae** questions are
|
||||
not in this reference's 28 topics. The diagram can still show unquizzed anatomy
|
||||
for context; such anatomy must not be assigned to a different answer merely to
|
||||
fill a mask. The new reference order changes topic indices, so geometry IDs,
|
||||
question count, histories, score percentage, and deterministic test expectations
|
||||
must be regenerated together.
|
||||
|
||||
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.
|
||||
The JSON `kind` values distinguish `bone`, `bone_group`, `bone_part`, and `cavity`.
|
||||
These labels describe the learning units; a paired bone name still covers both
|
||||
left and right examples. The bank contains no treatment, injury or diagnostic
|
||||
questions.
|
||||
|
||||
## Primary references checked
|
||||
|
||||
@@ -55,16 +106,14 @@ verify names, group boundaries and location facts on November 11, 2026:
|
||||
- [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.
|
||||
artwork are imported into the game. The short location hints are written for
|
||||
this quiz, 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.
|
||||
The original visual source remains [Human skeleton front en.svg](https://commons.wikimedia.org/wiki/File:Human_skeleton_front_en.svg)
|
||||
by **Mariana Ruiz Villarreal (LadyofHats)**, released into the public domain by
|
||||
its author. The newly supplied labeled reference determines this topic list;
|
||||
its photographed/cartoon pixels are not imported as runtime art by this data
|
||||
change. The retained Wikimedia SVG, adaptation receipt, generated masks, and
|
||||
any anatomy-specific segmentation must preserve their actual provenance.
|
||||
@@ -4,7 +4,7 @@ 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] Verify 28 reference structures 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.
|
||||
@@ -14,5 +14,52 @@ 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
|
||||
The quiz follows the 28 structures in Brian's reference, including distinct
|
||||
sternum sections, ilium/pubis and orbital/nasal cavities. It does not cover 206
|
||||
individually selectable bones. Paired left/right examples share one question.
|
||||
The original SVG remains the retained source; the supplied raster reference
|
||||
guides subject selection and the preference for clear outlines and rib gaps.
|
||||
|
||||
|
||||
## High-resolution rendering
|
||||
|
||||
Brian requested the highest native CoCo 3 resolution with a mostly black-and-white
|
||||
skeleton. The game now uses 640 × 225, four colors: black background/linework,
|
||||
white anatomy, yellow current structure and red missed structures. Correct
|
||||
structures return to white rather than consuming another palette entry.
|
||||
|
||||
The local GPL graphics driver adapts VCC Plus's original SDK GIME implementation;
|
||||
its upstream revision/hash remain in src/graphics.c. It owns two 40 KiB pages in
|
||||
physical banks $1E–$27, leaving the documented bank library's $28–$2B available
|
||||
for artwork. Both drawings and the 2 KB stack stay separate from the program.
|
||||
The driver clips 2-bit pixels, borrows the $8000 window only in short masked
|
||||
sections, restores the MMU/interrupt state, flips at vertical blank, and restores
|
||||
BASIC on exit. gfx_copy_front copies the visible page to the hidden page so
|
||||
feedback and spelling prompts can reuse the skeleton rather than repainting it.
|
||||
|
||||
BONES.DAT contains six compact drawing views, loaded read-only from drive 0 into
|
||||
asset banks once at startup. The loader validates exact size and a generated
|
||||
checksum; host checks verify SHA-256. Normal builds retain this data and the small
|
||||
C metadata, with no asset authoring dependencies. The original SVG is rendered
|
||||
anew at 872 × 1684 before reduction, with native pixels treated as 1:2 in physical
|
||||
width:height. The 159 × 184 overview and enlarged regional views retain rib gaps,
|
||||
facial recesses, joints and bone boundaries. Precise source selection, coordinate
|
||||
cuts and ownership evidence are in data/geometry-manifest.json.
|
||||
|
||||
The source game, emulator and website repositories remain separate. This work
|
||||
changes Bone Quest only; the VCC Plus app and Capital Quest are unchanged.
|
||||
|
||||
|
||||
## Hand pose and global exit refinement
|
||||
|
||||
The anatomical left thumb (screen right) now rests closer to the palm. The
|
||||
converter rotates its metacarpal and both phalanges together by 30 degrees about
|
||||
source point (367,416), preserving bone lengths and joint relationships. Both
|
||||
region ownership and linework use that same transform in overview/detail views;
|
||||
the original SVG is unchanged. The exact source element IDs are in the manifest.
|
||||
|
||||
Q/q, Escape (ASCII 27) and CoCo Break (ASCII 3) now call one cleanup path from
|
||||
all interactive screens. It releases the keyboard, closes graphics and asset
|
||||
banks, restores normal CPU speed and returns to BASIC. The automatic reading
|
||||
pause polls those keys too. Escape/Break are no longer reveal shortcuts: blank
|
||||
Enter reveals an answer as a miss; the spelling-help menu retains V to reveal.
|
||||
@@ -3,12 +3,14 @@
|
||||
"file": "docs/images/title.png",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"sha256": "c760e20e70c3063f2938acad87c80979ef8f795ff981bfa3eacb6fff5b3db9f3",
|
||||
"guestWidth": 640,
|
||||
"guestHeight": 225,
|
||||
"sha256": "8cd34f02ac0d4ee433e83e2666121daa2c32166b366c171c301a0e831e948222",
|
||||
"emulator": "VCC Plus 3.6.1 (54)",
|
||||
"processor": "MC6809",
|
||||
"ramKB": 512,
|
||||
"video": "RGB",
|
||||
"diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66",
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"capture": "Unmodified guest frame from isolated keyboard-driven playtest",
|
||||
"note": "Scripted validation includes deliberate incorrect answers."
|
||||
},
|
||||
@@ -16,12 +18,14 @@
|
||||
"file": "docs/images/multiple-choice.png",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"sha256": "a0f272e2e0355260e27bfef6b5021e4cb984e054eac9e39a0f910f05af66e3c5",
|
||||
"guestWidth": 640,
|
||||
"guestHeight": 225,
|
||||
"sha256": "d7815e218ff50750556362739f2e096bd3a415a60de20ddb81b1fcfa74a7a3bf",
|
||||
"emulator": "VCC Plus 3.6.1 (54)",
|
||||
"processor": "MC6809",
|
||||
"ramKB": 512,
|
||||
"video": "RGB",
|
||||
"diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66",
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"capture": "Unmodified guest frame from isolated keyboard-driven playtest",
|
||||
"note": "Scripted validation includes deliberate incorrect answers."
|
||||
},
|
||||
@@ -29,12 +33,14 @@
|
||||
"file": "docs/images/typed-answer.png",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"sha256": "f44cd5b9493a2b4704532f444f4666b536db375e4b7a6338683bcade9246444d",
|
||||
"guestWidth": 640,
|
||||
"guestHeight": 225,
|
||||
"sha256": "04b0149afa66c37ab2aa985bac30a92b24868bbf16f40cb01047c5ac4eea0d77",
|
||||
"emulator": "VCC Plus 3.6.1 (54)",
|
||||
"processor": "MC6809",
|
||||
"ramKB": 512,
|
||||
"video": "RGB",
|
||||
"diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66",
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"capture": "Unmodified guest frame from isolated keyboard-driven playtest",
|
||||
"note": "Scripted validation includes deliberate incorrect answers."
|
||||
},
|
||||
@@ -42,12 +48,44 @@
|
||||
"file": "docs/images/results.png",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"sha256": "81839f1acdf3511d62c52fc6fdc53df138a5b86048563628b450df6ffe7c6297",
|
||||
"guestWidth": 640,
|
||||
"guestHeight": 225,
|
||||
"sha256": "2dee6d6c16b4bd0fb942dd466ab814f418dc875f81c76fe845428740c826f1af",
|
||||
"emulator": "VCC Plus 3.6.1 (54)",
|
||||
"processor": "MC6809",
|
||||
"ramKB": 512,
|
||||
"video": "RGB",
|
||||
"diskSHA256": "cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66",
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"capture": "Unmodified guest frame from isolated keyboard-driven playtest",
|
||||
"note": "Scripted validation includes deliberate incorrect answers."
|
||||
},
|
||||
{
|
||||
"file": "docs/images/head-detail.png",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"guestWidth": 640,
|
||||
"guestHeight": 225,
|
||||
"sha256": "05b796dd8bb74979924b4b4af4c2ec10b2f06582a56b1bf5d13a1a61aad9f874",
|
||||
"emulator": "VCC Plus 3.6.1 (54)",
|
||||
"processor": "MC6809",
|
||||
"ramKB": 512,
|
||||
"video": "RGB",
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"capture": "Unmodified guest frame from isolated keyboard-driven playtest",
|
||||
"note": "Scripted validation includes deliberate incorrect answers."
|
||||
},
|
||||
{
|
||||
"file": "docs/images/hand-detail.png",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"guestWidth": 640,
|
||||
"guestHeight": 225,
|
||||
"sha256": "9adca4eed509d5bed1bf1497a1518c91b69cc1b52de0c373a29b0d037101fdf6",
|
||||
"emulator": "VCC Plus 3.6.1 (54)",
|
||||
"processor": "MC6809",
|
||||
"ramKB": 512,
|
||||
"video": "RGB",
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"capture": "Unmodified guest frame from isolated keyboard-driven playtest",
|
||||
"note": "Scripted validation includes deliberate incorrect answers."
|
||||
}
|
||||
|
||||
@@ -1,64 +1,101 @@
|
||||
# Initial Bone Quest verification — November 11, 2026
|
||||
# High-resolution Bone Quest verification — November 11, 2026
|
||||
|
||||
## Built and delivered
|
||||
## Candidate and builds
|
||||
|
||||
The root BONEQ.DSK is a standard 35-track DECB image, 161,280 bytes, SHA-256:
|
||||
The current candidate is a 35-track DECB disk, 161,280 bytes, SHA-256:
|
||||
|
||||
`cf9b2da5842551d76b58c3be2064a78163536526826fca13ac7ee58c269e1e66`
|
||||
`373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba`
|
||||
|
||||
Source base: 3cc37be5fb46b2e45be54ab13f52765c702edc24 plus the reviewable
|
||||
28-structure/high-resolution changes in this checkout. Selected source hashes
|
||||
and final check summaries are recorded in VERIFICATION.json.
|
||||
|
||||
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.
|
||||
Release program/static storage ends at $73FD; Debug at $745B; Test at $7402.
|
||||
All remain below the $7800 limit, with the separate 2 KB stack below $8000.
|
||||
Debug and Test were built in separate minimal folders without the original SVG,
|
||||
Python, Pillow or asset-conversion scripts as build inputs.
|
||||
|
||||
The display is native 640 × 225, four colors, with two 36,000-byte images in
|
||||
40 KiB reservations ($1E–$27). Artwork uses the bank library's separate $28–$2B
|
||||
reservation. BONES.DAT is 16,640 bytes; compiled geometry metadata is 552 bytes.
|
||||
The loader reads the file once, verifies size/checksum and never writes to disk.
|
||||
Ordinary builds use the retained metadata and drawing file.
|
||||
|
||||
## 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.
|
||||
make test passed 56,000 option sets across 2,000 complete shuffled 28-topic
|
||||
orders: unique topics/options, no consecutive correct-slot repeats, all allowed
|
||||
transitions, replay reset, aliases, known-wrong-name priority, spelling, scoring
|
||||
and duplicate-answer protection. Canonical bank/generated C identity, the
|
||||
original SVG hash, external artwork SHA-256/checksum, six disjoint bounded views,
|
||||
and visible coverage for every overview/selected-detail topic also passed.
|
||||
|
||||
## Feedback audio
|
||||
## Graphics and loading regressions
|
||||
|
||||
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.
|
||||
The retained tests/check_graphics.py fixture passed on both guest CPUs. It checks
|
||||
576,000 actual guest pixels per CPU across four observations and three
|
||||
presentations: packed 2-bit edges, all 8 KiB seams, fifth-bank rows, clipping,
|
||||
page flips, complete front-to-back copies, edits staying hidden until present,
|
||||
stock MMU restoration, BASIC return and zero writes. Its host arithmetic check
|
||||
compares the actual rectangle function against an independent pixel reference
|
||||
for all horizontal positions/widths on 15 critical rows and 1,000 clipped
|
||||
multirow rectangles.
|
||||
|
||||
The retained tests/check_loader.py checks passed on both CPUs: missing artwork,
|
||||
wrong file size and wrong checksum all return to BASIC with a clear error and
|
||||
zero guest disk writes. Tests modify disposable in-memory copies only.
|
||||
|
||||
## Thumb pose and quit controls
|
||||
|
||||
The screen-right hand's thumb chain is rotated toward the palm in the converter;
|
||||
bone lengths and relative joints are preserved. All six generated views use the
|
||||
same pose, and the original SVG hash remains unchanged. The current guest hand
|
||||
capture is images/hand-detail.png.
|
||||
|
||||
The separate quit regression passed 16 actual guest scenarios across both CPUs:
|
||||
Q/q, Break/native Escape and ASCII 27 via Ctrl+Shift+Down, title, credits,
|
||||
multiple choice, partial typed input, spelling help, typed feedback and the
|
||||
automatic reading pause. All return to BASIC with normal MMU mappings and zero
|
||||
disk writes. Complete-game runs additionally quit directly from missed review.
|
||||
Blank Enter now reveals a typed answer; Escape/Break are reserved for exit.
|
||||
|
||||
The unchanged low-level graphics and loader modules retain the earlier
|
||||
regression evidence recorded below; those suites were not repeated for this
|
||||
pose/input refinement.
|
||||
|
||||
## 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 actual Release disk completed a full 28-question multiple-choice round and
|
||||
a full 28-question typed-answer round on each emulated MC6809 and HD6309. Both
|
||||
reported zero disk writes and preserved the exact disk hash.
|
||||
|
||||
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.
|
||||
The driver reads the actual displayed text and checks the full skeleton and
|
||||
enlarged detail pixels against the current question and answer history. Checks
|
||||
include all 28 highlights, white normal/correct structures, yellow current,
|
||||
red missed, four readable choices, no repeated correct slot, held-key release,
|
||||
common aliases, case/spacing, spelling retry/Backspace, the 33-character bound,
|
||||
reveal, 23/28 (82%) scoring, one correction, paged review, replay and BASIC exit.
|
||||
Separate correct/incorrect feedback captures verify nonzero guest audio samples;
|
||||
this establishes generated signal, not audible listening. Personal emulator
|
||||
settings/media and desktop input are untouched.
|
||||
|
||||
To repeat these developer checks, provide your own ROM paths explicitly:
|
||||
To repeat developer checks, supply your own private ROM paths:
|
||||
|
||||
```sh
|
||||
python3 tests/playtest.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
python3 tests/check_quit.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
python3 tests/check_graphics.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
python3 tests/check_loader.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.
|
||||
Raw logs/captures and ROM inputs are excluded from Git. Selected unmodified guest
|
||||
frames are in images/ with matching hashes and disk identity in SCREENSHOTS.json.
|
||||
At 640 × 225, the helper's active image starts at output (0,16), with two output
|
||||
rows per guest row. These are game frames rather than native-window captures.
|
||||
|
||||
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.
|
||||
No physical CoCo, host Intel, macOS 14, native editor/source-open UI or audible
|
||||
listening qualification is claimed. The original 25-topic candidate's evidence
|
||||
is preserved in testing/INITIAL_25_TOPICS.md and its original source revision.
|
||||
|
||||
The initial high-resolution candidate record is retained in testing/HIGH_RESOLUTION_INITIAL.md and .json; its prior disk remains unchanged under test-output/pre-thumb-quit/.
|
||||
@@ -0,0 +1,352 @@
|
||||
{
|
||||
"date": "2026-11-11",
|
||||
"baseRevision": "3cc37be5fb46b2e45be54ab13f52765c702edc24",
|
||||
"sourceState": "Local 28-structure / 640x225 / relaxed thumb / global quit changes retained for review",
|
||||
"disk": {
|
||||
"file": "BONEQ.DSK",
|
||||
"bytes": 161280,
|
||||
"sha256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
"configuration": "Release",
|
||||
"programEnd": "73FD",
|
||||
"app": "VCC Plus 3.6.1 (54)",
|
||||
"toolchain": {
|
||||
"CMOC": "0.1.100",
|
||||
"LWTools": "4.25"
|
||||
},
|
||||
"sourceFiles": {
|
||||
"Makefile": "b0e9816d4b1712cd903b1e51ebb5c80901fb45ba4233f6b091e6e97fe5cdd1d7",
|
||||
"assets/generated/BONES.DAT": "60303495c7c4df61b0e1b46797126b48ecad82874df9e0a0739a5617589e2255",
|
||||
"assets/skeleton-source.svg": "501752c94533439a31521a929a10ad1dd1b781f588d44fc87144c426a38b8773",
|
||||
"data/bones.json": "c4c609fd8a55d503279a728078dd285e2bfb0aaaa0d231a6e097eccafc9bbd50",
|
||||
"data/geometry-manifest.json": "cf79e4c4f780103939fb0a01f6513b1e1a094479d656a3858ab11212060fa1f3",
|
||||
"geometry.h": "6f5671aecc191b68940193b4a4cfedb45de065ec3aebd82b8b780f8f911bd81f",
|
||||
"graphics.h": "432db9ea323eabdff8badb83e15ee6d59f45a8f21f2c593ecbfab025f23a9d47",
|
||||
"main.c": "fa0b248eac3557ef26e6df9c256c313207aa6cc0d15ca72d605c86d4053a58ab",
|
||||
"map_data.h": "cbe804d68efe6e24226e86243b7c0df7f81898cc24d135c334744bd505e72359",
|
||||
"quiz.h": "664c9b3b967d561c7a11c54a994b0963ffaca7019d2fc06ca812cdd7861c1b44",
|
||||
"src/bones.c": "f533d2ecfbc3fc47f0669ef3cf2f4faec25728958ea71182e42a5893b17b4fed",
|
||||
"src/geometry.c": "32cf6c08bd48bc065280657af29e00f065db6b6d64b053b22818e669c860cf99",
|
||||
"src/graphics.c": "e7044af1de881695b06d3eb3cda0387d372cc5b0251d72a42b2255c48f65f9e0",
|
||||
"src/map_data.c": "b89c39c4c2c52aa4f1107f4dafc063ca65f3f67e080ad4643ed37e51d461f4b6",
|
||||
"src/quiz.c": "6c5e0e52d24e625dd9593fd2918eb9e86f9e0b842f04edfd6c580fe7844502f5",
|
||||
"src/ui.c": "b4af299bd32db673ae061a956ec1d8914553fea4d5336a94615fe7c441b90559",
|
||||
"tests/check_assets.py": "890517b520c464553abfe5404c0e839a049441b134c0ee6211b40f9569072ee6",
|
||||
"tests/check_graphics.py": "3965b8f249aa4e5c8810fa3c779dfed67d2742213839a5c2ddc9fbc653f58bb7",
|
||||
"tests/check_loader.py": "81059e960ca9eb507b1a243452d3df2ed22b52c6d211210056cb4afc7776acc4",
|
||||
"tests/check_quit.py": "d13ef9c0f5653cae49d5428ee1de3bd765286e9369a42c9192d293952238d186",
|
||||
"tests/graphics_arithmetic.c": "97fed0470f309a165588f6ecf44f25998fb1c79f469345a09f46588aa3be21ee",
|
||||
"tests/graphics_fixture.c": "9445eb27e91d15d0b6a0b6c28316c63e98546f6be5d8a39cbb53f0ea457ed43c",
|
||||
"tests/playtest.py": "9db0733fd63b7cf3ee0ed089ccce0b9488345b57645a686ba4f2f7e80804dc8d",
|
||||
"tests/test_quiz.c": "d923cd7ba61230f4ae0a9e16f8a6d96258d7dd7d89cb78014775a7eb3e5846c0",
|
||||
"tools/boot.c": "6fba20dc79348b28c951a1323d1aa4e857bc63fd3e898fc8b3eefd69ad077486",
|
||||
"tools/prepare_assets.py": "2a2e1c6af1981b1182af297bfcddb24c3e95f6a052f7d90d873250fa6477d1ed",
|
||||
"tools/prepare_questions.py": "c1f51dde59dcc1e1ab596461e9a521ee0b4a37a5cfaa9b0deda3a8ba9fee6f3f",
|
||||
"ui.h": "a19c47004e2d915939eb128634e15d4b1d5299fc3b3b61be8f316b7cc425b9fb"
|
||||
},
|
||||
"gameplay": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"ramKB": 512,
|
||||
"multipleChoice": 28,
|
||||
"typed": 28,
|
||||
"score": 23,
|
||||
"spellingCorrections": 1,
|
||||
"mapPixelsChecked": true,
|
||||
"detailPixelsChecked": true,
|
||||
"feedbackAudio": true,
|
||||
"noRepeatedCorrectSlots": true,
|
||||
"heldKey": true,
|
||||
"review": true,
|
||||
"replay": true,
|
||||
"exit": true,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"ramKB": 512,
|
||||
"multipleChoice": 28,
|
||||
"typed": 28,
|
||||
"score": 23,
|
||||
"spellingCorrections": 1,
|
||||
"mapPixelsChecked": true,
|
||||
"detailPixelsChecked": true,
|
||||
"feedbackAudio": true,
|
||||
"noRepeatedCorrectSlots": true,
|
||||
"heldKey": true,
|
||||
"review": true,
|
||||
"replay": true,
|
||||
"exit": true,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba",
|
||||
"diskWrites": 0
|
||||
}
|
||||
],
|
||||
"feedbackAudio": [
|
||||
{
|
||||
"file": "6309-correct-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88651,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
},
|
||||
{
|
||||
"file": "6309-incorrect-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88652,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
},
|
||||
{
|
||||
"file": "6809-correct-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88652,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
},
|
||||
{
|
||||
"file": "6809-incorrect-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88652,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
}
|
||||
],
|
||||
"configurationBuilds": [
|
||||
{
|
||||
"configuration": "Debug",
|
||||
"programEnd": "745B",
|
||||
"diskSHA256": "6e323886ce705997a3886e2ea27a5ac40db2d591a93a2a8f69f176157935be07",
|
||||
"ordinaryBuildWithoutAuthoringInputs": true
|
||||
},
|
||||
{
|
||||
"configuration": "Test",
|
||||
"programEnd": "7402",
|
||||
"diskSHA256": "d3b602d8e7ee36d0eca49c82cd3705d98d13e92bfa239aa245d15bc0ccb7ddb9",
|
||||
"ordinaryBuildWithoutAuthoringInputs": true
|
||||
}
|
||||
],
|
||||
"graphics": {
|
||||
"sourceSHA256": {
|
||||
"src/graphics.c": "e7044af1de881695b06d3eb3cda0387d372cc5b0251d72a42b2255c48f65f9e0",
|
||||
"graphics.h": "432db9ea323eabdff8badb83e15ee6d59f45a8f21f2c593ecbfab025f23a9d47",
|
||||
"tests/graphics_fixture.c": "9445eb27e91d15d0b6a0b6c28316c63e98546f6be5d8a39cbb53f0ea457ed43c",
|
||||
"tests/graphics_arithmetic.c": "97fed0470f309a165588f6ecf44f25998fb1c79f469345a09f46588aa3be21ee",
|
||||
"tests/check_graphics.py": "3965b8f249aa4e5c8810fa3c779dfed67d2742213839a5c2ddc9fbc653f58bb7",
|
||||
"tools/boot.c": "6fba20dc79348b28c951a1323d1aa4e857bc63fd3e898fc8b3eefd69ad077486"
|
||||
},
|
||||
"fixtureDiskSHA256": "a4dc07c314e338848a31026d8c5f5551979d3797b3e2bda79744fb177f4a42a2",
|
||||
"emulatorVersion": "3.6.1",
|
||||
"emulatorBuild": "54",
|
||||
"hostArithmetic": "passed",
|
||||
"tests": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"ramKB": 512,
|
||||
"width": 640,
|
||||
"height": 225,
|
||||
"frameTop": 16,
|
||||
"pageFlips": 3,
|
||||
"frontCopied": true,
|
||||
"noPrematurePresentation": true,
|
||||
"guestPixelsChecked": 576000,
|
||||
"clipping": true,
|
||||
"partialByteEdges": true,
|
||||
"bankBoundaries": true,
|
||||
"MMURestored": true,
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"ramKB": 512,
|
||||
"width": 640,
|
||||
"height": 225,
|
||||
"frameTop": 16,
|
||||
"pageFlips": 3,
|
||||
"frontCopied": true,
|
||||
"noPrematurePresentation": true,
|
||||
"guestPixelsChecked": 576000,
|
||||
"clipping": true,
|
||||
"partialByteEdges": true,
|
||||
"bankBoundaries": true,
|
||||
"MMURestored": true,
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"loader": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"variant": "missing",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"variant": "wrong-size",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"variant": "wrong-checksum",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"variant": "missing",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"variant": "wrong-size",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"variant": "wrong-checksum",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
}
|
||||
],
|
||||
"quitControls": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "title-Q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "credits-Break",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "choice-Q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "typed-q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "typed-ASCII27",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "spelling-Break",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "typed-feedback-Q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"scenario": "auto-feedback-Break",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "title-Q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "credits-Break",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "choice-Q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "typed-q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "typed-ASCII27",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "spelling-Break",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "typed-feedback-Q",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"scenario": "auto-feedback-Break",
|
||||
"BASICReturned": true,
|
||||
"MMURestored": true,
|
||||
"diskWrites": 0,
|
||||
"diskSHA256": "373a3f387daf541b1eb4edd3421a125dd57094e600ee48d162802ac22f65ceba"
|
||||
}
|
||||
],
|
||||
"retainedRegressionNote": "Graphics and loader source unchanged since preceding high-resolution candidate; prior module regressions retained."
|
||||
}
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,220 @@
|
||||
{
|
||||
"date": "2026-11-11",
|
||||
"baseRevision": "3cc37be5fb46b2e45be54ab13f52765c702edc24",
|
||||
"sourceState": "Local 28-structure / 640x225 changes retained for review",
|
||||
"disk": {
|
||||
"file": "BONEQ.DSK",
|
||||
"bytes": 161280,
|
||||
"sha256": "2ef7530ef3d7fc0270e46ef800266fc6ce1557b58a470e3b8e97e3959d428d96"
|
||||
},
|
||||
"configuration": "Release",
|
||||
"programEnd": "73A3",
|
||||
"app": "VCC Plus 3.6.1 (54)",
|
||||
"toolchain": {
|
||||
"CMOC": "0.1.100",
|
||||
"LWTools": "4.25"
|
||||
},
|
||||
"sourceFiles": {
|
||||
"Makefile": "b0e9816d4b1712cd903b1e51ebb5c80901fb45ba4233f6b091e6e97fe5cdd1d7",
|
||||
"assets/generated/BONES.DAT": "8a8a3a84156cb3fd3bd767ee13a2dd267a8f63ec373d9fd3fb99b883020f1bd2",
|
||||
"assets/skeleton-source.svg": "501752c94533439a31521a929a10ad1dd1b781f588d44fc87144c426a38b8773",
|
||||
"data/bones.json": "c4c609fd8a55d503279a728078dd285e2bfb0aaaa0d231a6e097eccafc9bbd50",
|
||||
"data/geometry-manifest.json": "36e0cd424f822f9347c37d79cf97aa15befe17651d07b8c9676d5521c2bcf653",
|
||||
"geometry.h": "6f5671aecc191b68940193b4a4cfedb45de065ec3aebd82b8b780f8f911bd81f",
|
||||
"graphics.h": "432db9ea323eabdff8badb83e15ee6d59f45a8f21f2c593ecbfab025f23a9d47",
|
||||
"main.c": "a948780d1dc842365eb49b9bfef4b1c82fde779b89c3f31c99e75490f0600deb",
|
||||
"map_data.h": "cbe804d68efe6e24226e86243b7c0df7f81898cc24d135c334744bd505e72359",
|
||||
"quiz.h": "664c9b3b967d561c7a11c54a994b0963ffaca7019d2fc06ca812cdd7861c1b44",
|
||||
"src/bones.c": "f533d2ecfbc3fc47f0669ef3cf2f4faec25728958ea71182e42a5893b17b4fed",
|
||||
"src/geometry.c": "32cf6c08bd48bc065280657af29e00f065db6b6d64b053b22818e669c860cf99",
|
||||
"src/graphics.c": "e7044af1de881695b06d3eb3cda0387d372cc5b0251d72a42b2255c48f65f9e0",
|
||||
"src/map_data.c": "e89a4932324f7785d828b50656c557fb1c8fc064b718366c1a4717fd11752a84",
|
||||
"src/quiz.c": "6c5e0e52d24e625dd9593fd2918eb9e86f9e0b842f04edfd6c580fe7844502f5",
|
||||
"src/ui.c": "268bcc4b12e9e9949a1331a89906a39d13e02fb183a771e4bdfcf89342b4761e",
|
||||
"tests/check_assets.py": "890517b520c464553abfe5404c0e839a049441b134c0ee6211b40f9569072ee6",
|
||||
"tests/check_graphics.py": "3965b8f249aa4e5c8810fa3c779dfed67d2742213839a5c2ddc9fbc653f58bb7",
|
||||
"tests/check_loader.py": "81059e960ca9eb507b1a243452d3df2ed22b52c6d211210056cb4afc7776acc4",
|
||||
"tests/graphics_arithmetic.c": "97fed0470f309a165588f6ecf44f25998fb1c79f469345a09f46588aa3be21ee",
|
||||
"tests/graphics_fixture.c": "9445eb27e91d15d0b6a0b6c28316c63e98546f6be5d8a39cbb53f0ea457ed43c",
|
||||
"tests/playtest.py": "3f050f73e7132b3fe7ee2cd721661836f8a8a7ab4b7707d2e45b7d21ca0f30f5",
|
||||
"tests/test_quiz.c": "d923cd7ba61230f4ae0a9e16f8a6d96258d7dd7d89cb78014775a7eb3e5846c0",
|
||||
"tools/boot.c": "6fba20dc79348b28c951a1323d1aa4e857bc63fd3e898fc8b3eefd69ad077486",
|
||||
"tools/prepare_assets.py": "c4569478b00e46f6753b8d0fd610e0fee1ffc257b0be047cac2e2fb3e863ab02",
|
||||
"tools/prepare_questions.py": "c1f51dde59dcc1e1ab596461e9a521ee0b4a37a5cfaa9b0deda3a8ba9fee6f3f",
|
||||
"ui.h": "671d7b56d840713e42441122665670e1c33e689ac0741085b62e5ae71b6dffbc"
|
||||
},
|
||||
"gameplay": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"ramKB": 512,
|
||||
"multipleChoice": 28,
|
||||
"typed": 28,
|
||||
"score": 23,
|
||||
"spellingCorrections": 1,
|
||||
"mapPixelsChecked": true,
|
||||
"detailPixelsChecked": true,
|
||||
"feedbackAudio": true,
|
||||
"noRepeatedCorrectSlots": true,
|
||||
"heldKey": true,
|
||||
"review": true,
|
||||
"replay": true,
|
||||
"exit": true,
|
||||
"diskSHA256": "2ef7530ef3d7fc0270e46ef800266fc6ce1557b58a470e3b8e97e3959d428d96",
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"ramKB": 512,
|
||||
"multipleChoice": 28,
|
||||
"typed": 28,
|
||||
"score": 23,
|
||||
"spellingCorrections": 1,
|
||||
"mapPixelsChecked": true,
|
||||
"detailPixelsChecked": true,
|
||||
"feedbackAudio": true,
|
||||
"noRepeatedCorrectSlots": true,
|
||||
"heldKey": true,
|
||||
"review": true,
|
||||
"replay": true,
|
||||
"exit": true,
|
||||
"diskSHA256": "2ef7530ef3d7fc0270e46ef800266fc6ce1557b58a470e3b8e97e3959d428d96",
|
||||
"diskWrites": 0
|
||||
}
|
||||
],
|
||||
"feedbackAudio": [
|
||||
{
|
||||
"file": "6309-correct-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88652,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
},
|
||||
{
|
||||
"file": "6309-incorrect-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88652,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
},
|
||||
{
|
||||
"file": "6809-correct-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88651,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
},
|
||||
{
|
||||
"file": "6809-incorrect-feedback.wav",
|
||||
"sampleRate": 44100,
|
||||
"frames": 88652,
|
||||
"peak": 16128,
|
||||
"generatedSignal": true,
|
||||
"audibleListening": false
|
||||
}
|
||||
],
|
||||
"configurationBuilds": [
|
||||
{
|
||||
"configuration": "Debug",
|
||||
"programEnd": "73FA",
|
||||
"diskSHA256": "dbe8b50162883450aaf1f740569653eb75b993518a52f93880503a877c76aa67",
|
||||
"ordinaryBuildWithoutAuthoringInputs": true
|
||||
},
|
||||
{
|
||||
"configuration": "Test",
|
||||
"programEnd": "73A8",
|
||||
"diskSHA256": "a80fe3c132aff9eaa1dae02a98903c9eca35b38d8e0b4de6c20cd50586ce2884",
|
||||
"ordinaryBuildWithoutAuthoringInputs": true
|
||||
}
|
||||
],
|
||||
"graphics": {
|
||||
"sourceSHA256": {
|
||||
"src/graphics.c": "e7044af1de881695b06d3eb3cda0387d372cc5b0251d72a42b2255c48f65f9e0",
|
||||
"graphics.h": "432db9ea323eabdff8badb83e15ee6d59f45a8f21f2c593ecbfab025f23a9d47",
|
||||
"tests/graphics_fixture.c": "9445eb27e91d15d0b6a0b6c28316c63e98546f6be5d8a39cbb53f0ea457ed43c",
|
||||
"tests/graphics_arithmetic.c": "97fed0470f309a165588f6ecf44f25998fb1c79f469345a09f46588aa3be21ee",
|
||||
"tests/check_graphics.py": "3965b8f249aa4e5c8810fa3c779dfed67d2742213839a5c2ddc9fbc653f58bb7",
|
||||
"tools/boot.c": "6fba20dc79348b28c951a1323d1aa4e857bc63fd3e898fc8b3eefd69ad077486"
|
||||
},
|
||||
"fixtureDiskSHA256": "a4dc07c314e338848a31026d8c5f5551979d3797b3e2bda79744fb177f4a42a2",
|
||||
"emulatorVersion": "3.6.1",
|
||||
"emulatorBuild": "54",
|
||||
"hostArithmetic": "passed",
|
||||
"tests": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"ramKB": 512,
|
||||
"width": 640,
|
||||
"height": 225,
|
||||
"frameTop": 16,
|
||||
"pageFlips": 3,
|
||||
"frontCopied": true,
|
||||
"noPrematurePresentation": true,
|
||||
"guestPixelsChecked": 576000,
|
||||
"clipping": true,
|
||||
"partialByteEdges": true,
|
||||
"bankBoundaries": true,
|
||||
"MMURestored": true,
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"ramKB": 512,
|
||||
"width": 640,
|
||||
"height": 225,
|
||||
"frameTop": 16,
|
||||
"pageFlips": 3,
|
||||
"frontCopied": true,
|
||||
"noPrematurePresentation": true,
|
||||
"guestPixelsChecked": 576000,
|
||||
"clipping": true,
|
||||
"partialByteEdges": true,
|
||||
"bankBoundaries": true,
|
||||
"MMURestored": true,
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"loader": [
|
||||
{
|
||||
"cpu": "6809",
|
||||
"variant": "missing",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"variant": "wrong-size",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6809",
|
||||
"variant": "wrong-checksum",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"variant": "missing",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"variant": "wrong-size",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
},
|
||||
{
|
||||
"cpu": "6309",
|
||||
"variant": "wrong-checksum",
|
||||
"BASICReturned": true,
|
||||
"diskWrites": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
# High-resolution Bone Quest verification — November 11, 2026
|
||||
|
||||
## Candidate and builds
|
||||
|
||||
The current candidate is a 35-track DECB disk, 161,280 bytes, SHA-256:
|
||||
|
||||
`2ef7530ef3d7fc0270e46ef800266fc6ce1557b58a470e3b8e97e3959d428d96`
|
||||
|
||||
Source base: 3cc37be5fb46b2e45be54ab13f52765c702edc24 plus the reviewable
|
||||
28-structure/high-resolution changes in this checkout. Selected source hashes
|
||||
and final check summaries are recorded in VERIFICATION.json.
|
||||
|
||||
Built with installed VCC Plus 3.6.1 (54), bundled CMOC 0.1.100 and LWTools 4.25.
|
||||
Release program/static storage ends at $73A3; Debug at $73FA; Test at $73A8.
|
||||
All remain below the $7800 limit, with the separate 2 KB stack below $8000.
|
||||
Debug and Test were built in separate minimal folders without the original SVG,
|
||||
Python, Pillow or asset-conversion scripts as build inputs.
|
||||
|
||||
The display is native 640 × 225, four colors, with two 36,000-byte images in
|
||||
40 KiB reservations ($1E–$27). Artwork uses the bank library's separate $28–$2B
|
||||
reservation. BONES.DAT is 16,640 bytes; compiled geometry metadata is 552 bytes.
|
||||
The loader reads the file once, verifies size/checksum and never writes to disk.
|
||||
Ordinary builds use the retained metadata and drawing file.
|
||||
|
||||
## Logic and artwork
|
||||
|
||||
make test passed 56,000 option sets across 2,000 complete shuffled 28-topic
|
||||
orders: unique topics/options, no consecutive correct-slot repeats, all allowed
|
||||
transitions, replay reset, aliases, known-wrong-name priority, spelling, scoring
|
||||
and duplicate-answer protection. Canonical bank/generated C identity, the
|
||||
original SVG hash, external artwork SHA-256/checksum, six disjoint bounded views,
|
||||
and visible coverage for every overview/selected-detail topic also passed.
|
||||
|
||||
## Graphics and loading regressions
|
||||
|
||||
The retained tests/check_graphics.py fixture passed on both guest CPUs. It checks
|
||||
576,000 actual guest pixels per CPU across four observations and three
|
||||
presentations: packed 2-bit edges, all 8 KiB seams, fifth-bank rows, clipping,
|
||||
page flips, complete front-to-back copies, edits staying hidden until present,
|
||||
stock MMU restoration, BASIC return and zero writes. Its host arithmetic check
|
||||
compares the actual rectangle function against an independent pixel reference
|
||||
for all horizontal positions/widths on 15 critical rows and 1,000 clipped
|
||||
multirow rectangles.
|
||||
|
||||
The retained tests/check_loader.py checks passed on both CPUs: missing artwork,
|
||||
wrong file size and wrong checksum all return to BASIC with a clear error and
|
||||
zero guest disk writes. Tests modify disposable in-memory copies only.
|
||||
|
||||
## Actual gameplay
|
||||
|
||||
The actual Release disk completed a full 28-question multiple-choice round and
|
||||
a full 28-question typed-answer round on each emulated MC6809 and HD6309. Both
|
||||
reported zero disk writes and preserved the exact disk hash.
|
||||
|
||||
The driver reads the actual displayed text and checks the full skeleton and
|
||||
enlarged detail pixels against the current question and answer history. Checks
|
||||
include all 28 highlights, white normal/correct structures, yellow current,
|
||||
red missed, four readable choices, no repeated correct slot, held-key release,
|
||||
common aliases, case/spacing, spelling retry/Backspace, the 33-character bound,
|
||||
reveal, 23/28 (82%) scoring, one correction, paged review, replay and BASIC exit.
|
||||
Separate correct/incorrect feedback captures verify nonzero guest audio samples;
|
||||
this establishes generated signal, not audible listening. Personal emulator
|
||||
settings/media and desktop input are untouched.
|
||||
|
||||
To repeat developer checks, supply your own private ROM paths:
|
||||
|
||||
```sh
|
||||
python3 tests/playtest.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
python3 tests/check_graphics.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
python3 tests/check_loader.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
```
|
||||
|
||||
Raw logs/captures and ROM inputs are excluded from Git. Selected unmodified guest
|
||||
frames are in images/ with matching hashes and disk identity in SCREENSHOTS.json.
|
||||
At 640 × 225, the helper's active image starts at output (0,16), with two output
|
||||
rows per guest row. These are game frames rather than native-window captures.
|
||||
|
||||
No physical CoCo, host Intel, macOS 14, native editor/source-open UI or audible
|
||||
listening qualification is claimed. The original 25-topic candidate's evidence
|
||||
is preserved in testing/INITIAL_25_TOPICS.md and its original source revision.
|
||||
@@ -0,0 +1,68 @@
|
||||
Historical verification for the original 25-topic candidate at source revision
|
||||
3cc37be5fb46b2e45be54ab13f52765c702edc24. Its disk and matching screenshots
|
||||
remain in that revision. See ../TESTING.md for current high-resolution results.
|
||||
|
||||
# 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.
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef BONE_GEOMETRY_H
|
||||
#define BONE_GEOMETRY_H
|
||||
/* Read-only disk art is loaded once into the SDK's dedicated asset banks. */
|
||||
extern unsigned char geometry_failed;
|
||||
unsigned char geometry_open(void);
|
||||
unsigned char geometry_byte(unsigned offset);
|
||||
void geometry_close(void);
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#ifndef BONE_GRAPHICS_H
|
||||
#define BONE_GRAPHICS_H
|
||||
#define GFX_WIDTH 640
|
||||
#define GFX_HEIGHT 225
|
||||
|
||||
/* Bone Quest's local four-color GIME driver, adapted from VCC Plus's GPL SDK.
|
||||
Open from stock IRQ-enabled CoCo 3 BASIC text, with at least 512 KiB RAM.
|
||||
Code/globals/stack must be below $8000. Both pages reserve physical blocks
|
||||
$1E-$27 ($3C000-$4FFFF, 80 KiB); the bank library's $28-$2B remain available.
|
||||
Drawing borrows task 0's $8000 window briefly and restores it and CC before
|
||||
returning. Do not change the MMU/video registers or call from an interrupt.
|
||||
Coordinates and rectangles clip to 640x225; palette slots are 0..3.
|
||||
A successful present flips on BASIC's vertical interrupt and draws into the
|
||||
former front page, whose contents persist. Close restores BASIC and palette. */
|
||||
unsigned char gfx_open(void);
|
||||
void gfx_fill_rect(unsigned x,unsigned y,unsigned w,unsigned h,unsigned char color);
|
||||
void gfx_plot(unsigned x,unsigned y,unsigned char color);
|
||||
void gfx_clear(unsigned char color);
|
||||
void gfx_set_palette(unsigned char slot,unsigned char rgb);
|
||||
/* Copy the displayed image into the hidden page without showing/flipping it.
|
||||
Mapping and interrupt state are restored between each 32-byte chunk.
|
||||
Returns 0 while closed; 1 after copying all 36,000 visible bytes. */
|
||||
unsigned char gfx_copy_front(void);
|
||||
unsigned char gfx_present(void);
|
||||
void gfx_close(void);
|
||||
#endif
|
||||
@@ -1,98 +1,103 @@
|
||||
/* Bone Quest — based on Brian Holman's GPL-3.0-or-later Capital Quest. */
|
||||
#include <cmoc.h>
|
||||
#include <coco.h>
|
||||
#include <vcc/gime.h>
|
||||
#include "graphics.h"
|
||||
#include "geometry.h"
|
||||
#include "quiz.h"
|
||||
#include "ui.h"
|
||||
static char line[54],answer[ANSWER_SIZE];
|
||||
static U8 mode,spelling_attempt;
|
||||
U8 phase,current_bone;
|
||||
void quit_game(void)
|
||||
{
|
||||
release_keys();close_input();gfx_close();geometry_close();setHighSpeed(FALSE);
|
||||
printf("Thanks for playing Bone Quest!\n");exit(0);
|
||||
}
|
||||
static void present(void)
|
||||
{
|
||||
if(!gime_present()){gime_close();setHighSpeed(FALSE);printf("Graphics timer stopped.\n");exit(1);}
|
||||
if(geometry_failed || !gfx_present()){gfx_close();geometry_close();setHighSpeed(FALSE);printf("Graphics or artwork stopped.\n");exit(1);}
|
||||
}
|
||||
static U8 choose(const char *allowed)
|
||||
static U8 choose(const char *allowed,U8 ready_phase)
|
||||
{
|
||||
U8 c;release_keys();
|
||||
U8 c;phase=7;release_keys();phase=ready_phase;
|
||||
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(" ");
|
||||
phase=7;frame("CREDITS");
|
||||
text(16,21,"A JOURNEY THROUGH THE SKELETON",2);
|
||||
text(16,42,"Skeleton: Mariana Ruiz Villarreal",1);
|
||||
text(16,54,"(LadyofHats), public-domain artwork.",1);
|
||||
text(16,70,"Wikimedia Commons:",1);
|
||||
text(16,82,"Human_skeleton_front_en.svg",1);
|
||||
text(16,99,"Adapted: labels removed, reduced, recolored;",1);
|
||||
text(16,110,"bone masks and enlarged details prepared.",1);
|
||||
text(16,129,"Font / boot: Pierre Sarrazin, public domain.",1);
|
||||
text(16,143,"Based on Capital Quest by Brian Holman.",1);
|
||||
text(16,155,"Game GPL-3.0-or-later. See assets/CREDITS.md",1);
|
||||
text(16,212,"SPACE: back Q/Esc/Break: quit",2);present();choose(" ",5);
|
||||
}
|
||||
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();
|
||||
phase=7;frame("HUMAN ANATOMY");show_skeleton(255,0);
|
||||
text(224,35,"28 STRUCTURES",2);
|
||||
text(224,54,"1 MULTIPLE CHOICE",1);
|
||||
text(224,75,"2 TYPE THE NAME",1);
|
||||
text(224,101,"C CREDITS",1);text(224,117,"Q QUIT TO BASIC",1);
|
||||
text(224,143,"Find the yellow part.",1);
|
||||
text(224,155,"Learn from each answer.",1);
|
||||
text(224,169,"512 KB COCO 3 / RGB",2);
|
||||
text(16,216,"1/2: start Q/Esc/Break: quit",1);
|
||||
present();c=choose("12CQ",0);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);
|
||||
phase=7;frame(mode==1?"MULTIPLE CHOICE":"TYPE THE NAME");
|
||||
sprintf(line,"Question %u/%u Score %u",(unsigned)question+1,BONE_COUNT,(unsigned)score);text(16,19,line,1);
|
||||
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);
|
||||
text(224,140,"Name the yellow structure.",2);
|
||||
text(224,153,bones[current_bone].hint,1);
|
||||
text(16,216,"Yellow:current Red:missed Q/Esc/Break:quit",1);
|
||||
}
|
||||
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);
|
||||
for(i=0;i<4;++i){sprintf(line,"%u %s",(unsigned)i+1,bones[options[i]].name);text(224,168+i*11,line,1);}
|
||||
present();c=choose("1234",1)-'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();
|
||||
gfx_fill_rect(216,166,424,48,0);text(224,168,answer,1);
|
||||
text(224+strlen(answer)*12,168,"_",2);
|
||||
text(224,183,too_long?"Use Backspace to edit.":"Enter:submit Q/Esc:quit",1);
|
||||
text(224,196,"Blank Enter: show answer.",1);
|
||||
text(224,208,"Backspace edits; case ignored.",1);present();
|
||||
}
|
||||
static void input_edit(U8 old_n,U8 new_n)
|
||||
{
|
||||
U8 p,first=old_n<new_n?old_n:new_n;
|
||||
for(p=0;p<2;++p){gime_fill_rect(112+(unsigned)first*6,132,12,8,1);text(112+(unsigned)first*6,132,answer+first,7);text(112+(unsigned)new_n*6,132,"_",6);present();}
|
||||
for(p=0;p<2;++p){gfx_fill_rect(224+(unsigned)first*12,168,24,8,0);text(224+(unsigned)first*12,168,answer+first,1);text(224+(unsigned)new_n*12,168,"_",2);present();}
|
||||
}
|
||||
static U8 typed_answer(void)
|
||||
{
|
||||
U8 c,n=0,result,old_n;answer[0]=0;spelling_attempt=0;
|
||||
question_screen();input_screen(0);question_screen();input_screen(0);release_keys();
|
||||
question_screen();input_screen(0);gfx_copy_front();release_keys();phase=1;
|
||||
for(;;){
|
||||
c=next_key();release_keys();
|
||||
if(c==3 || c==27){strcpy(answer,"[revealed]");return 0;}
|
||||
if(c==8 || c==127){old_n=n;if(n)answer[--n]=0;input_edit(old_n,n);}
|
||||
else if(c==13 || c==10){
|
||||
result=classify(current_bone,answer);if(result==2)return 1;if(result==0)return 0;
|
||||
question_screen();phase=2;
|
||||
text(112,133,"That looks close.",6);text(112,144,"Check your spelling.",7);
|
||||
text(112,158,"R:retry V:reveal",7);text(112,171,"No point awarded yet.",2);
|
||||
present();c=choose("RV");if(c=='V')return 0;spelling_attempt=1;
|
||||
question_screen();input_screen(0);question_screen();input_screen(0);release_keys();
|
||||
gfx_copy_front();gfx_fill_rect(216,166,424,48,0);phase=2;
|
||||
text(224,169,"That looks close.",2);text(224,181,"Check your spelling.",1);
|
||||
text(224,196,"R:retry V:reveal",1);text(224,208,"No point awarded yet.",1);
|
||||
present();c=choose("RV",2);if(c=='V')return 0;spelling_attempt=1;
|
||||
gfx_copy_front();input_screen(0);gfx_copy_front();release_keys();phase=1;
|
||||
}else if((c>='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);}
|
||||
@@ -106,46 +111,46 @@ static void answer_sound(U8 right)
|
||||
}
|
||||
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(" ");
|
||||
gfx_copy_front();gfx_fill_rect(216,166,424,48,0);phase=3;
|
||||
text(224,170,right?"CORRECT!":"NOT THIS TIME.",right?2:3);
|
||||
text(224,183,bones[current_bone].name,1);
|
||||
text(224,201,mode==1?"Next follows automatically.":"SPACE: next question",1);
|
||||
present();answer_sound(right);if(mode==1)pause_or_quit(90);else choose(" ",3);
|
||||
}
|
||||
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;
|
||||
phase=7;frame("YOUR RESULTS");show_skeleton(255,1);
|
||||
text(224,35,"SKELETON COMPLETE",2);
|
||||
sprintf(line,"%u / %u correct %u%%",(unsigned)score,BONE_COUNT,(unsigned)score*100/BONE_COUNT);text(224,55,line,1);
|
||||
sprintf(line,"%u spelling corrections",(unsigned)corrections);text(224,77,line,1);
|
||||
sprintf(line,"%u topics to revisit",(unsigned)missed);text(224,93,line,1);
|
||||
text(224,118,"R REVIEW MISSED TOPICS",2);text(224,138,"P PLAY AGAIN",1);text(224,158,"Q QUIT TO BASIC",1);
|
||||
text(16,216,"Every topic once. Q/Esc/Break: quit",1);present();c=choose("RPQ",4);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;
|
||||
phase=7;frame("MISSED TOPICS");sprintf(line,"Review page %u",(unsigned)page+1);text(16,19,line,2);i=start;c=0;
|
||||
while(i<BONE_COUNT && c<3){
|
||||
if(!correct[order[i]]){
|
||||
text(8,39+c*43,bones[order[i]].name,6);
|
||||
sprintf(line,"You: %s",responses[order[i]][0]?(const char *)responses[order[i]]:"[blank]");text(8,50+c*43,line,7);
|
||||
sprintf(line,"Answer: %s",bones[order[i]].name);text(8,61+c*43,line,2);++c;
|
||||
text(16,39+c*43,bones[order[i]].name,2);
|
||||
sprintf(line,"You: %s",responses[order[i]][0]?(const char *)responses[order[i]]:"[blank]");text(16,50+c*43,line,1);
|
||||
sprintf(line,"Answer: %s",bones[order[i]].name);text(16,61+c*43,line,1);++c;
|
||||
}++i;
|
||||
}
|
||||
while(i<BONE_COUNT && correct[order[i]])++i;
|
||||
if(!missed)text(8,60,"A perfect skeleton! No missed bones.",7);
|
||||
text(8,180,i<BONE_COUNT?"N NEXT PAGE B BACK TO RESULTS":"B BACK TO RESULTS",6);present();c=choose(i<BONE_COUNT?"NB":"B");if(c=='B')break;start=i;++page;
|
||||
if(!missed)text(16,60,"A perfect skeleton! No missed topics.",1);
|
||||
text(16,212,i<BONE_COUNT?"N NEXT B BACK Q/Esc/Break QUIT":"B BACK Q/Esc/Break QUIT",2);present();c=choose(i<BONE_COUNT?"NB":"B",6);if(c=='B')break;start=i;++page;
|
||||
}
|
||||
}
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
U8 c,right;unsigned seed;
|
||||
if(!gime_open()){printf("Requires 512 KB CoCo 3 in BASIC.\n");return 1;}
|
||||
if(!gfx_open()){printf("Requires 512 KB CoCo 3 in BASIC.\n");return 1;}
|
||||
gfx_set_palette(0,0);gfx_set_palette(1,63);gfx_set_palette(2,54);gfx_set_palette(3,36);
|
||||
if(!geometry_open()){gfx_close();printf("Cannot load BONES.DAT from drive 0.\n");return 1;}
|
||||
setHighSpeed(TRUE);
|
||||
gime_set_palette(0,1);gime_set_palette(1,3);gime_set_palette(2,56);gime_set_palette(3,28);
|
||||
gime_set_palette(4,14);gime_set_palette(5,39);gime_set_palette(6,54);gime_set_palette(7,63);
|
||||
for(;;){
|
||||
c=title();if(c=='Q')break;mode=c-'0';seed=entropy^getTimer();
|
||||
#ifdef TEST_SEED
|
||||
@@ -155,5 +160,5 @@ int main(void)
|
||||
for(question=0;question<BONE_COUNT;++question){current_bone=order[question];spelling_attempt=0;right=mode==1?multiple_choice():typed_answer();quiz_record(current_bone,answer,right,spelling_attempt);feedback(right);}
|
||||
if(results()=='Q')break;
|
||||
}
|
||||
release_keys();close_input();gime_close();setHighSpeed(FALSE);printf("Thanks for playing Bone Quest!\n");return 0;
|
||||
quit_game();return 0;
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
#ifndef BONE_MAP_DATA_H
|
||||
#define BONE_MAP_DATA_H
|
||||
#define BONE_MAP_WIDTH 64
|
||||
#define BONE_MAP_HEIGHT 149
|
||||
#define BONE_MAP_WIDTH 159
|
||||
#define BONE_MAP_HEIGHT 184
|
||||
#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];
|
||||
#define BONE_CONTEXT_INDEX 28
|
||||
#define BONE_INK_INDEX 29
|
||||
#define BONE_DRAW_COUNT 30
|
||||
/* Each nonempty owner block starts y,x; then (skip,length) pairs. Skip255
|
||||
escapes 16-bit big-endian skip. Gaps are row-major from the previous run end.
|
||||
Offsets index bytes within each view,31 entries perview.
|
||||
View bytes live in external BONES.DAT, starting at bone_view_data_offsets.
|
||||
Native 640x225 pixels have1:2 width:height aspect; source masks are fitted accordingly. Context is neutral; ink is black.
|
||||
The black canvas supplies exterior contours; stored ink preserves internal lines.
|
||||
Boxes: xmin,ymin,width,height in overview pixels. View0=overview,1=head,
|
||||
2=hand,3=foot,4=pelvis/lowerback,5=chest. Selector 0 uses an overview crop. */
|
||||
extern const unsigned char bone_boxes[28][4];
|
||||
extern const unsigned char bone_detail_view[28];
|
||||
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 bone_view_data_offsets[BONE_VIEW_COUNT];
|
||||
extern const unsigned bone_asset_size, bone_asset_checksum;
|
||||
extern const unsigned * const bone_view_offsets[BONE_VIEW_COUNT];
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef QUIZ_H
|
||||
#define QUIZ_H
|
||||
#define BONE_COUNT 25
|
||||
#define ANSWER_SIZE 40
|
||||
#define BONE_COUNT 28
|
||||
#define ANSWER_SIZE 34
|
||||
typedef unsigned char U8;
|
||||
typedef struct { const char *name; const char *hint; const char *aliases; } Bone;
|
||||
extern const Bone bones[BONE_COUNT];
|
||||
|
||||
@@ -1,29 +1,32 @@
|
||||
/* Generated from data/bones.json; labels/codes remain in the authoring data. */
|
||||
/* Generated from data/bones.json; labels/codes/kinds remain in authoring data. */
|
||||
#include "quiz.h"
|
||||
const Bone bones[BONE_COUNT] = {
|
||||
{"Cranium", "Head above the lower jaw", "skull"},
|
||||
{"Mandible", "Lower jaw", "lower jaw|jawbone"},
|
||||
{"Clavicle", "Front of the shoulder", "collarbone|collar bone"},
|
||||
{"Scapula", "Back of the shoulder", "shoulder blade|shoulderblade"},
|
||||
{"Sternum", "Center of the chest", "breastbone|breast bone"},
|
||||
{"Ribs", "Curving around the chest", "rib|rib bones"},
|
||||
{"Skull", "Head, including the lower jaw", "cranium"},
|
||||
{"Cervical vertebrae", "Neck section of the spine", "neck vertebrae|cervical vertebra"},
|
||||
{"Thoracic vertebrae", "Upper and middle back", "thoracic vertebra"},
|
||||
{"Manubrium", "Upper breastbone section", "manubrium sterni"},
|
||||
{"Body of sternum", "Middle breastbone section", "sternal body|sternum body"},
|
||||
{"Xiphoid process", "Small tip of the breastbone", "xiphoid"},
|
||||
{"Lumbar vertebrae", "Lower back", "lumbar vertebra|lower back vertebrae"},
|
||||
{"Ilium", "Upper flared part of the hip", ""},
|
||||
{"Sacrum", "Base of spine above tailbone", "sacral bone"},
|
||||
{"Coccyx", "Small tip below the sacrum", "tailbone|tail bone"},
|
||||
{"Pelvic girdle", "Hip region, on either side", "hip bones|hip girdle|coxal bones"},
|
||||
{"Humerus", "Upper arm", "upper arm bone"},
|
||||
{"Radius", "Forearm, thumb side", "radius bone"},
|
||||
{"Ulna", "Forearm, little-finger side", "ulna bone"},
|
||||
{"Carpals", "Wrist", "wrist bones|carpal bones"},
|
||||
{"Metacarpals", "Palm between wrist and fingers", "palm bones|metacarpal bones"},
|
||||
{"Finger phalanges", "Digits of the hand", "finger bones|hand phalanges"},
|
||||
{"Pubis", "Front lower part of the hip", "pubic bone"},
|
||||
{"Femur", "Thigh", "thighbone|thigh bone"},
|
||||
{"Patella", "Front of the knee", "kneecap|knee cap"},
|
||||
{"Tibia", "Lower leg, inner side", "shinbone|shin bone"},
|
||||
{"Fibula", "Lower leg, outer side", "calf bone|calfbone"},
|
||||
{"Tarsals", "Rear foot and ankle", "ankle bones|tarsal bones"},
|
||||
{"Metatarsals", "Mid-foot behind the toes", "metatarsal bones"},
|
||||
{"Tarsals", "Rear foot and ankle", "tarsus|ankle bones|tarsal bones"},
|
||||
{"Metatarsals", "Mid-foot behind the toes", "metatarsus|metatarsal bones"},
|
||||
{"Toe phalanges", "Digits of the foot", "toe bones|foot phalanges"},
|
||||
{"Orbital cavity", "Bony space around the eye", "eye socket|orbit"},
|
||||
{"Nasal cavity", "Space behind the nose", "nose cavity"},
|
||||
{"Clavicle", "Front of the shoulder", "collarbone|collar bone"},
|
||||
{"Scapula", "Back of the shoulder", "shoulder blade|shoulderblade"},
|
||||
{"Ribs", "Curving around the chest", "rib|rib bones"},
|
||||
{"Humerus", "Upper arm", "upper arm bone"},
|
||||
{"Ulna", "Forearm, little-finger side", "ulna bone"},
|
||||
{"Radius", "Forearm, thumb side", "radius bone"},
|
||||
{"Carpals", "Wrist", "carpus|wrist bones|carpal bones"},
|
||||
{"Metacarpals", "Palm between wrist and fingers", "metacarpus|palm bones|metacarpal bones"},
|
||||
{"Finger phalanges", "Digits of the hand", "finger bones|hand phalanges"},
|
||||
{"Fibula", "Lower leg, outer side", "calf bone|calfbone"},
|
||||
{"Tibia", "Lower leg, inner side", "shinbone|shin bone"},
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Bone Quest banked drawing loader. GPL-3.0-or-later.
|
||||
Uses Pierre Sarrazin's public-domain ROM-backed DECB API and VCC Plus bank API.
|
||||
BONES.DAT is read once; no file creation, writes, or standalone Disk BASIC code. */
|
||||
#include <cmoc.h>
|
||||
#include <decbfile.h>
|
||||
#include <vcc/bank.h>
|
||||
#include "geometry.h"
|
||||
#include "map_data.h"
|
||||
static DECBDrive drive;
|
||||
static byte cache[256];
|
||||
static unsigned cache_at=65535;
|
||||
static byte ready;
|
||||
byte geometry_failed;
|
||||
byte geometry_open(void)
|
||||
{
|
||||
DECBFile file;unsigned sectors,offset,sum=0,i;unsigned long length;
|
||||
byte opened=0,ok=0;
|
||||
geometry_failed=0;
|
||||
if(ready || !bank_open())return 0;
|
||||
if(decb_init(&drive,1)!=DECB_OK){bank_close();return 0;}
|
||||
if(decb_registerDrive(0)!=DECB_OK)goto done;
|
||||
if(decb_openSectorFile(&file,0,"BONES.DAT")!=DECB_OK)goto done;
|
||||
opened=1;
|
||||
/* This API returns a granule count, with 255 indicating failure. */
|
||||
if(decb_getOpenFileSize(&file,§ors,&length)==255 || length!=bone_asset_size || bone_asset_size> BANK_CAPACITY || bone_asset_size%256)goto done;
|
||||
for(offset=0;offset<bone_asset_size;offset+=256){
|
||||
if(decb_readSector(&file,cache,offset/256)!=DECB_OK)goto done;
|
||||
for(i=0;i<256;++i)sum+=cache[i];
|
||||
if(!bank_write(offset,cache,256))goto done;
|
||||
}
|
||||
if(sum!=bone_asset_checksum)goto done;
|
||||
ok=1;
|
||||
done:
|
||||
if(opened && decb_closeSectorFile(&file)!=DECB_OK)ok=0;
|
||||
decb_shutdown();
|
||||
if(!ok){bank_close();return 0;}
|
||||
cache_at=65535;ready=1;geometry_failed=0;return 1;
|
||||
}
|
||||
byte geometry_byte(unsigned offset)
|
||||
{
|
||||
unsigned aligned=offset&0xff00;
|
||||
if(!ready || offset>=bone_asset_size){geometry_failed=1;return 0;}
|
||||
if(aligned!=cache_at){
|
||||
if(!bank_read(aligned,cache,256)){geometry_failed=1;return 0;}
|
||||
cache_at=aligned;
|
||||
}
|
||||
return cache[offset&255];
|
||||
}
|
||||
void geometry_close(void)
|
||||
{
|
||||
if(ready)bank_close();ready=0;cache_at=65535;
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Bone Quest adaptation, November 11, 2026, of VCC Plus sdk/cmoc/gime/gime.c.
|
||||
// Upstream checkout revision: f1ab8538a5b6b88a82951e9305db349a470a4e86
|
||||
// Upstream file SHA-256: 3a4ec27d3bc19cf59b1bcf23ae9ccb89aa308731e97ec12ef9609516c323859d
|
||||
// Changes: 640x225 four-color pixels, five banks per page, bounded front-to-back
|
||||
// copies, and BASIC border restoration. This local driver does not change the VCC Plus SDK contract.
|
||||
#include "graphics.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
#define REG(addr) (*(byte *)(addr))
|
||||
|
||||
#define FIRST_PAGE 0x1e
|
||||
#define SECOND_PAGE 0x23
|
||||
#define WINDOW 0x8000
|
||||
|
||||
static byte back; // Zero when closed; otherwise an 8 KiB block number.
|
||||
static byte palette[16];
|
||||
static byte copyBuffer[32];
|
||||
static const byte *textImage;
|
||||
|
||||
// program_end is provided by CMOC's linker script. While bank 4 is mapped,
|
||||
// neither an instruction fetch nor a stack access may land in the window.
|
||||
static asm byte lowProgramAndStack(void)
|
||||
{
|
||||
asm {
|
||||
program_end import
|
||||
ldx #program_end
|
||||
cmpx #$8000
|
||||
bhi @reject
|
||||
cmps #$8000
|
||||
bhi @reject
|
||||
tfr cc,b
|
||||
bitb #$10
|
||||
bne @reject
|
||||
ldb #1
|
||||
rts
|
||||
@reject clrb
|
||||
}
|
||||
}
|
||||
|
||||
// A real 128 KiB GIME accepts the same MMU register writes as a 512 KiB
|
||||
// machine, but blocks $20 and $30 alias. Change just one byte reversibly.
|
||||
// An inactive window (for instance, wrong task) also fails this test.
|
||||
static asm byte independentBanks(void)
|
||||
{
|
||||
asm {
|
||||
pshs cc
|
||||
orcc #$50
|
||||
lda >$ffa4
|
||||
pshs a
|
||||
lda #$30
|
||||
sta >$ffa4
|
||||
lda >$9555
|
||||
pshs a
|
||||
lda #$20
|
||||
sta >$ffa4
|
||||
lda >$9555
|
||||
pshs a
|
||||
coma
|
||||
sta >$9555
|
||||
cmpa >$9555
|
||||
bne @alias
|
||||
lda #$30
|
||||
sta >$ffa4
|
||||
ldb >$9555
|
||||
cmpb 1,s
|
||||
bne @alias
|
||||
ldb #1
|
||||
bra @restore
|
||||
@alias clrb
|
||||
@restore
|
||||
lda #$20
|
||||
sta >$ffa4
|
||||
puls a
|
||||
sta >$9555
|
||||
leas 1,s
|
||||
puls a
|
||||
sta >$ffa4
|
||||
puls cc
|
||||
}
|
||||
}
|
||||
|
||||
// BASIC's 16-bit TIMER is incremented by its vertical interrupt handler.
|
||||
// Poll the complete word, including through wraparound, with interrupts live.
|
||||
// Pages start on 8 KiB boundaries, so their low video offset is zero.
|
||||
// Flipping therefore needs one high-offset store.
|
||||
// The countdown makes missing IRQs a recoverable error.
|
||||
static byte field(byte offsetHigh, byte flip)
|
||||
{
|
||||
asm {
|
||||
ldd >$0112
|
||||
ldx #$2000
|
||||
@wait cmpd >$0112
|
||||
bne @blank
|
||||
leax -1,x
|
||||
bne @wait
|
||||
clrb
|
||||
bra @done
|
||||
@blank tst :flip
|
||||
beq @success
|
||||
ldb :offsetHigh
|
||||
stb >$ff9d
|
||||
@success
|
||||
ldb #1
|
||||
@done stb :flip
|
||||
}
|
||||
return flip;
|
||||
}
|
||||
|
||||
// Paint at most one scan-line fragment in one bank. Four 2-bit pixels fit
|
||||
// in each byte; preserve neighboring pixels at partial byte edges. Interrupts
|
||||
// stay masked only for the short mapping interval (at most 160 full bytes).
|
||||
static void span(byte bank, unsigned address, byte firstMask, byte fullBytes,
|
||||
byte lastMask, byte packed)
|
||||
{
|
||||
asm {
|
||||
pshs cc
|
||||
orcc #$50
|
||||
lda >$ffa4
|
||||
nop
|
||||
pshs a
|
||||
lda :bank
|
||||
sta >$ffa4
|
||||
ldx :address
|
||||
tst :firstMask
|
||||
beq @full
|
||||
lda :firstMask
|
||||
coma
|
||||
anda ,x
|
||||
pshs a
|
||||
lda :packed
|
||||
anda :firstMask
|
||||
ora ,s+
|
||||
sta ,x+
|
||||
@full ldb :fullBytes
|
||||
beq @last
|
||||
lda :packed
|
||||
@loop sta ,x+
|
||||
decb
|
||||
bne @loop
|
||||
@last tst :lastMask
|
||||
beq @done
|
||||
lda :lastMask
|
||||
coma
|
||||
anda ,x
|
||||
pshs a
|
||||
lda :packed
|
||||
anda :lastMask
|
||||
ora ,s+
|
||||
sta ,x
|
||||
@done puls a
|
||||
sta >$ffa4
|
||||
puls cc
|
||||
}
|
||||
}
|
||||
|
||||
void gfx_fill_rect(unsigned x, unsigned y, unsigned w, unsigned h, byte color)
|
||||
{
|
||||
unsigned rowByte;
|
||||
byte packed;
|
||||
if (!back || color > 3 || x >= GFX_WIDTH || y >= GFX_HEIGHT || !w || !h)
|
||||
return;
|
||||
if (w > GFX_WIDTH - x) w = GFX_WIDTH - x;
|
||||
if (h > GFX_HEIGHT - y) h = GFX_HEIGHT - y;
|
||||
packed = color | (color << 2);
|
||||
packed |= packed << 4;
|
||||
// A pixel index y*640 would overflow the CoCo's 16-bit unsigned int.
|
||||
// Byte addresses stay below 36,000 even on the final scan line.
|
||||
rowByte = y * 160u + (x >> 2);
|
||||
while (h--) {
|
||||
unsigned offset = rowByte;
|
||||
unsigned remaining = w;
|
||||
byte first = (byte)(x & 3);
|
||||
while (remaining) {
|
||||
unsigned inBank = offset & 0x1fff;
|
||||
unsigned count = ((0x2000u - inBank) << 2) - first;
|
||||
unsigned rest;
|
||||
byte firstCount = 0, firstMask = 0, lastMask = 0, tail;
|
||||
if (count > remaining) count = remaining;
|
||||
if (first || count < 4) {
|
||||
firstCount = 4 - first;
|
||||
if (firstCount > count) firstCount = (byte)count;
|
||||
firstMask = (byte)((0xffu >> (first << 1)) &
|
||||
(0xffu << ((4 - first - firstCount) << 1)));
|
||||
}
|
||||
rest = count - firstCount;
|
||||
tail = (byte)(rest & 3);
|
||||
if (tail) lastMask = (byte)(0xffu << ((4 - tail) << 1));
|
||||
span((byte)(back + (offset >> 13)), WINDOW + inBank,
|
||||
firstMask, (byte)(rest >> 2), lastMask, packed);
|
||||
offset += (first + count) >> 2;
|
||||
first = (byte)((first + count) & 3);
|
||||
remaining -= count;
|
||||
}
|
||||
rowByte += 160;
|
||||
}
|
||||
}
|
||||
|
||||
void gfx_plot(unsigned x, unsigned y, byte color)
|
||||
{
|
||||
gfx_fill_rect(x, y, 1, 1, color);
|
||||
}
|
||||
|
||||
void gfx_clear(byte color)
|
||||
{
|
||||
gfx_fill_rect(0, 0, GFX_WIDTH, GFX_HEIGHT, color);
|
||||
}
|
||||
|
||||
void gfx_set_palette(byte slot, byte rgb)
|
||||
{
|
||||
if (back && slot < 4 && rgb < 64)
|
||||
REG(0xffb0 + slot) = rgb;
|
||||
}
|
||||
|
||||
byte gfx_open(void)
|
||||
{
|
||||
byte i, width;
|
||||
// Super Extended BASIC defines HRMODE at $E6 and HRWIDTH at $E7.
|
||||
if (back || !lowProgramAndStack() || *(unsigned *)0xfff8 != 0xfef7 ||
|
||||
REG(0xe6) != 0 || REG(0xe7) > 2)
|
||||
return 0;
|
||||
for (i = 0; i < 16; ++i) {
|
||||
byte bank = REG(0xffa0 + i) & 0x3f;
|
||||
if (bank >= FIRST_PAGE && bank < SECOND_PAGE + 5)
|
||||
return 0;
|
||||
}
|
||||
if (!field(0, 0) || !independentBanks())
|
||||
return 0;
|
||||
|
||||
width = REG(0xe7);
|
||||
textImage = (const byte *)0xe032 + width * 9;
|
||||
for (i = 0; i < 16; ++i)
|
||||
palette[i] = REG(0xffb0 + i) & 0x3f;
|
||||
|
||||
back = FIRST_PAGE;
|
||||
gfx_clear(0);
|
||||
back = SECOND_PAGE;
|
||||
gfx_clear(0);
|
||||
if (!field(0, 0)) {
|
||||
back = 0;
|
||||
return 0;
|
||||
}
|
||||
// Super Extended BASIC keeps editable images of the write-only registers
|
||||
// at $E032 (text tables) and $E070 (graphics). Keep the ROM's color phase.
|
||||
REG(0xff90) = REG(0xe070);
|
||||
REG(0xff98) = REG(0xe071);
|
||||
REG(0xff99) = 0x7d; // 225 lines, 160 bytes per row, four colors.
|
||||
REG(0xff9a) = 0; // Black outer border; restore the BASIC image on close.
|
||||
REG(0xff9c) = 0;
|
||||
REG(0xff9d) = FIRST_PAGE << 2;
|
||||
REG(0xff9e) = 0;
|
||||
REG(0xff9f) = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Borrow the same short window twice per chunk. The staging buffer, program
|
||||
// and stack stay below $8000. Restore BASIC's mapping and interrupt mask between
|
||||
// chunks so a complete page copy cannot defer its vertical interrupt for long.
|
||||
static void copyChunk(byte sourceBank,byte destinationBank,unsigned address,
|
||||
byte *buffer)
|
||||
{
|
||||
asm {
|
||||
pshs cc,y
|
||||
orcc #$50
|
||||
lda >$ffa4
|
||||
nop
|
||||
pshs a
|
||||
lda :sourceBank
|
||||
sta >$ffa4
|
||||
ldx :address
|
||||
ldy :buffer
|
||||
ldb #32
|
||||
@read lda ,x+
|
||||
sta ,y+
|
||||
decb
|
||||
bne @read
|
||||
lda :destinationBank
|
||||
sta >$ffa4
|
||||
ldx :buffer
|
||||
ldy :address
|
||||
ldb #32
|
||||
@write lda ,x+
|
||||
sta ,y+
|
||||
decb
|
||||
bne @write
|
||||
puls a
|
||||
sta >$ffa4
|
||||
puls cc,y
|
||||
}
|
||||
}
|
||||
|
||||
byte gfx_copy_front(void)
|
||||
{
|
||||
unsigned offset;
|
||||
byte front;
|
||||
if(!back)return 0;
|
||||
front=back==FIRST_PAGE?SECOND_PAGE:FIRST_PAGE;
|
||||
// 36,000 visible bytes and each 8 KiB bank are multiples of 32.
|
||||
// Consequently no chunk crosses a bank or the visible image's end.
|
||||
for(offset=0;offset<36000u;offset+=32)
|
||||
copyChunk((byte)(front+(offset>>13)),(byte)(back+(offset>>13)),
|
||||
WINDOW+(offset&0x1fff),copyBuffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
byte gfx_present(void)
|
||||
{
|
||||
if (!back || !field(back << 2, 1))
|
||||
return 0;
|
||||
back = (back == SECOND_PAGE ? FIRST_PAGE : SECOND_PAGE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void gfx_close(void)
|
||||
{
|
||||
byte i;
|
||||
if (!back) return;
|
||||
field(0, 0); // Even if the timer stops, always give the display back.
|
||||
REG(0xff90) = textImage[0];
|
||||
REG(0xff98) = textImage[1];
|
||||
REG(0xff99) = textImage[2];
|
||||
REG(0xff9a) = textImage[3];
|
||||
REG(0xff9c) = textImage[5];
|
||||
REG(0xff9d) = textImage[6];
|
||||
REG(0xff9e) = textImage[7];
|
||||
REG(0xff9f) = textImage[8];
|
||||
for (i = 0; i < 16; ++i)
|
||||
REG(0xffb0 + i) = palette[i];
|
||||
back = 0;
|
||||
}
|
||||
@@ -1,298 +1,54 @@
|
||||
/* Generated by tools/prepare_assets.py from LadyofHats public-domain SVG. */
|
||||
/* Generated source-derived Bone Quest structure masks. */
|
||||
#include "map_data.h"
|
||||
|
||||
const unsigned char bone_spans[] = {
|
||||
0,23,7,1,22,9,2,21,11,3,20,13,4,20,13,5,20,13,6,20,13,7,20,2,
|
||||
7,26,1,7,31,2,8,20,2,8,26,1,8,32,1,9,20,2,9,26,1,9,32,1,
|
||||
10,20,2,10,25,1,10,32,1,11,20,1,11,22,4,11,28,3,11,32,1,12,23,2,
|
||||
12,28,2,13,23,3,13,27,3,14,23,7,15,23,7,16,24,5,11,21,1,11,31,1,
|
||||
12,20,3,12,30,3,13,21,2,13,30,3,14,21,2,14,30,3,15,21,2,15,30,2,
|
||||
16,21,3,16,29,3,17,22,10,18,22,9,19,24,6,22,13,1,23,12,11,23,33,9,
|
||||
24,13,2,24,16,9,24,29,12,25,23,2,25,28,4,23,11,1,24,10,3,24,41,2,
|
||||
25,10,7,25,19,1,25,37,7,26,11,6,26,36,7,27,13,5,27,36,5,28,14,4,
|
||||
28,36,4,29,14,3,29,19,1,29,37,3,30,14,3,30,37,3,31,13,3,31,37,4,
|
||||
32,13,3,32,34,2,32,38,2,33,14,2,33,38,2,34,14,1,34,38,1,35,14,1,
|
||||
35,17,2,35,35,1,25,25,3,26,24,6,27,24,5,28,24,5,29,25,4,30,25,4,
|
||||
31,25,4,32,25,3,33,25,4,34,25,3,35,25,3,36,25,3,37,25,3,38,26,2,
|
||||
39,26,2,40,26,2,41,26,1,23,23,2,23,29,3,25,20,3,25,32,1,26,18,6,
|
||||
26,30,5,27,18,6,27,29,7,28,18,6,28,29,7,29,17,2,29,20,5,29,29,8,
|
||||
30,17,6,30,31,6,31,16,9,31,29,8,32,16,9,32,28,6,32,36,2,33,16,6,
|
||||
33,24,1,33,29,1,33,32,6,34,15,10,34,28,10,35,15,2,35,19,6,35,28,7,
|
||||
35,36,3,36,15,10,36,28,10,37,14,11,37,28,11,38,15,11,38,28,3,38,32,7,
|
||||
39,15,10,39,28,4,39,34,5,40,14,11,40,28,11,41,14,11,41,28,11,42,14,10,
|
||||
42,29,10,43,14,6,43,21,4,43,28,4,43,33,4,43,38,2,44,14,10,44,29,4,
|
||||
44,35,5,45,14,8,45,28,1,45,30,9,46,14,7,46,23,1,46,28,3,46,32,7,
|
||||
47,14,9,47,30,9,48,14,8,48,23,1,48,28,2,48,31,8,49,14,10,49,29,3,
|
||||
49,33,6,50,15,3,50,20,3,50,31,2,50,35,3,51,15,1,51,18,3,51,32,2,
|
||||
51,37,1,52,33,1,19,23,1,20,23,7,21,23,8,22,23,8,23,25,3,23,28,1,
|
||||
24,25,3,39,25,1,40,25,1,41,25,1,41,27,1,42,25,3,43,25,3,44,24,4,
|
||||
45,24,4,46,24,4,47,24,4,48,24,4,49,26,1,49,24,2,49,27,2,50,23,6,
|
||||
51,24,5,52,24,5,53,23,7,54,24,5,55,23,8,56,24,5,57,23,7,58,24,5,
|
||||
59,23,8,60,23,7,61,24,5,62,25,3,60,22,1,60,30,1,61,22,2,61,29,2,
|
||||
62,21,4,62,28,3,63,22,9,64,23,7,65,23,6,66,24,5,67,25,2,67,27,1,
|
||||
68,26,1,69,26,1,56,17,2,56,32,5,57,15,7,57,31,7,58,14,9,58,30,9,
|
||||
59,14,9,59,31,9,60,13,9,60,31,9,61,13,9,61,31,9,62,13,8,62,31,9,
|
||||
63,14,8,63,31,8,64,15,7,64,31,7,65,16,5,65,31,6,66,16,6,66,30,7,
|
||||
67,16,6,67,30,6,68,17,6,68,30,5,69,18,6,69,29,5,70,19,2,70,22,12,
|
||||
71,19,3,71,23,6,71,31,3,72,19,15,73,20,4,73,28,5,27,10,3,27,41,3,
|
||||
28,9,5,28,40,5,29,8,6,29,40,5,30,8,6,30,40,5,31,8,5,31,42,4,
|
||||
32,8,4,32,42,4,33,8,4,33,43,3,34,8,3,34,43,3,35,8,3,35,43,3,
|
||||
36,7,3,36,43,3,37,7,3,37,43,3,38,7,3,38,43,3,39,7,3,39,43,3,
|
||||
40,6,3,40,44,2,41,6,3,41,44,2,42,5,4,42,44,3,43,5,3,43,44,3,
|
||||
44,5,3,44,44,3,45,4,4,45,44,3,46,4,3,46,44,3,47,4,3,47,44,4,
|
||||
48,3,4,48,44,4,49,3,4,49,44,5,50,2,5,50,44,5,51,1,7,51,44,6,
|
||||
52,2,6,52,43,6,53,6,1,53,44,2,52,49,1,53,1,3,53,48,2,54,2,2,
|
||||
54,48,2,55,2,3,55,48,2,56,2,3,56,48,3,57,3,2,57,49,2,58,4,2,
|
||||
58,49,3,59,4,2,59,49,3,60,4,2,60,50,3,61,4,2,61,50,3,62,4,2,
|
||||
62,51,2,63,4,2,63,51,3,64,4,2,64,51,3,65,4,2,65,52,2,66,4,2,
|
||||
66,52,3,67,4,2,67,52,3,68,4,2,68,52,3,69,4,2,69,52,4,70,4,2,
|
||||
70,52,4,71,3,3,71,52,4,72,3,3,72,53,1,73,4,2,53,4,2,53,46,2,
|
||||
54,4,3,54,45,3,55,5,1,55,46,2,56,5,1,56,46,2,57,46,3,58,3,1,
|
||||
58,46,3,59,3,1,59,47,2,60,2,2,60,47,3,61,2,2,61,47,3,62,2,2,
|
||||
62,48,2,63,2,2,63,48,2,64,2,2,64,48,2,65,2,2,65,48,3,66,2,2,
|
||||
66,49,2,67,1,3,67,49,2,68,1,3,68,49,2,69,1,2,69,50,2,70,1,2,
|
||||
70,50,2,71,1,2,71,50,2,72,1,2,72,51,1,73,1,1,72,52,1,72,54,3,
|
||||
73,2,2,73,51,5,74,1,5,74,51,3,74,55,1,75,1,5,73,56,4,74,54,1,
|
||||
74,56,2,75,6,2,75,51,7,76,1,5,76,7,2,76,51,5,76,57,1,77,0,7,
|
||||
77,52,4,77,57,1,78,0,3,78,4,3,78,52,7,79,0,3,79,4,1,79,6,2,
|
||||
79,54,1,80,0,8,73,60,1,74,60,2,75,61,2,76,62,2,77,8,2,78,9,2,
|
||||
79,9,2,79,52,2,79,55,4,80,52,7,81,0,8,81,53,7,82,1,7,82,53,7,
|
||||
83,1,7,83,54,6,84,1,7,84,54,1,84,56,4,85,1,6,85,56,3,86,3,4,
|
||||
86,58,1,87,3,3,88,4,1,67,15,1,67,36,1,68,13,4,68,35,2,68,38,2,
|
||||
69,12,6,69,34,6,70,12,5,70,34,7,71,11,6,71,36,5,72,12,5,72,36,5,
|
||||
73,12,5,73,35,5,74,13,4,74,35,5,75,13,4,75,36,3,76,14,3,76,35,4,
|
||||
77,14,3,77,35,4,78,14,4,78,35,3,79,14,4,79,35,3,80,15,3,80,34,4,
|
||||
81,15,3,81,34,4,82,15,4,82,34,4,83,15,4,83,33,4,84,16,3,84,33,4,
|
||||
85,16,3,85,33,4,86,16,4,86,33,3,87,16,4,87,32,4,88,17,3,88,32,4,
|
||||
89,17,4,89,32,4,90,17,4,90,32,3,91,17,4,91,31,4,92,18,4,92,31,4,
|
||||
93,18,4,93,31,4,94,18,4,94,30,4,95,18,5,95,30,4,96,18,5,96,30,4,
|
||||
97,18,5,97,30,4,98,18,6,98,29,5,99,18,6,99,29,5,100,18,6,100,28,6,
|
||||
101,18,7,101,28,7,102,17,9,102,27,8,103,17,9,103,27,8,104,17,3,104,22,4,
|
||||
104,27,3,104,33,2,105,17,2,105,23,2,105,27,2,105,34,1,106,28,1,104,20,2,
|
||||
104,30,3,105,19,4,105,29,5,106,18,6,106,29,5,107,19,4,107,29,5,108,20,2,
|
||||
108,30,3,106,17,1,106,24,1,106,27,1,106,34,1,107,17,2,107,23,2,107,27,2,
|
||||
107,34,1,108,17,3,108,22,4,108,27,3,108,33,2,109,18,7,109,27,8,110,18,7,
|
||||
110,27,7,111,19,6,111,27,6,112,19,6,112,28,5,113,20,5,113,28,5,114,20,4,
|
||||
114,28,4,115,20,4,115,28,4,116,20,4,116,28,4,117,20,4,117,28,4,118,20,4,
|
||||
118,28,4,119,20,4,119,28,4,120,20,4,120,28,4,121,20,4,121,28,4,122,20,4,
|
||||
122,28,4,123,20,4,123,28,4,124,21,3,124,28,4,125,21,4,125,28,3,126,21,4,
|
||||
126,28,3,127,21,4,127,28,3,128,21,3,128,28,3,129,21,3,129,28,3,130,21,4,
|
||||
130,27,4,131,21,4,131,27,4,132,21,4,132,27,4,133,21,4,133,27,4,134,21,4,
|
||||
134,27,4,135,21,10,136,21,10,137,21,10,138,22,3,138,26,3,109,17,1,110,17,1,
|
||||
110,34,1,111,17,2,111,33,2,112,17,2,112,33,2,113,17,2,113,33,2,114,17,2,
|
||||
114,33,2,115,18,1,115,33,2,116,18,2,116,33,2,117,18,2,117,33,1,118,18,2,
|
||||
118,32,2,119,18,2,119,32,2,120,18,2,120,32,2,121,18,2,121,32,2,122,18,2,
|
||||
122,32,2,123,19,1,123,32,2,124,19,2,124,32,1,125,19,2,125,31,2,126,19,2,
|
||||
126,31,2,127,19,2,127,31,2,128,19,2,128,31,2,129,19,2,129,31,2,130,19,2,
|
||||
130,31,2,131,20,1,131,31,1,132,20,1,132,31,1,133,19,2,133,31,2,134,19,2,
|
||||
134,31,1,135,20,1,135,31,1,136,19,2,136,31,2,137,19,2,137,31,2,138,20,2,
|
||||
138,29,3,139,19,6,139,26,7,140,22,3,140,26,4,141,23,2,141,26,3,142,24,1,
|
||||
142,27,1,140,18,4,140,30,5,141,17,6,141,29,6,142,16,8,142,28,8,143,16,8,
|
||||
143,28,8,144,19,3,144,30,3,143,15,1,143,36,1,144,14,5,144,33,5,145,13,8,
|
||||
145,31,8,146,13,7,146,31,8,147,14,5,147,33,5,148,34,1,148,36,1,
|
||||
};
|
||||
|
||||
const unsigned bone_offsets[] = {
|
||||
0,90,135,159,246,297,534,549,591,636,669,678,786,948,1074,1194,1218,1278,1353,1605,1635,1842,2013,2043,
|
||||
2073,2109,
|
||||
};
|
||||
|
||||
static const unsigned char head_spans[] = {
|
||||
1,16,6,2,12,14,3,10,18,4,8,22,5,7,24,6,6,26,7,5,28,8,5,29,
|
||||
9,4,30,10,3,32,11,3,32,12,2,34,13,2,34,14,2,34,15,2,34,16,2,34,
|
||||
17,2,34,18,2,34,19,2,9,19,13,23,20,2,6,20,17,5,20,30,2,20,33,3,
|
||||
21,2,5,21,17,4,21,31,5,22,2,4,22,17,4,22,32,4,23,3,3,23,17,4,
|
||||
23,32,3,24,3,3,24,17,4,24,32,3,25,3,3,25,17,4,25,32,3,26,3,3,
|
||||
26,17,4,26,32,3,27,3,3,27,16,4,27,32,4,28,2,4,28,15,2,28,22,1,
|
||||
28,31,5,29,2,5,29,14,2,29,22,2,29,30,6,30,2,15,30,21,15,31,3,1,
|
||||
31,7,10,31,21,10,31,34,1,32,8,8,32,21,8,32,34,1,33,8,8,33,22,7,
|
||||
34,9,7,34,22,7,35,9,7,35,19,1,35,21,8,36,9,20,37,10,18,38,11,17,
|
||||
39,10,18,40,10,18,41,10,18,42,11,17,43,12,15,44,15,10,31,4,3,31,31,3,
|
||||
32,3,5,32,29,5,33,3,5,33,29,5,34,3,6,34,29,5,35,4,5,35,29,5,
|
||||
36,4,5,36,29,5,37,4,5,37,29,5,38,4,5,38,29,5,39,5,4,39,29,5,
|
||||
40,5,5,40,29,4,41,5,5,41,29,4,42,6,5,42,28,5,43,6,6,43,27,6,
|
||||
44,6,9,44,25,7,45,6,26,46,6,25,47,7,23,48,9,20,49,10,18,50,12,15,
|
||||
51,14,12,60,0,1,61,0,9,62,0,12,62,31,7,63,0,14,63,26,12,64,0,15,
|
||||
64,24,14,59,9,1,59,28,2,60,8,7,60,24,7,61,9,6,61,24,8,62,13,2,
|
||||
62,24,2,62,29,2,50,11,1,51,11,3,51,26,2,52,11,17,53,11,16,54,11,17,
|
||||
55,11,17,56,10,19,57,9,20,58,9,20,59,10,18,60,15,8,61,15,8,60,23,1,
|
||||
61,23,1,62,15,9,63,15,9,64,15,8,
|
||||
static const unsigned bone_offsets[] = {
|
||||
0,120,150,162,186,196,264,314,346,356,412,646,684,724,764,824,846,858,882,974,1198,1358,1474,1584,
|
||||
1634,1742,1904,2050,2290,2444,3270,
|
||||
};
|
||||
|
||||
static const unsigned head_offsets[] = {
|
||||
0,234,339,363,363,363,390,429,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,
|
||||
444,444,
|
||||
};
|
||||
|
||||
static const unsigned char hand_spans[] = {
|
||||
0,18,12,1,18,12,2,18,13,3,18,13,4,18,13,5,18,12,6,18,11,7,19,6,
|
||||
0,11,6,1,11,6,2,11,6,3,12,6,4,12,6,5,12,6,6,13,5,7,13,3,
|
||||
8,13,2,7,17,2,7,25,6,8,17,14,9,16,18,10,16,18,11,15,19,12,15,17,
|
||||
13,15,15,14,15,15,15,16,8,16,19,2,9,35,2,10,34,11,11,34,12,12,32,14,
|
||||
13,30,8,13,42,3,14,30,5,14,43,1,15,24,4,15,31,4,16,16,3,16,21,2,
|
||||
16,24,5,16,31,4,17,16,7,17,24,5,17,32,3,18,16,13,18,33,2,19,16,8,
|
||||
19,25,4,19,33,3,20,16,3,20,20,5,20,26,3,20,33,3,21,16,3,21,21,3,
|
||||
21,26,4,21,33,3,22,16,4,22,21,3,22,27,3,22,33,4,23,16,4,23,22,3,
|
||||
23,27,3,23,34,3,24,16,4,24,22,3,24,27,4,24,34,4,25,17,3,25,22,3,
|
||||
25,28,3,25,34,4,26,17,3,26,23,3,26,28,4,26,34,5,27,17,3,27,23,3,
|
||||
27,28,4,27,34,5,28,17,4,28,23,4,28,28,5,28,34,5,29,17,5,29,23,11,
|
||||
29,35,4,30,17,5,30,23,11,30,35,1,31,18,1,31,23,5,31,29,5,32,24,2,
|
||||
32,30,2,12,46,2,13,45,4,14,44,6,15,45,6,16,47,6,17,49,5,18,50,5,
|
||||
19,50,5,20,51,6,21,53,4,22,54,4,23,55,2,30,36,4,31,19,3,31,35,5,
|
||||
32,18,4,32,26,3,32,32,8,33,18,4,33,24,5,33,30,5,33,36,4,34,19,3,
|
||||
34,24,5,34,30,5,34,37,3,35,20,3,35,25,4,35,31,4,35,37,4,36,20,3,
|
||||
36,26,4,36,31,4,36,37,4,37,20,3,37,26,4,37,32,3,37,38,3,38,21,3,
|
||||
38,26,4,38,32,4,38,38,4,39,21,3,39,27,3,39,32,4,39,38,4,40,21,4,
|
||||
40,27,3,40,33,3,40,38,4,41,21,4,41,27,4,41,33,4,41,38,4,42,22,3,
|
||||
42,27,4,42,33,4,42,39,3,43,22,4,43,27,5,43,33,5,43,39,3,44,23,3,
|
||||
44,28,4,44,34,4,44,40,2,45,23,3,45,28,4,45,34,4,45,40,3,46,24,3,
|
||||
46,29,4,46,35,3,46,40,3,47,25,2,47,30,3,47,35,3,47,40,3,48,25,3,
|
||||
48,30,4,48,36,3,48,40,3,49,26,1,49,31,3,49,36,3,49,41,2,50,31,4,
|
||||
50,36,4,50,41,3,51,32,3,51,36,4,51,41,2,52,32,3,52,37,3,53,33,2,
|
||||
53,38,3,54,33,2,54,38,3,55,38,3,
|
||||
0,654,808,808,808,808,808,808,808,808,808,808,808,808,808,808,874,904,944,944,978,978,978,978,
|
||||
978,978,978,978,978,1000,2084,
|
||||
};
|
||||
|
||||
static const unsigned hand_offsets[] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,51,84,291,588,588,588,588,588,588,
|
||||
588,588,
|
||||
};
|
||||
|
||||
static const unsigned char foot_spans[] = {
|
||||
0,3,19,1,3,19,2,3,19,3,2,20,4,2,20,5,2,20,6,2,20,7,2,20,
|
||||
8,1,21,9,1,20,10,1,20,11,1,18,12,1,17,13,2,15,14,2,14,15,2,7,
|
||||
16,2,5,17,3,3,0,22,6,1,22,6,2,22,6,3,22,6,4,22,7,5,22,7,
|
||||
6,22,7,7,22,7,8,22,7,9,22,8,10,23,6,11,24,5,12,26,3,9,21,1,
|
||||
10,21,2,11,19,5,12,18,8,13,17,9,14,16,10,15,9,17,16,7,18,17,6,21,
|
||||
18,3,25,19,3,27,20,3,30,21,3,31,22,3,22,22,26,4,22,31,4,23,4,20,
|
||||
23,27,1,23,32,3,24,3,15,24,21,2,24,33,1,25,3,14,26,3,13,27,3,12,
|
||||
28,3,12,29,3,12,30,3,10,31,3,9,32,5,6,33,6,4,34,7,3,35,7,3,
|
||||
36,8,2,22,25,1,22,30,1,23,24,3,23,28,4,23,35,2,24,18,3,24,23,10,
|
||||
24,34,4,25,17,21,26,16,23,27,15,25,28,15,26,29,15,26,30,13,29,31,12,31,
|
||||
32,11,33,33,10,9,33,21,24,34,10,10,34,22,24,35,10,10,35,23,23,36,10,11,
|
||||
36,24,23,37,10,12,37,25,23,38,11,12,38,26,20,39,13,11,39,27,19,40,15,11,
|
||||
40,29,10,40,42,1,41,17,11,41,29,7,42,18,16,43,19,14,44,20,9,45,21,7,
|
||||
46,22,5,47,22,4,48,23,2,49,24,1,38,46,4,39,46,5,40,39,3,40,43,9,
|
||||
41,36,17,42,34,20,43,33,23,44,29,2,44,32,24,45,28,3,45,32,25,46,27,20,
|
||||
46,48,9,47,26,6,47,33,15,47,49,9,48,25,8,48,34,14,48,50,5,48,56,3,
|
||||
49,25,8,49,36,19,49,56,3,50,25,9,50,37,13,50,51,4,50,57,1,51,25,10,
|
||||
51,38,12,51,53,3,52,29,7,52,39,11,52,54,3,53,30,6,53,39,7,53,47,4,
|
||||
53,54,3,54,30,8,54,40,6,54,48,4,54,55,1,55,30,8,55,41,6,55,49,4,
|
||||
56,31,7,56,43,5,56,49,4,57,32,7,57,44,4,57,50,3,58,33,7,58,45,4,
|
||||
59,36,4,59,45,4,60,36,4,60,47,1,61,37,2,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,60,
|
||||
208,524,912,912,912,912,2158,
|
||||
};
|
||||
|
||||
static const unsigned foot_offsets[] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,93,195,
|
||||
324,495,
|
||||
};
|
||||
|
||||
static const unsigned char spine_spans[] = {
|
||||
0,0,1,0,3,6,0,27,5,1,2,6,1,10,2,1,22,2,1,28,6,2,0,7,
|
||||
2,9,3,2,22,3,2,29,5,3,0,6,3,8,4,3,22,4,3,30,4,4,0,4,
|
||||
4,7,5,4,22,6,4,31,3,5,0,2,5,6,4,5,24,5,5,33,1,6,4,5,
|
||||
6,26,5,7,2,5,7,27,5,8,0,6,8,28,6,9,0,5,9,30,4,10,0,3,
|
||||
10,31,3,11,0,1,11,33,1,0,12,10,1,12,10,2,12,10,3,12,10,4,12,10,
|
||||
5,12,9,5,21,1,6,12,10,7,12,11,8,12,11,9,9,17,10,8,18,11,10,1,
|
||||
11,12,11,12,12,11,13,12,11,14,12,11,15,9,2,15,12,13,16,8,19,17,8,19,
|
||||
18,10,1,18,12,13,19,12,11,20,12,11,21,8,1,21,11,12,21,25,3,22,7,22,
|
||||
23,6,22,24,7,16,24,26,1,25,12,11,26,12,11,27,12,11,27,25,2,28,7,21,
|
||||
29,7,21,30,8,19,31,12,11,32,12,11,33,8,1,33,12,11,33,25,3,34,7,3,
|
||||
34,12,11,34,24,4,35,6,22,36,7,20,37,8,17,38,10,13,39,11,12,40,11,12,
|
||||
41,12,10,42,13,8,36,27,2,37,5,3,37,25,5,38,5,5,38,23,7,39,4,7,
|
||||
39,23,7,40,4,7,40,23,7,41,4,8,41,22,8,42,3,10,42,21,9,43,3,27,
|
||||
44,3,27,45,4,7,45,12,18,46,4,25,47,8,18,48,9,17,49,9,16,50,9,16,
|
||||
51,9,16,52,9,15,53,10,13,54,12,9,55,14,6,55,13,1,55,20,1,56,13,8,
|
||||
57,14,5,58,15,4,59,15,4,60,16,3,61,16,2,26,32,2,27,0,2,27,31,3,
|
||||
28,0,4,28,30,4,29,0,6,29,29,5,30,0,7,30,28,6,31,0,8,31,28,6,
|
||||
32,0,8,32,28,6,33,0,8,33,28,6,34,0,7,34,28,6,35,0,6,35,28,6,
|
||||
36,0,7,36,29,5,37,0,5,37,30,4,38,0,5,38,30,4,39,0,4,39,30,4,
|
||||
40,0,4,40,30,4,41,0,4,41,30,4,42,0,3,42,30,4,43,0,3,43,30,4,
|
||||
44,0,3,44,30,4,45,0,4,45,30,4,46,0,4,46,29,5,47,0,4,47,29,5,
|
||||
48,0,3,48,30,4,49,0,2,49,30,4,50,0,2,50,30,4,51,0,3,51,30,4,
|
||||
52,0,4,52,30,4,53,0,5,53,29,5,54,0,6,54,28,6,55,0,6,55,27,7,
|
||||
56,0,6,56,26,8,57,0,5,57,26,8,58,0,5,58,27,7,59,0,7,59,27,7,
|
||||
60,0,8,60,26,8,61,0,9,61,25,9,62,0,10,62,24,10,63,0,2,63,3,8,
|
||||
63,23,11,64,0,2,64,4,8,64,14,2,64,17,2,64,21,8,64,31,3,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,212,568,942,942,942,942,942,942,942,942,942,
|
||||
942,942,942,1000,1134,1134,2372,
|
||||
};
|
||||
|
||||
static const unsigned spine_offsets[] = {
|
||||
0,0,0,0,0,0,105,105,123,270,351,375,621,621,621,621,621,621,621,621,621,621,621,621,
|
||||
621,621,
|
||||
};
|
||||
|
||||
static const unsigned char chest_spans[] = {
|
||||
3,7,2,4,6,17,4,51,11,5,6,22,5,45,17,6,7,23,6,40,22,7,24,7,
|
||||
7,37,17,8,27,5,8,37,8,9,28,3,9,37,4,5,4,2,5,62,2,6,3,4,
|
||||
6,62,3,7,2,6,7,60,6,8,2,13,8,59,8,9,2,14,9,20,1,9,54,13,
|
||||
10,3,13,10,53,13,11,9,8,11,52,9,12,8,9,12,21,2,12,46,1,12,51,9,
|
||||
13,9,8,13,51,9,14,9,8,14,51,9,15,10,6,15,52,7,16,10,5,16,19,3,
|
||||
16,53,6,17,9,6,17,19,1,17,48,2,17,53,6,18,9,6,18,53,7,19,8,7,
|
||||
19,53,9,20,7,7,20,54,7,21,8,5,21,19,1,21,55,5,22,9,4,22,18,2,
|
||||
22,48,4,22,55,5,23,9,5,23,50,1,23,55,4,24,10,5,24,54,4,25,10,3,
|
||||
25,55,3,26,10,2,26,18,1,26,56,1,27,16,4,27,48,4,28,16,1,28,51,1,
|
||||
29,11,1,30,11,1,32,15,2,32,50,2,8,32,1,8,35,2,9,31,6,10,29,10,
|
||||
11,29,10,12,29,10,13,29,10,14,29,9,15,30,8,16,31,6,17,30,8,18,30,8,
|
||||
19,31,6,20,31,6,21,31,6,22,31,6,23,31,6,24,31,6,25,31,6,26,31,6,
|
||||
27,31,6,28,31,6,29,31,6,30,32,4,31,32,4,32,32,4,33,33,2,34,32,3,
|
||||
35,32,4,36,33,2,37,33,2,38,33,2,3,41,1,4,25,5,4,38,5,5,28,2,
|
||||
5,37,7,6,30,1,6,37,1,7,22,2,8,22,5,8,45,1,9,21,7,9,41,7,
|
||||
10,18,11,10,39,10,11,17,12,11,39,12,12,17,4,12,23,6,12,39,7,12,47,4,
|
||||
13,17,12,13,39,12,14,17,12,14,42,9,15,16,14,15,38,14,16,15,4,16,22,9,
|
||||
16,37,16,17,15,4,17,20,10,17,38,10,17,50,3,18,15,11,18,43,10,19,15,11,
|
||||
19,28,3,19,37,3,19,45,8,20,14,17,20,37,17,21,13,6,21,20,11,21,37,18,
|
||||
22,13,5,22,20,11,22,37,11,22,52,3,23,14,12,23,30,1,23,37,13,23,51,4,
|
||||
24,15,9,24,27,4,24,37,3,24,45,9,25,13,18,25,37,18,26,12,6,26,19,12,
|
||||
26,37,19,27,11,5,27,20,11,27,37,11,27,52,5,28,11,5,28,17,8,28,27,4,
|
||||
28,37,2,28,43,8,28,52,4,29,12,10,29,25,6,29,37,5,29,45,11,30,12,20,
|
||||
30,36,20,31,11,21,31,37,19,32,11,4,32,17,14,32,36,1,32,38,12,32,53,4,
|
||||
33,11,22,33,35,7,33,44,8,33,53,4,34,12,9,34,25,7,34,35,8,34,46,10,
|
||||
35,11,20,35,36,8,35,49,8,36,10,20,36,37,20,37,10,4,37,16,9,37,26,4,
|
||||
37,37,15,37,54,4,38,10,13,38,25,5,38,37,14,38,54,4,39,11,8,39,22,8,
|
||||
39,37,20,40,10,19,40,38,19,41,10,3,41,14,15,41,39,19,42,10,3,42,14,16,
|
||||
42,37,6,42,45,9,42,55,4,43,10,9,43,23,7,43,37,7,43,47,7,43,55,4,
|
||||
44,10,6,44,21,9,44,37,9,44,50,9,45,10,17,45,39,19,46,9,17,46,41,17,
|
||||
47,9,4,47,14,11,47,28,2,47,37,3,47,42,16,48,9,15,48,26,4,48,37,5,
|
||||
48,44,9,48,54,4,49,10,13,49,25,4,49,39,4,49,44,14,50,11,11,50,24,4,
|
||||
50,40,4,50,45,12,51,10,11,51,22,5,51,28,2,51,37,2,51,41,16,52,10,4,
|
||||
52,16,10,52,27,3,52,37,3,52,42,15,53,10,14,53,26,3,53,38,3,53,43,8,
|
||||
53,54,3,54,10,12,54,24,4,54,39,4,54,47,10,55,11,7,55,22,5,55,41,3,
|
||||
55,49,8,56,13,3,56,20,5,56,42,4,56,51,5,57,12,3,57,19,4,57,44,4,
|
||||
57,52,3,58,12,1,58,18,4,58,45,3,58,53,3,59,18,2,59,46,3,59,55,1,
|
||||
0,28,13,1,27,14,2,27,14,3,27,14,4,31,6,5,31,6,4,30,1,4,37,1,
|
||||
5,30,1,6,31,6,7,31,6,8,33,2,35,31,1,36,30,3,36,35,1,37,30,3,
|
||||
37,35,2,38,30,3,38,35,2,39,30,7,40,30,7,41,30,7,42,30,7,43,30,7,
|
||||
44,30,7,45,30,7,46,30,7,47,30,7,48,30,7,49,30,7,50,30,7,51,30,7,
|
||||
52,30,7,53,30,7,54,30,7,55,30,7,56,28,11,57,28,11,58,30,7,59,30,7,
|
||||
60,28,1,60,30,9,61,27,13,12,4,3,12,62,4,13,2,7,13,60,8,14,0,9,
|
||||
14,60,8,15,0,10,15,59,9,16,0,10,16,59,9,17,0,9,17,59,9,18,0,9,
|
||||
18,60,8,19,0,8,19,62,6,20,0,7,20,63,5,21,0,6,21,63,5,22,0,5,
|
||||
22,64,4,23,0,5,23,64,4,24,0,5,24,64,4,25,0,4,25,65,3,26,0,4,
|
||||
26,65,3,27,0,3,27,65,3,28,0,3,28,65,3,29,0,3,29,65,3,30,0,3,
|
||||
30,65,3,31,0,2,31,65,3,32,0,2,32,66,2,33,0,2,33,66,2,34,0,2,
|
||||
34,66,2,35,0,1,35,66,2,36,0,1,36,66,2,37,0,1,37,66,2,38,66,2,
|
||||
39,66,2,40,67,1,41,67,1,42,67,1,43,67,1,44,67,1,45,67,1,46,67,1,
|
||||
47,67,1,48,67,1,49,67,1,50,67,1,51,67,1,52,67,1,53,67,1,54,67,1,
|
||||
55,67,1,56,67,1,57,67,1,58,66,2,59,66,2,60,66,2,61,67,1,
|
||||
0,0,0,0,0,0,300,476,618,644,918,1108,1108,1108,1108,1108,1108,1108,1108,1108,1346,1346,1346,1346,
|
||||
1346,1346,1346,1346,1346,1480,3108,
|
||||
};
|
||||
|
||||
static const unsigned chest_offsets[] = {
|
||||
0,0,0,39,228,324,888,906,990,1017,1017,1017,1017,1245,1245,1245,1245,1245,1245,1245,1245,1245,1245,1245,
|
||||
1245,1245,
|
||||
0,0,58,96,150,170,228,228,228,228,228,228,228,228,228,228,228,228,302,572,1310,1646,1646,1646,
|
||||
1646,1646,1646,1646,1646,2032,3592,
|
||||
};
|
||||
|
||||
const unsigned char bone_boxes[25][4] = {{20,0,13,17},{20,11,13,9},{12,22,30,4},{10,23,34,13},{24,25,6,17},{14,23,26,30},{23,19,8,5},{24,23,5,27},{23,49,8,14},{21,60,10,8},{26,67,2,3},{13,56,27,18},{1,27,49,27},{1,52,55,22},{1,53,51,21},{1,72,56,4},{0,73,60,8},{0,73,64,16},{11,67,30,40},{18,104,16,5},{17,106,18,33},{17,109,18,29},{19,138,14,5},{16,140,20,5},{13,143,26,6}};
|
||||
const unsigned char bone_boxes[28][4] = {{50,0,33,24},{57,24,19,6},{60,31,13,5},{62,37,9,10},{64,47,4,4},{56,60,20,18},{33,69,66,12},{54,74,24,10},{62,83,7,3},{40,80,49,12},{29,82,72,49},{46,128,37,7},{46,170,37,7},{39,173,51,7},{33,177,64,7},{53,9,26,5},{63,12,6,5},{30,28,73,5},{25,29,84,18},{34,28,64,37},{4,33,119,34},{2,65,128,26},{4,65,135,26},{2,88,140,7},{1,90,148,10},{1,93,152,17},{42,135,46,36},{43,131,44,41}};
|
||||
const unsigned char bone_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,
|
||||
1,1,5,5,5,4,4,4,4,4,0,0,3,3,3,1,1,5,5,5,0,0,0,2,
|
||||
2,2,0,0,
|
||||
};
|
||||
|
||||
const unsigned char bone_view_widths[] = {
|
||||
64,38,61,63,34,68,
|
||||
159,114,185,191,201,215,
|
||||
};
|
||||
|
||||
const unsigned char bone_view_heights[] = {
|
||||
149,65,65,65,65,62,
|
||||
184,98,98,98,98,98,
|
||||
};
|
||||
|
||||
const unsigned bone_view_data_offsets[] = {
|
||||
0,3270,5354,7512,9884,12992,
|
||||
};
|
||||
|
||||
const unsigned char * const bone_view_spans[BONE_VIEW_COUNT] = {bone_spans,head_spans,hand_spans,foot_spans,spine_spans,chest_spans};
|
||||
const unsigned * const bone_view_offsets[BONE_VIEW_COUNT] = {bone_offsets,head_offsets,hand_offsets,foot_offsets,spine_offsets,chest_offsets};
|
||||
const unsigned bone_asset_size = 16640;
|
||||
const unsigned bone_asset_checksum = 50756;
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <coco.h>
|
||||
#include <Keyboard.h>
|
||||
#include <font5x8.h>
|
||||
#include <vcc/gime.h>
|
||||
#include "graphics.h"
|
||||
#include "geometry.h"
|
||||
#include "ui.h"
|
||||
#include "map_data.h"
|
||||
static Keyboard keyboard;
|
||||
@@ -11,46 +12,60 @@ 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;
|
||||
U8 c,row,col,bits,start;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;
|
||||
for(row=0;row<8;++row){
|
||||
bits=font5x8[(unsigned)(c-32)*8+row];col=0;
|
||||
while(col<5){
|
||||
if(bits&(128>>col)){++col;continue;}
|
||||
start=col;do{++col;}while(col<5 && !(bits&(128>>col)));
|
||||
gfx_fill_rect(x+start*2,y+row,(col-start)*2,1,color);
|
||||
}
|
||||
}
|
||||
x+=12;
|
||||
}
|
||||
}
|
||||
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);
|
||||
gfx_clear(0);text(16,3,"BONE QUEST",1);text(352,3,label,1);gfx_fill_rect(16,29,608,1,1);
|
||||
}
|
||||
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<BONE_COUNT;++b){
|
||||
col=b==current?6:(!progress||!answered[b]?3:(correct[b]?4:5));end=off[b+1];
|
||||
for(i=off[b];i<end;i+=3){
|
||||
y=data[i];x=data[i+1];n=data[i+2];if(y<cy || y>=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);
|
||||
const unsigned *off=bone_view_offsets[view];unsigned base=bone_view_data_offsets[view];
|
||||
U8 b,y,n,col,skip;unsigned i,end,left,right,x;
|
||||
for(b=0;b<BONE_DRAW_COUNT;++b){
|
||||
col=b==BONE_INK_INDEX?0:(b==current?2:(b<BONE_COUNT && progress && answered[b] && !correct[b]?3:1));end=off[b+1];
|
||||
i=off[b];if(i==end)continue;y=geometry_byte(base+i++);x=geometry_byte(base+i++);
|
||||
while(i<end){
|
||||
skip=geometry_byte(base+i++);
|
||||
if(skip==255){x+=(unsigned)geometry_byte(base+i)*256+geometry_byte(base+i+1);i+=2;}else x+=skip;
|
||||
while(x>=bone_view_widths[view]){x-=bone_view_widths[view];++y;}
|
||||
n=geometry_byte(base+i++);
|
||||
if(y>=cy && y<cy+ch){
|
||||
left=x>cx?x:(unsigned)cx;right=x+n;if(right>cx+cw)right=cx+cw;
|
||||
if(left<right)gfx_fill_rect(ox+(left-cx)*scale,oy+(unsigned)(y-cy)*scale,(right-left)*scale,scale,col);
|
||||
}
|
||||
x+=n;
|
||||
}
|
||||
}
|
||||
}
|
||||
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]);
|
||||
draw_view(0,current,progress,8+(200-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];
|
||||
gfx_fill_rect(216,30,424,106,0);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);
|
||||
draw_view(view,current,progress,224+(400-w)/2,34+(98-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);
|
||||
scale=98/h;if(!scale)scale=1;if(scale>4)scale=4;if((unsigned)w*scale>400)scale=(U8)(400/w);
|
||||
draw_view(0,current,progress,224+(400-(unsigned)w*scale)/2,34+(98-(unsigned)h*scale)/2,scale,x,y,w,h);
|
||||
}
|
||||
}
|
||||
static U8 any_key(void)
|
||||
@@ -66,9 +81,21 @@ 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);
|
||||
if(c==3 || c==27 || c=='q' || c=='Q')quit_game();
|
||||
entropy^=(unsigned)c<<8;return c;
|
||||
}
|
||||
void close_input(void)
|
||||
{
|
||||
if(initialized){Keyboard_shutdown(&keyboard);initialized=0;}
|
||||
}
|
||||
|
||||
/* Keep the reading pause responsive to the same global quit keys as menus. */
|
||||
void pause_or_quit(unsigned ticks)
|
||||
{
|
||||
unsigned since=getTimer();U8 c;
|
||||
if(!initialized){Keyboard_init(&keyboard);initialized=1;}
|
||||
do{
|
||||
c=Keyboard_poll(&keyboard);
|
||||
if(c==3 || c==27 || c=='q' || c=='Q')quit_game();
|
||||
}while((unsigned)(getTimer()-since)<ticks);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# Isolated high-resolution graphics checks
|
||||
|
||||
Run the independent graphics fixture with your own private ROMs:
|
||||
|
||||
```sh
|
||||
python3 tests/check_graphics.py --rom /path/to/coco3.rom --disk-rom /path/to/disk11.rom
|
||||
```
|
||||
|
||||
The installed VCC Plus app supplies the CMOC tools and isolated `vcc-playtest`
|
||||
helper. This does not launch or control the normal emulator, use personal media,
|
||||
or rebuild/replace the game disk. Each run builds a fresh fixture disk and keeps
|
||||
its source hashes, logs and captures beneath ignored `test-output/graphics/`.
|
||||
Use `--app` for another app bundle or `--evidence` for another output directory.
|
||||
Private ROM paths must be supplied explicitly; no ROMs are retained by the test.
|
||||
|
||||
The guest fixture checks every pixel in four observations of three 640 × 225
|
||||
four-color presentations, partial byte edges, all four 8 KiB bank seams, the final scan line,
|
||||
clipping and no-op inputs. It copies the displayed second page into the hidden
|
||||
first page, changes a few edge pixels, and verifies that every other pixel is
|
||||
preserved. A capture before the explicit third presentation verifies that the
|
||||
hidden edits have not appeared prematurely. It verifies normal MMU mappings between draw calls,
|
||||
page flipping, return to BASIC and zero disk writes on both emulated CPUs.
|
||||
Captures are actual guest frames, not synthesized previews. They do not establish
|
||||
physical hardware, host Intel or audible behavior.
|
||||
|
||||
The supplemental host check compiles the actual current `gfx_fill_rect` function
|
||||
with only its hardware span writer substituted. It compares all horizontal
|
||||
positions/widths on 15 critical rows and 1,000 clipped multirow rectangles with
|
||||
an independent per-pixel reference, including untouched neighboring bits and
|
||||
memory beyond the visible image. A host C compiler is required for this optional
|
||||
check; `--skip-host` records the skip instead of reporting it as a pass. Ordinary
|
||||
game builds do not require a host compiler or these tests.
|
||||
@@ -1,25 +1,58 @@
|
||||
"""Validate exact generated anatomy/data and compact rendering ownership."""
|
||||
"""Validate the authored bank and independently decode compact geometry."""
|
||||
import hashlib,json,re,runpy
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
|
||||
def read_views():
|
||||
source=(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*\{([^{}]*)\}',source)}
|
||||
names=re.findall(r'[A-Za-z_]\w*',re.search(r'bone_view_offsets\[[^]]*\]\s*=\s*\{([^}]+)\}',source)[1])
|
||||
blob=(ROOT/'assets/generated/BONES.DAT').read_bytes()
|
||||
assert len(blob)==int(re.search(r'bone_asset_size = (\d+)',source)[1])<=32768
|
||||
assert sum(blob)%65536==int(re.search(r'bone_asset_checksum = (\d+)',source)[1])
|
||||
widths=arrays['bone_view_widths'];heights=arrays['bone_view_heights'];assert len(names)==len(widths)==len(heights)==6
|
||||
count=len(json.loads((ROOT/'data/bones.json').read_text()));views=[]
|
||||
for name,w,h,base in zip(names,widths,heights,arrays['bone_view_data_offsets']):
|
||||
off=arrays[name];data=blob[base:base+off[-1]];assert len(off)==count+3 and off[0]==0 and off[-1]==len(data)
|
||||
layers=[]
|
||||
for start,end in zip(off,off[1:]):
|
||||
assert 0<=start<=end<=len(data);pixels=set();i=start
|
||||
if start<end:
|
||||
assert end-start>=4
|
||||
cursor=data[i]*w+data[i+1];i+=2
|
||||
while i<end:
|
||||
skip=data[i];i+=1
|
||||
if skip==255:
|
||||
assert i+2<=end;skip=data[i]*256+data[i+1];i+=2;assert skip>=255
|
||||
assert i<end
|
||||
n=data[i];i+=1;cursor+=skip;x=cursor%w;y=cursor//w
|
||||
assert n>0 and 0<=y<h and x+n<=w,(name,x,y,n)
|
||||
for pos in range(cursor,cursor+n):assert pos not in pixels;pixels.add(pos)
|
||||
cursor+=n
|
||||
assert i==end
|
||||
layers.append(pixels)
|
||||
views.append(dict(name=name,width=w,height=h,layers=layers))
|
||||
return views,arrays
|
||||
|
||||
def main():
|
||||
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<=y<heights[view] and 0<=x<x+n<=widths[view]
|
||||
for xx in range(x,x+n):assert (xx,y) not in occupied,(name,xx,y);occupied.add((xx,y))
|
||||
pairs.append(name)
|
||||
assert len(pairs)==6,pairs
|
||||
print('PASS authored bank/C identity, source SVG hash, six bounded disjoint views, 25 nonempty overview masks.')
|
||||
rows=json.loads((ROOT/'data/bones.json').read_text());manifest=json.loads((ROOT/'data/geometry-manifest.json').read_text())
|
||||
assert [t['code'] for t in manifest['topics']]==[r['code'] for r in rows]
|
||||
asset=(ROOT/manifest['asset']['file']).read_bytes()
|
||||
assert hashlib.sha256(asset).hexdigest()==manifest['asset']['sha256']
|
||||
assert sum(asset)%65536==manifest['asset']['checksum']
|
||||
assert len(rows)==28
|
||||
views,arrays=read_views()
|
||||
for view in views:
|
||||
occupied=set()
|
||||
for pixels in view['layers'][:-1]:
|
||||
assert not pixels&occupied,(view['name'],'overlapping ownership');occupied|=pixels
|
||||
assert view['layers'][-1],(view['name'],'missing outline')
|
||||
for i,row in enumerate(rows):
|
||||
assert views[0]['layers'][i]-views[0]['layers'][-1],(row['code'],'invisible overview')
|
||||
detail=arrays['bone_detail_view'][i]
|
||||
assert views[detail]['layers'][i]-views[detail]['layers'][-1],(row['code'],'invisible detail')
|
||||
print('PASS 28 authored structures/C identity, original SVG hash, six bounded delta views, visible topics and outlines.')
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,220 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Qualify the local 640x225 graphics driver on isolated VCC Plus machines.
|
||||
|
||||
Supply your own ROMs explicitly. This builds an independent fixture disk into a
|
||||
fresh ignored run directory, never uses the normal emulator or the game disk,
|
||||
and requires no Python packages beyond the standard library. Host arithmetic
|
||||
checks additionally need a host C compiler; --skip-host records that skip.
|
||||
"""
|
||||
import argparse
|
||||
import base64
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
import re
|
||||
import selectors
|
||||
import shutil
|
||||
import struct
|
||||
import subprocess
|
||||
import tempfile
|
||||
import zlib
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
COLORS=((0,0,0),(255,255,255),(255,255,0),(255,85,85))
|
||||
|
||||
|
||||
def sha(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def run(command,folder,log):
|
||||
with log.open('ab') as stream:
|
||||
subprocess.run([str(v) for v in command],cwd=folder,stdout=stream,
|
||||
stderr=subprocess.STDOUT,check=True)
|
||||
|
||||
|
||||
def host_arithmetic(folder,compiler):
|
||||
source=(ROOT/'src/graphics.c').read_text()
|
||||
start=source.index('void gfx_fill_rect(')
|
||||
end=source.index('\nvoid gfx_plot(',start)
|
||||
(folder/'graphics_fill_under_test.h').write_text(source[start:end]+'\n')
|
||||
executable=folder/'graphics_arithmetic'
|
||||
log=folder/'host-build.log'
|
||||
run([compiler,'-std=c99','-O2','-Wall','-Wextra','-Werror','-I'+str(ROOT),
|
||||
'-I'+str(folder),ROOT/'tests/graphics_arithmetic.c','-o',executable],folder,log)
|
||||
run([executable],folder,log)
|
||||
|
||||
|
||||
def build_fixture(app,folder):
|
||||
tools=app/'Contents/Resources/Toolchain/bin'
|
||||
compiler=tools/'cmoc'
|
||||
log=folder/'guest-build.log'
|
||||
for stem,source in (('fixture',ROOT/'tests/graphics_fixture.c'),
|
||||
('graphics',ROOT/'src/graphics.c')):
|
||||
run([compiler,'--coco','-O2','--intermediate','--intdir='+str(folder),
|
||||
'-I'+str(ROOT),'-c','-o',folder/(stem+'.o'),source],folder,log)
|
||||
run([compiler,'--coco','--org=2000','--limit=7800','--intermediate','-o',
|
||||
folder/'BONEQ.BIN',folder/'fixture.o',folder/'graphics.o'],folder,log)
|
||||
run([compiler,'--dos','-O0','--limit=2800','-o',folder/'boot.bin',
|
||||
ROOT/'tools/boot.c'],folder,log)
|
||||
disk=folder/'fixture.dsk'
|
||||
disk.write_bytes(bytes([255])*(35*18*256))
|
||||
run([tools/'install-coco-boot-loader',disk,folder/'boot.bin'],folder,log)
|
||||
run([tools/'writecocofile',disk,folder/'BONEQ.BIN'],folder,log)
|
||||
source=(folder/'BONEQ.map').read_text()
|
||||
phase=int(re.search(r'Symbol: _phase .*?= ([0-9A-Fa-f]+)',source)[1],16)
|
||||
return disk,phase
|
||||
|
||||
|
||||
def png(path):
|
||||
"""Decode the helper's 8-bit RGB/RGBA PNG without optional image modules."""
|
||||
blob=path.read_bytes();position=8;compressed=b''
|
||||
assert blob[:8]==b'\x89PNG\r\n\x1a\n'
|
||||
while position<len(blob):
|
||||
count=int.from_bytes(blob[position:position+4],'big')
|
||||
kind=blob[position+4:position+8]
|
||||
data=blob[position+8:position+8+count];position+=count+12
|
||||
if kind==b'IHDR':width,height,depth,color,*_=struct.unpack('>IIBBBBB',data)
|
||||
if kind==b'IDAT':compressed+=data
|
||||
assert depth==8 and color in (2,6)
|
||||
channels=3 if color==2 else 4;stride=width*channels
|
||||
raw=zlib.decompress(compressed);prior=bytearray(stride);rows=[];position=0
|
||||
for _ in range(height):
|
||||
method=raw[position];position+=1
|
||||
row=bytearray(raw[position:position+stride]);position+=stride
|
||||
assert method in range(5)
|
||||
for i in range(stride):
|
||||
a=row[i-channels] if i>=channels else 0
|
||||
b=prior[i];c=prior[i-channels] if i>=channels else 0
|
||||
if method==1:prediction=a
|
||||
elif method==2:prediction=b
|
||||
elif method==3:prediction=(a+b)//2
|
||||
elif method==4:
|
||||
v=a+b-c;pa=abs(v-a);pb=abs(v-b);pc=abs(v-c)
|
||||
prediction=a if pa<=pb and pa<=pc else b if pb<=pc else c
|
||||
else:prediction=0
|
||||
row[i]=(row[i]+prediction)&255
|
||||
rows.append(row);prior=row
|
||||
return width,height,channels,rows
|
||||
|
||||
|
||||
def rectangle(image,x,y,width,height,color):
|
||||
for yy in range(y,min(225,y+height)):
|
||||
for xx in range(x,min(640,x+width)):
|
||||
image[yy*640+xx]=color
|
||||
|
||||
|
||||
def expected_page(page):
|
||||
if page==1:
|
||||
image=[1]*(640*225)
|
||||
for i in range(1,5):
|
||||
rectangle(image,(i*8192%160)*4-3,i*8192//160,9,1,2)
|
||||
rectangle(image,638,223,9,9,0)
|
||||
rectangle(image,639,0,1,1,3);rectangle(image,0,224,1,1,3)
|
||||
else:
|
||||
image=[2]*(640*225)
|
||||
rectangle(image,0,0,640,1,1);rectangle(image,0,224,640,1,3)
|
||||
rectangle(image,0,0,1,225,0);rectangle(image,639,0,1,225,0)
|
||||
rectangle(image,17,51,619,154,3);rectangle(image,18,52,617,152,1)
|
||||
if page==4:
|
||||
rectangle(image,1,1,2,1,3);rectangle(image,639,224,1,1,1)
|
||||
return image
|
||||
|
||||
|
||||
def qualify_cpu(app,folder,disk,phase,cpu,system_rom,disk_rom):
|
||||
stderr=(folder/(cpu+'-helper.log')).open('w')
|
||||
process=subprocess.Popen([str(app/'Contents/Helpers/vcc-playtest')],
|
||||
stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=stderr,text=True,bufsize=1)
|
||||
selector=selectors.DefaultSelector();selector.register(process.stdout,selectors.EVENT_READ)
|
||||
def call(op,**kwargs):
|
||||
process.stdin.write(json.dumps(dict(op=op,**kwargs))+'\n');process.stdin.flush()
|
||||
if not selector.select(timeout=60):raise TimeoutError('Playtest helper timed out: '+op)
|
||||
line=process.stdout.readline()
|
||||
if not line:raise RuntimeError('Playtest helper closed during '+op)
|
||||
response=json.loads(line)
|
||||
if 'error' in response:raise RuntimeError('Playtest helper rejected '+op+': '+str(response['error']))
|
||||
return response['result']
|
||||
def step():return call('input',steps=[dict(mask=0,fields=600)])
|
||||
def key():return call('input',steps=[dict(mask=1<<31,fields=8),dict(mask=0,fields=600)])
|
||||
def current_phase():return call('read_memory',address=phase,count=1)['bytes'][0]
|
||||
def capture(name):
|
||||
result=call('capture');path=folder/(cpu+'-'+name+'.png')
|
||||
path.write_bytes(base64.b64decode(result.pop('png_base64')))
|
||||
(folder/(cpu+'-'+name+'.json')).write_text(json.dumps(result,indent=2)+'\n')
|
||||
return png(path)
|
||||
encode=lambda data:base64.b64encode(data).decode()
|
||||
try:
|
||||
call('init',system_rom=encode(system_rom),disk_rom=encode(disk_rom),
|
||||
disk=encode(disk.read_bytes()),cpu=cpu,boot_keys=[1<<b for b in (4,15,19,48)])
|
||||
step();assert current_phase()==1,(cpu,'first page phase',current_phase())
|
||||
top=None
|
||||
for page in (1,2,3,4):
|
||||
if page>1:key();assert current_phase()==page,(cpu,'page phase',page,current_phase())
|
||||
width,height,channels,rows=capture('page'+str(page))
|
||||
assert (width,height)==(640,480),(cpu,width,height)
|
||||
def pixel(x,y):return tuple(rows[y][x*channels:x*channels+3])
|
||||
if page==1:
|
||||
visible=[y for y in range(height)
|
||||
if sum(pixel(x,y)==COLORS[1] for x in range(width))>600]
|
||||
assert len(visible)==450 and max(visible)==min(visible)+449,(cpu,'active height')
|
||||
top=min(visible)
|
||||
expected=expected_page(page)
|
||||
for y in range(225):
|
||||
for x in range(640):
|
||||
value=COLORS[expected[y*640+x]]
|
||||
for repeat in (0,1):
|
||||
actual=pixel(x,top+y*2+repeat)
|
||||
assert actual==value,(cpu,page,x,y,actual,value)
|
||||
mmu=call('read_memory',address=0xffa0,count=8)['bytes']
|
||||
assert [value&63 for value in mmu]==list(range(0x38,0x40)),(cpu,'MMU restoration')
|
||||
key();assert current_phase()==5,(cpu,'exit phase',current_phase())
|
||||
result=call('capture')
|
||||
assert 'GRAPHICS TEST COMPLETE' in result.get('screen_text',''),(cpu,'BASIC return')
|
||||
capture('exit')
|
||||
final=call('stop')
|
||||
assert final['disk_writes']==0 and final['disk_sha256']==sha(disk),(cpu,'disk changed')
|
||||
process.wait(timeout=10)
|
||||
return dict(cpu=cpu,ramKB=512,width=640,height=225,frameTop=top,pageFlips=3,frontCopied=True,noPrematurePresentation=True,
|
||||
guestPixelsChecked=576000,clipping=True,partialByteEdges=True,
|
||||
bankBoundaries=True,MMURestored=True,BASICReturned=True,diskWrites=0)
|
||||
finally:
|
||||
if process.poll() is None:process.kill();process.wait(timeout=10)
|
||||
selector.close();stderr.close()
|
||||
|
||||
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--app',type=Path,default=Path('/Applications/VCC Plus.app'))
|
||||
parser.add_argument('--rom',type=Path,required=True)
|
||||
parser.add_argument('--disk-rom',type=Path,required=True)
|
||||
parser.add_argument('--cpu',choices=('6809','6309','both'),default='both')
|
||||
parser.add_argument('--evidence',type=Path,default=ROOT/'test-output/graphics')
|
||||
parser.add_argument('--cc',default='cc',help='Host C compiler for the arithmetic check')
|
||||
parser.add_argument('--skip-host',action='store_true',help='Skip and record the optional host-compiler check')
|
||||
args=parser.parse_args()
|
||||
args.app=args.app.resolve()
|
||||
system_rom=args.rom.read_bytes();disk_rom=args.disk_rom.read_bytes()
|
||||
evidence=args.evidence.resolve();evidence.mkdir(parents=True,exist_ok=True)
|
||||
folder=Path(tempfile.mkdtemp(prefix='run-',dir=evidence))
|
||||
sources=('src/graphics.c','graphics.h','tests/graphics_fixture.c','tests/graphics_arithmetic.c','tests/check_graphics.py','tools/boot.c')
|
||||
identity={path:sha(ROOT/path) for path in sources}
|
||||
if not args.skip_host:
|
||||
compiler=shutil.which(args.cc)
|
||||
if not compiler:parser.error('Host C compiler unavailable; supply --cc or record --skip-host.')
|
||||
host_arithmetic(folder,compiler);print('PASS host graphics arithmetic',flush=True)
|
||||
disk,phase=build_fixture(args.app,folder)
|
||||
reports=[]
|
||||
for cpu in (('6809','6309') if args.cpu=='both' else (args.cpu,)):
|
||||
reports.append(qualify_cpu(args.app,folder,disk,phase,cpu,system_rom,disk_rom))
|
||||
print('PASS',cpu,'640x225 pages, front copy, all pixels, clipping, bank seams, MMU and BASIC return',flush=True)
|
||||
assert identity=={path:sha(ROOT/path) for path in sources},'Source changed during graphics checks; rerun.'
|
||||
info=plistlib.loads((args.app/'Contents/Info.plist').read_bytes())
|
||||
report=dict(sourceSHA256=identity,fixtureDiskSHA256=sha(disk),
|
||||
emulatorVersion=info.get('CFBundleShortVersionString'),emulatorBuild=info.get('CFBundleVersion'),
|
||||
hostArithmetic='skipped by explicit option' if args.skip_host else 'passed',tests=reports)
|
||||
(folder/'verification.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
print('Evidence:',folder)
|
||||
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Reject missing/corrupt artwork cleanly in isolated disposable machines."""
|
||||
import argparse,base64,hashlib,json,subprocess
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
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/loader')
|
||||
a=p.parse_args();a.evidence.mkdir(parents=True,exist_ok=True)
|
||||
blob=(ROOT/'build/BONEQ.dsk').read_bytes();directory=17*18*256+2*256
|
||||
entry=next(i for i in range(directory,18*18*256,32) if blob[i:i+11]==b'BONES DAT')
|
||||
g=blob[entry+13];track=g//2;track+=track>=17;first=track*18*256+(g%2)*9*256
|
||||
reports=[]
|
||||
for cpu in ('6809','6309'):
|
||||
for variant in ('missing','wrong-size','wrong-checksum'):
|
||||
disk=bytearray(blob)
|
||||
if variant=='missing':disk[entry]=0
|
||||
elif variant=='wrong-size':disk[entry+14:entry+16]=bytes([0,255])
|
||||
else:disk[first]^=1
|
||||
sha=hashlib.sha256(disk).hexdigest()
|
||||
proc=subprocess.Popen([str(a.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']
|
||||
enc=lambda data:base64.b64encode(data).decode()
|
||||
try:
|
||||
call('init',system_rom=enc(a.rom.read_bytes()),disk_rom=enc(a.disk_rom.read_bytes()),disk=enc(disk),cpu=cpu,boot_keys=[1<<b for b in (4,15,19,48)])
|
||||
call('input',steps=[dict(mask=0,fields=600)])
|
||||
r=call('capture');assert 'CANNOT LOAD BONES.DAT' in r['screen_text'] and r['display_buffer']['width']==256,(cpu,variant,r['screen_text'])
|
||||
path=a.evidence/(cpu+'-'+variant+'.png');path.write_bytes(base64.b64decode(r['png_base64']))
|
||||
result=call('stop');assert result['disk_writes']==0 and result['disk_sha256']==sha
|
||||
reports.append(dict(cpu=cpu,variant=variant,BASICReturned=True,diskWrites=0))
|
||||
finally:
|
||||
proc.stdin.close();proc.wait(timeout=10)
|
||||
print('PASS',cpu,variant,flush=True)
|
||||
(a.evidence/'verification.json').write_text(json.dumps(reports,indent=2)+'\n')
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check global exits through real guest keys without controlling a desktop."""
|
||||
import argparse,base64,hashlib,json,re,subprocess
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
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/quit')
|
||||
a=p.parse_args();a.evidence.mkdir(parents=True,exist_ok=True)
|
||||
mp=(ROOT/'build/BONEQ.map').read_text();symbols={n:int(v,16) for n,v in re.findall(r'Symbol: _(\w+) .*?= ([0-9A-Fa-f]+)',mp)}
|
||||
rows=json.loads((ROOT/'data/bones.json').read_text());disk=(ROOT/'build/BONEQ.dsk').read_bytes();sha=hashlib.sha256(disk).hexdigest();reports=[]
|
||||
for cpu in ('6809','6309'):
|
||||
for scenario in ('title-Q','credits-Break','choice-Q','typed-q','typed-ASCII27','spelling-Break','typed-feedback-Q','auto-feedback-Break'):
|
||||
proc=subprocess.Popen([str(a.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 step(n=600):call('input',steps=[dict(mask=0,fields=n)])
|
||||
def press(mask,settle=600):call('input',steps=[dict(mask=mask,fields=8)]+([dict(mask=0,fields=settle)] if settle else []))
|
||||
def key(bit,settle=600):press(1<<bit,settle)
|
||||
def read(name):return call('read_memory',address=symbols[name],count=1)['bytes'][0]
|
||||
def ready(phase):
|
||||
for _ in range(120):
|
||||
if read('phase')==phase:return
|
||||
step(30)
|
||||
raise AssertionError(('screen not ready',scenario,phase,read('phase')))
|
||||
def type_text(text):
|
||||
for c in text:key(31 if c==' ' else ord(c.lower())-96,16)
|
||||
enc=lambda b:base64.b64encode(b).decode()
|
||||
stopped=False
|
||||
try:
|
||||
call('init',system_rom=enc(a.rom.read_bytes()),disk_rom=enc(a.disk_rom.read_bytes()),disk=enc(disk),cpu=cpu,boot_keys=[1<<b for b in (4,15,19,48)])
|
||||
step();ready(0)
|
||||
quit_mask=1<<17
|
||||
if scenario=='credits-Break':key(3);ready(5);quit_mask=1<<50
|
||||
elif scenario.startswith('choice') or scenario.startswith('auto-'):
|
||||
key(33);ready(1)
|
||||
if scenario.startswith('auto-'):
|
||||
current=read('current_bone');opts=call('read_memory',address=symbols['options'],count=4)['bytes']
|
||||
key(33+opts.index(current),0)
|
||||
for _ in range(1000):
|
||||
if read('phase')==3:break
|
||||
step(1)
|
||||
assert read('phase')==3;step(60);quit_mask=1<<50
|
||||
elif scenario!='title-Q':
|
||||
key(34);ready(1)
|
||||
if scenario=='typed-q':press((1<<55)|(1<<32),16);type_text('fem')
|
||||
elif scenario=='typed-ASCII27':quit_mask=(1<<28)|(1<<55)|(1<<52)
|
||||
elif scenario=='spelling-Break':
|
||||
name=rows[read('current_bone')]['name'];type_text(name[0]+name[2]+name[1]+name[3:]);key(48);ready(2);quit_mask=1<<50
|
||||
elif scenario=='typed-feedback-Q':key(48);ready(3)
|
||||
press(quit_mask);r=call('capture')
|
||||
assert 'THANKS FOR PLAYING BONE QUEST!' in r['screen_text'] and r['display_buffer']['width']==256,(cpu,scenario,r['screen_text'])
|
||||
assert [v&63 for v in call('read_memory',address=0xffa0,count=8)['bytes']]==list(range(0x38,0x40))
|
||||
if scenario=='auto-feedback-Break':assert read('question')==0,'Quit was delayed until next question'
|
||||
(a.evidence/(cpu+'-'+scenario+'.png')).write_bytes(base64.b64decode(r['png_base64']))
|
||||
final=call('stop');stopped=True;assert final['disk_writes']==0 and final['disk_sha256']==sha
|
||||
reports.append(dict(cpu=cpu,scenario=scenario,BASICReturned=True,MMURestored=True,diskWrites=0,diskSHA256=sha))
|
||||
finally:
|
||||
if not stopped:
|
||||
try:call('stop')
|
||||
except Exception:pass
|
||||
proc.stdin.close();proc.wait(timeout=10)
|
||||
print('PASS',cpu,scenario,flush=True)
|
||||
(a.evidence/'verification.json').write_text(json.dumps(reports,indent=2)+'\n')
|
||||
@@ -0,0 +1,60 @@
|
||||
/* Host check of the actual gfx_fill_rect arithmetic, with only the banked
|
||||
hardware span writer substituted. check_graphics.py extracts the current
|
||||
driver function into graphics_fill_under_test.h in a disposable build folder.
|
||||
GPL-3.0-or-later. */
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "graphics.h"
|
||||
typedef unsigned char byte;
|
||||
#define WINDOW 0x8000
|
||||
static byte back=0x1e;
|
||||
static byte image[40960],reference_image[40960];
|
||||
static void span(byte bank,unsigned address,byte firstMask,byte fullBytes,
|
||||
byte lastMask,byte packed)
|
||||
{
|
||||
unsigned pos=(bank-back)*8192+address-WINDOW;
|
||||
assert(pos<36000);
|
||||
if(firstMask) {image[pos]=(image[pos]&~firstMask)|(packed&firstMask);++pos;}
|
||||
while(fullBytes--) {assert(pos<36000);image[pos++]=packed;}
|
||||
if(lastMask) {assert(pos<36000);image[pos]=(image[pos]&~lastMask)|(packed&lastMask);}
|
||||
}
|
||||
#include "graphics_fill_under_test.h"
|
||||
|
||||
static void reference(unsigned x,unsigned y,unsigned w,unsigned h,byte color)
|
||||
{
|
||||
unsigned xx,yy,pos,shift;
|
||||
if(color>3 || x>=640 || y>=225 || !w || !h)return;
|
||||
if(w>640-x)w=640-x;
|
||||
if(h>225-y)h=225-y;
|
||||
for(yy=y;yy<y+h;++yy)for(xx=x;xx<x+w;++xx) {
|
||||
pos=yy*160+xx/4;shift=(3-xx%4)*2;
|
||||
reference_image[pos]=(reference_image[pos]&~(3<<shift))|(color<<shift);
|
||||
}
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
unsigned x,w,y,color,n;
|
||||
uint32_t seed=12345;
|
||||
static const unsigned rows[]={0,1,50,51,52,101,102,103,152,153,154,203,204,205,224};
|
||||
memset(image,0x96,sizeof(image));
|
||||
memset(reference_image,0x96,sizeof(reference_image));
|
||||
for(n=0;n<sizeof(rows)/sizeof(rows[0]);++n) {
|
||||
y=rows[n];
|
||||
for(x=0;x<640;++x)for(w=1;w<=640-x;++w) {
|
||||
color=(x+w+n)%4;gfx_fill_rect(x,y,w,1,color);reference(x,y,w,1,color);
|
||||
assert(!memcmp(image,reference_image,sizeof(image)));
|
||||
}
|
||||
}
|
||||
for(n=0;n<1000;++n) {
|
||||
seed=seed*1664525u+1013904223u;x=seed%700;
|
||||
seed=seed*1664525u+1013904223u;y=seed%260;
|
||||
seed=seed*1664525u+1013904223u;w=seed%700;
|
||||
seed=seed*1664525u+1013904223u;color=seed%5;
|
||||
gfx_fill_rect(x,y,w,n%250,color);reference(x,y,w,n%250,color);
|
||||
assert(!memcmp(image,reference_image,sizeof(image)));
|
||||
}
|
||||
puts("PASS graphics arithmetic: every x/width on15 edge/bank rows and1000 clipped multirow rectangles.");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Isolated 640x225 graphics regression fixture. GPL-3.0-or-later.
|
||||
Built/run only by check_graphics.py, never included in the game disk. */
|
||||
#include <cmoc.h>
|
||||
#include <coco.h>
|
||||
#include "graphics.h"
|
||||
|
||||
unsigned char phase;
|
||||
static void wait_for_space(void)
|
||||
{
|
||||
while(inkey()!=' ') {}
|
||||
while(inkey()) {}
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
unsigned i;
|
||||
setHighSpeed(TRUE);
|
||||
if(!gfx_open()) {phase=99;printf("GFX OPEN FAILED\n");return 1;}
|
||||
gfx_set_palette(0,0);gfx_set_palette(1,63);
|
||||
gfx_set_palette(2,54);gfx_set_palette(3,39);
|
||||
|
||||
gfx_clear(1);
|
||||
/* Each stripe straddles an 8 KiB physical bank boundary. */
|
||||
for(i=1;i<5;++i)
|
||||
gfx_fill_rect((i*8192u%160u)*4-3,i*8192u/160u,9,1,2);
|
||||
gfx_fill_rect(638,223,9,9,0);
|
||||
gfx_plot(639,0,3);gfx_plot(0,224,3);
|
||||
/* Empty, out-of-range and invalid-color draws must be no-ops. */
|
||||
gfx_fill_rect(100,100,0,12,3);gfx_fill_rect(100,100,12,0,3);
|
||||
gfx_fill_rect(640,0,3,3,3);gfx_fill_rect(0,225,3,3,3);
|
||||
gfx_fill_rect(10,10,9,9,4);
|
||||
if(!gfx_present()) {phase=98;return 1;}
|
||||
phase=1;wait_for_space();
|
||||
|
||||
/* A different image exercises the other page and many partial byte edges. */
|
||||
gfx_clear(2);
|
||||
gfx_fill_rect(0,0,640,1,1);gfx_fill_rect(0,224,640,1,3);
|
||||
gfx_fill_rect(0,0,1,225,0);gfx_fill_rect(639,0,1,225,0);
|
||||
gfx_fill_rect(17,51,619,154,3);gfx_fill_rect(18,52,617,152,1);
|
||||
if(!gfx_present()) {phase=97;return 1;}
|
||||
phase=2;wait_for_space();
|
||||
/* The hidden page still contains page1. Copy page2, edit two edges, and
|
||||
prove that the rest of page2 survives on this different physical page. */
|
||||
if(!gfx_copy_front()) {phase=96;return 1;}
|
||||
gfx_fill_rect(1,1,2,1,3);gfx_plot(639,224,1);
|
||||
/* These hidden edits must not appear until the explicit presentation. */
|
||||
phase=3;wait_for_space();
|
||||
if(!gfx_present()) {phase=95;return 1;}
|
||||
phase=4;wait_for_space();
|
||||
gfx_close();setHighSpeed(FALSE);phase=5;
|
||||
printf("GRAPHICS TEST COMPLETE\n");return 0;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ Requires explicitly supplied private ROMs; does not operate the personal emulato
|
||||
"""
|
||||
import argparse,ast,base64,hashlib,json,re,struct,subprocess,zlib
|
||||
from pathlib import Path
|
||||
from check_assets import read_views
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
|
||||
def png(path):
|
||||
@@ -30,11 +31,11 @@ def png(path):
|
||||
|
||||
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 guest(self,x,y):return tuple(self.rows[16+y*2][x*self.ch:x*self.ch+3])
|
||||
def text(self,x,y,n):
|
||||
bg=self.guest(x+5,y);out=''
|
||||
bg=self.guest(x+10,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)]
|
||||
bits=[self.guest(x+j*12+c*2,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)]
|
||||
@@ -48,7 +49,7 @@ def main():
|
||||
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()
|
||||
rows=json.loads((ROOT/'data/bones.json').read_text());count=len(rows);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 i<len(blob):
|
||||
@@ -56,8 +57,8 @@ def main():
|
||||
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)}
|
||||
views,arrays=read_views();colors={0:(0,0,0),1:(255,255,255),2:(255,255,0),3:(255,0,0)}
|
||||
manifest=json.loads((ROOT/'data/geometry-manifest.json').read_text())
|
||||
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)
|
||||
@@ -65,7 +66,7 @@ def main():
|
||||
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 press(mask,settle=600,hold=8):return call('input',steps=[dict(mask=mask,fields=hold)]+([dict(mask=0,fields=settle)] if settle else []))
|
||||
def key(bit,settle=600,hold=8):return press(1<<bit,settle,hold)
|
||||
def type_text(s):
|
||||
steps=[]
|
||||
@@ -78,40 +79,69 @@ def main():
|
||||
r=call('capture');path=out/(cpu+'-'+name+'.png');path.write_bytes(base64.b64decode(r.pop('png_base64')))
|
||||
(out/(cpu+'-'+name+'.json')).write_text(json.dumps(r,indent=2)+'\n');return Screen(path,font)
|
||||
def check_map(s,current,outcomes):
|
||||
def check_view(view,ox,oy,scale=1,cx=0,cy=0,cw=None,ch=None):
|
||||
w=view['width'];h=view['height'];cw=w if cw is None else cw;ch=h if ch is None else ch
|
||||
expected=[None]*(w*h)
|
||||
for bone,pixels in enumerate(view['layers']):
|
||||
col=0 if bone==count+1 else 2 if bone==current else 3 if outcomes.get(bone) is False else 1
|
||||
for pos in pixels:expected[pos]=colors[col]
|
||||
checked=0
|
||||
for bone in range(25):
|
||||
col=6 if bone==current else 4 if outcomes.get(bone) is True else 5 if bone in outcomes else 3
|
||||
for j in range(offsets[bone],offsets[bone+1],3):
|
||||
y,x,n=spans[j:j+3]
|
||||
for xx in range(x,x+n):
|
||||
assert s.guest(22+xx,30+y)==colors[col],(cpu,bone,current,xx,y,s.guest(22+xx,30+y),colors[col]);checked+=1
|
||||
assert checked>1000
|
||||
for y in range(cy,cy+ch):
|
||||
for x in range(cx,cx+cw):
|
||||
value=expected[y*w+x]
|
||||
if value is None:continue
|
||||
for yy in range(scale):
|
||||
for xx in range(scale):
|
||||
actual=s.guest(ox+(x-cx)*scale+xx,oy+(y-cy)*scale+yy)
|
||||
assert actual==value,(cpu,current,view['name'],x,y,actual,value)
|
||||
checked+=1
|
||||
assert checked>0
|
||||
check_view(views[0],8+(200-views[0]['width'])//2,30)
|
||||
if current is None:return
|
||||
detail=arrays['bone_detail_view'][current]
|
||||
if detail:
|
||||
view=views[detail];check_view(view,224+(400-view['width'])//2,34+(98-view['height'])//2)
|
||||
else:
|
||||
x,y,w,h=manifest['overviewBoxes'][rows[current]['code']]
|
||||
if x>2:x-=2;w+=2
|
||||
else:x=0
|
||||
if y>2:y-=2;h+=2
|
||||
else:y=0
|
||||
w+=2;h+=2;w=min(w,views[0]['width']-x);h=min(h,views[0]['height']-y)
|
||||
scale=max(1,min(4,98//h))
|
||||
if w*scale>400:scale=400//w
|
||||
check_view(views[0],224+(400-w*scale)//2,34+(98-h*scale)//2,scale,x,y,w,h)
|
||||
def ready(phase,q=None):
|
||||
for _ in range(120):
|
||||
if read('phase')==[phase] and (q is None or read('question')==[q]):return
|
||||
step(30)
|
||||
raise AssertionError(('Screen did not finish',cpu,phase,q,read('phase'),read('question')))
|
||||
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<<b for b in (4,15,19,48)])
|
||||
step();check_map(capture('title'),None,{})
|
||||
key(3);s=capture('credits');assert s.text(8,42,45)=='Skeleton: Mariana Ruiz Villarreal';key(31);key(33)
|
||||
step();ready(0);s=capture('title');check_map(s,None,{});assert s.text(224,35,34)==f'{count} STRUCTURES'
|
||||
key(3);s=capture('credits');assert s.text(16,42,45)=='Skeleton: Mariana Ruiz Villarreal';key(31);key(33)
|
||||
outcomes={};slots=[];visited=[]
|
||||
for q in range(25):
|
||||
assert read('phase')==[1] and read('question')==[q]
|
||||
for q in range(count):
|
||||
ready(1,q);assert read('phase')==[1] and read('question')==[q]
|
||||
bone=read('current_bone')[0];s=capture('mc-%02d-%s'%(q+1,rows[bone]['code']));check_map(s,bone,outcomes)
|
||||
assert s.text(8,19,45)==f'Question {q+1}/25 Score {sum(outcomes.values())}'
|
||||
opts=[s.text(112,132+i*11,34)[2:] for i in range(4)];assert len(set(opts))==4 and rows[bone]['name'] in opts,(q,opts)
|
||||
assert s.text(16,19,45)==f'Question {q+1}/{count} Score {sum(outcomes.values())}'
|
||||
opts=[s.text(224,168+i*11,34)[2:] for i in range(4)];assert len(set(opts))==4 and rows[bone]['name'] in opts,(q,opts)
|
||||
slot=opts.index(rows[bone]['name']);assert not slots or slot!=slots[-1];slots.append(slot);visited.append(bone)
|
||||
right=q%5!=0;selection=slot if right else (slot+1)%4
|
||||
right=q not in (0,5,10,15,20);selection=slot if right else (slot+1)%4
|
||||
if q==0:
|
||||
# Hold through feedback and the next question; only one answer.
|
||||
press(1<<(33+selection),600,600);assert read('question')==[1];step(16)
|
||||
else:key(33+selection)
|
||||
outcomes[bone]=right
|
||||
if q%5==0:print(cpu,'multiple choice',q+1,flush=True)
|
||||
assert len(set(visited))==25 and read('phase')==[4]
|
||||
s=capture('mc-results');check_map(s,None,outcomes);assert s.text(112,55,34)=='20 / 25 correct 80%'
|
||||
key(18);s=capture('mc-review');assert s.text(8,39,45)==rows[visited[0]]['name'];key(14);capture('mc-review-next');key(2);key(16);check_map(capture('replay-title'),None,{})
|
||||
ready(4);assert len(set(visited))==count and read('phase')==[4]
|
||||
s=capture('mc-results');check_map(s,None,outcomes);assert s.text(224,55,34)==f'{count-5} / {count} correct {(count-5)*100//count}%'
|
||||
key(18);ready(6);s=capture('mc-review');assert s.text(16,39,45)==rows[visited[0]]['name'];key(14);capture('mc-review-next');key(2);key(16);ready(0);check_map(capture('replay-title'),None,{})
|
||||
key(34);press((1<<55)|(1<<32),16);outcomes={};typed=[];corrections=0
|
||||
for q in range(25):
|
||||
assert read('phase')==[1] and read('question')==[q]
|
||||
for q in range(count):
|
||||
ready(1,q);assert read('phase')==[1] and read('question')==[q]
|
||||
bone=read('current_bone')[0];name=rows[bone]['name'];s=capture('typed-%02d-%s'%(q+1,rows[bone]['code']));check_map(s,bone,outcomes)
|
||||
right=q not in (2,3,4,5,6)
|
||||
if q==0:
|
||||
@@ -122,26 +152,33 @@ def main():
|
||||
elif q==1:
|
||||
type_text(rows[bone]['aliases'][0] if rows[bone]['aliases'] else name);capture('typed-alias')
|
||||
elif q==3:
|
||||
key(50)
|
||||
pass # Blank Enter now reveals; Break is a global quit key.
|
||||
elif q==4:
|
||||
type_text('X'*33);type_text('XXXXXX');step();s=capture('input-limit');assert s.text(112,132,34)=='X'*33+'_'
|
||||
type_text('X'*33);type_text('XXXXXX');step();s=capture('input-limit');assert s.text(224,168,34)=='X'*33+'_'
|
||||
elif q==5:pass
|
||||
elif q in (2,6):
|
||||
other=rows[(bone+1)%25];type_text(other['aliases'][0] if q==6 and other['aliases'] else other['name'])
|
||||
other=rows[(bone+1)%count];type_text(other['aliases'][0] if q==6 and other['aliases'] else other['name'])
|
||||
else:
|
||||
text=' '.join(name.split());text=(' '+text.replace(' ',' ')+' ') if q%3==0 else text.lower() if q%3==1 else text.upper();type_text(text)
|
||||
if q!=3:key(48)
|
||||
if q in (0,2):
|
||||
key(48,0)
|
||||
for _ in range(1200):
|
||||
if read('phase')==[3]:break
|
||||
step(1)
|
||||
assert read('phase')==[3]
|
||||
sound('correct-feedback' if right else 'incorrect-feedback');step()
|
||||
else:key(48)
|
||||
s=capture('typed-feedback-%02d'%(q+1));assert read('phase')==[3]
|
||||
assert s.text(112,134,30)==('CORRECT!' if right else 'NOT THIS TIME.'),(q,name,s.text(112,134,30))
|
||||
assert s.text(224,170,30)==('CORRECT!' if right else 'NOT THIS TIME.'),(q,name,s.text(224,170,30))
|
||||
outcomes[bone]=right;typed.append(bone);assert read('score')==[sum(outcomes.values())]
|
||||
key(31)
|
||||
if q%5==0:print(cpu,'typed',q+1,flush=True)
|
||||
assert len(set(typed))==25 and read('phase')==[4]
|
||||
s=capture('typed-results');check_map(s,None,outcomes);assert s.text(112,55,34)=='20 / 25 correct 80%';assert s.text(112,77,34)=='1 spelling corrections'
|
||||
key(18);s=capture('typed-review');assert s.text(8,39,45)==rows[typed[2]]['name'];key(2);key(17)
|
||||
ready(4);assert len(set(typed))==count and read('phase')==[4]
|
||||
s=capture('typed-results');check_map(s,None,outcomes);assert s.text(224,55,34)==f'{count-5} / {count} correct {(count-5)*100//count}%';assert s.text(224,77,34)=='1 spelling corrections'
|
||||
key(18);ready(6);s=capture('typed-review');assert s.text(16,39,45)==rows[typed[2]]['name'];key(50)
|
||||
s=capture('exit');r=call('capture');assert 'THANKS FOR PLAYING BONE QUEST!' in r.get('screen_text','')
|
||||
final=call('stop');final.pop('disk_base64',None);proc.wait(timeout=10)
|
||||
assert final['disk_writes']==0 and final['disk_sha256']==sha
|
||||
reports.append(dict(cpu=cpu,ramKB=512,multipleChoice=25,typed=25,score=20,spellingCorrections=1,mapPixelsChecked=True,noRepeatedCorrectSlots=True,heldKey=True,review=True,replay=True,exit=True,diskSHA256=sha,diskWrites=0))
|
||||
reports.append(dict(cpu=cpu,ramKB=512,multipleChoice=count,typed=count,score=count-5,spellingCorrections=1,mapPixelsChecked=True,detailPixelsChecked=True,feedbackAudio=True,noRepeatedCorrectSlots=True,heldKey=True,review=True,replay=True,exit=True,diskSHA256=sha,diskWrites=0))
|
||||
(out/'report.json').write_text(json.dumps(reports,indent=2)+'\n');print('PASS',cpu,'complete quizzes, map/colors/choices/input/review/replay/exit',flush=True)
|
||||
if __name__=='__main__':main()
|
||||
@@ -7,6 +7,10 @@ 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(n<ANSWER_SIZE-1);word[n++]=*p++;}word[n]=0;assert(classify(target,word)==(bone==target?2:0));if(*p)++p;}
|
||||
}
|
||||
static U8 named(const char *name)
|
||||
{
|
||||
U8 i;for(i=0;i<BONE_COUNT;++i)if(!strcmp(bones[i].name,name))return i;assert(0);return 0;
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
unsigned seed,i,j,k,p,slot,previous,positions[4]={0},transitions[4][4]={{0}};
|
||||
@@ -28,15 +32,15 @@ int main(void)
|
||||
for(j=0;j<BONE_COUNT;++j)if(j!=i){assert(classify(i,bones[j].name)==0);aliases(j,i);}
|
||||
assert(classify(i,"")==0 && classify(i,"not a bone")==0);
|
||||
}
|
||||
assert(classify(12,"Humeruz")==1);assert(classify(18,"Femru")==1);
|
||||
assert(classify(17,"phalanges")!=2 && classify(24,"phalanges")!=2);
|
||||
assert(classify(2," COLLAR BONE ")==2);
|
||||
assert(classify(named("Humerus"),"Humeruz")==1);assert(classify(named("Femur"),"Femru")==1);
|
||||
assert(classify(named("Finger phalanges"),"phalanges")!=2 && classify(named("Toe phalanges"),"phalanges")!=2);
|
||||
assert(classify(named("Clavicle")," COLLAR BONE ")==2);
|
||||
normalize(" \t Lumbar VERTEBRAE ",normalized);assert(!strcmp(normalized,"lumbar vertebrae"));
|
||||
quiz_start(2709);
|
||||
for(i=0;i<BONE_COUNT;++i){quiz_record(order[i],i%2?"wrong":bones[order[i]].name,!(i%2),!(i%4));quiz_record(order[i],"duplicate",1,1);}
|
||||
assert(score==13 && corrections==7);
|
||||
assert(score==(BONE_COUNT+1)/2 && corrections==(BONE_COUNT+3)/4);
|
||||
for(i=0;i<BONE_COUNT;++i)assert(answered[i]);
|
||||
quiz_start(2710);assert(!score && !corrections);
|
||||
for(i=0;i<BONE_COUNT;++i)assert(!answered[i] && !responses[i][0]);
|
||||
puts("PASS: 50000 unique option sets, no repeated correct slot, all permitted transitions, aliases/wrong-name guards, spelling, score and reset.");return 0;
|
||||
puts("PASS: 56000 unique option sets, no repeated correct slot, all permitted transitions, aliases/wrong-name guards, spelling, score and reset.");return 0;
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
"""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
|
||||
builds use the generated metadata and BONES.DAT 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.
|
||||
into a 28-structure pixel mask. All coordinates below refer to a 436x842 render of the
|
||||
source's nominal 435.687x841.89 viewBox; the SVG is rendered at 2x before reduction. No SVG is parsed on the CoCo.
|
||||
"""
|
||||
import argparse
|
||||
import copy
|
||||
@@ -19,7 +19,15 @@ import xml.etree.ElementTree as ET
|
||||
from PIL import Image, ImageChops
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
TOPICS = [
|
||||
RASTER_SCALE = 2
|
||||
RASTER_WIDTH, RASTER_HEIGHT = 436 * RASTER_SCALE, 842 * RASTER_SCALE
|
||||
|
||||
def scaled_box(box):
|
||||
return tuple(value * RASTER_SCALE for value in box)
|
||||
|
||||
def crop(mask, box):
|
||||
return mask.crop(scaled_box(box))
|
||||
ORIGINAL_GROUPS = [
|
||||
('CRANIUM', ['Cranium', 'g1297']),
|
||||
('MANDIBLE', ['Mandible']),
|
||||
('CLAVICLE', ['ClavicleLeft', 'ClavicleRight']),
|
||||
@@ -46,18 +54,6 @@ TOPICS = [
|
||||
('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):
|
||||
@@ -79,23 +75,6 @@ def selected_svg(source, elements, selected):
|
||||
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'
|
||||
@@ -103,140 +82,269 @@ def c_array(name, values, kind='unsigned char', static=False):
|
||||
for n in range(0,len(values),24)) + '};\n\n'
|
||||
|
||||
|
||||
|
||||
STRUCTURES = ['SKULL','CERVICAL','MANUBRIUM','STERNUM','XIPHOID','LUMBAR',
|
||||
'ILIUM','SACRUM','COCCYX','PUBIS','FEMUR','PATELLA','TARSALS',
|
||||
'METATARSALS','TOES','ORBIT','NASAL','CLAVICLE','SCAPULA','RIBS',
|
||||
'HUMERUS','ULNA','RADIUS','CARPALS','METACARPALS','FINGERS','FIBULA','TIBIA']
|
||||
PAINT_ORDER = [28,12,13,14,26,27,10,6,9,18,8,7,5,19,1,0,3,4,2,17,20,21,22,23,24,25,11,15,16]
|
||||
DETAIL_VIEW = [1,1,5,5,5,4,4,4,4,4,0,0,3,3,3,1,1,5,5,5,0,0,0,2,2,2,0,0]
|
||||
VIEWS = [('overview',(59,20,405,822),159,184),('head',(163,17,243,154),114,98),
|
||||
('hand',(313,397,410,500),185,98),('foot',(199,747,275,825),191,98),
|
||||
('spine',(126,274,279,423),201,98),('chest',(107,132,300,308),215,98)]
|
||||
|
||||
|
||||
def packed_runs(rows, width):
|
||||
"""Block: initial y,x, then skip,length pairs; 255 escapes a16-bit skip."""
|
||||
if not rows:
|
||||
return []
|
||||
result = [rows[0][0],rows[0][1]]
|
||||
end = rows[0][0]*width+rows[0][1]
|
||||
for y,x,length in rows:
|
||||
skip=y*width+x-end
|
||||
assert skip>=0 and 0<length<=255
|
||||
if skip>=255:
|
||||
result.extend((255,skip>>8,skip&255))
|
||||
else:
|
||||
result.append(skip)
|
||||
result.append(length)
|
||||
end=y*width+x+length
|
||||
return result
|
||||
|
||||
|
||||
def row_runs(pixels,width,height,value):
|
||||
rows=[]
|
||||
for y in range(height):
|
||||
x=0
|
||||
while x<width:
|
||||
if pixels[y*width+x]!=value:
|
||||
x+=1
|
||||
continue
|
||||
start=x
|
||||
while x<width and pixels[y*width+x]==value:
|
||||
x+=1
|
||||
rows.append((y,start,x-start))
|
||||
return rows
|
||||
|
||||
|
||||
def decode(data,offsets,width,height):
|
||||
pixels=bytearray(width*height)
|
||||
for structure in range(30):
|
||||
p,end=offsets[structure],offsets[structure+1]
|
||||
if p==end:
|
||||
continue
|
||||
y,x=data[p:p+2];p+=2
|
||||
while p<end:
|
||||
skip=data[p];p+=1
|
||||
if skip==255:
|
||||
skip=data[p]*256+data[p+1];p+=2
|
||||
x+=skip
|
||||
while x>=width:
|
||||
x-=width;y+=1
|
||||
length=data[p];p+=1
|
||||
assert 0<=y<height and 0<=x<x+length<=width
|
||||
for xx in range(x,x+length):
|
||||
assert pixels[y*width+xx]==0
|
||||
pixels[y*width+xx]=structure+1
|
||||
x+=length
|
||||
assert p==end
|
||||
return pixels
|
||||
|
||||
|
||||
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.')
|
||||
parser.error('Optional asset authoring requires rsvg-convert; ordinary builds use generated C.')
|
||||
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'],
|
||||
# Relax the artist's widely splayed anatomical left thumb (screen right).
|
||||
# Rotate the complete three-bone chain together about its wrist attachment;
|
||||
# the original SVG and all relative bone lengths/joints remain unchanged.
|
||||
thumb_ids = ('g1977', 'g1951', 'g1963')
|
||||
for ident in thumb_ids:
|
||||
element = elements[ident]
|
||||
assert not element.get('transform'), 'Review the source thumb transform'
|
||||
element.set('transform', 'rotate(30 367 416)')
|
||||
def render(ids):
|
||||
if any(i not in elements for i in ids):
|
||||
raise ValueError('Missing source SVG group: '+str(ids))
|
||||
result=subprocess.run([args.rsvg_convert,'-w',str(RASTER_WIDTH),'-h',str(RASTER_HEIGHT)],
|
||||
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)
|
||||
return Image.open(io.BytesIO(result.stdout)).convert('RGBA')
|
||||
def alpha(ids):return render(ids).getchannel('A')
|
||||
def clipped(mask,box):
|
||||
result=Image.new('L',mask.size);result.paste(crop(mask,box),scaled_box(box)[:2]);return result
|
||||
original=[alpha(ids) for code,ids in ORIGINAL_GROUPS]
|
||||
sternum=alpha(['Sternum']);pelvis=alpha(['PelvicGirdle']);skull=alpha(['Skull'])
|
||||
# The artist's explicit eye-recess paths provide both selectable orbits.
|
||||
for ident in ('path1577','path1579'):
|
||||
e=elements[ident];e.set('style',e.get('style','')+';opacity:1')
|
||||
orbit=alpha(['path1577','path1579'])
|
||||
# Select the visible nasal recess from the source's dark facial region.
|
||||
skull_rgb=render(['Skull']);nasal=Image.new('L',(RASTER_WIDTH,RASTER_HEIGHT))
|
||||
for y in range(75*RASTER_SCALE,103*RASTER_SCALE):
|
||||
for x in range(195*RASTER_SCALE,213*RASTER_SCALE):
|
||||
red,green,blue,a=skull_rgb.getpixel((x,y))
|
||||
if a>128 and (299*red+587*green+114*blue)//1000<140:
|
||||
nasal.putpixel((x,y),255)
|
||||
cartilage=[]
|
||||
for group in ('g845','g1609'):
|
||||
for e in elements[group].iter():
|
||||
if 'fill:#e1e2e3' in e.get('style',''):
|
||||
cartilage.append(e.get('id'))
|
||||
cartilage_mask=alpha(cartilage)
|
||||
# Preserve the rib faces rather than merging the original overlapping
|
||||
# shaded polygons into a solid chest plate. The original source luminance
|
||||
# separates light faces from darker boundaries and cast shadows.
|
||||
rib_rgb=render(['g845','g1609']);ribs=Image.new('L',(RASTER_WIDTH,RASTER_HEIGHT))
|
||||
raw=rib_rgb.tobytes()
|
||||
for pos in range(RASTER_WIDTH*RASTER_HEIGHT):
|
||||
red,green,blue,a=raw[pos*4:pos*4+4]
|
||||
if a>=128 and max(red,green,blue)-min(red,green,blue)>30 and (299*red+587*green+114*blue)//1000>=211:
|
||||
ribs.putpixel((pos%RASTER_WIDTH,pos//RASTER_WIDTH),255)
|
||||
masks=[skull,original[6],alpha(['Manubrium']),clipped(sternum,(0,0,436,228)),
|
||||
clipped(sternum,(0,228,436,842)),original[8],clipped(pelvis,(0,0,436,371)),
|
||||
original[9],original[10],alpha(['g447']),original[18],original[19],
|
||||
original[22],original[23],original[24],orbit,nasal,original[2],original[3],
|
||||
ribs,original[12],original[14],original[13],original[15],original[16],
|
||||
original[17],original[21],original[20]]
|
||||
context=ImageChops.lighter(original[7],clipped(pelvis,(0,371,436,842)))
|
||||
masks.append(ImageChops.lighter(context,cartilage_mask))
|
||||
# Retain the artist's darker bone boundaries and joint lines. A separate
|
||||
# black ink owner keeps these visible when the selected bone changes color.
|
||||
source_rgb=render(['layer3'])
|
||||
source_ink=Image.new('L',source_rgb.size)
|
||||
ink_bytes=bytearray(RASTER_WIDTH*RASTER_HEIGHT)
|
||||
source_bytes=source_rgb.tobytes()
|
||||
for pos in range(RASTER_WIDTH*RASTER_HEIGHT):
|
||||
red,green,blue,a=source_bytes[pos*4:pos*4+4]
|
||||
if a>=128 and (299*red+587*green+114*blue)//1000<180:
|
||||
ink_bytes[pos]=255
|
||||
source_ink.frombytes(bytes(ink_bytes))
|
||||
manifest=dict(schemaVersion=3,encoding='delta-runs-v1',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=[RASTER_WIDTH,RASTER_HEIGHT],sourceCoordinates=[436,842],pixelAspect=[1,2],topics=[dict(id=i,code=name) for i,name in enumerate(STRUCTURES)],
|
||||
contextIndex=28,inkIndex=29,drawCount=30,
|
||||
derivedRegions=dict(leftThumbPose=dict(elements=list(thumb_ids),rotationDegrees=30,pivot=[367,416],purpose='Relax the anatomical left thumb on screen right without changing bone lengths or joints'),sternum='Native Sternum path split atsource y228: body above, xiphoid below',
|
||||
ilium='Native PelvicGirdle upperwings clipped atsource y371; remaining lowerhip isneutralcontext',
|
||||
pubis='Nativeg447 pairedpubicarch',orbit='Nativepath1577/path1579 eye-recess shapes withopacityflattened',
|
||||
nasal='Source facialregion x195..212 y75..102 withluminance<140',
|
||||
ribs='Native g845/g1609 bright bone-face pixels, excluding gray cartilage; source rib matte occludes rear scapula',
|
||||
internalInk='Native full-skeleton luminance below180/255, box resampled coverage at least70/255; cavity cores retain their own selectable masks'),
|
||||
originalSourceGroups={name:ids for name,ids in ORIGINAL_GROUPS},views=[])
|
||||
code=['/* Generated source-derived Bone Quest structure masks. */\n#include "map_data.h"\n\n']
|
||||
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
|
||||
sizes=0;view_data=[];overview=None;asset=bytearray();data_offsets=[]
|
||||
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 topic==19:
|
||||
# Rear scapula and unlabelled spine must not fill the rib gaps.
|
||||
matte=crop(original[5],box).resize((width,height),Image.Resampling.LANCZOS)
|
||||
for p,value in enumerate(matte.tobytes()):
|
||||
if value>=64 and pixels[p] in (19,29):pixels[p]=0
|
||||
cart=crop(cartilage_mask,box).resize((width,height),Image.Resampling.LANCZOS)
|
||||
for p,value in enumerate(cart.tobytes()):
|
||||
if value>=64:pixels[p]=29
|
||||
mode=Image.Resampling.LANCZOS
|
||||
layer=crop(masks[topic],box).resize((width,height),mode)
|
||||
threshold=128 if topic in (0,6,10,18,19) else 64
|
||||
for p,value in enumerate(layer.tobytes()):
|
||||
if value>=threshold:pixels[p]=topic+1
|
||||
# Store internal separators. The black canvas supplies exterior contours,
|
||||
# avoiding duplicate edge data and an extra runtime outline pass.
|
||||
before=pixels[:]
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
p=y*width+x
|
||||
adjacent=[before[n] for n in (p-1,p+1,p-width,p+width)
|
||||
if 0<=n<len(before) and (n//width==y or n%width==x)]
|
||||
if before[p]==29 and any(0<v<29 for v in adjacent):pixels[p]=30
|
||||
elif before[p]==1 and any(v in (16,17) for v in adjacent):pixels[p]=30
|
||||
elif before[p]==4 and any(v in (3,5) for v in adjacent):pixels[p]=30
|
||||
ink_layer=crop(source_ink,box).resize((width,height),Image.Resampling.BOX)
|
||||
ink_values=ink_layer.tobytes()
|
||||
for p,value in enumerate(ink_values):
|
||||
if value>=70 and pixels[p] and pixels[p] not in (16,17):pixels[p]=30
|
||||
# Keep at least one visible fill pixel for every represented topic; this
|
||||
# protects the smallest overview structures from stroke quantization.
|
||||
for owner in range(1,29):
|
||||
if owner in before and owner not in pixels:
|
||||
candidates=[p for p,v in enumerate(before) if v==owner]
|
||||
p=min(candidates,key=lambda p:ink_values[p])
|
||||
pixels[p]=owner
|
||||
counts=[pixels.count(i+1) for i in range(30)]
|
||||
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<=y<height and 0<=x<x+length<=width
|
||||
for xx in range(x,x+length):
|
||||
pos=y*width+xx;assert decoded[pos]==0;decoded[pos]=topic+1
|
||||
assert decoded==pixels
|
||||
overview=pixels[:]
|
||||
if not all(counts[:28]):raise ValueError('Astructuredisappearedfromoverview:'+str(counts))
|
||||
data=[];offsets=[0]
|
||||
for i in range(30):data.extend(packed_runs(row_runs(pixels,width,height,i+1),width));offsets.append(len(data))
|
||||
assert decode(data,offsets,width,height)==pixels
|
||||
stem='bone' if view_index==0 else name
|
||||
data_offsets.append(len(asset));asset.extend(data)
|
||||
code.append(c_array(stem+'_offsets',offsets,'unsigned',static=True))
|
||||
sizes+=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,
|
||||
fileOffset=data_offsets[-1],spanBytes=len(data),offsetBytes=len(offsets)*2,pixels={STRUCTURES[i] if i<28 else 'CONTEXT' if i==28 else 'INK':counts[i] for i in range(30)}))
|
||||
# The black canvas supplies the exterior outlines; ink is internal.
|
||||
display=pixels
|
||||
sample=next((i for i,view in enumerate(DETAIL_VIEW) if view==view_index),0)
|
||||
colors=[(0,0,0)]+[(255,255,0) if i==sample else(255,255,255) for i in range(28)]+[(255,255,255),(0,0,0)]
|
||||
image=Image.new('RGB',(width,height));image.putdata([colors[value] for value in display]);image.save(generated/(name+'-preview.png'))
|
||||
image.resize((width*2,height*4),Image.Resampling.NEAREST).save(generated/(name+'-display-preview.png'))
|
||||
palette=[(0,0,85)]+[((i*73+80)%220+35,(i*41)%220+35,(i*109)%220+35) for i in range(29)]+[(0,0,0)]
|
||||
image.putdata([palette[value] for value in pixels]);image.save(generated/(name+'-regions.png'))
|
||||
boxes=[]
|
||||
for topic in range(1,26):
|
||||
points=[(i%64,i//64) for i,value in enumerate(overview_pixels) if value==topic]
|
||||
for topic in range(1,29):
|
||||
points=[(p%VIEWS[0][2],p//VIEWS[0][2]) for p,value in enumerate(overview) if value==topic]
|
||||
xmin=min(x for x,y in points);ymin=min(y for x,y in points)
|
||||
boxes.extend((xmin,ymin,max(x for x,y in points)-xmin+1,max(y for x,y in points)-ymin+1))
|
||||
code.append('const unsigned char bone_boxes[25][4] = {'+','.join('{'+','.join(map(str,boxes[i:i+4]))+'}' for i in range(0,100,4))+'};\n')
|
||||
code.append(c_array('bone_detail_view',DETAIL_VIEW))
|
||||
code.append(c_array('bone_view_widths',[v[1] for v in view_data]))
|
||||
code.append(c_array('bone_view_heights',[v[2] for v in view_data]))
|
||||
code.append('const unsigned char * const bone_view_spans[BONE_VIEW_COUNT] = {'+','.join(v[0]+'_spans' for v in view_data)+'};\n')
|
||||
code.append('const unsigned char bone_boxes[28][4] = {'+','.join('{'+','.join(map(str,boxes[i:i+4]))+'}' for i in range(0,112,4))+'};\n')
|
||||
code.append(c_array('bone_detail_view',DETAIL_VIEW));code.append(c_array('bone_view_widths',[v[1] for v in view_data]));code.append(c_array('bone_view_heights',[v[2] for v in view_data]))
|
||||
code.append(c_array('bone_view_data_offsets',data_offsets,'unsigned'))
|
||||
code.append('const unsigned * const bone_view_offsets[BONE_VIEW_COUNT] = {'+','.join(v[0]+'_offsets' for v in view_data)+'};\n')
|
||||
sizes+=len(boxes)+len(DETAIL_VIEW)+len(view_data)*2+len(view_data)*4
|
||||
if sizes>6000:
|
||||
raise ValueError('Geometry exceeds 6000-byte ROM budget: '+str(sizes))
|
||||
sizes+=len(boxes)+len(DETAIL_VIEW)+len(view_data)*6+4
|
||||
raw_size=len(asset)
|
||||
asset.extend(bytes((-len(asset))%256))
|
||||
if len(asset)>32768:raise ValueError('Banked geometry exceeds32768-byte budget:'+str(len(asset)))
|
||||
checksum=sum(asset)&65535
|
||||
code.append('const unsigned bone_asset_size = '+str(len(asset))+';\n')
|
||||
code.append('const unsigned bone_asset_checksum = '+str(checksum)+';\n')
|
||||
(generated/'BONES.DAT').write_bytes(asset)
|
||||
manifest['asset']=dict(file='assets/generated/BONES.DAT',spanBytes=raw_size,bytes=len(asset),sha256=hashlib.sha256(asset).hexdigest(),checksum=checksum,padding='Zero padded to256 bytes')
|
||||
(ROOT/'src/map_data.c').write_text(''.join(code))
|
||||
(ROOT/'map_data.h').write_text('''#ifndef BONE_MAP_DATA_H
|
||||
(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_MAP_WIDTH 159
|
||||
#define BONE_MAP_HEIGHT 184
|
||||
#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];
|
||||
#define BONE_CONTEXT_INDEX 28
|
||||
#define BONE_INK_INDEX 29
|
||||
#define BONE_DRAW_COUNT 30
|
||||
/* Each nonempty owner block starts y,x; then (skip,length) pairs. Skip255
|
||||
escapes 16-bit big-endian skip. Gaps are row-major from the previous run end.
|
||||
Offsets index bytes within each view,31 entries perview.
|
||||
View bytes live in external BONES.DAT, starting at bone_view_data_offsets.
|
||||
Native 640x225 pixels have1:2 width:height aspect; source masks are fitted accordingly. Context is neutral; ink is black.
|
||||
The black canvas supplies exterior contours; stored ink preserves internal lines.
|
||||
Boxes: xmin,ymin,width,height in overview pixels. View0=overview,1=head,
|
||||
2=hand,3=foot,4=pelvis/lowerback,5=chest. Selector 0 uses an overview crop. */
|
||||
extern const unsigned char bone_boxes[28][4];
|
||||
extern const unsigned char bone_detail_view[28];
|
||||
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 bone_view_data_offsets[BONE_VIEW_COUNT];
|
||||
extern const unsigned bone_asset_size, bone_asset_checksum;
|
||||
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)}
|
||||
""")
|
||||
manifest['geometryROMBytes']=sizes;manifest['detailSelector']=DETAIL_VIEW
|
||||
manifest['overviewBoxes']={STRUCTURES[i]:boxes[i*4:i*4+4] for i in range(28)}
|
||||
(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)
|
||||
print('PASS28 structures; exact disjoint delta decoding. Metadata ROM bytes:',sizes,'Banked asset bytes:',len(asset),'Unpadded:',raw_size,'Checksum:',checksum)
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
main()
|
||||
if __name__=='__main__':main()
|
||||
@@ -1,24 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Validate authored anatomy facts and regenerate the small CMOC question table."""
|
||||
"""Validate the 28 reference topics and regenerate the compact CMOC 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')
|
||||
CODES=('SKULL','CERVICAL','MANUBRIUM','STERNUM','XIPHOID','LUMBAR','ILIUM','SACRUM','COCCYX','PUBIS','FEMUR','PATELLA','TARSALS','METATARSALS','TOES','ORBIT','NASAL','CLAVICLE','SCAPULA','RIBS','HUMERUS','ULNA','RADIUS','CARPALS','METACARPALS','FINGERS','FIBULA','TIBIA')
|
||||
KINDS=('bone','bone_group','bone_part','cavity')
|
||||
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<len(row['name'])<=22 and 0<len(row['hint'])<=30
|
||||
assert 0<len(row['name'])<=18 and 0<len(row['hint'])<=30
|
||||
assert row['hint'].isascii() and row['kind'] in KINDS
|
||||
for value in [row['name']]+row['aliases']:
|
||||
assert value.isascii() and len(value)<40 and '|' not in value
|
||||
assert value.isascii() and 0<len(value)<=33 and '|' not in value
|
||||
normalized=' '.join(value.lower().split());assert normalized and normalized not in seen
|
||||
seen.add(normalized)
|
||||
assert all(a==a.lower() and a==' '.join(a.split()) for a in row['aliases'])
|
||||
out='/* Generated from data/bones.json; labels/codes remain in the authoring data. */\n#include "quiz.h"\nconst Bone bones[BONE_COUNT] = {\n'
|
||||
assert {r['code'] for r in rows if r['kind']=='cavity'}=={'ORBIT','NASAL'}
|
||||
out='/* Generated from data/bones.json; labels/codes/kinds remain in authoring data. */\n#include "quiz.h"\nconst Bone bones[BONE_COUNT] = {\n'
|
||||
for row in rows:out+=' {'+', '.join(json.dumps(value) for value in (row['name'],row['hint'],'|'.join(row['aliases'])))+'},\n'
|
||||
return out+'};\n'
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--check',action='store_true');args=parser.parse_args();out=generated();path=ROOT/'src/bones.c'
|
||||
if args.check:assert path.read_text()==out,'Regenerate src/bones.c';print('PASS 25 anatomy topics, unique aliases, bounds, and generated C identity.')
|
||||
if args.check:assert path.read_text()==out,'Regenerate src/bones.c';print('PASS 28 reference topics, unique aliases, bounds, structure kinds, and generated C identity.')
|
||||
else:path.write_text(out);print('Generated src/bones.c')
|
||||