Letters

See all articles from SYNC v2 n6

Comet Crusher

Dear Editor:

Chuck Dawson’s Comet Crusher in SYNC 2:4 was interesting, but, if you have more than 1K RAM, you can add to its visual appeal. Here is a listing of the program which illustrates some of the visual effects possible (Listing 1). Using

PEEK 16396+256*PEEK
16397-16509

I came up with 1531 bytes, including line 9 and the subroutine at 350. Without these I get 1344 bytes.

I love my ZX81 with the 16K RAM and never cease to be amazed at its power. SYNC has really opened my eyes on that score. But, being a novice, I would like to see some very basic articles on machine code with the ZX81 in mind.

Keep up the good work.

George T. Milonas, Lt. Col, USAF (Ret.)
[address omitted]
Tacoma, WA

   1 REM "COMET CRUSHER" TO SAVE GOTO 500
3 LET SHOT=0
4 LET HITS=0
5 PRINT AT 0,0;
6 FOR I=0 TO 20
7 PRINT "[inv space x32]"
8 NEXT I
9 GOSUB 350
10 LET H=18
15 LET A=0
20 LET Y=37
25 LET X=0
26 PRINT AT 12,1;"[inv SHOTS: ]";SHOT;" ";AT 14,2;"[inv HITS: ]";HITS;" "
28 IF SHOT=10 THEN PRINT AT 8,1;"[inv YOU GOT ]";HITS;"[inv HITS OUT OF 10]";TAB 1;"[inv SHOTS FOR A SCORE OF ]";(HITS/SHOT)*100;" ";TAB 1;"[inv PER CENT.]"
29 IF SHOT=10 THEN STOP
30 PRINT AT 18,19;"▒";TAB 19;"▒ ";TAB 19;"▒▒"
40 PRINT AT 20,1;"[inv PRESS ]▒F▒[inv TO FIRE]"
50 PRINT AT 21,0;"▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
60 PLOT X-1,Y
70 UNPLOT X,Y
80 LET X=X+1
90 IF X>63 THEN GOTO 5
100 IF INKEY$="F" AND A=0 THEN LET SHOT=SHOT+1
105 IF INKEY$="F" THEN LET A=1
110 IF INKEY$="F" THEN PRINT AT 20,1;"[inv space x17]"
120 IF A=0 THEN GOTO 30
130 LET H=H-1
140 PRINT AT H,19;"▒";TAB 19;"▒ ";TAB 19;"▒▒";TAB 19;"▒▒";TAB 19;"▒▒"
150 IF X=40 AND H<4 AND H>0 THEN GOTO 200
160 IF H=0 THEN GOTO 5
170 IF H=17 THEN GOTO 50
180 GOTO 60
200 PRINT AT 3,17;"▒▒▒▒";TAB 17;"▒▒▒▒";TAB 16;"▒▒▒▒▒▒"
203 PRINT AT 0,18;
205 GOSUB 300
210 PRINT AT 10,3;"[inv COMET PARTICLE DESTROYED]"
215 LET HITS=HITS+1
220 FOR N=1 TO 75
230 NEXT N
240 GOTO 5
300 FOR I=0 TO 6
310 PRINT TAB 16;"[inv space x5]"
320 NEXT I
330 RETURN
350 FOR I=1 TO 8
360 LET Y=INT (RND*31)+1
370 IF Y=19 OR Y=20 THEN GOTO 360
380 LET X=INT (RND*12)+1
390 IF X=3 THEN GOTO 380
400 PRINT AT X,Y;"[inv +]"
410 NEXT I
420 RETURN
500 SAVE "COMET CRUSHE[inv R]"
510 RUN

Line notes:

General note: underlined words mean use the graphics mode to get the inverse letters.

7: inverse space (32); provides black backdrop.

9: May be omitted if short of memory.

26: Puts scoreboard on screen.

30: Graphics on E and 5.

50: Graphics on S (32).

110: inverse space (17).

140: Graphics on E and 5; inverse asterisk and space.

200: Graphics on QEBE; EQ.R; .WZ # E; provide debris after hit.

220: For a pause without jerkiness of PAUSE.

300: Erases comet and rocket.

310: 5 inverse spaces.

350-420: See line 9; may be omitted if short on memory; provides a few stars in the sky.

370, 390: Keep clear path for comet and rocket.

400: Inverse +.

DEF

Dear Editor:

Jon Passler’s article on DEF (SYNC 2:4) is very helpful, but the action can be speeded up a bit by adding as follows:

1K RAM:
102 PRINT AT 0,0;A$
105 FAST
16K RAM:
175 FAST
200 delete
300 delete
325 SLOW

For some reason my machine produced an “INTEGER OUT OF RANGE” code for line 160 in the 16K program—so I substituted.

David M. Hoke
[address omitted]
Mt. Holly, NJ

