Letters

See all articles from SYNC v1 n5

REM on the 4K ROM

Dear Editor:

I have been visiting my brother this summer and learning a little about programming the ZX80. Recently I discovered something interesting:

10 REM
20 PRINT "THIS LINE WILL NOT
PRINT"
30 PRINT "THIS ONE WILL"

In this example line 20 will not print, but if line 10 is changed to

10 REM 1 (or any other character)

lines 20 and 30 will print.

We decided that the ZX80 (4K ROM) skips the next character after the remark command. If that character is a “newline,” it skips the entire next line. (Note by his brother: The interpreter skips over everything up to the next NEWLINE, after skipping the character following the REM.)

I have really enjoyed your magazine and the games that are published.

David Brendel
[address omitted]


Dear Editor:

I would like to warn your readers about a semi-bug in Sinclair’s 4K ROM. If you use a REM, you must put something after it other than spaces. Otherwise, the computer ignores the next line of the program. I have informed Sinclair Research of the problem, and I certainly hope they correct it in later ROMs.

Geoffrey Horton
[address omitted]

Ed.—When we received two letters at about the same time on the same topic, we decided to refer the question to some of our sources. Here are their replies:

David Ornstein—This feature of the 4K ROM is a powerful debugging tool. Suppose you want to check how a particular line, say line 150, is functioning in a program without going to all the trouble of deleting it and then reentering it. You simply type in line 149 REM, and RUN your program. The ZX80 will run the program and skip over line 150. You can observe the results and then easily EDIT line 149.

Joseph Sutton—The REM command can be used in a line to remove it temporarily from the program by inserting REM immediately after the line number. After you have checked the performance, you delete the REM.

James Grosjean—You can use this feature as a memory saving tool in some programs. For example, in “Motorcycle Race” in this issue, you can save six bytes by deleting lines 100-114 and substituting the following:

102 GO TO 102+RND(6)*2
104 PRINT "WATER AND MUD"
105 REM
106 PRINT "DEEP HOLE"
107 REM
108 PRINT "SHARP TURN"
109 REM
110 PRINT "BUMPY TRACK"
111 REM
112 PRINT "FALLEN RIDER"
113 REM
114 PRINT "LOOSE GRAVEL"

“Mini-Billboard” for 8K ROM

Dear Editor:

When I received my July/August issue of SYNC magazine, one of the first programs I looked at was “Mini-Billboard.” Since I now have the 8K Basic installed and I do not want to go back, I looked it over to see whether it would be easy to convert.

The only serious problem was finding where the character generator was located in the 8K ROM. A few weeks before, I had obtained a listing of the 8K ROM, so I looked for the patterns necessary for the character generator. Then all I needed was the address. I picked what looked like a unique pattern just before the beginning of the character generator and wrote the program:

10 FOR A=3 TO 9E3
20 IF PEEK A=0 AND PEEK(A-1)=255
AND PEEK(A-2)=255 AND PEEK(A-3)=
201 THEN PRINT A
30 NEXT A

(If you are interested in using this, it takes almost 5 minutes to run). Now armed with the address (7680) I re-wrote lines 20, 70, and 110 and removed line 21.

If you change line 10 of the memory search program to 17E3 in place of 9E3, you will find the pattern occurs twice, at 7680 and again at 7680 plus 8K (or 8192 2^13 = 15872). I would be interested in finding out why a particular byte in the ZX80 ROM can be addressed at more than one place.

The “Mini-Billboard” program revised for the 8K ROM is as follows:

  5 DIM A(8)
10 INPUT A$
15 FOR I=1 TO 8
20 LET A(I)=(CODE(A$(I)*8)
+7680
23 NEXT I
25 LET F=1
27 LET L=4
30 FOR X=0 TO 7
35 FOR I=F TO L
40 LET C=PEEK(A(I)+X)
50 FOR Y=0 TO &
60 LET E=2**(7-Y)
70 IF C [illegible]=E THEN GO TO 100
80 PRINT "#";
90 GO TO 120
100 LET C=C-E
110 PRINT "■"; (shift 9; hit
space)
120 NEXT Y
130 NEXT I
140 NEXT X
150 LET F=F+4
160 LET L=L+4
170 IF L=8 THEN GO TO 30

My thanks to SYNC for a great magazine and to Dennis Duke for a great program.

Joseph R. Sutton
[address omitted]


“Bar Charts” and Rubber Cement

Dear Editor:

In my program “Setting Up Bar Charts” (SYNC 1:4), additional data can be entered in the immediate mode, and the REM on line 320 can be eliminated, since J will always point to the first element of B which contains a zero. Example: LET B(J) = 1104. However, the program must be run (using GO TO 1) to update the value of J each time a value is added to vector B.

For those having a problem with putting the 8K keyboard template over the old keyboard, rubber cement, a temporary paper adhesive, seems to do the job. The cement remains flexible, and the template can easily be removed later if desired. The best procedure seems to be to lay a thin coat on the keyboard, let it dry a couple of minutes, and then attach the template. Since rubber cement is highly flammable, be sure to take proper precautions.

Jon Passler
[address omitted]


Splitting Strings

Dear Editor:

Harry Doakes’ article on string handling in the July/August issue was great. However, he didn’t mention one other useful technique that rises naturally from his explanations—how to split a string into sub-strings. The following program will do it.

 10 (enter the program shown in SYNC
1:4, p. 26)
20 LET A$="STRING TO BE SPLIT"
30 LET L$=""
40 FOR F=1 TO 13
50 LET B$=CHR$(CODE(A$))
60 LET A$=TL$(A$)
70 LET M$=B$
80 LET L$=L$
90 LET M$=M$
100 RANDOMIZE USR(16427)
110 NEXT F
120 PRINT L$
130 PRINT A$

This program has the effect of chipping away the leading characters from A$ and piling them up, one by one, at the end of L$. With the inputs shown above, the result will be “STRING TO BE” and “SPLIT”. In practice, of course, lines 20 and 40 will be altered to fit the needs of the moment. You can also extend this technique to insert a string into the middle of an existing string.

Basil Wentworth
[address omitted]


Short Video Cable

Dear Editor:

My son, James Willis, got a ZX80 computer for Christmas 1980, but we have a problem. The video cable with the coaxial plugs is too short for usage.

Can we obtain from the manufacturer a longer coaxial cable and where specifically do we do that?

Charles D. Willis, M.D.
[address omitted]

Ed.—Check your local electronics supply store for a standard coaxial cable with standard RCA plugs. If it does not carry one long enough for your use, the parts should be available to make one.


The 5-6 Seconds of Silence

Dear Editor:

When recording programs on cassettes, my auto record level cassette machine is fooled by the silent period prior to the issuance of the message. Due to the silence, the gain increases until it is wide open, and, when the signal is produced, it initially overloads the recording and the results are unusable. I have solved this problem by not engaging the cassette recorder until after 5-6 seconds of silence have passed.

A. Dan Klyver
[address omitted]

Ed.—See “Perceptions” in this issue for more on loading.