Add secondary joystick hard drop and deliver build 05

This commit is contained in:
Brian Holman committed 2026-11-11 15:35:49 -07:00
1 parent a07c41555a
commit 49bc78158a
21 files changed
+230 -35

No files matched your search

+3
View File
@@ -33,3 +33,6 @@ HELLO.dsk
# Retired build-02 personal disk; pristine historical delivery stays in Git history. # Retired build-02 personal disk; pristine historical delivery stays in Git history.
/QUADPSL02.DSK /QUADPSL02.DSK
# Superseded build04 local disk/backup retained; current pristine delivery is05.
/QUADPSL04.DSK
+1 -1
View File
@@ -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.1 (53)** (approved by Brian November 11, 2026 for the joystick checks) and its supported MCP. - Use official `/Applications/VCC Plus.app` **3.6.1 (54)** (Brian requested final testing after Core installed this version on November 11, 2026) 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
Binary file not shown.
+12 -3
View File
@@ -54,6 +54,8 @@ Keyboard: arrows or A/D move, Down/S soft drop, Up/W preferred rotation, Q/E
counterclockwise/clockwise, Space hard drop, H hold, P pause, Enter select, BREAK counterclockwise/clockwise, Space hard drop, H hold, P pause, Enter select, BREAK
back/pause. The title also accepts Space. A short joystick fire press rotates on back/pause. The title also accepts Space. A short joystick fire press rotates on
release; holding fire for 400 ms opens actions, including Hold and Settings. release; holding fire for 400 ms opens actions, including Hold and Settings.
Joystick Up or the secondary button hard-drops like Space. The secondary button
drops once on press; release it before another drop. Down remains soft drop.
High scores are designed to reload from `QPSAVE0.DAT`/`QPSAVE1.DAT` on the game High scores are designed to reload from `QPSAVE0.DAT`/`QPSAVE1.DAT` on the game
disk. The two-slot store covers all difficulty/normal-or-difficult categories and disk. The two-slot store covers all difficulty/normal-or-difficult categories and
@@ -74,15 +76,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 [QUADPSL04.DSK](QUADPSL04.DSK) in drive 0 and type Mount a writable copy of [QUADPSL05.DSK](QUADPSL05.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 04**; the next changed delivery will new build. The current delivery is **build 05**; the next changed delivery will
be build 05. See [build records](docs/BUILDS.md). The official recipe still uses be build 06. 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:
@@ -121,3 +123,10 @@ physical controller/CoCo and left-port retests remain pending. CoCoMan was a
read-only reference; its assembly and VCC-specific APIs were not imported. read-only reference; its assembly and VCC-specific APIs were not imported.
See [the target diagnosis](docs/CMOC_JOYSTICK_ARGUMENTS.md) and See [the target diagnosis](docs/CMOC_JOYSTICK_ARGUMENTS.md) and
[joystick validation](docs/JOYSTICK_FIX.md). [joystick validation](docs/JOYSTICK_FIX.md).
Build 05 adds Fire 2 hard drop once per press, retaining joystick Up and Fire 1.
Official VCC Plus 3.6.1 (54) Release and actual standard right-port joystick
snapshots pass press/hold/release/repress, steering, lasting rotation and steering
after keyboard pause/resume. Host adapter checks cover both ports. See
[secondary-button validation and acceptance steps](docs/SECONDARY_BUTTON.md).
Physical controller/CoCo, left-port guest and 128 KB qualification remain pending.
+4
View File
@@ -221,6 +221,10 @@ Default mapping to implement and usability-test:
- Left/right: movement with the same repeat timing as keyboard. - Left/right: movement with the same repeat timing as keyboard.
- Down: soft drop while held. - Down: soft drop while held.
- Up: one hard drop, rearmed only after returning to neutral. - Up: one hard drop, rearmed only after returning to neutral.
- Secondary button (optional two-button controller): hard drop on press, like
Space; once per press, with release required before another drop. Ignore it
in menus and when the joystick is Off. This addition was approved November 11,
2026; the complete one-button control path remains available.
- Short button press/release: rotate in the preferred direction, once on release. - Short button press/release: rotate in the preferred direction, once on release.
- Button held for 400 ms: pause and open the actions menu, without triggering a - Button held for 400 ms: pause and open the actions menu, without triggering a
rotation on release. That menu provides Resume, Hold, Rotate Other Way, rotation on release. That menu provides Resume, Hold, Rotate Other Way,
+2 -2
View File
@@ -55,8 +55,8 @@
4 7 SPACE HARD DROP H HOLD P PAUSE 4 7 SPACE HARD DROP H HOLD P PAUSE
4 8 JOYSTICK 4 8 JOYSTICK
4 9 LEFT RIGHT MOVE DOWN SOFT DROP 4 9 LEFT RIGHT MOVE DOWN SOFT DROP
4 10 UP HARD DROP TAP FIRE ROTATE 4 10 UP OR FIRE 2 HARD DROP
4 11 HOLD FIRE FOR ACTIONS MENU 4 11 TAP FIRE 1 ROTATE HOLD ACTIONS
4 12 RIGHT XY 4 12 RIGHT XY
4 13 LEFT XY 4 13 LEFT XY
4 14 BUTTONS 4 14 BUTTONS
1 # scene id text - original Quadrapassel menu text, GPL-3.0-or-later
55 4 7 SPACE HARD DROP H HOLD P PAUSE
56 4 8 JOYSTICK
57 4 9 LEFT RIGHT MOVE DOWN SOFT DROP
58 4 10 UP HARD DROP TAP FIRE ROTATE UP OR FIRE 2 HARD DROP
59 4 11 HOLD FIRE FOR ACTIONS MENU TAP FIRE 1 ROTATE HOLD ACTIONS
60 4 12 RIGHT XY
61 4 13 LEFT XY
62 4 14 BUTTONS
+25 -2
View File
@@ -2,7 +2,7 @@
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 current delivery is 04; the next changed delivery is 05. This number new delivered build. Begin at 01. The current delivery is 05; the next changed delivery is 06. 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 |
@@ -11,6 +11,7 @@ identifies the game disk, independently of the VCC Plus application build.
| 02 | 2026-11-11 | QUADPSL02.DSK | Initial shared-row/axis fix; Brian reported actual joystick failure after DOS load | | 02 | 2026-11-11 | QUADPSL02.DSK | Initial shared-row/axis fix; Brian reported actual joystick failure after DOS load |
| 03 | 2026-11-11 | QUADPSL03.DSK | Internal candidate; native test exposed target calibration argument error; withdrawn | | 03 | 2026-11-11 | QUADPSL03.DSK | Internal candidate; native test exposed target calibration argument error; withdrawn |
| 04 | 2026-11-11 | QUADPSL04.DSK | Correct target argument loads, stable fire, scene readiness; native emulated joystick checks pass | | 04 | 2026-11-11 | QUADPSL04.DSK | Correct target argument loads, stable fire, scene readiness; native emulated joystick checks pass |
| 05 | 2026-11-11 | QUADPSL05.DSK | Fire 2 hard drop once per press; actual standard right-port press/held/repress and input regression checks pass on official build54 |
Build 01 is 161,280 bytes, SHA-256: Build 01 is 161,280 bytes, SHA-256:
`4ac171e87c51dfd99b302b9e035a91a59c030144e5ae0661a6d2dfc84ba3a63f`. `4ac171e87c51dfd99b302b9e035a91a59c030144e5ae0661a6d2dfc84ba3a63f`.
@@ -58,7 +59,7 @@ $13FD; the 1024-byte stack reserve is unchanged. The writable build-02 file is
preserved locally and backed up byte-identically under ignored personal media; preserved locally and backed up byte-identically under ignored personal media;
it is retired from tracking rather than resetting its saved contents. it is retired from tracking rather than resetting its saved contents.
Build 04 is the current clean delivery, SHA-256: Build 04 is the preceding clean delivery, SHA-256:
`1cddb6bdf17857b915e96a6929e14181bad05cfae73278a4919add26fea0ba45`. `1cddb6bdf17857b915e96a6929e14181bad05cfae73278a4919add26fea0ba45`.
QUAD.bin is 26,581 bytes, SHA-256: QUAD.bin is 26,581 bytes, SHA-256:
`f79dd5b4ba32ab592bd2b1cb21bea2847b58bd88a1343a9507e1e72e26fe6767`. `f79dd5b4ba32ab592bd2b1cb21bea2847b58bd88a1343a9507e1e72e26fe6767`.
@@ -71,3 +72,25 @@ Pristine QUADPSL04.DSK contains only QUAD.BIN, WORDS.DAT, QPTEXT.DAT and the DOS
launcher; empty scores/default settings. The app mounted a separate working copy. launcher; empty scores/default settings. The app mounted a separate working copy.
Withdrawn pristine build03 and unmounted test scratch are removed during cleanup; Withdrawn pristine build03 and unmounted test scratch are removed during cleanup;
personal build01/build02 images and backups are retained unchanged. personal build01/build02 images and backups are retained unchanged.
Build 05 is the current clean delivery (161,280 bytes), SHA-256:
`d05ab25fd90171b048cce54f3af18ca6d0bd81335e138044ff05315e99cbf582`.
QUAD.bin is 26,623 bytes, SHA-256:
`ed5460993770f80bd1560001892ef34d4845ddf9eafe40fc732d1033a9c84290`.
Official build54 project 273E195B-8BFC-495F-A1F8-E1469759B910 revision0,
Release build CC51E81E-B5E2-4670-B8FA-15785BAFEB51, artifact
F137D778-646A-43AE-9CF1-92A658464FF3, zero diagnostics. Its outputs exactly
match the earlier native build53 C671F741 candidate; the compiler workaround
remains. Code/const end $7AFE, static end $13FD, original 1024-byte stack reserve.
The directory contains QUAD.BIN, WORDS.DAT and QPTEXT.DAT plus DOS launcher;
50 free granules, no QPSAVE files. The numbered copy was created exclusively
and its hash checked after the owned run stopped.
Actual MC6809/512 KB standard right-port joystick tests passed Fire 2 held for
180 fields (one lock), neutral then press (second lock), both horizontal walls,
lasting primary release rotation, Up hard drop, keyboard pause/resume then
joystick LEFT. Input traces confirm actual analog/button states and neutral
release, not guest keyboard aliases. The owned run stopped with disk retained,
zero writes and unchanged pristine hash. Details and qualification limits:
SECONDARY_BUTTON.md. The old build04 file and byte-identical backup remain
locally, retired from tracking; personal build01/build02 and backups are untouched.
+17 -2
View File
@@ -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 joystick correction — build 04 ## Current secondary-button addition — build 05
QUADPSL05.DSK adds Fire 2 hard drop once per press; Up and Fire 1 remain.
Official installed VCC Plus 3.6.1 (54) Release and disposable MC6809/512 KB
standard right-port joystick tests pass held/released/repressed drops,
left/right, lasting rotation, Up drop and keyboard pause/resume then joystick
movement. Host adapter tests cover both ports; rules, persistence and video
checks pass. Code/const end $7AFE, static end $13FD, stack reserve1024.
Disk SHA-256:
`d05ab25fd90171b048cce54f3af18ca6d0bd81335e138044ff05315e99cbf582`.
Run stopped with its disk retained and zero writes; personal media unchanged.
Physical controller/CoCo, guest left port, this candidate's HD6309 and 128 KB
remain pending; normal-window buzz remains open. See SECONDARY_BUTTON.md.
## Previous joystick correction — build 04
QUADPSL04.DSK works around a demonstrated bundled CMOC -O2 calibration-argument QUADPSL04.DSK works around a demonstrated bundled CMOC -O2 calibration-argument
load error. Official native build53 Release and right-port emulated joystick load error. Official native build53 Release and right-port emulated joystick
@@ -123,7 +137,8 @@ Actual 128 KB and physical joystick qualification remain pending.
- Modern/Classic 32-bit saturating scoring, level transitions and Relaxed mode. - Modern/Classic 32-bit saturating scoring, level transitions and Relaxed mode.
- Version-1 xorshift32 seeded stream, inverse-square balancing, prefill and - Version-1 xorshift32 seeded stream, inverse-square balancing, prefill and
Difficult Pieces metric/selection. Difficult search is currently synchronous. Difficult Pieces metric/selection. Difficult search is currently synchronous.
- Keyboard controls and a one-button joystick input state machine, settings, - Keyboard controls, a complete one-button joystick input state machine with
optional Fire 2 hard drop, settings,
seed editor, pause/actions/confirmation screens, score browser and initials. seed editor, pause/actions/confirmation screens, score browser and initials.
- Code-drawn title and cached tiles; menu focus updates without full redraws. - Code-drawn title and cached tiles; menu focus updates without full redraws.
Scene text is a bounded, checksummed disk asset sharing the display cache. Scene text is a bounded, checksummed disk asset sharing the display cache.
+11
View File
@@ -85,3 +85,14 @@ workflow after the grant ended. Native builds FC462D93 / A7A18927 succeeded.
Launch Disk mounted a separate working copy; explicit cold restart plus DOS was Launch Disk mounted a separate working copy; explicit cold restart plus DOS was
required because the prior graphics game was still in RAM. A new mounted filename required because the prior graphics game was still in RAM. A new mounted filename
or C workspace's latest-build badge alone does not prove the guest reloaded it. or C workspace's latest-build badge alone does not prove the guest reloaded it.
Build05 final checks use official build54's newly exported native connection,
project273E195B-8BFC-495F-A1F8-E1469759B910 revision0. Discovery returned29 tools,
playtest_joystick_input and input_diagnostics; actual standard port/axis/fire2
steps and get_playtest_input were used successfully. The official local helper
required local-service execution permission; without that permission it returned
host_unavailable despite local tools/list succeeding. This was resolved without
replacing the grant or changing the emulator. All owned runs stopped; the native
workspace was released to Core for the next project's scoped connection. Private
grant files remain outside Git. See SECONDARY_BUTTON.md for exact evidence.
+6
View File
@@ -65,3 +65,9 @@ Final build04's independent calibration/position pointers avoid the target
compiler indexing defect. Code/const end $7AD4 (44 bytes free), static end compiler indexing defect. Code/const end $7AD4 (44 bytes free), static end
$13FD (3 bytes free). The original MMU window, section limits and 1024-byte $13FD (3 bytes free). The original MMU window, section limits and 1024-byte
stack reserve are unchanged. Memory qualification remains actual-128-KB pending. stack reserve are unchanged. Memory qualification remains actual-128-KB pending.
Build05 maps Fire 2 into the existing hard-drop edge path: code/const end $7AFE
(2 bytes free), static end $13FD (3 bytes free), unchanged 1024-byte stack reserve.
Official build54 reproduces these exact bounds and passes MC6809/512 KB standard
right-port tests. Further code/data growth requires compaction first; 128 KB and
full stack qualification remain pending.
+80
View File
@@ -0,0 +1,80 @@
# Secondary joystick hard drop — November 11, 2026
Brian requested Fire 2 hard drop, equivalent to Space. The game uses the selected
right/left joystick's named standard CMOC secondary mask (right 0x04, left 0x08)
from the same stable button snapshot used to filter keyboard rows. In gameplay,
it joins the existing Q_HARD held action before edge detection: one drop on press,
no repeat while held, and no rotation on release. Space and Fire 2 share the same
logical edge, preventing a second drop while either alias stays down.
The secondary button is ignored in menus and with Joystick Off. A held button
across scene transitions must be released before input is rearmed. Joystick Up
hard drop, Down soft drop and primary short/long-press actions remain. Both port
mappings are covered by hardware-mock adapter tests with real q_input_step/q_drop;
held samples leave exactly four settled cells, and another released/repressed
button locks a second piece. Wrong port, Off, menu and transition cases pass.
All four shared keyboard rows continue to be filtered. The Controls page now
lists Up/Fire 2 hard drop and Fire 1 rotation/actions.
Build05 was first built using official VCC Plus 3.6.1 (53), then rebuilt and
qualified with installed 3.6.1 (54), CMOC 0.1.100 Release. The two builds produce
identical binary/disk bytes. The game-side calibration-pointer compiler workaround
remains despite the general compiler fix now included in the installed app. Code/const
end $7AFE, static end $13FD, original 1024-byte stack reserve. No persistent state,
score formula or save schema changed. Native qualification follows; host simulation alone does not prove physical
joystick behavior.
## Final installed-app check
Brian authorized the final installed VCC Plus check after Core installed build54.
The fresh native project grant identified project
273E195B-8BFC-495F-A1F8-E1469759B910 revision0 and advertised joystick injection
and diagnostics. Source hashes matched main.c, keyboard.c/h, menu asset and
Makefile. The official Release build CC51E81E-B5E2-4670-B8FA-15785BAFEB51
succeeded without diagnostics; artifact F137D778-646A-43AE-9CF1-92A658464FF3.
See BUILDS.md for binary/disk hashes and exact memory bounds.
Disposable run C3EAFAD1-3CB6-435F-9B40-03E55C6CB534 used MC6809 and 512 KB,
booted from that exact artifact. Score loading and initial drawing were allowed
to finish before controls were evaluated. Public playtest_input steps used
standard right-port X/Y snapshots (0..16383, center8191) and named fire1/fire2;
get_playtest_input and input_trace confirmed the actual states and release.
No emulator internals or guest memory/register writes were used.
- Fire 2 on the title did not start a game.
- Empty-board baseline had no settled cells. Fire 2 was held 180 fields, then
released 60 fields: four green settled cells and the next purple piece still
falling. There was no repeat or release rotation.
- Fire 2 pressed again for 12 fields, then released 120: eight settled cells
(green + purple), with the yellow piece falling. Exactly one additional lock.
- Actual analog X=0 and X=16383 moved the yellow piece to the respective walls.
- Primary held 8 fields/released 90 rotated the yellow piece vertically and
left it rotated. Up (Y=0) still hard-dropped it.
- Keyboard P/Enter pause/resume followed by actual joystick LEFT moved the next
gray piece to the left wall. Keyboard confirmation did not disable the stick.
- A 120-field idle audio capture had PCM peak0 in both channels. This isolated
silence does not establish that Brian's normal-window buzzing is fixed.
The run stopped normally at field5806, with zero disk writes. Its writable test
disk was retained with the same pristine hash. The normal paused session,
DualSense assignments, stopped tape and personal score media were preserved.
Both secondary port masks pass host adapter/gameplay fixtures; this guest run
qualifies the right port only. Actual left port, physical controller/CoCo,
HD6309 on this candidate and 128 KB remain unqualified. No save schema or scoring
formula changed. Host input/store/keyboard, rules and video suites pass with
AddressSanitizer/UndefinedBehaviorSanitizer.
![One settled piece after holding Fire 2](screenshots/build05-fire2-held.png)
![Two settled pieces after release and another press](screenshots/build05-fire2-repress.png)
![Joystick LEFT after keyboard resume](screenshots/build05-after-keyboard-resume.png)
## Brian's acceptance test
Use a writable copy of QUADPSL05.DSK, type DOS to load it, and select Right
joystick (the default). Confirm left/right movement; primary tap/release rotation
that stays rotated; secondary hard drop once per press even while held; another
drop after release/repress; and joystick movement after keyboard pause/resume.
Up remains another hard drop and Down soft drop. Old disks keep their scores;
build05 starts fresh. Note machine RAM and whether buzzing occurs at the title.
+3 -2
View File
@@ -2,8 +2,9 @@
## Required installed app ## Required installed app
Use `/Applications/VCC Plus.app`, **version 3.6.1, build 53**, explicitly approved by Brian Use `/Applications/VCC Plus.app`, **version 3.6.1, build 54**. Brian requested the final
on November 11, 2026 for the joystick investigation, reconnection and isolated build/playtest. The installed Quadrapassel test after Core installed it on November 11, 2026. Earlier build53
checks remain historical. 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.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

+1 -1
View File
@@ -64,7 +64,7 @@ static QActions sample(Q16 ms)
disableInterrupts(); disableInterrupts();
Player_disableSound(); Player_disableSound();
axes=readJoystickPositions();for(i=0;i<4;++i)joystick_axes[i]=axes[i]; axes=readJoystickPositions();for(i=0;i<4;++i)joystick_axes[i]=axes[i];
keys=keyboard_read(&joystick_buttons,scene==PLAY?(Q8)(KEYBOARD_PLAY|(preferences.clockwise<<1)):scene==INITIALS?(Q8)KEYBOARD_INITIALS:(Q8)0); keys=keyboard_read(&joystick_buttons,scene==PLAY?(Q8)(KEYBOARD_PLAY|(preferences.clockwise<<1)):scene==INITIALS?(Q8)KEYBOARD_INITIALS:(Q8)0,port);
Player_disableSound(); Player_disableSound();
enableInterrupts(); enableInterrupts();
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));
+2 -1
View File
@@ -11,7 +11,7 @@ static const KeyBinding keys[]={
}; };
/* Pressed joystick buttons ground the same PIA rows used by isKeyPressed. /* Pressed joystick buttons ground the same PIA rows used by isKeyPressed.
* Suppress only those ambiguous rows, including buttons on the other port. */ * Suppress only those ambiguous rows, including buttons on the other port. */
Q16 keyboard_read(Q8 *buttons,Q8 mode) Q16 keyboard_read(Q8 *buttons,Q8 mode,Q8 port)
{ {
Q16 held;Q8 before,after,blocked; Q16 held;Q8 before,after,blocked;
const KeyBinding *key,*end=keys+((mode&KEYBOARD_INITIALS)?6:sizeof(keys)/sizeof(keys[0])); const KeyBinding *key,*end=keys+((mode&KEYBOARD_INITIALS)?6:sizeof(keys)/sizeof(keys[0]));
@@ -25,6 +25,7 @@ Q16 keyboard_read(Q8 *buttons,Q8 mode)
after=readJoystickButtons(); after=readJoystickButtons();
}while(before!=after); }while(before!=after);
if(mode&KEYBOARD_PLAY){ if(mode&KEYBOARD_PLAY){
if(port<2&&!(after&(port==1?JOYSTK_BUTTON_2_LEFT:JOYSTK_BUTTON_2_RIGHT)))held|=Q_HARD;
if(held&Q_UP)held=(held&~Q_UP)|((mode&KEYBOARD_CLOCKWISE)?Q_CW:Q_CCW); if(held&Q_UP)held=(held&~Q_UP)|((mode&KEYBOARD_CLOCKWISE)?Q_CW:Q_CCW);
}else if(held&Q_HARD)held=(held&~Q_HARD)|Q_CONFIRM; }else if(held&Q_HARD)held=(held&~Q_HARD)|Q_CONFIRM;
*buttons=after; *buttons=after;
+3 -2
View File
@@ -5,6 +5,7 @@
#define KEYBOARD_PLAY 1 #define KEYBOARD_PLAY 1
#define KEYBOARD_CLOCKWISE 2 #define KEYBOARD_CLOCKWISE 2
#define KEYBOARD_INITIALS 4 #define KEYBOARD_INITIALS 4
/* Caller holds the foreground PIA transaction; returns a stable button sample. */ /* Caller holds the foreground PIA transaction. Port: 0 right, 1 left, 2 off.
Q16 keyboard_read(Q8 *buttons,Q8 mode); * Return filtered keys plus the selected secondary button (hard drop in play). */
Q16 keyboard_read(Q8 *buttons,Q8 mode,Q8 port);
#endif #endif
+1
View File
@@ -37,4 +37,5 @@ enum {
}; };
byte isKeyPressed(byte probe,byte bit); byte isKeyPressed(byte probe,byte bit);
byte readJoystickButtons(void); byte readJoystickButtons(void);
enum { JOYSTK_BUTTON_2_RIGHT=4,JOYSTK_BUTTON_2_LEFT=8 };
#endif #endif
+59 -19
View File
@@ -15,20 +15,33 @@ byte isKeyPressed(byte probe,byte bit)
if((bit&15)&~raw_buttons)return 1; if((bit&15)&~raw_buttons)return 1;
return probe==contact_probe&&(bit&contact_bit)!=0; return probe==contact_probe&&(bit&contact_bit)!=0;
} }
/* Existing keyboard-only fixtures leave joystick mapping disabled. */
static Q16 read_keys(Q8 mode){return keyboard_read(&raw_buttons,mode,2);}
static QActions port_poll(QInput *in,Q8 port,Q16 ms,Q8 playing)
{
Q16 held=keyboard_read(&raw_buttons,playing?KEYBOARD_PLAY:0,port);
Q8 primary=port<2&&!(raw_buttons&(port==1?2:1));
return q_input_step(in,held,primary,31,31,31,31,port<2,ms,playing,0);
}
static Q8 occupied(const QGame *g)
{
Q8 x,y,n=0;for(y=0;y<20;++y)for(x=0;x<10;++x)if(g->board.cells[y][x])++n;
return n;
}
static QActions poll(QInput *in,Q8 button,Q16 ms) 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); return q_input_step(in,read_keys(KEYBOARD_PLAY),button,31,31,31,31,1,ms,1,0);
} }
int main(void) int main(void)
{ {
QInput in;QActions a;QGame game;QOptions options={0,Q_MODERN,0,1};Q8 pressed; 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. */ /* 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); raw_buttons=14;assert(read_keys(KEYBOARD_PLAY)==0);
for(pressed=0;pressed<4;++pressed){ for(pressed=0;pressed<4;++pressed){
raw_buttons=(Q8)(15&~(1<<pressed)); raw_buttons=(Q8)(15&~(1<<pressed));
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==0); assert(read_keys(KEYBOARD_PLAY)==0);
contact_probe=KEY_PROBE_BREAK;contact_bit=KEY_BIT_BREAK; contact_probe=KEY_PROBE_BREAK;contact_bit=KEY_BIT_BREAK;
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==Q_BACK); assert(read_keys(KEYBOARD_PLAY)==Q_BACK);
contact_bit=0; contact_bit=0;
} }
raw_buttons=15;q_input_reset(&in);poll(&in,0,0); raw_buttons=15;q_input_reset(&in);poll(&in,0,0);
@@ -41,27 +54,27 @@ int main(void)
a=poll(&in,0,1);assert(!(a.pressed&(Q_CW|Q_CCW))&&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. */ /* Fire held while steering must not add opposing A/D or E actions. */
q_input_reset(&in);poll(&in,0,0);raw_buttons=14; 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); a=q_input_step(&in,read_keys(KEYBOARD_PLAY),1,0,31,31,31,1,1,1,0);
assert(a.move==-1&&a.repeats==1&&!(a.pressed&Q_CW)); 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); a=q_input_step(&in,read_keys(KEYBOARD_PLAY),1,63,31,31,31,1,1,1,0);
assert(a.move==1&&a.repeats==1&&!(a.pressed&Q_CW)); assert(a.move==1&&a.repeats==1&&!(a.pressed&Q_CW));
/* Clockwise preference also yields one edge on release, not on press. */ /* 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; 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); a=q_input_step(&in,read_keys(KEYBOARD_PLAY|KEYBOARD_CLOCKWISE),1,31,31,31,31,1,100,1,1);
assert(!(a.pressed&(Q_CW|Q_CCW)));raw_buttons=15; 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); a=q_input_step(&in,read_keys(KEYBOARD_PLAY|KEYBOARD_CLOCKWISE),0,31,31,31,31,1,1,1,1);
assert((a.pressed&Q_CW)&&!(a.pressed&Q_CCW)); assert((a.pressed&Q_CW)&&!(a.pressed&Q_CCW));
/* Real keyboard aliases still work when their shared row is available. */ /* Real keyboard aliases still work when their shared row is available. */
contact_probe=KEY_PROBE_E;contact_bit=KEY_BIT_E;assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==Q_CW); contact_probe=KEY_PROBE_E;contact_bit=KEY_BIT_E;assert(read_keys(KEYBOARD_PLAY)==Q_CW);
contact_probe=KEY_PROBE_A;contact_bit=KEY_BIT_A;assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==Q_LEFT); contact_probe=KEY_PROBE_A;contact_bit=KEY_BIT_A;assert(read_keys(KEYBOARD_PLAY)==Q_LEFT);
contact_probe=KEY_PROBE_D;contact_bit=KEY_BIT_D;assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==Q_RIGHT); contact_probe=KEY_PROBE_D;contact_bit=KEY_BIT_D;assert(read_keys(KEYBOARD_PLAY)==Q_RIGHT);
assert(keyboard_read(&raw_buttons,KEYBOARD_INITIALS)==0); assert(read_keys(KEYBOARD_INITIALS)==0);
contact_probe=KEY_PROBE_UP;contact_bit=KEY_BIT_UP; contact_probe=KEY_PROBE_UP;contact_bit=KEY_BIT_UP;
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==Q_CCW); assert(read_keys(KEYBOARD_PLAY)==Q_CCW);
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY|KEYBOARD_CLOCKWISE)==Q_CW); assert(read_keys(KEYBOARD_PLAY|KEYBOARD_CLOCKWISE)==Q_CW);
contact_probe=KEY_PROBE_SPACE;contact_bit=KEY_BIT_SPACE; contact_probe=KEY_PROBE_SPACE;contact_bit=KEY_BIT_SPACE;
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==Q_HARD); assert(read_keys(KEYBOARD_PLAY)==Q_HARD);
assert(keyboard_read(&raw_buttons,0)==Q_CONFIRM); assert(read_keys(0)==Q_CONFIRM);
/* A fire press arriving after the opening sample must cause a rescan. /* A fire press arriving after the opening sample must cause a rescan.
* Every reachable scan boundary is checked, including held/released edges. */ * Every reachable scan boundary is checked, including held/released edges. */
contact_bit=0; contact_bit=0;
@@ -70,11 +83,11 @@ int main(void)
for(line=0;line<4;++line){ for(line=0;line<4;++line){
for(pressed=1;pressed<=15;++pressed){ for(pressed=1;pressed<=15;++pressed){
raw_buttons=15;probes=0;edge_at=pressed;edge_buttons=(Q8)(15&~(1<<line)); raw_buttons=15;probes=0;edge_at=pressed;edge_buttons=(Q8)(15&~(1<<line));
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==0&&!edge_at); assert(read_keys(KEYBOARD_PLAY)==0&&!edge_at);
} }
for(pressed=1;pressed<=15-ambiguous[line];++pressed){ for(pressed=1;pressed<=15-ambiguous[line];++pressed){
raw_buttons=(Q8)(15&~(1<<line));probes=0;edge_at=pressed;edge_buttons=15; raw_buttons=(Q8)(15&~(1<<line));probes=0;edge_at=pressed;edge_buttons=15;
assert(keyboard_read(&raw_buttons,KEYBOARD_PLAY)==0&&!edge_at); assert(read_keys(KEYBOARD_PLAY)==0&&!edge_at);
} }
} }
} }
@@ -88,6 +101,33 @@ int main(void)
a=poll(&in,0,1);assert(!(a.pressed&(Q_CW|Q_CCW))); a=poll(&in,0,1);assert(!(a.pressed&(Q_CW|Q_CCW)));
assert(game.active.rotation==(pressed+1)%4); assert(game.active.rotation==(pressed+1)%4);
} }
puts("PASS: shared fire/keyboard rows, one lasting fire-release rotation, unaffected keyboard rows and gameplay/menu aliases"); /* Both physical secondary lines use the real adapter and edge handler.
* Held fire drops one piece, without alias rotations or repeated drops. */
for(pressed=0;pressed<2;++pressed){
Q8 held_sample,secondary=(Q8)(pressed?8:4);
raw_buttons=15;q_input_reset(&in);port_poll(&in,pressed,0,1);
q_start(&game,&options);
raw_buttons=(Q8)(15&~secondary);a=port_poll(&in,pressed,1,1);
assert(a.pressed==Q_HARD);assert(q_drop(&game)&&occupied(&game)==4);
for(held_sample=0;held_sample<8;++held_sample){
a=port_poll(&in,pressed,500,1);assert(!a.pressed);
if(a.pressed&Q_HARD)q_drop(&game);
}
assert(occupied(&game)==4);
raw_buttons=15;a=port_poll(&in,pressed,1,1);assert(!a.pressed);
raw_buttons=(Q8)(15&~secondary);a=port_poll(&in,pressed,1,1);
assert(a.pressed==Q_HARD);assert(q_drop(&game)&&occupied(&game)==8);
/* Wrong port and Off cannot turn this secondary into a hard drop. */
assert(!(keyboard_read(&raw_buttons,KEYBOARD_PLAY,(Q8)(1-pressed))&Q_HARD));
assert(!(keyboard_read(&raw_buttons,KEYBOARD_PLAY,2)&Q_HARD));
assert(!keyboard_read(&raw_buttons,0,pressed));
/* A held secondary across a menu/resume requires release first. */
q_input_release(&in);a=port_poll(&in,pressed,1,1);assert(!a.pressed);
a=port_poll(&in,pressed,1000,1);assert(!a.pressed);
raw_buttons=15;port_poll(&in,pressed,1,1);
raw_buttons=(Q8)(15&~secondary);a=port_poll(&in,pressed,1,1);
assert(a.pressed==Q_HARD);
}
puts("PASS: shared fire/keyboard rows, one lasting fire-release rotation, unaffected keyboard rows, both secondary hard-drop buttons, held/transition guards and port selection");
return 0; return 0;
} }