It looks like one graph is obscured a bit, but you can figure it out.
In one of the modes, there is basically 8 buttons connected to pin 9.
In the other mode it's able to deal with a Keypad without much intervention. A key in a typical keypad, connects a row and a column together. So, a 4 x 4 keypad doesn;t require 16 ports. It only requires 8.
The processor is constantly scanning either the rows and and looking for colum transitions or vice versa. A Row, column pair is mapped to each button.
It looks like in the button mode, it's one port per button.
The chip probably enables the pullups correctly.
This **broken link removed** might give you a better idea of what's going on.