Thanks for the link...so my syntax should be?

FOR i = 0 to 7
IF portb.0(i) = 0 THEN GOSUB alarm
NEXT i

I'll give it a whirl.
Rgds
MED2007