Skip to main content

Full text of "SYNTAX ZX80 Vol. 2 No. 2"

See other formats


SYNTAX ZX80 

A PUBLICATION OF THE HARVARD GROUP 


VOL. 2 NO. 2 ISSN 0273-2696 FEB., 1981 


NEWS FROM MICRO ACE 

MicroAce offices are open 
again after a 3 week holiday, and 
they're working on answering the 
letters and orders that piled up 
over Christmas. If you haven't 
been able to reach them by phone, 
try again. 

According to Andy Fisher, 
MicroAce will soon market a book 
called The ZX80 Magic Book, 
containing advanced technical 
information and some programs . It 
costs $12 and MicroAce is taking 
orders now for the strictly mail 
order sales. They expect to start 
shipping books within the next 
several weeks. 

For MicroAce owners , Fisher 
promised to send us details for 
using Sinclair's 8K ROM on your 
kits, which we will pass on to you 
as soon as we know of them. 

8K ROM, 16K RAM UPDATES 

ROM wasn't built in a day, 
and neither was RAM. Latest from 
Sinclair Research says that 8K 
ROMs will arrive in the US in late 
February. News is better for the 
RAMs — they're under production and 
in distribution in England and 
will be available here in late 
January, although European users 
have first crack at buying them. 
Sinclair is accepting orders now 
for RAMs , but not making firm 
delivery date promises . The FCC 
may require certain modifications 
to the British design. If these 
changes increase the ZX80's need 
for current, Sinclair will include 
a new power source in the original 
$99,95 price. 


NEW PRODUCT UPDATES 

No news is bad news in this 
case. Many new products reported 
in SYNTAX ’await either the 8K ROMs 
or the 16K RAMs for completion. 

But CAI Instruments will take 
orders for ZX80 peripherals now. 
CAI offers an expansion interface, 
a printer and a tape mechanism. A 
Widget board (expansion interface) 
provides serial output (110 to 
9600 baud), parallel output, and 
a tape recorder interface. Widget 
also drives the 20- column thermal 
printer. Adding the tape drive, 
your computer addresses & operates 
the tape recorder. You can call, 
update, and return a file to the 
same location. Price: printer 
and Widget — $99.95, Widget only 
--$49.95, tape drive-- $99 . 95 . You 
cannot get the printer separately. 

According to Robert Swann of 
CAI, they will accept written or 
phone orders now and guarantee a 
6-7 week delivery (UPS) on the new 
Widget. Their address: 

CAI Instruments 
2559 Arbutus Court 
Midland, MI 48640 
517/835-6145 


Sinclair's 10-page technical 
manual, reported in SYNTAX, Nov. , 
1980, has materialized as a 4-page 
manual with ZX80 schematic. It is 
a compendium of the technical 
specs and the system variable 
summary from the operating manual. 
New information includes a 
description of a direct video 
connection. Get the manual now 
free from Sinclair Research. Ltd., 
50 Staniford St., Boston, MA. 
02114, or call 617/367-2555. 


1 


SYNS OF OMISSION 

Jan, 81 — Bubble Sort (pp. 2-3) was 
written by Robert J. Schlesinger, 
Van Nuys , CA. We inadvertantly 
left his name out of the article. 

Robert Demunbrun's Basic 
Salary Scheduling program lacked a 
line: 535 LET M1=M1+311 (without 
this line, the M+30 column is 
incorrect from line 12 on) . 

Memory Window, p. 6, contains 
a typo. Line 100 should read . . . 
(16**(3-J)) 

The original concept and 
circuit for Output Port come from 
Tony Bringhurst, Lancaster, NY. 

And finally, label the large 
IC 8212 in the drawing on p. 8.. 

Dec. 80— Martin Oakes tells us of 
2 errors in Big Keyboard. First, 
IC10 has 16 pins, so pin 1 is 
directly opposite pin 16, not 14. 
Second, in the diagram showing how 
to connect keyswitches , reverse 
connections to IC10 pins 6 and 10 
so SHIFT, A, Q, 1, 0, P, NL, and 
SPACE connect to pin 6. 

Multiplication Exercise 
lacked a ; in line 40 after A$. 
Thanks to those who reported. 

NOTE TO CONTRIBUTORS: 

When you send in programs for 
possible publication in SYNTAX, 
please include the following 
information : 

*How to operate the program, 
including what to input if it does 
not contain prompts. 

^Whether you can run the 
program over again and how. 

*How to exit the program, 

*The Syntactic Sum (using 
program on page 7 . ) 

^Whether it fits in IK or 2K 
RAM (or 16K when available) , 

We pay for this explanatory 
text at the same rate as for 
articles in addition to payment 
for the program itself. 


TV, RECORDER RECOMMENDATIONS 

Many of you have written in 
to share advice about TVs and tape 
recorders that do and don't work 
well with ZX80s and MicroAces . 

