Page 1 of 1

Reading the keyboard using JSR $FFE4

Posted: Wed Mar 13, 2024 7:54 pm
by fredrik
Programming on the emulator, I'm calling $ffe4 to read the keyboard, for various purposes. Most of the time I get the expected result.

However, I have a routine which waits for the user to press a key. The first time $ffe4 is called, it gets 0 back. The routine then waits a while (to make a cursor flash at a pleasant speed) and calls $ffe4 again. This time, it gets $0d (Enter). I've made sure I don't press Enter at any point.

Any idea what I may be doing wrong, or if there's something to be aware of regarding reading the keyboard using $ffe4?

Re: Reading the keyboard using JSR $FFE4

Posted: Wed Mar 13, 2024 9:59 pm
by TomXP411
This is interesting. I just did a quick check on this from BASIC, and it works as advertised - returns a 0 when no key has been pressed:

so a dumb question: how are you blinking the cursor? Can you post that snippet of code, so we can see if maybe you're doing something that has side effects?

Here's my quick test code:
10 SYS $FFE4
20 A=PEEK($30C)
30 IF A=0 THEN 10
40 PRINT HEX$(A)
50 GOTO 10

Re: Reading the keyboard using JSR $FFE4

Posted: Wed Mar 13, 2024 11:14 pm
by fredrik
Thanks!

This made me look in the right place. I had code that was meant to put a character on screen, but accidentally modified code instead...

Fixed this, but it's still not working properly. Will continue my investigations tomorrow.