Not too difficult to check for key release to act on.
Right now you are checking a keypress when the portb value is different from $78
Key release is simply getting the transition from (Not $78) to $78
What caused it to be Not $78 is the key that got released.
For easy implementation in case of short keypresses, a tight blocking loop doing the above test is fine. In case you anticipate the user will have a button down for a long while, then a different approach using a software timer may give better results.
Just a short pseudo code as I am not well oiled in PBP these days
If you wish to have a keyboard that has buttons that give pressed, hold, repeat and release states, I suggest you look at some arduino code that shows such an implementation using a finite state machineCode:while 1 key = ~portb & $78 if (key <> $78) then savedkey = key else if savedkey <> $78 then ' saved key is the one that was released ' act on saved key endif endif wend




Bookmarks