The Theory
Limitations
The technical limitation on the C64 Keyboard hardware is that not more than 2 keys may be pressed at the same time if you want to be 100% sure the result is valid. In some cases, three keys will work fine but whenever 3 keys form a right angle in the keyboard scan matrix, a 4th letter will appear. The combination “ABC” will work fine but the combination “ASD” will form such a triangle and the matrix will also report that the “F” key is pressed. Same goes for “ASF” which would incorrectly read a “D” the same way.
In short, the C64 keyboard is not a piano where you can play choords and stuff.
Scanning the Keyboard the correct and non-KERNAL way