Files
Quadrapassel/docs/CMOC_JOYSTICK_ARGUMENTS.md
T
Brian Holman a07c41555a Fix target joystick calibration arguments and scene transitions
Avoid a demonstrated CMOC -O2 removed-index-reload error with independent calibration and position pointers. Keep established joystick readiness across menus, stabilize shared fire/keyboard scans, and protect input sampling from IRQ interference.

Ship pristine QUADPSL04.DSK. Native right-port emulated analog/button checks pass for both directions, four lasting T-piece turns, and steering after keyboard resume. Host input/store/rules/video regressions and unchanged memory guards pass. Preserve personal score disks and record physical/128 KB/audio limits.
2026-11-11 14:26:06 -07:00

67 lines
3.6 KiB
Markdown

# Horizontal input compiler workaround — November 11, 2026
The build-03 native test reproduced constant right movement with the right port
assigned to VCC Plus Keyboard input (Arrows + Z / X). These host keys are reserved
for the emulated joystick, so guest A/D keyboard movement does not mask a bad
analog direction. Held-left entry into Controls read right X=0, Y=31. The actual
normal guest was then paused and inspected through the public native Debugger.
Build-03 QUAD.map identifies preferences=$1008, input=$101B, joystick_axes=$102C.
Memory showed preferences.centers[0..3]=31,31,31,31, axes=31,31,31,31 and raw
buttons=15, yet input.previous=Q_RIGHT, direction=+1 and axis_x=+1. No guest
memory, registers, PC or breakpoints were edited. This distinguishes correct
analog readings from the erroneous direction seen by the rules.
The generated main.s explains the mismatch. CMOC 0.1.100, bundled in official
VCC Plus 3.6.1 (53), --coco -O2 --no-relocate --switch=jump, originally emitted:
```asm
LDB index
ADDB #1
LDX #preferences_centers
LDB D,X ; cy, normally 31
PSHS B,A
; removeUselessLdaOrLdb removed the reload of index here
LDX #preferences_centers
LDB D,X ; uses the previous cy byte as the index for cx
PSHS B,A
```
These are abbreviated excerpts of compiler-generated game assembly; symbol and
stack spellings are shortened for readability. The wrong cx comes from outside
the four-byte array. A zero there makes neutral X=31 activate right, and full
left X=0 becomes neutral instead of negative. Ordinary host C tests do not run
this target optimizer. Earlier MCP guest keyboard LEFT also masks spurious
joystick RIGHT because the first horizontal direction wins.
The C-only workaround forms independent center/position base pointers before
passing element 0 and element 1. Generated argument loads are now pointer+1 and
pointer+0; the previous byte value is never reused as an array index. Both
ports use the same corrected call; actual left-port qualification is pending.
No compiler snapshot, emulator source, assembly or hardware driver was changed.
Brian authorized sending this finding to Core VCC Plus for separate follow-up.
## Target validation
Official native Release disk builds FC462D93 and A7A18927 succeeded with zero
issues; A7A18927 included the numbered delivery in its input identity. A native
Launch Disk mounts a separate working copy. It did not replace the old graphics
program in RAM, so the machine was explicitly cold-restarted and DOS run before
accepting any new evidence. Brian had authorized replacing his running game.
The clean build-04 disk has no QPSAVE files. MC6809 / 512 KB normal-window tests
using right-port Keyboard joystick mapping demonstrated both walls with the same
I piece, four distinct T orientations in sequence on short fire release, and
joystick LEFT after keyboard P/Enter pause/resume. The released button did not
undo a turn. CoCoMan's reference informed the shared-row/transition safeguards,
but its VCC-specific input API and assembly were not copied.
The right-port DualSense Wireless Controller assignment was restored (Standard,
left stick, Fire 1 Button 1, Fire 2 Button 2, 15% dead zone); left port None and
512 KB/MC6809 remained selected. The build-04 working copy is left paused.
This is emulated analog/button-path evidence, not physical DualSense or real
CoCo hardware qualification. Physical joystick, left port and 128 KB remain
pending. Normal-window speaker buzz remains open; no audible cure is claimed.
![Native right-port joystick LEFT after keyboard resume](screenshots/build04-native-joystick-after-resume.png)