10 REM - Wandering CBS Eye EYESAVER.BAS.txt

20 GOSUB 1000 : REM Clear the Screen
30 PI = 3.14159
40 DZOP "C",1 : REM Color mode [Range = 16-23]
50 C=17 : REM Initial color
60 XC = 128 : YC = 128 : REM Initial center of the Eye

70 FOR STEPS = 1 TO 1000 : REM Loop to keep CBS eye wandering
80 GOSUB 4000 : REM Move the eye to a new random position
90 GOSUB 2000 : REM Draw the CBS Eye
100 GOSUB 3000 : REM Pause between moves
110 GOSUB 1000 : REM Clear the screen for the next position
120 NEXT STEPS

999 GOTO 9999 : REM End of Program

1000 REM Clear the Screen Routine
1010 DZOP "C",16
1020 DZOP "P",0,0
1030 DZOP "R",255,255
1040 RETURN

2000 REM CBS Eye Drawing Routine
2010 DZOP "C",C : REM Set color for outer circle
2020 GOSUB 2100 : REM Draw outer ellipse (CBS outer shape)

2030 DZOP "C",C+2 : REM Set color for middle part
2040 GOSUB 2200 : REM Draw middle ellipse (CBS mid shape)

2050 DZOP "C",C+4 : REM Set color for center circle
2060 GOSUB 2300 : REM Draw center circle (CBS center)

2095 RETURN

2100 REM Draw Outer CBS Eye Ellipse (Wider Ellipse)
2110 FOR T = 0 TO (2*PI) STEP 0.1
2120 X = XC + 70 * COS(T) : Y = YC + 40 * SIN(T)
2130 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D" : REM Only plot valid coordinates
2140 NEXT T
2150 RETURN

2200 REM Draw Middle CBS Eye Ellipse (Smaller Ellipse)
2210 FOR T = 0 TO (2*PI) STEP 0.1
2220 X = XC + 50 * COS(T) : Y = YC + 25 * SIN(T)
2230 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2240 NEXT T
2250 RETURN

2300 REM Draw Center CBS Eye Circle
2310 FOR T = 0 TO (2*PI) STEP 0.1
2320 X = XC + 20 * COS(T) : Y = YC + 20 * SIN(T)
2330 IF X >= 0 AND X <= 255 AND Y >= 0 AND Y <= 255 THEN DZOP "P", X,Y : DZOP "D"
2340 NEXT T
2350 RETURN

3000 REM Pause Routine
3010 FOR PAUSE = 1 TO 300 : NEXT PAUSE : REM Short pause
3020 RETURN

4000 REM Move the CBS Eye to a new random position
4010 XC = INT(RND(1)*160) + 48 : YC = INT(RND(1)*160) + 48 : REM Random position within screen bounds
4020 RETURN

9999 REM End of Program
10000 END
