Reading the keyboard using JSR $FFE4

All aspects of programming on the Commander X16.
Post Reply
fredrik
Posts: 18
Joined: Fri Mar 01, 2024 12:25 pm

Reading the keyboard using JSR $FFE4

Post 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?
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

Re: Reading the keyboard using JSR $FFE4

Post 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
fredrik
Posts: 18
Joined: Fri Mar 01, 2024 12:25 pm

Re: Reading the keyboard using JSR $FFE4

Post 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.
Post Reply