Gene Hammond, Carmel, CA 
found the best display from a GE 
12XB9114W, retailing just over 
$100, and couldn't get a Sylvania 
to work at all. He also says a 
Panasonic RQ-331 recorder works 
perfectly. Bill Eder, Fort Ashby, 
WV, found among the recorders he 
tested, Sear's model 564.21570050 
($20) worked better than some 
expensive models. It has an 
external microphone input (in 
contrast with auxiliary input 
on some other inexpensive models). 

For a comparison of several 
color TV models, check Consumer 
Reports ' evaluation of 19" color 
TVs. Page 36 discusses 
nonstandard signal reception. 


OUR POLICY ON CONTRIBUTED MATERIAL 

SYNTAX ZX80 invites you to express opinions related to the ZX80 and the 
newsletter. We will print, as space allows, letters discussing items of general interest. 
Of course, we reserve the right to edit letters to a suitable length and to refuse 
publication of any material. 

We welcome program listings for all levels of expertise. Programs can be for any 
fun or useful purpose. We will test run each one before publishing it. but we will not 
debug programs; please send only workable listings. 

In return for your listing, we will pay you a token fee of $2.00 per program we 
use. This payment gives us the nonexclusive right to use that program in any form, 
world-wide. This means you can still use it, sell it, or give it away, and so can we. 

We will consider submissions of news and hardware or software reviews. Please 
keep articles short (50-100 words). Again, we reserve the right to edit accepted articles 
to a suitable length. We will pay 7 cents per 6 characters, including spaces and 
punctuation, for accepted articles. 

If you want us to return your original program listing or article, please include a 
self-addressed, stamped envelope. Otherwise, we cannot return submitted material. 


SYNTAX ZX80 is published monthly 

by Syntax, Inc., a wholly-owned subsidiary of 
The Harvard Group, RD 2, Box 457, Bolton Rood. 
Harvard, MA 01451. Telephone 617 / 456-3661. 
Subscriptions: 12 issues, $25. Single issue, $4. 

Publisher: Kirtland H. Olson 
Editor: Ann L. Zevnik 
Technical consultant: Eric K. Olson 

Printed by Joseph E. Marhefka, Jr., 

Clinton Offset Printers 
Clinton, MA 01510. 

© Syntax, Inc., 1981. All rights reserved. 
Photocopying prohibited. ISSN 0273-2696 


2 


MASTERMIND 


This is a ZX80 version of 
Mastermind, the number guessing 
game. The computer chooses a 
random secret 5 digit number. You 
enter a 5 digit guess , one digit 
at a time ('hit NL between each) . 
You get 10 points for each correct 
digit in a correct position and 1 
point for any correct digit in a 
wrong position. Deduce all 5 
digits and their correct order. 

To exit after a successful guess, 
enter Y (NL) . 

Walt Bacon, Hopewell Junction, NY 

10 DIM A (.5) 

15 DIM B(5) 

20 DIM C(5) 

25 LET T=0 
30 RANDOMISE 
35 FOR J=1 TO 5 
40 LET A(J) = (RND (10) -1) 

45 NEXT J 
50 CLS 

55 FOR J=1 TO 5 
60 LET C(J)=0 
65 NEXT J 

70 PRINT "ENTER 1ST DIGIT OF G 
UESS" 

75 INPUT B (1) 

80 PRINT "2ND DIGIT?" 

85 INPUT BC2) 

90 PRINT "3RD?" 

95 INPUT B (3) 

100 PRINT "4TH?" 

105 INPUT B (4) 

110 PRINT "5TH?" 

115 INPUT B(5) 

120 PRINT B(l) ;B(2) ;B(3) ;B(4) ;B 
(5) 

125 LET S=0 

130 FOR J=1 TO 5 

135 IF NOT A(J)=BCJ) THEN GO TO 

150 

140 LET S=S+10 

145 LET C(J)=1 

150 NEXT . J 

155 FOR J=1 TO 5 

160 FOR K=1 TO 5 

165 IF NOT A(J)=B(J) AND C(K)=0 

AND B (J)=A(K) THEN GO TO 175 

170 GO TO 190 


175 LET S=S+1 
180 LET C(K)=1 
185 GO TO 195 
190 NEXT K 
195 NEXT J 
200 LET T=T+1 

205 PRINT "SCORE IS ";S;" TRIES 
= M . t 

210 IF S=50 THEN PRINT "CONGRAT 
ULATIONS . MORE? ENTER M" 

215 IF NOT S=50 THEN PRINT "GIV 
E UP? ENTER Y OR HIT NEWLINE" 

220 INPUT D$ 

225 IF D$="" THEN GO TO 50 
230 IF D$="M" THEN GO TO 10 
235 PRINT A(l) ;A(2) ;A(3) ;A(4) ;A 
(5) 

Syntactic Sum= -6629 
SON OF BIG CHARACTERS 