Draw It

Dear Editor:

In the Draw It program in SYNC 2:4 lines 60, 70, 80, and 90 can be deleted and the following lines put in:

60 LET X=X+(INKEY$="8")-(INKEY$="5")
70 LET Y=Y+(INKEY$="7")-(INKEY$="6")

Robert Jorgenson
[address omitted]
San Diego, CA

Strong KBD Signals

Dear Editor:

I would like to publicly thank Herb Hornung (Double H Electronics, 195 Lelani, San Antonio, TX 78242) for his hardware tip concerning strong signals from KBD 0-4 (SYNC 2:4). I had been having keyboard troubles with the kit from the time I put it together. This was one of the reasons I purchased a keyboard from Herb. At that time he made some recommendations which helped quite a bit. Examination showed that a very strong signal from KBD 0 would often “crash” the system when a key in that circuit was used. Herb’s article, personal correspondence, and the substitution of 6.8k ohm resistors for the Sinclair resistor pack straightened out all the problem I was having. I highly recommend the Double H keyboard for those who have trouble getting their fingers around the membrane keyboard.

Lawrence A. Kelly
[address omitted]
Morris Plains, NJ

List Learning

Dear Editor:

I am writing to express my thanks to James John Hollandsworth for “List Learning with the ZX81” (SYNC 2:5). The program ran beautifully and my eight year-old enjoyed it. He has already started to learn the states and their capitals, and he gets to use Dad’s computer to boot!

There were some parts of the program that I changed slightly to make it run smoother. When the program that I changed slightly to make it run smoother. When the program ws put into “Review” mode, the screen had an annoying blink that was rather distracting. The reason for the blinks was the PAUSE statements used.

The solution was to replace them with FOR/NEXT loops as follows:

210 (change the zeros to 1's)
217 IF Z<1 or Z>9 THEN GOTO 215
235 FOR R=1 TO Z*10
236 NEXT R
237 POKE P, Q

Use the line content of 235-237 to make three more loops: 250-252, 280-282, 295-297.

Again, special thanks to James Hollandsworth for this very useful learning tool.

K.R. Peters
[address omitted]
Fox Lake, IL

Ed.—The use of the PAUSE routines in “Listing Learning” indicates that the program may be used on the ZX80 (8K ROM). In our last issue we noted that programs for the ZX81 and the ZX80 (8K ROM) are virtually identical except that certain types of displays on the ZX80 (8K ROM) need the PAUSE routines as a substitute for the SLOW mode. If you have the ZX81 or the T/S 1000, you can substitute the FOR/NEXT loops, but you can also just omit the PAUSE routines.

Pantry Inventory

Dear Editor:

I thoroughly enjoyed Dr. Justham’s “Pantry Inventory” (SYNC 1:6). I have expanded upon it, and I would like to share a more efficient search routine using the LEN command. Rather than use up memory space by creating a separate array M$ in line 3044 with which to compare the “item” sought (C$), compare C$ to the original array I$ (B) directly as follows:

3040 INPUT C$
3050 FOR B=1 TO 150
3060 IF C$=I$ (B) (1 TO LEN C$) THEN GOTO 3100
3070 NEXT B

Using the same method, it is possible to expand the search routine to search records internally, i.e., looking for strings within a heading and not limited to the first characters within that heading:

FOR B$=1 TO 150
FOR J=1 TO (LEN I$ (B)-LEN C$+1)
IF C$=I$ (B) (J TO J+(LEN C$-1)) THEN GOTO 3100
NEXT J
NEXT B

If you have a larger number of records, this search may take a while, but it is very thorough. Thanks for your highly entertaining and educational magazine. I look forward to my next issue!

Jeff Hino
[address omitted]
Corvallis, OR

Lunar Lander

Dear Editor:

If you have more than 1K RAM, you can modify Chuck Dawson’s Lunar Lander (SYNC 2:1) with the lines given below which will indicate a safe landing, your pilot’s rating, and the reason for the rating.

Dick Bloom
[address omitted]
Cloudcroft, NM

  40 IF NOT H AND V<-100 THEN STOP
41 IF H THEN GOTO 11
42 IF NOT H AND V>-100 THEN PRINT "SAFE LANDING"
43 IF NOT H AND F<6000 THEN PRINT AT 20,16;"CMNDR"
44 PRINT "GOOD FUEL USE"
45 IF NOT H AND F<4000 THEN PRINT AT 20,16;"CAPT."
46 PRINT "FAIR FUEL USE"
47 IF NOT H AND F<2000 THEN PRINT AT 20,16;"PRVT"
48 PRINT "NEED TO CONSERVE FUEL"
49 IF NOT H AND F<1000 THEN PRINT AT 20,16;"RESCHOOL"
50 PRINT "TOO MUCH FUEL USED"
51 STOP

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