you can remove all the gosubs entirely with a bit of thought to get the same printout

Code:
LOOPY:        FOR X = 1 TO 30
        DEBUG 13,10,DEC X,9
        GOSUB CX
    NEXT
    PAUSE 5000    
GOTO LOOPY 
CX:
     XX = x
     y = 0
     WHILE XX  
         DEBUG  49 + y
         y = y + 1
         if y == 3 then y = 0
         Xx = Xx - 1
         IF  XX  THEN DEBUG ","
     WEND
 RETURN