I think the Studio IV uses 20 or possibly 32 keys. The lower 4 bits of OUT 2 are used as input selecting one of the 16 outputs of the keyboard decoder. The keys on the left keypad are connected to the EF3 flag and on the right keypad to the EF4 flag. The Studio IV software checks the keys by stepping OUT 2 from 0 to 15. After every OUT, EF3 and EF4 are checked and if equal to 0 the key representing the last OUT 2 and EF was pressed.