The magazine for Sinclair users

Math and Science: * Least Squares Analysis

Programming: * Alternative Display * Storing Words

Space Warp Graphics Game

a сша

BVM » DATS

THE SUBSCRIPTION MAGAZINE FOR THE ZX-81 MICROCOMPUTER

FOR THE ZX-80 & ZX-81 8K ROM IK - 16K GAMES-EDUCATIONAL-BUSINESS GRAPHICS-TUTORIAL-ETC.

12 Mo. Issues 6 Bi-Month CASSETTES

AT LEAST 6 PROGRAMS EACH |

$39.50

Ill. Residents add $2.07 tax outside USA add $10.00

Ask for operator #383

muc 24 HR. HOT LINE 800-543-1300

(312) 628-8955 IN OHIO - 800-582-1364

Make your “LITTLE” ZX81

work like a BIG computer with BYTE-BACK modules

INSTANT INFORMATION .| 16-K MEMORY MODULE BYTE-BACK’S MD-1

MODEM only $99.95

WIRED and TESTED $119.95

Use your phone to connect your “LITTLE” ZX81 to the "LARGEST" computer networks in the world. With BYTE-BACK's MD-1 MODEM connected all you do is dial a phone number (usually local), press a few keys and watch the data appear on your TV screen. (Software is included)

This MODEM can be used in either the "originate" or "answer" mode with selectable baud rate.

You can have immediate access to:

DOW JONES UPI And Much More! RS-232 PORT INCLUDED As an extra bonus ап RS-232 port is provided to allow you to drive all standard RS-232 periph- erials.(75 to 9600 Baud)

64-K MEMORY MODULE

It has a Metal Case

NEW in stock!

$139.77

WIRED and TESTED $154.95

It has a Metal Case

only

$69.95

WIRED апа TESTED $79.95

in stock!

But unlike other 16-K memory modules, up to three BYTE-BACK M-16 memory modules can be connected at one time to get a total of 48K.

(It can be used with the SINCLAIR memory module.) BYTE-BACK'S BB-1

CONTROL MODULE $59 00 In Stock!

= KIT WIRED and TESTED $69.

e 8 Independent Relays

(with LED status indicators)

e 8 Independent TTL Inputs (with Schmitt trigger buffers)

e By using a single POKE command you can change and latch the status of each of the 8 relays.

e Your ZX80/1 can read the status of all 8 inputs by the use of a single PEEK command.

e A comprehensive manual is included that has complete appli- cation details.

The new M-64, together with the ZX-81, gives a full 64K of system memory (ROM * RAM) with the same high reliability of our proven 16-K module.

ALL MODULES CARRY 90-DAY WARRANTY Remember with:BYTE BACK modules you are NOT limited to using only one module at a time!

C Mail To: BYTE-BACK CO. * Rt. 3, Box 147 е Brodie Rd. Leesville, S.C. 29070

п | O MOI Kit MERIT TT $139.95 O M-16 КЕ с.га 4. .нз виз жакан ка ке» $69.95 ш © | О M-64 Wired and Tested............. $154.95 O M-16 Wired and Tested.............. $79.95 GOSS | OM-64 Blank РС Воага............... $19.95 [O M-16 Blank PC Воага............... $19.95 О@(;Ф | овв-і кігапа Мапиа!.................. $59 O Modem Кйй........................ 599.95 OTe ©) | ОВВ-І Wired and Tested and Manual...... $69 O Modem Wired and Tested ........... $119.95 & - "PE S | О ВВ-1 Blank PC Board and Manual....... $29 Shipping and Handling $4.95 ше ao ES 2 | ORDER PHONE (803) 532-5812 Bill My C1 Visa О Mastercharge “уурусу aa ui & | Exp.Date. —— . Card No. i -d | Name f , с | Address MasterCard | City/State/Zip |

We carr

all the parts and the

| | > you rinted Circuit Board.

INTEGRATED CIRCUITS VOLTAGE REGULATORS

POSITIVE NEGATIVE

7805 +5V 7905 -5V 7812 +12 7912 -12 7815 +15 7915 -15 7824 +24 1.25 €a.

HEAT SINK 25¢

LM323K 5VOLT 3AMP 3.95

HEAT SINK 75¢

LLL

+ + © © © o

+ «+ © © o £7 5 . «+ о © э o

MEMORY 2114 1KX4 STATIC 4.00 8/28.00 4118 1KX8 STATIC 8.25 8/58.00 6116 2KX8 STATIC 14.95 8/125.00 4116 16K X1 DYNAM 3.50 8/24.00 2716 2KX8 EPROM 12.00 8/84.00 2732 4KX8 EPROM 19.95 8/135 00]

TTL

PARTIAL. LISTING

7400..... .24 74LS00..... 25 7403..... .24 74L.503..... 125 7409..... .28 74LS09..... «30 7490..... .35 74LS90..... -45 74148... .75 7415138... .70 74154..1.25 74LS154.. 1.75

74190....75 7415190... .85 7415244 1.00 74LS245..

CMOS

PARTIAL LISTING

74CO00..... .40 4001.... .30 74C02..... .40 4011.... .30 74C30..... .40 4016.... . 60 74C90.... 1.35 4020... 1.20 74C154.. 4.25 4071.... .30 74C240.. 2.35 4511... 1.15 74C244.. 2.35 4553... 3.95

LINEAR

MC3401 QUAD OP-AMP .... .50 MC1555 ТІМЕВ.................. .45

BI-FET ОР-А МР5 LOW NOISE

SINGLE Т1 081... .75 DUAL. TLO82. 1.25 QUAD TLOB84.. 2.25

TLOZ71... .90 TLO72.. 1.50 TLO74.. 2.50

WIRE WRAP WIRE

KYNAR #30 WIRE WRAP WIRE

PRECUT TO LENGTH THEN 1" STRIPPED FROM EACH END.

WE GOT IT IN RED, YELLOW, BLUE,BLACK,WHITE & GREEN

LENGTH 100/BAG 1000/BAG 3.0" 1.45 7.50 32.9'' 1.58 8.25 4.0'' 1.65 9.00 4.5'' 1.75 9.75 5.0" 1.85 10.25

ADD'L 0.5' UP TO А TOTAL

OF 10.0" .10 725

#30 BY THE SPOOL 100° ...3.95 500° ..11.95 1000° ...19.95

CLIP AND STRIP

, CUT AND STRIP#30 " WIRE IN ONE OPERA-

TION.TAKES A LOT OF THE WORK OUT OF WIRE WRAPPING,

CAS1 3 OU oor e occ S

HOBBY WRAP TOOL AUTO-INDEX : ANTI-OVERWRAP MODIFIED WRAP

TOOL WITH BIT BYV26308B. .... .27.95

WRAPS AND UNWRAPS BUILT-IN#30 WIRE STRIPPER

WSU30... REGULAR WSU30M MODIFIED

Check Mastercharge. Add $3.00 for ing and handling, Texas nts add 5% state sales tax. Foreign orders add $10,00 for shipping; U.S. funds only. Limite

i reside

WANT TO FIX YOUR SINCLAIR? ADD MORE MEMOR Y? ADD A BUSS? WE GOT YOUR PARTS.