John Filley of Nashville, TN, 
sent us a new Big Characters 
program, saying "Big Characters in 
the Dec. 80 issue had the serious 
limit of handling only 2 lines of 
4 characters each... a 4x display 
should be more useful." We 
agreed, and liked his approach. 

Our technical consultant, using 
John's method to read 2 rows and 2 
columns of the ROM image at once, 
produced this improved program. 

(This exchange shows SYNTAX’S 
power to help you get more from 
your machine. User interactions 
produce better software.) 

The REM statement creates a 
subset of the graphics characters 
in a special order and in known 
RAM addresses, making it easier to 
build large characters. The space 
and 15 solid graphics form all 4x 
characters . They are ordered so 
the sum of 16427 and the weights 
of blackened elements will equal 
the RAM address of the character 
code. Putting the REM statement 
first fixes the address of the 
space following REM at 16427. 

On a IK machine , this program 
prints up to 5 lines with 34 total 
characters, including internal 
spaces. With 2K or 16K RAM, it 
should print 5 8-character lines 


3 


and a 6th line with the bottom 
squares cut off, giving a 5/110 
error when you run out of room. 

To first enter the program, 
type it as shown, then RUN (NL) . 
Enter the numbers shown below, 
hitting (NL) between each. After 
you enter all 16 numbers , the 
string prompt appears. Type (NL) 
and then quickly (BREAK) to end 
the RUN. Get the listing back up. 
Delete lines 6-9. Line 2 now says 

2 REM Save this 

version on tape. 

Hit RUN (NL) , then enter up 
to 8 characters for each prompt. 

It will ignore characters over 8 
in one line. 

2 REM ABCDEFGHIJKLMNOP 

5 DIM C(7) 

6 FOR X=0 TO 15 

7 INPUT E 

8 POKE 16427+X,E 

9 NEXT X 
10 INPUT A$ 

20 FOR X=0 TO 7 
30 LET C (X) =C0DE (A$ ) 

35 IF C(X)=1 THEN GO TO 57 
40 LET A$=TL$ (A$) 

50 NEXT X 

57 LET E=X-1 

60 LET L=1 

70 FOR X=0 TO E 

80 LET Q=C(X)*8+3583+L 

85 LET R=PEEK(Q+1) 

90 LET Q=PEEK(Q) 

95 LET B=128 
97 LET B2=B/2 

110 PRINT CHR$(PEEK(16427+Q AN 
D B)/B+4*(Q AND B2) /B2+2*(R AND 
B)/B+8*(R AND B2)/B2)); 

170 LET B=B/4 

175 IF B>0 THEN GO TO 97 

250 NEXT X 

255 LET L=L+2 

257 PRINT 

260 GO TO 10-60* (L<9) 

Syntactic Sum= -32591 

Enter these 16 numbers in this 
order when you first type in the 
program, hitting (NL) after each: 

0 4 6 2 5 131 8 135 7 136 

3 133 130 134 132 128 


ADDITION THROUGH 7 DIGITS 

With 8 bit words , the ZX80 
can handle numbers up to only 5 
digits. This program enables you 
to add 7 digit numbers , so long as 
their total doesn't exceed 7 
digits. After hitting RUN (NL) , 
respond with a number up to 7 
digits . Hit (NL) and that number 
appears on the screen. Enter 
another number (NL) . The running 
total appears. Zeros show only as 
spaces. To see zeros, change line 
260 to PRINT "0”;, but thenyou 
will get 7 digit numbers with 
zeros as place holders. To change 
the number of usable digits, 
change lines 5, 7, 200, and’ 210. 

Francis LeBaron, Brockton, MA 

5 DIM X(7) 

7 DIM Y(7) 

10 INPUT A$ 

20 FOR N=1 TO 7 
30 LET X(N)=CODE(A$)-28 
35 IF X(N) <0 THEN GO TO 70 
37 IF X(N) >9 THEN STOP 
50 LET A$=TL$(A$) 

60 NEXT N 
70 LET M=N- 1 
80 FOR 1=1 TO N-l 
90 LET Y (I)=Y (I)+X(M) 

97 IF Y(I) >9 THEN GO TO 130 
100 LET M=M- 1 
110 NEXT I 
120 GO TO 200 
130 LET Y(I)=Y(I)-10 
140 LET Y(I+1)=Y(I)+1 
150 GO TO 95 
200 LET M=7 
202 LET FL=0 
210 FOR 1=1 TO 7 
212 IF FL>0 THEN GO TO 220 

214 IF Y (M) =0 THEN GO TO 260 

215 LET FL=0 
220 PRINT Y(M) ; 

230 LET M=M- 1 
240 NEXT I 

245 PRINT 
250 GO TO 10 
260 PRINT " 

270 GO TO 230 
Syntactic Sum= 28812 


4 


PHONE DIALER 

Using this circuit and 
program, you can turn your ZX80 
into a programmable phone dialer 1 
The circuit consists of three 
modules: address decoding, data 

