Your code here:
WHILE SKIP==0 FOR X=0 TO DIRTX BGPUT 0,DIRT,DIRTH,332 INC DIRTX,1 NEXT WENDYou never set SKIP to 1 after it finishes. I think an IF statement would be appropriate instead of a WHILE loop. So,
IF SKIP==0 THEN FOR X=0 TO DIRTX BGPUT 0,DIRT,DIRTH,332 NEXT ENDIFAnother problem: You never allow the FOR to end. You keep increasing DIRTX each loop. That never allows X to catch up. That's why I removed INC DIRTX,1 in the code example. If you're doing INC SOMETHING,1 then you can remove the ,1. It's implied if there's no second argument. So INC DIRTX is equally correct and shorter to write than INC DIRTX,1.