need to repair your Sinclair with the Ене of the Sinclair Logic Unit, the ROM, In addition we carry OK, WELLER. and і ( /

cases and VECTOR breadboarding and prototyping supplies. We stock resistors, capacitors, integrated circuits, descrete solid state devices, switches, sockets, connectors etc. etc. Below is a very small sampling of our products.

If you see what you need give us a call, if you don’t write for our free catalog.

FULL-SIZE KEYBOARD

INCREASE YOUR COMPUTING TIME BY DECREASING TYPING TIME

ADD A FULL-SIZE KEYBOARD TO YOUR ZX-80/81 OR MICROACE. YOUR FINGERS WILL LOVE YOU FOR IT.

OUR KEYBOARD HAS 62 KEYS SO YOU CAN ADD LOTS OF EXTRA FUNCTIONS. WE WILL EVEN SEND YOU PLANS ON HOW TO ADD SUCH USEFUL THINGS AS AUTOMATIC SHIFT ON CERTAIN FUNCTIONS, AUTOMATIC REPEAT AND RESET. EACH KEY HAS GOLD CONTACTS AND IS FIRMLY MOUNTED TO A BLACK METAL PLATE ‘WHICH MEASURES 15-1/2" BY 4" AND DOUBLES AS AN ATTRACTIVE FACE PLATE.

BEST OF ALL YOU CAN GET YOURS IN KIT FORM, COMPLETE WITH INSTRUCTIONS, OR WIRED AND READY TO GO. EITHER WAY WE WILL INCLUDE THE EXSPANSION PLANS.

KEYBOARD KIT. 34.95 WIRED & TESTED..49.95

YOUR ULTIMATE POWER SUPPLY

WHY WASTE TIME BUILDING NEW POWER SUPPLIES WHEN YOU WANT TO EXPAND? BUY AN ULTIMATE SUPPLY AND SPEND

ALL YOUR TIME ON PROJECTS NOT P.S.

MULTIVOLTAGE FOR DYNAMIC RAMS ETC. INPUT 120 - 220 VAC OUTPUTS +5VDC--5AMP

*12VDC 1AMP —12VDC-1AMP 12VAC--1/2 A.

SINGLE VOLTAGE FOR CMOS & TTL LOVERS I N PU T—------- 120 - 220 VAC OUTPUT--— +5VDC---9AMP DIM.——9-*t/2X 5X 5 MOD CPS-169 ALSO AVAILABLE 120 IN 5VDC-3AMP MOD SPS 30-5...24:95 120 IN 5.8VDC--1.2AMP MOD SPS 1-5

money order, VISA, or

quanities on some items.

CELITE tools, HAMM

EASY ONE HAND OPERATION ALL METAL CONSTRUCTION REPLACEABLE TEFLON TIP REGULATED SUCTION

VACUUM BASED LIGHT DUTY VISE 1-1/2" WIDE JAWS 1-1/4'" TRAVEL

LA E T E

ALTEX ELECTRONICS

618 W. Sunset San Antonio, Texas 78216

1—-512—828—0503

ND, and PAC-TEC

SINCLAIR R. F. CONNECTOR | MODULATOR

GOLD CONTACTS WIRE WRAP OR SOLDER TAIL $7.50

USA VHF 5.95

DATA CASSETTES 5175 10 for *159?

Made for Datapoint by Maxell 90 min. with case

5 screw high strength shell

JOYSTICK

4 - 10K Linear pots 1- V2" metal handle 2- V8 square

$5.95

IC SOCKETS

*PIN SOL WW

SOLDER

KESTER 60/40 Rosin core. .020 dia. 1 Pound Roll

SOLDERING IRONS

WELLER WP25 120V 25W 17.03 WP40 120V 40W 20.93

PENCIL THIN IRON (NOT SHOWN)

WM120 120V 12W 19.47

SOLDERING TOOL STAND

STAND WITH SPONGE, $ BASE & RECEPTACLE.

FITS WP-25 WP-40 W-60 MOD PH-60

FITS WM-120 MOD PHM-120

INSERTION / EXTRACTION TOOLS

INS1416 INSERT TOOL 4.35 MOS SAFE INSERT TOOLS

MOS1 416 14-16 PIN.....9.95 MOS2428 28-28 PIN..... 9.95 MOS40 36-40 PIN....10.95

EXTRACTION TOOLS EX1 ` 14-16 PIN.....1.49 EX2 24-40 PIN. ...9.95

WK7 COMPLETE KIT ...37.95

The magazine for Sinclair users

Ei іг

May/June 1982

Volume 2, Number 3

DEPARTMENTS 4 LOISIR. ooo d RRERENRERA PUR FI URGERE CE Va енын эке 8 SYNC Мойөз................................. Grosjean 20 Try TRIS. usa kar he ERa etx RREA Y m Sad Seeler, Bush 20 Glitchoidz Верок..................................... 14 Perceptions. ................................. Ornstein

The ZX81 Parser and User-Defined Commands 12 dust for Fun... ool

42 Ңө$оОигСӨ$........................................... 48 Index to Аауег\ї$ег$..................................

HARDWARE AND THE KEYBOARD

23 Two-Switch Human Interface for the Communicative Impaired. ............... Dorcey Using the ZX80/81 to communicate

28 Keyboard/System Conversion: The First 40/1 Кеуѕ.......................... Trelease Add a keyboard to your ZX80/81

PROGRAMMING TECHNIQUES AND FUNCTIONS

1 6 An Introduction to Expression Evaluation........Logan How your 8K ROM handles expressions

38 An Alternative Display —Tank Battle. ............ Nisbet Developing displays; game

46 Storing 3-Letter Words in an Array............ Manders Memory squeezing; game

48 Character Веуегѕе. .......................... Егеетап Моге on strings

MATH AND SCIENCE 32 Least Squares Data Analysis with the ZX80/81..... Salt Finding the straight line GAMES 44 Space Магр...................................... Fox Command decisions for the touch down REVIEWS 43 ZX Саіахіапѕ............................. Wren-Hilton

Software review

—————— P ЕГА I OEE d

Staff Рири$һег...................................... ааз David Н. Ahl Managing Editor... 506s <:iccrssasdecetrisrinrenvens Paul Grosjean Contributing Edilior. ...... 0.066655 ордоо wee ha David Ornstein U.K. Соггезропдеп{. ........................... Martin Wren-Hilton Secretary... b ut 6a 5 cmrteuPbdnremcqed o d dba engl Elizabeth Magin Art Рїтесїог......................... 2...2... Susan Gendzwil Assistant Art Director..........................-.Diana Negri Rudio Tunes еге. iuo ssoceway Eg t RRDURAM RAATCDE: pE Кшз Karen Brown

Renea Cole

Financial Coordinator. ....... ooo rns William L. Baumann

Personnel and Еіпапсе............................ Patricia Kennelly

ChreulaBtiON, «cose binds sveaanedne sua RR RA Francis Miskovich

Carol Vita

Advertising Sales Managét.........2o eR RR Jim Beloff MEMBER

Volume 2, Number 3

SYNC (USPS: 585-490: ISSN: 0279-5701) is published bi-monthly for $16 per year by Creative Computing, 39 E. Hanover Ave., Morris Plains, NJ 07950.

Second class postage paid at New York, NY 10001, and at additional mailing offices.

Subscription rates: USA: 6 issues, $16; 12 issues, $30: 18 issues, $42. Canada: $3 per year additional. Other foreign: $5 per year additional. U.K. air: 6 issues, £13. Minimum charge card order: $10.

For SYNC advertising information, contact Jim Beloff, SYNC Advertis- ing Sales Manager, Ziff-Davis Publishing Company, One Park Ave., New York, NY 10016 (phone 212/725-4216).

All other correspondence should be addressed to: SYNC, 39 E. Hanover Ave., Morris Plains, NJ 07950. In U.K., SYNC, 27 Andrew Close, Stoke Golding, Nuneaton CV136EL.

Postmaster: Send address changes to SYNC, PO Box 789-M, Morristown, NJ 07960.

a Creative competing PUBLICATION

Шагы _

Help Wanted

Dear Editor:

I have a special request. I would like to have some information on producers and shops which sell ZX81 music programs, like one which changes the ZXS81 into an electric organ or a synthesizer. I own a ZX81 and I am very interested in making and playing music on it. Also I am inter- ested in a good accounting system for a small business.

Arnar Matthiasson Samvinnuskolinn Bifrost

311 Borgarnes Iceland

Dear Editor:

I recently acquired my ZX81 (16K) with little knowledge of programming under my belt. I received my first issue of SYNC (2:1), and I was excited at the prospect of using machine language. Then I encoun- tered two problems:

1) I would be interested in knowing how to modify the "Flattop Lander" code for my machine. The system variables appear to be different, and I have no source equivalents.

2) I twice, no thrice, entered the "Life" program with no success. The initial border routine worked, but after I entered some numbers/cells the system would crash when I input 0 to continue. Are there any bugs? I even entered it once using Mr. Ornstein’s Window program (a long process I can assure you).

Any help you could give me would be appreciated. I enjoy your magazine, though I wish that it were monthly. Also, which back issues are still available?

Keith Liggeti 21111 Strathmoor Lane Huntington Beach, CA 92646

Ed. The "Life" program did have some problems as some readers have called to our attention. The author has supplied the revisions which are included in our Glitchoidz Report. A few back issues of SYNC 1:2 are available at $2.50 each.

Payment should accompanv the order.

4

Dear Editor:

Enclosed is a list of several errors that I found in The Gateway Guide to the ZX81 and ZX8&0. | am sure that most readers would spot the errors quickly, but beginners may not. I feel that the book is well worth the money, as is The ZX81 Companion (but I wish more about the intricate working of the ROM had been included).

Now a question. Is there any way to write a machine language routine to read TRS-80 500 BAUD tapes? I sent for a kit to do so, but it is really designed for an S- 100 Bus operating with a Z80 CPU. How about an article in SYNC on this? How about more articles on machine routines to extend the 8K Basic like the READ routine in Edward Kennedy's article ($ УУС 1:5). How about MERGE? How about a routine to set a single pixel?

I liked very much David Ornstein's article on the 4K ROM SAVE command. I hope that he does as threatened and writes an article on a full fledged cassette based I/O processing system, especially if he includes details on wiring the cassette to forward or reverse under CPU control.

I have also sent for a light pen (designed for the TRS-80) that I would like to hook up to my 8K ROM ZX80. Any suggestions? How about some articles on adding output ports to make the ZX80 compatible with TRS-80 peripherals?

Timothy MclIlwee Flagler Palm Coast High PO Box 488

Bunnell, FL 32010

Ed. The corrections have been passed on to our Book Division. Again our readers have set out a number of challenges. We look forward to your responses.

Program Problems

Dear Editor:

I am the owner of a ZX80 and a ZX81. I have been trying some of the examples in your magazine and have been having problems. E.g., In Robot Composer (1:5) I cannot enter line 150; in Defuse (1:5), lines 10, 20, 30, 40; in Graphic Surprises

(1:3), lines 130, 200, 1010; Variable Con- versions (1:3), line 30; The TLS Function (1:4), line 50 LET P$—TLS(AS) (syntax error); Mini-Billboard, line 21 LET AS-—' TLS(AS). Please tell me how I can do these.

Edward A. Parker 582 East Sunset Dr. Altadena, CA 91001

Ed. —First and foremost be sure that you are entering your program on the correct ROM. All the programs in issues 1:1, 1:2, 1:3, and 1:4 are for the 4K ROM and cannot be entered on the 8K ROM without translation. In issues from 1:5 on programs for both ROMs are included, and the machine requirements for the programs are given at the top of the page. Most of the lines referred to above seem to involve the random feature. On the 4K ROM RANDOMISE is on the J key and RND(x) must be spelled out; on the SK ROM INT and RND are functions and must be entered directly from the keyboard in one key- stroke. In the line PS—TLS(PS$), ignore the syntax error and finish typing in the line. It serves to remind vou that something must be completed, e.g., the second parenthesis or quotation marks. For the SK ROM the line must be rewritten as LET P$=P$(2 TO #).

ZX80 Slow Mode

Dear Editor:

Is there any way that I can get my ZX80 with the 8K ROM to run in the SLOW mode? :

Anthony Larry 228 Main St. West Haven, CT 06516

Ed. —At present the only method we have heard of is the MicroAce Video Upgrade Kit (see a review of this kit in SYNC 2:1, p. 27) However, MicroAce has closed down its U.S. operation, and we have received no information whether a U.S. distributor for the kit has been arranged. MicroAce can be reached at: MicroAce Compshop. 14 Station Road, New Barnet, Hertfordshire ENS IQW, United Kingdom.

SYNC Magazine

Software Publishers —Analyze the NEED!

The TIMEX and SINCLAIR ZX systems are cassette-based. Everything depends on delivering software product the user can LOAD very readily, with- out difficulty. In publishing software for these machines, reputation and repeat orders depend on good programming AND ready-loading product.

Software Publishers —Qualify the SOURCE!

COOK LABS is the product source that DOES (1981). Users don't have problems with T.I. duplicate digitally not audio-analog. cassette software. They needn't with yours.

COOK LABS has been making digital cassettes SINCE 1952 Emorv Cook's name has been

for serious software publishers for many years. mne y 3 wid Ладе 1

Why? internationally associated with leadership in | | EM electronics design.

COOK LABS is the only duplicating source

with Texas Instruments CERTIFICATE of COOK LABS operates under his engineering

AWARD for EXCELLENCE of QUALITY control and supervision.

Wil] ор

(two of every Kioa The Noah's Д5

that wits

SOFTWARE PUBLISHERS PHONE, WRITE, USE COUPON... GET INFORMATION NOW!

COOK LABORATORIES, INC. NAME _——— Р.О. Вох 529 Norwalk, CT 06856 (Phone 203-853-3641) COMPANY. [] Inform me about COOK services for: [] Software duplication. ADDRESS

[] Procurement of labels, inserts, etc. [] Fulfillment, including fulfillment of individual orders. ee E ион а Ene АКЫ"

[] Send free booklet: Cassettes An Effective Software Medium." PHONE (OPTIONAL)

When your computer wont speak your language, you need a basic handbook.

As a matter of fact, everyone who works in BASIC needs The BASIC Handbook. It is the definitive reference work on the subject of BASIC.

The BASIC Handbook is an easy-to- use encyclopedia of nearly 500 words covering the “dialects” used by virtu- ally every BASIC-speaking computer in the world. But more than that, it's a simple, step-by-step guide to translat-

ing programs from one computer to another. So now you can actu- ally use software printed in

M /!

magazines and elsewhere, no matter what computer you own. Written by Dr. David А. Lien, author of the Tandy TRS-80 Level I User's Manual and the Learner's Manuais for the Epson e MX printers, this completely revised ————— Second Edition contains almost twice

as many entries as the best selling

First Edition, making it

by far the most up-to-

date BASIC reference ati OO book you can buy.

Extensively indexed and cross-referenced, The BASIC Hana- book gives you 480 pages packed with the information you need to be a better programmer. And if, after 30 days you don't agree it's indispensable, send it back. We'll return your money.

INN The BASIC Handbook is available in several à languages and accepted throughout the world. No one who programs in BASIC should be without it.

Available at better computer and

E oo. book stores, s or call (800) 854 -6505 In California (714) 588 -0996 To order by mail, send check or money order for $19.95 (California residents add 6%), plus $1.65 shipping and handling. Overseas orders send $19.95 plus $2.38 surface shipping and handling.

®

MasterCard

1050-E Pioneer Way, Dept. E, El Cajon, CA 92020

L—

The Hidden Chessmen

Dear Editor: | have received several requests to

convert The Hidden Chessmen (SYNC 1:6) to use on a ZX81. Presently, I have an 8K ROM in my ZX80 and a 16K RAM pack. The following changes were needed to get the program running:

1 LET B=1+INT(8*RND)

2 LET C=1+INT(8*RND)

3 LET K=1+INT(8*RND)

4 LET L=1+INT(8*RND)

6 LET R=1+INT(8*RND)

7 LET S=1+INT(8*RND)

44 LET X=INT(Q/10)

50 LET Q—PEEK 16396+ 256* PEEK 16397+2*Х-1+66*(Ү-1)

62 IF... THEN POKE(Q+33),48

64 IF ... THEN POKE(Q+34),55

The program takes more than 1K RAM,

but I think it will fit in 2K.

Roger Haar 19372 Holts Rd. Martin, OH 43445

Ed. Our thanks to Roger Haar for these changes to make the program available

to our 8K ROM readers. a”

OTHELLO FOR 1K

GRAPHICS, HIGH-SKILL PLAYING ALGORITHM $7.50 (U.S.) $10.00 (NON-U.S.) INTELLECTUAL GAMES 193 PEACEABLE ST. RIDGEFIELD, CT 06877

WORD POOL

The ultimate spelling program for the 2Х80/81 For use in the home or school Program featuresa current list and a wordpool built up from previous lists Uses a corrective routine with graphics Does not simply identify right or wrong answers Menu options include the fol- lowing 1 Display/Change Current List (Password)

2 Display Wordpool 3 Display Change Time Limit (Password)

4 Run Test— Current List

5 Run Test— Wordpool

6 Delete Wordpool | (Password) 7 Identify Student

8 Error Recall (Password) 9 Autosave

Suitable for all children in grades 1 thru

8 Tested and found especially useful to dyslexics and those with writing difficul- ties

Versions for the 2Х80. ZX80-8K ROM or

ZX81 all with 16K memory Please state version required Send $15 for tape. notes and shipping and handling (£7 OO Inc p & p intheU K ) Fullrange of educational software available SA E for details CROWN COMPUTERS (U.K.)

9 HOLME CLOSE WOODBOROUGH NOTTINGHAM МС 14•6ЕХ ENGLAND.

mi >< G

lore the excellence of your ZX81 with a

[ПЕГ1ОРВП 64H memory extension for $179.95

Give your diminishing memory more byte.

MEMOPAK 64K RAM $179.95 The Sinclair ZX81 has revolutionized home computing. The MEMOPAK 64K RAM extends the memory of ZX81 by a further 56K to a full 64K. It is neither switched nor paged and is Directly Addressable. The unit is user trans- parent and accepts such basic com- mands as 10 DIM A (9000). It plugs directly into the back of ZX81 and does not inhibit the use of the printer or other add-on units. There is no need for an additional power supply or leads.

Description of memory 0-8K ... Sinclair ROM 8-16K . . . This section of memory switches in or out in 4K blocks to leave space for memory mapping, holds its contents during cassette loads, allows communication between programs, and can be used to run assembly language routines. 16-32K ... This area can be used for basic programs and assembly language routines. 32-64K . . . 32K of RAM memory for basic variables and large arrays. With the MEMOPAK 64K extension the ZX81 is transformed into a powerful com- puter, suitable for business, leisure and educationai use, at a fraction of the cost of comparable systems.

Memory Extention Specialists

Memotech Corporation 7550 West Yale Ave., Suite 220 Denver, Colorado 80227

Ph.(303) 986 -0016

MEMOPAK 16K RAM $79.95 With the addition of MEMOPAK 16K, your ZX81 will have a full 16K of Di- rectly Addressable RAM. It is neither switched nor paged and enables you to execute longer and more sophisticated programs and to hold an extended data base.

The 16K and 64K Memopaks come in attractive, custom-designed and engi- neered cases which fit snugly on to the back of the ZX81 giving a firm connec- tion.

Free service on your MEMOPAK Within the first six months, should any- thing go wrong with your MEMOPAK, return it to us and we will repair or replace it free of charge.

———— Intemotech Corp. 7550 W. Yale Ave. Suite 220 Denver, Colo. 802

Try MEMOPAK with no obligation You can use our MEMOPAK in your home without obligation. After 10 days if you are not completely satisfied, simply return it for a full refund.

Coming soon ..... A complete range of ZX81 plug-in peripherals:

MEMOTECH Hi-Res Graphics MEMOTECH Digitising Tablets RS232 Interface

Centronic Interface and Software Drivers

All these products are designed to fit "piggy-back" fashion on to each other and use the ZX81 power supply.

Further information forthcoming.

Suite 220 Denver, Colo. 8 7l

| Yes! | would like to try the Memopak. | understand that if I’m not complete satisfied,

| can return it in 10 days for a full refund.

| [] Check | [] Visa [] MC

| Name

| Street

| City

Memopak 64k RAM $ 179.95

Memopak 16k RAM

Shipping and Handling |$ 4.95 | |s 495 | |ae.mo[ 1

Price t Qty. Amount

зз» [|

+ U.S. Dollars

sync rings.

Paul Grosjean

Timex Sinclair 1000

The Timex Computer Corporation will enter the personal computer market with the Timex Sinclair 1000. Sales will begin in July through the more than 100,000 Timex retail outlets, including computer stores, department stores and chains, consumer electronics, jewelry, and drug stores. This step is the result of an agree- ment between Timex and Sinclair Research Ltd. for Timex to market computers using Sinclair technical expertise. Sinclair's mail order sales of the ZX81 will be phased out as Timex begins its marketing program. The announcement of the Timex entry into this new field and of the agreement with Sinclair was made by Daniel D. Ross, Vice President of Timex Computer Cor- poration, an affiliate of Timex Corporation, in New York on April 20.

The Timex Sinclair 1000 is basically the Sinclair ZX81, which Timex has already been manufacturing in Dundee, Scotland, but with two major differences. First, the new machine will have 2K RAM instead of the current 1K on the ZX81. Second, the new machine will sell for a suggested retail price of $99.95 instead of the $149.95 for the ZX81. Also featured will be an instruction manual especially written for the first time computer user with step by step instruction and a course in funda- mental programming.

Peripherals for the Timex Sinclair 1000 will also be sold by Timex along with the basic machine. The first one available is the 16K RAM expansion module for $49.95 (Sinclair's current 16K RAM is $99.95). In the fourth quarter of 1982 a printer and a telephone modem are expected to go on sale for $99.95 each. The modem will offer a significant enhancement for many users and will feature: 300 BAUD, standard Bell Telephone jack attachments, and auto-dial capability. It will give a direct tie-in with large computer data services.

Timex plans to supplement the hardware offerings with a range of software, including business, personal financial management, education, and entertainment. The price range of the programs is expected to be from $9.95 to $19.95.

The marketing program will aim at the first-time computer buyer, the educational market, and computer buffs. The potential market for personal computers is estimated at over 90,000,000 customers. In addition

8

to instructional displays in the retail outlets, Timex plans to support the retailers with an extensive service network, a 90-day guarantee, and a national ad campaign beginning in August.

SYNC Coverage

SYNC will expand its coverage of the Sinclair type computers by adding the Timex Sinclair 1000 to the list. We will continue to help you get more out of your computer by providing instruction, enter- tainment and product information.

Do You Want to...

Advertise in SYNC?

Contact Jim Beloff, SYNC Advertising Sales Manager, Ziff-Davis Publishing Co., One Park Ave.. New York. NY 10016; phone: (212) 725-4216. Jim now handles all aspects of advertising in SYNC. He will be glad not only to supply you with all information about ad rates, specifica- tions time schedules, and copy submission but also to answer any questions you may have about "getting in SYNC."

Be listed in the Resources Column?

Send a brief announcement of your new product or service or users group similar to the ones you have already seen in the Resources Column to "SYNC Resources." There is no charge for a one time listing. Repeat listings may be made at our classified rate which goes by the inch. Be sure to include the name of your product, brief details about it, and exact details on how readers may order.

Send to: SYNC Magazine. 39 E. Hanover Ave., Morris Plains. NJ 07950.

Write for SYNC?

In our Jan/Feb 1982 issue we ran an article "Writing for SYNC." If you want to submit an article to SYNC and did not get this issue, send a self-addressed stamped envelope to the managing editor for a copy of the article.

If you are planning a rather lengthy article, it would be best to check whether we would be interested in the topic before you put the work into writing it up. Just drop a note with a brief outline or summary

of what you have in mind to the managing editor. It is not unusual for us to receive several articles or programs on similar topics within a matter of a few weeks of each other.

Again we want to emphasize that manu- scripts must be typed and double spaced. If you are submitting a printout of your article. please set vour printer on double space. Program listings. however. should be single spaced and should show the lines just as thev are on the computer screen. А camera ready program listing adds significantly to your article. When printers are available. printouts will be preferred. Long programs should also be submitted on tape.

If you are submitting a program which Is not a direct printout from your ZX80/81 computer, please enter your program from your listing before you send it to us.

Send to: SYNC Magazine, 39 E. Hanover Ave., Morris Plains. NJ 07950.

Order products from our advertisers?

1) Allow sufficient time for an order to be processed. shipped. and delivered. Understandably ZX80/81 users are eager to get their orders. but patience must be urged. Two to three weeks is simply not enough turnaround time in most cases. especially if the supplier waits for a check to clear.

2) If you want to order internationally. you can pay in the following ways: a) a personal check (remember that a bank only accepts a check for collection; when you get your money immediately the bank is really giving you the money from your own account and will deduct that amount if the check bounces; the check must clear before it is actually credited; so your supplier may wait to process your order until the check clears); b) a bank draft (such as when you make a withdrawal from а savings account); c) a "foreign draft" in the money of the country you are ordering from (the charge in our area is about $10); d) an international money order (in dollars) purchased at your bank

SYNC Magazine

usually for a flat fee (in our area about 51.25 regardless of the amount); e) an international money order purchased at the Post Office (the rates vary according to the amount of the money order and the country to which it goes; for England the cost is $1.30 for up to $25 and $1.50 for $25-50).

3) Remember that banks charge the depositor for handling a foreign check: in our area the charge can be up to $3; the same holds for foreign banks handling U.S. checks. Needless to say. such a charge can eat up a sellers profit on a small order. Some will include it in either a handling charge or higher prices)

4) A check with local customs reveals that in general there is no duty on software but that there might be on hardware. To be on the safe side. check with your local customs office before ordering. especially if the cost or quantity of items is substantial. If there is a customs assessment. the Post Office will notify you that you have a package with the amount due which includes a charge of about $2 by the Post Office for handling the transaction.

64K

Screen Display Area

48K

More I/O and Memory Blocks

Software Switches

I/O Space

QUICKSILVA Hi-res memory

User RAM

16K

Graphics and

Extended Basic

encarta D.O.S. and

8K Network

Basic OK

May/June 1982

Ask technical questions about your ZX80/81?

Write a letter to the editor stating your problem or question. We will refer the letter to some of our authors who have agreed to answer questions. (Please do not call SYNC because the people who can answer the questions are not at our offices.) We will print the question and answer whenever possible. The chances are good that you are not the only one who has the question.

Form a users group or publicize one? Send details to our Resources Column.

Developing a

Memory Map Consensus

Nick Lambert of Quicksilva has proposed that suppliers for the Sinclair computers reach a consensus on some kind of memory map to avoid "a whole heap of problems" to everyone's benefit. He has proposed the following ZX Computer Memory Map on a provisional basis for discussion. The comments of suppliers are welcome and should be sent to Nick Lambert. Quicksilva. 95 Upper Brown Hill Road. Maybush. Southampton. Hampshire. U.K. "n

ZX Computer Memory Map

User RAM (Screen routine only)

Read/write only memory

User RAM

Most people are. or will be. using a 16K RAM pack of some kind so really this block should be left completely for this purpose. No ROM or I/O from this

block.

ROMs (for add-on boards)

The user RAM appears in this block where the screen display routines and hardware use it to output the display. D-FILE can appear anywhere in this block so it really cannot be used for any other purpose.

Due to the internal hardware of the computer no opcode fetches can be made from this block. So you cannot run any machine code from here. You can read and write to memory though so it is fine for data storage. Also it seems to be the best place to do Input/Output from. Unless there is an extremely good reason not to. Quicksilva intend to put the 6K of memory needed for our Hi-res board starting at 32K. This will enable us to make the Hi-res software run significantly faster. Other areas within this block are open to debate.

SYNC Program Listings

Readers should note the following conventions used in the program listings in this issue:

Z The number symbol is used in PRINT statements to show necessary spaces.

"A"— The underline is used in PRINT statements to indicate graphics. Press the key designated in whatever way your machine requires to get the graphic.

INPUT In PRINT statements when a word or token is underlined enter the word from the keyboard rather than type | it in letter by letter. This is a memory saving technique.

After typing in a program line, you must put the line into your program. On the ZX80 and ZX81 with 8K ROM this is done by hitting the NEWLINE key. On the ZX81 the same thing is done by hitting ENTER. The words are used interchange- ably.

A number followed by a b is binary; a number followed by h is hex.

This 8K block is the only area left. apart from user RAM space from which you can do an opcode fetch. For this reason this block should be saved for extra ROMs. Actual functions of the 2K areas in this block can be swapped around of course. However. if two companies are doing the same product which requires some of this ROM space. to avoid wasting valuable space. it would be sensible for both to use the same 2K area. So here it would be advisable to settle for a definite layout. i.e.. 8K to 10K for Disc Operating Systems. etc.

ROM (Sinclair Basic ROM)

А

/

LP Эф,

RAM 8K ROM

just FOr FLIIT ———S

In general $ YNC prefers articles in some depth so that we can help you develop your programming skills and get more out of your computer. However, a number of readers have shared with us some of their favorite short programs which are too long for our "Try This" column and too short for the kind of tutorial that we often use. Some of these programs illustrate a point or demonstrate a technique that the reader has found helpful. Others do something the reader has found interesting. So we have collected a number of these short programs "Just for Fun." If you learn something. great. If you have some fun, great. If you have some that you want to share, send them in. We will have a "Just for Fun" column as often as we have the material.

Renumbering by a USR Routine

Jon Passler Enter the following program: 1 REM 15£58RNDYVE7YTAB "RND7Y COS P7P77777TAB" RND 2 REM 3 LET L=USR 16514 4 STOP

See "SYNC Notes" for the conventions used here. In addition, the overline indi- cates inverse characters.

Then in the immediate mode (i.e.. without a line number) enter

POKE 16531.112

POKE 16533.113 RUN the program and note the changes in the listing. Then add five more of the graphics on the 7 key after the five already given in 1 REM and run the program again. Then in the immediate mode:

POKE 16515.10 and RUN again.

12

Delete all the lines except 1 REM and save it for future use. It will SAVE and LOAD more quickly without the 16K RAM pack attached. The subroutine can be called in the immediate mode by

LET L=USR 16514

Note:

LD BCS LD HL.16525 LD A.59 ADD A.A

LOOP INC HL CP (HL) JPNZ, LOOP INC HL CP (HL) RET Z LD (HL).B INC HL LD (НІС INC BC INC BC INC BC INC BC INC BC JPNZ, LOOP

Jon Passler, 344 Cabot St.. Beverly. MA 01915.

Sweeper Bernard Bush

Some uses for UNPLOT. TAB, and SCROLL that are not given directly in the manual can be extremely useful:

1) UNPLOT can be used in a FOR NEXT LOOP to keep the print position on a given line.

2) There are two PLOT (or UNPLOT) positions for a given line. UNPLOT 0.42 or UNPLOT 0.43 will both work for the top line.

3) SCROLL can also be followed by UNPLOT to keep the print position on a given line. Without it SCROLL moves the print position to the bottom left side of the screen.

4) SCROLL can be used in a loop to SCROLL several lines. E.g.. 10 FOR J=1 TO 10 20 SCROLL 30 NEXT J The following programs show some uses for UNPLOT and TAB.

SWEEPER 28 LET A=INT (RND#3) +1 = LET E INT (RNO Se) +5 за IF

ao GOSUB 19

110 NEXT E

120 FOR м=З@ TO 1 STEP -1 139 PRINT ТАВ J;"/7GoO "

140 GOSUB 190

179 NEXT J

150 GOTO 160

190 IF B-1 THEN UNPLOT @,42 20@ IF A=2 THEN UNPLOT @,4@ 210 IF R-3 THEN UNPLOT @,за 228 RETURN

R +1 а>=1ё THEN TLS RINT TAB d; “HELLO”

FOR K=3 TO ie

PRINT TRB қ; бз"

NEXT К

IF A@>=20 THEN GOSUB 208 бота =

E Bie

RETURN

Cs Ca £2 C3 UL CD CS ер C3 CO 2 fa C iy

Pape SOLCH e С La TO pa e

ШЧ

Bernard Bush. Rt. 2. Manslield. MO 65704.

Ed, the Head

Basil Wentworth

In lines 180 to 210 an action technique is illustrated which might be useful in a number of programs, for example. a moving target, a flashing signal, alternating graphics for rotary motion.

TO i4 =1 Ж +

ЖЕ”

к)

HI ^

E

uu CC

Gom Sm ку DA у тЫ К DA бу К) 0 9 9 Р z », -j musco o "m

БОС ЫЛ > CON II СЛ {> rng (00 om mmc

fO f ea e ft de e ER E EL ә

IT тю

OI Л! 94

|^

Basil Wentworth, 1413 Elliston Dr.. Bloomington. IN 47401. a”

SYNC Magazine

Ld

CAI peripherals allow you to expand your Sinclair or MicroAce personal computer, enabling it to perform like a main frame or host computer...a true stand alone system!

The CAI/O board, along with the tape, printer and phone modem, can put you in touch with the rapidly expanding world of computer communications. Shake hands with the billions of bytes of information, entertainment and technical knowledge coming on stream. Expand your horizons with quality peripherals designed specif- ically for Sinclair personal computers. .. only from CAI.

CAI/O Board?

The CAI/O Board is the main interface that allows your personal computer to communicate with the outside world as well as other peripherals. No soldering or computer modification is required to install the CAI/O board. Just plug it into the Sinclair's expansion port. The CAI/O board features:

Serial RS-232 Input/Output Port—RS-232 with hand shak- ing enables your Sinclair to communicate with other computers, printers, and serial devices. Simple program commands allow you to set baud rates from 110 to 9600. It's compatible with modems that allow you to interface your ZX80-81 with computer networks, such as THE SOURCES®. Full details are available from CAI. The serial port can also be configured to operate current loop devices, such as tele- types, etc.

Parallel I/O (3 Ports)— You can design circuits to light lamps, control household appliances, power relays, run parallel printers, and A/D converters.

Printer Port, Tape Port, and Memory Expansion Port— These ports are on the CAI/O board to serve as the main interface ports for other peripherals.

$ ri 9 95 When Purchased $ 69 95 When Purchased With

Separately Additional CAI Peripherals

WIDGIPRINT ? Printer

The WIDGIPRINT is a low cost, dependable 32 column thermal printer that prints Sinclair's alpha-numerics, graphics, and inverse characters on 3.2" wide paper (readily available through CAI at $1.95 per 137' roll). The printer prints 190 words per minute, black on white (so it's easy to copy). It prints in three different program modes:

List—Lists the present program in memory.

Print— Will print script, variables, string variables, etc. from within a program.

Screen Dump-— This print mode allows present information on

the TV screen to be dumped to the printer. $99 95

"

WIDGITAPE® The WIDGITAPE system is a

stringy-floppy mass storage device that provides much of the versatility of a floppy disk at a fraction of the cost! The WIDGITAPE uses standard, readily available endless loop cassette tapes (available from CAI at $2.95 per tape—tape lengths from 30 seconds to 6 minutes). Each minute of tape allows you to store up to 5.5K. WIDGITAPE functions are computer controlled. There’s no need to operate the tape system manually. Program functions include:

File Directory WIDGITAPE has its own file directory which can be viewed on the screen. |

Read/Write—WIDGITAPE has the ability to read or write data files during a program run.

File Extending and Modifying— Variables can be brought into memory from the WIDGITAPE while a program is running and then summed with other variables already in memory. These new variables can then be written back into memory, printed, viewed $99 95

on the screen . .. or all three!

Additional Peripherals From CAI $ 1 2995 Phone Modem $ 1 1 995 64К Метогу

Expansion Programs Available from CAI $1495 kons 7955. a, $995 Mh, 995:

Finance Tutorial Bang

CAI Peripherals nd а

АП CAI peripherals come with complete instruction manuals, schematics, and a 30 day unconditional replacement warranty. Prices are subject to change without notice.

СЕСЕ ТЕСТЕ

Orders accepted by phone or mail. Quantit Description Unit Price Total

For mail orders, send check, money [ ^ |CAL/OBeard | (SeePrice) | |

order, VISA or MASTERCARD [| . [WIDGIPRINT| $9995 | |

numbers. Foreign orders must be | [WwiDGITAPE | $9995 | |

made in U.S. currency. O QOIHER. | 1 [SUBTOTAL] | |] Z .J— | |.

б

Shipping and Handling 4% Sales Tax (Michigan Residents Only) TOTAL

CAI Instruments, Inc. SHIPPING AND HANDLING CHARGES P.O. Box 2032

Midland, MI 48640

Phone: (317)835.6]45. MasterCard Visa Office Hours: Exp. Date 9:00 a.m. 4:30 p.m. Name Evening Hours (Technical Information) Address 6:00 p.m.—8:30 p.m. ||: UNE.

Within U.S. $5.00 Outside U.S. F.O.B. Midland, MI

8K ROM

Bercenptions

David B. Ornstein

The ZX81 Parser and User-Defined Commands

In this issue we begin a series of articles which will describe parsing, the ZX81’s parser, and user-defined commands. Par- sing is the process used by a computer system to extract the syntactic and semantic elements of a user’s program. These elements, once isolated, are either acted upon directly or stored in a data structure (or two) for later examination. In the Z X81, and all other computers, it is the parser that is responsible for a) syntax checking, and b) execution of a program. It is one of the most important elements of any system designed to execute a language.

The Parsing Steps

When a parser is called to look at a line or a series of lines, it must perform many steps. An overview of these is as follows:

A) Let IP be a pointer to the first character to be looked-at. The character is the first one in the line to be syntax- checked/executed.

B) Let CCHAR be the character stored at location IP.

C) Process CCHAR according to the current context.

D) Increment IP.

E) If IP does not point to an End-Of- Line (EOL) character, go back to step B.

Let us now take a look at these steps. Before entry into the "SCANNING-LOOP," which ranges from steps B to E, inclusive, the parser sets up a pointer to the first character to be looked-at. This pointer, called the Interpreter Pointer, is given the label IP. Step B fetches the next character to be looked-at. The next step,

14

C, is the most important one and will be discussed further in the next issue of SYNC.

Step D increments the IP. In most systems line elements are stored in con- tiguous memory locations, so the action performed in step D is actually an incre- ment, i.e., IP=IP+1. To state the operation more correctly, we should say: D) Point IP to the next character to be interpreted. Step E is very straight forward. It is, conceptually, a test to see if we have looked through the whole line yet. It is implemented by a compare or a series of compares with the set of legal line-end markers.

RST 0018 GET-CH: LD HL, (CH-ADD) LD A, HL) OO1C TEST-SF: AND à КЕТ М7

МОР NOF

CALL CH-ADD+1 JR TEST-SF

RST 0020 NEXT-CH:

be called by the code responsible for line execution. These routines are labeled “GET-CURRENT-CHARACTER” and “GET-NEXT-CHARACTER.” They are called by way of the RST (ReSTart) instructions: RST 18 and RST 20. The RST instruction is theoretically a CALL instruction, but it has two advantages.

The first is that it is a single byte long. The address of the routine to CALL is implicitly specified in the instruction byte itself. saving the two bytes. required by a CALL, which specify the subroutine ad- dress. With an RST. the address of the subroutine is calculated by taking the lowest three bits from the instruction and multi- plying them by eight. This yields: RST 0, RST 98, RST 10, RST 18, RST 20... RST 38 (all the addresses are in hex). RSTs are used for the most commonly needed/ac- cessed routines.

Listing 1: The RST 18 and RST 20 Routines.

:; The "GET-CURRENT-CHAR" routine. ; Get the char into А. : This instruction will test to see if

character in А is a space (i.e., 0). It will set Z if it is a space.

It will set NZ if it is not. ; Return if it is not a space. ; Fadding.

; Fadding.

Increment CH-ADD.

ч Go back to OO1C.

Listing 2: The CH-ADD +1 Routine.

0049 CHADD+1: LD HL, (CH-ADD) OQO4QC | CURSOR-SO: INC HL QOA4D TEMF-FTR: LD (CH-ADD) ,HL LD A, (HL) CF CURSOR RET NZ

JR CURSOR-SO

; the "Bump CH-ADD" routine.

; bump it.

; STore it.

; Get the char.

; Compare it with CURSOR (7FHh).

If it is not a CURSOR, then return If it is, then go back, and get another character to check.

The RST 18 and RST 20 Instructions The ZX81’s parser follows this basic outline, but it is structured a bit differently. The process used by the ZX81 to “get” characters involves two interconnected routines that are subroutines which can

The second advantage of using RSTs as opposed to CALLs is that the RST instruction is faster. This stems from the fact that the RST does not have to make two extra memory accesses to find out where to send the processor since this

SYNC Magazine

ES

address is specified in the instruction itself.

The RST 18 and RST 20 routines are shown in Listing 1. They use an auxiliary routine called СН-Арр +1, shown in Listing 2, to move CH-ADD along to the next character. The operation performed by this routine is basically analogous to the operation performed in step D above. It is also responsible for a secondary task, namely, skipping any CURSOR characters. The CH-ADD pointer is a system variable and is used as the Interpreter Pointer in the ROM.

In reviewing the routines (RST 18 and RST 20), we must note that they simply refuse to return a space character. This is why you can put spaces almost anywhere in a program without having them affect the execution of your program. The only restriction on the space-insertion rule is that all spaces inside quotation marks, i.e., valid string constants, are significant. The system facilitates this by having a separate routine to parse string constants.

These RSTs provide the base of the parser. Next time I will dive head on into the main parser routines.

Bibliography

Two bibliographic references are impor- tant for this article:

The ZX61 Monitor Listing, Part A by Ian Logan. Melbourne House, 1981.

Writing Interactive Compilers and In- terpreters by P. J. Brown. New York: John Wiley & Sons. 1979.

I wish to express special thanks to Dr. Logan for writing The ZXG$1 Monitor Listing. The labels used in this article are from this work.

May/June 1982

More on the 16K RAM Pack Schematic

I have received many calls and letters from people who want to build the RAM expansion on their own. The biggest problem with this is that some of the components listed in the power supply section are U.K. parts and are not available in the U.S. I have not been able to find cross-references for several, including the ZTX750 transistor. My suggestion to those who want to build the memory expansion is that you use the +5-volt-only version of the 4116 dynamic memory. This way the power converter section, and all the headaches that go along with it, can be eliminated.

As noted in SYNC 2:1, the 16K RAM pack schematic published in SYNC 1:5 needed some corrections and clarifications. A further correction should be made: on each 4116 (ICs 8-15) two pin 7’s are shown. The one going to -5 volts should be shown as pin number 1.

Addenda to “The ZX80/81 Video Display System”

In the discussion of “The ZX80/81 Video Display System” in SYNC 2:1, one further aspect of the Display System (more spe- cifically, the Display File) must be included. As you will note in the column, each of the 24 records in the display file is termin- ated by a NEWLINE (ENTER) character (76h). This is interpreted as a HALT instruction by the Z80 microprocessor. If a line in the display file is shorter than 32 characters, the system will reach and read the suffix NEWLINE.

Meanwhile, the NOP-Forcing logic has been happily forcing NOPs onto the data bus, overriding whatever happened to be coming from RAM. (Whenever the Z80 is in the middle of a display sequence and D6 from the RAM is low, the Force logic is enabled.) Whenever a character is read from the RAM, whose D6 bit is low, the NOP-Force logic is disabled, and the instruction (byte) read will be allowed to pass through to the Z80 for execution.

In the case of the record-terminating HALT instruction, this is the desired effect. The 280 will enter a HALT loop (NOPs), not exiting from this loop until the R (Refresh) register times out and interrupts the system. Herein lies the problem with placing some special characters (those with D6 high)—usually machine code—into REM statements. If the character has the "killer-bit" set, it will pass through the NOP-Force logic and enter the Z80 for execution. This can have disasterous results.

Until next time, same relativistic time period, same non-Euclidian universe. Mg

** Forthe 1k ZX-81

M «FULLY INTERACTIVE GRAPHICS! JM] «DOZENS OF PLAY LEVELS! X " {ЛД «FOR 1, 2, OR MORE! 7.75] -HOURS OF FUN! P “Ih Sc] ENTIRELY IN BASIC! x

PROGRAM WITH COMPLETE INSTRUCTIONS AND DOCUMENTATION—ONLY $3.00

ABOVE WITH CASSETTE—$5.00

ТТ Flint Data Systems

146-22 Delaware Avenue Flushing, New York 11355

CUSTOM ZX EDGE-BD. CONNECTOR s.t. only $7.95

8K ROM IK RAM

An Introduction to Expression Evaluation

In the Sinclair ROM program of the ZX80/81 the "expression evaluator” is to be found at OF55-111Bh (improved 8K КОМ) and forms an essential part of the program. A study of the fundamental parts of the "expression evaluator" can be very useful as it enables Basic programmers to understand many of the limitations and quirks of the Sinclair Basic.

Some Definitions

First we must make some definitions:

Expression. An expression is any com- bination of numbers, variables, strings, functions, and operators that can be combined to form the operand of a com- mand. For example:

1) 2—a simple number.

2) 2*A —a number and a variable linked by a binary operator.

3) CHR$ 32— a function and a number.

4) CHRS(T+A-26*INT ((T+A)+38) —my favorite complex expression. |

Function. Function includes the expected keywords ABS, СНК, INT, etc., but do not ignore the two special functions NOT and -. NOT is a function that gives an "opposite logical result," i.e., NOT 3 gives 0 as the number 3 is logically "true." When - is used as a "leading minus,” it gives an "opposite numeric result," i.e., -3 should be taken аѕ“ + "subjected to the function-.

Binary operators. In the 8&K ROM program the following binary operators are allowed: **, *,/, +, -, =,<=,›=‹ 5 AND, OR. In each case a binary operator is required to be between two operands, which may in turn be "subexpressions" in their own right.

Unary operators. There are three special operators in this group: RND, PI, and INKEY'S. In one sense they are not oper- ators at all and they can, if preferred, be considered as "fixed variables."

Dr. lan S. Logan, 24 Nurses Lane, Skellingthorpe, Lincoln LN6 OTT, U.K.

16

lan Logan

Priority. All of the binary operators and functions have associated with them a "priority" that is used to determine the "order of the operations." Hence, 2 4*2 is 14 rather than 18 since multiplication has the priority value of 8 and addition a value of 6.

Last value. Last value is, perhaps, a difficult point to understand but the Sinclair 8K ROM program evaluates expressions to produce a "last value” on the “calculator stack." For a numeric result the "last value” is a 5 byte floating-point number and for a string result a set of 5 parameters that define the string.

The Actual “Expression Evaluator”

The object of the "evaluator" is to produce a single "last value" that corres- ponds to the expression that it has been given. For instance, if the expression is a simple one such as 2, then the "last value" produced will be the number 2 in binary floating-point form, and it will be the topmost number on the calculator stack. However, if the expression is 2 4*3, then the "last value" is to be 14 and this has to be "evaluated" by "scanning" the expression from left to right and saving the part- answers as they occur and the operations to be performed until the point is reached when the "saved" answers and operations have to be used.

A Simple Evaluation

A Basic line such as 10 PRINT 2 appears to be a very simple line but its interpretation by the 8K ROM program involves an almost unbelievable amount of work. Initially the interpreter has to locate line 10, then scan the line for its first command and jump to that command's routine. In this example, the jump is to the PRINT COMMAND ROUTINE at OACFh. In this

routine a call is made to the "expression evaluator" so as to create a "last value" from the operand of the PRINT command, i.e., the 2, and then a call is made to PRINT-STK, the routine that prints the correct representation of the "last value" on the TV display. A check is then made to see if the line is finished, which in this case it is, before the next line is considered.

It can be seen in the above description that the use of the "expression evaluator" is essential and an outline view of this routine will now be given.

1) Put a zero on the machine stack as a "starting priority marker."

2) See if the first character of the expression is a "unary operator." No.

3) Is the character alphanumeric? Yes. So jump accordingly.

4) Is it a digit? Yes. So jump accord- ingly.

5) Transfer the invisible binary repre- sentation of the number 2 to the calculator stack as a "last value" (remember the line 10 PRINT 2 has its binary representation in 6 bytes between the 2 and the NEWLINE).

6) Fetch the next character in the line. It isa NEWLINE.

7) Jump forward to the “evaluation loop” if it is not an operator. At this point the “last operation” code is zero.

8) In the “loop” an exit is made as the “last operation” code is the same as the “starting priority marker.” Both are zero.

Note the successful outcome! The “last value” on the calculator stack is the floating- point representation of 2 as was required.

SYNC Magazine

2-

The Sinclair ZX-81 is innovative and powerful. Now there's a magazine to help you get the most out of it.

Thousands of smart consumers have picked the Sinclair ZX-81 as their personal computer. And, unlike many of today's bar- gains, this one can really give you your money's worth. Or it can turn into nothing but an expensive calculator. A Sinclair owner can putter along in first gear, missing the power and potential of the ZX-81, or he can shift into high, pushing the ZX-81 beyond imaginable limits. That's why thousands of smart con- sumers have picked SYNC as their computer magazine.

Right on Target

The ZX-81 is unique. There is nothing like it, nothing that comes close to packing so much power and versatility into one small package. Some computer magazines might publish one or two articles about the Sinclair each year, some never mention it. SYNC covers only the ZX-81 and its predecessor, the ZX-80. If an article doesn't apply to the Sinclair, if a game doesn't work on the Sinclair, you won't see it in SYNC. Our staff and contributors are Sinclair owners. Some started out as experts. Others started as readers and became experts.

How can a whole magazine find enough material about one small computer? By cover- ing everything from hardware to software, by offering both new applications and old tricks with a new twist. Did you know that the Sin- clair can generate music? Our readers found that out when we published a program and article showing how to do it, and explaining why it works. Do you know where to buy soft- ware, books, or peripherals for the ZX-81? We list resources in every issue, along with ad- dresses for user's groups so you can get in touch with other Sinclair owners. But knowing where to buy is not enough by a long shot. And that's where we can really help you out.

Hard-Hitting Evaluations

As a Sinclair owner, you know the value of a dollar. But it isn't always easy to know the value of all the extras on the market. Face it, some programs are great, some aren't worth the tape they're stored on. We receive every new product for the Sinclair as soon as it is available, often months before it is on the market. And those products are reviewed and tested with a very critical eye. If an adver-

tiser doesn't care for this sort of honesty, we don't care for his business. We haven't gotten where we are by patting backs, we've gotten there by giving the Sinclair owner the informa- tion he needs. But there's more to SYNC than just reviews.

Applications and Explanations

The ZX-81 comes with a very powerful Basic language. But power doesn't imply diffi- culty. We show you how to get the most from your computer, whether you want to write a game or keep track of a mailing list. And we don't stop with Basic. The Sinclair can be programmed in machine language. For the newcomer, we have articles explaining ma- chine language from the ground up. For the old pro (and anyone who has been reading SYNC for a while will soon find himself in this category) we have sophisticated routines for animation, data handling, and every other aspect of programming.

Don't run your computer in first gear.

Topping if off, hardware articles cover every- thing from attaching a full-size keyboard to adding a tape monitor. Whether you are inter- ested in software or soldering, we'll keep you busy. But we also know how to have fun.

Games of Every Kind

If you like to shoot down attacking space- ships, fight monsters in a dungeon, or land on the moon, we've got what you want. Every issue of SYNC is packed with games. There are classic computer games converted for the Sinclair, and new games designed specifically to exploit the capabilities of the ZX-81. Our contributors keep getting better and better, but that's not surprising, because the games come complete with tips and explanations. Programming tricks and special techniques are fully explained, so you can use them in your own games. We don't believe in keeping secrets.

SYNC is a Creative Computing publication. Creative Computing is the number 1 maga- zine of software and applications with over 150,000 circulation. The two most popular computer games books in the world, Basic Computer Games and More Basic Computer Games (combined sales over 500,000) are published by Creative Computing. Creative Computing Software manufactures over 150 software packages for six different personal computers.

| Order SYNC Today | and Save Money!

[n шшш | Soc

| P.O. Box 789-M

| Morristown, N.J. 07960

| | | ҮЕ { Send me SYNC for the | | а term checked: |

| [ ] One year (6 issues) $12.97 —1 save

| 19%! | | 0 Two years (12 issues) $22.97— | | | save 28%! | | Г] Three years (18 issues) $31.97— |

| save 33%! | Savings based on full one-year sub- |

scription price of $16.

|

|

| CHECK ONE: | [ ] Payment enclosed. | П] Bill me later. | Mr.

|

|

|

|

Mrs. Ms.

(please print full name)

| City

| State Zip

| Foreign postage: Add $3 a year for Canada. Add $5 a year (cash payment in U.S. currency only) for all other countries outside U.S. and posses- sions. Please allow 60 to 90 days for delivery of ;

oec MEN |

| | | | | | Address | | | Apt . | | | | | |

The Next Stage

Let us go through this outline view of the work of the expression evaluator again, but this time the expression is 2c 4*3— a seemingly innocent expression that is a great deal more complex than appears at first sight!

1) Put the "starting priority marker" of zero on the machine stack.

2) Perform the steps outlined above in 2-5 that result in a "last value" of "2" going onto the calculator stack.

3) Fetch the next character: a +.

4) This time it is an operator so prepare the "literal." OF, and the priority of 06 for the operation of addition.

5) Enter the "evaluation loop" and as the "present priority" is greater than the "last priority" (that zero) put the "present literal" and "present priority" onto the machine stack on top of the "last literal and priority" (that zero again).

6) Now fetch the next character, the 4, and go back to step 2 again with a different operand. This time a "last value" of 4 goes on the calculator stack on top of the 2. The "literal." 04, and the corresponding priority of 08 for multiplication are pre- pared and the "evaluation loop" entered once again.

ADD ON MEMORY FOR ZX

16K memory assembled and tested. No extra power supply needed. 90 day warranty on parts and labor.

$49.95 POSTPAID

Check or money order only. California residents add 6%.

KB ENTERPRISES 8211 VALDOSTA AVE. SAN DIEGO, CALIFORNIA 92126

RAM EXPANSION

ADD ON RAM FOR ZX80; 2K INCREMENTS UP TO 16K. COMPLETE. SCHEMATIC, PARTS LIST. SOURCES, AND HOW-TO FOR $3.95. APPR COST FOR 2K, $20 FOR THE FIRST 2K: $13.50 FOR EACH ADDITIONAL 2K; NO ADDITIONAL POWER SUPPLY NEEDED. SEND $3.95 WITH SASE TO:

DENNIS WEBER. BOX 742 TROUTMANN, N.C. 28166

18

7) Here the “present priority” is greater than the “last priority,” i.e, 08 is greater than 06, so again the “present priority and literal” go onto the machine stack. (The evaluator has determined that 2 is not to be added to 4, as the 4 is followed by a "more binding" operator.)

8) Now fetch the next character, the 2, and loop back to create a "last value" of 3, above the 4, and the 2.

9) Alas, the end of the expression has been reached. The "present operator" is zero because the present character is a NEWLINE and the "evaluator loop" is entered for the final time.

10) At this point the priorities are 00, 06, 08 and 00 whilst the calculator stack holds 2, 4, and 3. These stacked values now have to be "unstacked" and this is done as follows: The "present priority "of 00 is less than the "last priority" of 08 so the operation of multiplication, associated with the "last priority." is performed

between the top two numbers of the `

calculator stack.

11) Now the priorities are 00, 06, and 00 and the stack holds 2 and 12. As the "present priority" 00 is less than the last priority 06, the operation of addition is performed.

