BURSTLINE

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Demo

BURSTLINE is a display-effect routine that animates a text string by “exploding” it outward from the center, revealing characters progressively from the middle to the edges on a single screen row. The program pads odd-length strings with a trailing space to ensure an even character count before calculating split points. A BEEP with a pitch proportional to the current iteration index accompanies each animation frame, producing an ascending tone as the line expands. The subroutine accepts a string in `b$` (up to 32 characters) and a target print row in `vt`, making it easy to integrate into larger programs via GOSUB 1000. Two SAVE lines are included, one for the standalone demo and one for the subroutine-only version.


Program Structure

The program is organized into three logical sections:

  1. Lines 10–100: REM headers documenting subroutine usage conventions.
  2. Lines 110–140: A standalone demonstration loop that sets b$ and vt, calls the subroutine repeatedly, incrementing vt each iteration until row 21 is reached.
  3. Line 1000–1010: The self-contained burst animation subroutine.

The Burst Algorithm

The core routine at lines 10001010 works as follows:

  1. Compute M = LEN B$. If M is odd (i.e., M/2 <> INT(M/2)), append a space and increment M to guarantee an even split.
  2. Loop N from 1 to M/2. On each iteration, print at row vt, column 16-N, the concatenation of B$(TO N) (the left-growing fragment) and B$(M-N+1 TO) (the right-growing fragment). This places the two halves symmetrically around the screen center (column 16).
  3. Issue a BEEP .02, 2*N — a short beep whose pitch rises linearly with each step, reinforcing the expanding visual effect.

Because each PRINT AT overwrites the same screen row, the successive prints build up the complete string from the inside out without clearing the line explicitly.

Key BASIC Idioms and Techniques

  • Even-length enforcement: The parity check M/2 <> INT(M/2) is a compact idiom for detecting an odd integer without using MOD.
  • String slicing for symmetry: B$(TO N) and B$(M-N+1 TO) neatly extract growing left and right substrings in a single expression, avoiding temporary variables.
  • Column centering: Using column 16-N as the print position ensures the expanding text stays centered on a 32-column display, since the left fragment grows leftward by one column per iteration.
  • Dual SAVE lines: Lines 9998 and 9999 offer two save options — one for the full demo (auto-running at line 130) and one labelled as just the subroutine portion, both followed by VERIFY for data integrity confirmation.
  • Subroutine contract documented in REM: Lines 10 and 100 explicitly document the calling convention (b$, vt, GOSUB 1000), a good practice for reusable library routines.

Notable Observations

  • The demo loop in lines 120140 increments vt before calling the subroutine, so the first burst appears on row 1 rather than row 0. This is intentional given the initial LET vt=0 at line 111.
  • The 32-character limit on b$ stated in the REM corresponds exactly to the display width, ensuring the burst never overflows the screen horizontally.
  • Each animation frame redraws the entire (growing) string from the PRINT AT position; there is no partial erase, so the effect relies on overprinting characters already placed. This is efficient but means earlier characters are reprinted redundantly on each pass.
  • The ascending BEEP pitch (2*N semitones above a base note) provides a natural audio cue that the animation is progressing — a simple but effective audiovisual coupling.

Potential Anomaly

Line 1000 combines two statements — the length calculation with parity check and the conditional string pad — on a single line separated by a colon. This is syntactically valid but could cause a subtle issue: if B$ is already exactly 32 characters and odd-length (impossible at 32, but possible at 31), the append pushes it to 33 characters, potentially causing a column overflow when N = 16 and the print position is column 0. For strings up to 31 characters this is harmless, but callers should be aware the effective safe maximum for odd-length strings is 31 characters, not 32.

Source Code

   10 REM \{20}\{1}To use as a subroutine:\{20}\{0}
  100 REM \{20}\{1}Define b$: <=32 char\{20}\{0}            \{20}\{1}Define vt: PRINT Line\{20}\{0}           \{20}\{1}Gosub 1000 \{20}\{0}
  110 LET b$="DEMONSTRATION OF LINE EXPLOSION"
  111 LET vt=0
  120 LET vt=vt+1
  130 GO SUB 1000
  135 IF vt=21 THEN STOP 
  140 GO TO 120
 1000 LET M= LEN B$:IF M/2 <> INT (M/2) THEN LET B$=B$+" ":LET M=M+1
 1010 FOR N=1 TO M/2:PRINT AT VT,16-N;B$( TO N);B$(M-N+1 TO ):BEEP .02,2*n:NEXT N:RETURN 
 9998 SAVE "BURSTLINE" LINE 130:PRINT FLASH 1;"Verify...":VERIFY "":STOP 
 9999 SAVE "BURST sub" LINE 130:PRINT FLASH 1;"Verify...":VERIFY "":STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.