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
@@ -16,4 +16,24 @@ void width(byte columns);
|
||||
void setHighSpeed(byte speed);
|
||||
word getTimer(void);
|
||||
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
|
||||
@@ -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,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);
|
||||
/* 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;}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user