12) Now the end has been reached. The priorities are 00 and 00 and, since there is but one value on the calculator stack, the required 14, the EXIT is taken.

Although the above examples have dealt only with simple decimal numbers and binary operators the other facilities of the expression evaluator are managed in a similar manner. A variable, such as A, is evaluated to a "last value" and used accordingly. A function such as COS is identified and its literal and priority prepared, and the "operation" of COSing the "last value” is performed when required. Note that it is part of the "calculator" which ensures that a unary operation replaces a "last value" with another, and a binary operation replaces two values with a "last value."

The "expression evaluator” also handles the special operators RND. РЇ, and INKEYS. Indeed there are no subroutines for these operators but merely segments of the "expression evaluator" deal with them in a "straight programming" manner. The addresses of the segments are (all improved ROM):

RND—OF59h PI—OF8Ch INKEY$—OF9Dh

The Priorities

The last point we need to cover is to correct the ZX8/ BASIC Programming manual with regard to the “priorities” of the various operations. They are:

Priority Operations and Functions Decimal. All functions (except LEADING MINUS and NOT) 16 жж 10 LEADING MINUS 9 i 8 - + 6 ACT 5 NOT 4 AND 3 OR 2

Demonstration Program

Our program this time is an exercise in graphics. It is quite easy to get vehicles to go across the screen, but it is a little more complicated to get them appearing in stages from the left and disappearing slowly at the right!

Listing 1: A SYNC Delivery Van.

19 SLOW 20 LET A$="

fs ts ae FOR L=1 TO 15 4@ FOR A=37 РЕИС та nest; w ff ы + 2 5a 5@ PRINT AT L Sate TU ПЫЗ

Ag fALIBE TG R469. 9865 UT

Program notes

Line 20: After the " enter 32 spaces. type in SYNC in reverse letters (hit shift and 9 to get the graphics mode and then type in the letters), enter the graphic on the R key, enter 33 spaces, enter 6 reverse spaces (get into graphics mode and hit the space key 6 times), enter 32 spaces, the letter О, 3 spaces, the letter О, and 33 spaces. Close with the “.

After entering the program, hit RUN and ENTER and watch the results.

Ed. Note that Dr. Logan s Sinclair ROM Disassembly Parts A and Bwill provide major assistance. They can be obtained

from several advertisers or directly from Dr. Logan. R-

SYNC Magazine

ZX 81 AND TIMEX-SINCLAIR 1000 OWNERS

16K-549.95

64K-5149.95

16K normally sells for $80, $90, or even $100. Now you can get this vital tool for less than HALF the of- ficial price. 16K transforms your ZX- 81 or Timex-Sinclair 1000 into a powerful machine. Run Business, Education, and Games without running into the brick wall of “mem- ory full.

