I had one answer on Forum64.de:
"It's not a flag, it's a procedure that's required to detect if the shift lock key is pressed. Note that shift lock is hardwired to the left shift key, so the "impossible"-answers are kind-of true. However, the switch-type key has different properties from the button-type key that can be taken advantage of.
Normally, you set one CIA port to output and the other CIA port to input for scanning the keys. This is the usual way, and it's the right way. Once you have detected that the left shift key is pressed, you need to do something that is "electrically wrong": Program both bits of the key matrix to OUTPUT and set the A side to 0, while you set the B side to 1. In essence, you're programming a short-circuit.
Now comes the electrical knowledge: Even when programmed to output, the CIA port-registers always reflect the true status of the physical pins. If programmed to 1, but pulled to GND on the outside, you read a 0. The behaviour of the "1"-bit is what lets you determine the status of the shift lock key: If the bit that you've programmed to "1" reads "0", then the shift lock key is pressed. If both bits read the value that you have written, then the normal left-shift key is pressed.
This procedure sounds much like the "killer-poke", because you're essentially programming a short-circuit, but it's not. The CIA's port bits are operated close to, but within limits using this technique.
Have fun implementing - it should only be a few lines of code!
But when I tried to programming it, I don't understand it correctly and never it works.
Can you help me with this?
Thank you very much.