Top row numbers can be shifted and keypad numbers can't. Both share an edge detector circuit and multiplexer 'line'. Top row key short to ground whereas keypad key have an SIO (or S10) signal. The keyboard logic board uses an analogue edge detector with 74121 pulse generator.
On the Pico I'm handling this by driving the SIO line low. When a keypress is detected I drive it high. If the keypress is still detectable then it's a top row key. If not then keypad.