Do not overlook the use of the TL$ function when you are creating programs. It is a very useful item. This function allows the ZX80 user to process a string in much the same way that other computers READ DATA statements.
To see how it works in this fashion, consider first the CODE(string) function. It will “read” and give the code of the first character in a string. Thus, if A$=”ABC”, CODE(A$) would result in 38, the code for A.
Now add the TL$ function: LET A$=TL$(A$). The TL$ function strips the first character from the string—A in this case—leaving “BC” in A$. If CODE(A$) is now reintroduced, it will “read” B and give its code, 39.
Clearly, an entire string can be “read” in this way. So, for example, say you have a stock portfolio of five stocks, namely: 100 shares of ABC, 200 of XYZ, 300 Q, 200 KLMN, and 100 ZX. The following program will print the number of shares in 100s, the stock symbol, ask for the last (current) price per 100 shares (stock prices are quoted per share so that 5 1/4 would be input as 525), and, then, after all five stocks have been processed, print the total value of the portfolio.
10 LET V=0
20 LET P$=".1 ABC.2 XYZ.3 Q.2 KLMN.1 ZX."
30 IF CODE(P$)=27 THEN LET P=CODE(TL$(P$))-28
40 PRINT CHR$(CODE(P$));
50 LET P$=TL$(P$)
60 IF P$="" THEN GOTO 130
70 IF NOT CODE(P$)=27 THEN GOTO 40
80 PRINT, " INPUT LAST PER 100"
90 INPUT L —use 100 for test RUN
100 LET V=V+(L*P)
110 CLS
120 GOTO 30
130 CLS
140 PRINT "PORTFOLIO VALUE= ";V —test RUN should
give 900
In line 20 it is noted that the code for . is 27 and acts as a flag to control the loop routine following.
In line 30, subtracting 28 from the code for 1, 2, 3, etc. results in 1, 2, 3, etc. since the code for 1 is 29, for 2 is 30, etc. and thus sets P at the proper value. Note here that the TL$ function is used to “look” one character ahead in the string without actually stripping the string.
To see the value of the TL$ function here, try writing a program without using TL$ to accomplish the same results as this program and look at the length and memory difference.
Another example of using TL$ is seen in this version of Mastermind. Further applications will be left to your imagination.

Mastermind
5 REM COPYRIGHT 1981 BY ROLF L. MILLER
10 LEX X=15
20 LET A=9999+RND(22768)
30 LET A$=STR$(A)
40 LET B$=A$
50 IF X=0 THEN GOTO 190
60 LET X=X-1
70 LET Z-0
80 PRINT "5 NO.GUESS ";
90 INPUT G$
100 IF G$=A$ THEN GOTO 220
110 PRINT G$;
120 IF B$="" THEN GOTO 170
130 IF CODE(G$)=CODE(B$) THEN LET Z=Z+1
140 LET G$=TL$(G$)
150 LET B$=TL$(B$)
160 GOTO 120
170 PRINT " ";Z;" RIGHT (";X;")" (2 sp.)
180 GOTO 40
190 PRINT
200 PRINT "YOU LOSE THE NO. WAS ";A$
210 STOP
220 PRINT
230 PRINT ,A$
240 PRINT
250 PRINT ,"YOU WIN"
Program Notes:
110 displays number guessed.
170 displays number of digits
in proper place of sequence
and number of turns left
in ( ).
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.