This program displays a simple animated face constructed entirely from ASCII-style characters, cycling through three frames in a continuous loop. Each frame is drawn inside a border of asterisks and parentheses, with the face alternating eye and mouth states to suggest blinking and an opening mouth. The delay between frames is achieved using a short FOR–NEXT loop from 1 to 10, a common timing technique on machines without a dedicated delay command. The animation loops indefinitely via a GOTO at line 280 returning to the start.
Program Analysis
Program Structure
The program is divided into three nearly identical blocks, each occupying roughly 90 lines of code. Every block clears the screen, prints an eight-row bordered face, then pauses using a short FOR–NEXT loop before the next block begins. After the third frame, GOTO 10 at line 280 restarts the cycle indefinitely.
| Block | Lines | Eyes | Mouth |
|---|---|---|---|
| Frame 1 | 10–95 | (O) (O) | — |
| Frame 2 | 100–185 | (O) (-) | O |
| Frame 3 | 190–275 | (O) (O) | O |
Animation Logic
The animation mimics a winking or blinking sequence. Frame 1 shows both eyes open with a closed mouth (---). Frame 2 changes the right eye to a closed dash (-) and opens the mouth to an O. Frame 3 returns both eyes to open while keeping the mouth as O. This three-step cycle creates a subtle wink-and-speak effect.
Timing Mechanism
Each frame uses a FOR X=1 TO 10 ... NEXT X loop split across two lines (e.g. lines 90 and 95) purely as a software delay. The loop body is empty, so it simply burns CPU cycles. The delay is very short — only 10 iterations — which on a machine of this era produces a rapid animation rather than a slow one.
Key BASIC Idioms
- Splitting
FORandNEXTacross adjacent line numbers (e.g. 90/95, 180/185, 270/275) is a stylistic choice with no functional difference from a single-line loop. - Each frame reuses the same border string
"()***********()", making the outer frame consistent across all three states. GOTO 10rather thanGOTO VAL "10"is used for the infinite loop, which is straightforward but slightly less memory-efficient than theVALidiom.
Anomalies and Notes
Lines 290 and 300 (SAVE "1018%0" and RUN) appear at the end of the listing but are never reached during execution because the GOTO 10 loop at line 280 never exits. These lines exist outside the runtime flow and serve a purpose unrelated to the animation itself.
The variable X is shared across all three delay loops, but since each loop runs to completion before the next begins, there is no conflict. After each loop, X holds the value 11, but this is never read.
Content
Source Code
10 CLS
20 PRINT "()***********()"
30 PRINT "** **"
40 PRINT "** (O) (O) **"
50 PRINT "** **"
60 PRINT "** V **"
70 PRINT "** **"
80 PRINT "** --- **"
90 FOR X=1 TO 10
95 NEXT X
100 CLS
110 PRINT "()***********()"
120 PRINT "** **"
130 PRINT "** (O) (-) **"
140 PRINT "** **"
150 PRINT "** V **"
160 PRINT "** **"
170 PRINT "** O **"
180 FOR X=1 TO 10
185 NEXT X
190 CLS
200 PRINT "()***********()"
210 PRINT "** **"
220 PRINT "** (O) (O) **"
230 PRINT "** **"
240 PRINT "** V **"
250 PRINT "** **"
260 PRINT "** O **"
270 FOR X=1 TO 10
275 NEXT X
280 GOTO 10
290 SAVE "1018%0"
300 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
