/* SPDX-License-Identifier: GPL-3.0-or-later */ #include #include #include #include #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<