Code:
for i = 0 to 255
    IF porta <> 0 then exitloop
pause 1
next i
exitloop:
if any pin on porta is set, exit the loop