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:
1 parent
356a7fc895
commit
2e163049d1
28 files changed
+382
-81
No files matched your search
@@ -27,3 +27,6 @@ HELLO.dsk
|
|||||||
|
|
||||||
# Historical probe build product; source and selected evidence are retained.
|
# Historical probe build product; source and selected evidence are retained.
|
||||||
/APIProbe.DSK
|
/APIProbe.DSK
|
||||||
|
|
||||||
|
# Superseded delivery remains loaded/personal locally; pristine copy is in history.
|
||||||
|
/QUADPSL01.DSK
|
||||||
@@ -9,7 +9,7 @@ Brian take precedence. Read `SPECIFICATION.md` and `docs/VCC_PLUS_WORKFLOW.md`.
|
|||||||
by default for authorized solo work. Preserve unrelated edits and user disks.
|
by default for authorized solo work. Preserve unrelated edits and user disks.
|
||||||
- The chat may be organized within the VCC Plus project. This does not authorize
|
- The chat may be organized within the VCC Plus project. This does not authorize
|
||||||
reading or editing other project repositories.
|
reading or editing other project repositories.
|
||||||
- Use official `/Applications/VCC Plus.app` **3.6.0 (51)** (approved by Brian November 11, 2026) and its supported MCP.
|
- Use official `/Applications/VCC Plus.app` **3.6.1 (53)** (approved by Brian November 11, 2026 for the joystick checks) and its supported MCP.
|
||||||
No custom VCC Plus builds, emulator patches, private protocol calls, replacement
|
No custom VCC Plus builds, emulator patches, private protocol calls, replacement
|
||||||
MCP integration, or requests for VCC Plus feature changes.
|
MCP integration, or requests for VCC Plus feature changes.
|
||||||
- Do not inspect VCC Plus implementation source, private developer guides or
|
- Do not inspect VCC Plus implementation source, private developer guides or
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ SOURCES := src/game/rules.c src/platform/coco3_video.c src/APIProbe/src/disk.c g
|
|||||||
LDLIBS += -ldecbfile
|
LDLIBS += -ldecbfile
|
||||||
else
|
else
|
||||||
ENTRY := main.c
|
ENTRY := main.c
|
||||||
SOURCES := src/game/rules.c src/game/input.c src/game/store.c src/platform/coco3_video.c src/platform/video.c src/platform/disk_store.c
|
SOURCES := src/game/rules.c src/game/input.c src/game/store.c src/platform/coco3_video.c src/platform/video.c src/platform/keyboard.c src/platform/disk_store.c
|
||||||
LDLIBS += -lcardgame -lbsound -ldecbfile
|
LDLIBS += -lcardgame -lbsound -ldecbfile
|
||||||
endif
|
endif
|
||||||
OBJECTS := obj/entry.o $(SOURCES:%.c=obj/%.o)
|
OBJECTS := obj/entry.o $(SOURCES:%.c=obj/%.o)
|
||||||
|
|||||||
Binary file not shown.
@@ -74,15 +74,15 @@ ROM, emulator implementation, or third-party sound payload is included.
|
|||||||
|
|
||||||
## Run the current CoCo 3 disk
|
## Run the current CoCo 3 disk
|
||||||
|
|
||||||
Mount a writable copy of [QUADPSL01.DSK](QUADPSL01.DSK) in drive 0 and type
|
Mount a writable copy of [QUADPSL02.DSK](QUADPSL02.DSK) in drive 0 and type
|
||||||
`DOS`. Keep the downloaded original pristine. The current build targets the
|
`DOS`. Keep the downloaded original pristine. The current build targets the
|
||||||
CoCo 3; CoCo 2 adaptation is deferred. Allow disk loading and explicit saves to
|
CoCo 3; CoCo 2 adaptation is deferred. Allow disk loading and explicit saves to
|
||||||
finish before the next action. High scores/settings use QPSAVE0.DAT and
|
finish before the next action. High scores/settings use QPSAVE0.DAT and
|
||||||
QPSAVE1.DAT; QPTEXT.DAT contains read-only menu text.
|
QPSAVE1.DAT; QPTEXT.DAT contains read-only menu text.
|
||||||
Each numbered build starts with empty high scores and default preferences.
|
Each numbered build starts with empty high scores and default preferences.
|
||||||
Existing personal score disks remain untouched; scores are not copied into the
|
Existing personal score disks remain untouched; scores are not copied into the
|
||||||
new build. The current delivery is **build 01**; the next changed delivery will
|
new build. The current delivery is **build 02**; the next changed delivery will
|
||||||
be build 02. See [build records](docs/BUILDS.md). The official recipe still uses
|
be build 03. See [build records](docs/BUILDS.md). The official recipe still uses
|
||||||
Quadrapassel.DSK as its clean staging artifact.
|
Quadrapassel.DSK as its clean staging artifact.
|
||||||
|
|
||||||
The separately verified manual fallback on the 512 KB test machine is:
|
The separately verified manual fallback on the 512 KB test machine is:
|
||||||
@@ -111,3 +111,8 @@ Settings names the scoring choices **Modern** and **Classic (40.2)**. Switching
|
|||||||
changes the next game and defaults to keeping existing high scores. Both
|
changes the next game and defaults to keeping existing high scores. Both
|
||||||
formulas match the supplied Mac source. The reported normal-window buzz remains
|
formulas match the supplied Mac source. The reported normal-window buzz remains
|
||||||
unconfirmed fixed; isolated audio is quiet between effects.
|
unconfirmed fixed; isolated audio is quiet between effects.
|
||||||
|
|
||||||
|
Build 02 corrects joystick fire being mistaken for keyboard actions and allows
|
||||||
|
horizontal movement when only X has centered. Host regressions and official
|
||||||
|
keyboard smoke checks pass; actual joystick confirmation remains pending.
|
||||||
|
See [joystick correction](docs/JOYSTICK_FIX.md).
|
||||||
@@ -121,3 +121,11 @@ capture contains 88,651 frames, idle captures 88,652 at 44,100 Hz. Checks pass.
|
|||||||
Owned runs are stopped. The normal-window buzz remains unconfirmed fixed and
|
Owned runs are stopped. The normal-window buzz remains unconfirmed fixed and
|
||||||
needs the new candidate retested in that same environment. Full final identity
|
needs the new candidate retested in that same environment. Full final identity
|
||||||
and preserved-score disk are in TITLE_AND_SCORING_UPDATE.md.
|
and preserved-score disk are in TITLE_AND_SCORING_UPDATE.md.
|
||||||
|
|
||||||
|
Build 02 changes keyboard/joystick logical handling, not sound APIs. Official
|
||||||
|
build-53 MC6809/512 KB idle capture remains zero; the positive movement capture
|
||||||
|
has both-channel peak 7936, ten changing edges and silent final 500 ms. These
|
||||||
|
120-field captures pass the existing checker. The user-reported normal-window
|
||||||
|
buzz was still present on build 01 and remains open pending build-02 retest;
|
||||||
|
the differing emulator versions prevent treating effect peak changes as a
|
||||||
|
controlled game-volume comparison. See JOYSTICK_FIX.md for the current artifact.
|
||||||
+11
-4
@@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
Brian requested this delivery convention on November 11, 2026:
|
Brian requested this delivery convention on November 11, 2026:
|
||||||
`QUADPSLxx.DSK`, with a two-digit build number and fresh high scores for each
|
`QUADPSLxx.DSK`, with a two-digit build number and fresh high scores for each
|
||||||
new delivered build. Begin at 01. The next changed delivery is 02. This number
|
new delivered build. Begin at 01. The current delivery is 02; the next changed delivery is 03. This number
|
||||||
identifies the game disk, independently of the VCC Plus application build.
|
identifies the game disk, independently of the VCC Plus application build.
|
||||||
|
|
||||||
| Build | Date | Filename | Contents / validation |
|
| Build | Date | Filename | Contents / validation |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| 01 | 2026-11-11 | QUADPSL01.DSK | Current title spacing, credits, scoring labels and extra standard-library mute; byte-identical to the verified clean official artifact described in TITLE_AND_SCORING_UPDATE.md |
|
| 01 | 2026-11-11 | QUADPSL01.DSK | Title spacing, credits, scoring labels and extra standard-library mute; historical artifact in Git |
|
||||||
|
| 02 | 2026-11-11 | QUADPSL02.DSK | Fix shared fire/keyboard rows and independently arm joystick axes; see JOYSTICK_FIX.md |
|
||||||
|
|
||||||
Build 01 is 161,280 bytes, SHA-256:
|
Build 01 is 161,280 bytes, SHA-256:
|
||||||
`4ac171e87c51dfd99b302b9e035a91a59c030144e5ae0661a6d2dfc84ba3a63f`.
|
`4ac171e87c51dfd99b302b9e035a91a59c030144e5ae0661a6d2dfc84ba3a63f`.
|
||||||
@@ -34,9 +35,15 @@ November 11. The Git commit adding QUADPSL01.DSK records its source snapshot;
|
|||||||
use `git log -- QUADPSL01.DSK` to identify that commit. The game bytes were
|
use `git log -- QUADPSL01.DSK` to identify that commit. The game bytes were
|
||||||
qualified before committing and are unchanged from the official artifact.
|
qualified before committing and are unchanged from the official artifact.
|
||||||
|
|
||||||
Brian also requested cleanup of obsolete builds. Build 01 is the only retained
|
At the build-01 stage, Brian requested cleanup of obsolete builds. Build 01
|
||||||
current game delivery. Compiled objects, generated staging files, old probe/
|
was then the only retained current game delivery. Compiled objects, generated staging files, old probe/
|
||||||
staging images and host test scratch were removed after verification. Personal
|
staging images and host test scratch were removed after verification. Personal
|
||||||
score backups and the mounted disk remain untouched; ignored WAV/JSON diagnostic
|
score backups and the mounted disk remain untouched; ignored WAV/JSON diagnostic
|
||||||
evidence is retained while the normal-window buzz is unresolved. Historical
|
evidence is retained while the normal-window buzz is unresolved. Historical
|
||||||
source and selected evidence remain in Git.
|
source and selected evidence remain in Git.
|
||||||
|
|
||||||
|
Build 02 is the current clean delivery. SHA-256:
|
||||||
|
`4e3af2440a3195ee5864498e39a779362988257d8a39cfc1c413157ace287a3c`.
|
||||||
|
The old build-01 filename was observed loaded in VCC Plus, so that local disk is
|
||||||
|
left untouched during cleanup. Its pristine historical artifact remains in Git
|
||||||
|
history; it is excluded from future commits to protect any personal save writes.
|
||||||
@@ -4,7 +4,21 @@ The current disk contains a playable CoCo 3 game with standard CMOC sound,
|
|||||||
settings and disk-backed high scores. Actual 128 KB qualification remains
|
settings and disk-backed high scores. Actual 128 KB qualification remains
|
||||||
pending; CoCo 2 adaptation is deferred at Brian's direction.
|
pending; CoCo 2 adaptation is deferred at Brian's direction.
|
||||||
|
|
||||||
## Current numbered delivery
|
## Current joystick correction — build 02
|
||||||
|
|
||||||
|
QUADPSL02.DSK fixes shared fire/keyboard input lines and arms joystick axes
|
||||||
|
independently. Both reported failure patterns were reproduced in host regressions
|
||||||
|
and pass after correction. Standard CMOC APIs are retained. Official VCC Plus
|
||||||
|
3.6.1 (53) Release build and MC6809/512 KB keyboard/gameplay smoke checks pass;
|
||||||
|
physical joystick testing is still pending. Details, source references and final
|
||||||
|
identity: [JOYSTICK_FIX.md](JOYSTICK_FIX.md).
|
||||||
|
|
||||||
|
Clean disk SHA-256:
|
||||||
|
`4e3af2440a3195ee5864498e39a779362988257d8a39cfc1c413157ace287a3c`.
|
||||||
|
Code/constants end $7AF6, static data end $13F6; original stack/bounds retained.
|
||||||
|
The normal-window buzz remains open. Old personal score disks are untouched.
|
||||||
|
|
||||||
|
## Earlier numbered delivery
|
||||||
|
|
||||||
Brian requested `QUADPSLxx.DSK` with a two-digit build number and fresh high
|
Brian requested `QUADPSLxx.DSK` with a two-digit build number and fresh high
|
||||||
scores. The first is **QUADPSL01.DSK**, byte-identical to the clean official
|
scores. The first is **QUADPSL01.DSK**, byte-identical to the clean official
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
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.
|
||||||
@@ -59,3 +59,9 @@ project connection was renewed through the supported interface. Current project
|
|||||||
on official build 51. get_machine_status read normal-session configuration;
|
on official build 51. get_machine_status read normal-session configuration;
|
||||||
no writable disks or peripherals were removed to satisfy native-run blockers.
|
no writable disks or peripherals were removed to satisfy native-run blockers.
|
||||||
The new candidate used only disposable playtests.
|
The new candidate used only disposable playtests.
|
||||||
|
|
||||||
|
Brian approved official VCC Plus 3.6.1 (53) and an idle desktop window for the
|
||||||
|
joystick investigation. The renewed connection verified project
|
||||||
|
7D6E1D9C-DF7C-4B15-B64D-6B30732417CB, revision 2, built successfully and ran the
|
||||||
|
frozen artifact. Its playtest_input schema still supports only keyboard keys,
|
||||||
|
not analog axes/fire injection. No native joystick pass is inferred from it.
|
||||||
@@ -14,8 +14,8 @@ outside live game state. No BASIC user program or prior
|
|||||||
low-resolution picture is preserved by launching
|
low-resolution picture is preserved by launching
|
||||||
this game. BASIC system RAM, text RAM and disk buffers below $0E00 remain intact.
|
this game. BASIC system RAM, text RAM and disk buffers below $0E00 remain intact.
|
||||||
|
|
||||||
The November 11 layout/scoring-label update ends code/constants at $7AF4 and static data at
|
The November 11 joystick update ends code/constants at $7AF6 and static data at
|
||||||
$13DE (1,502 bytes including initialized variables). The limits remain unchanged.
|
$13F6 (1,526 bytes including initialized variables). The limits remain unchanged.
|
||||||
The font uses 336 row bytes plus 12 punctuation codes; 198 bytes of font/packing
|
The font uses 336 row bytes plus 12 punctuation codes; 198 bytes of font/packing
|
||||||
data are stored in the low data region and only read by the renderer. $7B00–$7FFF is kept free for
|
data are stored in the low data region and only read by the renderer. $7B00–$7FFF is kept free for
|
||||||
the foreground/ROM stack, with CMOC configured for 1,024 bytes. The split layout has passed settings and earned-score save/reload checks on
|
the foreground/ROM stack, with CMOC configured for 1,024 bytes. The split layout has passed settings and earned-score save/reload checks on
|
||||||
@@ -47,3 +47,9 @@ Files longer than the schema allows are rejected and reported; the program does
|
|||||||
not truncate an unexpectedly oversized file. Missing/short inactive files can be
|
not truncate an unexpectedly oversized file. Missing/short inactive files can be
|
||||||
created/extended using the documented file API. Only the two named save files
|
created/extended using the documented file API. Only the two named save files
|
||||||
are written. QPTEXT.DAT is read-only game data.
|
are written. QPTEXT.DAT is read-only game data.
|
||||||
|
|
||||||
|
Build 02 packs each caption's scene and column into one byte, preserving all
|
||||||
|
positions. The palette (11 bytes) and preference-validation table (15 bytes)
|
||||||
|
use low static data; they are only read. Optional video timing instrumentation
|
||||||
|
is enabled only by QUAD_PROFILE and is unavailable in Release. Every profile
|
||||||
|
build still needs the unchanged link guard; profile configurations are unqualified.
|
||||||
@@ -107,3 +107,10 @@ Classic (40.2) formulas. `scoring_through_drop` in tests/rules_test.c adapts the
|
|||||||
GPL-3.0-or-later setup in its tests/test-scoring.vala to exercise actual piece
|
GPL-3.0-or-later setup in its tests/test-scoring.vala to exercise actual piece
|
||||||
drops, bottom-row detection and level changes in the CoCo rules engine. No Mac
|
drops, bottom-row detection and level changes in the CoCo rules engine. No Mac
|
||||||
application code was changed or bundled.
|
application code was changed or bundled.
|
||||||
|
|
||||||
|
For the build-02 joystick correction, Pierre Sarrazin's GPL-3.0-or-later
|
||||||
|
CoCoPlanes 0.1.0 coco-planes.c was consulted for its separate controller paths,
|
||||||
|
periodic sampling and active-low primary-button masks. Public coco.h keyboard
|
||||||
|
coordinates and Joystick.h contracts identify the shared input rows. No raw
|
||||||
|
register/interrupt/assembly code was copied. The new keyboard-row fixture is
|
||||||
|
authored for this repository; details are in JOYSTICK_FIX.md.
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
## Required installed app
|
## Required installed app
|
||||||
|
|
||||||
Use `/Applications/VCC Plus.app`, **version 3.6.0, build 51**, explicitly approved by Brian
|
Use `/Applications/VCC Plus.app`, **version 3.6.1, build 53**, explicitly approved by Brian
|
||||||
on November 11, 2026 for reconnection and isolated build/playtest. The installed
|
on November 11, 2026 for the joystick investigation, reconnection and isolated build/playtest. The installed
|
||||||
Info.plist was verified. Earlier build-48 evidence remains historical.
|
Info.plist was verified. Earlier build-48 evidence remains historical.
|
||||||
Verify again at implementation start.
|
Verify again at implementation start.
|
||||||
If the app differs, report it and wait for Brian to approve a different version.
|
If the app differs, report it and wait for Brian to approve a different version.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -4,6 +4,7 @@
|
|||||||
#include <Player.h>
|
#include <Player.h>
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "keyboard.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "disk_store.h"
|
#include "disk_store.h"
|
||||||
@@ -53,28 +54,6 @@ static void new_game(void)
|
|||||||
q_start(&game,&options);active=1;score_eligible=1;enter(PLAY);
|
q_start(&game,&options);active=1;score_eligible=1;enter(PLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct { Q8 probe,bit;Q16 action; } KeyBinding;
|
|
||||||
#define BIND(name,action) {KEY_PROBE_##name,KEY_BIT_##name,action}
|
|
||||||
static const KeyBinding keys[]={
|
|
||||||
BIND(LEFT,Q_LEFT),BIND(RIGHT,Q_RIGHT),BIND(UP,Q_UP),BIND(DOWN,Q_DOWN),
|
|
||||||
BIND(ENTER,Q_CONFIRM),BIND(BREAK,Q_BACK),
|
|
||||||
BIND(A,Q_LEFT),BIND(D,Q_RIGHT),BIND(W,Q_UP),BIND(S,Q_DOWN),
|
|
||||||
BIND(Q,Q_CCW),BIND(E,Q_CW),BIND(SPACE,Q_CONFIRM),BIND(H,Q_HOLD),BIND(P,Q_PAUSE)
|
|
||||||
};
|
|
||||||
static Q16 keyboard(void)
|
|
||||||
{
|
|
||||||
Q16 held=0,action;Q8 i,count=scene==INITIALS?6:sizeof(keys)/sizeof(keys[0]);
|
|
||||||
for(i=0;i<count;++i)if(isKeyPressed(keys[i].probe,keys[i].bit)){
|
|
||||||
action=keys[i].action;
|
|
||||||
if(scene==PLAY){
|
|
||||||
if(action==Q_UP)action=preferences.clockwise?Q_CW:Q_CCW;
|
|
||||||
if(i==12)action=Q_HARD;
|
|
||||||
}
|
|
||||||
held|=action;
|
|
||||||
}
|
|
||||||
return held;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QActions sample(Q16 ms)
|
static QActions sample(Q16 ms)
|
||||||
{
|
{
|
||||||
const byte *axes;
|
const byte *axes;
|
||||||
@@ -84,7 +63,7 @@ static QActions sample(Q16 ms)
|
|||||||
joystick_buttons=readJoystickButtons();
|
joystick_buttons=readJoystickButtons();
|
||||||
Player_disableSound(); /* Reassert idle silence after the shared analog-input APIs. */
|
Player_disableSound(); /* Reassert idle silence after the shared analog-input APIs. */
|
||||||
if(port<2)button=!(joystick_buttons&(port==1?JOYSTK_BUTTON_1_LEFT:JOYSTK_BUTTON_1_RIGHT));
|
if(port<2)button=!(joystick_buttons&(port==1?JOYSTK_BUTTON_1_LEFT:JOYSTK_BUTTON_1_RIGHT));
|
||||||
return q_input_step(&input,keyboard(),button,joystick_axes[index],joystick_axes[index+1],
|
return q_input_step(&input,keyboard_read(joystick_buttons,scene==PLAY?(Q8)(KEYBOARD_PLAY|(preferences.clockwise<<1)):scene==INITIALS?(Q8)KEYBOARD_INITIALS:(Q8)0),button,joystick_axes[index],joystick_axes[index+1],
|
||||||
preferences.centers[index],preferences.centers[index+1],port<2,ms,scene==PLAY,preferences.clockwise);
|
preferences.centers[index],preferences.centers[index+1],port<2,ms,scene==PLAY,preferences.clockwise);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,50 +132,52 @@ static void settings_picture(void)
|
|||||||
video_text(1,22,ui_label(74));
|
video_text(1,22,ui_label(74));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Q8 captions[][4]={
|
/* Caption columns fit three bits; keep scene and column in one byte. */
|
||||||
{0,5,20,1},
|
static const Q8 captions[][3]={
|
||||||
{0,6,22,2},
|
{5,20,1},
|
||||||
{2,1,20,3},
|
{6,22,2},
|
||||||
{4,1,1,4},
|
{17,20,3},
|
||||||
{4,1,3,5},
|
{33,1,4},
|
||||||
{4,1,5,6},
|
{33,3,5},
|
||||||
{4,1,7,7},
|
{33,5,6},
|
||||||
{4,1,10,8},
|
{33,7,7},
|
||||||
{4,1,12,9},
|
{33,10,8},
|
||||||
{4,1,14,10},
|
{33,12,9},
|
||||||
{4,1,16,11},
|
{33,14,10},
|
||||||
{4,1,18,12},
|
{33,16,11},
|
||||||
{4,1,19,13},
|
{33,18,12},
|
||||||
{4,1,20,14},
|
{33,19,13},
|
||||||
{6,1,1,15},
|
{33,20,14},
|
||||||
{6,1,3,16},
|
{49,1,15},
|
||||||
{6,1,5,17},
|
{49,3,16},
|
||||||
{6,1,6,18},
|
{49,5,17},
|
||||||
{6,1,7,19},
|
{49,6,18},
|
||||||
{6,1,9,20},
|
{49,7,19},
|
||||||
{6,1,11,21},
|
{49,9,20},
|
||||||
{6,1,12,22},
|
{49,11,21},
|
||||||
{6,1,14,23},
|
{49,12,22},
|
||||||
{6,1,16,24},
|
{49,14,23},
|
||||||
{9,1,2,25},
|
{49,16,24},
|
||||||
{9,1,5,26},
|
{73,2,25},
|
||||||
{9,1,7,94},
|
{73,5,26},
|
||||||
{10,1,2,27},
|
{73,7,94},
|
||||||
{10,1,14,28},
|
{81,2,27},
|
||||||
{10,1,16,29},
|
{81,14,28},
|
||||||
{5,1,0,30},
|
{81,16,29},
|
||||||
{5,1,4,31},
|
{41,0,30},
|
||||||
{5,1,18,32},
|
{41,4,31},
|
||||||
{5,1,20,33},
|
{41,18,32},
|
||||||
{11,2,1,34},
|
{41,20,33},
|
||||||
{11,1,19,35},
|
{90,1,34},
|
||||||
{11,1,21,36},
|
{89,19,35},
|
||||||
|
{89,21,36},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void fixed_captions(void)
|
static void fixed_captions(void)
|
||||||
{
|
{
|
||||||
Q8 i;for(i=0;i<sizeof(captions)/sizeof(captions[0]);++i)
|
Q8 i;for(i=0;i<sizeof(captions)/sizeof(captions[0]);++i)
|
||||||
if(captions[i][0]==scene)video_text(captions[i][1],captions[i][2],ui_label(captions[i][3]));
|
if((captions[i][0]>>3)==scene)video_text(captions[i][0]&7,captions[i][1],ui_label(captions[i][2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void picture(void)
|
static void picture(void)
|
||||||
|
|||||||
+5
-2
@@ -26,15 +26,18 @@ QActions q_input_step(QInput *s,Q16 keys,Q8 button,Q8 x,Q8 y,Q8 cx,Q8 cy,Q8 joys
|
|||||||
a.held=a.pressed=0;a.move=0;a.repeats=0;
|
a.held=a.pressed=0;a.move=0;a.repeats=0;
|
||||||
if(!joystick){button=0;dx=dy=0;}
|
if(!joystick){button=0;dx=dy=0;}
|
||||||
s->axis_x=axis(s->axis_x,dx);s->axis_y=axis(s->axis_y,dy);
|
s->axis_x=axis(s->axis_x,dx);s->axis_y=axis(s->axis_y,dy);
|
||||||
if(!s->axis_x&&!s->axis_y){s->stick_armed=1;s->up_armed=1;}
|
if(!s->axis_x)s->stick_armed|=1;
|
||||||
|
if(!s->axis_y){s->stick_armed|=2;s->up_armed=1;}
|
||||||
if(s->guard){
|
if(s->guard){
|
||||||
if(!keys&&!button)s->guard=0;
|
if(!keys&&!button)s->guard=0;
|
||||||
s->button_before=button;
|
s->button_before=button;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
if(s->stick_armed){
|
if(s->stick_armed&1){
|
||||||
if(s->axis_x<0)held|=Q_LEFT;
|
if(s->axis_x<0)held|=Q_LEFT;
|
||||||
if(s->axis_x>0)held|=Q_RIGHT;
|
if(s->axis_x>0)held|=Q_RIGHT;
|
||||||
|
}
|
||||||
|
if(s->stick_armed&2){
|
||||||
if(s->axis_y>0)held|=Q_DOWN;
|
if(s->axis_y>0)held|=Q_DOWN;
|
||||||
ax=dx<0?-dx:dx;ay=dy<0?-dy:dy;
|
ax=dx<0?-dx:dx;ay=dy<0?-dy:dy;
|
||||||
if(s->axis_y<0){
|
if(s->axis_y<0){
|
||||||
|
|||||||
+2
-1
@@ -17,7 +17,8 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Q16 previous,repeat_ms,button_ms;
|
Q16 previous,repeat_ms,button_ms;
|
||||||
signed char direction,axis_x,axis_y;
|
signed char direction,axis_x,axis_y;
|
||||||
Q8 guard,button_before,button_used,up_armed,stick_armed;
|
Q8 guard,button_before,button_used,up_armed;
|
||||||
|
Q8 stick_armed; /* bit 0: X has centered; bit 1: Y has centered */
|
||||||
} QInput;
|
} QInput;
|
||||||
typedef struct { Q16 held,pressed; signed char move; Q8 repeats; } QActions;
|
typedef struct { Q16 held,pressed; signed char move; Q8 repeats; } QActions;
|
||||||
void q_input_reset(QInput *state);
|
void q_input_reset(QInput *state);
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ void q_preferences_default(QPreferences *p)
|
|||||||
|
|
||||||
static Q8 preferences_ok(void)
|
static Q8 preferences_ok(void)
|
||||||
{
|
{
|
||||||
static const Q8 maximum[15]={16,1,1,2,1,1,1,1,1,2,60,63,63,63,63};
|
static Q8 maximum[15]={16,1,1,2,1,1,1,1,1,2,60,63,63,63,63};
|
||||||
Q8 i;for(i=0;i<15;++i)if(page[12+i]>maximum[i])return 0;
|
Q8 i;for(i=0;i<15;++i)if(page[12+i]>maximum[i])return 0;
|
||||||
if(page[22]!=50&&page[22]!=60)return 0;
|
if(page[22]!=50&&page[22]!=60)return 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
#include <coco.h>
|
||||||
|
#include "keyboard.h"
|
||||||
|
typedef struct { Q8 probe,bit;Q16 action; } KeyBinding;
|
||||||
|
#define BIND(name,action) {KEY_PROBE_##name,KEY_BIT_##name,action}
|
||||||
|
static const KeyBinding keys[]={
|
||||||
|
BIND(LEFT,Q_LEFT),BIND(RIGHT,Q_RIGHT),BIND(UP,Q_UP),BIND(DOWN,Q_DOWN),
|
||||||
|
BIND(ENTER,Q_CONFIRM),BIND(BREAK,Q_BACK),
|
||||||
|
BIND(A,Q_LEFT),BIND(D,Q_RIGHT),BIND(W,Q_UP),BIND(S,Q_DOWN),
|
||||||
|
BIND(Q,Q_CCW),BIND(E,Q_CW),BIND(SPACE,Q_CONFIRM),BIND(H,Q_HOLD),BIND(P,Q_PAUSE)
|
||||||
|
};
|
||||||
|
/* Pressed joystick buttons ground the same PIA rows used by isKeyPressed.
|
||||||
|
* Suppress only those ambiguous rows, including buttons on the other port. */
|
||||||
|
Q16 keyboard_read(Q8 buttons,Q8 mode)
|
||||||
|
{
|
||||||
|
Q16 held=0,action;Q8 blocked=(~buttons)&15;
|
||||||
|
const KeyBinding *key,*end=keys+((mode&KEYBOARD_INITIALS)?6:sizeof(keys)/sizeof(keys[0]));
|
||||||
|
for(key=keys;key!=end;++key)if(!(key->bit&blocked)&&isKeyPressed(key->probe,key->bit)){
|
||||||
|
action=key->action;
|
||||||
|
if(mode&KEYBOARD_PLAY){
|
||||||
|
if(action==Q_UP)action=(mode&KEYBOARD_CLOCKWISE)?Q_CW:Q_CCW;
|
||||||
|
if(key==keys+12)action=Q_HARD;
|
||||||
|
}
|
||||||
|
held|=action;
|
||||||
|
}
|
||||||
|
return held;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
#ifndef QUAD_KEYBOARD_H
|
||||||
|
#define QUAD_KEYBOARD_H
|
||||||
|
#include "input.h"
|
||||||
|
#define KEYBOARD_PLAY 1
|
||||||
|
#define KEYBOARD_CLOCKWISE 2
|
||||||
|
#define KEYBOARD_INITIALS 4
|
||||||
|
Q16 keyboard_read(Q8 buttons,Q8 mode);
|
||||||
|
#endif
|
||||||
@@ -9,11 +9,13 @@ static union {GameBuffers game;Q8 menu[512];} buffers;
|
|||||||
#define old_cells buffers.game.old_cells
|
#define old_cells buffers.game.old_cells
|
||||||
static Q8 menu_mode;
|
static Q8 menu_mode;
|
||||||
#include "pierre_font.h"
|
#include "pierre_font.h"
|
||||||
|
#ifdef QUAD_PROFILE
|
||||||
Q16 video_worst_ticks;
|
Q16 video_worst_ticks;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void palette_setup(void)
|
static void palette_setup(void)
|
||||||
{
|
{
|
||||||
static const Q8 colors[11]={0,48,12,7,42,60,35,52,63,1,21};
|
static Q8 colors[11]={0,48,12,7,42,60,35,52,63,1,21};
|
||||||
Q8 i,c;rgb();
|
Q8 i,c;rgb();
|
||||||
for(i=0;i<11;++i){c=colors[i];paletteRGB(i,c>>4,(c>>2)&3,c&3);}
|
for(i=0;i<11;++i){c=colors[i];paletteRGB(i,c>>4,(c>>2)&3,c&3);}
|
||||||
}
|
}
|
||||||
@@ -166,7 +168,9 @@ void video_number(Q8 col,Q8 row,Q32 n)
|
|||||||
void video_game(const QGame *g,Q8 shadow,Q8 force)
|
void video_game(const QGame *g,Q8 shadow,Q8 force)
|
||||||
{
|
{
|
||||||
Q8 cells[200],x,y;
|
Q8 cells[200],x,y;
|
||||||
|
#ifdef QUAD_PROFILE
|
||||||
Q16 start=getTimer(),elapsed;
|
Q16 start=getTimer(),elapsed;
|
||||||
|
#endif
|
||||||
QPiece ghost;
|
QPiece ghost;
|
||||||
if(force&1){
|
if(force&1){
|
||||||
menu_mode=0;video_style(style,grid);
|
menu_mode=0;video_style(style,grid);
|
||||||
@@ -194,7 +198,9 @@ void video_game(const QGame *g,Q8 shadow,Q8 force)
|
|||||||
video_text(23,17,g->hold_used?"USED":" ");
|
video_text(23,17,g->hold_used?"USED":" ");
|
||||||
}
|
}
|
||||||
if(g->over)video_text(10,11,"GAME OVER");
|
if(g->over)video_text(10,11,"GAME OVER");
|
||||||
|
#ifdef QUAD_PROFILE
|
||||||
elapsed=(Q16)(getTimer()-start);if(elapsed>video_worst_ticks)video_worst_ticks=elapsed;
|
elapsed=(Q16)(getTimer()-start);if(elapsed>video_worst_ticks)video_worst_ticks=elapsed;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void title_piece(Q8 x,Q8 y,Q8 type,Q8 rotation)
|
static void title_piece(Q8 x,Q8 y,Q8 type,Q8 rotation)
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ void video_cell(Q8 x,Q8 y,Q8 value);
|
|||||||
void video_piece(Q8 x,Q8 y,Q8 type,Q8 rotation);
|
void video_piece(Q8 x,Q8 y,Q8 type,Q8 rotation);
|
||||||
void video_game(const QGame *game,Q8 shadow,Q8 force);
|
void video_game(const QGame *game,Q8 shadow,Q8 force);
|
||||||
void video_title_art(void);
|
void video_title_art(void);
|
||||||
|
#ifdef QUAD_PROFILE
|
||||||
extern Q16 video_worst_ticks;
|
extern Q16 video_worst_ticks;
|
||||||
|
#endif
|
||||||
void video_number(Q8 col,Q8 row,Q32 n);
|
void video_number(Q8 col,Q8 row,Q32 n);
|
||||||
Q8 *video_menu_buffer(void);
|
Q8 *video_menu_buffer(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -16,4 +16,24 @@ void width(byte columns);
|
|||||||
void setHighSpeed(byte speed);
|
void setHighSpeed(byte speed);
|
||||||
word getTimer(void);
|
word getTimer(void);
|
||||||
byte hset(word x,word y,byte color);
|
byte hset(word x,word y,byte color);
|
||||||
|
|
||||||
|
/* Public coco.h key coordinates used by the real keyboard adapter. */
|
||||||
|
enum {
|
||||||
|
KEY_PROBE_LEFT=0xDF, KEY_BIT_LEFT=0x08,
|
||||||
|
KEY_PROBE_RIGHT=0xBF, KEY_BIT_RIGHT=0x08,
|
||||||
|
KEY_PROBE_UP=0xF7, KEY_BIT_UP=0x08,
|
||||||
|
KEY_PROBE_DOWN=0xEF, KEY_BIT_DOWN=0x08,
|
||||||
|
KEY_PROBE_ENTER=0xFE, KEY_BIT_ENTER=0x40,
|
||||||
|
KEY_PROBE_BREAK=0xFB, KEY_BIT_BREAK=0x40,
|
||||||
|
KEY_PROBE_A=0xFD, KEY_BIT_A=0x01,
|
||||||
|
KEY_PROBE_D=0xEF, KEY_BIT_D=0x01,
|
||||||
|
KEY_PROBE_W=0x7F, KEY_BIT_W=0x04,
|
||||||
|
KEY_PROBE_S=0xEF, KEY_BIT_S=0x04,
|
||||||
|
KEY_PROBE_Q=0xFD, KEY_BIT_Q=0x04,
|
||||||
|
KEY_PROBE_E=0xDF, KEY_BIT_E=0x01,
|
||||||
|
KEY_PROBE_SPACE=0x7F, KEY_BIT_SPACE=0x08,
|
||||||
|
KEY_PROBE_H=0xFE, KEY_BIT_H=0x02,
|
||||||
|
KEY_PROBE_P=0xFE, KEY_BIT_P=0x04
|
||||||
|
};
|
||||||
|
byte isKeyPressed(byte probe,byte bit);
|
||||||
#endif
|
#endif
|
||||||
@@ -26,4 +26,14 @@ int main(void){QActions a;
|
|||||||
a=step(0,0,24,31,1,1);assert(a.held&Q_LEFT);
|
a=step(0,0,24,31,1,1);assert(a.held&Q_LEFT);
|
||||||
a=step(0,0,25,31,1,1);assert(!(a.held&Q_LEFT));
|
a=step(0,0,25,31,1,1);assert(!(a.held&Q_LEFT));
|
||||||
reset();step(0,1,31,31,100,0);a=step(0,0,31,31,1,0);assert(a.pressed&Q_CONFIRM);
|
reset();step(0,1,31,31,100,0);a=step(0,0,31,31,1,0);assert(a.pressed&Q_CONFIRM);
|
||||||
|
/* X can center/arm while an uncalibrated or deliberately held Y stays low. */
|
||||||
|
q_input_reset(&s);step(0,0,31,0,1,1);
|
||||||
|
a=step(0,0,0,0,1,1);assert(a.move==-1&&a.repeats==1&&!(a.pressed&Q_HARD));
|
||||||
|
a=step(0,0,0,0,200,1);assert(a.move==-1&&a.repeats==1);
|
||||||
|
a=step(0,0,63,0,1,1);assert(a.move==1&&a.repeats==1);
|
||||||
|
a=step(0,0,31,0,1,1);assert(!a.repeats);
|
||||||
|
/* Releasing a deflected joystick need not center both axes at once. */
|
||||||
|
q_input_reset(&s);step(0,0,0,0,1,1);
|
||||||
|
a=step(0,0,63,0,1,1);assert(!a.repeats); /* no X neutral observed yet */
|
||||||
|
step(0,0,31,0,1,1);a=step(0,0,63,0,1,1);assert(a.move==1);
|
||||||
puts("PASS: input repeat, conflicting directions, edges, one-button timing, hysteresis, diagonal guard, disconnected-stick keyboard");return 0;}
|
puts("PASS: input repeat, conflicting directions, edges, one-button timing, hysteresis, diagonal guard, disconnected-stick keyboard");return 0;}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <coco.h>
|
||||||
|
#include "keyboard.h"
|
||||||
|
static Q8 raw_buttons=15,contact_probe,contact_bit;
|
||||||
|
/* Model the shared PIA input lines: a fire button grounds its row for EVERY
|
||||||
|
* keyboard column probe. A real key grounds it only for its selected column. */
|
||||||
|
byte isKeyPressed(byte probe,byte bit)
|
||||||
|
{
|
||||||
|
if((bit&15)&~raw_buttons)return 1;
|
||||||
|
return probe==contact_probe&&(bit&contact_bit)!=0;
|
||||||
|
}
|
||||||
|
static QActions poll(QInput *in,Q8 button,Q16 ms)
|
||||||
|
{
|
||||||
|
return q_input_step(in,keyboard_read(raw_buttons,KEYBOARD_PLAY),button,31,31,31,31,1,ms,1,0);
|
||||||
|
}
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
QInput in;QActions a;QGame game;QOptions options={0,Q_MODERN,0,1};Q8 pressed;
|
||||||
|
/* CoCo right fire grounds A/D/E. It must not masquerade as left/right/CW. */
|
||||||
|
raw_buttons=14;assert(keyboard_read(raw_buttons,KEYBOARD_PLAY)==0);
|
||||||
|
for(pressed=0;pressed<4;++pressed){
|
||||||
|
raw_buttons=(Q8)(15&~(1<<pressed));
|
||||||
|
assert(keyboard_read(raw_buttons,KEYBOARD_PLAY)==0);
|
||||||
|
contact_probe=KEY_PROBE_BREAK;contact_bit=KEY_BIT_BREAK;
|
||||||
|
assert(keyboard_read(raw_buttons,KEYBOARD_PLAY)==Q_BACK);
|
||||||
|
contact_bit=0;
|
||||||
|
}
|
||||||
|
raw_buttons=15;q_input_reset(&in);poll(&in,0,0);
|
||||||
|
q_start(&game,&options);game.active=q_spawn(0,0);game.active.y=6;
|
||||||
|
raw_buttons=14;a=poll(&in,1,100);
|
||||||
|
assert(!(a.pressed&(Q_CW|Q_CCW|Q_HARD|Q_HOLD))&&!a.repeats);
|
||||||
|
a=poll(&in,1,100);assert(!(a.pressed&(Q_CW|Q_CCW|Q_PAUSE)));
|
||||||
|
raw_buttons=15;a=poll(&in,0,1);assert(a.pressed&Q_CCW);
|
||||||
|
assert(q_rotate(&game,0)&&game.active.rotation==1);
|
||||||
|
a=poll(&in,0,1);assert(!(a.pressed&(Q_CW|Q_CCW))&&game.active.rotation==1);
|
||||||
|
/* Fire held while steering must not add opposing A/D or E actions. */
|
||||||
|
q_input_reset(&in);poll(&in,0,0);raw_buttons=14;
|
||||||
|
a=q_input_step(&in,keyboard_read(raw_buttons,KEYBOARD_PLAY),1,0,31,31,31,1,1,1,0);
|
||||||
|
assert(a.move==-1&&a.repeats==1&&!(a.pressed&Q_CW));
|
||||||
|
a=q_input_step(&in,keyboard_read(raw_buttons,KEYBOARD_PLAY),1,63,31,31,31,1,1,1,0);
|
||||||
|
assert(a.move==1&&a.repeats==1&&!(a.pressed&Q_CW));
|
||||||
|
/* Clockwise preference also yields one edge on release, not on press. */
|
||||||
|
raw_buttons=15;q_input_reset(&in);poll(&in,0,0);raw_buttons=14;
|
||||||
|
a=q_input_step(&in,keyboard_read(raw_buttons,KEYBOARD_PLAY|KEYBOARD_CLOCKWISE),1,31,31,31,31,1,100,1,1);
|
||||||
|
assert(!(a.pressed&(Q_CW|Q_CCW)));raw_buttons=15;
|
||||||
|
a=q_input_step(&in,keyboard_read(raw_buttons,KEYBOARD_PLAY|KEYBOARD_CLOCKWISE),0,31,31,31,31,1,1,1,1);
|
||||||
|
assert((a.pressed&Q_CW)&&!(a.pressed&Q_CCW));
|
||||||
|
/* Real keyboard aliases still work when their shared row is available. */
|
||||||
|
contact_probe=KEY_PROBE_E;contact_bit=KEY_BIT_E;assert(keyboard_read(15,KEYBOARD_PLAY)==Q_CW);
|
||||||
|
contact_probe=KEY_PROBE_A;contact_bit=KEY_BIT_A;assert(keyboard_read(15,KEYBOARD_PLAY)==Q_LEFT);
|
||||||
|
contact_probe=KEY_PROBE_D;contact_bit=KEY_BIT_D;assert(keyboard_read(15,KEYBOARD_PLAY)==Q_RIGHT);
|
||||||
|
assert(keyboard_read(15,KEYBOARD_INITIALS)==0);
|
||||||
|
contact_probe=KEY_PROBE_UP;contact_bit=KEY_BIT_UP;
|
||||||
|
assert(keyboard_read(15,KEYBOARD_PLAY)==Q_CCW);
|
||||||
|
assert(keyboard_read(15,KEYBOARD_PLAY|KEYBOARD_CLOCKWISE)==Q_CW);
|
||||||
|
contact_probe=KEY_PROBE_SPACE;contact_bit=KEY_BIT_SPACE;
|
||||||
|
assert(keyboard_read(15,KEYBOARD_PLAY)==Q_HARD);
|
||||||
|
assert(keyboard_read(15,0)==Q_CONFIRM);
|
||||||
|
puts("PASS: shared fire/keyboard rows, one lasting fire-release rotation, unaffected keyboard rows and gameplay/menu aliases");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -13,3 +13,12 @@ for name in ['input','store']:
|
|||||||
str(root/'tests'/(name+'_test.c')),str(root/'src/game'/(name+'.c')),
|
str(root/'tests'/(name+'_test.c')),str(root/'src/game'/(name+'.c')),
|
||||||
'-o',str(exe)],check=True)
|
'-o',str(exe)],check=True)
|
||||||
subprocess.run([str(exe)],check=True)
|
subprocess.run([str(exe)],check=True)
|
||||||
|
|
||||||
|
# Exercise the real public-API keyboard adapter with shared joystick/keyboard rows.
|
||||||
|
exe=out/'keyboard_test'
|
||||||
|
subprocess.run(['clang','-std=c89','-Wall','-Wextra','-Werror','-pedantic',
|
||||||
|
'-fsanitize=address,undefined','-DQUAD_HOST',
|
||||||
|
*['-I'+str(root/p) for p in ['tests/include','src/game','src/platform']],
|
||||||
|
*[str(root/p) for p in ['tests/keyboard_test.c','src/platform/keyboard.c','src/game/input.c','src/game/rules.c']],
|
||||||
|
'-o',str(exe)],check=True)
|
||||||
|
subprocess.run([str(exe)],check=True)
|
||||||
@@ -92,6 +92,7 @@
|
|||||||
"src/game/input.c",
|
"src/game/input.c",
|
||||||
"src/platform/coco3_video.c",
|
"src/platform/coco3_video.c",
|
||||||
"src/platform/video.c",
|
"src/platform/video.c",
|
||||||
|
"src/platform/keyboard.c",
|
||||||
"src/game/store.c",
|
"src/game/store.c",
|
||||||
"src/platform/disk_store.c"
|
"src/platform/disk_store.c"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user