Amenoera,
I think your “page 3” example will not work.
The switches are “DIP Switches” so many may be closed. These are not key but switches.
Example:
Close switch A0 through 7 and switch B3 all other are open
RA3,2,1,0 = 1111b RB7,6,5,4,3,2,1,0, = 11111111
Scan switches
RA3,2,1,0 = 1110b RB7,6,5,4,3,2,1,0, = 00000000
RA3,2,1,0 = 1101b RB7,6,5,4,3,2,1,0, = 00000000
RA3,2,1,0 = 1011b RB7,6,5,4,3,2,1,0, = 11111111
RA3,2,1,0 = 0111b RB7,6,5,4,3,2,1,0, = 11111111
Problem: When switch A 0 through 7 are closed it shorts RB7,6,5,4,3,2,1,0 together.
This is why I suggested adding diodes. Diodes work, I have done this. See old message.