Login
Forum Help



Post Your Message
="hidden" name="cat" value="Programming">
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

Hendriks
on 2020-08-20
13:09:18
 Re: Help needed with keyboard matrix in assembly

Yes, it works now. Thanks!

Posted By

Hendriks
on 2020-08-20
12:58:43
 Re: Help needed with keyboard matrix in assembly

Thanks for pointing me in the right direction. I did the check for the key release before, but it didn't work. I will try with setting a flag.

Posted By

gerliczer
on 2020-08-20
12:17:20
 Re: Help needed with keyboard matrix in assembly

You should define a flag that holds the state of key left being depressed or not. If it is clear check for left being pressed like you did in your code, but instead of the action set the flag. If the flag is set check for left being released, which is the opposite condition of your code, then do your action and clear the flag.

Posted By

Hendriks
on 2020-08-20
10:42:51
 Help needed with keyboard matrix in assembly

Hi there, after more than three decades I'm back fiddling in assembly on my favorite Plus/4 machine.

I am using the following code to verify if the user presses the LEFT arrow on the keyboard. It works, when the key is pressed the memory location currChar is decreased. The code is in my main loop (not in an interrupt or something).

The issue is that it fires rapidly and continuously when the key is pressed down. I want it to happen only once until the key goes back up again. Is there a way to wait until the key goes back up again or until a certain time has passed (if the key keeps being pressed)? How do you solve this issue?

LDA #$BF ; Check column 6
STA $FD30 ; Write to Keyboard Matrix
STA $FF08 ; Write to Keyboard Latch
LDA $FF08 ; Read from Keyboard Latch
AND #$01 ; Query keyboard for "LEFT"
BNE LEFT_not_pressed
DEC currChar ; What happens when LEFT is pressed
LEFT_not_pressed
RTS

Thanks!


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon