Try These

See all articles from T-S Horizons n18
Author(s): Peter McMullin
Publication: T-S Horizons
Pub Details: T-S Horizons n18 (Issue 18)
Date: April 1986
Pages: 5

The EXPANDING Text Line – by Peter McMullin

(ZX81/TS1000/TS 2068 2K or more)

“After having gotten my feet wet writing some software, it became a challenge to present introductory or instructive text sequences in an interesting way

“I spotted the cover screen for an IBM software package which was a real eyecatcher: each line of text appeared to scroll outwards into place from the centre of the screen. The Sinclair BASIC string handling features lend themselves well to this sort of thing.

“A trivial routine like this must (and this one does) fill 3 requirements: 1) Executes quickly enough to achieve a specific effect. 2) Easily coded in BASIC. 3) Uses very few bytes.

“If you use the subroutine in a long Basic program, put it near the start of the program, where it will execute more quickly. The listing should be self-explanatory – the text input string A$ must not be longer than 32 characters. An additional benefit is that the routine centres all text on the screen.

“Can you see why line 1000 is necessary? If not, delete line 1000 then run and see what happens with odd length strings. Here’s the listing, have some fun!”

  10 LET LINE=2
20 PRINT "> ENTER A TEXT STRING <32 CHR$ "
30 INPUT A$
40 IF LEN A$>32 THEN LET A$=A$( TO 32)
50 GOSUB 1000
60 LET LINE=LINE+2*(LINE<20)
70 GOTO 50
1000 IF LEN A$/2<>INT (LEN A$/2) THEN LET A$=A$+" "
1010 LET END=LEN A$
1020 LET MID=END/2
1030 FOR N=1 TO MID
1040 PRINT AT LINE,16-N;A$( TO N)+A$(END+1-N TO )
1050 NEXT N
1060 RETURN

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