A string demonstration for the ZX80. Type a string at the prompt and the program prints it backward twice, once in normal characters and once in inverse video, then -END-. It takes the string apart one character at a time with CODE and TL$, storing the codes in array C, and prints them from the last to the first.
The array allows strings of up to 30 characters; to handle longer strings, increase the size of C in line 5 as far as memory allows. The same article printed a separate Inverse Graphics subroutine by Peter Herschel, which is not part of this program.
Published in Syntax September 1981 (Manipulating Strings).
Source Code
5 DIM C(30)
10 PRINT "ENTER A STRING"
20 INPUT A$
30 PRINT
40 PRINT "REVERSE OF ";A$;" IS:"
50 LET I=0
60 LET I=I+1
70 LET C(I)=CODE(A$)
80 LET A$=TL$(A$)
90 IF NOT A$="" THEN GO TO 60
100 FOR N=0 TO I-1
110 LET K=I-N
120 PRINT CHR$(C(K));
130 NEXT N
140 PRINT
150 PRINT
160 FOR N=0 TO I-1
170 LET K=I-N
180 PRINT CHR$(C(K)+128);
190 NEXT N
200 PRINT
210 PRINT
220 PRINT "-END-"Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

