!       SPIRAL.BAS
! This tries to build a spiral from the center of the screen
! Feb. 23, 1980   ske messin around when he should be workin
! 1 Jan 87 new graphics codes.... rrm...MCMA/AM
! 11 Jan 87 corrected so words print correctly on Wyse-50  RMC [ROBT/AM]
START:
        on error goto WRAPUP
        R = 12  ! locates the center row
        C = 36  ! locates the starting column
        HORIZ = 5 ! start printing more horizontal than vertical
        VERT = 0
        ? TAB(-1,0);TAB(-1,29); !cursor off
        PRINT TAB(-1,23); ! set graphics mode on
        FOR I=1 TO 24
           FOR J=1 TO 79
                PRINT TAB(-1,49);       !solid block char
                NEXT J
           PRINT
        NEXT I
	? TAB(-1,24);		! graphics mode off temporarily [RMC]
        ? TAB(R,C);"THE END";! print the words
        ? TAB(-1,32);           ! reverse video
	? TAB(-1,23)		! graphics mode back on [RMC]
        C = C + 7
        GOTO DOWN

RIGHT:
        PRINT TAB(R,C);TAB(-1,38);                      !top left
        HORIZ = HORIZ + 3
        FOR RT = 1 TO HORIZ
                C = C + 1
                ? TAB(R,C);TAB(-1,46);                  !horiz line
        NEXT RT
        IF C = 79 THEN GOTO QUIT

DOWN:
        ? TAB(R,C);TAB(-1,39);                          !top right
        VERT = VERT + 1
        FOR DOWN = 1 TO VERT
                R = R + 1
                ? TAB(R,C);TAB(-1,47);                  !vert line
        NEXT DOWN
        IF R = 24 THEN GOTO QUIT

LEFT:
        ? TAB(R,C);TAB(-1,41);                          !bottom right
        HORIZ = HORIZ + 3
        FOR LT = 1 TO HORIZ
                C = C - 1
                ? TAB(R,C);TAB(-1,46);                  !horiz line
        NEXT LT

UP:
        ? TAB(R,C);TAB(-1,40);                          !bot left
        VERT = VERT + 1
        FOR UP = 1 TO VERT
                R = R - 1
                ? TAB(R,C);TAB(-1,47);                  !vert line
        NEXT UP
        GOTO RIGHT
QUIT:   PRINT TAB(-1,24);TAB(-1,28);   ! EXIT GRAPHICS MODE & CURSOR ON
        PRINT TAB(-1,33);               ! normal video
        PRINT TAB(24,1);TAB(-1,10);     ! clear to end of screen
        END
WRAPUP:
        RESUME QUIT