This program creates a bouncing-text effect by repeatedly printing a user-supplied string (up to 20 characters) paired with its inverse-video mirror across the screen. The POKE at address 23692 disables the “scroll?” prompt, preventing the display from pausing when it reaches the bottom. Row position `e` bounces between 0 and 20, and column position `d` bounces between 0 and 30, each reversing sign when they exceed their boundary. The combined normal and INVERSE 1 rendering doubles the visual width of the text on each print.
Program Analysis
Program Structure
The program is organized into three logical phases: initialization (lines 10–40), display (line 50), and position update with wraparound (lines 60–100). The main loop runs from line 50 back to line 50 via GO TO 50 at line 100, producing a continuous animation with no exit condition.
- Lines 10–20: Set display attributes (black ink, white paper, border 7), clear screen, and collect the user’s string into
a$. - Line 30:
POKE 23692,255sets the scroll counter to its maximum value, suppressing the “scroll?” prompt. - Lines 40–50: Initialize column (
d) and row (e) to zero, then print the string twice — once normally, once inINVERSE 1— at the current screen position. - Lines 60–100: Increment row and column counters, reverse their sign when they exceed the screen boundaries, and loop back.
Bouncing Algorithm
The bounce logic uses a sign-flip technique rather than a direction flag. When e exceeds 20 it is replaced with -e, and when d exceeds 30 it becomes -d. While this does reverse direction, the approach has a notable anomaly: the counters can take on negative values, which are valid AT row/column arguments only so long as they resolve to legal screen coordinates. Negative AT coordinates will cause an error (“B Integer out of range”) once the magnitude drifts outside the 0–20 / 0–31 screen bounds, so in practice the bounce only works cleanly during the initial positive sweep.
Key BASIC Idioms
POKE 23692,255— the standard system-variable poke to defeat the scroll prompt; the value decrements with each line scrolled, so 255 gives the maximum headroom before it must be re-poked.INVERSE 1inline within aPRINTstatement — toggles inverse video mid-statement without needing a separatePRINTline, producing the two-tone text pair.- The
INPUTstatement uses the'separator to issue a newline before the input cursor, keeping the prompt and entry on separate lines.
Notable Techniques
Printing at a fixed AT e,d position on every iteration means the program does not clear the screen between frames; old text remains visible, giving a trail effect rather than a clean animation. This is intentional for the “light show” aesthetic but means the display fills quickly.
Bugs and Anomalies
| Line | Issue | Effect |
|---|---|---|
70 | LET e=-e when e>20 can produce a negative row such as -21 | Subsequent PRINT AT e,d will raise error “B Integer out of range” once the negated value is used |
90 | Same sign-flip issue for column d when d>30 | Same potential out-of-range error on the column axis |
30 | Scroll counter poked only once, not inside the loop | After 255 scroll events the “scroll?” prompt will reappear |
Content
Image Gallery
Source Code
10 OVER 0: INK 0: PAPER 7: BORDER 7: CLS
20 INPUT "Enter 1 - 20 characters"'a$
30 POKE 23692,255
40 LET d=0: LET e=0
50 PRINT AT e,d;a$; INVERSE 1;a$
60 LET e=e+1
70 IF e>20 THEN LET e=-e
80 LET d=d+1
90 IF d>30 THEN LET d=-d
100 GO TO 50
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.