Any idea how can the keyboard matrix scan routine check for key release, before jumps to the keycheck subroutine please?

Code:
keyscan:
while 1
    for ix=0 to 2     'scan columns
        portb=~dcd ix 'invert polarity
        keyin=portb & %01111000
        if keyin<>120 then keycheck  'if key is pressed then check it
    next ix
wend
Ioannis