UNTESTED, but with no compile error.

You can try

main:
for I = 0 to 7
if (portb & DCD I) = 1 then xxxxx
next I
goto main


J-P