since pbp has no nibble var type i would guess that

keyn(ix)=kin ' read the row inputs into nibbles of key0

becomes
keyn = keyn & ~$0f<<(ix*4);clear nibble
keyn = keyn | kin<<(ix*4);load new value for nibble

where kin is now a word and

kin var inD
becomes
kin = portd & $f



there is probably better pbp code for reading a keypad floating around