[BASIC] How to read from the keyboard buffer?
Posted: Sat Mar 23, 2019 8:33 pm
Hi!
I am struggling with the input in the Spectrum version of my BASIC game "Mines":
https://github.com/Fabrizio-Caruso/Sinc ... -10-liners
I need to read the last key-pressed in a loop without stopping if no key is pressed.
I don't want to miss key-presses.
I currently use "LET S = CODE INKEY$" but this works randomly because
it seems not to read from the keyboard buffer. It seems it is only reading the current keyboard status.
So if by chance the key was pressed and released just before, then the last key pressed is lost.
What is the correct way to read the keyboard in a "buffered way"?
Fabrizio
I am struggling with the input in the Spectrum version of my BASIC game "Mines":
https://github.com/Fabrizio-Caruso/Sinc ... -10-liners
I need to read the last key-pressed in a loop without stopping if no key is pressed.
I don't want to miss key-presses.
I currently use "LET S = CODE INKEY$" but this works randomly because
it seems not to read from the keyboard buffer. It seems it is only reading the current keyboard status.
So if by chance the key was pressed and released just before, then the last key pressed is lost.
What is the correct way to read the keyboard in a "buffered way"?
Fabrizio