64K is all the memory you'll ever need. In fact, its all your computer can handle. And at $149.95, this isnt just the LOWEST PRICE EVER, ANYWHERE for the ZX-81 or Timex Sinclair 1000. Its the LOWEST PRICE FOR ANY COM- PUTER. :

64K makes your computer more powerful than machines costing ten times as much.

These Memories are On-The-Shelf. Just Waiting for your Order.

You bought a breakthrough when you spent your hardearned cash for a Sinclair computer. The amazing power for the rock bottom price has made the Sinclair, after only a year, the best selling computer in history. Now, you have a chance to multiply the power of that computer without spending an arm and a leg. Мете so sure youre going to love the freedom and possibilities of more memory that we are GUARANTEEING THESE MEMORIES FOR 90 DAYS. Money back. No Questions asked.

Dolphin Computer P.O. Box 3046 Redwood City, CA 94064

I NEED IT NOW, RUSH ME: (I know these RAMS's аге FULLY GUARANTEED for 90 Days)

CHECK [ ] (Payable to Dolphin Computer) Quantity Price Total MASTERCHARGE £ 16K RAM ESAE 64K RAM NAME POSTAGE| $5.95 ADDRESS OTHER PRODUCTS YOU WOULD LIKE TO SEE

Dolphin Computer P.O. Box 3046 Redwood City, CA 94064

Gold plated 6 fingers.

Optional volt regg

@ Unique decoder circuitry opens 8K of memory- mapped I/O at addresses 8K-16K

Fastens to ZX81

00000000000 PROMPT DELIVERY:

Bare Board $30*

With connector to port and complete documentation,

Kit $60* ........

6 connectors, 8 chips, sockets parts needed (less volt reg). * Add $3 ship & hndl.

Calif. res add 6% tax.

To order send check or M.O

( emputer

301 16th Ave San Francisco, CA

n

nire

2х81 сһігрег $9

Sancti

The CHIRPER lets you enter programs

fast and accurately.

The chirp lets you hear when a key is entered or when a shakey finger You dont

has caused a double entry.

need to look up at the screen to

check each keys

The CHIRPER lets you hear the sound

patterns of a program while it runs.

Га

We include the listing of a program that plays a random tune. installs easly There are just Complete ns included. Order your CHIRPER by sending a check or money Audiograph Co. 3584 Leroy St. Ann Arbor, MI, 48103. In the USA we pay the postage. Elsewhere please

stage for Зоя first class.

=

5 C3 + (b = O (

EXPANSION BOARD

Buffered Bus/Development Board for marketed and user built peripherals.

Offers С уеї inexpensive access to ZX80/1 hardware.

94118

Que Ee

ӨА11 lines from , port are on bus і &1n same order,

| @Two types of connectors: .l in, .156 in.

Q8 chips needed; all parts are standard.

Ә Connector to port (provided). Option to mount ZX81 uncased vertically.

Qrinest quality board Plated thru holes, solder mask, legend, tin plated,

Q Many circuitry апа mechanical options.

Ө 2х80 requires minor circuit mod at ROM CS

Q Fits 7х80/81, MicroAce.

ontinuum

(415) 752 6294

This column will feature short programs to show off your computer. impress your family and friends. and tickle your imagina- tion when SYNC arrives at your place. We Invite your contributions. Address them to: Try This. SYNC, 39 E. Hanover Ave.. Morris Plains. NJ 07950

4K ROM Type in: 10 REM ZX80 and hit NEWLINE. Then type in: POKE 16431.587 and hit NEWLINE. Hit NEWLINE again and watch the display. On some TV sets adjusting the controls will change the speed of the display. Our thanks to: Aaron Seeler 3460 Red Rose Encino. CA 91436

8K ROM ENTER the following lines:

LET R=INT (tRNDse421 +1 LET B=INT (RND #42} +1 LET C=INT {RND Z) +1

FOR 4-1 TO A STEP C

PLOT n,

PLOT ШЕ

NEXT J

сата 28

к лр Ф ду {14 е Л GU C9 бу д

kie

After you hit RUN and ENTER. watch the results. Our thanks to: Bernard Bush Rt. 2 Mansfield. MO 65704 2"

Glitchoidz neport

Getting Loaded (2:2)

Clarifications offered by the author include: 1) Check your tape recorder grounding; you may have to reverse the diode. 2) Parts list: LED #276-042; diode £276-1114.

The Game of Life Revisited (2:1)

The author has supplied the following changes which should make both versions work.

p. 20, col. 3:

LET A=USR(16427)

p. 21, Fig, 3.

1) Hex address column: the instructions after 40FD repeat Fig. 2. 2) Add the following instructions:

40AB: CD F9 40 CALL TEST 40AE: DD 7E 22 LD A, (IX--34) 40B1 : CD F9 40 CALL TEST 40B4 : DD 7E 00 LD A. (1X)

3) Correct the following instructions: 40DF: DD 36 00 00 LD (IX).00 40E5: DD 36 0080 CELL: LD (IX).128 p. 25, Fig. 7: 4115: Correct hex format to 28 OE Already noted in 2:2: p. 21, Larger Field: 3) POKE 16435.20 p. 21, Fig. 5: 240 IF A <1 OR A 2300...

MicroAce Video Upgrade(2:1). p. 27.

The author has supplied the following additional information:

1) Ist col., last sentence: pin 2 should be "pin 1."

2) Several readers have wondered about connection "G" on the board. The in- structions can be interpreted to indicate a connection between it and both IC 21 pin 1 and the base resistor of the transistor buffer used on VHF modulator equipped Z X80 computers. Connect G as follows:

a) UHF modulators: to IC 21 pin 1.

b) VHF modulators: to the base resistor of the buffer only. a”

SYNC Magazine

ZX81 SOFTWARE THE CHECK BOOK

Get rid of the draw full of old checks "M" | and end the monthly hassle of checkbook balancing with THE .. A scientific approach to solving the CHECK BOOK. This personal or business checking account Cube. This program allows you to set up and move program stores up to 250 transactions on a single program. Over the Cube in any configuration, gives you a choice of 3600 transactions can be permanently stored on a single cassette. displays -- two dimensional, three dimensional and THE CHECK BOOK provides all transaction information and memos flat -- and remembers every move. and will sort by date, latest transactions or alphabetically. 16K $1 4.95

16K $14.95

f, e

(^

CUBE

LOAN/MORTGAGE

The LOAN/MORTGAGE PROGRAM is a fast and flexible calculation program, useful as a tool when contemplating a major purchase. It determines compound interest payments enabling you to investigate the details of a fixed rate mortgage or many other types of loans (i.e. condominiums, cooperative apartments, car, boat, home improvements or college.) It is also useful in developing payment schedules for all types of financial planning (such as owner financing of real estate).

The program has a menu with seven items: 1.) Single Payment Data, 2.) Single Year Data. 3.) Profile By Month, 4.) Profile By Year, 5.) Interest/Principal Plot, 6.) New Data, 7.) End (To Save).

PLUS BOOKS

The Complete 2Х81 BASIC Course Not Only 30 Programs

VU-CALC Turn your ZX81 into an immensely

powerful analysis chart. VU-CALC constructs, generates and calculates large tables for such diverse applications as financial analysis, budget sheets and projections. Using a choice of grids and formulas you can quickly and easily set up an entire business or household financial management program.

клр 16K $19.95

BACKGAMMON

$35.00

This classic game of skill and luck has . | been transformed into an exciting ZX81 game using fast and for Sinclair 2X81: 1K $14.95 efficient machine code and detailed graphics. Backgammon has a - choice of four levels of skill and features screen displayed rolling Machine Language ; diceand doubling cube. 16K $14.95 Programming Made Simple $19.95

ZX81 ROM Disassembly $14.95 Understanding Your ZX81 ROM $19.95

PLUS MANY MORE ZX81 PROGRAMS!

WRITE FOR FREE CATALOG

SEND CHECK OR MONEY ORDER TO:

Please send me: SOFTSYNE, INL.

copies of CUBE @ $14.95 ea ... Copies of BACKGAMMON @ $14.95 ea PO Box 480, Murray Hill Station, New York, NY. 10156 copies of THE CHECK BOOK @ $14.95 ea Copies ofLOAN/MORTGAGE @ $14.95 ea Bl NAME . copies of VU-CALC @ $19.95 ea

ADDRESS

Add $1.50 shipping and handling. CITY New York residents add sales tax. STATE/ZIP

NOW, THE BESTSELLING

HOME COMPUTER PACKAGE

IS AVAILABLE FOR THE ZX81

BILLBOARD

Your message scrolls continuously ' across the screen in giant let- ters. Perfect for dis- plays and exhibits. Messages are easily changed. Press “S” to SAVE a message on tape. When reloaded, it comes up running.

CHECKBOOK BALANCER Keep a running tabula- tion of your bank ac- count. Reconciles bank statement to check- book balance and dis- play both. Stores and displays up to twenty uncleared transac- tions, (more on larger

Why is THE HOME COMPUTER PACKAGE a bestseller? Judge for yourself:

COMPOSER

A color keyboard overlay turns your com- puter into a multi-octave musical instru- ment. Broadcast music to nearby radios as you play or play through your own sound system or record directly onto tape. Stores notes as you play, ready for immediate playback. EDIT keys allow easy changes. Single-step forward or backward through your piece. SPECIAL EFFECTS keys let you create laser blasts and arcade noises.

ETCH-A-SCHEEN

Easily paint text and graphics over most of the screen. Move forward, backward, up or down, leaving behind text, graphics, and inverse characters. Keys REPEAT while held down. Your drawing can be stored on tape... and immediately ap- pears when reloaded. Perfect for desig- ning screen logos or just doodling.

Pm

memories).

The complete ZX81 HOME COMPUTER PACKAGE, including cassette of four programs, manual, guide cards, screen display sheet, musical score sheet, and TWO FULL-COLOR KEYBOARD OVERLAYS, is just

$9.95. Shipping and handling included! $9.95

From: LAMO-LEM LABORATORIES, CODE 208, BOX 2382, LA JOLLA, CA 92038

The ZX81 Home Computer Package runs on all ZX81's, (1К memory or more). Also on x ZX80's with optional 8K ROM. Enclose check [

The ZX81 Home Computer Package, ($9.95) similar items:

The ZX80 Home Computer Package (for standard 4K ROM), ($9.95)

or money-order with or ders. No postage, han- dling, or sales tax. Foreign orders add 3096 for airmail. All packages carry ten day re- fund-or-replace guarantee.

The Timex Sinclair 1000 Home Computer Package, ($9.95) also available: Our catalog, with screen display and coding sheets, is free!

ZX81 Classics (with K-Trek, Life, Lunar Lander, Mastermind), ($9.95) NAME

ZX81 1K Disassembler, ($9.95) ADDRESS

CITY

STATE/ZIP

4K ROM 1K RAM 8KROM 16K RAM

Two Switch Human Interface for the Communicative Impaired Charles Dorcey, Jr.

Ed.—A WORD OF CAUTION: Any hard- ware project that involves modifications to your computer must be approached with extreme caution. SYNC cannot be responsible for problems that may arise from attempting hardware projects. Obviously, any damage done to the com- puter can be costly in time and money for repairs or even replacement.

An Experiment

Let's try an experiment. Type in a few lines of the program in Figure 6, and change channels on your TV. Contemplate the result. Of course, we know that nothing is wrong with the computer; perhaps the lines are still somewhat visible. We suspect that it is still responding to its keyboard, but the responses have become “lost” somewhere along the way back to you. It is probably not worth the effort to use the computer without a readable display. Most of us would just shut it off.

Suppose now that you take the com- puter's point of view. You know that you are functioning as always, but that you cannot get your operator to read and respond to your output. Imagine now asa person that due to some birth defect, illness, or accident your messages are lost on their way out. You know that you are still as intelligent and creative as ever, but does anyone else? Do they shut you off because your message is not getting through to them?

This article is intended to use the ZX80/81 to take a step toward enhancing the communicative potential of such people. Minimum physical coordination is required to display messages on the monitor which could be placed, for ex- ample, at a bedside visible to both the user and visitor. Granted that it is crude and inefficient, but it is also quick and relatively inexpensive to build (even if you have to buy a new computer to dedicate just to this task). Hopefully, the article will stimulate a more elaborate system design.

Charles Dorcey, Jr. 912 Park Hill Rd., Laurel, MD 20707. Adapted to 8K ROM by James Grosjean.

May/June 1982

Program Usage

The program will usually display three rows of characters on the screen at any time: the upper alphabet (UA) row, the lower alphabet (LA) row, and the message row, which will be empty at first. The program allows the user to select letters from the alphabet rows for display in the message row. Three special characters are also included: 1) the inverse-space graphic to put in a blank space; 2) the inverse less-than sign to delete the last character entered; 3) the British pound sign to delete the entire message.

Suppose the user is thirsty and wants to call for “WATER.” Since "W" is found in the LA row when he begins, he pushes NEWLINE. When the display reappears, the alphabet rows are half as long. Now the UA row shows B through O; LA, P through Z. "W" is still in the LA row so he pushes NEWLINE again. The display reappears as shown in Figure 1 with UA holding P-V and LA holding W-Z. The user again chooses the lower row, and the display will look like Figure 2. Now “W” has moved to the UA row, so the user must type U and NEWLINE. Figure 3 shows the new display, and U and NEW- LINE are again entered. Since there is only one letter in each row now, one more choice is needed. U and NEWLINE are entered for the third time and the “W” is put into the message line. The screen display will put the whole alphabet back for the next choice. The sequence for choosing “А” is: U, NEWLINE, NEW- LINE, NEWLINE, NEWLINE, NEWLINE. Since there are 54 characters in our "alphabet," any letter can be selected with five or six choices.

Input Modifications

Since minimal control of hands and fingers often accompanies communicative disorders, some users may not be able to work with the standard ZX80/81 keyboard.

. For some a simple sheet of rigid material,

e.g., perfboard, with finger-sized holes over the U and NEWLINE keys may be ade- quate. For others an external switch actuated by finger, arm, foot, or head motion will provide the necessary input

control. Sound, proximity, and electro- myographic sensing interfaces are beyond the scope of this article but may have potential.

Figure 1 PORSTUV WXY Z

Figure 2 WX YZ

Figure 3 W X

23

GAMES PACKS

for 1K ZX81 & 8K ROM ZX80. Eight fantastic programs for the

unexpanded ZX81, including

DIGICLOCK, 9-LIVES, REACTION TEST, GOBBLER and PATTERNS. $9.95 ($12.95 in Canada)

2

for 16K ZX81. Four programs writ- ten in BASIC for the expanded ZX81. PONTOON, FRUIT MACHINE, OXO, and BIO— RHYTHMS.

$9.95 ($12.95 in Canada) 3 Two programs for expanded ZX81

to keep you entertained for hours! 3-D OXO is written in machine code and is hard to beat. MARS RESCUE is a com- pulsive adventure game.

for 16K ZX81 and 8K ROM ZX80.

$9.95 ($12.95 in Canada) for 16K ZX81. ZOMBIES escape as they chase you around Zombie Island. Lure them into the pits, but don't fall in yourself. MOUNT MAYHEM can you reach the 20,000 foot summit? Look out for Yetis and other hazards! $9.95 ($12.95 in Canada)

DILTATOR

Fantastic new adventure game for 16K (or greater) ZX81. You have just become 129th ruler of Ritimba with a single goal in mind: take full advantage of the situation for your own good. You have to deal with a handful of factions: unruly army, downtrodden peasants but you have the secret police on your side.

$14.95 ($17.95 in Canada)

CONSTELLATION

Turn your ZX81 into a telescope with this amazing 16K program. Produces a simula- tion of the night sky as seen from any position on Earth at any chosen time this century. You may point your telescope in any direction, move it up, down, left or right, zoom in or out. Stars may be displayed by magnitude or constellation $14.95 ($19.95 in Canada)

CHESS

A challenging chess programme, written in machine language, designed to operate in the ZX81 fast mode. ZX Chess allows you to select from 6 levels of play, choose either black or white, and enables castling and en passant moves. Unique ‘‘self- running" feature: you start the tape and when the chess board appears on the screen, start your game.

ZX CHESS! $24.95 ($29.95 in Canada)

ZXDB Machine Code Disauembler

Machine Code Assembler

S1208TORE- ELECTRO

ZXAS Assembler

Now you can use the full power of the Z80 microprocessor without having to laboriously POKE in instruction codes. This full specification Z80 assembler assembles all the standard Zilog mnemonics, which are simply written into REM statements (more than one per line is allowed) within your BASIC program. When assembled, the assembly listings, together with assembled codes and adresses, are displayed on the screen. The assembled code is executed by USR. The program occupies 5K, is situated at the top of the memory, and is protected from overwriting. This means that ZXAS may be used in conjunction with ZXDB (see below), providing an extremely power- ful machine code system normally only found on very expensive computers.

The program is available for both the ZX81 and the 8K ROM ZX80, and in both cases, the 16K RAM pack is required. Despite the low price, ZXAS is a FULL- SPECIFICATION ássembler, and is a must for all serious ZX users. Full documenta- tion on how to use the assembler (in- ied a list of the mnemonics) is sup-

БО, de ($12.95 in Canada)

ZXD Debugger

The perfect complement to the ZXAS assembler, ZXDB is a complete combined machine code disassembler and debugg- ing program. Like ZXAS, it is itself written in machine code for compactness, and may be used in conjunction with ZXAS, still leaving about 9K of memory for your Own program.

Apart from the DIASSEMBLER, the pro- gram has features including SINGLE STEP, BLOCK SEARCH, TRANSFER AND FILL, HEX LOADER, REGISTER DISPLAY and more, all of which are executed by simple one key commands from the keyboard. All in all, an extremely powerful programming aid, 'well worth the money for the disassembler alone!

$9.95 ($12.95 in Canada)

STAR TREK

The classic computer game in which you trek across the galaxy in search of KI- ingons to zap with your phasers and photon torpedoes. You have long and short range scanners to help you find them, Starbases to refuel your ship at and, of course, various witty comments from the crew. 16K.

$9.95 ($12.95 in Canada)

Disassembler/

VU-LALL

VU-CALC. Constructs, generates, and calculates large tables for analysis, budget sheets and projections. Up to 26 columns of figures or data can be entered, plus user definable formulae capable of relating any one or more position in the table to any other defined position.

$24.95 ($29.95 in Canada)

MULT IF IL El e PROGRAM (C) 1981 GUG-EYTE

SET UP pate FARAHET ERS CREATE LI

MODIFY ILE

SERRCH FOR FILE

1 2 3 4 5 6 Y 8

LOCK SRUE FILES ON TAPE

ENTER YOUR CHOICE (1-3)

MULTIFILE

Data Storage System

An amazingly versatile multi-purpose fil- ing system for the 16K ZX81. The program is menu-driven, and number, size and headings of files are user-definable. Both string and numerical files are catered for. Files may be created, modified, replaced, and searched, and are protected by an in- genious foolproof security system. Out- put to the ZX printer is also provided. The program comes on cassette, together with three quality data cassettes for file storage, and comprehensive documenta- tion, describing a host of applications for both business and personal use. Supplied in an attractive storage case. If your ZX81 is bored with playing games, then this pro- gram will give it plenty to think about! $29.95 ($39.95 in Canada)

VIEWTEXT

A ten page information display system for the 16K ZX81. Can display both text and graphics in any sequence with variable speed. Many applications including shop window displays, educations, animation, etc.

$14.95 ($17.95 in Canada)

Gladstone Electronics, 901 Furhmann Blvd., Buffalo, N.Y. 14203 (716) 849-0735

Atlast, a comprehensive text for your Sinclair ZX 81! The complete BASIC Course is a manual which will immediately become an indispensible work of reference for all your ZX 81 programming.

Whether you have never done any programming or whether you are an experienced microcomputer user, the Complete BASIC Course will provide itself to you as an invaluable aid.

The Complete BASIC Course is designed to teach you to write and develop BASIC programs for the Sinclair ZX 81 - no other books or aids are necessary. All is revealed in our easy step-by-step guide with programs and "test yourself" exercises all the way through.

As you become more proficient with computing, the Complete BASIC Course will continue to be an essential guide, giving you finger tip references, numerous advanced programming techniques and memory saving devices specifically for the Sinclair ZX 81.

HOW TO WRITE PROGRAMS:

Even if the idea of writing programs is completely mystifying to you, the Complete BASIC Course will show you just how easy it is. In no time you will be able to write and enjoy complex programs for whatever use you desire.

Using the proven "TOP-DOWN" approach, the Complete BASIC Course will show you systematic and simple ways to write programs. Even experienced programmers will benefit from this Course, making programs easier to write and less prone to error!

NUMEROUS EXAMPLES:

Every concept, every function is fully described by simple programs that you can enter on your Sinclair ZX 81 in minutes.

MORE BOOKS!

Not Only 30 Programs for the Sinclair ZX81: 1K-

Not only over 30 programs, from arcade games to the final challenging Draughts perna program, which all fit into the unexpahded 1K Sinclair ZX81 but also notes on how these programs were written and special tips! Great value!

$14.95 ($16.95 in Canada)

ana Language Programming Made Simple for the nclair

A complete beginner’s guide to the computer’s own language —Z80 machine language. Machine language programs enable you to save on memory and typically pes you programs than run 10-30 times faster than

ASIC programs. $19.95 ($23.50 in Canada)

Understanding Your ZX81 ROM

A brilliant guide for more experienced programmers by Dr. lan Logan, this book illustrates the Sinclair's own operating system and how you can use it. In- cludes special section on how to use machine code routines in your BASIC programs.

$19.95 ($23.95 in Canada)

ZX81 ROM Disassembly

Part A. Covers ROM locations from 000H to OF54H and includes all functions except for routines used in floating point calculator. A must for the experienced programmer.

$14.95 ($16.95 in Canada)