latching, and a relay. 

In effect, the address 
decoder ANDs MREQ (memory 
request), WR (write), A12, A13 and 
A14. This results in a positive 
logic signal at pin 10 of the 
7402, which is true whenever the 
computer tries to write to any 
address in the range 3000- 3FFF. 

This signal controls a single 
bit latch Cl/4 7475) having DO as 
its data input. Thus the latch 
stores the lowest order bit of the 
last write to address 3000. So 
POKE 12288,1 causes the latch's 
output to go high; POKE 12288,0 
lowers the latch output. 

The relay is controlled by 
the latch through a high current 
driver consisting of an open- 
collector TTL inverter. It can 
sink 23 mA from the 220 A resistor 
used to turn on a RS 276-2009 
(Radio Shack catalog no.) NPN 
transistor, grounding the relay. 

We built our dialer first on 
a prototyping board, then moved it 
onto a Radio Shack 276-170 printed 
circuit experimenter's board. We 
housed it in a Radio Shack project 
case and grounded the metal lid to 
reduce interference. 

The transistor we used cannot 
be driven directly from the latch; 
it doesn't have enough current 
capability. Also, do not omit the 
diode across the relay coil since 
it clamps the spike caused by the 
coil's collapsing field. Supply 
power to the circuit board near 
the relay since it takes 100 mA. 

Connect the dialer normally 
closed in series with the tip 
(non-ground, usually red wire) 
half of the phone wire. The phone 
must be off-hook to dial. Note 
that this is a prototype dialer 
and does Tint incorporate many 


things (such as optical isolation 
or FCC approval) that a production 
dialer would. We take no 
responsibility for any damage 
caused by use of this dialer. 

The program takes the 
description and phone number of 
each name in its memory from the 
subroutines starting at 700 and 
increments by tens . Add up to 10 
subroutines ; each should contain 
LET statements assigning N$ the 
number and D$ its description, and 
end in a RETURN statement. 

To operate, type RUN (NL) . 
Screen displays a menu of names. 
Respond with a letter (NL) to 
dial. Or, type in a complete 
phone number (NL) , without 
punctuation, for the program to 
dial that number. 

As shown, the program works 
in IK with up to 10 names. When 
you have more memory, you can 
raise the ending value of the loop 
at line 100. If your phone 
company has older equipment, it 
may need larger numbers in the 
loops in lines 540, 570, and 600 
to increase the relay cycle times. 

50 POKE 12288,1 
100 FOR G=1 TO 10 
120 GO SUB 690+G*10 
130 PRINT CHR$ (G+37) ; " ";D$ 

140 NEXT G 
145 CLEAR 
150 INPUT N$ 

155 CLS 

156 LET G=CODE(N$)-37 

157 IF G<1 THEN GO TO 400 
160 GO SUB 690+G*10 

400 GO SUB 500 
430 GO TO 100 
500 LET N=CODE(N$)-28 
505 LET N$=TL$ (N$) 

510 IF N=-27 THEN RETURN 

515 IF N=0 THEN LET N=10 

520 FOR P=1 TO N 

530 POKE 12288,0 

540 FOR S=1 TO 10 

550 NEXT S 

560 POKE 12288,1 

570 FOR S=1 TO 10 

580 NEXT S 


5 



8 





INST or CIASIIC 



I 



FOUR CLASSIC COMPUTER GAMES FOR 
THE MICROACE AND 4-K. ROM ZX8Q. 



f sik^5. ‘t 



.’ft' 



/Mi'o f* 5 / : '#/• 


JV/ 


5. 

ALL ON ONE CASSETTE 
WITH GAME CHARTS AND 
GAME MANUAL INCLUDED 


FREE! 

FOR OUR 
TALOQ & 
IXSO& 

CC CODING 
8. 



J9.95 


£ 



O-LEM, BOX 2382, LA JOLLA, CA 92038 


590 NEXT P 

600 FOR S=1 TO 100 

610 NEXT S 

620 GO TO 500 

700 LET D$="UNCLE JIM" 

702 LET N$="15553423" 

704 RETURN 

710 LET D$="DIR. ASSISTANCE" 

712 LET N$="411" 

714 RETURN 

720 LET D$="EMERGENCY" 

722 LET N$="9ll" 

724 RETURN 

900 LET D$="BLANK" 

902 LET N$="" 

904 RETURN 

Syntactic Sum= -27616 

Use diagram on page 6 to construct 
your ZX80 dialer. 

SYNTACTIC SUMS 

To allow you to easily check 
programs typed into your ZX80 from 
SYNTAX, we Will print a Syntactic 
Sum™, a number unique to the exact 
program form, after each listing 
we publish. Using the following 
program, you can verify your 
typing immediately after entry. 

To make a cassette containing 
the Syntactic Sum™ program, start 
with a blank tape. (See below if 
you have more than IK memory.) 

