Scrolling Bulletin

This file is part of Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Home

This program implements a horizontal text ticker (news-bulletin crawler) for a 32-column display, scrolling a message string across row 12 of the screen from right to left. The subroutine at line 1060 handles three phases: an entry phase (characters slide in from the right edge), a mid-scroll phase (a full 32-character window moves through the string), and an exit phase (characters slide off the left edge). Two separate messages, stored in C$ and D$, are displayed in alternating loops via GOTO 20 at line 1000. The delay loops at lines 1080–1090 and 1130–1140 use a short FOR/NEXT with limit 3 to control scroll speed. The program requires the message string to be at least 33 characters long and end with a space, as documented in D$ itself.


Program Analysis

Program Structure

The program is divided into two logical parts: a main loop and a reusable scroll subroutine.

  • Lines 10–90: Initialisation and message dispatch — sets up two strings (C$ and D$), copies each into B$, and calls the scroll subroutine.
  • Line 1000: GOTO 20 creates an infinite alternating loop between the two messages.
  • Lines 1060–1210: The scroll subroutine, which performs all three phases of the ticker animation on row 12.
  • Lines 1220–1240: Utility lines for saving — not reached during normal execution.

Scroll Subroutine — Three Phases

The subroutine at line 1060 implements a classic ticker in three distinct phases, all printing to AT 12, (the middle of a 25-row display):

  1. Entry phase (lines 1060–1100): Loop variable F runs from 0 to 30. Each iteration prints the first F+1 characters of B$ at column 31-F, making the text appear to slide in from the right edge one character at a time.
  2. Mid-scroll phase (lines 1110–1150): Loop variable E runs from 1 to LEN B$-33. A 32-character window (B$(E+1 TO E+32)) is printed at column 0, advancing through the string. This requires the string to be at least 33 characters long.
  3. Exit phase (lines 1160–1200): Loop variable C runs from 0 to 31. The tail of the string (B$(C+LEN B$-31 TO LEN B$)) is printed at column 0, progressively shortening as the text scrolls off the left edge.

Delay Mechanism

Speed is controlled by an inner FOR D=1 TO 3: NEXT D loop present in each phase (lines 1080–1090, 1130–1140, 1180–1190). The limit of 3 iterations produces a minimal delay. Combined with the SLOW mode set at line 10 (which halts the CPU during display generation), this gives a visible but reasonably fast scroll rate. Increasing the limit of 3 would slow the ticker down.

String Requirements and Self-Documentation

The program imposes two constraints on B$: it must be at least 33 characters long (or the mid-scroll loop will not execute, and the slice in the exit phase may produce an error), and its final character must be a space (to avoid a visible hard edge during exit). Unusually, the demonstration string stored in D$ at line 60 explicitly states both of these requirements as part of its own content, serving as both a test message and inline documentation.

Variable Usage

VariableRole
B$Working copy of the string passed to the subroutine
C$First display message (intro/instructions)
D$Second display message (usage notes)
FEntry phase loop counter
EMid-scroll phase loop counter
CExit phase loop counter
DInner delay loop counter (reused across all three phases)

Notable Techniques and Observations

  • The reuse of B$ as an input parameter convention for the subroutine is a clean pattern, given ZX81 BASIC has no proper procedure arguments.
  • The CLS at lines 50 and 90 clears the screen between messages, preventing leftover characters from adjacent print positions.
  • The exit phase loop runs from 0 to 31 (32 iterations), but each iteration prints a progressively shorter slice ending at LEN B$; at C=31 the slice is a single character (the mandatory trailing space), leaving a clean finish.
  • There is a potential edge case: if LEN B$ is exactly 33, the mid-scroll loop runs for exactly one iteration (E=1), which is valid but produces almost no mid-scroll phase.
  • The variable name C is reused at line 1160 as the exit-phase counter, which shadows the outer loop variable — this is safe here since the entry phase loop using F has already completed, but the naming overlap with C$ (the string variable) is coincidental and causes no conflict in ZX81 BASIC.

Appears On

Tape 1006 of the Timex Sinclair Public Domain Library. Assembled by Tim Ward from many sources.

Image Gallery

Source Code

  10 SLOW 
  20 LET C$="IF YOU WANT TO PRINT A NEWS BULLETIN THEN READ ON . "
  30 LET B$=C$
  40 GOSUB 1060
  50 CLS 
  60 LET D$="LENGTHEN THIS STRING FOR MORE   MESSAGE.  600 CHARACTERS MAY BE USED.USE AT LEAST 33 CHARACTERS. THE FINAL CHARACTER MUST BE A  SPACE. "
  70 LET B$=D$
  80 GOSUB 1060
  90 CLS 
 1000 GOTO 20
 1060 FOR F=0 TO 30
 1070 PRINT AT 12,31-F;B$(1 TO F+1)
 1080 FOR D=1 TO 3
 1090 NEXT D
 1100 NEXT F
 1110 FOR E=1 TO LEN B$-33
 1120 PRINT AT 12,0;B$(E+1 TO E+32)
 1130 FOR D=1 TO 3
 1140 NEXT D
 1150 NEXT E
 1160 FOR C=0 TO 31
 1170 PRINT AT 12,0;B$(C+LEN B$-31 TO LEN B$)
 1180 FOR D=1 TO 3
 1190 NEXT D
 1200 NEXT C
 1210 RETURN 
 1220 CLEAR 
 1230 SAVE "1026%7"
 1240 RUN 

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