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.
28 lines
1.2 KiB
C
28 lines
1.2 KiB
C
/* 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;
|
|
}
|