Type Program 1 and save it on the 
tape. Allow the tape to record 
about 2 seconds of screen hiss 
after the program is saved. Now 
type NEW (NL) and type in Program 
2. Run Program 2, and input the 
numbers from the Decimal Listing, 
hitting (NL) after each. When you 
have typed in the final number, 
error 9/5 will appear. Hit any 
key to display the listing, then 
delete lines 1-5. Save lines 6-9 
on the tape just after Program 1. 

If you have more than IK RAM, 
change the number in line 6 in 
Programs 1 and 2 to the amount of 
memory you have (in bytes , where 
IK = 1024 bytes). For example, if 
you have a 2K MicroAce, change it 
to 2048. To run Syntactic Sum™ use 


16352+your RAM size as the address 
(PRINT USR(18400) (NL) for 2K) . 

To load Syntactic Sum™, 
rewind the tape and load Program 
1. Run it immediately and the 
screen will clear. Type LOAD (NL) 
when the cassette reaches the 
silent leader of Program 2. (If 
you use our cassette eavesdropper, 
just let the cassette keep going 
as you run the first program and 
type LOAD (NL) when Program 2 ' s 
leader comes up.) After loading 
Program 2, stop the recorder and 
type GO TO 6 (NL) . It is very 
important to type GO TO 6 and not 
RUN, because RUN will destroy 
array variable P. After the 
program has run, do not type NEW! 
If you do, you erase the Syntactic 
Sum™ program hidden m memory. 
Erase Program 2 by typing 6 (NL) 7 
(NL) 8 (NL) 9 (NL) , or by loading 
a program from tape. 

After Programs 1 and 2 have 
been run, enter any BASIC program. 
To find the Syntactic Sum™ of the 
BASIC program in memory, type 
PRINT USR(17376) (NL) (If you have 
more than IK, use a different 
address) . The number appearing on 
the display equals the published 
Syntactic Sum™ when both programs 
are identically typed. You can 
also write the Syntactic Sum™ of 
your own programs on the cassette 
labels to check for a good load. 

Program 1 sets aside 32 bytes 
of ZX80 RAM for Syntactic Sum™ 
(Thanks to David Ornstein of 
Sinclair Research Ltd. for this 
technique) . If you type NEW (NL) 
you will erase this memory, 
protected from your BASIC 
programs . Program 2 loads machine 
language code to calculate the 
Syntactic Sum™. If your BASIC 
program runs out of memory with 
Syntactic Sum™ loaded, then save 
the EASIC program on cassette, 
type NEW. (NL) to erase Syntactic 
Siam™, and reload the BASIC. Most 
programs will fit, but if they are 
normally cramped for space, they 
will not execute. 


7 


PROGRAM 1. 

6 LET M=1024 

7 LET M=M+16351 
10 POKE 17152,33 

20 POKE 17153, M- (M/256) 

30 POKE 17154, M/256 
40 POKE 17155,195 
50 POKE 17156,107 
60 POKE 17157,2 
70 LET X=USR(17152) 

PROGRAM 2. 

1 DIM P(31) 

2 FOR L=1 TO 31 

3 INPUT P (L) 

4 NEXT L 

5 STOP 

6 LET M=1024 

7 FOR L=M+16352 TO M+16382 

8 POKE L,P(L-M- 16351) 

9 NEXT L 

SYNTACTIC SUM —DECIMAL LISTING 


33 

40 

64 

237 

91 

8 

64 

221 

33 

0 

0 

124 

186 

32 

8 

125 

187 

32 

4 

221 

229 

225 

201 

78 

6 

0 

221 

9 

35 

24 

236 



ZX80 "THIS BOOK IS EXCELLENT!" 

-Clive Sinclair 

'30 PROGRAMS FOR THE SINCLAIR ZX-80:1K ’ is a unique 112 page 
book which contains 30 programs all designed to fit into your 
basic IK version of the Sinclair ZX-80. In programs which go 
far beyond anything that has been published the authors show 
the unique capabilities of the Sinclair ZX-80. The ZX-80 is 
more powerful than you ever thought! 

BLACKJACK - actually contains a full pack of cards, shuffles 
them, keeps track of the dealer and player card totals, and 
the money bet, all within IK. 

MEMORY LEFT - an incredible routine, especially useful as it 
enables you to know exactly how much memory is left, even 
during the running of a program. This also illustrates USR 
routines . 

DR. ZX-80 - a conversational program with the computer as 
analyst which uses an ingenious method of storage. 

GOMUKU - the computer challenges you to this complex Japanese 
game. Incredibly this program including display of the 7x7 
board, fits into IK; it only does so because it uses the 
display as memory! 

Other programs included are HORSE RACE, LUNAR LANDER, (with 
moving spaceship), NOUGHTS & CROSSES, NIM, SIMPLE SIMON, 
HANGMAN , LIFE , MASTERMIND , PINCH and 17 others. 