ZX81 COMPLETE BASIC COURSE

The Complete BASIC Course contains over 100 programs and examples! These programs illustrate the use and possibilities of the Sinclair ZX 81:

Home use

Financial analysis and planning Educational applications Games

Mathematical applications Displays of Artificial Intelligence

EVERY FUNCTION COVERED:

No matter what your application, what your confusion about any function, you will find it covered in the Complete BASIC Course.

A full and detailed discussion is included of even traditionally taboo topics such as USR, PEEK and POKE.

A handy alphabetical summary section lists all functions, and provides a short description and example programs of all topics.

A PERMANENT WORK OF REFERENCE:

The Complete BASIC Course is an excellent reference work for experienced programmers (including tips on using special techniques) as well as a comprehensiye step-by-step guide for complete beginners.

The Complete BASIC Course has over 240 pages filled with information in an attractive durable ring binder - this is a lay-flat work of reference that deserves a place next to every Sinclair ZX 81

UT" $34.95

BASIC Course Programs on Cassette All major programs in the BASIC Course are available pre-recorded in this set of cassettes. This is a valuable adjunct to the Course, saving you time and effort.

$7.50 ($9.95 in Canada)

LAST MINUTE SOFTWARE!

Backgammon (16K) Includes a high quality graphic representation of the board. $14.95 ($17.95 in Canada) FI ght Simulation Incredible realistic machine co

e program for piloting your own ZX81! $24.95 ($29.95 in Canada) Damsel & the Beast (1K) Superb adventure game. $14.95

17.95 in Canada) wo Adventure Games (16K) $14.95 ($17.95 in Canada)

The Ex Guide to the ZX81

For Sinclair

ZXB87

64K

$179-95.

Memotech 64K Memopak

The Memopak is a 64K RAM pack which extends the memory of the ZX81 by a further 56K. Design- ed to be in the price range expected by Sinclair owners. Plugs directly into the back of the ZX81 and does not inhibit the use of the printer or other add-on boards. There is no need for additional power supply or cables. The Memopack together with the ZX81 gives a full 64K, which is neither switched nor paged, and is directly addressable. The unit is user transparent, and accepts such basic commands such as 10DIM A(9000). With the Memopak extension the ZX81 is transformed into a powerful computer, suitable for business, leisure and educational use, at a frac- tion of the cost of comparable systems.

plorers’

Programming Aids Some Games and Other Novelties Applications

Machine Language Discovering the ROM Hardware

$9.95 ($12.95 in Canada)

SAT,

Shipping and handling charge $1.50

per order books and cassettes, $3.00

per order 64k Memopak.

In Canada: Gladstone Electronics.

1736 Avenue Rd., Toronto, Ont.(416) 787-1448.

CHARGE TO: Please rush me: [X VISA © MASTERCARD

1 account number: i

GLADSTONE

Electronics 901 Fuhrmann Blvd., Buffalo, NY, 14203

Quantity Price Total Д

[|

Expiry date

Signature

H Date | NAME

| ADDRESS SHIPPING

TOTAL .. L^ Gladstone Electronics, 901 Furhmann Blvd., Buffalo, N.Y. 14203 (716) 849-0735

Figure 4. Add on Switch Wiring

Push-button switches (Radio Shack 275-1547)

EA

R17 (R20) LL - R14(R21)

3-4 feet | About 2 inches

Connectors (1 pkg.) (Radio Shack 274-283)

Computer

Figure 5. PC Board Detail

Е :

S

MicroAce PC details

R14 (R21)

NEWLINE row connection D9 (D7)

U row connection D8 (D6) о

MicroAce printed circuit

MICROACE issue 1.1980 ©

To 74LS365

%

ttc.

1K RAM 15 Ғғ

R17 (R20)

Ala!’

* Make connections here

26

A Hardware Modification

Adding the necessary switches to the computer should be no problem for anyone who knows which end of a soldering iron to hold. In this discussion specific refer- ences to the ZX80 will be followed by the corresponding MicroAce numbers in pa- rentheses. For example, on both schematic diagrams, five lines come down from the keyboard matrix, go left across the bottom and up the left side into a 74LS365 integrated circuit. This IC is designated IC10 (U11) on the pe board and schematic. I have not had a ZX81 to work with, but since the keyboard is electronically iden- tical only the part numbers would

change.

It is helpful, though not essential, to understand how the original ZX80 key- board works. Under each key is a square in which two wires cross to form a simple pair of contacts which come together when the key position is pressed. Though the keyboard is physically arranged as four rows of ten keys, electrically it is arranged as eight rows of five columns. Each column Is wired to a bit on a data bus which goes up through that 74LS365 to the Z80's data bus when the processor is testing the keyboard. Since the column wires are "pulled up” to 5v ordinarily, the only time the Z80 will see a zero bit when testing the keyboard is when one of those keyboard "switches" connects the column line to a row line which is grounded. A short circuit to ground "pulls" down harder than a resistor can pull up. By rapidly grounding one row line after another, the CPU can test all the rows in the keyboard. But how does it do that? A very subtle feature, probably unique to the 780, is involved. The monitor program executes an "IN C,kbd” instruction which 1) puts out the keyboard address on the low half of the data bus, 2) loads the current pattern from the data bus into the C register of the CPU, and 3) (this is the sneaky part) drives the high half of the address bus with the contents of the CPU's A register. This high half of the address bus drives the column lines of your keyboard just the right way so one column is sensed at a time and nobody gets confused but the poor hobbyist who tries to figure the whole thing out. |

SYNC Magazine

Two wires must be added to your computer for each extension switch. All the switch has to do is short the right row to the right column to imitate the original

Figure 6: —Basic Output Enhancement I, 4K Program.

10 REM

an = BASIC OQUTPUT ENHSNCENEN

р G е) l4 X AD

Pr fy)

T | ons Rael HC

- Qi i

каз + IDE:

gun mul

Gu

e n3 c

o

[

г"

m

4 бтрт DH HUE HEN ms Fc arem ams UMC HOON

Iv.

J63 THEN GOTO PRINT DISPLRHY

158 Гы."

аір;

FOR I- NEXT І

B+i TO C iat

І == 4. а а 2 ipt ens (TI);

270 NE

PRINT

INPUT Bs

S00 IF A= QT HEN SFOR

IF CODE (Ag) 25а THEN GOTO 3

В = +41

GOTO Sa

Figure 7: Basic Output Enhancement I, 8K Program.

20 DIM Rí543

43 FOR I=1 TO 52

s@ LET лдын

©б NEXT

70 LET А53) 2128

S590 LET A(54) =14?

36 FOR J=1 TO 64

120 LET A=1

110 LET 6=26

120 LET Cz53

130 CLS

142 LF J<64 THEN GOTO 168 159 PRINT “DISPLAY FULL"

150 FOR I=A TO

170 PRINT CHR$ (ACI);

159 NEXT I

iod PRINT

Daa FOR I=B+1 TO C

zig PRINT CHR$ (ACT;

220 NEXT I

238 PRINT

zd PRINT

250 FOR 1=1 TO J-i

260 PRINT CHR ТТУ);

270 NEXT I

2S0 PRINT

290 INPUT AS

зо F AG="O" THEN STOP

3190 IF AG="U" THEN GOTO 35a 320 ET A=B+1

S38 LET B=INT ((A4C) 72)

340 GOTO 370

5509 LET CzB

360 LET B-INT (BA?

370 IF A:B OR B«C THEN GOTO 138 Зё@ LET T fl} =A (С:

39ge IF mí(C)z147 THEN LET J= 7-2 490 IF ЯС} =12 THEN GOTO 90 41@ IF ЯС) =128 THEN LET T (J) 42а NEXT J

430 сото аа

Мау/Јипе 1982

switch. The type of switches to use will vary with the intended user's capabilities, but should be normally-open (N.O.), single pole single throw ((SPST), either push- buttons or spring-return toggles. To allow easy removal of the switches when not in use, add a pair of audio-type miniature connectors in the switch wiring, but that is optional. Proceed as follows:

1) Run one wire from D9 (D7) to one terminal of a switch. Use the end of the diode which is closest to the keyboard wiring. See Figure 4.

2) Run another wire from R17 (R20) to the other terminal of the same switch. Use the end of the resistor which is NOT connected in common with the others to +5у. This is the NEWLINE extension switch.

3) Add wires to D8 (D6) and R14 (R21), as described in 1) and 2) above, for the "U" switch.

4) You are now ready to enter and RUN the program.

If you do your own soldering, use as fine a tip as you can get. Keep it clean and bright. When the iron is dirty (dull grey in color), solder "bridges" to adjacent conductors are easy to make and hard to remove. Use no more solder than neces-

Sary.

Suggestions for Program Improvements

Obviously, improvements can be made to the program in Figure 6. Rewriting it in

machine language would speed it up and remove the need to hit NEWLINE each time. A user defined list of words either in place of or in addition to the alphabet would remove the laborious retyping of common words and phrases. If you want to get fancier, alternate displaying the top and bottom rows so that a single switch closure during the appropriate display period would then do the selection. (One sound-activated switch is much easier to build than two.) Finally, a “тахітит- entropy" coding scheme could also speed use by creating shorter "paths" to com- monly needed symbols (whether individual characters, letter groups, or words). If you put only the four most common symbols in the LA row in the beginning, only three decisions would be needed to select any one of them. (Note: this is getting dangerously close to “information theory.")

Program Notes

1) The program was written on a 4K ROM, 1K RAM MicroAce.

2) The A array holds the "alphabet." The symbol set (lines 50-90) can be cus- tomized for the individual.

3) The T array (64 letters) holds the message text. Modify lines 30, 90, and 140 to expand it for your memory capacity.

4) Line 300 provides for modification and/or debugging while running the pro- gram by entering “О” to quit.

5) Any input line beginning with U selects the UA row. Otherwise the LA row is selected. When only one character remains in the selected row, it is entered into the text buffer, i.e., the message line.

6) Lines 390, 400, and 410 select the control symbols and can be changed to your own preference. The [Ё] resets the file pointer and, in effect, wipes the slate clean. The KI moves the pointer back one space to allow error correction. The Ё puts a space into the text buffer. не

MUSIC AND KALEIDSCOPES

PLAYER ZX81 generates music through the cassette port. 2 octaves, 124 note length. Random sound program included. $6.95 pp.

SQUARES AND CROSSES are kaleidoscopic simulations forthe

ZX81. $6.95 pp. Cassette and instructions. Guaranteed to load. ALL RUN IN 1K RAM Add $3 each outside U.S.

William Don Maples 688 Moore Street Lakewood, CO 80215

= Learn by Doing Programming Kits from SSL Ө Educational, financial, game programs that you build as a kit. Instructions teach programming and tricks of the trade. For free catalog write: Systems and Solutions, Ltd. 5054 Kenerson Dr. Fairfax, VA 22032

27

Keyboard/System Conversion: The First 40/1 Keys

Robert B. Trelease

28

Ed. A WORD OF CAUTION: Алу hard- ware project that involves modifications to vour computer must be approached with extreme caution. SYNC cannot be responsible for problems that may arise

from attempting hardware projects.

Obviously, апу damage done to the com- puter can be costly in time and money for repairs or even replacement.

Introduction

As a daily user of some of Digital Equipment Corporation's nicest micro- based laboratory computer systems, it is easy for me to be prejudiced about system design and operating convenience. In particular, I will have to admit a real fondness for DEC's VT-103/LSI-11 ergo- nomically designed video terminal with detached keyboard and self-contained 16 bit LSI-11 microcomputer bus/backplane.

As a ZX80 owner, on the other hand, I also find system simplicity and portability very attractive. As others have pointed out, one only needs a battery pack, a small portable television, and a ZX80/1 or MicroAce for a backpackable combi- nation that can bring computing to places like the high Sierra Nevada wilderness.

On first thought, it would seem a con- siderable design problem to configure a system combining DEC-style keyboard convenience and modularity with Sinclair- style portability. As it turns out, the problem is not very great, and the average (read: technically sophisticated) SYNC reader can probably handle it with ease.

The purpose of this article is to review computer keyboard (KB) conversion for the ZX80 or MicroAce and to describe the first phase of an adaptation that retains original system portability while allowing upgrading to an “advanced” expansion- bus oriented system.

Keyboard Conversion Kits

The fundamental conversion described here can be made with almost any KB switch array, 40 keys, new or used, so long as the switches are normally open and are closed with a keystroke. Such

Robert B. Trelease, 2313 5th St.. Santa Monica. CA 90405

SYNC Magazine

keyboards can then be paralleled with the ZX80 keyboard. The Schultz Systems keyboard used in this article was chosen because the kit included the electronics for additional features not available with the standard Sinclair or MicroAce. These features, which include shift-locking. auto- repeat, and single key. auto-upshifted functions (such as single key rubout) will be covered in a future article on advanced conversions. Unfortunately. Schultz no longer provides complete conversion kits with used KB’s, although complete in- structions, KB source listing. and other parts can still be obtained. (At this writing kits and instructions are available from L.J.H. Enterprises and Double H Elec- tronics.)

Construction Details

