Fix joystick fire ghost keys and independent axis arming

Filter keyboard rows grounded by joystick buttons before processing actions,
preventing right fire from acting as A/D/E and undoing its release rotation.
Arm X and Y independently so an uncentered vertical axis cannot block steering.

Reproduce both defects in host regressions, retain ordinary CMOC input APIs,
and update official project membership. Compact unchanged display data and make
render profiling optional to preserve the original memory and stack bounds.

Deliver QUADPSL02.DSK with fresh scores. Retire the old artifact from tracking
while leaving the loaded local disk untouched. Host suites, official Release
build and MC6809/512 KB keyboard/audio smoke checks pass. Actual joystick-port
confirmation and the reported normal-window buzz remain pending.
This commit is contained in:
Brian Holman committed 2026-11-11 13:27:18 -07:00
1 parent 356a7fc895
commit 2e163049d1
28 files changed
+382 -81

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
# Build 02 joystick correction — November 11, 2026
Brian reported that the right joystick could not move pieces reliably in either
VCC Plus or on the physical CoCo 3. Pressing fire appeared to rotate a piece;
releasing it turned the piece back. Build 01's simulated input tests had not
covered the actual keyboard adapter or a separately uncentered vertical axis.
## Reproduced causes and changes
The public coco.h key coordinates put A, D and E on row bit 0x01. Right fire
also grounds this shared input line. Calling isKeyPressed on that row while fire
is down can therefore report Left, Right and clockwise rotation together.
Releasing fire then generates the intended preferred rotation. With the default
counterclockwise preference, those two turns cancel, matching Brian's report.
The keyboard adapter now calls the same standard isKeyPressed API but skips only
rows grounded by joystick buttons. It uses the raw low nibble returned by the
standard readJoystickButtons API, covering all four button lines, including the
other port. Unaffected keyboard rows remain usable. Keyboard/joystick aliasing
is filtered before logical action processing. No direct hardware accesses,
custom driver or assembly were added. The adapter is now a separate, testable
C module, src/platform/keyboard.c, with build/project membership updated.
Separately, the old neutral guard required both X and Y to center before either
axis could work. A centered horizontal axis followed by left/right movement was
ignored indefinitely if Y remained outside its dead zone. The new guard arms
X and Y independently. It still requires an axis to center before accepting it,
retains hysteresis and horizontal repeat, requires neutral before another upward
hard drop, and keeps keyboard controls usable with a disconnected stick.
This independent guard defect is reproduced by tests; actual ADC traces from
Brian's physical joystick have not been captured.
## Shared examples and attribution
Pierre Sarrazin's CoCoPlanes 0.1.0 coco-planes.c (Copyright 2026 Pierre Sarrazin,
GPL-3.0-or-later) was consulted read-only. Its separate keyboard/joystick
controller paths, periodic sampling and active-low right/left primary-button
masks informed the comparison. The public installed Joystick.h and coco.h API
contracts were also read, including shared sound/analog input behavior. No
CoCoPlanes raw-register, interrupt or assembly routines were copied or used.
Existing standard CMOC joystick/sound APIs remain in use.
## Tests and memory
The new keyboard regression uses the actual keyboard adapter and an authored
mock of the shared keyboard/fire input lines. With the original polling it
fails immediately on right fire, reproducing false A/D/E actions. With the
filter it passes: all four fire lines, an unaffected BREAK key, left/right while
holding fire, one lasting rotation on release, both preferred rotation choices,
and normal keyboard/menu/initials aliases. The original axis guard also failed
the new centered-X/off-center-Y left/right test; the independent guards pass it.
Host ASan/UBSan rules, input, keyboard-adapter, persistence and video suites pass.
The existing 25 scoring cases still pass, including actual piece drops. Palette
and font pixels are unchanged. All caption scene/column/row/label values were
checked against build 01 after packing scene+column into one byte.
To retain the existing memory contract, unchanged caption coordinates are packed,
the 11 palette bytes and 15 preference-validation limits live in low static data,
and optional video_worst_ticks instrumentation is compiled only with
QUAD_PROFILE. That instrumentation is absent/unavailable in Release, rather than
reporting zero timing as a measurement. Profile builds still must pass the same
memory guard; they are not qualified by this release. Menu/game rendering and
all original bounds remain intact.
Release code/constants end $7AF6; static data end $13F6. Ten bytes remain before
each enforced limit. The 1,024-byte stack reserve is unchanged. No extra RAM is
required by design; actual 128 KB qualification remains pending.
## Official build and guest checks
Brian explicitly approved installed VCC Plus 3.6.1 (53) for the joystick checks
and granted an idle desktop window. The official project refresh reviewed the
new adapter, fixtures and Make/settings changes.
- Base revision: 356a7fc, main, plus this correction.
- Project: 7D6E1D9C-DF7C-4B15-B64D-6B30732417CB, revision 2.
- Release build: 9CFA6AC6-F75A-4515-9029-69129FEF3DD2; zero diagnostics.
- Artifact: C5E785C7-F0D2-407B-A626-D0FF3F9BCC22.
- QUAD.bin: 26,608 bytes, SHA-256
`f7e0aacb35782f6bbb8ccab1761b196b02afa4120ea496277c5a14dc478856db`.
- QUADPSL02.DSK: 161,280 bytes, SHA-256
`4e3af2440a3195ee5864498e39a779362988257d8a39cfc1c413157ace287a3c`.
Local delivery bytes match the official clean artifact. No QPSAVE data is
present; build 02 starts with defaults and an empty scoreboard.
- Owned MC6809/512 KB run: 4F2B442F-433B-4F30-8394-A6205C01FA0B, stopped.
DOS/title and keyboard move/rotate/Hold smoke checks passed. The title layout
and gameplay framebuffer were inspected after caption packing.
- Direct 120-field stereo PCM captures: idle entirely zero; movement effect
varies in both channels, peak 7936, ten changing edges, final 500 ms zero.
These build-53 results do not establish that the reported normal-window buzz
is fixed. The sound API usage was not changed by this correction.
![Build 02 title](screenshots/build02-title-512k.png)
![Build 02 gameplay](screenshots/build02-gameplay-512k.png)
The current MCP playtest_input schema injects keys only. These guest smoke checks
are keyboard evidence; authored host hardware models are regression evidence,
not physical joystick-port passes. Actual right/left port testing and the reported
normal-window buzzing remain pending user confirmation with build 02. No new
HD6309 qualification was performed. The personal normal emulator was not reset
or remounted; its loaded build-01 disk and personal score backups remain intact.
## Manual check for build 02
Use the right port and a fresh QUADPSL02.DSK copy. Center the stick, then hold
left, reverse to right and return to center. A short fire press must produce
one rotation on release that remains after the button is released. Repeat while
steering. Hold fire 400 ms to open Actions; release must not rotate or select a
second action. Check keyboard fallback and, separately, the left-port setting.
If X still sticks, distinguish movement that never starts from movement that
works once and then locks; record which system and port exhibit it.