As well as the programs, the book illustrates programming 
techniques you can use in your own programs - space compress- 
ion, PEEKS and POKES, USRs and so on. 


AVAILABLE BY MAIL ORDER ONLY $14.95 
MELBOURNE HOUSE PUBLISHERS 

Orders to: Image Computers Products, 615 Academy Drive, 
Northbrook, Illinois 
Please add $1 for post and packing. 


SYNTACTIC SUM — ASSEMBLY LISTING 





ORG 

43E0H 



RAMBOT 

EQU 

4028H 



VARS 

EQU 

4008H 

43E0 

212840 

START 

LD 

HL , RAMBOT 

43E3 

ED5B0840 


LD 

DE, (VARS) 

43E7 

DD210000 


LD 

IX, 0000 

43EB 

1C 

REPT 

LD 

A,H 

43EC 

BA 


CP 

D 

43ED 

2008 


JR 

NZ /ADDIN 

43EF 

7D 


LD 

A,L 

43F0 

BB 


CP 

E 

43F1 

2004 


JR 

NZ , ADDIN 

43F3 

DDE 5 


PUSH 

IX 

43F5 

El 


POP 

HL 

43F6 

C9 


RET 


43F7 

4E 

ADDIN 

LD 

C , (HL) 

43F8 

0600 


LD 

B , 0 

43FA 

DD09 


ADD 

IX, BC 

43FC 

23 


INC 

HL 

43FD 

18EC 


JR 

REPT 




END 

START 


WHERE TO START 
WHERE TO END 
PUT 0 IN IX 
COMPARE HL TO DE 


; IF B < > D 


; IF L <> E 
; PUT ANSWER (IX) 

; IN HL FOR BASIC 
; RETURN TO BASIC 
;GET ANOTHER BYTE 
; ZERO THE HI BYTE 
; ADD INTO THE SUM 
; GO TO NEXT BYTE 
: AND DO IT AGAIN 


Syntax, Inc. hereby grants everyone the right to use the Syntactic Sum™ program 
to generate Syntactic Sums™ and to publish them with programs. Republication 
of this program is strictly prohibited without our written consent. 


8 


DEAR EDITOR: 


I had no problem assembling 
my 2K MicroAce kit except that I 
could not insert the cylinders 
into the plastic rivets that hold 
the case together. I used round 
wooden toothpicks instead and they 
worked great. 

John W. Walsh, Van Nuys , CA 


I had trouble loading from my 
cassette tape one day because the 
recorder was too close to the 19" 
color TV I was using a monitor. 
When I moved the recorder away 
from the TV's magnetic field, the 
loading went as normal. 

John A. Sampson, College Point, NY 


As a novice microcomputer 
enthusiast, I am unsure of the 
microcomputer community protocol. 
Several questions: Is it 
permissible to adapt published 
copyrighted programs written for 
one system to run on another? 
Second, my apartment is near a 
powerful communications tower that 
causes severe interference for my 
ZX80 RF modulator. I have found 
only one kind of TV that produces 
a steady display. Would naming 
this brand amount to an 
endorsement and hence be 
unacceptable for publishing in 
SYNTAX? Finally, I do not yet 
have a printer. Rather than 
writing out program listings, 
would you accept a cassette tape 
containing the program itself? 

Colin Alexander, San Francisco, CA 

Copyright laws concerning software 
are nebulous at best. In regular 
literary copyrights, US law states 
that only the actual expression of 
information is copyrightable; you 
cannot copyright the information 
or ideas themselves. Strictly 
interpreted, adapting existing 
programs for another system may be 


legally OK. To be on the safe 
side, ask for permission to reuse 
a published program. For further 
information, see the Oct., 1980 
issue of 80 Microcomputing,. 

We do not' object to printing 
the brand names of any product 
useful to ZX80 and MicroAce users. 
Part of our function is to provide 
you with objective reviews of 
available hardware, and TVs 
certainly fall into this category . 
Check page 2 for some reader's 
comments on TVs and recorders . 

We will accept cassette tapes 
containing programs as submissions 
until such time as we find it too 
complicated or unworkable. — AZ 


Using the instructions in the 
Dec. , 1980, issue of SYNTAX, I put 
a switch between B and C on my 
ZX80's PC board to reverse the 
video display. But the white-on- 
black display was impossible to 
read, although the black-on-white 
display was the same as always. I 
prefer the white-on-black display. 
How can I remedy this? Also, is 
the book of programs on page 3 of 
the Jan. , 1981, issue the same as 
the catalog to be sent to all ZX80 
owners , as reported on page 1 of 
the Dec. , 1980, issue? 

Bill Cothan, Winston-Salem, NC 

Check Bill Eder's advice, next 
letter. 

Second, the book advertised 
on page 3, Jan , 1981, is 
published by Melbourne House, an 
Australian publisher. Although it 
is available in the US through 
Image Computer Products , it is not 
the same as Image's catalog of its 
own products, which it distributes 
free . — -AZ 