Ihe KB provided. as is probably the case with most used units, came equipped with a printed circuit board electronics matrix attached to the switch terminals. To begin the conversion, it was thus necessary to remove this PC board. A de-soldering tool, such as a SOLDAVAC (ТМ) (Radio Shack no. 64-2085 or equiv- alent) is a real necessity. Even with this tool, unsoldering the old matrix board was clearly the most difficult part of the initial conversion, taking about 2 of the 4 hours needed for the project. In order to avoid switch damage on removing the PC board, all of the solder had to be removed from each connection. This required 2 complete passes over the board. (Figure iW

Once removed, the old matrix board was kept for salvageable parts like sockets, IC's, diodes, resistors, and capacitors— an added bonus! Each switch was tested with an ohmmeter in order to avoid unpleasant surprises and then labelled on the back to aid in wiring. Although it was not necessary with my KB, the circuit board could have been retained for switch support, with each terminal contact being isolated from the old circuit by cutting printed circuit conductors.

The switches were then strung together in rows and columns using the ZX80 matrix convention (see $YNC 3:42 for greater detail). Briefly, this consists of wiring in parallel one terminal of each switch in 8 rows (e.g., "shift," Z. X, C, V) and the other terminal of each switch in 5 "folded" columns 9 to 13. Since there were two "shift" keys, each was wired the same to allow shifting with either hand. For con- venience, I did the same with adjacent "." and "." keys. All connections were made with standard insulated hookup wire. (Figure 2)

For connecting the wired KB matrix to the computer, I used a 16 pin DIP termi- nated 18" ribbon "jumper" cable (Radio

May/June 1982

Figure 1: Desoldering the kevboard.

Shack 276-1976) and 2 16 pin DIP IC sockets (Radio Shack 276-1998). A small piece of 0.10 spacing "perf-board" was attached to a convenient slot in the KB frame using cyanoacrylate glue ("Crazy glue”). One of the 16 pin IC sockets was glued to the board. and the row/column leads (1-8/9-13) were soldered to its ter- minals in numerical order (1-8 and 9-13 respectively). Pins 14-16 were reserved for power connections for the advanced functions. (Figure 3)

The final step of the basic conversion. connection to the computer board matrix diodes and resistors, was carried out using the DIP terminated jumper cable. One of the DIP plugs was cut off the cable. leaving enough cable on the detached connector so that conductor numbers could be positively identified. This was important because the jumper cable was not color- coded, although the 1/6 edge of the ribbon bore a standard red stripe. The computer's top cover was removed. Following the convention of the IC socket on the KB, wires 1-8 were carefully soldered to the anode (unbanded) leads of diodes D3 - D10 (MicroAce, D1-D8). Wires 9-13 were connected to the non-5 volt ends of

Figure 2: Wiring.ne keys. —— —ć

resistors R13-R17 (MicroAce R18-R22; neither system is in numerical order!). To avoid component damage, wire leads were pretinned, and contacts were only briefly heated (Figure 4)

In my ZX80, the ribbon cable was led back under the voltage regulator heat sink to exit the case just above the expansion bus. (Other exits could be used in the ZX80 or MicroAce. For example, a small slot might be cut in the cover). Strain relief was provided by tethering the ribbon cable to the video modulator case. (Figure 5)

The final products of this conversion were a DIP-socketed, wired keyboard and a ZX80 with a mating ribbon cable "tail." When the system was connected, every- thing worked almost. Initially, the R and O keys did not function on the new keyboard. Closer examination showed that in wiring the matrix, I had slightly bent one terminal on each key so the switch contacts did not close. A gentle push on the terminal connection restored complete function. I then had a ZX80 with both keyboards functioning in parallel. (Figure 6)

In order to ruggedize the project and reduce ТУ interference from the conver- sion, a keyboard enclosure was added. I chose an aluminum housing for my system (BUD KB 13202 from Herbach and Rademan, Inc.; depending on the specific KB adapted, many other enclosures could be used). The IC socket on the keyboard was jumpered to another socket mounted on the back of the enclosure. (For coura- geous engineers who do not wish to test keyboard wiring before enclosing, con- nections from the rows and columns may be made directly to an IC socket on the cabinet). The connector pins on the computers new "tail" were protected during "stand-alone" operation using the remaining 16 pin IC socket.

29

Since the keyboard was printed with the standard type letters as well as with unusual “uppercase” functions, a copy of the ZX80 template was used as a "cheat- sheet." Transfer lettering and clear epoxy lacquer also could have been used to identify keys.

Synopsis and Provision for Expansion

As described here, the basic keyboard conversion is easy to wire, taking a slow builder about four hours of straight time. The finished product as modified is a detachable keyboard for the ZX80/1 or MicroAce which can serve as the founda- tion for a more complex, expansion bus oriented microcomputer system. In the present form, the original system can be separated from the new keyboard, thus retaining true portability.

By implementing CMOS switching cir- cuitry such as that obtainable from Schultz Systems, one can obtain advanced key- board functions like auto-repeat and single- key rubout. By adding a separate cabinet containing a heavy duty power supply, printed circuit card guides, and ZX80 bus connectors, the true "hardware freak" can inexpensively construct a modular micro- computer system with features similar to those of more expensive business and scientific models. (A somewhat different

30

Figure 3: Attaching row/column leads to IC socket on períboard.

approach to such an advanced system was shown in SYNC 4:38 "A Parallel Interface" by Alger Salt.) Design and implementation of these advanced features will be considered in a future article.

(Note: DEC, VT-103, and LSI-11 are trademarks of the Digital Equipment Cor- poration.)

ZX81 Conversion Details

Shortly after finishing the first part of this conversion article, I had the good fortune to acquire a ZX81 kit. It immedi- ately became apparent that the same general conversion scheme could be applied to the new machine as well. I will detail only one approach, although SYNC readers will undoubtedly conceive of other ways to do the job.

The keyboard matrix and connector should be constructed as detailed above, with rows and columns wired to 13 pins on the attached DIP socket. The jumper cable should then be connected to the matrix diodes and resistors, which are D1-D8 and RP-3 in the ZX81. In the quick and dirty approach, the cable leads should be conservatively stripped, pretinned, and then soldered to the PC traces of con- nectors KB 1 and KB 2 on the solder side of the board.

Figure 4: Attaching ribbon wires to the diodes.

Soldering may be done relatively easily with only the bottom half of the computer case removed. Figure 7 depicts the PCB under KB 1 and KB 2 and shows the order of connections for the lines of the jumper cable.

Stripping of the jumper leads should be kept to a minimum, and some additional insulation, like heat shrink tubing or silicone cement, may be used to reduce the likeli- hood of shorting. The cable may be out of the case below the bus connector, and tethering to PCB screw channel/support posts will help reduce the chances of wire breaks and shorts.

ZX81 owners particular about the "OEM" condition of their machines might want to try adapting a 16 pin dip plug to flexible printed circuit "cable" for direct connection to KB 1 and KB 2. This scheme necessitates opening the case, however, and disconnecting the membrane KB when connecting to the new KB. This is clearly no disadvantage for those who might wish to mount the ZX81 or bare PCB perma- nently inside the new KB enclosure.

Figure 5: Ribbon cable exit from computer. _

SYNC Magazine

Figure 7: ZX81 hookup.

Figure 8: Row and column arrangement.

OOOOOOOOOO

с rr

du

II TR SIGNALS

2 JUMPER 4& | INES

D8

7 А14 D7 KBO KBI KB2 K B3

8 AIS

< =

13 12

~

11 10

ZX-STD BUS INTERFACE Floppy Disc * ON-BOARD MEMORY Hi-Res Vid. EXPANSION OPTION Add X MEMORY -MAPPED PORTS Menery * PROVIDES POWER TO ZX Speech *ALLOWS OVER 6M CABLE Modem * HI-POWER BUS BUFFERS

e * DELIVERY FROM STOCK D-

Uto CENE CES p op Etc. Etc. - 493M 8 uU" Pu From over 50 manuf. ов D Re UU LU oU MA ca NN bee Le Lt i i NEST hin Es em | - ANNIN, OPTIONS: шшш” h—— —— ө) * CONVERT ZX EDGE CON. | par

TO RIBBON HEADER $30

A E CO * 2K RAM EXPANSION $15 Ы *4K RAM EXPANSION $ 25

ШШ

BOX 18093 AUSTIN

"Peas " SINCLAIR (512) 385-7405 334

8K ROM 16K RAM

Least Squares Data Analysis with

the ZX80/81

Alger Salt

One of the most common tasks of a computer is to perform statistical analysis and data manipulative type computations. Many of the computations involved are very tedious to perform by hand since they sometimes require a large number of reiterative calculations. Statistical analysis problems that take hours for a human (equipped only with pencil and paper) are solved in a matter of seconds with a computer. This article presents a program which computes some simple statistical quantities commonly used by engineers and scientists.

Data collected in the laboratory or in the field often follows some logical pattern. The quantity of interest depends on or is a function of another quantity. By recording a sufficient amount of data, this relationship may be determined by fitting a function to the set of data points. It is rare that data collected in the real world corresponds exactly to some function; rather it is scattered about with a certain probability of corresponding to the function.

Consider a function which would de- scribe the ambient temperature in Cove City, North Carolina, as a function of time for the last twenty years. If the function were to include all of the daily temperature fluctuations, it would indeed be a very complicated function. However, if only the average weekly or monthly temperatures were recorded, then a rea- sonable function could be fitted to the finite number of data points. The function would resemble a sinosoid with a period of 365 days with maxima and minima occurring in the late summer and winter respectively. There would be some un- certainty associated with correlating a

Alger Salt, Department of Chemistry, East Carolina University, Greenville, NC 278234.

32

particular day in the future with some specific temperature. In this case the uncertainty lies within some confidence limits determined by the climate. In other cases the uncertainty depends primarily on the method or apparatus used to measure the data.

Fitting a function to a set of data points is desirable because it allows one to make predictions or extrapolations from hypo- thetical or trial data.

The Method of Least Squares

In many situations the function which relates one quantity to another is linear. That is, if the data are plotted, the points lie on or about straight line. Examples include: the current through a resistor as a function of voltage, the conductance of pure water as a function of the amount of salt added or the length of a suspended

spring as a function of the load attached. An approximate method of determining the "best" straight line through a set of data points is by plotting the points on graph paper and drawing a line which uniformly divides all the points. Of course, this method is prone to error because determining the "best" straight line is somewhat subjective and two persons working with the same data will rarely arrive at identical functions.

The "best" straight line through a set of data points is defined as that line in which the sum of the squares of the deviations of all points from the line is a minimum. This method of "least squares" is far superior because it calculates, not approx- imates, the line. The method yields two quantities: the slope and the intercept of the line, thereby defining the linear function by the well-known relation

у = ах + Б where a is the slope and b is the y- intercept.

The slope and intercept are determined by the formulas in Figure 1. Another useful quantity is the correlation coefficient, given in Figure 2, which is the relative amount

Figure 1. X y ху N slope =a= ( x)? x 2 N y—m x y—intercept = b = N Figure 2. ( x)? x? N N—1 correlation coefficient = с=т , ( y)? y N М 1

SYNC Magazine

HAVEN HARDWARE Programmable Character Generator User defined characters Z81 Repeating Keymodule For editing-variable speed Parallel Input/Output Port Full-Size Keyboard Large two part keytops with repeat key * Kit available, subtract 209/ for kit price

BUTLER/CURRIE/HOOK Print n' Plotter Jotter Pads 100 Sheets 8%” x 1134", 2816 Pixels PLOT grid 704 item PRINT grid, numbered, keyboard facsimile, 2 hole punched, far superior to Sinclair grid Print n' Plotter Films Erasable overlay 8" y 11” PLOT and PRINT grid Print n’ Plotter Ring Binder

JP GIBBONS

Personal Banking System Requires 16K expansion-cassette

MELBOURNE HOUSE

Books

Not Only 30 Programs For

The Sinclair ZX81

Machine Language Made Simple

ZX81 ROM Disassembly Part A & B (2 volumes) Dr. lan Logan

Understanding Your ZX81 ROM Dr. lan Logan

The Sinclair ZX81 Basic Course

Casette Tapes

ZXChess 16K ZX80-8K/ZX81 10 Exciting Programs 1K ZX81 Adventure A 16K ZX80-8K/XZ81 Adventure B 16K ZX80-8K/ZX81 Adventure C 16K ZX80-8K/ZX81 Spacetrek 16K ZX81 Directory/Record 1K ZX80-8K/ZX81 with listing

Reversi 1K ZX80-8K/ZX81 Super Invasion 1K ZX80-8K/ZX81 Wallbusters 1K ZX80-8K/ZX81 ZXGalaxians 16K ZX81 ZXBug Utility Program 16K ZX81

If you are a producer of hardware or software for the ZX81 and are interested in having a U.S. or Westcoast sales orgnization marketing your products we would like to hear from you.

Add 5% west of or 7% east of Mississippi River to cover handling and shipping. Washington residents add 6.5% sales tax.

Qinclain Place

8K/16K

ZX81 CHECKERS

* FASCINATING FULL SCREEN MOVING GRAPHICS. * SOPHISTICATED PROGRAM WITH DETAILED DISPLAY OF PLAYING BOARD. * EDUCATIONAL & ENTERTAINING. * EASY & FUN TO USE. —CASSETTE & INSTRUCTIONS— REG. $14.95

INTRO PRICE—$11.95 & $1.50 P/H

В & В SOFTWARE 1425 LUCY LANE MADISON, WI. 93711

P.O. Box 2288 Redmond, WA. 98052

STRUCTURAL DESIGN

For ZX-81 8K/16K Programs include GRAPHICS STEEL BEAM DESIGN $29

12 Options of Beam Type and Loading

TIMBER BEAM DESIGN $29

3 Options of Beam Type and Loading

Choice of Timber Grade and allowable Stress

DORAN ENGINEERING, P.A. 113 South Chestnut Street PLEASANTVILLE, NJ 08232 (609) 646-3111

VISA MASTERCARD

of scatter about the line. A correlation coefficient of 1 means that all data points lie exactly on the least squares line. A correlation coefficient of less than 0.9 implies that the data are either invalid or are not linearly related.

The Program

Though the program as written will not fit into a IK system, it can easily be broken down into independent modules so that IK owners should still be able to benefit from this article. The DIM statements at lines 10 and 11 limit the maximum number of data points to 20. The FOR-NEXT loop at lines 140-180 repeatedly invokes the subroutine at line 1000 to enter the data points into the X and Y arrays. The main program is made from lines 200-400. These statements produce a menu which gives the user several paths to follow. The user enters a number from 1 to 5 which is stored in the variable G. The program calculates the appropriate line number from G and branches accordingly. (Note that branching to a line number specified by a variable is one feature of the Sinclair Basic not found in many others. This feature offers many advantages including increased readability; it is much easier to comprehend a statement that says GOSUB PLOTSUB than one that says GOSUB 130.) The options given to the user are: calculating the least squares line, printing a table of the data, plotting the data, starting over or ending the program.

The analytical calculations are done in the subroutine starting at line 3000. As you can see, the summations indicated in the equations in Figures 1 and 2 are carried out in a FOR-NEXT loop from 1 TO N, where N is the number of points. Line 3340 prints the equation of the line from the calculated slope and y-intercept. The correlation coefficient is calculated at lines 3360-3400 and is printed at line 3420. This module, along with some way of getting data into the X and Y arrays, may be used as the main program in a 1K system.

Ihe plotting routine is useful as a qualitative assessment of the data. By plotting the data on the screen one can see at a glance if the data are well behaved: in this case linear. In some cases the user may or may not wish to see a plot which includes the origin. For instance, a straight- line plot with a high positive y-intercept would not utilize the full resolution of the 44 x 64 pixel screen. Instead, the line would look compressed against the top of the screen. For this reason the user is given the option of having the graph include

34

the origin or the point (0,0) which is in the lower left corner of the screen. This is a rather unsophisticated plotting routine and is only valid for positive values. The user may wish to substitute another. A more sophisticated routine would allow negative values and position the origin accordingly. Labeled axes would also be a useful enhancement.

Note the instruction POKE 16437,255 at line 5581. This is necessary for ZX80 8K ROM users. It must follow every PAUSE instruction. Failure to include it can result in a system crash. The reason for this is not clear to me, but it is apparently the result of a bug in the ROM. It has something to do with a counter that both the PAUSE instruction and video circuitry use. Without the extra instruction the system may work fine for as long as ten minutes then suddenly produce a blank screen with no response to keyboard input. A power down or reset is the only road to recovery which, of course, results in losing the program which you had just spent the last two hours typing in. I had to find out the hard way, and, after several weeks of testing, probing, and endangering my sanity, I happened to stumble across the solution on page 127 of ZX61 BASIC Programming, a typical case of “when all else fails, read the instructions.” Be forewarned.

Example

Perhaps the best explanation of the method of “least squares” is an example. Let’s say that we are looking for the function which describes the forward voltage drop across a transistor as a function of temperature. In order to use the least squares method we must have a function which we will get back as a straight line. Therefore, we must assume that the relation of the voltage drop across a transistor is linear. Well, it is not quite

X Y

Voltage Drop Temperature

(volts) (degree Celcius) (1) 0.6853 0.00 (2) 0.6752 5.00 (3) 0.6647 10.00 (4) 0.6542 15.00 (5) 0.6440 20.00 (6) 0.6337 25.00 (7) 0.6234 30.00 (8) 0.6024 40.00 (9) 0.5811 50.00 (10) 0.5595 60.00 (11) 0.5377 70.00 (12) 0.5264 75.00 (13) 0.5163 80.00 (14) 0.5054 85.00 (15) 0.4942 90.00 (16) 0.4821 95.00

Figure 3: Voltage/Temperature Table.

linear, but close enough when operated between 0 and 100 degrees Celsius. The data in Figure 3 were collected using a 4- digit multimeter and a National Bureau of Standards mercury thermometer with absolute accuracy to 1/100 of a degree.

From this table and with the aid of the program in Figure 4 we should easily be able to determine the temperature of the transistor casing (or ambient temperature if the device is in the surrounding envi- ronment) by measuring its forward voltage drop. Conversely, we could determine the forward voltage drop if we knew the temperature. Suppose we measure a voltage drop of 0.6295 volts across the transistor and we wish to determine the temperature accurately. We know that it should be between 25 and 30 degrees just by looking at the table. But we want to be a little more accurate than that. Let's run the program and see.

The program first asks for the number of data points. We have collected 16 known data points so enter 16. The program then asks for the data, X1 then Y1, X2 then Y2, etc., until the Y component of the last data point is entered. Then a menu is displayed so we can tell the computer what to do with the data: 1) perform least squares analysis, 2) list the numerical values, 3) plot the data, 4) start over, or 5) quit. The best thing to do here is list the data to double check all of the entries. If a mistake is found, the program forgivingly offers the option of correcting it without entering the entire collection again. After entry corrections, the program waits for another NEWLINE before going back to the menu. With the corrected data now in the computer we are ready to perform a least squares analysis. The program responds with the slope, y- intercept, and the equation of the best straight line through the set of data points. The unknown quantity can be immediate- ly calculated by substituting the corres- ponding known quantity into the equation.

y=axtb or (y-b) X == а

In this case we know x.

y = -469.02146 deg/V* 0.6295 V + 321.99771 deg 26.75 deg

The result is valid to the number of digits of the input data. The same results would have been obtained had we switched the coordinates, that is, if we had let the voltage drop be the X value and the temperature be the Y value. Then the unknown temperature would have been

SYNC Magazine

EVEN IF YOUR LIGHTS GO OUT

YOUR COMPUTER WON'T,

| Introducing —^ . NiCd Battery Back-Up Units from Syncware

«+ Make your ZX Portable BBU-2 runs over 2 hr. BBU-1 runs 1 hr. Baby BBU runs Уе hr. 5 Make your ZX immune ——X ÙO lino glitches! : e PRICES: : : * Protection against _ s Baby BBU 39.50 brown-outs, blown BBU-1 54.50 fuses, etc. BBU-2 84.50

y 4 ү. ОКЕ

TIRED OF LINE GLITCHES Prices are postpaid in continental | GIVING YOUR COMPUTER AMNESIA? "i S. decus sine un ada 2 | Let Syncware take the annoyance out of computing. Baby BBU and BBU-1 useex- | Payment must be in V. o. - T созы supply; in case AC line goes dead or power supply gets knocked out | rency. Send check, ие огаег ог _ of socket, battery takes over until power restored, preventing memory loss. international M. O. only.

BBU-2 contains built-in heavy duty power supply, | eliminating need for original supply. In addition, 1.1 E _ BBU-2's output is pre-regulated at 8 volts for addi- tional glitch rejection, and also lets your ZX run con- siderably cooler. DON'T WAIT FOR A SUDDEN CRASH BEFORE YOU ORDER YOURS!

ZX81 PARALLEL INPUT/OUTPUT BOARD

_|1]2[3[%]5]в]7]в]з]в] | | | Ганев тура ое

Features include: 16 User Programmable lines Fully TTL Compatible