I simplified your cassette 
eavesdropper (Dec. , 1980) by 
soldering the IK resistor to one 
leg of one of the 3.5 mm jack 
plugs, attaching one earplug wire 
•to the other leg of the plug and 


9 


COMPUTER NUMBER SYSTEMS 


the other earplug wire to the 
other end of the resistor. The 
whole assembly is small enough to 
fit right inside the plastic 
handle of the plug itself with the 
thin earplug wires coming out of 
the handle next to the regular 
connector wire. I have had no 
interference problems and the 
arrangement works great when 
loading programs into the ZX80. 

To improve Paul Byrne ' s 
interference problem, try reversing 
the video output. Turn the 
brightness control on the TV down 
until the screen is almost 
completely dark, then turn down 
the contrast. The characters are 
easier to read with no noticeable 
interference patterns . 

Bill Eder, Fort Ashby, WV 

Amateur radio operators wishing to 
share programs related to amateur 
radio can contact K2MI, Marty 
Irons, 46 Magic Circle Dr., 

Goshen, NY, 10924, 914/294-9462. 

Joe Carroll would like to 
communicate with other ZX80 ,and 
MicroAce users in the Huntsville 
and North Alabama area. Call 
205/852-6527 between 10AM and 2PM 
or between midnight and 2AM or 
write Joe at 3422 Mimosa Ln, 
Huntsville, AL, 35810. 

SYNTACTIC SUMS FOR PAST 4K ROM 
PROGRAMS IN SYNTAX ZX80 

Nov. 80: 

Cryptoquote 1796 

12 Days of Christmas — 5358 
Dec. 80: 

Big Characters — 25918 
Multiplication Exercise — 1376 

Season's Greetings 27631 

Compu- Calendar — 22279 
Jan. 81: 

Bubble Sort — 32552 
Basic Salary Sched— 28578 

Memory Window 20799 

Bytes to the Line 28932 

Computer Model 27135 


Your ZX80 or MicroAce 
computes for you in decimal 
numbers, the pumber system we all 
learned to count in. But it 
thinks in another number system, 
called binary. Instead of 10 
digits. 0-9, in the decimal 
system, binary has only 2 — 0 and 1 
(hence the name binary') . 

When you see a decimal number 
such as 24, you know it means 2 
tens (twenty) plus 4 ones (four) . . 
Another way to look at it is 2x10* 
plus 4x100. Each place represents 
a power of 10 . Binary works the 
same way, except that each place 
represents a power of 2. For 
example, 1011 means 1x23 plus 0x22 
plus 1x2 1 plus 1x2®, for a total 
of 11 in decimal. (Remember, any 
number to the zero power=l) 

Why is this useful? All 
digital computers, like the ZX80, 
work in this base 2 system. The 
ZX80 converts everything to binary 
digits (or "bits") and handles 
them in 8-bit units, called bytes. 

Each keystroke uses 1 byte of 
memory space in your computer. A 
ZX80 comes with IK memory, and some 
MicroAces with 2K. This means you 
have 1024 (2 10) bytes available in 
your ZX80, 2048 (2^) in your 
MicroAce. (Computer users round to 
IK and 2K respectively. The 16K 
RAM will really have 16384 (214) 
bytes of memory available.) 

Before you can get into the 
gut workings of your computer, you 
must understand that it works in a 
different number system than you 
do. Later we'll see how you can 
use binary numbers to decode 
addresses in memory or manipulate 
graphics (for example', Big 
Characters — see page 3 — reads the 
binary representation of each*line 
of a character's video image and 
expands it) . 

These 2 programs, by Bill 
Herron of San Diego, convdtt* 
decimal numbers to binary .and 
back. In later issues Bill and I 


lO 



will show you how to convert to 
hexidecimal (base 16) and octal 
(base 8) numbers, other number 
systems used with computers. To 
run the DEC to BI program again, 
just hit NL. To exit, hit any key 
then NL. To run the BI to DEC 
program again, change line 430 to 
RUN. To exit, hit NL then BREAK 
while the screen is blanked. 

1 REM DECIMAL TO BINARY 
100 PRINT "D="; 

110 INPUT D 
120 PRINT D 
200 PRINT "BI="; 

205 LET MSKl=-32767-l 
210 FOR Z=1 TO 16 

220 PRINT (D AND MSK1)/MSK1; 

230 LET MSK1=ABS (MSK1/2) 

240 NEXT Z 
250 PRINT 
1000 INPUT Z$ 

1020 IF Z$="" THEN GO TO 100 
Syntactic Sum= 14416 

NOTE— Range: -32768<D<32767 

02£BIsllllllllllllllll2 

100 REM BINARY TO DECIMAL 
110 DIM X(14) 

112 DIM YC14) 

114 LET A=10**4 
120 LET X(0) =2**13 
130 FOR 1=1 TO 14 
140 LET X=X(I-1) *2, 

142 LET C=X/A 

144 LET X(I)=X-C*A 

150 LET Y(I)=Y(I-1)*2+C 

160 NEXT I 

170 DIM B(27) 

200 PRINT "BI=" ; 

204 INPUT B$ 

206 LET F=0 

210 FOR 1=0 TO 27 
220 LET B=C0DE(B$) 

230 IF B=1 THEN GO TO 292 
2 34. IF B=29 THEN LET F=1 
240 IF B<30 AND B>27 AND F>0 THEN 
GO TO 270 
250 LET B$=TL$(B$) 

260' GO TO 220 
270 LET B(I)=B-28 
275 PRINT B(I) ; 

280 LET B$=TL$(B$) 


290 NEXT I 
292 LET S=I-1 

294 IF S<0 THEN GO TO 297 

295 PRINT 

296 GO TO 300 

297 LET S=0 

298 PRINT S 
300 LET U=0 
305 LET L=0 

320 FOR 1=0 TO S 
330 IF B(I)=0 THEN GO TO 380 
340 IF S-I>12 THEN GO TO 350 
342 LET X=2**(S-I) 

344 LET Y=0 

346 GO TO 360 

350 LET X=X(S-I-13) 

352 LET Y=Y (S-I-13) 

360 LET L=L+X 
362 LET C=L/A 
364 LET L=L-C*A 
370 LET U=U+Y+C 
380 NEXT I 
400 PRINT "DEC="; 

410 IF U>0 THEN GO TO 413 

411 PRINT L 

412 GO TO 430 

413 PRINT U; 

420 PRINT TL$ (STR$ (L+A) ) 

430 CLEAR 

Syntactic Sum= -3481 

NOTE— Range: 0^DEC<268435455 

02^BI<lllillllllllllllllllllllllll2 

ROM V. RAM 

Last week a beginner told me 
he couldn't run SYNTAX programs, 

I was very surprised, since I test 
every program we print myself. He 
tried to use 8K ROM programs on 
his 4K ROM. He didn't understand 
the difference between the 2 ROMs , 
or what ROMs or RAMs are. 

ROM stands for read only 
memory. Your ZX80 or MicroAce has 
a 4K ROM memory chip (see binary 
number story for discussion of 
4K) . This chip holds instructions 
designed by the manufacturer for 
the computer. You cannot alter 
the ROM--it's read only. The new 
8K ROM will contain 4K more 
instructions for the computer, so 
it will have greater capabilities. 


11 



You also have IK or 2K RAM, 
or random acces's memory, depending 
on your machine. RAM stores the 
data and instructions you type in. 
The machine needs 40 bytes to 
store system variables, but the 
rest is yours to fill with 
programs . 

INCREMENT, DECREMENT FOR- TO* S 

Using the ZX80's BASIC FOR- TO 
statement, you can only increase 
the control variable by 1. But 
you can insert a LET statement to 
either increment or decrement the 
loop index. To increase by 5 
steps, add line 20: 

10 FOR J=100 TO 200 
20 LET J=J+4 
30 PRINT J 
40 NEXT J 

In general , +1 increments by 2 , +2 
increments by 3 , and X increments 
by (X+l) . To display Y through Z, 
use Y-X and Z-X in line 10. 

To decrement, use the same 
starting and ending values in the 
FOR- TO statement: 

10 FOR J=104 TO 104 
20 LET J=J-4 
30 PRINT J 
40 NEXT J 



THE 

H\R\ARD 

GKOLP 

Bolton Road, Harvard. Mass. 01451 


O "O 
O G 
O G 
G co 

<u i c_> . 

T3 CO S to 
G <1" r— I 
o m G 
. o 

G O OO 

*1-1 o o to 
co oo in G 
i — i a) 

o G T) 
G •• O G 

•r4 G 4-> O 
W » til 

G Cti 
g g <D co 
<U G G*t4 
25 G O > 


In general , -X in line 20 
decrements the loop index by 
(X-l). You must usually stop a 
decrement , so add a line : 

35 IF J=49 THEN STOP 

making sure that 49 falls in the 
decremented progression. 

In general, use Y+X to start 
with Y and decrement by (X-l). 

D.J. O'Connell Jr, San Antonio, TX 

Another scheme to decrement loops: 

100 FOR P=0 TO 7 
110 LET B=7-P 
120 NEXT P 

Use B as decremented value. The 2 
numbers in lines 100 and 110 (in 
this case 7) must be the same. — AZ 

When your program gets dull or 
you're stuck in an endless loop 
and the break key gives you " " 
because it wants input, you can 
get out without pulling the power. 
If the required input is numeric, 
enter XX (NL) . If it is a string, 
space forward and erase the quote 
marks , then type CHR$ (XX) (NL) , 

Tip from Alfred Milgrom, 
Collingwood, Victoria, Australia