Lj [ajs]p]e[e|w[o[k]t[ Jew ser] | Jz]xic[vis[u[n]. [ue ы а ннакана

A multitude of Keyboard & Display uses include: Interface

Lighting Control Systems Robot Controller

Home Security Systems Central Heating Control

THIS IS A МЕМ, SURPLUS, 53 KEY, GOLD CONTACT, FULL STROKE, HIGH RELIABILITY

KEYBOARD, ORIGINALLY MADE FOR A TEXAS INSTRUMENTS COMPUTER TERMINAL BY HI-TEK.

WE MODIFIED THE CIRCUIT BOARD TO WORK WITH THE ZX80 AND ZX81 COMPUTERS.

THE KEYBOARD IS ABOUT 12 INCHES LONG, 4 INCHES WIDE AND 1% INCHES THICK.

THE SPACE BAR IS 6 INCHES LONG AND THE TWO SHIFT KEYS AND RETURN (ENTER) KEY

ARE OVERSIZED FOR EASIER USE. THERE ARE 12 EXTRA KEYS WHICH YOU MAY USE FOR

THE SPECIAL CIRCUITS DESCRIBED BELOW. DETAILED PLANS ARE INCLUDED WITH THE |

KEYBOARD. AN OPTIONAL PARTS KIT IS AVAILABLE. ELECTRONIC SHIFT LOCK WITH LED INDICATOR- allows vou to lock the keyboard |

. 4 E 7 7 T А 3 | їп the shifted mode. Simplifies entering graphics. | AND MANY MORE. AUTOMATIC REPEAT WITH LED INDICATOR- once activated, you сап hold any key | down and it will continuously input until released. Make it easu to | move the cursor quickly, draw graphies ete words, ete | | AUTOMATIC SHIFT FOR SELECTED FUNCTIONS- s like: delete, $, cursors, ", =, ete. can be placed on dec this etreutt

does the shifting for you, electronically. THE KEYBOARD COMES FULLY ASSEMBLED AND READY TO CONNECT TO YOUR COMPUTER VIA | A 13 CONDUCTOR RIBBON CABLE (SUPPLIED). THE COMPUTER'S EXPANSION CONNECTOR IS LEFT FREE FOR USE WITH THE 16K MEMORY OR PRINTER, ETC. THE PARTS KIT IS NEEDED ONLY TO ADD THE SPECIAL CIRCUITS DESCRIBED. THE KIT CONTAINS ALL THE ELECTRONIC | PARTS REQUIRED, INCLUDING ALL IC'S WITH SOCKETS, RESISTORS, LED'S, ETC. YOU | PROVIDE ONLY SOLDER, WIRE AND A SMALL PIECE OF PERF BOARD FOR ASSEMBLY.

PRICE: £16.50/$35 US $ Cheques accepted.

О.К. ORDERS ADD £2.48 V.A.T. + 30p p. & p.

Shipping, insurance, handling please add the following:

U.S.— APO-FPO(PAL) $3, CANADA $6, ALL OTHER FOREIGN $12

Texas residents add $2.53 state sales tax. FOR PARTS KIT ADD $13 and an additional $1 for postage/handling

6 ——9 Texas residents add $.72 additional sales tax. DOUBLE H ELECTRONICS ALL PRICES ARE $ U.S. AND ONLY U.S.

Е DOLLARS CAN BE ACCEPTED. MONEY ORDER | 195 LELANI OR CASHIERS CHECK PREFERRED.PERSONAL CHECKS MUST CLEAR BEFORE SHIPMENT. E SAN ANTONIO, TEXAS 78242

© OO COMPLETELY ASSEMBLED KEYBOARD & PLANS FOR THE SPECIAL CIRCUITS

ORDER FROM: -

Andrew Developments, 93 Beaconsfield Villas, Preston Park, Brighton, E. Sussex, ENGLAND. Tel. (0273)564629

determined by substitution of the transis- tor's voltage drop into y. Finally, we can plot the data by hitting NEWLINE to get back to the menu and then entering 3. The sample plot reveals that the data are hardly scattered, as also predicted by the correlation coefficient of very near unity.

Hopefully, this article will be of help or interest to many readers. This article barely scratches the surface of statistical analysis and function fitting. Bear in mind that the least squares technique is not limited to linear functions. Variations on the method can be used to fit polynomials of any degree to a set of data points.

Note: Readers are referred to Jon Passler's "Linear Regression" in SYNC 2:1 for more information on relating vari-

ables.

bs Dr Ggonceccoggronmne

0 :É5ÉoaGrGe-c

AA. to

Figure 4: Program Listing

REM ... LEAST SOQURES REM ... ANALYSIS PROGRAM REM п Br.

REM a. ALGER SALT REM ... JANUARY 1962 DIM Y (S

а 2 “L.

AST SGUARES DATA я

т——

INPUT N

CLs

FOR I=1 TON GOSUB 10900

PRINT "1- LEAST SQUARES"

La] Cad Lad Ld Cad d ad Gd Gl Gd Cad Gd Gad (d Т Ш bo bok TETTE

1-54)

еб б RO UU

RRRIZOZU QU

UJ Cd GI o Gm Ld La Ld:

~ LIST DATA“ - PLOT DATA"

- START AGAIN" - QUIT"

N 19 LET SO-50-«vt(I)xx2 20 LET S1-51-4XtI1j 4ай LET $S2-52-4vt13 60 LET S3-334X(I) жу {iI} SQ LET 54=54+ХІІ) x2 тсе NEXT I 29 LET S5-Sirx2 40 LET M=((S2252-°N) -SS) 7 0 (551

={(f-M#51) +52) ^N “SLOPE”, “Үү INTCP"

3386 PRINT N.B

O PRINT @ PRINT

@ PRINT

5 PRINT “EQUATION OF THE LINE 6 PRINT | © PRINT “Y = “;М;"#х + (";B;" © LET SY=SOR ((SO-(S2xs2) /N) 7 1))

© LET SX=SOR ((S4-(S1ks2) /N) / 1))

@ LET CC-MxSX.SY

@ PRINT

1 PRINT

= pe bal Bar = чен,

Pan | у» E рад = = = TX Ud =

3 5 5 5 5 S 5

3420 PRINT "COR. COEF. = ";CC 3999 RETURN

40080 REM ... LISTING ROUTINE 4005 PRINT HT @.9: "b ul S x

4290 GOSUB 1000 4225 СОТО 4000 4300 RETURN

a LET YL=a FOR I-C TO 63 PLOT I. © NEXT FOR 150. TO 41

12 13 16 17 20 21 23 2d

^

5525 PLOT

200 сото 1

EE" » “H

vY“ THEN GOTO 5528

z528 FOR r=1 TO N

S838 LET XN-iXII)-XL)^(XH-XL) #41 SS4@ LET YN=(¥ (13 -YL}) 4 (YH-YL) #41 S560 PLOT XN,YN

36

Are you ready to put your ZX-81 to work On some tough processing prob- lems? Would you like to use your ZX- 81 in monitoring or control applica- tions? Then consider the Wisconsinc 16K/32K memory board with I/O ports.

The Wisconsinc memory board is de- signed for economy and flexibility. We offer kits ranging from a bare board and edge connector for the budget minded to a complete 32K with ports, aluminum enclosure, and a power Supply with sufficient capacity to source 500 ma to peripheral loads. All kits include complete schematic and instructions for the 32K with ports to allow easy expansion as your needs change. or as your budget allows.

Wisconsinc 5 I/O ports consist of two 8-bit LS TTL input ports and two 8-bit latching output ports. The ports are readily accessed using BASIC PEEK and POKE commands, or can be ac-

DON'T JUST EXPAND YOUR MEMORY. EXPAND YOUR HORIZONS.

cessed at very high speeds with user subroutines. The applications for ports are limited only by your imagination. With suitable external circuitry, they are useful for data acquisition and Storage, joystick interface, music synthesizer, realtime clock inputs, home security systems, environmen- tal monitoring and control, and much more. And the best part is that Wis- consinc s ports may be added later as the need arises; port kits come with headers and ribbon cables.

Even if you don t need the ports, you'll find Wisconsinc's 32K memory to be easy to use, requiring only two simply BASIC commands to move the stack and re-initialize your ZX-81, providing 16K for BASIC programs and 16K useful for large arrays and variables. This allows the use of large arrays and character strings, and will offer new possibilities in scientific and business applications, especially for engineer- ing or accounting students.

16K memory kit ............... $99 32K memory kit .............. $134 PORE Lssesssdueurruk versus $32 Bare board, connecter ......... $45 16K add-on kit ................ $35 Kit repairservice .............. $20

Wisconsin residents add sales tax. Please add $4.95 for shipping and handling. Check or money order only. Allow 4-6 weeks for delivery.

Get the most from your ZX-81, and put the world within reach of your key- board. Think about it. You can only do SO much with software. Sooner or later you Il wish you had ports.

WISCON

Wisconsinc Electronics PO Box 332 Milton WI 53563

SYNC Magazine

JRS SOFTWARE

x 19 WAYSIDE AVENUE, WORTHING, SUSSEX, BN13 3JU eo TELEPHONE WORTHING 65691 (Evenings and Weekends only) -—

As reviewed in ‘YOUR COMPUTER' . arch 1982

16K RAM PACK £35 ($69.95)

ASSETTE professionally recorded by SOUND NEWS STUDIOS

GAMES PACK Beat this for value! 5 x 16K ams PLUS 2 x 1K rams 3-D Battle (M/code-1K) Fast moving space battle with continuous count down Maa)

of energy units left City Bomb (M/code-1K) Destroy the buildings and land your plane Your tuel has nearly gone and you circle the city lower and l'ower

Warp Wars (Basic & M/code-16K) features realistic space craft moved by M code for

(previously sold at Microfair with instant response WHY PAY Sweet Tooth for £4.95) MORE Snake (Basic-16K) A game of thought and skill Pass through all the marked S

(previously sold at Microfair squares without crossing or doubling back on your path

for £3.95) but watch out for the expanding black blob

Sweet Tooth (Basic & M/code-16K) M code routines used to move your fat face round the screen and gobble the sweets

PLUS Slalom and Black Holes (previously sold together for £4.95)

An ESSENTIAL addition to your 1K RAM ZX81 (ог ZK 8K ROM)

(please which when ordering) TOOLKIT (written by PAUL HOLMES) Provides the following additional facilities

Line renumber yOu State starting number and increment value

Search and replace changes every occurence of a character as you require Free space - tells you how many free bytes you have left

SPECIAL GRAPHICS ROUTINES

Hyper graphics mode graphics never seen on a 2Х81 before

Open instantly sets up as many empty print lines as yQu require (1K version only! Fill used in conjunction with OPEN fills your screen instantly with your specified character

Reverse changes each character on your screen to 115 inverse video

TAPE ROUTINE - provides a system WAIT condition until a signal is received in the cassette ear jack - many uses !

Fully built, tested and guaranteed. No additional power supply required, black case

No wobble problems fully compatible with printer etc, etc (Please send large S.A.E. + 50p fora copy of 'YOUR OMPUTER' RAM pack reviews (March 1982)

Refunded when you purchase the RAM pack). Please allow 21 days for delivery

STOP PRESS

NOW AVAILABLE 64K RAM pack

All these routines are written in machine code and together take up only

164 BYTES of your precious RAM an incredible achievement!

The price i$ incredible too! ONLY £3.95 ($7.90) for cassette, including FULL instructions and example programs

ALSO available 16K version ONLY £4.95 ($9.90) which include. all the above PLUS GOTO's and GOSUB's included in line renumber

Search for and list every line containing specified character (56К useable) £75 inclusive $139 95

(NEW) GRAPHICS TOOLKIT (Another masterpiece by PAUL HOLMES) 22

exciting MACHINE CODE routines that give you control over your screén as never before ! (ZX81 - 16K RAM ONLY)

DRAW/UNDRAW draws or deletes your SCROLL facilities

multi-character shape which is defined in a REM UPSCROLL

statement. You may define as many different DOWNSCROLL Scroll your screen in the

shapes as you like and draw or undraw each at RIGHTSCROLL direction indicated

will at whichever screen position you choose LEFTSCROLL

FOREGROUND ON/OFF use this to ‘protect’ ONSCREEN/OFFSCREEN turns your screen on or

existing characters on your screen. When on new off

shapes will appear to slide behind and re-emerge BACKGROUND ON/OFF

from other shapes Fills your screen by your specified character. When foreground is on existing information is

BORDER/UNBORDER:'Draws a border round the unaffected and shapes will appear to pass in front

edges of your screen area. Edit lines can be used of your background, without deleting it

if required. Your border is protected when

foreground is on SEARCH AND REPLACE will search the screen fcr every occurence of the character you specify and

FILL Fills any number of lines you specify, starting replace it with your new character

at any line you specify, by your chosen character SQUARE draws a square or rectangle from your

REVERSE Converts all characters to their inverse specified co-ordinates

video, control as in FILL ALL these routines are in machine code for SUPER-FAST response ! Simply load GRAPHICS

PRINT POSITION CONTROLS TOOLKIT, which repositions itself at the end of

UP u | your RAM, and then your own program (or key in

DOWN After your next PRINT position in a new one), GRAPHICS TOOLKIT uses only 2K of

LEFT the direction indicated your RAM and that includes space to load the

RIGHT programmers TOOLKIT described above (16K

EDITPRINT Moves next PRINT position to first RAM version)

edit line

This includes a cassette with 2 copies of the program

ALL FOR ONLY £5.95 ($11.90) plus a comprehensive instruction booklet with (amazing value from JRS) examples NOTE: All prices are fully inclusive send checue or P.O. to JRS Software at above address

OVERSEAS солон» Payment may be made in Sterling (Money Order available at | Prices quoted above are also export PLEASE NOTE your bank) ou $U.S. (U.S.A. customers only). prices and include AIRMAIL postage

USE OUR PLANS AND SAVE $$$$$

SYN NCHBGNIRE YOUR SINCLAIR

KEYBOARD how to add a full-size keyboard to a ZX/80 or 81.Includes instructions on how to use any extra keys for Shift Lock, Automatic shift, Automatic Repeat, and Reset. $5.00

POWER SUPPLY Running a little hot? Design and build your own supply to fit your needs at a fraction of wired price. Includes how to estimate both present and future needs and

covers both single and multi-voltage. $5.00

BUSS Inexpensive exspansion system unlimits your edge connector. $3.50

JOYSTICK Add popular Atari joysticks and find out how much fun games can be. 2.

Send check or money order to:

SYNCHRONIZE Box 1667 Kerrville, Texas 78028

PM ENTERPRISES Proudly Announces The MX-48 48K Expansion Memory $169.00

COMES WITH POWER SUPPLY AND EXPANSION CONNECTOR

Other Fine Products

MX-16 EXPANSION MEMORY $89.95

2118-7 16KXI MEMORY 1.С. $ 5.80 12VDC FILTERED POWER SUPPLY $19.95 WIRE-WRAP_SOCKET MODIFIED

FOR ZX81 | $ 7.50

48K and Power Supply Available June 1st.

Please Add $3.00 Shipping and Handling.

PM ENTERPRISES

4102 N 325 W LAPORTE, IN 46350 (219) 326-7923 M.C./ CHECK/M.O./VISA/C.O.D.

EZRA GROUP II EZRA GROUP II

The ZX81/80's are making a name with LOW prices...

WE CHALLENGE THE SOFTWARE COMPANIES TO LOWER THEIR PRICES!

for ZX81/ZX80/8K ROM 1K and 16K RAM versions

BIOHInVItiS. iexaseaheuwastsxenawtuk rema tarkas 1.00 Graphics Billboard

Horse Насе......................................... 1 00 SPINNER TM. (like Rubik's) 16K.

Skew-a-Sketch (like Etch)

Improved Pause (ZX81)

Linear Ќедгеѕѕіоп. .................................. 2.00 Linear Programming

Shootist

Self Addressed Stamped Envelope Gets YOU our Goodies Catalog

ALL ORDERS AND CATALOG REQUESTS GET FREE Galactic Messages PROGRAM.

EZRA GROUP II EZRA GROUP II

P.O. Box 5222 San Diego, California 92105 (714) 584-8291

4K ROM 16K RAM 4K RAM

An Alternative Display Method

- Tank Battle

Drew Nisbet

Perhaps the greatest inconvenience presented by the ZX80 to the person programming in Basic is the loss of video which occurs whenever the CPU is other- wise occupied. While you are sitting. perhaps not so patiently. waiting for a display to appear. the amount of time that the screen is blank seems much longer than it actually is. This may be only mildly Irritating when the program does not depend on user interaction. However. if the program involved is a board game which requires that an ever-changing playing arena be displayed repeatedly and that the program interact with the player to some degree. then periods of time spent before an unimpressive. grey screen can be fatal to the attention span of the player.

The majority of board games written in Basic for the ZX80 display the playing surface by storing print codes in an integer array and printing each member of this array by means of a FOR/NEXT loop. Any change on the board. such as the movement of a token or the destruction of a coordinate. requires that the screen be cleared and that the display be re- created. Generally speaking. the larger the playing surface of a game. the better. but displaying a board which uses a large portion of the screen area by the method noted above сап take up to 30 seconds. Add to this the time required by the computer to perform any calculations which are required between displays and you may wind up with the plug being pulled on your program! In addition. any prompts or messages displayed for the players information must be kept to a minimum. or the playing surface must again be cleared in order to accommodate them.

Drew Nisbet. 6 Moffatt Court. Toronto. Ontario.

Canada, M9V 4E1

38

Figure 1: Token Use Directions.

Symbol Meaning

+ Ávailable coordinate

E Destroyed coordinate

H Location of player's tank

> Location of computer's tank ?

Inverse X* Inverse C

Player's tank destroyed Computer's

о о

tank destroyed

° Displayed at end of game

Although the most valuable use of the PEEK and POKE commands may be to program and debug ZX80 machine code programs. they are extremely valuable when employed in any Basic program as tools for both examining and altering memory location contents. After an initial display has been created on the screen. it may be examined or altered by PEEKing or POKEing memory locations relative to

the address stored in the D-FILE pointer

(located in the two bytes starting at address 16396). The game program which follows makes extensive use of this function. The screen display for Tank Battle is divided into two sections: the playing surface. or board. which occupies two thirds of the display. and a "message center"

Figure 3: The Tank Battle Program.

10 RANDOMISE

20 LET HO = RND(9) х 10 + RND(9) 50 LET HV = RND(9) 10 + RND(9) 40 LET HN = 0

950 LET CM = I

70 LET SH = 0

80 LET AS = "COORD:" 90 LET BS = "YOU WIN” 100 LET CS = "] WIN” 110 LET DS = "] FIRED" 120 LET ES = "FROM"

+

which makes use of the remaining third of the screen and is located to the right of the game board. This arrangement affords the largest square playing area available. The two sections are prominently separated by a black line. The PRINT command is not employed after the initial playing board has been displayed as all alterations to the playing surface are made Бу POK Eing character codes into memory. АП prompts and messages are displayed and erased in the same manner. The longest period of time during which the screen is blank is approximately five seconds. the amount of time depending on the number of lines which must be deleted from the message portion of the screen.

player's last coord=dummy player's 2nd last coord-dummy player's last move

computer's move

computer's target

“#” represents a space “@” stands for the character shifted “Q”.

SYNC Magazine

Figure 3 (continued)

150 LET FS = ID

140 LET 6S = "PLAT:"

50 LET HS = "TIE GAME 160 LET IS = "GAME OVER” 170 LET Jẹ = “AGAIN

180 LET D = 5 player's beginning row 190 LET E = 8 player's beginning column 200 LET HL = 58 player's beginning coord

210 LET CL = RND(9) + 10 + 1

220 PRINT "3HHHHITANK BATTLE IBHICHPLAY : THEA” 250 PRINT "dHrliHibibibiEilr IRISH FI TAH C RRR EH TP ETRE IET 240 PRINT "4t";

250 FOR ] = I TU 9 260 PRINT "#";1; 210 NEXT J

280 PRINT "ЖСР HEHE TE Si HES

290 PRINT 7яННННЕННННННЕН НЕНЕН Е ҤНЕЕЕННЕНЕЕ” 400 FOR | = 1 TO 9

510 PRINT J 3 "ЕРЕ d+ ake de eb hip de EU 520 PRINT "dnHkiBEBHIHHEIEHNHBHEBEHIEHBBEI Caki iriri Pp T $50 NEST i

: $55 FOR I = 1 TO 22 cone uA S 336 PRINT CHRS(121); | уу... | ш; 337 NEXT 1 тое боз 12435 $40 LET Р = 67 + 66% ре E * 2 3166 ++++ ++ | | FIRED 350 LET M = 45 '"HU + +++ + M | FROM 62 560 GO SUE 1600 print player's location + Tren TO 68 570 INPUT М5 input play т, s 380 IF NOT «MS = "M" OR MS = "S" OP if invalid ask again з d MS = "") THEN GO TO 370 | 8 + + + + + + + + о, ,,.,., 590 IF MS = "" THEN GO TO 800 if end of game branch 600 LET P = 29 print play selected 410 LET M = CODE(MS) 420 GO SUB 1609 430 LET P = 89 print “COORD: ` 440 LET TS = А$ | | 450 GO SUB 1910 Figure 2 shows the screen layout after 660 INPUT C јара свого both the player and the computer have 695 LET D = - £ 1D ni taken several turns. The drawing is not to &ED LET E = C - D & 10 AC ORNA scale as the playing board is really double (90 IF D « 1 OR 9 ORE« 1 OR 9 if invalid coord ask again spaced both vertically snd horizontally. THEN GO TO 460 | The . which does not print on the screen. 500 IF MS = "S" THEN CO TO 660 if shoot branch is the point from which all PEEKing and 510 LET G = HL / 10 player's row POKEing is done in order to examine or 520 LET H= HL- G * 10 player's column | alter the board contents. The address stored 530 IF ABS(G - р) > 1 OR AàES(H- Е) > 1 if illegal distance ask again in the D-FILE pointer and 67 (32 print THEN GO TO 4€0 codes plus 1 newline character times 2 9340 LET P= 67 + 66 * D+E * 2 plus | print code on the third print line 550 IF PEEK(PEEK(16396) + PEEK(16397) if illegal coord ack again equals 67). The address for any coordinate * 256 + P) = 128 THEN CO TO 460 on the board is determined by multiplying 960 GO SUB 1620 the row coordinate by 6 (2 times 32 print 970 LET P= 67 + 66 * G+ H * 2 codes plus | newline character). adding 2 S80 LET M = 19 bad times the column coordinate (for the 370 GO SUB 1600 blank player's old position horizontal double spacing) and adding 67 600 LET HL = : ЕС соога = new coord (for the reference point) to the contents BI MET P = М AR AP EJ E | of the D-FILE pointer. Alterations to the ile SUN З А mE | . АКША . 650 GO SUB 1600 display playor' s new position | message portion are accomplished by ; Е i | = р TERNI e rt 640 LET HM = 1 play = move POR Emig ше appropriate character cot 650 GO TO 890 branch to computer's turn into memory locations relative to the 660 GO SUR 1620 gressus edd contents of the D-FILE pointer. 670 LET P = 62- 66 D* E 2 i The program uses the subroutines at 680 LET M - 128 m lines 1600 and 1910 to accomplish the 690 GO SUB 1600 display hit coord above. The subroutine at line 1600 alters 700 LET HM = 2 play = shoot any memory location by POKEing a T10 LE? HD = HL let old coord = present coord character code M into the location relative 720 GO TO 890 branch to computer's turn to the contents of the D-FILE pointer by 730 LET Р = 352 an offset of P locations. The subroutine 740 LET T$ = JS print 'GAME OVER‘ at line 1910 POKEs the message codes 750 GO SUB 1910 into consecutive memory locations by 760 INPUT YS input yes or no

May/June 1982 39

examining the strings (TS) one character at a time. Lines 1430 - 1560 POKE zeros «code for a space) into any line which contains non-blank characters in the message portion of the screen. The routines located at lines 1620. 1690. 1970. and 2010 display the coordinates selected by the player. the shots fired by the computer. the player's tank when destroyed and the computer's tank when destroyed respec- tively.

The game itself was inspired by Lloyd Johnson's article "Paint Duel" in Creative Computing (July 1981). The player attempts to destroy the computer's tank by hitting it with a well-placed shot. The two plays available are Shoot or Move. The player's initial location is row 5 column 8. The computer tries to destroy the player's tank in turn. The starting location for the computer's tank is in the first column and a random row. After specifying the play selected the computer requests the coor- dinates of the target and then displays them in the message portion of the screen. A shot shows up on the screen as a "EJ" placed at the coordinates specified. A move is legal only if made to a coordinate directly above, below. left of. right of. or diagonally adjacent to the present location. A tank may not move to a coordinate which has previously been shot at.

The computer's play is determined by the following odds:

1) 10% chance it will do nothing.

2) 10% chance it will shoot.

3) 70% chance it will move if it shot last turn.

4) 70% chance it will fire if player shot last turn.

5) Move.

These odds can be altered by changing the values in lines 890 - 920 of the program. The computer is prevented from firing at a coordinate which has already been shot at by PEEKing into the memory location for the coordinate selected and comparing its contents to 128 (black square). The tanks are prevented from moving into a hit square in the same way. Both the players and the computer's plays are completed simultaneously. which allows the possibility of a tie game if both tanks are destroyed on the same turn. Each player learns of the position of the oppo- nent's tank only if he is fired upon. If the computer decides to shoot. it will place its shot into a coordinate which it knows the player may have moved to. To end the game press NEWLINE when requested to play.

Ed. —For those who do not wish to enter the listing, it is available from the author on cassette. Write for information. "a

40

920 930 940 950 960

970 980

990 1000 1010 1020 1030 1040 1050 1060

1070 1080

1090 1100 1110 1120 1150 1100 1150 1160 1170 1180

1190

1200 1210 1220 1220

1240

1250 1260 1270 1280 1299 1500 1310

1520 С

1540 1540 135

1560 1570 1580 1390

Figure 3 (continued)

IF YS = “N” THEN STOP

CLS

RUN

LET D = CE Z 10

LET E = DL = D. * 10

LET P= 67 + 66 * D +62 2 LET M = 40

GO SUB 1600

LET Р = 287

ЕР TS Is

GO SUB 1910

GO TO 730

LET X = RND(10)

IF 9 THEH GO TO 1140

IF X « 2 THEN GO ТО 1020

IF CM = 2 AND RND(10) > 3 THEN GO TO 920

IF HN = 2 AND RND(10) > 3 THEN СО TO 1020

LET D = CL / 10

LET E = С = D 10

LET 9. D + RNDCS) = 2

LET T = E + RNDCS) = 2

IF S&S « I DR 5 > 9 OR T « 1 DE T > 9 THEN GO TO 940

LET P = 67 + 66 я 65 + T # 2

If РЕЕК(РЕЕК 16396) + PEEK( 16397)

* 256 + P) =

LET CL S x I0 * T LET CM 1

GO TO 1140

LET D = HV / 10

LET E = HV - D ғ 10 LET S = D + RND(3) LET T = E + RND(3)

= 2 = 2

128 TEEN GO TO 900

IF >< 1 OR S> 9 DE T « 1

OR 9 THEN CO TO 1040

67 + 66 + S^ T ¥ 2

IF PEEK{PEEK( 16596) + PEEKCL6297)

LET P

> 256 + P) = LET SH- S х 104+ T LET M = 128

GO SUR 1600 GO SUR 1690

128 THEN GO TO 1040

LET АЙ 2 IF HM = 2 AND С = CL THEN GO TO 1170 IF CM = 2 AND SH = HL THEN GO TO 1230 GO TO 1390 IF CM = 2 AND SH = HL THEN GO TO 1230 GO SUE 1970 LET P = 287 LET T$ = BS GO SUE 1910 GO TO 730 GO SUB 2010 LET P = 287 LET TS = CS GO 508 1910 LET D = CL 10 27-Е = CL = ж 10 LET P 67 + 66 "D +E = 2 LET M = 40 GO SUR 1600 СО TO 730 GO SUE 1970 GO SUE 2610 LET P = 287 LET 15 = H$ GO SUB 1910 GO TO 739 LET P = 287

stop if no replay

run if replay

display computer's location

print ‘GAME OVER"

ask for replay 10% 10% 70%

do nothing shoot

move

chance to chance to chance to 70%

chance to shoot

computer moves

if invalid coord

if illegal coord

computer's new location c

computer's play = move branch to request next play

computer shoots

if invalid coord

if coord already hit

coord of target

"ре"

display computers shot computers play = shoot

if computer's tank hit if player's tank hit if no hits if both hit display computer's hit tank print 'YOU WIN’ branch to ask for replay

display player's hit tank print ']

display computer s location

C»?

branch to ask for replay computer's hit tank

"= hit tank

display display player print 'TIE

branch to ask for replay

SYNC Magazine

———M——ÀÀ——— c FE 3 (continued)

1500 LET TS = GS

1410 GO SUB 1910

1420 INPUT MS

1430 LET М = 0

1440 LET P = 29

1450 GO SUB 1600

1460 LET P = 89

1570 IF NOT PEEK(PEEE(16296) + PEEK(16597) * 256 + P) = 0 THEN GO TO 1500

1490 LET Р = P + $3

1490 GO TO 155

1500 FOR 1 = 1 TO 8

1510 POKE РЕЕК( 16596) + PEEK(16397) * 256

1520 LET P= P = ]

1530 NEXT |

1550 LET P = Р + 25

1550 IF Р > $20 THEN GO TO 1570

1560 GO TO 1470

1570 LET HV = HO

1580 LET HN = HM

1590 GO TO 380

1600 POKE PEEK(16396) + PEEK(16397) и 256 + Р.И

1610 RETURN

1620 LET P = 95

1630 LET M= D + 29

1640 GO SUB 1600

1650 LET P = Р +]

1660 LET M = E + 28

1670 GO SUB 1600

1660 RETURN

1690 LET P = 155

1700 LET TS = DS

1710 GO SUB 1910

1720 LET P = 188

1750 LET T9 = ES

1740 GO SUB 1910

1750 LET P = 193

1760 LET M = CL / 10 + 28

1770 GO SUB 1600 .

1780 LET M = CL = {CL / 10 ) * 10 + 28

1790 LET P e P œ+]

1800 GO SUB 1600

1810 LET P = 221

1820 LET TS * FS

1850 GO SUB 1910

1840 LET P = 224

1850 LET M= 5 + 28

1860 GO SUB 1600

1870 LET M= T + 28

1880 LET P = P + 1

1890 СО SUP 1600

1900 RETURN

1910 LET M = CODE(TS)

1920 GO SUB 1600

1950 LET TS = TLSIETS)

1940 IF TS = "" THEN RETURN

1950 LET P = P + ]

1960 GO TO 1910

1970 LET P = 67 + 66 * TCL / 105 + 2 * (LL = (CL Z 10) * 103

1980 LET M = 168

1990 GO SUB 1600

2000 KcTURN

2010 LET P = 67 + 66 * (HL / 10) + 2 * (HL = (HL 7 10) * 10)

2020 LET М = 148

2030 GO SUB 1600

2040 RETURN

SYNCSUM = 125 4K ROM 4K RAM

May/June 1982

print

"PLAY: "

input

p ] ау

blank

out old play message

blank eut all messages

lines which are non-hlznec

+ PIU

2nd last play = play

last location = last yo display next play

poke character code in memory

poke coords in message section

display computer's shot

print '] FIRED’

print ‘FROM’

print coords

print ‘TO’

print coords

print first character of string

shorten string

if all done return

branch to print next character

print computer's hit tank

us

inverse

print player's hit tank

" * Li inverse >

Z80 TUITION

USING A 1K ZX81 FOR MACHINE CODE PROGRAMMING

8 Part fortnightly postal course also includes details for adding RAM EPROM HEX KEYPAD LCD DISPLCD DISPLAY & PROM PROGRAMMER.

Course price $49.00 U.S.A./Canada £21.95 U.K.

Or send $3.50/£1.50 for 280 Instruction

Codes and Course Syllabus.

ANDOVER SOFTWARE KITS

15 Winchester Rd., Andover. Hants SP10 2EG. England.

ZX-81/1K

LISTINGS OF 5 GAMES $2.00

Z—GAMES P.O. Box 267 Ringoes, N.J.

08551

Searching for software? Get

creative computing

1982 Software Buyers Guide!

The new 1982 SOFTWARE BUYERS GUIDE from the Editors of Creative Computing gives you all the facts you need to make the right software purchasing decisions. The BUYERS GUIDE covers applications and systems software, with reviews of more than 150 programs! There’s even a Directory of Manufacturers, cross-referenced to type of computer.

Get the information you need and save time, trouble and money. Get your copy of the 1982 SOFT- WARE BUYERS GUIDE today!

Only $3.95!

creative compatiog | SOFTWARE < BUYERS GUIDE 1

Software Buyers Guide P.O. Box 340 Broomall, PA 19008

Please send me the Creative Computing 1982 SOFTWARE BUYERS GUIDE. | enclose $5.00 ($3.95* plus $1.05 postage and handling). $6.00 outside U.S.A.

Mr./Mrs./Ms. .

(please print full name) Address Apt. City State/ Zip

* Residents of CA, CO, CT, DC, FL, IL, MA, MI, MO, NJ, NY State, OH, SC, TN and VT please add applicable sales tax.

41

[ESOUICES —À|

Users Groups

Central Pennsylvania Interest Group

Meets every Tuesday at 8:00 p.m. 321 Bouche Bldg., Penn State U. Campus, State College, PA. Initiator: Bill Russell. Phone: 814-364-1325.

Club ZX 80/81 Chemin du Moulin 38 B - 1328 OHAIN Belgium

SAM BAM (Sinclair and MicroAce Bay Area Microcomputer Users). Users "living in the Golden Triangle around Tampa Bay and along the golden suncoast of Florida" are invited to write for infor- mation. Locating users in the area is the immediate task.

SAM BAM

c/o Mel Routt

PO Box 596

Safety Harbor, FL 33572

Memphis, TN, ZX81 Users Group just getting started. Contact: James Barker 3791 Barron Ave. Memphis, TN 38111 Phone: (901) 327-2158

Voltage devices

VOTEM for ZX81/ZX80. 8K ROM.

Read voltage and temperature with extremely high sensitivity. Voltage range easily adjusted for wide variety of applicat- ions; temperature range: -25 to 125 C; self-contained and low power unit attaches directly to ZX80/81 with no hardware modifications; all calibration done in software; audio and visual tape load monitoring capability; circuitry for am- plifying and conditioning tape signal. Software runs in IK RAM. Kit, $39.95; assembled and tested, $59.95.

Down East Computers

PO Box 3096

Greenville. NC 27834

Protect all ZX80/81 ICs if voltage regulator fails by crowbar and fusing. Schematic. $2.00; with parts. $15.00. Schematic for precision setting of cassette output level.

$2.00.

Arnold J. Gold 820 Prospect Ave. Hartford. CT 06105

42

Books

Word Processors & Information Proces- sing: A Basic Manual on What They Are and How To Buy. by Dan Poynter. $11.95 from:

Para Publishing

PO Box 4232-88

Santa Barbara. CA 93103-0232

Phone: (805) 968-7277

Memory Expansion

RKL-16K RAM. $79.95; expandable to 32K whenever desired. RKL-32K RAM, $149.95. Upgrade 16K to 32K. $79.95. Add $4.95 s&h and 5% tax in Mass.

RKL Systems

PO Box 515

Leominster, MA 01453

Joysticks

RKL-J1, single joystick system. $69.95; RKL-J2. dual joysticks. $89.95. Upgrades: RKL-U2. adds RKL-J1 to RKL-32, $59.95;

RKL-U3 adds RKL-J2 to RKL-32, $79.95.

Add $4.95 s&h and 5% RKL Systems PO Box 515 Leominster, MA 01453

tax in Mass.

Publications

SYNCHRO-SETTE. a monthly magazine with bi-monthly cassette containing at least six programs for the ZX81 or ZX80(8K КОМ) user. One year. $39.50. Visa and MC. For more information call 24 hr. toll- free hotline. 800/543-1300 (in Ohio. 800/582-1364). ask for operator 383.

S & S Company

388 W. Lake St.

Addison. IL 60101

Phone: 312/628-8955

Micro Moonlighter Newsletter wil provide techniques. tips. and guidance to those who wish to make money with their computer knowledge. Among the topics: Marketing methods. advertising hints, the ins and outs of contracts. books. Sub-

scriptions: $25 for 12 issues ($29 in Canada; $35 worldwide). Visa and Master Charge welcome. Send inquiries to:

J. Norman Goode

2115 Bernard Ave.

Nashville, TN 37212

/ ХІ Sourcebook (TM)

A catalogue listing software and hard- ware for the 4 Х81. For information on getting listed and getting copies. contact:

Micro Design Concepts

PO Box 280

Carrollton, TX 75006

The Index covers over 40 magazines and newsletters in the home/personal computer marketplace and includes over 12.000 articles indexed by using the key words of the titles. For information and ordering contact:

Missouri Indexing, Inc.

P.O. Box 301

St. Ann, MO 63074

Phone: (314) 997-6470

ROM Disassembly

The ZX80 IK Disassembler for the 4K ROM ZX80.

The ZX61 IK Disassembler for the ZX81 and 8K ROM ZX80.

To begin disassembly of ROM or MC program, enter starting address, a key is calculated and displayed. manual then give mnemonic, all numbers displayed in deci- mal, about 100 bytes of RAM to store MC program for disassembly; RAM mem- Огу test provided; addresses of bytes failing the test are displayed. Manual. reference cards, and cassette with the disassembler and memory test programs. $9.95 pp. Further information and catalog upon request.

Lamo-Lem Laboratories

Box 2382

La Jolla. CA 92038-2382

Programs

8K ROM; 16K, IK. Games, utilities, tech prog.. household. and more. For details send SASE to:

NGM INC.

PO Box 18702

Okla City, OK 73154 a"

SYNC Magazine

Software Review

ZX Galaxians martin wren-Hilton

к= | SOFTWARE PROFILE Name: ZX-Galaxian Type: Arcade fantasy

System: ZX81; ZX80 8K ROM, SLOW mode; 4K RAM

Format: Cassette Language: Z80 Machine Code

Summary: A challenging game and a good implementation of the arcade game

Price: £3.95; £1.00 s&h for U.S. Manufacturer:

Artic Computing

396 James Reckitt Avenue Hull, N. Humberside HU8 OJA United Kingdom

ZX81 OWNERS with 16K RAM! IT'S READY---ARE YOU?

$14.95 + 2.50 S&H

QUT FIG).

If so, you get: *24-row/full-screen displays *Nearly 2K of machine code

for FAST real-time graphics

*A 4K Star Atlas as the moving backdrop during enemy engagements

ZX-Galaxians is a good adaptation to the ZX81 of the popular arcade game of the same name. You are being attacked in deep space by formations of hostile Galaxians, and it is your mission to prevent them from attacking Earth by zapping them with your laser gun as they break out of formation and hurtle towards you.

After being loaded, the game runs automatically. The title appears in large letters at the top of the screen, a bit of information about the game is showu, and you press any key to start. Four rows of eight galaxians appear hovering above your base. On the right side of the screen you will see the details of which buttons to press, what the current score is, what the high score is together with the name (up to six letters) of the high scorer, and a graphical representation of how many ships you have left.

Martin Wren-Hilton, U.K. Correspondent to SYNC, 4 Little Poulton Lane, Poultonle-Fylde. Backpool, FY6 7ET, United Kingdom.

*9-еасһ fuel and skill levels that

The thirty-two galaxians move left to right and back again. Your controls are 5 for left, 8 for right and 0 for fire. Occa- sionally one or more galaxians break out of the formation and dive about the screen, dropping bombs as they go. You get 10 points for each galaxian shot in formation and 20 points for those shot in mid-flight. The movement of your base is very smooth due to good use of the ZXSI's graphics. When your base gets hit either by a galaxian or by a galaxian's bomb, the explosions are quite good.

Unlike the real Galaxians (TM), this game does not have the starry background. In addition the formation is rectangular. The letter "V" is used to represent the galaxians, and those flying around the screen are made up from the graphic symbols on letters Q, W, E and R, de- pending upon their direction of flight.

If you are a keen arcade player, then ZX-Galaxians is for you. It is the best version of this game that I have played, and makes good use of the ZX81’s graph- ics. a”

16K Programs for either ZX80-8K or ZX8l

*PLANE FRAME-modelling for engineers

*FUNDAMENTAL ANALYSIS-for stocks investors

*POLSAT & GEOSAT-space age Ham Radio uses

*MATH PAK-Routines & Fit, Variance Analyzer, Statistics, and RPN Calculator

, *E.S.P.-test your precognition *Many others plus 6 1K 6-paks

including Machine Code

WRITE for free catalog. (In Europe, send U$1 bill or DM2 stamp: DELTASOFT/Osterfeldstr.79D/D-2000 Hamburg 54 GER)

Mail coupon or copy with payment to:

1 ] li 1 Hu vos T АГИ га inl ИЙ © IZETA Software/PO Вох 3522/Greenville,SC 29608 no gun power, or no shields. 1 way & | to win----destroy ALL enemy craft. £ A M is 5... сеек a E *An enemy data generator imbedded in ^ ifor —— copy(ies) of SCOUT FIGHTER 2X81 16K the run as part of the "action" Sd jplus $2.50 S&H for the order, *'Blink"-less pauses in BASIC ee | NAME *Stick-on/peel-off custom keys x > *In-depth booklet explaining both са Ф | ADDRESS the "game" and the program о 5 | *Shipped on a certified cassette CITY/STATE/ZIP

1 copy each side

Please allow 4 weeks if paid by check.

May/June 1982 43

4K ROM 1K RAM

Since I have always loved video space games, I have been looking for some game that could possibly fit into my limited 1K of RAM. The product of several hours of often exasperating labor is Space Warp, which runs in 1K without any problems if entered as specified.

The objective of Space Warp is to reach your base before running out of fuel. In order to do this, you must think ahead and consider how your speed will affect your fuel consumption. The distance to the base is 1000 miles, and you have 100 fuel units initially. Your speed, measured in warp factors as per Star Trek, has a direct bearing on your fuel consumption. Warp factors range from 1 (slowest) to 15 (fastest). Each turn, you will be asked to enter a warp factor. A read-out of fuel remaining, distance remaining, velocity, and warp factor as of last turn is also displayed. After entering the warp factor, you will be asked “DIRECTION?” Input F to move forward towards the base or R to reverse.

Armando Fox, 62-23 Cromwell Crescent, Rego

Park, NY 11374.

S PACE WARP 27s A e aU LE X" 2 3 HRS G i "ns С^ gum Ё EE i i © i ae hee m ы ses WR

Armando Fox

The reason for reversing will be discussed below. When this has been done, one of two things will happen.

If you are unlucky, an enemy satellite dispatched from a nearby base will harass your approach. This will appear as a double asterisk (**) at the rightmost edge of the screen. If you do not watch out for these satellites, they “eat” a random number of fuel units. This is often the downfall of many players. However, if you are going at warp 7 or less, you will be asked “RETREAT?” Answer Y or N. If you retreat, you will of course lose distance as well as fuel, but the enemy satellites cannot harm a retreating ship, so retreating does pay off as a strategy technique. If you decide to retreat, the appropriate fuel (and distance) will be added into the next calculation; if you decide not to, the enemy satellite will “eat” a random number of fuel units.

Next (or first, if no satellite came after you) the screen will clear and then redisplay, hopefully with your ship farther over to the right, indicating that you have moved

ZX81 PERSONAL BANKING SYSTEM

WITH LOAD/SAVE DATAFILES AT DOUBLE SPEED

closer to the base. The readout will again be displayed, and the “WARP” and “DIREC- TION” prompts will wait for input.

This turn sequence continues until one of three things happens:

1) You reach the base and stil] have fuel, and the message "HOME FREE" will appear near the center of the screen.

2) You will reach the base without any fuel, drift, and collide with it—your ship will break up into several pieces.

3) You run out of fuel before reaching the base, and the game will stop with error code 9/460. If you want to know how far you actually travelled, subtract the distance on the screen from 1000.

Entering the Program

This program runs in 1K, but it must be entered in two parts. The first part is the "set variables" section shown in Listing 1. Enter this short program and RUN. Enter the following values to be POKEd to the REM statement in line 1: 0, 3, 10, 0, 0, 132, 128, 150, 139; 10, 0; 132, 3, 133, 6. Then hit LIST. Line 1 will look like a jumble of graphics symbols; these draw the ship. Now delete lines 40 through 70 (not 1 through 30) and continue by entering the main program in Listing 2. To run the program, simply type RUN; since the graphics are stored as a REM statement, there is not much that can cause these variables to be cleared, except for NEW.

"n

Load the program in the normal way—enter, amend or delete your transactions (ZX81 will automatically scan standing order file and post any items due)—save the file of data onto cassette in 45 seconds—load a different datafile into the same program, also in 45 seconds—enter Items, etc.—save datafile only onto cassette (45 seconds)—repeat operation for any number of accounts.

Absolutely no need to save program, as all information is held in data- files. Very easy to use—unlike other bank accounts. Requires a mini- mum of 16K RAM—can use much more (no modification required).

On Demonstration at the next ZX Micro Fair.

The personal Banking System also includes the following features— Full page detailed Bank Account, dual display (or printout). Automatic generation of standing orders on due dates.

Validation of all entries.

a any item previously entered. (Single/Multiple field correc- tion

Enter an item (previously omitted) in the correct date order of the account.

Single key operation. Utilises a M/C keyboard scan.

Search for any item or items by cheque number, description or amount—display (and printout if required) with totals.

Continuous display of statement extract, continually updated dur- ing input of entry.

File of standing order details can be displayed, printed, added to, cancelled and amended.

Detailed User Manual.

After sales maintenance.

Send £9.95 ($20) incl. for cassette and users manual to J.P. Gibbons A.I.B., 14 Avalon Road, Orpington, Kent, BR6 9AX, England. (Send large S.A.E. for details).

There are only two suppliers of supported ZX81 software, this is one of

them. Be sure to include your name and address.

Coming soon: Bank Reconciliation Module—a separate program on cassette that utilises data supplied by the main program (S.A.E. for full details). The only expandable system for the ZX81.

The Personal Banking System is also available from the Buffer Shop,

Streatham, London and Branches of the Computer Bookshop Group, full maintenance still available.

KOPAK GIVES YOU THE POWER!

KOPAKTM is now offering The Source* ‘America’s Information Utility’. The Source* gives you the power to access a wide array of services including: e Barter Shopping * Business Infor- mation e Career Network * Electronic Mail e Medical Advice e UPI News $9.95 Service and much more. A modem is required to use The Source*.

Source ID $100.

KOPAK'STM Touch-A-Matic gives you the power to type more accurately and much faster. No wires, no soldering, simple to install. Our unique vinyl over- lay guides your fingers to the correct keys. Touch typing now possible with your Sinclair* or MicroAce* !

The KOPAKTM Sinclair* female Con- nector gives you the power to use the 2-80 bus. Edgecard connectors specif- ically made for Sinclair* computers. e 46 Pins, 23/23 * All pins are gold plated e polarizing pin for correct alignment everytime! Available with The KOPAMATICTM Keyboard Solder-Tail, Wire-Rap and PCBoard. The KOPAKTM Printer

$14.95 KOPAKTM Memory Products The KOPAKTM Disc

More POWER on the way! KOPAK'STM Coming Creations:

The KOPAKTM RS-232 Interface

The KOPAKTM Bus

‘KOPAK has the POWER to deliver! Order by Phone or Mail,

Charge it with MasterCharge or Visa © 1982 KOPAK Creations Inc.

KOPAK Creations Inc. TM Trademark of KOPAK Creations Inc. Dept. SY sinclair* is a trademark of Sinclair* 448 West 55th Street Research LTD.

New York, NY 10019 MicroAce* is a trademark of MicroAce* (212) 757-8698

Listing 1: Setting the Variables. Žž ——————— ——— Sample Run

1 REM XXXXXXXXXXXXXXX (15 X'a) 40 FOR X=16427 TO 16441

10 LET D=1000 SO INPUT Е 20 LET Dzzo 60 FORE X, Е 30 LET F=100 70 NEXT X WARP? —— 6 (NL) DIRECTION? Listing 2: Space Магр. | F (NL) ee aca оа (screen cleared) 110 INFPUT W 380 PRINT CHRE (PEEK (16426+N)); WARP FUEL VELOC 120 IF W15 OR Wei THEN GO TO 390 NEXT X 2 do 27 110 400 РКІМТ 7 ш 130 PRINT "DIRECTION?" 410 LET X=X+4 140 INFUT D$ 420 NEXT X 150 IF NOT (D£$-"F" OR D$-"R") T 425 FOR L=1 TO 25 HEN GO TO 140 420 PRINT "d"; 200 LET FzF-UWXRND CX) z5 NEXT L 210 LET V=(W/2) * CRND(S) +5) 440 FRINT CHR (5) 220 LET різу (ило) 50 IF S THEN GO SUR 600 230 IF D$z"R" THEN LET Di--Di 460 IF Fei THEN STOF WARF? 240 LET р=р-рі 470 IF Dei THEN GO TO 500 10 (NL) 250 LET So 480 GO TO 100 DIRECTION? шо IF RND(6)=6 THEN LET S-226 500 PRINT , "HOME FREE" F (NL) 270 LET D2=D2+Di 510 STOF 280 IF DJO THEN LET Dzo 600 IF W7 THEN GO TO 660 (screen cleared) 290 CLS 619 PRINT "RETREAT?" S00 PRINT "WARP", "FUEL", "VELO 620 INFUT D$ WARP FUEL VELOC C^, "DIST", Wy Е, V, D 630 IF D$-"N" THEN GO TO 660 10 572 40 AO FR INT 640 LET р=р+уж (W/ 2) 330 FOR X= -4 TO 6 645 LET F=F—-W 340 FOR J=i TO D2/40 650 GO TO 670 350 PRINT "st"; 660 LET F=F- (RND (5) X ZU) 360 NEXT J 670 RETURN

THE EXPLORER'S GUIDE TO THE ZX81

If you have ZX81 then you need this book (120 Pages).

1K and 16K Programs. Games and Application. RAM and I/O Circuits. Programming Hints ROM Routines.

$11 from:

TIME DATA 3-Waldon Road . Califon, N.J. 07830

Enclosed | | | | Check/MO. Name

Address |. |. | City |. | | Stete | Zip

TURN YOUR COMPUTER INTO AN ELECTRONIC WORKSHEET!

NEW SPREAD SHEET PROGRAM FEATURES:

Z 27 COLUMNS X 40 ROWS . „АШ NORMAL CALCULATOR FUNCTIONS . ЁК .PLUS TIME SAVING SUMMATIONS С OF ROWS AND COLUMNS .

e SPECIAL SAVE FUNCTION . e MENU DRIVEN . e ON CASSETTE WITH USERMANUAL . FOR ZX-81, 80 (8K, 16K) .

PRICE: $16.00 ADD $1.50 POST. & HANDLING MAIL CK. OR M.O. TO:

SOFTWARE APPLICATIONS Р.О. BOX 1922 ATASCADERO, CA. 93423

ананан te t BA Бы ананан ар аайын QUU UU, UU EO AR UU UB GUN ы и ы UI ка QU UU, UO M, MR tu JN M

4K ROM 1K RAM

Storing 3-Letter Words in an Array

I wanted to develop a method of storing as many three-letter words as possible in my ІК ZX80, using as little memory as possible. The solution is based on the fact that character numbers of the letters can be compounded into a single number, which can be stored in an array element. Thus three letters can be stored in two bytes.

Listing 1, The Word Storing Routine, sets up arrays which are used in Listing 2, The WORDY Program.

The technique takes the character numbers of the letters in a word; subtracts 36, then multiplies by 1 for the first letter, 30 for the second letter, and 900 for the third. Then the three are added together so that they can be stored as a single number, which must not exceed 32767, hence the -36 in line 14. Line 18 ensures that a space keeps its code number of 0, and a nul string is treated as a space. This allows one- or two-letter words to be stored if desired.

Line 20 does the multiplication and addition, and the numbers representing the words are stored in Array S(). The maximum number of words this program can hold is 175.

When the words have been stored, the whole of the word storing routine can be deleted. But remember never use RUN, or the words will be lost. The words could be stored at this stage, but it is better to get as much as possible of the main program entered first.

Having entered Listing 1 and checked the SYNCSUM, which should be 18, enter Listing 2, starting at Line 32. The first part of Listing 2 cannot be entered until you

F. W. Manders, 24 Horton St.. Lincoln, LN2 5NG,

UK.

46

F. W. Manders

are finished with Listing 1. Check the SYNCSUM again at the end of Listing 2. It should be 57.

Now you are almost ready to store your 175 words, but first the SYNCSUM Routine must be removed as we need the 27 bytes it occupies. We also need to store the program on tape at this stage, so we can kill two birds with one stone, as they say. When you have it safely on tape, enter NEW and then reLOAD from the tape.

Enter RUN and the screen will display:

ENTER WORDS 0