The magazine for Sinclair users and Timex/Sinclair users $2.95

March/April 1984 Volume 4¿¿Múmber 2

THEME SECTION: SYNC AT THE KEYBOARD-PROGRAM The Array Advantage * Anatomy of a Program Line * Knight's Tour ° Sortik "C Techniques ° Memory Mapping ° Using RAM Packs * TS2068 Tips e MACHINE LANGUAGE: The Great Circle * PARCLE ° HARDWARE: ROM and; RA Addressing ° Great RAM Rescue + GAMES; Boule ° Meteors ° RE MIE Go-fer * ZX Pro/File*Tntercontroller * Forth

| 04 54

14024°143

A E oE A N RN ea

&

y

ANO ld SEN

A m

The Complete Range

MEMOTECH

Fifteen months ago Memotech developed the first 64K Memopak, designed to maximise the capabilities of the Sinclair ZX81. Since then, using the ZX81 as a starting point, we've gone on to produce a comprehensive range of Memopaks, adding 16K and 32K memory expansions, utilities packages comprising a Word Processor, Z80 Assembler and Spreadsheet Analysis, plus Communication Interfaces, High Resolution Graphics and a professional quality Keyboard. To complete our range of Timex add-ons, we are now introducing the MEMOPAK RS232 Serial Interface.

RS232 Interface

The RS232 is an all-purpose interface which allows the Timex not only to output to suitable serial printers, but can link up with numerous types of peripheral or even other processors. The Interface has two main modes of operation: BASIC mode allows you to use the range of functions supplied in the RS232 EPROM within an ordinary BASIC program, and TERMINAL mode allows you to use your Timex as a terminal to another processor.

The EPROM functions offered permit the user to send, receive and convert bytes between Z80 code and ASCII, as well as check the status of numerous control flags. Received or transmitted data can appear simultaneously on the screen, and received data may be printed simultaneously.

$79.95 cable $19.95

Memopak Centronics I/F

The BASIC commands LPRINT, LLIST and COPY are used to print on any CENTRONICS type printer. All ASCII characters are generated and translation takes place automatically within the pack. Reverse capitals give lower case. Additional facilities allow high resolution printing.

$59.95 cable $19.95 Memopak HRG

This pack breaks down the constraints imposed by operating at the Z80 character level and allows high definition displays to be generated. All 248 x 192 individual pixels can be controlled using simple commands, and

the built in software enables the user to.

work interactively at the dot, line, character, block and page levels.

$79.95

Memocalc

The screen display behaves as a ‘window’ on a large sheet of paper on which a table of numbers is laid out. The maximum size of the table is determined by the memory capacity, and with a Memopak 64K a table of up to 7000 numbers with up to 250 rows or 99 columns can be specified.

$39.95

$39.95

Memotext

Text is first arranged in 32 character lines for the screen with comprehensive editing facilities. On output the user simply chooses the line length required for printing and the system does the rest. Used with the Memopak Centronics Interface, the Word Processor makes available printout with 80 character lines, upper and lower case and single and double size characters.

$39.95

Memopak Memory Extensions

For those just setting

out on tha road to real computing, these packs transform the Timex from a toy to a powerful computer.

Data storage, extended program- ming and complex displays all become feasible. Further details available on request.

16K Memopak $39.95 32K Memopak $79.95 64K Memopak $119.95

Z80 Assembler

The Assembler allows you first to code and edit a source program in the Z80 language, and then assemble it into machine code. You can now write flexible and economic programs. The Editor mode

allows you to code directly in the right format, manipulaté inidividual lines and control the exact placing of source and machine code. Routines may be merged or listed (even to a commercial printer using our Centronics Interface). The assembler mode handles all standard Z80 mnemonics, numbers in hex or decimal, comments and user- selected lables.

Memotech Keyboard

The Memotech plug-in Keyboard plus buffer pack takes the effort out of data entry for Timex users. The Keyboard has a light professional touch and is housed in an elegant aluminum case. The simple plug-in system means that you are not obliged to open up your Timex, use a soldering iron or invalidate your Timex warranty.

Keyboard Buffer Pak

The Buffer Pak performs a “housekeeping” function for the Keyboard, interfacing directly with the port of your Timex.

$79.95 (keyboard & buffer included)

Note! All Memotech products carry a 6 mo. warranty. 80 column dot matrix printer packages available at a substantial savings from Memotech.

Order at no risk (10 day money-back guarantee): Call 617-449-6614. Or send your name, address, phone number and a check/money order / Visa or MasterCard number with expiration date to: Memotech Direct Sales Division, 99 Cabot Street, Needham, MA. 02194. Shipping/Handling $4.95; Massachusetts Residents add applicable sales tax.

The magazine for Sinclair users and TIMEX /Sinclair users

or

r-

March/April 1984 Volume 4, Number 2 DEPARTMENTS 42 TS2068 Programming TipS....................... Aker A (ene Going beyond the manual MACHINE LANGUAGE B Bead TWE FIEE. oo o oso RO ee. 46 TheCircloGame............. 00... cece ences. Doakes B TEL Lo s 5o c deu a ee Introduction to machine code, part 7 Aker, BoVee, Gonzales, Marsh, Pozyski | 05 “PAROLE |... eee ee Wertz 6 GitchoidzReport............... ccc ccc nnn nnn eens Subroutine for PARtial screen CLEaring B- SYNG Nome. = o co cn een Grosjean HARDWARE ARTICLES Codes ce UEM E ener ae 60 zx/TS ROM and RAM Addressing................Rice Kautz, Marsh, Midura, Newton, Terranella Unravelling the mysteries 64 The Great RAM Rescue....................... Glidden 14 ad A on Using the 1K-2K with your RAM pack CRON O DONE o as px er ee Grosjean ARTICLES E o v he P on 33 Whither GIVET. o ia MC Mc E E Ahl The electric car moves closer? 96 Index to Advertisers........ eoe oo n n nnne GAMES SYNC AT THE KEYBOARD 82 Programming Boule. «25. ces Milonas 17 Anatomy of a Program Line..................... Fisher A casino game Looking at the unseen REVIEWS 20 An Assortment of Sorts... Tracy ; Bubble, Float, Shell, and Quick sorts 32 Crazybugs and Cyberzone........ Grosjean Grosjean Two TS2068 game reviews 28 The Array Advantage.................o...oocooo.o.. Aker Understanding and using arrays 58 Thelntercontroller............... osse Kelly Hardware review 34 Kus Oi Oe o oou eoo T TerR ne Midura Using a back-tracking algorithm GS EB ia ALLE ELO ELA Trelease The language and the Pluri-Forth EPROM A 1 Loue E cocus Williams Memory mapping in 1K; game RA Golo A A Nes o E Caley Software review 56 Using RAMPacks.........seoee nnn Beeler The 32K TS1500; 64K TS1000 B8 ZA Prona i. 3 lou eee eee... Gaby Software review TS2068 40 Defining Characters........................... Hartung 86 The ROMPAK System.....................5-5- Busche

Making new TS2068 characters

Hardware/Software review

SUR qe e a ae EA A NN NO ES A A Sen ee OR UA ran AIR

Volume 4, Number 2

Staff Founder/Editor-in-Chief........... David Ahl Managing Editor. 20.00 Paul Grosiean Contributing Editor. .......... David Ornstein Art Editor ................ Diana Negri Rudio Typesetting r iS cT. a ss Karen Brown

Advertising Sales Manager.... Wayne Stephens Advertising Sales Representative ge cried ur ec DE ues iiri a Debra Sanders Advertising Coordinator ...... Julie Henderson Ziff-Davis Publishing Company Consumer Computer and Electronics Division

SYNC (USPS: 585-490; ISSN: 0279-5701) is published bi-monthly by Ahl Computing, Inc., a subsidiary of Ziff-Davis Publishing Company. David Ahl, President; Elizabeth B. Staples, Vice-President; Selwyn Taubman, Treasurer; Bertram A. Abrams, Secretary. 39 E. Hanover Ave., Morris Plains, NJ 07950. Second class postage paid at New York, NY 10001, and at additional mailing offices.

Copyright? 1984 by Ahl Computing, Inc. All rights reserved.

Permissions: Material in this publication may not be reproduced in any form without permission. Requests for permission should be directed to Bette Amado, Ziff-Davis Publishing Company, One Park Ave., New York, NY 10016.

Subscription rates: USA: One year (6 issues), $19.97; two years (12 issues), $36.97; three years

(18 issues), $49.97. Canada and other foreign: $4 per year additional.

Subscriptions: For all inquiries concerning sub- scriptions, new orders, renewals, change of address (include the name and old ZIP or mailing label), problems, etc., write to: SYNC Magazine, PO Box 2939, Boulder, CO 80302.

Advertising: For advertising information, contact Wayne Stephens, $YNC Advertising Sales Manager, Ziff-Davis Publishing Company, One Park Ave., New York, NY 10016 (phone: 212/725-4216).

All other correspondence: Address to: $YNC, 39 E. Hanover Ave., Morris Plains, NJ 07950. In U.K. to: SYNC, 10 Bishops Way, Sutton Coldfield, W. Midlands B74 4XU.

Postmaster: Send address changes to: SYNC, PO Box 2939, Boulder, CO 80302.

Cover by Bob Aiese

AA A NES CN NNNM eee

President e a aat WC osi Larry Sporn Vice President/

Maärkenng A A J. Scott Briggs Vice President/

Circulation. ................. Carole Mandel Vice President/

General Manager......... Eileen G. Markowitz Creative Director............... Peter J. Blank Promotion Manager......... Ronni Sonnenberg 2

March/April 1984 © SYNC

CES cut DUE ENS C LPS LES US PR NE pe EN cun m Els cov ou er D NE Pes Els cue qus cvv DS (ax Cu A t

mum rix DRE CHE e is E MU

Mer diu a. " n 3 3 - 0 H m s [e i : 4 ss » bol 7 " S " e "n n s M MN PE i x toe pia 2 et ; Alf AN iu. eet per ; f

CIRCLE 10 ON READER SERVICE CARD

letters

64K RAM

Dear Editor:

I enjoy reading your magazine because of its great insight into the needs of its readers. You do a great job of providing information on the many uses and ex- pansion possibilities of the TS1000, and you have done a marvelous job of giving inspiring suggestions for getting the most out of our simple yet powerful 2K com- puters. Some of your programs for those with 16K of power are really out of this world.

Yet I am at a loss to know how to feed my hungry 64K of computing power, and you can be sure I am not alone in this search for power. Many of us out here feel the TS1000 is as good as any other computer on the market, but we would like to know what we can do with our 64K RAM packs to make our computers operate more effectively.

George Bilokonsky 4002 Elaine PI. S. Columbus, OH 43227

“Using RAM Packs” in this issue is a start, and we would welcome other articles on the topic.

The ZTX-750 Transistor

Dear Editor:

I believe I have an answer for J. L. Peeler (SYNC 4:1). The equivalent trans- istor for the ZTX-750 or ZTX-752 may be Radio Shack’s RS-276-2032.

Stephen Wilson 221 Forest Dr. Linwood, NJ 08221

Dear Editor: I was able to purchase the Ferranti ZTX-750 PNP transistor (used in the volt-

4

age converter section of the 16K RAM

schematic in SYNC 1:5) from Myco

Vickers, 8040-3 Deering Ave., Canoga Park,

CA 91304 (213/340-2043). Also I switched

the BA221 rectifier with an 1R30S1. Better yet, as suggested by David

Ornstein, avoid the voltage converter al-

together by using Intel 2118 5V RAMS (if

you can find them; they are no longer

being manufactured).

Spuh Poyn

14441 Nordhoff St.

Van Nuys, CA 91402

Say What

Dear Editor:

In “Say What" by Brad Bennett (SYNC 3:6) the seven lines 800-830 (the CLEAR FILES routine) can be replaced by one line 800 RUN. This is all that is needed to clear the variables. Not only will this save programming space, but the RUN com- mand is much faster than the Basic routine. In place of the audio amplifier, I found that the tape recorder hookup described by Ron LeMon in "AUDISY" in the same issue works fine for either program. Gregory T. Blocker PO Box 1226 Page, AZ 86040

TS2068

Dear Editor:

WOW!

That's my reaction to the TS2068.

However, a prediction: the TS1000 and 1500 are not dead, by any means. Those of us who are into computing tend to forget the mass market is looking for a feature/price ratio they like —and maybe they do not care about color and sound.

I intend to continue using my TS1000,

though I have just gotten a TS2068, and will probably buy a TS1500 for developing programs for it and the TS1000; my kids will, I am sure, use the TS1000.

The conversion of one of my programs to run on the Apple lle took more than 20 hours. The transfer to the TS2068 took four hours. Part of the difference is due to the need to store data on disks with the Apple, but part of it is due to the letter- by-letter entry of keywords, the lack of syntax checking on line entry, the loss of program data when a syntax error is en- countered during a test run, and the need for extra symbols and letters such as LEN (A$) instead of the TS LEN A$. I have used the IBM PC, too, and it is not much better (if it is at all better) in this respect. Let’s hear it for Timex Sinclair Basic!

SYNC has far and away the most and best material for TS users. The general interest computer magazines tend to ignore it—their mistake, I think.

John G. Sandell 2 E. Oak Ave. Moorestown, NJ 08057

Bulletin Boards

Dear Editor:

Are there any free bulletin boards out there that can be accessed by a modem such as the Byte-Back MD-1? Perhaps SYNC should publish of list of them in- cluding the phone number, the city lo- cation, the SYSOP name, and whether the board has uploading/downloading pro- gram capabilities.

Joseph Lavinus 1911 N. Van Buren St. Arlington, VA 22205

We will publish information on bulletin boards and services accessible by modems in our Resources Column. Full details should be sent to: "Resources. "

March/April 1984 9 SYNC

A NEW, IMPROVED

TS1000/ZX81 KEYBOARD ATA

NEW, IMPROVED PRICE. $15.

LINPEOT REM OF ST

es QOSUR LE

x

There's only one thing wrong with the TS1000/ZX8L Its keyboard.

Or rather its lack of one.

since it's flat your fingers don't feel as if there's any response to the pressure put on the keys.

TS1000/ZX81 KEYS SECONDBASE KEY

In other words, you're not quite sure which keys you've pressed until the screen actually tells you.

Our new, improved push button keyboard changes all that.

It matches the TS1000/ZX81 perfectly. And the keys give a real calculator-type feel.

To set it up all you have to do is peel off the adhesive backing and stick it on top of the 151000/ZX81 touchpad.

Because no tampering or soldering is involved the guarantee is not affected. And it will last for up to 3% million operations.

But our keyboard doesnt just come

{eR STR |

ENTER

NEXT

loaded with features. With it comes a separate overlay and a set of coloured stick-on labels to make game playing easier.

Its yours for the new, bargain price of S15.

Whichever way you look at it, we think you'll agree that it's a keyboard that's quite outstanding.

Please send______ Keyboards at $15.00 each. p

Enclosed is my check or moneyorderforS = > (US Dollars only) |

Please charge my VisaL] Mastercard O |

Account LL T ET ETT ELEETTETTI ELI LL]

Expiry date |

|

|

| Name

| Address | |

| City/State/Zip |

| Telephone |

| Signature | Å= = == === $ ¿$ => 700 Lexington Avenue, PA 16601 U.S.A. Tel: 814-942 8171

CIRCLE 73 ON READER SERVICE CARD

: case letters are for the TS2068.-

. hexadecimal.

E how many times.

repart

Search and Replace (4:1) Version I, Routine A, line 9: Replace inv. Y with quotation marks. Version II, Routine B, line 1:

Change LD HL,16566 to LD HL,16564;

replace inv. Q with inv. O (letter).

Read This First | TT - Before you enter the programs | in this issue, please note: - = All the programs require the TS1000 or ZX81 with 16K RAM unless dios : : amt femenis are given at the top « of the first page of the "ud Listings with lower

| Read the article all the way through before trying to enter the program. - x | A letter after a number Shows the type: b for d d for decimal; h for

^ d PRINT statements: - A a "t : : n | |

E (32): The underline n means o the gape on that key. The dumber in = ) tells _ A: The overline means use the key i in inverse. |

- INPUT: An underlined word found on the keyboard hold’ not be spelled out. e Enter it iter it directly. Tf it will not ENTER, hit THEN, then the keyword you want,

backspace, delete THEN, and continue entering the line. TRE memory saving : technique may be disregarded if you have enough RAM. |

oOlNtechoidz

Brick Busters (4:1)

P: 4 cob. 3. Make the following change in the list of numbers: 42,12,64,35,54,155,.

Tax Shelter Time Bomb (4:1) 40 IF Y <1 OR -13 THEN... Pa

| Ery ENS

TS1000/ZX81 (1K RAM or more)

Type in the following lines. Make sure the computer is in SLOW mode, press RUN and ENTER. Type in any character or string of characters and press ENTER. Notice the cursor response. When the screen is full, hit CONT, ENTER, and continue typing.

Wi

Te tl Tt pe 18: 45. Ca al

"1

us

[|

t Eu Meg d

RT T TERES

CE CIT I^

ra da di i

TS2068 Change the 16390 in line 10 to 23617. Notice the difference from the TS1000.

"t C KIT ELSE Pte Te ok

T tab PE fe 444-444 UN

(5 (3 I IE 334 X TI

| e T ox "i d x

Our thanks to: Christopher D. Marsh 911 Summit Dr. Greensburg, PA 15601

TIMEX-SINCLAIR 2068

A NEW DIMENSION IN ADVENTURE GAMES

UE.

>

An intriguing split-screen graphic and text adventure for the TS 2068

ALSO, GAMES FOR COMMODORE 64

ve STOPPER ....... Y XA "7 a X PES

DEALER INQUIRIES CORDIALLY INVITED

NT

2008 COMPU aii cus poc iiir $179.95* 2020 Cassette Recorder .................. $ 49.95 2050 Modem io dot do $119.95 PRO OVSHOK rra eek ri $ 14.95 ZOSO IE cs e DE Puce HR $ 99.95 SUDO iste 3 (a o A ECES On request

* Buy the new TS 2068 Color Computer now and join our 25% club (25% off all future software orders)

Other titles for the TS 2068: TRANSYLVANIAN TOWER-DEVILS OF THE DEEP- SUPER SPY-PINGO-ALIEN CURSE-HOME FINANCE 2000-SINCBASIC 2000, and the list goes on.

PROGRAMMERS-TS 1000 QSAVE

Specify System When Ordering Catalog Add $2 s/h for Hardware

WE HAVE A WINNER in our 1984 Computer Giveaway (Will be announced in next issue of SYNC)

SOURCEWARE, INC. P.O. Box 1579 Vernal, Utah 84078

CIRCLE 57 ON READER SERVICE CARD

March/April 1984 © SYNC

“Try This” features short programs to show off your computer, impress your

family and friends, and tickle your imagination when SYNC arrives at your place. Send your contributions to: Try This, SYNC, 39 E. Hanover Ave., Morris Plains,

NJ 07950.

TS1000/ZX81 (2K RAM)

Type in the lines below, press RUN and ENTER. The BREAK key will stop the program at any value of X (degrees).

5 FAST

10 FOR A=4 TO 63 20 PLOT A,21l

30 NEXT A

d0 FOR B=8 TO 43 50 PLOT @,6

50 NEXT B

6S SLOH

78 FOR X=0_TO 62 _ 88 PRINT AT 18,10;"Y= 20 SINE » SS PRINT AT 28,18; "X="; x35075 = ad LET WeeO+eoeSIn QUSZOIsPI) 35 PRINT AT 21,180; "Y="; (Y-20)

188 PLOT x,Y NEXT Xx TS2068 Delete lines 5 and 65 in the above listing and type in. Notice the difference from the TS1000. Our thanks to: Ted A. Pozyski 1215 Thompson St. Houston, TX 77007

TS1000/ZX81 (1K RAM)

Carefully examine the lines below. Decide what the computer should PRINT, Now type in the lines:

1 REM BOVEE 19 I THEY ARE EQUAL" 20 PRINT .02+.03

Press RUN and ENTER. Did you get

what you expected? Our thanks to: Chris BoVee Box 8264 Pembroke Pines, FL 33084

TS2068 |

Type in the lines below, RUN, and

19 FOR d=95 TO 255 STEP 10

15 PLOT 65,27: DRAW 100,100,PI d

20 PAUSE 38: CLS : NEXT d

18 OVER 1

15 FOR nsi TO 2

20 PLOT 65,27: DRAW 100,100,PI #255

25 NEXT n

F ,@2+,.83=.85 THEN PRINT "

ENTER. Observe the results. Our thanks

to: Sharon Zardetto Aker 20 Courtland Dr. Sussex, NJ 07461

TS1000/ZX81 (2K RAM)

Type in the lines below. RUN in SLOW

FOR nsa TO 10 20 FOR CsA TO 31-8 30 PRINT AT AG ae IF CXina-m THEN OTT ea sa PRINT AT 21-A,0+1;

50 NEXT

FOR ÉS =A+1 TO 2a- A PRINT AT L,31-A;"F';

bo NEXT L 100 PRINT LETS PES,

417 "T XT

10 NEXT A

¡AT L ee a;

4 e m A": s AS bue LAIR

ade Try to follow the pattern. Our thanks

to: Carlos Gonzalez 2601 S.W. 9 St., #2 Miami, FL 33135

DISCOUNTED SOFTWARE!

BIG DISCOUNTS on ALL'TS1000 and TS1500 software. See Catalog for details. EXPANDED PRODUCT LINE

Software, supplies, accessories, and. . .

Look to Robotec for

the products you need

and the fast delivery you expect.

All software is on high quality, computer grade cas- settes. Fully guaranteed.

Most orders are shipped the day they are received via

FIRST CLASS mail.

Telephone orders welcome! VISA and MASTERCARD

accepted.

Shipping and handling $1.25 + $.50 for each additional

cassette. $10 for EXPRESS MAIL. Ohio residents add 512% sales tax.

DEALER INQUIRIES WELCOME

March/April 1984 © SYNC

2068 SOFTWARE

FREE CATALOG!!

robotec, inc.

59 C Street Ampoint Industrial Park Perrysburg, Ohio 43551

419-666-2410

Ask for ROBOTEC software from your local dealer.

"TS1000 &'TS1500 are trademarks of Timex . Corporation

CIRCLE 44 ON READER SERVICE CARD

New titles now being added!

Use reader service, call, or write.

'TS1000 & TS1500 SOFTWARE

ZX PRO/FILE D-Base wsort. Reviewer's choice FASTLOAD save & LOAD in a fraction of the time ZX DATA FINDER with Basic tutorial Z-WRYTER Word processing TEACHER'S GRADEBOOK CHECK REGISTER & BUDGET PROFIT PLAN Profit analysis GRAPH | & Il Equation graphers EPHEMERIS V Deluxe planet finder RAMPAGER for M/L programmers DISTACALC Distance calculations METAGRAPHICS Graphic paint brush TIMEBLASTERS Machine code game TEE Machine code game MAZEBALL Machine code game

$16.95

$19.95 $14.95

"n

sunc notes

Paul Grosjean

SYNC at the Keyboard

Mark Fisher leads off our theme section “SYNC at the Keyboard” by revealing the hidden parts of the program line. Then Richard Tracy helps us sort things out, Sharon Aker sets up some arrays, and Edward Beeler shows how to get more into our RAM packs. “Knight’s Tour” by Robert Midura lets us watch the computer working out a problem. In “Meteors” Michael Williams shows yet another way of squeezing more into 1K RAM. For TS2068 users, Sharon Aker shares some programming tips, and Robert Hartung develops his method of using the user defined graphics capability. Realizing the power of your computer involves under- standing how to use the memory space more fully so V. B. Rice unravels the mysteries of ROM and RAM addressing, and Randall Glidden answers the question of how to use the RAM disabled by your RAM pack. New programming languages also extend the power of your computer as Robert Trelease shows in his discussion of Forth. Finally, we take a break with George Milonas and see how the game Boule can be programmed to the computer.

Coming Issues

Our next theme section will be “SYNC on the Job.” We will look at how the computer is being used in work situations —both conventional and unconventional. Other themes under consideration for subsequent issues include: “SYNC at the Arcade,” “SYNC Goes Shopping” (a buyer’s guide to TS2068 products), and “SYNC in the Classroom.”

Timex Developments

Timex Command Cartridge TS1000 and TS1500 users will now be able to enjoy cartridge software. The Timex

8

Sinclair 1510 Cartridge Player (T-Dock for short) plugs firmly into the expansion port of your computer and allows the use of Timex’s new line of cartridge software. The unit measures 3 1/4 x 3 5/8 x 1 1/4 inches, not including the cartridge slot extension. (See photo .)

Timex Command Cartridge Player and Cartridges.

On the TS1500 you need only the T- Dock, but on the TS1000 you must use your 16K RAM pack. We had no problem with RAM pack wobble, but precaution must still be taken. The unit also has a reset button. Some users may want to keep the T-Dock plugged into the com- puter all the time in order to have the reset capability even though cartridge use is not planned.

The Command Cartridge measures 2 1/2 x 2 3/4 x 3/16 inches. It has a handle on the top for getting a good grip for removal. A board extends out the bottom

about 3/16 of an inch. This plugs into the vertical socket on the T-Dock. A sleeve protects the board until the cartridge is inserted in the socket. Although the cartridge looks identical to those for the TS2068, there is no danger of making a mistake because the boards are different and cannot be plugged into the wrong machine.

On the TS1500 you turn the computer power on, the cartridge loads almost in- stantly, and the program screen comes up. On the TS1000 you must load the program with a USR call. This may take several seconds, but it is significantly faster than tape loading.

The limitation of the T-Dock system is, of course, that you cannot save a program with your data back to the cartridge. Nevertheless at $19.95 the T-Dock promises to save substantial time and relieve much user frustration in loading software.

Cartridge Software

As samples of what is to come from Timex’s cartridge software, Timex’s winter catalog includes seven cartridges for the TS2068 and four for the TS1000/TS1500 in its list of over 100 software packages. The prices are generally in the $19.95 range. We have seen “Crazybugs” for the TS2068 (see review on p. 32) and for the TS1000/TS1500 “Supermath,” “States and Capitals,” and “Flight Simulator” (reviewed in the cassette version in S YNC 3:2).

Third Party Support

However, more important is that third party vendors will be able to offer programs in the Command Cartridge format. In- terested vendors should request information on their official letterhead from Billy Skryme at Timex. Third party vendors may also request (on letterhead) infor- mation on the hardware/software guide from Billy Skryme and on schematics from Doug Smith (Timex Computer Corp., Waterbury, CT 06725).

March/April 1984 © SYNC

COMPUTER

a COMPUTER STANDS ¿e Power base

Raised stand for TS1000 and TS1500. Fitted LOAD/SAVE Dae switch, and power ON/OFF for screen clearing. Saves uet wear and tear on connections. Front lip holds computer in di place. No soldering, comes complete with all necessary ks P" Raised stand for Plugs and cables. : 2210001500 NEW Spectrum Sound, with build in $ 19.90 orderr

ef: PBS1 variable sound amplifier. (PBS2).

At last, a fool proof gg method of avoiding ES TS1000 whiteouts ` caused by Ram-Pack wobble. Simply turn the plastic thumbscrew until the Ram-Pack is held firmly against the | 151000. No soldering, Small tilted for :

no stick-on pieces, just TS1000/1500 & $8 90. Printer. common sense! Flator Small flat for TS1000/1500 Ram Pack. a flat ref. LW

tilted models. & Ram Pack. $9.90 $10.90 tilted | $7.90 Order ref. SW Order ref: STW ref: LTW

Large flat or tilted for TS1000/1500

| FABULOUS SINCLAIR/ TIMEX A OFFER FOR TS1000 OWNERS

| These are the real thing. 1S1000 memory extensions

| made for the USA and specifically screened to stop

_ radio interference. Fully Guaranteed for 12 months | enosoldering ¢ easy to fit « simply plug in

e noloss of memory through wobble or whiteout

L COMPUTER?

3 414 South Evergreen, Arlington Heights, Illinois 60005. d

(s A Please SONG A A ee a o luas dcm i E enclose check for$ ............. payable to Computer Add Ons i

E A (Spe S VL DES AA Scherz Me tar Dale urea g

E BITE LUI TEUER EVI qr dr CER a pii UA e aat ONE CD RIED E

s OMA * EC Agde 4 e iesus den vans oe i

$ 76 ME164 USA m E d E erri pL ERU EE UN PENIS UE i $25.50 ME1 16 USA ü GCI ONO ise Lob romae e gk eR Or e TON S2 j

4mm mm NER Add $4.00 Shipping & Handling to all prices. amm mm mm » CIRCLE 4 ON READER SERVICE CARD

Just For FuN

“Just for Fun” shares short programs that illustrate a point, demonstrate a technique, or show something the author has found interesting. If you have some

programs that you want to share, send them to: Just for Fun, SYNC, 39 E. Hanover Ave., Morris Plains, NJ 07950.

Faster Random Numbers

Frank Terranella

Have you ever been frustrated by the

RND function? You type in

LET R=INT (RND*10)+1 to generate random numbers in the range of 1 to 10. While an output of 3, 2, 2, 4, 7, 7, 5,3 is random, it is not pleasing to have the same number crop up so often. What can we do?

The conventional answer involves taking every random number generated and com- paring it to all those generated before it and discarding it if it is a repeat. Although this method works, the computer must do a lot of work. This takes a long time. For example, I used the program in Listing 1

Listing 1.

S REM CONUENTIONRL METHOD 10 DIM Y (S52! 20 FOR x=1 TO Se

38 LET Y(X) SINT (RNDxS8!-41 40 IF X=1 THEN GOTO 82a

S@ FOR Y=xX-1 TO 1 STEP -1

50 IF vYixX)zsYtY) THEN GOTO 30 ?@ NEXT Y

Se Pelt) VEE pee ts

90 NEXT X

to generate 52 random, nonrepeating num- bers. In SLOW mode it took 6 minutes and 30 seconds; in FAST it still took 1

minute and 28 seconds. Of course, this:

time is variable depending on how lucky the computer’s random numbers are at not repeating.

There has to be a better way.

Listing 2 shows my solution. Since we know all the numbers we want to generate

Frank Terranella, 8 Torne Rd., Sloatsburg, NY 10974.

10

and we simply want the order jumbled, the easiest thing to do is to give the computer a string with all the numbers already in it and have it take random slices of the string. To make the mix a bit more thorough, we can mix up the numbers in the string.

Listing 2 shows how to generate random

Listing 2.

ABREN Too En RANDON NUMBERS e DIM A$ (52,

Aa Ti z$- O /252soSa920R71 Q@G64¢45135223S8S351151 S16 42; 141500

uO nuo me 0 Pr uo Ci c mmi vc

332011 WSlSee2d614¢a5e24d3 Q423033201" ‘sl TO Se R=etINT (RND (53-K) 1 +1) 4 @ IF LEN x$=2 THEN LET AS(x) =

Q IF LEN X$=s2 THEN GOTO 200 A LET mM$ix)zx$iR TO Re+1i a LET x$zx$i TO R-1)4x$iRM42 T

m

*X Li EAR ES E IR IE GJ P E E E I

a

IF VAL R$íx,1)z0 THEN LET A A zA $ LX ¿el

e

1

a PRINT Afix!” uy @ NEXT x

ut

m m m

BEX Aw 0000 ESO I CS

Listing 3. 18 REM AUTOMATIC RANDOM NUMBER

24 LET X$z" 30 PRINT "HOLA MANY NUMBERS?" 40 INPUT x

se IF x>299 THEN GOTO 30

640 DIM Aix, 23

TA LS

78 EROT

08 FOR: Isl TOD X ga LET *$=x54+ "0"

C

AND I:10)48T

R$ I 100 MEXT I 105 3LüQL

110 FOR I=1 TO x 120 LET RziINT (RAND (¥4+1-I) 141)

130 IF LEN xX$=2 THEN LET A$1x)=

$

140 IF LEN X$=2 THEN GOTO 170 150 LET H$ilI)!zX$£iR TO R+1)

1680 LET “$=xX$ TO R-1)4sX$iR«2 T

1280 IF URL H$iI,1)z0 THEN LET A $ iI} =A$iI., Z)

isa PRINT AgiqIi;”

194 NEXT I

numbers from 1-52 (useful, e.g:, in card games). I started out with the conventional sort in Listing 1 and waited a minute and a half for it to generate the 52 numbers in random order. I then copied that order into the string in line 120. The rest of the program takes random slices of the string according to the random number generated in line 140,

Tests with this method show a dramatic improvement in speed of execution. It took 26 seconds to generate the same 52 random numbers that took more than 6 minutes in SLOW mode by the other method. In FAST, you can have 52 non- repeating random numbers in 4 seconds. Not bad.

Of course, if you would rather not type in a long string, you can have the computer create one with all the numbers you need. The results are not as pleasing, but it is less work. Listing 3 shows how.

Polar Lines Christopher D. Marsh

“Polar Lines” demonstrates a technique for drawing lines. It can be applied, e.g., to graphic displays, laser effects, land boundary line plotting, trigonometry pro- grams. The symbols used in the program are all standard conventions in mathe- matics.

Type the program in, RUN, and ENTER. A pair of coordinate axes are drawn. To use the program follow these steps:

1) Enter the coordinates of the starting point where the line will begin.

Christopher D. Marsh, 911 Summit Dr., Greensburg,

PA 15601.

March/April 1984 © SYNC

ER E "mur

Microtech Mar keting 1418 Lansing Street e Aurora, CO 80010

HANDY ORDER FORM FILL IN AND MAIL TODAY!

Name Address

E seg ocu dc oc Stee up

Phone + ( )

MODEL + DESCRIPTION UNIT PRICE AMOUNT

OUR CATALOG UE Refundable off 1st Order $ 3.00 EV TS 2068 E o da Color Computer 72K 179. 95 Ses TS 2020 Computer Cassette Recorder 49.95 m

TS 2050 BENT Modem for 2068 109.00

Produces 87% Winners at the Horse Races

COMPUTURF +1 TS 1000, 1500, 2068, 16K 29.95 UNDE.

Colorado State residents please add 7.1% sales tax

Handling, Shipping and Insurance

GRAND TOTAL 2050 2040 das CHARGE MY METHOD OF PAYMENT: (check one) Credit Card No. LL] visa or L] master Card C] PAYMENT ENCLOSED

in the amount of $

(check or Money Order only)

O CHARGE CARD

Information filled in at left

Expiration Required

Make checks payable to:

MICROTECH MARKETING

1418 Lansing Street, Aurora, CO 80010 SHIP TO: (Fill in only if address is different from above)

NAME

ADDRESS

DHT Pe LL STATE U.P

We ship via UPS. Please provide Street Address. UPS will NOT deliver to P.O. Box If you are usually out during the day please leave written instructions for UPS men where to leave parcel.

Delivery in 4-6 Weeks CIRCLE 32 ON READER SERVICE CARD

pa Tl rn KA

ME TITAN vf "T li Tic 4 ES lal

Cr Cn pe ca ru XL ETE C I | [

A rm |

Cn c ca AAN Cg a Cy TET Dr

Mm HT HA T1 n

t fu

ar

Tes I

-e

| a

*, e me

DET be ER TI d 8 T | fpc E o [m

ue

J

m

be

Y

-

[UNT

[

[ J

zp ru d

je -

TX eB ec

XA PR ZU

"a P

pa p p p p pre e Cr Cn pe na ca Pare pora uc en «d

rm

2) Enter the coordinates, first the X coordinate and then the Y coordinate.

3) Enter the length of the line (R).

4) Enter the angle (THETA) along which

1560 PRINT iY

170 PRINT HT 2,8; ‘R=

150 INPUT E

190 PRINT OE

200 PRINT “THETA=

zig IHPUT THETA

220 PRINT THETA

2330 LET @=THETASePI-Lse

240 FOR F-0 TO INT (R+.4)

2580 LET §£=f{F 4005 Qi +32+5=

200. LET Y=1F+5IN 0)1+22F39T

2370 PLOT x,Y

250 NEST F

2398 LET Sx=e-32

3500 LET SY=-22

310 PRINT HT 8.7; INT 2xXt.4 "Eum hey +s 4) E A 320 PRINT AT a. = EA" NE s

330 GOTO ifs

R-12 THETA=123

the line will be plotted from the starting point. Where each line ends, the next begins. The computer displays each new

starting point.

Input Anywhere ll Brian Kautz

Another way of inputting anywhere (Matt Dralle, “Input Anywhere” SYNC 3:6) is shown in the program below. It demonstrates a very nice way of inputting information into other programs.

This technique can handle alphabetic or numeric data and can accept up to 31 characters. Input is accomplished just like the normal input by entering the alpha- numeric data and then pressing ENTER. A delete function can be added without much difficulty.

Setting the values of I and J moves the prompt around. Beware! The larger the value of I, the smaller the input can be. In line 15 any character that you want can be used as prompt.

10 REM BE

20 LET

39 LET

4@ LET 4:

Sa PRINT AT 9,28; "ENTER A 1-12 DIGIT"; AT 38,8; "LONG NUMBER. ";

66 PRINT "E"

70 LET Z£-INKEYS

32 IF Z$-"" THEN GOTO 78 o 99 IF ZS-CHRS 118 THEN GOTO 14

184 PRINT AT X,Y;I5; "RC:

112 LET Y=Y>1

123 LET u$£-uS-z$

132 GOTO 7a

148 PRINT AT Me ty =3a) , ya U4232) 4

1528 PRINT HT 12,5; "THANK you”

168 PRINT AT 34,55 "YOU ARE “Us ; 4 YvwRS OLD,"

172 LET W=VAL WS

Brian Kautz, 35 Central Blvd., Camp Hill, PA

17011.

Screen Strings Robert J. Midura

"Screen Strings" illustrates the technique of storing the screen display in a string variable. This has the advantage of being able to print almost instantly with one simple PRINT statement. No time con- suming FOR-NEXT loops are needed.

To use the program, put the computer in SLOW mode, type RUN 100 and ENTER. When the program stops with the message 0/160, type PRINT P$ to see the stored string.

ie DIM Pe Pad:

eu LET Xz1

SU LET i-PEER i5225-255s:PEER i 5397+1

ig FOR Losi TO L47235

50 IF PEER iciio THEN GOTO a8

58 LET FPixki =CHRE PEER iL

TOLER AZAR

SQ NEXT L

ads RETURN

188 FOR I-i TO 22

iig PRINT TRE INT RHDEZ2A+1 F EST PARATTERH'

isa NEXT I

ice FAST

148 GOSUB 12

toe. CUS

isg SLO

Line Notes 10-90: Store a screen image in the string

P$. The length of P$ is the number of

Robert J. Midura, 19 Merrifield St., Worcester, MA 01605.

12

character positions on the screen: 22 lines by 32 columns equals 704. 50: Excludes the ENTER characters. TS2068 users must substitute 13 for 118. 60: The variable L addresses the display file and stores each character in P$. 100-160: Demo program.

Random Squares J. C. Newton

"Random Squares“ fills your screen with randomly placed overlapping squares. The

results suggest some modern types of art.

J. C. Newton, North West River, Labrador, Canada AOP 1M0.

Line 30 lets you stop without leaving any incomplete squares by pressing the A key.

With 1K RAM only a limited number of squares can be displayed.

3 REM “SQUARES

S DIM AFid.4}

18 LET ASCE =" A

32 LET ASI(2I=" P.

14 LET AS ES ="

io LET AFCA? =” £s

20 LET S=INT (RNIDEZ3)

ege LET TeIN {RNG £17)

25 FOR Hze TG 3

27 PRINT AT T4*H,5:RH$t'Hc«-1? SO NEXT HH

38 IF INKEYS="A" THEN STOP 35 GOTO 20

Graphics notes:

10: E;7;7;R

12, 14: 5; space (2);8

16: W;6;6;Q =

March/April 1984 © SYNC

Call our NEW Demo Hot-Line and hear it for yourself!

(212) 625-6220 W The Zebra-Talker unlimited vocabulary voice synthesizer uses the famous VOTRAX SCO1 phoneme synthesizer with 4 programable pitch levels and automatic inflection. It produces all the phonemes required for English speech. MWincludes assembled and tested Zebra-Talker, 1400-word Votrax SPEAKER / AMPLIFIER dictionary, instruction manual, editing and demo software. ORDER C145....$12.50 Features expansion connector for “piggy-back” expandability. MW Audio output plugs into any audio system, or order our $C145 Amplifier/Speaker module with volume control.

"59% VOICE SYNTHESIZER

Zebra-Talker FOR THE TS1000 & ZX-81 ORDER C141

NEW! ZTALKER 1.2 TEXT TO SPEECH SOFTWARE ... Only $19.95 Unlimited vocabulary including: words, letters, symbols and numbers. Talking is as simple as typing “TESTING 1 2 3”. Requires 16K RAM. ORDER C146

BLIPPO ZEBRA LIGHT PEN

TS1000 ZX81 Sound effects generator Add amazing sound effects to your games Easy to program in BASIC Wide frequency range Features bus expansion connector - eAssembled & Tested, with Demo software . C122 BLIPPO WITHOUT SPEAKER. ...$19.95 C124 Attractive Speaker Module :

JOYSTICK ADAPTOR

The ZEBRA Joystick Adaptor allows you to connect any Atari compatible joystick to your ZX81 ,or TS1000. It comes assembled and tested with simple instructions to make joystick versions of most action games. Simply plugs into the back of your computer and features an expansion connector for piggybacking. Use your own Á Atari compatible joystick or add $6.50 for a genuine Atari Joystick. FREE PATCHKIT +1

e Fun to experiment in BASIC e Complete package includes: - Light Pen

- Computer Interface Module - Demo Program Listings

e Assembled & Tested

GREEN SCREEN

| The Green Screen is a specially molded lastic optical filter which relieves eye strain y enhancing character contrast and by

liminating the components of white light . which cause eye fatigue. The Green Screen ill fit any 12" TV or monitor and can easily ' be trimmed with a pair of scissors to fit any . smaller size.

RDER C140. $12.95

shows patches for TIMEX Flight Simulator and other popular games. C120 ZEBRA JOYSTICK ADAPTOR ...$19.95 C121 ATARI JOYSTICK C115 6 JOYSTICK DEMO GAMES

CASSETTE

ORDER C109 $24.95

ALL ZEBRA PRODUCTS HAVE OUR 5-DAY MONEY BACK GUARANTEE

TIMEX sinclair WE STOCK ALL TIMEX’S SOFTWARE TITLES AND ACCESSORIES FOR THE TS2068. CALLUS FOR PROMPT SERVICE AT COMPETITIVE PRICES.

HARDWARE ENTERTAINMENT CASSETTES TS2040 Printer 64001 Androids 9.95 C143 6-Rolls Printer Paper. . 64002 Penetrator

TS2050 Modem 64004 Casino |

TS2020 Cassette Recorder ..49.95 64005 Crossfire

TS2068 72K Color Computer182.45 64012 Fun Golf

TIMEX HOME CASSETTES

62000 Budgeter 62001 Home Improvement

TIMEX EDUCATION CASSETTES TIMEX COMMAND CARTRIDGES 63000 Flight Simulator 72000 Budgeter 63001 States and Capitals . . 73000 Flight Simulator 63016 Math Wizardry | 73001 States & Capitals 62003 Auto Analyzer 3 63017 Math Wizardry II 74004 Casino : 64013 Chess 62004 Checkbook Manager..19.95 63019 Wordcross 74005 Crazybugs > TS2090 Command Stick . Fo H TIMEX BUSINESS CASSETTES 63020 Word Play | SOFTSYNC TS-2068 CASSETTES TS1500 16K Computer 64014 Hungry Horace 61000 Vu-Calc ; 64015 H G 2m 63021 Word Play Il SS001 Voice Chess TS1510 Cartridge Adapter... 015 Horace Goes Skiing... 19. 61001 Vu-3D L U 64019 Horace & The Spiders . 19.95 aS Nenguagev enge 55002 yerconé TS1000 2K Computer DN iced Alo ke 61002 Vu-3D 63028 Capitalization Master . 15.95 $S003 Gulpman TS1016 16K RAM Pack oeque y 61003 Quadra Chart EZ-KEY CASSETTE SS004 Personal Accountant . 21.95 All titles for TS2068 only <=> "ugs. EZ001 Upload 2000 .19.95 SS005 Zeus Assemble;- 19.95

KEYBOARD BEEPER THE BEST BOOKS EXPERIMENTING?

FOR THE TS1000/TS1500 C134 ELECTRONICALLY SPEAKING: COM- PUTER SPEECH GENERATION by John C111 Cater. 230 pages. Very enjoyable reading. UNIVERSAL Useful & up-to-date PATTERN FOR LEARNING TIMEX SINCLAIR BASIC by IC'S. CAPS David Lein. 350 pages. Great for beginners ETC. . NOT JUST 30 PROGRAMS FOR THE ZX81. Interesting programs with explanations . i C112 BYTING DEEPER INTO YOUR TS1000. PIGGY BACK

Experience for yourself how much the Key- Excellent presentation with 37 tutorial RAM OR OTHER

board Beeper improves the use of your TIMEX keyboard. Simply plug it into your computer's expansion connector and hear a beep whenever a character is accepted by the computer's keyboard input routine. No software is required. Features expansion connector for RAM etc.

BONUS 1 - You can trigger the beep from Basic. Great for program prompts, timers,

ORDER 4C133. $19.95

= ZEBRA SYSTEMS, INC.

programs UNDERSTANDING YOUR ZX81 ROM by lan Logan. Good study of ZX81 & assembly language

THE COMPLETE TS1000/2X81 ROM DIS- ASSEMBLY by lan Logan. A must for advanced users

MACHINE LANGUAGE MADE SIMPLE

FOR YOUR SINCLAIR TIMES TS1000. $14.95 THE INS & OUTS OF THE TS1000 & ZX81. Excellent hardware manual . $12.95

PERIPHERALS

C110 ALL SIGNALS LABELED

C110 Keyed & Labeled ZX Connector $5.95 C111 Universal Protctyping Board . . C112 Expansion Connector . .

ADD $3.00 PER ORDER

FOR SHIPPING.

WE ACCEPT VISA, MASTERCARD, CHECKS, M.O.

C.O.D. ADD $3.00 EXTRA.

N.Y. RESIDENTS ADD SALES TAX.

78-06 Jamaica Avenue, Woodhaven, New York 11421 Or 2) 296-2385 DEALER DISCOUNTS AVAILABLE.

IN and OWE OF Sync

John Anderson David Grosjean

r ia

In addition, we will al EB a ie or two = show what it wodi be 4 li «e to write and run the program on the Brand X computer compared to the Timex/ Sinclair. You will probably find these tutorials a useful aid for converting

| pos fro other Sources to your Timex/ smetar computer.

The Commodore 64

John Anderson

The Commodore 64 is the best-selling machine in its class, and for very good reason. At under $200, it is quite a buy. With 64K RAM, superlative color graphics, and sophisticated sound syn- thesis capability, the C-64 packs a lot of punch. It also has a ROM cartridge slot, full-stroke keyboard with four function keys, and an expansion bus.

Commodore, which began years back as a business furniture and calculator company, was among the first manufac- turers to offer an assembled micro- computer. It introduced the Commodore Pet in 1978. And despite the fact that the initial machines were slightly flaky and sported the most un- friendly keyboards around, the Pet re- mains a sight in many homes and schools. It is at the least remembered fondly by many a micro enthusist.

When the 5K Vic-20 was first in- troduced in 1980, it met with little enthusiasm. At $300, the machine was too cheap for serious hobbyists, and too expensive for the fledgling mass market. So it languished for a while.

But Commodore kept right on push- ing the machine, and, to the chagrin of the industry, made cost-cutting its basic strategy. The Vic-20 offered a taste of color graphics and sound, and sported a full-stroke keyboard. By the time the mass market for microcomputers really began to heat up (Christmas of 1981), the Vic-20 was selling for $200. It had some decent software, too, though mostly from third-party manufacturers. And so it began to catch on.

14

By Christmas of 1982, over a million Vic-20s had been sold, and they continue to be sold today, at prices well under $100. Without a doubt, the Vic was the first true mass market machine. It set Commodore afloat.

Meanwhile, engineers at Commodore continued to improve the Vic, giving it advanced capabilities and a quantum leap in RAM. In early 1983, the Com- modore 64 was christened. It was news even at a list price of $595, but it did not stay there for long. Soon after the in- troduction of the C-64, the first volleys of a bloody, and now legendary, price war were heard.

During this time, the price of the Timex Sinclair dropped from $150 to $50. Commodore prices dropped just as dramatically. And the real winner of the hardware wars was you, the consumer.

One of the strong points of the C-64 is its processor, the 6510. Its architecture is modeled after the 6502, which is the heart of the Apple and Atari micros. As a result, high quality translations of Ap- ple and Atari games and application software have become available. This li- brary will continue to grow.

But the Commodore 64 is not without its problems. Never known as a com- pany with a remarkable support system, they have run aground on a few reefs of their own making.

Problems with reliability have plagued the C-64 since its inception, and though these problems seem largely to have been solved, there is still a ghost in the machine. Early 64s suffered from serious video problems. Later runs turned up units that were D.O.A. (dead on arrival).

March/April 1984 9 SYNC

Then there is Commodore 64 Basic. It was pulled over from the Pet and Vic machines, without much alteration. As a result, many of the advanced capabilities of the C-64 cannot be accessed from Ba- sic without recourse to complicated PEEKs and POKEs. Simon’s Basic, an improved language with powerful com- mands that allow Basic to finally latch in to the potential of the C-64, has just been released. It is the brainchild of a sixteen-year-old programmer from Brit- ain. Not too many serious C-64 enthu- siasts will do without it for long. Programming graphics and sound is just too tedious from plain old Basic.

Still, the C-64 can do many things that the more expensive machines can do, and has grown to be a market pres- ence that cannot be ignored. And if the Coleco Adam ever manages to become a marketing force itself, Commodore is ready to cut its prices once again. It's hard to argue with a strategy like that. At $99.95, the C-64 would be hard in- deed to beat.

Changing Colors

David Grosjean

Although many computers have the ability to use colors, the system for using the colors varies from machine to machine and sometimes becomes quite confusing. On the TS2068 and the JR200, for example, the system is rather simple. In this issue we compare color changing on the TS2068 and the Commodore 64 and on the TS1000 which is limited to black, white, and gray.

Cursor Color

Changing the color in which the cursor prints is easy on both the TS2068 and the C-64. On the C-64, color is produced by holding down the CTRL (control) key and pressing one of the number keys 1 through 8, e.g., CTRL 3 produces red. Using the Commodore key instead of the CTRL key produces 8 more colors.

If you are typing in direct mode, changing the color immediately starts the cursor printing that color; however, if you are typing a PRINT line of a program and you wish to change the color, the computer inserts a control character instead of directly changing color. E.g., type

30 PRINT “(CTRL 2) SYNC"

Where you hit CTRL 2, there is an inverse E. When you run this, that inverse E does not show up, but "SYNC" will be in white.

Producing the same effect on the TS2068 is easier. No matter where you are typing, if you change color, the cursor starts to print in that color; there are no control characters. The colors are on the number keys, just as on the C-64. To change colors, push the CAPS SHIFT key and the

March/April 1984 © SYNC

SYMBOL SHIFT key to get the E cursor. Hold down the CAPS SHIFT key and press the number key of the color you want. You are ready to type. Try the same test used on the C-64.

Borders and Backgrounds

You can also change the color of the border of the screen and the background on both computers.

On the C-64, POKEing a number (1-15 each corresponding to a different color) into location 53280 changes the color of the border. E.g.,

40 POKE 53280,2 changes the border color to white. Similarly, POKEing into location 53281 changes the background color.

The following program simply changes the colors of the border and background incrementally with a loop (x). Line 60 is a delay loop.

C-64:

10 X=X+4

20 IF X215 THEN X=0

30 POKE 53280,X

40 FOKE 53281, X+1

50 GOTO 10

The TS2068 has several commands that make changing colors easy. To change the border, simply type BORDER and the number of the color. Also, the back- ground can be changed with the command PAPER and the color number. The back- ground, however, does not change until the screen has been cleared. E.g., type in

10 BORDER 1:PAPER 2:CLS RUN this. You will see that the border is blue and the background is red. Add these lines:

20 PAPER 7:PRINT “In and out of Sync”

30 PRINT “colors”

RUN this. The background is red, but the background of the letters is white. Clear the screen (CLS and ENTER) and the entire background is white.

Individual Characters

Y ou can control the color of individual characters on the screen. The C-64 has a color memory that stores the color of every character on the screen. To change the color of any one character, just POKE the new color into the correct location in this color memory which starts at location 55296 and is 1000 locations long (the screen has 40 x 25 characters). The following program fills the screen with circles and then changes the color of a randomly chosen circle.

C-64:

100 FOR I=1 TO 960

110 PRINT "0";

120 NEXT I

130 FOKE 55297*INT(?60XRND((DO,

INT (16XRND C12) 140 GOTO 130

Continued on page 55.

LET YOUR

TIMEX COMPUTER WORK FOR YOU

PERSONAL - BUSINESS - EDUCATIONAL PROGRAMS: On cassette - menu driven - printer optional Available for: TS 1000/1500/2000 Series

MAILING LIST -16K: Holds 100 names, ad- dresses and phone numbers - Searches - Sorts - Lists - Changes - Deletes - Prints. 9.95 MAILING LIST-64K: Does same as 16K only holds 425 names, etc. ! INVENTORY-16K: Holds 150 items with com- ments (Serial Nos., etc.) Searches - Lists - Changes - Deletes - Prints INVENTORY-64K: Same as 16K only holds 750 items with comments à CHECKING-16K: Lists 25 deposits - 80 checks - Adds interest - Deducts Serv. Charges - Searches by #, name, date or amount - Prints list of deposits, accts. & checks

CHECKING-64K: Same as 16K only lists 100 deposits - 500 checks 9.95

GRADEBOOK: Teacher's time saver - Self- adjusting memory - Computes means, stand- ard deviations, variance and coefficient of vari- ation - Ranks by weighted or unweighted aver-

FINANCIAL RECORD KEEPER-16K: Holds 20 files for household or small business ex- penses and/or income - Reviews, corrects or changes information - Prints list for tax pur- 14.95 FINANCIAL RECORD KEEPER PLUS-48K: Does same as 16K - also keeps up to 500 checking transactions - Reconciles checkbook with bank statement SALES FILE-16K: Retail business program can be used directly as a cash register to keep records for bookkeeping and inventory. Holds 150 items & 25 accounts - Prints pie inventory & receipts SALES FILE-64K: Same as 16K only holds 600 items & 100 accounts 14.95 INVOICE CONTROL: Keeps track of, and prints, invoices for the small business. Self- adjusts according to amount of memory avail-

APPOINTMENT CALENDAR-16K: Enter date and list up to (8) appointments per day for up to (31) days - Change - Delete - Print - Save

CASH REGISTER-16K: Totals, figures sales tax - Clears and keeps daily totals - Prints sales slips wcompany name & date .. 9.95 MULTIPLICATION TABLES-16K: Choose the multiplier for up to 50 problems - (YES) or (NO) will appear after each problem. Incorrect problems may be listed with answers . 9.95 MATH QUIZ-16K: Choose (+) (—) (x) (+) for up to 50 problems w/six difficulty levels (Grade School) A

FLASH SPELLING-16K: Enter up to fifty words - Determine how long you want the word flashed 9.9

SEND FOR FREE CATALOG

Any three $9.95 tapes tor $24.95 - Add $1.00 per tape shipping - Ind. res. add 5% sales tax - Send Cert. Check, M.O., VISA or M/Card No. w/Exp. Date. :

HEATH COMPUTER SERVICE 950 E. - 52 S., Greentown; IN 46936

Phone: (317) 628-3130

CIRCLE 18 ON READER SERVICE Xie" 5

IIS ERRATA EA

AAPA IIA AAA A ARATRO M 3705 BISCAYNE BOULEVARD e MIAMI, FLORIDA 33137

IDA sinclair computers

DREVJA * A NEK SOURCE OF PROGRAM INFORMATION; BEYOND COMPARE!

Dear Sinclair Owner,

Welcome to the exciting world of the Basic Computer Newsletter. A newsletter designed especially for you, the Sinclair Computer owner.

Each month the Basic Computer Newsletter will offer a large assortment of new and useful programs that can be put into use right away, either in your home or office. Basic Computer Newsletter will fully outline and explain each program in detail. The programs are written in such a fashion to permit enhancement or modification for maximum usefulness and profitability.

As a Basic Computer Newsletter subscriber you will soon have what we consider to be the least costly and most extensive library of superior computer programs available.

2 ee ne) es EP 2 ¿Cano DAMM E S o o we? ds

. 8 PR F " FEENTER COLUMN NO. (8 . noO a pn

. 9 INPUT B a * EDUCATION PROGRAMS ¿oro |

ig PRINT “REMEMBER PRESS ic? TO 2 ere

Dil PRINT EX PRESS ENTER TO RUN. Sc, ae ge^" EM TI UTR As po

UT Z$ | O

12 INP

13 ELS a. gro

20 FOR Hz To 21 Q,

=< S PEOR C AN— Q e | = | X, pM

* " m Y ope o atte! Y " nul 7, y sobe . an t m D aeons] s “n, * Dex "n an "^ i 4, " e am v Ms e sel

« 22 REM i32 INUERSE SPACES) ' BUSINESS PROGRAMS My o??? | eo MEXT H e So sara saa HOw F > Jo" T XUI Qn e IMp seg LET X-H ROVE pp S2Ø LET A$=CHR$ 136 0 * * * CUBCRIBE NON? AM 530 IF INKEY$-'"5" THEN LET Y=Y- | MES SI A EI Paga A RRA A E i subscription. Make check TET to BASIC ES IM Hie TES eS TARE. LET =z- : sis ehe zo 580 IF INKEY$="8" THEN LET ¥=¥+ | | S82 IF X:5-24 THEN LET X=B0 | 563 IF Y:-2 THEN LET v=1 cir IP oe ees: A y dy eT O, E E ADDRESS AD ELO PRINT B Cras na A CITY or MES n : State . Zip A O UA Br E c: LP Ef E y $? 5 gi SUL IF INMEYX-2' C" THEN GOTO 22 BASIC 3705 BISCAYNE BOULEVARD MIAMI,FL 33137

CIRCLE 21 ON READER SERVICE CARD

The Anatomy of a Program Line

Mark Fisher

Program listings on the ZX/TS computers are available on command. With either LIST or LLIST, the pro- gram in the machine is displayed for you to study or change. But not everything in the program file is displayed! Three elements are censored from the Listings you see.

But ignorance is bliss, you may say. To an extent you would be right. For most programming chores, understand- ing the structure of the ZX/TS program file is unnecessary. There are times, however, when you may want to work with the program file itself, e.g., when renumbering lines or trying to save space, and, at these times, knowledge of the structure is important.

Computer Structure

This paper is a tool for holding information. The shapes written on it (letters) mean different things as they are combined (words and sentences).

The computer is also a tool for hold- ing information, but it is built in a dif- ferent way. There are two main differences: 1) it holds binary numbers only, and 2) it is linear, like a string of beads, rather than two dimensional as this paper is. For the convenience of the human users, both of these attributes have been “covered up.” You can communicate with the machine using letters and decimal numbers, and receive its replies in the same way, but the ma- chine is doing a lot of extra work to accommodate you. When we look at the structure of the computer, though, we must keep those differences in mind.

Mechanics

The computer stores numbers in a long string. Each number, in reality, is a collection of 32 transistors, formed into

Mark Fisher, 8014 Flower Ave., Apt. #B, Takoma Park, MD 20912.

March/April 1984 © SYNC

You can communicate with the machine in letters and numbers, but it has to do a lot of extra work to accommodate you.

eight switches, or bits. These eight bits together are called a byte. As it happens, eight switches can be arranged in 256 different ways, from 00000000, 00000001, 00000010, ...to 11111111. We can think of each arrangement as a number, between O and 255. Each of these eight bit numbers has a fixed po- sition in the string of numbers; these po- sitions are called addresses. Not all addresses have switches presently attached—it is a little like a new Levit- town, with empty streets stretching off into the distance. In the basic TS1000, only the addresses from O to 8192, and from 16384 to 18432 are used, while the machine could work with addresses up to 65536!

The Program

Type in the program in Listing 1. It will be stored between 16509 and 16607. You may want to change LPRINT to PRINT after you have RUN it once.

Listing 1. 10 REM SAMPLE PROGRAM. NO. i 0 FOR N-i5583 To 16686 34 SCROLL 428 LPRINT N PESAN) one 105 CHR PEEK N S@ NEXT N

Otherwise, type it in exactly as written —the success of your future POKEs de- pends on it.

This program uses two features of Ba- sic to help us examine the machine’s memory: PEEK and CHR$. PEEK, fol- lowed by an address, will give us the decimal value of the number at that ad- dress. The machine can interpret that number in several ways—(as text, as a

binary number, or as machine code). We can use CHR$ to command the machine to translate the number into text. POKE, the companion command to PEEK, lets us change the value stored in RAM.

Tokens

RUN the program and look carefully at the results. “Wait!” you say, “each address is supposed to hold one number, and some seem to hold whole words.” You are seeing tokens. When the ma- chine translates its memory into text, some numbers are assigned whole words, rather than individual characters. A list of all the tokens is in the character list in your User’s Manual.

The Powerful 118

The next thing you notice is that the nice, neat program lines are gone; the numbers run along without an apparent break. However, two kinds of breaks are there. Note how each line of the pro- gram has a 118 to conclude it (each line of the screen display has one also, but that is a subject for another time). When the LIST routine is drawing the program to the screen, it uses the 118 markers to signal the end of a line.

We can have some fun with that. Type in POKE 16520,118 and ENTER. The LIST routine now thinks that the REM is in two parts! The program will still run; the machine uses a different method of keeping things straight as it RUNS.

Now try POKE 16521,118 and EN- TER. List the program. Where did it go? It is still there; try RUN to prove it. The LIST routine interprets two 118's to-

17

gether as the end of the program file. If you want to see the rest of the program again, POKE 16520,0 and 16521,0

The Silent 126

The machine has another flag hidden in the listing. RUN the program again, and watch the LISTing of line 28 (ad- dresses 16536 to 16566). The number 16509 appears, starting at 16543. You see the character codes for 1, 6, 5, 0, and 9, but there are six bytes of garbage be- fore you get to the “TO.” The 126 tells

the computer that a five byte binary number follows. This number is inserted after each decimal number you include in your program line, as the line is copied from the bottom of the screen into the program area. When you press EDIT, these numbers are stripped out. Try POKE 16520,126. LIST now thinks that the letters “PROGR” are a binary number and hides them from you. They are still there; RUN the pro- gram again to prove it. Now LIST it again and pull line 10 down with EDIT.

Figure 1. 1850932 Y issa4 232 i 1865539 36 a 16584 2ii PEERK 16516 i9 16525 128 7 iosoaü 128 7? 15805 91 - N 15511 23 x 16536 8 16361143 E 10585 ESO. ; 165ie 8 18537 22 = 16562 1 i55287 194 THE 16513 234 REN 16555 27 16563 laz " 16585 ga ae 16514 56 3 185339 8 16564 a 16583 23 e 16515 38 A 16540 235 FoR 16555 Y 1659298 125 7 155816 50 .M 15541 51 —N 16556 113 7 15591 1532 9 19517. 53 P i6Sd42 2a = 16567 @ 16592 32 4d 16515 49 L 18543 20 1 16565. 38. 2 16593 Y 15513 42 E 16544 34 5 16563 z 156594 dg 16522 2 10545 33 o is578 Y 15595 ø 16521 53 P 155465 22 2 190571: 231 OORA 16598 25 ; i5522 55 R TOSA Z 237: 9 36572 118? 15527 214 CHRS 15522 52 a 165458 126 77 16573 a8 16598 211 PEER 16524 44 G 16543 143 E ies7rá da G lesa si bj 16525 55 R 16558 Y 16575 2 * 156528 113 7 1565286 32 A 16551 250 IF 165785 Y iggi a 16S27 50 M isssz a 16577? 225 (PRINT 165@2 5: H 15523 26 5 16553 8 16573 5i 4 16593 3 - 16523 a 16554-2239 TO 16573 25 jesui Qu iss538 Si bi 18555 ga i 16588 li 15605 243 NEX 16531 Se a 15555 34 5 iesai ø igas 5i HN 15532 27 ings? 94" 6 15653211 166847 113 7 16533 2 18553 23 a 16533 25 issues 113 7?

The 50 ready-to-run programs in this book will show you how! e aS

18

If you suspect you're not getting all you can from your Timex Sinclair 1000, here’s a new book that will make sure you do.

In The Timex Sinclair 1000 Idea- Book, David H. Ahl puts 25 years of experience to work—to help you put your computer to work.

It looks the same as in the listing, but “PROGR” is now deleted. Press EN- TER to replace it, and RUN to prove it.

This will happen to machine code if it happens to contain a 126 (which, un- fortunately, is a very important com- mand) and is pulled down with EDIT.

Try POKE 16548,0 and LIST. This will remove the 126 from behind the decimal number 16509, and LIST will provide the CHRS for the five following bytes, rather than skipping them as it normally does. Sometimes, a bad load will change 126 to something else, and the program will not operate correctly. The symptom, of course, is six charac- ters of garbage following a good number in the LISTing. If you like, you can add a program such in Listing 1. Identify the address of the missing 126, and replace it with a POKE.

More Anatomy Line Numbers...

There are two more “structures” that help the machine navigate through the program file. The first is the line num- ber. This is stored in an almost logical way. Remember that the largest number that an address can hold is 255. How would it hold a line number larger than that? Let’s see.

EDIT line 50, change its line number to 300, and RUN. The line number for

Each of the 50 complete, pre- tested programs is designed to illustrate a specific problem-solving technique. By working these pro- grams on your own computer, you'll understand more fully its hid- den strengths. Plus, you'll learn how to overcome its inherent Weaknesses.

Armed with this knowledge, you're ready to put your Timex to work performing a multitude of practical, everyday tasks. Ten infor- mative chapters show you how to solve problems using:

e Repetitive trial e Geometry e Convergence e Science

e Recursion e Simulation e Compounding e Drill

e Probability e Practice

Order your copy of The Timex Sinclair 1000 IdeaBook today— and start taking full advantage of your TS 1000 and ZX-81.

MAIL TODAY TO:

CREATIVE COMPUTING PRESS d Dept. NI3H, 39 East Hanover Avenue

Morris Plains, NJ 07950

Please send me _________ copies of The Timex Sinclair 1000 IdeaBook for only $8.95 each, plus $2.00 shipping & handling per book. l Total AmountS ca icol, O Payment Enclosed. (CA, NJ and NY State residents i please add applicable sales tax.) i O Charge my: (Charge and phone orders: $10 minimum) O American Express O MasterCard O Visa | Card +

Exp. Date

| Signature

| Nam (please print)

i ADDRESS | GITY.

A IO e OSS e NE à "Outside U.S., add $3 for shipping and handling. i O Check here to receive a FREE catalog of computing books, magazines and guides. For faster service, PHONE TOLL FREE: 800-631-8112 (In NJ only 201-540-0445) Also available in your local bookstore and computer store.

March/April 1984 2 SYNC

= =

On the TS2068 the program file no longer starts at 16509 or any fixed address, but PEEKing 23635 and

23636 will give the starting address.

that line is held at addresses 16601 and 16602. The computer has taken the line number 300, seen how many 256’s would go in it (one), and put the remain- der in the next address. Try POKEing 16601,10 and LIST. The first number now represents 2560, and the remainder from before is added in, making 2604.

And Line Length

There are two more bytes to account for. These are extremely important for the machine, as they tell the computer how long the present line is, and thus, how many addresses to move to get to the next line,

RUN, and look at line 10. Address 16511 holds 23. Now starting at the first byte of the text of the line (16513), count down 23. You find the 118 at the end! Many computers only allow lines of less than 256 characters (can you guess why?), but the ZX/TS machines support lines of essentially any length. If the length is greater than 255, the same op- eration as the line number is performed, with one byte getting the number of 256's in the length, and the other getting the remainder. There is one catch though: the two bytes are in reverse or- der, to speed the handling of the num- bers by the Z80.

If You Have a 2068

The 2068 is organized in a similar way to the 1000 and the 1500, however, 1t was designed to provide a wider variety of abilities. Therefore its overall organization is much more complex. The organization of the program file, though, is very similar. The changes are:

1) The program file no longer starts at 16509, or any fixed address for that mat- ter. Finding the program is simple, how- ever, as the address where it starts is stored at a fixed address. The starting address of the program can be found by using

PEEK 23635+256*PEEK 23636

2) The character codes have been changed to conform to the codes used by other computers (ASCII code). This is not too criticial—CHR$ will still give you the meaning of the given addresses —but the 1000’s end line and number markers (118 and 126) had to be changed. The new end line marker is 13, and the new number flag is 14.

3) ASCII codes below 32 are not printable. Like the end line (also called line feed or newline) or number marker, the other numbers below 32 generally

March/April 1984 9 SYNC

give the machine instructions and will affect only how you see the characters that follow if you attempt to print them.

We can still look into the anatomy of the 2068’s program lines, though. The program in Listing 2 will do it.

Run it, and now go back to the TO-

Listing 2. 14 REM 2852 anatomy

20 FOR xzPEEK 23635+25654FEEK 2 3636 TO PEEK 2362742562PEEK 2352

SO PRINT x, ". .PEEK x,: IF PEE E x:31 THEN PRINT CHAS PEEK :

428 PRINT

Su NEXT x

we

KENS section, and follow the explora- tion of your machine. You will have to substitute 13 for 118, and 14 for 126 as you go along. Try hitting inverse video somewhere in the listing, and look for where it appears in the program printout.

Now you have seen part of the ma- chine’s structure that was hidden before. Like a sleek car, it sometimes pays to lift the hood and appreciate the effort that went into the works under there as

well. "n Figure 2. ee7ie Y 2678s Y zo711 i8 26733 43 + z6rig2 i4 26754 58 P 25712 2 26 725. 0 x 26714 23 REM 25725 54 = 28715 528 2 25797 26716 43 a 26723 8 geo?i? 54 5 258723 26718 56 3 go,;ag8 25713 32 go?2i i 26728 37 a #26792: 0 2ge?2i 118 E 257393 de E 26722 97 3 26794 198 PEER 28723 115 t 5795 58 = zerzd ili e corso di 3 ¿6725 103 m 25727 54 5 267265 izi d 26735 58 = s6727 175 25793 55 a 267233 8 ¿soe i4 2e?2ga 22 26581 g zo?2cü 75 E 2sosd2z 8 28731 8 25805 75 E 28732 225 FOR 25584 az * 28733 1208 x £65325 2 gETS3Sá sl = #6885 15 ¿57553 198 PEER 2¿osur Y 28738 Su 2 sos 38 20737 51 3 ¿oa 32 28733 S4 = ses ia Y 26733 51 T ¿bli ž45 PRINT 26740 55 8 ebsiz 129 : 2o/4i 14 263813 55 Sarda ð 26814 34 Sera 8 25315 32 ghevád 23 a 265815 34 + 25745 32 3 £6817 59 ; 36745 Q 26813 199 PEER 26747. 43 + ¿6313 izàa = 265743 su 5 ¿56528 44 : 28743 53 = 26821 53 26750 & zbozz 258 Ha 2875 ¿5323 138 PEEF 287252 4 #265824 122 x 228753 8 26825 52 $ 2287254 & 26826 5i 3 285725 1 25327 49 i 28758 4 26323 14 25757 42 P 26829 a8 108 PEEK ¿5338 a Se 2 26233173 Si 3 26832 a a 26333 a i2 Si 3 £5834 pua THEN PS 5 26835 245 PRINT 25784 14 265335 1294 CHRE 28785 8 26837 1238 PEER 256785 A 259533 120 Xx 25757 84 T 26839 59 : 26768 392 £68408 i2 25763 P 26341 e 25778 204 TO 26842 42 i 26771 190 PEER 26943 2 26772 50 = 25944 8 28773 =1 ^ 25845 245 PRINT 26774 54 E £5846 13 26775 52 = 26047 Y 26778 55 5 26943 58 2 26777 14 25649 3 26778 8 53509 267739 8 25351 243 NEXT 256788 75 E 26352 120 x 26731 92 206953 13 25354 243 SAVE

19

ZX81/TS1000/TS2068

An Assortment of Sorts

William F. Tracy

When you must order and retrieve information, you can recall data in mini- mal time if the data has an orderly place- ment. In a program to store names and telephone numbers consider how you would locate someone if the data are in random order, e.g., Jones, Smith, Allen, Zimmerman, Travis. Location of a spe- cific name could be made by starting at the first of the list and examining each entry until the correct one is located. Such a process is known as a linear search (see SYNC, 3:6, for a machine language linear search). Linear searches are easy to conduct, but time consuming to execute when the material being searched for is longer than a few items. The usual way for humans to order and search lists is either alphabetically for names or by order of magnitude for numbers.

Comparing Sorting Types

Any system of file handling will usu- ally include routines for sorting (arrang- ing the data in some sequential order) and searching. In this paper, four sorts will be examined: Bubble, Float, Shell, and Quick. There are others but these were chosen because they are popular and because they represent slow, inter- mediate, and fast, as well as simple and complex algorithms. Let's look at how they work and the speed at which they order data.

The routines were run with numeric and alphanumeric data and timed with a stop watch. Three runs were then av- eraged. The first trials involved sorting numbers under two conditions: 1) a "Worst case" situation in which the orig- inal order was from high to low and the order to be sorted into was from low to high; and 2) a random order grouping. String timing consisted of sorting strings

William F. Tracy, 200 Retreat Court, W., Hermitage, TN 37076.

20

Listing 1 gives the program for sorting numbers, and Listing 2 for words. To use the programs, type in the listing you want. Note that the line numbers are parallel so that the other listing can be entered with minimal editing.

After you have typed in the listing, press RUN and ENTER. The program will then ask how many items are to be sorted. If words are to be sorted, the program asks for word length. The pro- gram will then generate random data.

Listing 1.

F ES = = pa e DIA —— = Rii liine i - PAS ED i

Mr RF DEDE oe en zt xi

Exo Gc TT

TTT AL

AAA ER Eu E C a I P

n irr thin RUP is 1 H f i

Hou Ho ks

LL Fe Ca FU pens fa n IC ns CP CIL e

V Meg Ig E

9] 4 e CO e pe en Ros or e

F4 bef bet Fe T]

IE Be Cad be E

wars

A CTI p C I E Ig IE

Tl EXE XM

> Ga im - $3 = ji! R [1 SLi il e = i => EIC ts m=i = = —— T Ril 195 Hit = >e Poi dic $ TE firs: Éi THE ES TA ae fi Sm i Ct. = Te | AD PL uw LO NES n =, x" n i £T ii = TS H ii mii - oT Li —= E | DIG RICUY.UT = a E e, Erp E T mi A; o im $ is IM ¡or rt 4.2 į H t H 1 ee Í ; EUT ii i H H iB : sam EY ilii TE i: a i sos st n5 CU i LB e m ili i: = se HEM E e be : = 1 1 " i H "I i Sg 4 H i H m Li ED i =F A i4 = = TS min io? m ai Eu ii L =r si $T ne 22.23 23.4 2 Lr e de - ii p 1 1 T i 1 $ : == EE i CUT j -h L S PES S II TL TE T v Zi Tio? 17917171542 £c a} st zc M iz LEES AENEA i Sg gs Hi p H 1 1 iP OZ i i H i ST ii! i oT

mimrmam m

XETET GO Ze

M GUIDHE SORT A LIH PERMISSION Y HON SCHUSTER, INC. ROH: THE ESSENTIAL GUIDE To TIHEX -SINCLAIR HOME COMPUTERS BY HORSE, ADAMSON. ANREP, AND HARCOC

aro RE! == = BEG DIM SINUM.S Z LET Pg fe Let ST via LET Ronin fee LET -IsL Foe LEF JsR ¿de LEFT. 22 Ll a A A A ES NE THEN GOTO seY TOU .LEI Fea te TM LEL Bist stiita “Ha” LET UtOdTT 72ag LET S35=-3 sad IF S=1 THEN LET Zi=-1+1 310. IF SSI THEN LET Jsd-1 aga IF Id THEN GOTO 758 230 IF I4+i:=sR THEN GoTo 370 S48 LET P=P+1 350. LET Seth Feet asd LET 51P,23=R aya LET. RzI-1 338 IF L:R THEN GoTo 728 aan IF Pzü THEN GOTO 35 aaa LET L-3iP,ii aid LET R=3S1P,21 S208 LET P=P-1 G38 GoTo 728 S48 REH == E 225g CLe S62 PRINT UARRA SORTED SLOL asd FOR Xai TO A 5200 PRINT Utx: iega IF x193 THEN SCROLL ITALA HEXT Xx iaza PAUSE 588 1838 CLs 1942 GOTa 32 ias REM GENERATES ERNDOM HUMBERS AND FILLS ARRAY 1859 FOR xX-1 TO HUM iara LET ilixiziMT (RHDS339 ¡asa HEXT X isa RETURN ii32 PRINT BT 5.35: ‘RICK SORT’: a ote og de BUBBLE- HI OO BH. F LUNMT .HT-- TO A A OHELL wae es AA MA a iiic RETURN

March/April 1984 © SYNC

———— AO

21st CENTURY ELECTRONICS

6813 POLK STREET GUTTENBERG, N.J. 07093 . (201) 869-2616

COMPATIBILITY for your TIMEX 2068

UNTIL NOW, THE ONLY PROBLEM WITH THE TIMEX-SINCLAIR/2068 MICROCOMPUTER HAS BEEN IT'S INCOMPATIBILITY WITH THE MANY FINE PRINTERS AND OTHER PERIPHERALS OFFERED BY THE COMPUTER INDUSTRY. 21st CENTURY ELECTRONICS NOW BRINGS YOU THE TWO MOST COMMOMLY USED DATA INTERFACES IN THE MICROCOMPUTER INDUSTRY. THE CENTRONICS PARALLEL INTERFACE AND THE RS232-C SERIAL INTERFACE CREATED BY AERCO.

CENTRONICS intertace DUAL RS232 interface

THE ChNLRONICS INTERFACE THE RS232-C INTERFACE: BRINGS GIVES COMPATIBILITY WITH COMPATIBILITY WITH MOST LETTER

ALMOST ANY DOT MATRIX PRINTER QUALITY PRINTERS AND MODEMS, AVALIABLE. GRAPHICS SUPPORT IS TWO SERIAL DEVICES CAN BE PROVIDED, AS IS THE ABILITY TO CONNECTED AT ONCE, WITH AN PRINT TEXT IN EITHER THE PRINTER'S ADJUSTIBLE DATA TRANSFER RATE NATIVE FONT OR IN THE TS/2068 FROM 300 TO 19200 BAUD. DISPLAY SCREEN FONT. CABLES INCLUDED

UPLOAD - 2000 by Dave Ornstein

NOW! GET FREE SOFTWARE BY MAKING YOUR TIMEX/1000 PROGRAMS COMPATIBLE WITH YOUR NEW TIMEX/2068. NO HARDWARE INVOLVED. EVERYTHING IS ACCOMPLISHED. SOPHISTICATED SOFTWARE. YOU WILL BE ABLE TO CONVERT ANY TIMEX/1000 PROGRAM WRITTEN IN BASIC TO RUN ON YOUR TIMEX/2068

CASSETTE and DOCUMENTATION ONLY] FANTASTIC VALUE

DUAL FLOPPY DISC DRIVES BRAND NEW, dual floppy disc drives made by Digital Equip- ment Corp. (DEC model no. RX 180AB). This beautiful piece of computer hardware consists of 2 Shugart compatible, 40 track, double density, 5'4” mini floppy disc drives brand new in the case with their own regulated power supply, cooling fan and on/off switch. Each unit also comes with a line cord and full documentation. These were made for DEC, but should be compatible with many other personal computers such as IBM, Radio Shack, TI, and other similiar systems. Naturally, you supply cables and the controller board. The disc drives will run on either 115/230 vac 50/60 Hz. without any modification to the drives. Each unit comes in its original factory carton. All are guaranteed O. K.. A block buster of a buy !

Digital Dual Drive Unit Reg. $500.95

Interface Board

ZX-PROFILE on board DOS In ROM

NOW BY TOM WOODS

NOT ONLY ON CASSETTE Industry Standard IBM Format$189.95 BUT ON DISK FOR THE 21st CENTURY AAD RA PO Ww SP A DISK DRIVE SYSTEM AND AERCO DISC :

DRIVE SYSTEMS ONLY $39.95 Complete Disk Drive System

ON CASSETTE $16.95 Includes Drives, Interface Board

& ZX-PROFILE $599.95

All orders shipped postage charge C.O.D. Personal Checks take 3 weeks Sclear AMX - VISA - MC - Money Order or Certified Check for Turnaround Shipment

CIRCLE 72 ON READER SERVICE CARD

ges am «n ge y. 5 ie: po] c = po) O O z o & I O) E" 5 " 3 OQ 2.3) E ! à e C $ e eo JQ O 5 T d à E r som O o a o gU - Š M UA hi " ho rr ul po) vo Q 2 O Oc O Q 9 ec ND rar tr "i c EI a £o o= O 5092 s QF Ss n as z tz 10 rem: SE ^x SS c e om $ Ez cu nf z Re ET co o > O = O to YK) m Te) (D 2 A ps r.a ut "n x wl] an iD ENE og EO 5%F T o c = 9 A BA " c 3 Bn e O Elcg 80 HI gs pi O 66 T e. a: (Be OY 32828508 OLTE o. T d 232 |, 99 ca ^ o wi 5 Ham o SUP 902 c-o&8t5 o a 2 ps " zz t BS T 5; een -— O E ef £38 "Se caro gr UE: Bee | cuits a Mas? Ba Vu Grcz 2 _A= 08 i0 o im d O E cic t s . B. dU NEM =< C OESEEE od 997 Q Mc Q $35 va |S > T v DER E as b- =i Y C o OQ L xw c't E =l © m "rz ci - M " na cipi na ; 5 T arb c HE w TRN O os CRED > Ü Sumas 25508 ac Y O33 "Ite TIR T PFO 3m à ie figa A. ae: m. ien Se 5 V A - w^ n az sl N O o oO > O Lil x o c Or O + t zT Oia un = e F- H- -J ‘mye e Wu uua och —. ELA A i KE «+ © 3 O <= c Ooo O05 otc O = 'a ES: ea A S ba uud M.. ay} za 96 ee y 2 Nxt =e m QUO: e » tcc 0. Po cot 1 5 a 29% Q l.. Uap a td dad da 7 JHE uM Pe inca "ME S FIEL - low Ni o & = 0 Pe cod cad FAA dd E SAO Cp L.C CE M. A be Se it saa ouem od Ch ih f Ce ajan «t > 4 . . o > FO 2 a S. A 7, ES r- É a rat tr 2E CE ol Ch. n E. vr cmm pa ie bd Sint ba ro PG A e = ye (D) ODE E "COL AA CO Ce LL. Uc. od iei rimis Aza M rr Ex “mp ea = "eu e e EA c Cu Cr x Mer uc P v a (Ca a Sa a a C E "ARM ORE AU CO A cL Er Cu «114 " zo um ea ca cn cen en en en en en e = E * ru mis un un R ope A EL AH AD E E CAA E EN , | A 5 8 OS ta e C E Cu e Lo I P mmm GG E ehas Ed ar Der ner per par Der Par cd hoe Y = e + v 4 $ aec ER rt aet a a = ct s IDE Er Koan Keia E Ban Keia e i: war oec: rm tcc E S S ded asd « ua W oO O ^ | gua u| ESE : " O Spx V à A a mn t m E A. ©: z| og s d E DNO hh + Pus ; s "T, o. Ww RSS T * LE: £ s AU a [5] o I T ON] "7 © c CB « RN i 5 uino > 2 pe opm D E ^ r^ Me cs » uie bD bb E 5 E u E © El 2 Hr $9. im I^ © z Lr) 2 apn - - xz - x E E MEA cD) * IN. I oe, Ut vod lee ` am © d 5 + E 7 At: EAT y a Ha t zii Ia inland + aa TAS eA 0 dn E p- Tw WT Ii e E s ee uu A Cal Y er $ sot Wt: © T N D see Won ow ona irte ae OEE» 23. uo cd ied, ume D LL MUS Y C Y ^ RD Jus). “EFF EFF EFE T bd MIS L CE nbn W bom ua dq T S " ia J- a LACE n fe + E BER a TE FIR M Ys ‘ont | do oad Lal. | se m "oc ud za 50.2 "OQ 3 ho: Core fe i n | a E ib n WoW EW me | 7] ^ CL 5 e. Q c 3 g 3 c iii b ua Wd W.. [it E ff E (spes Be 2. da V EL Lud CE F4 RE tai tobe P i NIS of i o o (ncc cc CE T Sas AI AT OE ft Sa de, ite |) m ARET wis = o yo] aL 4 ba Ud d. i NS x 108 MAS n bas Cw (O e S Bgaga |3 Med MMe oe coe o ee a ee H = e Ss 2 > 2 E n ES Es E is Carta Do TOO a... y in : ba a a od UL. da. 13.. da mm m © Boe eal ee AIRIS ADAL sa aan JA Ae Eres y VU E tn n d ep msn ua na ab hs b tied M d rar; ^ | > nio up un vb up ua o una els ail Pe Rh Ca fa a a a P Qo o ww" BP P P PPS PT: are CR ed Cu 3 «rU D E z Y ET e « [d n e n wn "m bas o- dd "E 2g m oO t wi de Ó ego ea -= d cO» CL = = E E 5 5 o a = p o c - Sa n S US e Q 5 = = De EURO a E t ra e 4 p rr. "al I" O o0 o wd CJ rl CC e UC ua po Qo <S o S 1 CL e rl ("i C oO oO Q 3 - (OS E AN E OA E pes q E D Ci Ute ied ES z a E LL 3 8 + Tam LY ca E cu wha! ajos? ont = T CERA = (a e mas r4 o E E bo. * mee en dc e x (n " > nn 202 wir de. Un E A Aa e Du a+ aah, Wi Mor oz ra b S pd P- hy = = ar 3 u T PME. ii v po sal 4 s zal z E cu ers EE ef be pzz + li T a : 5 cuu. o EE i aaa TT TENERE "TREES po Pl oe Z 5 " od e C T - dl oe mee ee 5 HH TU cool wa gu = ES t 7 p 4 Ds | Ds | | ES bid à | r ul " =t úl [- |--: cies of 4 mr a Ya E yn e de m 3 ri c V wo espe an Edu a EST A fup [oo HIT zt SSS is E Mr ERAT E i i arar o aramee ca nif "eani i yl = head TH: Qf em pa: pul hen ORE CESE IR AET Ba CAC T HA R ARC CCR) El IN ee = ^O ur c ce -+ LAN, Debe ier Pt E ES Tc LAM me AFE IV ri ian an rs A o9 B GIC DE LI CR a m en EE Fl en Es nrbt em aeneis gs NE E SALUR amos e DISTR RR A A O 1I C C o da da. ad Und la MEE EER pete ES => = >> e ra 653 Gu u. E Aid dd (¿E DRM dvo. MES ns BE peri. ur) b Ca l. tu tud ELE na A PAPERONE AUN TDR DNE AUN RR I PEL A d A "n t Ui E ra Ea a ra dE cr Bere seed cont one S F C E SO IPA a P cheat cde Sora iwi FOL A 00 O o pod ta 0734 6003 6 , 5 eJ UI MECE E E e E E E

March/April 1984 © SYNC

22

All products are compatible with TS1000and TS1500 Computers

A Reliable Fast Loading System

Operates 16 times faster than the Sinclair system (i.e. Loads/Saves 8K in _ CS; 48K in 110 secs) iS with any memory and on any n length

'ograms, BÁSIC or MACHINE CODE S what you get: | - 1. A cassette interface to improve the ~ Signal quality. To make loading most reliable an AUTOMATIC LEVEL - CONTROL, an OVERLOAD - WARNING LIGHT, a SAVE/LOAD SWITCH, an ON/OFF SWITCH are . also built into this unit.

O | 2 Lom sophisticated, superbly easy to

use 1/2K software for up to 16K and 64K Programs HPL7001 $37.95

QSAVE software on Solid Stato cartridge available Separately | a #PL7001 c $24. 95 . Complete unit with software on olid State cartridge #PL7001B $57. 95

tridges need Flexible Ribbon Connector Ver.2.-

(Decoding Tool) B

-New Memotech DMX Printer - 80 Column to 136 in condensed form - Sharp, Precise, high-speed print - Bidirectional, tractor and friction seed. - ee _ #PL7025

_ $395. 9590

FH ercorst potes.

NEW VERSION #PL7013B $99. 95 (Ribbon Connector included) * Compatible with Timex Computer

INTERCONTROLLER.... PUTS YOUR COMPUTER TO.

WORK FOR YOU AROUND THE CLOCK.

1000's of new applications at home, office, laboratory or shop. INTER- CONTROLLER™ enables you to use your computer's power to control any number of tasks, everyday of your life, with just a few lines of BASIC. Four fully programmable outlets. Expandable to 16 with SOFTBOX. TM

The first real integer BASIC compiler

for the TS1000 computer

Give your BASIC program the speed

|... Of MACHINE language programs . 75 times and in some cases up to 900

times speed improvement

Very simple to use:

1. Load MCODER

2. Write your BASIC program according to the manual and compile it through the MCODER by using a single PRINT USR

command 4PT4001 $18.95

No More System Crashes : E Connects any RAM expansion to your

| TS100 ° Prevents usual system crashes caused by the computer or the RAM movement hd 9 inches long flat ribbon cable $17.95

#PL7016

> Version 2 with an EXTRA port for Peripherals ¿PL7016B $24.95

Write machine code quickly and easily Two pass assembler, ZILOG mnemonics, 8 pseudo-OPS o | Debugger includes odifying, breakpoint with

play ® Occupies 7K, comprehensive multi- page manual #PT4003 $18.95

CIRCLE 29 ON READER SERVICE CARD

e Enables you to break through any machine code software, list it on the screen, save it on another tape, or print it out Very simple to use, load STOPPER into your TS1000 and follow the simple instructions on the screen a

#PT4002 $18.95

DEALERS/DISTRIBUTORS PACKAGE AVAILABLE.

Phone orders: (617) 738-5310 7 days a week. Cail or write to us for FREE brochure and a information on our full line of

Mail to: intercomputer, Inc., 358 Chestnut Hill Ave., Boston, MA 02146 Tel: (617) 738-5310 Telex: 951141COFAR

Shipping and Handling for MEMOTECH and QSAVE for EACH PACKAGE Mass. Residents Tax 5% a Total (Visa O M.C. O Check Account No. | Name

City

No Shipping & Handling Charges for Cassettes

The Bubble sort is slow; the Float, twice as fast; the Shell, four times faster; the Quick, among the fastest.

tion. It is comparable in time to other sorts when dealing with 15 or fewer items not in a worst case order before sorting. The Bubble Sort, as with other sorts can order data in any direction, from low to high, or high to low. The sorts, described order from smallest to largest in value.

SUNTRONICS

sun KD-81 ae

If you're tired of not knowing whether your data got entered or tired of poking data in with one or two fingers, then it's time to upgrade your ZX-81 to a full size, professional keyboard.

KD-81 FEATURES

* Full size keyboard with 41 keys

e Two color silk-screened key tops for easy e reading

e Key tops have commands and graphics spelled out the same as ZX-81

e Extra shift key for real keyboard-style typing e Full size space bar

e Allows touch typing

* Rear cutout allows any RAM or

T/S 2040 PRINTER *89.95

* 6 445

Add $7.50 Shipping and Handling for this item.

=== SUNTRONICS e CO, INC.

par enema we 12621 Crenshaw Blvd. Hawthorne, CA 90250

-— = Cam STORE HOURS: MON.-FRI. 9:00 am to 6:30 pm SATURDAY 10:00 am to 5:00 pm

BEST KEYBOARD AVAILABLE!

For Your 2X-81/TS-1000

SAMWOO MONITORS GIVE YOU A BETTER PICTURE

SAMWOO provides a much better picture for your Sin- clair Computer than your TV monitor. Simple modifica- tion procedure includes easy-to-follow instructions.

B TCU uso everti

Diem. s A sr. DNE 67 i cS

16K RAM MODULE (MX-16KP) 549.95 64K RAM MODULE (MX-64KP) 599.00

In a sort of N numbers (the variable NUM in the listings) the Bubble Sort works by comparing adjacent numbers. If they are not out of order, it shifts their positions. The first elements n1 and n2 are compared, then n2 and n3, n3 and n4, etc., until the end of the data. When N is reached, the largest value is in the

|_| Includes Shielded Case C] Fully Warranted For 90 Days [| Now In Stock L.] Hundreds of Satisfied Customers

NEW LOWER PRICE

DEALER INQUIRIES WELCOME

expansion module to be plugged in e Keyboard comes with own cables

e Keyboard case holds both keyboard and _ computer with room to spare

e High impact plastic case with vaporized metal shielding

e Easy assembly no soldering, no modifications

e Measures 10',"x7',"x2',"

PAPER (3-ROLLS) *7.95

Features:

e Composite Video Input/Output

e Switchable Input Impedance 75 or 10K ohm

$ 99.00 » 750 Line Resolution at Center and 500 Lines at Corners CALL e Dimensions are 12.13" x 11.34" x CALL 11.65” for the 12" model and 8.66"

x 8.54” x 9.05” for the 9” model

e Builtin output connector for piggyback e Lip for mounting on ZX-81 KD-81

e Highimpact plastic case with vaporized metal shielding e6.6” wide, 3.2” high, 1.08” deep

CALIFORNIA

213-644-1149

(for Tech Info and Calif. orders)

OUTSIDE CALIFORNIA TOLL FREE

1-800-421-5775

(Order Desk Only)

Mail Order Minimum Order $10. Send Money Order or Check. VISA or Mastercard (please include expiration date). Add $4.00 postage and handling to order. CA residents add sales tax.

94 CIRCLE 59 ON READER SERVICE CARD

nth position. The sequence is repeated until all comparisons have been made. With a random ordering of the distribu- tion to be sorted, there will be (N*(N**2-1))/2 comparisons. With data already ordered, exchanges = 0. In- terestingly, in other sorts, the final pass through the data is often a Bubble Sort.

The Bubble Sort offers the advantage of being simple and easy to understand. As shown it occupies 236 bytes. Its dis- advantage is slowness. Table 1 shows a walk through a Bubble Sort for 8 num- bers arranged in random order.

Float Sort

In Float Sort, we compare the first element with each succeeding element until a larger value is found. When

Table 1. Bubble sort number flow.

Order at end of pass Data 1 2 3 4 5 6 7

OD: 288 ^01*- Ole Op DI. 01" 01 28. OPE 28*- 28. 28 1 2 25 28 OL .4T* Ay: 41-4012 R IZ 32 47] —90*- 88*5 56* 329 oat 4] 47 93 88* 50* 37* Gr 506 36 . 56 88 56" -32 89" 88 - 88 8 . 88 56 = 32* .90* —90 .—90 90 . 9D —90 42.593*. 983 91 4 Hi 4 93 *[ndicates that a position swap occurred.

found, the larger element is then com- pared to each of the remaining elements. If no larger value is found, that element

Table 2. Float sort number flow.

Order at end of pass aua i 2 30 A MN s 7.

90 .90--56*- 56 327^ AA 0L Ol 285. 28. 28 —28 28 2 O 28 OT: Ol 0L ,.01- Dp "NLIS n 47 47 47 47 47 47 47 47 93. 32* 32 —32— 908" A -26-— 56 88. 88. .88 88 . 98. 88 .88 58 26. 365: 90* .90.7 4 E EE 790

32-9419 .93 93 915094. 99 - 93 *Swap

becomes the last one in the array and the value previously in last position occupies the former position of the larger ele- ment. If, after a pass is completed, the first element is the greatest, the first and last elements are swapped.

An advantage of the Float Sort is that, on the average, it is about twice as fast as the Bubble Sort. The number of compar- isons is N*(N + 1)/2. The routine occu- pies 281 bytes. Table 1 shows the walk through. With the numbers given, the sort was completed with 28 compari- sons, and 4 exchanges in 7 passes.

March/April 1984 2 SYNC

Shell Sort

Shell Sort involves an interchanging technique in which succeeding passes through the data place the data into a more nearly sorted list. The routine starts by comparing elements at least N/2 positions apart and swapping if the first element is greater than the second. This process is then repeated with successive pairs of elements, the same distance apart, until all elements have been compared. Then the comparison distance is halved for each successive pass through the data.

This routine is, on the average, almost four times faster than the Bubble Sort on 50 item sorts. It occupies 353 bytes. Ta- ble 3 shows the Shell Sort example which made 18 comparisons and 4 ex- changes in 4 passes.

Quick Sort Quick Sort works on the premise that it is faster to sort two small arrays rather

Table 3. Shell sort number flow. . |

Order at end of pass Data 1 2 3 4

90 32* 32 01* 01 28 28 28 28 28 01 01 01 32* 32 47 47 47 47 47 93 93 93 56* 56 88 88 88 88 88 56 56 56 93* 90*

32 90* 90 90 933

Table 4. Quick sort number flow.

Order at end of pass Data 1 2 3 4 5 6

90-I 32 32 32-I 01 01 28 28 28 28 28- 28 Index 01 01 01 01-J 32 32 47 47 47 47 47 47 93 93-1 56 56 56 56 88 88 8-Index 88 56 56-J 93 93-I 90 32-J 90 90 90-J 93 fa bed. la Ll IeJ 7 Pont: er ah RT J= J=8 Posi- tions

than one large array. This Sort is re- ported to be among the fastest of the sorts for disordered data. When data is not disordered but in inverse or nearly sorted order, this routine can be slow. As listed, the algorithm occupies 543 bytes. It is reproduced through the kind permission of Simon & Schuster Pub- lishers and is taken from The Essential Guide to Timex/Sinclair Home Comput- ers by Morse, Adamson, Anrep, and Hancock.

The routine operates by dividing the data into two groups about an Index value. The Index is such that the values above it are smaller, and those below are

March/April 1984 © SYNC

larger. Each group is sorted in turn. Sorting is accomplished by an upper pointer (I) and a lower pointer (J). The upper pointer starts at U(1) and the lower at U(NUM). If the value indicated by I is greater than J, the values are ex- changed and I is advanced one position. If J is greater, I is moved one position down and no exchange occurs. This pro- cess continues until the pointers coincide (I=J) and this value, U(I—J), then be- comes the Index. One group is set aside and the other group sorted by the above

Conclusions

Which sort is best? The answer de- pends on the number of items being sorted and their order. From Table 5, it is clear that for sorting large numbers of items, likely to be in random order, the Quick Sort is by far the fastest. If the data is almost sorted or inverse ordered, then the Quick Sort can be slower than the Bubble Sort.

When dealing with 20 items or fewer, time factors are not a major consid- eration and the programmer considers

Table 5. Sort comparison-time/number sorts .

NUMBERS STRINGS Size: 20 50 20 50 100 400 Order: Rnd Iny Rnd Rnd Rnd Rnd Rnd BUBBLE 6 40 34 7 43 176 waiting FLOAT 4 22 21 4 23 86 1306 SHELL 3 9 11 4 15 62 720 UICK 3 41 10 3 14 33 162

Time in seconds (rounded off). Numbers ranged from 1-99. Strings of length 20.

procedure until ordered. The reserved group is retrieved and sorted, and the ar- ray 1s ordered.

With the data shown in Table 4, the quick sort ordered the array with 4 ex- changes and 13 comparisons in 6 passes.

At last, the “SYSTEM” is com- pletel Your TS2068 and the new TIMEX Microdrives along with the new professional quality full size printer, word processing, CP/M card and CP/M software car- tridges make up a computer sys- tem that beats others selling for thousands more! The Microdrives are a crucial part of it all. They're light- ning fast, super compact, and amazingly inexpensive. Imagine loading 48K in only 9 seconds! In use, your typical access time will usually be only 3.5 seconds... there aren't very many disk drives that can beat that! You can connect up to eight Micro- drives to your TS2068 and they each hold a minimum of 85K You can networkthem with up

DEALERS WANTED

cMICRODRIVES!

...For your T2068 Computer!

to64 other TS2068's. And they're only as big as a hockey puck..they won'ttakeupallofthe space on your desk Best of all, for the cost of one standard disk drive, you could buy 3 - 4 Microdrives!

We have an information package that's loaded with specifications, prices, and ordering information.

memory requirements and/or complex- ity of the algorithm in sort choices. My choice for the “best” all around sort would be the Shell Sort. It is fast, easy to understand, considerate of memory, and relatively free from ordering effects. "a

(Artist'S Conception)

Just call or write to us and we'll send it to you. You can order direct through us or through your nearest E.

Arthur Brown/TIMEX dealer. If your dealer isn't supplied by us, please clip this ad, show itto him, and askhimtoget in touch with us. With our support, he can give you better service. It's important that you act NOW, though. Initially these new items will be under supply allocations and will be hard to come by for some time. Get your order in early

to be sure you're in on the first shipments.

Whether you're an established TIMEX dealer or just getting started, we have an excellent dealer support program. We specialize in TIMEX computers and carry the complete TIMEX line as well as nor TIMEX brands of peripherals and software. We

E IIR BROWN we can send you a complete dealer kit ! ©1984 by E. Arthur Brown Co. 1702 Oak Knoll Drive, Alexandria, MN 56308 @ 612/762-8847 or 762-1631 CIRCLE 8 ON READER SERVICE CARD

G3LNVM Su3a1TVad GILNVM SH31V3Gd

know our products and can back you up with that knowledge. There's no minimum on orders, so you can start small and grow. Write on your letterhead and include your state resale number so

25

Introducin

the MTX512

AWorld Apart from

the Ordinary.

It begins with the sense of touch. |

With the sleek black metal housing. Cool to the touch. Cool to the advanced circuitry and components contained within.

And the solid feel of people-sized keys set up in a field that gives you room to work and space in which to think.

But the difference only begins with what you see and feel. Where it ends... well, that's really up to you.

In a very practical sense, the only limits you'll experience with the MTX512 are those you choose to accept.

64K To 512K RAM - A Look On The Inside

Take a close look at the MTX512.

We could tell you it offers the greatest performance and versatil- ity of any micro in its price range, but we think you're smart enough to draw your own conclusions.

The design is elegant in its simplicity. Remarkable for the power and complexity it represents. 64K RAM built in, with total expan- sion to 512K. And that doesn't include 16K of video RAM con- trolled by its own processor.

Speaking of video, keep in mind this is no ordinary monochro- matic, single screen system. The MTX starts off where other micros end up. Delivering vivid screen capabilities with 256 x 192 pixels that crisply define interference-free high resolution graphics. 16 brilliant colors that can be displayed simultaneously. In a format powered by 32 easily movable, user-defined graphics characters. Graphics capabilities you’d find impressive in a system that gives you a single screen to work in. With the MTX, you have eight.

Yes, eight.

Eight definable windows to operate independently or in tandem. And still maintain full screen capabilities. Thus, you can manipu- late spread sheets on the MTX and see the impact of changing variables in graphics at the same time. Eight separate windows on the world. We call them Virtual Screens. You'll call them extraordinary.

Far from ordinary as well are the built-in system outputs that come standard on the MTX. The Centronics parallel printer port. The two industry-standard joystick ports. The uncommitted paral- lel I/O port. The Cassette port with 2400 baud. Separate TV and Video Monitor Ports. The 4-channel sound hifi output. We've even installed a ROM cartridge port for word processing and other dedi- cated programs.

Interactive Languages And Routines A Look At The Way All Micros Will One Day Perform

Forget the way all other micros perform. This is the way they should.

Interactively.

With the MTX, you can create and manipulate programs using four different languages in dynamic interaction, all coordinated through the FRONT PANEL DISPLAY. Interweaving elements as you would in creating a symphony.

And take a serious look at the languages housed in the MTX's 24K ROM. MTX BASIC, a more powerful form of BASIC that allows you to use all standard BASIC programs. MTX GRAPH- ICS, with straight forward commands, eliminates the tedium and difficulty of creating complex graphics programs. NODDY, an 11- command “easy learn” language that can transform real world pro- gramming into a child-friendly activity. And MTX ASSEMBLER, which enables sophisticated programming in assembly language. Something else the advanced programmer will appreciate is our ASSEMBLER/DISASSEMBLER, tied to BASIC, which provides unprecedented display and keyboard access to Z80 CPU storage locations, memory and program.

If you’re hungry for more, PASCAL and FORTH are also availa- ble as add-on ROM packs.

On the keyboard side of things, you'll find a number of operator- oriented features that speed up and ease up the operation of the MTX. The separate numeric pad with quadri-directional cursor control and full editing functions. The eight dual function keys.

The auto repeat function on all alpha-numeric keys. Add to this such programmer-saving features as the use of abbreviated BASIC commands, a built-in syntax verifier, automatic cursor-honing to errors, auto-line numbering and automatic scrolling, and you begin to see the MTX not only opens a lot of doors that other micros leave closed, but speeds you through them as well.

The 160 Megabyte Connection A Look At The System

To build a good system, quality must be designed in at every level.

We designed the MTX and its complete line of system periph- erals using proven, standard components. Striking a strategic bal- ance between power, versatility and dependability. Our Z80A processor, running at 4MHz, gave us the high performance charac- teristics we were striving for, plus the ability to expand into the MTX Hard Disc, MTX Silicon and Floppy Disc CP/M operated systems. Systems that could provide up to 160 megabyte storage capacity. More power than you'll probably ever need, unless you take full advantage of the MTX's impressive system capabilities.

Systems hookup is as simple as every other MTX procedure.

By merely plugging in the twin RS232C Serial interfaces and the Node software, sold optionally, you're ready to create a disc-driven interactive communications network (OXFORD RINGO) that can link up to 255 units.

Software? You'll never worry about software availability with the MTX. Dozens of MTX-dedicated programs have already been created, supplementing the vast landscape of CP/M applications software currently available. And advance word of the MTX’s technical capabilities has precipitated an MTX software “push” on the part of many leading software manufacturers.

Word Processing For $999 A Look At A Great Deal

Look first at the capabilities, then at the price.

This is word processing the way it should be. Quick. Easy. Professional. A package that includes the MTX512; the powerful New Word™ word processing ROM cartridge; and the Memotech DMX80 correspondence quality printer* An exceptional value!

And that brings us to the bottom line.

A Look At The Price

There’s a very simple equation that covers the pricing of the MTX512.

The more engineering you put in a system, the less it will cost to produce. As you've already seen, the MTX is a pure product of advanced, innovative engineering.

Which is why we can sell it for $595**

And why we can confidently back it up with a full one- year warranty.

Make no mistake. When you turn this page, you'll be return- ing to a world very different from this one.

A world in which all microcomputers will suddenly seem very different.

Suddenly very ordinary.

For more information about the MTX512, or to find out the location of the MTX dealer nearest you, contact Memotech

Corporation, 99 Cabot Street, Needham, MA 02194; or phone (617) 449-6614

MEMO TECH

CORPORATION

CP/M is a trademark of Digital Research, Inc. New Word™ is a trademark of New Star Software, Inc.

*DMXS80 correspondence quality printer suggested retail price $395. **Suggested retail price.

The Array Advantage

Sharon Zardetto Aker

An array is just another kind of vari- able, right? Well, yes and no: an array is another kind of variable, but it is not just another variable.

There are arrays to store numbers, there are arrays to hold strings, and there are lots of things you can do with arrays that you cannot do with simple variables.

Numeric Arrays

A numeric array is like a row of boxes: each is able to hold any number you want to put into it. To tell the com- puter how many boxes you want to re- serve, use a DIM statement, e.g.,

DIMB(5)

tells the computer to reserve five mem- ory cells. Each cell, or element, in the ar- ray is named by the variable (any single letter) used with DIM and a subscript that indicates its place in the array.

B(1) B(2) B(3) B(4) B(5) are the subscripted variables for the array dimensioned above.

An array variable name on the TS2068 can be either upper or lower case. Because the computer considers upper and lower case letters inter- changeable when it comes to variables, you still have only 26 different single-let- ter variables.

Filling the Boxes When an array is dimensioned, all its cells are automatically filled wtih zeros. Type in, as direct commands: DIMA(2) PRINT A( 1), A(2) You will get two zeros on the screen—the contents of the two “boxes.”

Sharon Zardetto Aker, 20 Courtland Dr., Sussex, NJ 07461.

28

The great advantage of arrays over regular variables is the ease of assigning

and retrieving values.

Placing a number into an array cell is like assigning a value to any other variable:

LETN(4)=17 might appear in a program, while INPUT L(3) would allow the cell to be filled while the program is running.

The subscripted variable that stands for an array element can be used in the same way that other variables are used, SO:

LET A(4)2B(4)*C(2) and PLOT: X8), Y(3) are valid programming statements.

Listing 1.

S REM "ARRAY DEMO" 10 DIM A11323) 15 FOR N=1 To 10 20 PRINT “WHAT DO YOU WAN

"IN

25 INPUT AIM;

38 NEXT N

48 FOR N=1 To ie

45 PRINT “CELL ";N;" CONTAINS "SANI

SO NEXT ON

The great advantage of arrays over regular variables is the ease with which values can be assigned and retrieved. Listing 1 demonstrates this. It will ask you to INPUT a value for each of ten cells, and then print them out on the screen. Compare this program to one you would have to write if you were us- ing regular variables instead; without the FOR-NEXT loops that can be used with

subscripted variables, your listing would be about ten times longer.

An Application

Listing 2 is a short game that shows how you might use an array. It is a sim- ple “guess my number” game with two added features: a subroutine that checks if you are repeating yourself when giving an answer, and a recap of all your guesses at the end. You have ten tries to find the correct number between one and fifty.

Lines 10-50 constitute the basic guess- ing game. The subroutine at line 100 checks the current guess (G) against the

Listing 2.

5 REM "GUESS" 19 DIM nile

15 LET N-INT :RNDs50)-41 20 FOR T=1 To 10 25 SCROLL AE 30 PRINT “TAKE A GUESS" 35 INPUT G

40 IF G=N THEN GOTO 55 45 GOSUB 128

58 NEXT T

5 3

50 PRINT RIGHT AHD Gs=H} + SORRY, ." AND G<>NJ; THE NUHBEH WU H5 "Ib

65 PRINT “YOUR GUESSES WERE

70 FOR Hzi TO 18

7S PRINT AH

50 NEXT HN

35 STOP

1280 FOR K=1 TO 18

195 IF GzhH(K) THEN GOTO 130

110 IF &5::8tKh: THEN NESE F

115 LET AiTiss

ge RETURN

130 SCROLL

135 PRINT "voi TRIED THAT ALEER

Dr ir 148 SOTO 35

TS2068 Users: Delete lines 25 and 130.

March/April 1984 2 SYNC

contents of the array—each cell holds a prior guess. If a match is found, the player is informed, and the program re- turns to the INPUT line; if no match is found, the current guess is placed into the next available array cell. Lines 70-80 use a FOR-NEXT loop to print out all the wrong guesses.

Another Dimension

The “rows of boxes” in the previous programs are single dimension arrays, because you are working with a single row of boxes. If you visualize rows of boxes on top of each other or informa- tion presented in rows and columns, you will be dealing with a two-dimensional array.

A two-dimensional array is dimen- sioned by two numbers with the DIM statement, and each element in the array is identified by two subscripts.

DIMZ(3,4)

dimensions an array with twelve cells (three rows of four boxes). The first ele- ment is named Z(1,1) and the last Z(3,4). It is easy to keep track of the ele- ment names if you think of the first number as referring to a row and the second to a column. Figure 1 shows just how the cells in this array are named.

o es dime k Cell subscripts for a two-dimensional array.

rper jefas leaf

While the “stack of boxes” is a helpful image in understanding two-dimensional arrays, keep in mind that the computer does not actually have memory cells in that configuration.

An Application

Any data that benefits from a row/column presentation is a candidate for a two-dimension array. The program in Listing 3 uses a two-dimensional ar- ray. The program in Listing 3 uses a two-dimensional array to keep track of

Listing 3. S REM CHART

10 DIN Pi2.7!

15 GO5U6B 532

20 PRINT TAB 14; “Local ¡TAS zi

'LONG"

25 PRINT MON THES “HED

sa THUR: FRI Aa. SUN = T 2.8;

20 FOR X=1 TO 7

35 PRINT THE 15;P1i,.xX3:TAB zz Pi2,X1

4g NEXT X

45 STOP

508 FOR Hzi TO 2

595 FOR X=1 TO 7

6@ LET R=INT :IRENDxzüi

LET PiN,X! =R

RETURN

March/April 1984 © SYNC

the number of local and long distance calls made during the course of a week.

The array is set up as two rows of seven cells. (It could have been seven rows of two cells.) The subroutine at line 50 fills the array with random data. Lines 20 and 25 set up the screen, lines 30-45 print the data on the screen.

The effectiveness of a two-dimensional array is not immediately apparent, be- cause this program could have been written with a single dimension array, or even with separate variables for all the data (although assigning variable values would not have been so simple).

The importance of the two-dimen- sional array is evident when you want to manipulate the data. For instance, the total of local calls and long distance calls made during the week can be calculated with the following subroutine:

LET LOCAL=0

LET LONG=0

FOR N=1 TO 7

LET LOCAL=LOCAL+P(1,N) LET LONG=LONGtP (2,N) NEXT N

The first two lines of this subroutine are examples of variable initialization. Because we want to use LOCAL and LONG to store ever-increasing totals as the FOR-NEXT loop is performed, we

TS1000

use the statement LET LONG-LONG*tP(2,N)

and a similar one for LOCAL. Using these statements, however, without assigning initial values to the variables would result in an “undefined variable” error. This initialization procedure is used very often in games, where the vari- able that stores the score is initialized to zero. Array elements, remember, are automatically initialized to zero when you dimension the variable.

The latter part of this routine uses a FOR-NEXT loop to add the first col- umn figures into LOCAL and the sec- ond column figures into LONG.

The average local or long distance calls per day are then LOCAL/7 and LONG/7. Try adding the printout of these statistics to your display, as well as writing a subroutine to calculate the to- tal number of calls per day, and all the calls made during the week.

Other Dimensions

Numeric arrays are not limited to two dimensions. You might want to add statistics to the “telephone” program for each week of the year. In that case,

DIMP(52;7T,2)

would set up a three-dimensional array, which you could visualize as 52 pages of rows and columns.

64K Inside!!

And under $100!

E bd m

No bulky add-ons so it leaves the rear connector free for peripherals! No wobbles or fear of crashing if your computer is bumped!!

By a switch, you can disable the 10- 12K, 8- 12K, or 8- 16K area of memory so that it doesnt in- terfere with peripherals that use these areas of memory.

Itinstalls INSIDE your computer in a minute with easy instructions and NO soldering. It simply plugs into the microprocessor socket. Or, get it in a complete kit that you can assemble. Our products carry a 90 day warranty.

The 64KT isfora TS1000 with a serial no. prefix of F, P, or T. The 64KZ is for a TS1000 with prefix of D, and for the ZX81.

The 64KT or 64KZ fits INSIDE your computer to increase its memory to its full capability of 64K bytes, yet it won't cause overheating!

To order, send the order form, or a copy to:

INDEPENDENCE RESEARCH P.O. BOX 1497 OREM, UTAH 84057

Ro C TAM A

Please send me: | 64KT @ 95.00 ea. i . 64KZ @ 95.00 ea. | 64KTK @ 90.00 ea. | 64KZK @ 90.00 ea. |

l

for the above amount plus 4.00 for

shipping and handling

Please ship C.O.D. for the above amount | | plus 4.00 for shipping and handling. |

Rs A VY NS 0 n

| | | | | | have enclosed a check or money order | | |

CIRCLE 24 ON READER SERVICE CARD

Arrays of more that three dimensions are possible, although progressively more difficult to visualize:

DIMELO 2.2.2.) sets up a five-dimensional array with 32 elements (rows, columns, pages, books, shelves?).

The overall number of elements you can dimension depends on the memory you have available.

Caveats

Some computers will stop a program with a “re-dimensioning” error if you use the same array name twice. A ZX/TS computer will do what it is told: it will dimension the same array over again, wiping out all your data in the process.

So, be careful where you place your DIM statement—keep it outside of loops, as in the listings accompanying this article.

RUN will also wipe out the contents of an array, just as it erases regular vari- able values: use GOTO when you are working with a program with arrays!

String Arrays

String arrays are similar to numeric arrays in that a DIM statement is used to reserve memory space, and the use of subscripted variables makes the strings easy to store and retrieve.

However, string arrays have one ma- jor difference that calls for a more thor- ough study: for a string array, you have to indicate not only how many elements you want in the array (how many strings you want to store), but also how long the strings will be.

DIMN$(5, 10) will dimension an array that will hold five strings of ten characters each. If you use only one subscript when dimension- ing a string array, e.g., DIMA$(10)

the computer will assume the number refers to the length of the string, and dimension an array of one element— and, yes, there are uses for a one-element string array!

While you can think of numeric ar- rays as rows of boxes, string arrays are more like a series of shelves, with only a certain amount of space on each shelf. Each string goes on one shelf, but each character of the string goes into one of the spaces on the shelf.

Once Upon a Time

This brings us to the story of Procrus- tes, a legendary (and, we hope, mythical) Greek innkeeper who forced travellers to fit one of two beds either by stretching their bodies to the right length, or by chopping off that portion of the anatomy that might be hanging over the edge.

What has that to do with string ar-

30

rays? Well, assignment to a string array is Procrustean: a string will be either padded out with spaces to fill the array "shelf," or truncated to fit in. If we dimension a string array DIMA$(3,6)

and put the strings string, array, and storage on the three shelves, they would be stored as shown in Figure 2: string fits perfectly, array gets a space added to it, and storage has its last letter removed. Listing 4 demonstrates what is illus- trated in this figure. It will load the three words into an array and then print out the array contents. A period is added to the printout of each stored string so you can see exactly where it ends.

So What?

Why is it important that you take this Procrustean assignment into consid- eration? There are a number of reasons.

Dimensioning an array larger than you need uses up memory space. Saving

Figure 2. Procrustean string storage.

L9L TR LNG |

pA, RRA, Y y pSyT yO RJA YG | Listing 4. REM STRING 1^" 18 DIM nH$i3,253 15 LET BH$iii-"2TEINC 28 LET A$ i2 -< ARRE #5 LET Aisi =U>2TORAGE" 30. FOR Nazi T0.3 35 PRINT a$iH:;:" 4@ HEXT N

room for a dozen 30-character strings is a waste if you are going to store only five-letter words. More importantly, (yes, there are more important things than saving space), if you are going to be checking an INPUT against the contents of a string array cell, you had better be aware of just what is stored in that cell. Run the program in Listing 5 and type in the words as you are instructed.

Listing 5. S REM "STRING 2" ig DIM Asif. 5: 15 LET BH$ii-" SHORT ga LET nH&izi-"LüNG" 25 FOR N=1 TO 2 30 PRINT “TYPE IH == 35 INPUT Bs 428 IF B£-u$iNH:i THEH PRINT “RIS HT" 45 IF B$£::n$:iN) THEN PRINT SE DONG" =

ri y. r4

When you type “SHORT” the computer

will tell you that you are right, but, when you enter “LONG”, you will be wrong.

Since the array was dimensioned to hold strings of five characters, it padded out “LONG” with an extra space at the

end. If you type in LONG with a space after it, the computer will consider it a correct answer.

This aspect of Procrustean assignment can wreak havoc in a question/answer game if you do not allow for it. By dimensioning an array of one element to hold the answer (I told you there would be a use for it), the answer will be pad- ded out to match the answer in the ar- ray. Add/change

7 DIMN$(5) 35 INPUT N$ and run the program again.

Space Savers

If you are not sure just what dimen- sions to use in a program, try letting the user enter the figures that will be needed. For instance, at the start of an alphabet sort routine, you might use:

10 PRINT "HOW MANY WORDS?"

20 INPUT N

30 PRINT "LONGEST WORD?"

40 INPUT WS

50DIMAS(N,LENWS)

In this way, the array is kept to the exact number of elements needed, and the space in each cell is only as large as is necessary to store the longest word.

Another Application

Applications for string arrays are similar to those for numeric arrays in that they lend themselves to certain manipulations not possible with regular string variables. For instance, alphabet- izing routines compare each string in an array with the others and rearrange their order until they have been sorted alpha- betically; many word processing pro- grams also use string arrays.

Another application that takes advan- tage of the Procrustean feature of ZX/TS string arrays is one that can save your display. If you have a game that in- cludes a scoreboard, you may have room

March/April 1984 © SYNC

Use the same letter for both a number and a numeric array.

for only eight letters of the player’s

name. Asking a player to type in only eight letters is asking for trouble, since many people take perverse pleasure in not following directions. You can foil that person in one of two ways: check the length of the INPUT string and loop back if it is more than eight letters, or simply dimension of single-element string array to store the player’s name. When it is printed out, only the first eight letters will be there.

Multi-Dimensional String Arrays

Setting up string arrays of more than one dimension is the same as setting up a multi-dimensional numeric array, except for the number that denotes the length of the strings.

N$(3,4,5)

dimensions a two-dimensional string array—three walls of four shelves with five spaces on each.

Bits and Pieces Sinclair Basic has string-slicing func- tions that, while slightly non-standard, are easy to use, and they apply to strings inside arrays as well as to simple strings. To pick a character out of an arrayed string, use A$(3,4) where 3 is the array element and 4 is the fourth character of the string stored there. A$(3,2 TO) A$(3,TO 5) will give everything from the second character to the end of the string, and the first five characters of the string respectively. These slicers can also be written as: A$(3) (4) A$(3) (2 TO) A$(3) (TO 5)

What's in a Name?

The same letter can be used to name both a number and a numeric array in the same program; if you use a string variable name for a string array, 1t can- not be used for a simple string variable. You can use the same letter for up to three things in a program: a numeric variable, a numeric array, and a string variable (simple or array).

Onward... Now that you know all about arrays, you should be ready to write such pro-

grams as word processors... mailing lists . . . spreadsheets . . . household budgets... n"

March/April 1984 © SYNC

BLACKJACK W | NN ER 5

Ka Oe Ie TN

AC O VACK PAE? t

GAB

Use this professional blackjack game to master the fundamentals used by experts to win consistently at 21: BLACKJACK RULES Part of the fun of 21 is using the options to your full advantage. BASIC STRATEGY Remove the guesswork from hit/stand double down and split decisions. CARD COUNTING Win ty placing bets in proportion to your advantage. MONEY MANAGEMENT Maximize gain and minimize loss with correct bankroll managezent.

16K TS1000

Learn to count while playing 21 with the powerful and proven card counting system built into tnis blackjack game.

Features menu selection of rules to simulate actual casino play including:

o Doubling down and pair splitting o doubling after splits

o Insurance and surrender

o Kultipie decks and more

Cassette comes with 208 page hardcover book, BLACKJACK YOUR WAY TO RICHES.

Send $27.95 plus $3.00 postage to: (Ca. residents add 63% sales tax)

SCITECH SOFTWARE 1111 EL CANINO REAL, SUITE SUNNYVALE, CA. 94087

109/219

For Home or Business WHAT...WHEN...HOW...

LEARN HOW TO USE A COMPUTER

Train at home in spare time! No previous experience needed! Now you can learn it all! Com- puter programming...compu- ter applications...computer games...everything you ever wanted to know about com- puter operations! Write your own computer programs or use hundreds of programs already available...budget- ing, real estate, bookkeep- ing, expenses, investments, interest, taxes, shopping lists, vacation planning, addresses, phon num- bers, routing „even foreign languages and EE: graphics. You’ II KH whai really happens when y . have a com- puter problem with a bank, store, loan company, oil company, utility or anyone else. You’ Il be able to talk their language...understand why and how things hap- pen...to be able to take the offensive when you're the victim of acomputer.error. Experts explain everything in easy-to-understand language with step-by-step directions.

e TIMEX COMPUTER INCLUDED WITH . YOUR TRAINING e Plugs into any TV

e SEND FOR | FREE FACTS! _

TGS | computer TRAINING, Dept. 00000 | SINCE 1891 J Scranton, Pennsylvania 18515 | Please rush me free facts and color araenu] | that tells how | can learn computer applications, programming and operation at home in spare time. No cost. No opligaion: |: | Name Age i

Address l |

City/State/Zip

05UA

IT'S SO EASY

To expand you : computer when you have the Solutions

Solutions is proud to announce the arrival of THE EXPERIMENTER'S SOLUTIONS BOOK. It will show you how simple it is to add sophisti- cation to your Timex Sinclair 1000. Here are some examples:

e A Buffered Expansion board that allows for a great number of quick and

strong connections. e Different types of Parallel I/O.

e The use of Parallel I/O to control AC and DC circuits.

e RS232 Serial Communications. e Parallel Printer Interface. e.Real Time Clock

And more!

Written in a clear, easy to follow style everything is included; wiring diagrams, software listings, parts lists, theory of operation, etc. There is also an introduction to help you understand the Timex Sinclair Expan-

sion port.

THE EXPERIMENTER'S SOLUTIONS BOOK

$9.99

Don't forget Solutions also carries an ever expanding line of business

and educational Software.

SOLUTIONS P. O. Box 1144

Piscataway, N.J. 08854

CIRCLE 50 ON READER SERVICE CARD

Crazvbugs and Cyberzone

?

David and James Grosjean

Crazy bugs is a Pac-Man type game, but with enough differences to make to make another enjoyable game. You are in a subterranean maze and are being chased by beetles. As the beetles lay eggs, one at a time, you must go, fetch, and lock up

SUNE

SOFTWARE PROFILE Name: Crazybugs

Type: Arcade maze System: TS2068 Format: Cassette; cartridge

Summary: Superb if you enjoy maze games and dislike cassette problems.

Price: Cassette: $19.95 Cartridge: $29.95

Manufacturer: Timex Computer Corp. Waterbury, CT 06725

the egg in a flashing box. After locking up four eggs, you must exit the maze and move on to the next screen.

Crazybugs comes in two versions: cas- sette and Timex Command Cartridge. The cartridge very convenient because it avoids loading time. When the computer is turned on, the title screen for Crazybugs prompts the user to enter a skill level (1-3). If nothing is entered, the computer provides an entertaining demonstration.

When play commences, your humanoid appears in the Jower left hand corner of the maze. You control him with a joystick or the Q, Z, I, and P keys. You must

David and James Grosjean, 50 Kings Rd., Chatham, NJ 07928

32

move quickly because the bugs are in-

telligent and will soon trap you if you.

remain idle. After you have locked up the four eggs, you must exit by a flashing white door on the maze's edge. Then the screen flashes colors, the computer makes unusual sound effects, and the maze under- goes a metamorphasis as a flashing orange box moves around closing up branches of the maze to set up the next screen.

The second screen is harder because

there are fewer places to run. Luckily, you are faster than the bugs and have five lives. The third screen is the hardest. It completes the first phase.

The second phase begins with the orig- inal maze but has an added twist. This screen has four beetles, plus one super- bug. which is much faster than you. Luckily, it is not so smart, and it stops before turning a corner. Another super-bug is added each phase.

This game has many fine points for which it must be commended: 1) The cartridge avoids loading time and allows starting a new game by switching the computer off and on again. 2) Crazybugs makes excellent use of the TS2068's hi- resolution graphics, color, and sound. 3) The game is progressively difficult, pro- viding continuous challenge. 4) Because of the simple concept of Crazybugs, you do not have to read endless pages of directions. 5) The game has on-screen scoring and a hi-score indicator.

As for disadvantages, Crazybugs has only two: 1) initials cannot be entered when a hi-score is achieved; 2) the game has no pause feature, as many games now do. Thus, this game is superb for people who enjoy maze games and who dislike cassette problems.

Cyberzone, the new, improved, and up- dated version of TS Destroyer (originally published in SYNC 2:4), takes advantage of the sound and color graphics of the TS2068. The object is to shoot through the rotating defense shields and destroy

SUNE

SOFTWARE PROFILE Name: Cyberzone

Type: Arcade space System: TS2068 Format: Cassette

Summary: If you liked TS Destroyer, a must; one of the best new games for the TS2068.

Price: $19.95

Manufacturer:

Softsync, Inc. 14 E. 34th St. New York, NY 10016

the alien inside. Cyberzone adds some excellent and challenging features.

When the program loads, you have the option of intructions, play, or attract mode. If you leave the title page alone for about 20 seconds, the computer automatically goes into attract mode. To play, simply choose a skill level (1-5). Controls move left and right (arrow keys) and 0 to fire. A joystick can be used instead,

At first, the game seems to be merely an excellent translation of the old game, but soon an alien plane appears and you know that this is different. The plane emerges at the top and swoops down, taking a seemingly unpredictable and un- orthodox path to drop deadly accurate bombs. They do not make any kamikaze

March/April 1984 © SYNC .

moves, but, when they are shot down, they fall from the sky like a sack of wet cement.

Just as you find that the planes and very accurate laser mounted the alien's underside are about your match, suddenly, from the center of the alien's ship, a wide beam transports a flying saucer-looking object down to a level just above your own. It begins to shoot down your shots, and you cannot blow it away. Then it starts to move and shoot down your shots everywhere you go. You can only destroy 1t by getting one of the other enemies on the screen to destroy it for you.

If you eventually get through the de- fenses and hit the alien, there is a bloody

explosion and you are advanced to a harder screen. In the later screens, two planes attack you, the laser gets faster, and every- thing gets tougher.

This game is an excellent job of pro- gramming and a source of constant chal- lenge and excitement. The (optional) sound effects, colorful hi-res graphics, multiple levels of play, and high speed action make this a fun game that can be enjoyed by anyone. Small features such as a record of the hi-score, attract mode, interesting destructions, and optional sound complete its engrossing effect.

If you liked TS Destroyer, this version is a must. Cyberzone is one of the best new games for the TS2068. 2"

Whither Clive?

David H. Ahl

This is a somewhat roundabout story, but bear with us. Lotus, that outstanding manufacturer of winning race cars as well as the Lotus Elite and Elan, has been in serious financial difficulties lately. These troubles have been mag- nified by the death of Colin Chapman, the founder of Lotus, and by the DeLorean affair. The only reason that DeLorean enters into the picture is that Lotus had agreed to use the DeLorean plant for the development and manufac- ture of some very sophisticated light- weight cars.

The latest reports we get indicate that things are improving rapidly. First, Lo- tus has entered into a cooperative sports car project using engine and drivetrain components from Toyota. This sparked some spirited negotiations on the part of David Wickins of British Car Auctions to take over Lotus before it fell to the control of (horrors! a Japanese firm. The Lotus board accepted Wickin's offer.

However, some weeks later Toyota made an offer to buy 2.9 million shares of Lotus stock (16% of the total) for £1.16 million. This offer was accepted at the Lotus stockholders meeting. So where does Sir Clive Sinclair enter in?

March/April 1984 © SYNC

Sir Clive, that electronics wizard who invented the “black watch," cheap scien- tific calculator, ZX80 (and its deriva- tives), and flat screen TV, had a new invention on the drawing boards—an electric car (shades of Tom Swift).

So he took a small dollop of his vast wealth (£9 million) and formed a new company called the Sinclair Vehicle Project and bought the DeLorean plant in Ireland. Why? Because Lotus had al- ready modified it to build sophisticated lightweight vehicles.

Sinclair has stated his theory that, if you can't lighten the batteries (appar- ently you can't), you should 1) make the batteries fit the vehicle and/or 2) make the vehicle more efficient. His method for doing the latter is to use a chip (he calls it a chopper") to chop the vehicle power demand on the battery into time slices of milli- or nanoseconds. In other words, deliver one millisecond of power then rest for two. Apparently this ex- tends the discharge time enormously. Also, with the chip, the system can be programmed for various types and weights of vehicles.

Sounds good to us. Now when do we get one for evaluation? —DHA

INTERFACE THE TIMEX-SINCLAIR

To Control External Devices Teach Interfacing Skills Demonstrate Science Principles

The low-cost FD-ZX1 I/O board turns the Timex-Sinclair micro- computer into an automated measurement, data acquisition, and control instrument. Schools, colleges, industrial and academic technicians, scientists, and engineers can now afford enough interface systems for effective teaching or for developing dedi- cated automation instruments with- out investing more in the computer than in the instrument. A number of Science experiments have been developed to aid teachers in illu- strating scientific principles. Available as a kit or assembled, the FD-ZX1 includes cables, but not the solderless breadboard tor con- structing the interface circuits.

For the Timex-Sinclair, Model 1000, 1500, ZX81, Spectrum

Model FD-ZX4K (kit) $69.95 Model FD-ZX1A (assbld.) 99.95 Solderless Breadboard, BG-10 18.00

Visa or Mastercard accepted. Write for our complete catalog of Blacksburg Series books and INNOVATOR and I/O hardware.

E (O n) Gia SL olnalooy. Lid TOGETHER IWS Y /

P.O. Box 87M * Check, Virginia 24072

703-651-3153

CIRCLE 20 ON READER SERVICE CARD

33

ZX81/TS1000/TS2068

Knight’s Tour

Robert J. Midura

The Knight’s Tour Puzzle

The “Knight’s Tour” is a familiar chess puzzle. The object is to move a knight according to chess rules around the board in such a way that each square is visited only once. The puzzle may be solved by using a trial and error process that syste- matically explores all of the moves until a solution is found.

The program in Listing 1 will allow you to find a solution to the puzzle with your computer. You set the size of the board, pick the knight’s starting point, and sit back and watch the knight make its tour of the board.

The Programming Algorithm

The program uses what is called a back- tracking algorithm to arrive at a solution. The board locations of each successful move are stored on a stack along with the direction that allowed a move to proceed to another. When a position is found from which no move can be made, the program pops off the stack and continues with the next direction that was stored with the move. In this way the program remembers where it left off trying new moves at every location.

The board is displayed and the moves are entered on the board with the current location of the knight shown in inverse. This enables you to observe the back- tracking process on the screen.

Entering the Program

1) Before typing in the program, we need to set up an array to store the values used to compute moves from a location on the board. Since a knight has 8 possible moves from a given location, we need an 8 x 2 array. In the immediate mode type in DIM A(8,2) and ENTER.

Robert J. Midura, 19 Merrifield St., Worcester, MA 01605.

34

Successful moves are stored on a stack so the program remembers where it left off trying new moves at every location.

2) Then type in the short program in Listing 2.

3) Start the array input program by typing GOTO 10 and enter the values shown in Table 1.

Table 1. Array values.

ON pete E pee mi

UENIDUDUE AA Pd pe o. d LI .. | | mA .. E da PLD pe pe l Ij

4) Type in Listing 1 which will erase the program you used to input the array values.

Running the Program

1) Put the computer in SLOW mode and type GOTO 900 and ENTER.

2) The program will first request the size of the board. It will accept only values

+--+--+--+--+--+ż +i2+7 +4 +i¡2d+i¿2 +--4+--+--+--+--H +irf¢e +21+5 +2 + +--4+--+--+--+--+ +¿22+11+ +i5+22=+ +--4+--+--4¢--+--F i +15 +Bi+18+

+ - ps I = =. = E -

fu.

from 1 to 8. I have found that boards smaller than 5 x 5 are unsolvable. Of course, a 1 square board is solved simply by one move. (Try starting with a 5.)

3) The program will request the row and column numbers for the location of the starting point of the knight. (Try using row 5 and column 1.)

4) The program will then start solving the puzzle. (The solution for the suggested data will be found in a little over two minutes. You will probably not want to observe the solution of some starting lo- cations simply because it will take too long in compute and display mode. You can operate the program in FAST mode by first entering the line

225 SLOW so the screen will activate when a solution is found. Then put the computer in FAST and type GOTO 900)

5) The program will then give you the option of finding another solution from the same input or of resetting the board

+--+--+--+--+--+

+ +

March/April 1984 © SYNC

SYSTEM for TIMEX SINCLAIR USERS

FDC-100 SERIES FLOPPY DISK

Available in both single disk and double disk configuration

m Up to 250 K bytes per side = High speed up to 31.2 K character/sec

= SAVE and LOAD from Timex/Sinclair BASIC no PEEK's, POKE’s or USR’s

= All commands fully integrated into Timex/Sinclair Basic and do not interfere with tape SAVE and LOAD

= System compatible with other computers = Extensive command list

= Create your own data types via READ and WRITE physical track commands

O9. for FDC-101 single drive system)

Coming Soon COLOR SIN 81

WATCH OUR ADS FOR DETAILS

Send me more information on

O FDC 100 Series []BLS201 []LOS200 [] Color SIN 81

L] My check is enclosed [] Master Card. [O Visa [] COD $3 charge Please ship:

O FDC 101 [ ]FDC 102 LIBLS 201 LJLOS 200

Card No. ________ Expiration Date Signature

NAME:

ADDRESS:

CITY: STATE s AR

TELEPHONE: (

)

Add $3.50 ea. item for shipping/handling. NJ Residents add 6% Sales Tax.

New from BEG

BLEEPER SYSTEM BLS-201 $

= Positive signal for every $2900 key press on your ZX81, T/S 1000. = The BLEEP you hear provides positive audio

feedback that a key has been depressed and makes data entry/program entry much easier.

= BLS-201 is easily installed in minutes and comes with complete, easy to follow instructions.

(SPECIAL: Order with LOS-200 Tape Loading System and pay only $14.00 save over 50%).

TAPE LOADING SYSTEM LOS-200

Eliminate the frustration of ZX81 and T/S 1000 tapes and commercial tapes that won't load. The LOS 200 provides the facility to check volume and blank tape noise and to "amino if a tape is damaged.

‘36% FEATURES:

= LED indicators show: volume too high o or low-noisey tape end of program-"voice over”.

= Earphone plug allows you to listen to the tape while setting up and while loading tape. You can hear drop outs and bad tone setting quite easily.

= Reset switch allows starting computer from “K” without removing power plug.

= SAVE/LOAD switch allows both EAR and MIKE to be plugged into computer at once. You may simply switch between SAVE and LOAD.

= Powered completely by the computer and does not interfere with the operation of any other peripheral.

COMPUSA PAN

1101 Bristol Road Mountainside, New Jersey 07092 U.S.A.

(201) 654-7220 Telex: 138275

CIRCLE 7 ON READER SERVICE CARD

size and starting point. (If you choose to try for another solution with the suggested

input, you will get one in about 3 1/2

minutes. The program will start back tracking from the solution it just found in an attempt to find another.)

6) Pressing any key other than A or R will cause the program to execute a STOP statement. The program will also stop and leave the board blank if it is unable to find a solution (try a 3 x 3 board).

Line Notes

900-920: Input board size.

930: Sets variable E to the number of squares on the board.

940: Sets X to the string slice length for printing the board.

950: Clears the screen.

1000-1050: Print the board.

1060: Defines stack array; size set to number of squares by 3 so that it can store the row, column, and direction value for every move made. The direction value is actually the index to the array A indi- cating which values are being used to compute trial moves.

1070: Defines a string array to represent the board and to check if a square is already occupied. A blank indicates that the square is unoccupied; an X that the square is occupied.

1080: Sets variable P to point to top of the stack. Since your starting location is the first move, it is stored at S(1,1) and S(1,2). So P begins at 2.

1090: Sets variable C to point to the current move in the stack which is 1 to begin with.

1100-1165: Input the starting location of the knight. |

1170: Prints knight at this location.

1180: Marks board position.

1190: Sends control to main part of program (lines 10-220).

10: Sets up trial move loop. The FOR- NEXT variable I is used as the index to the array A.

20, 30: Compute a possible move using the values in A and the current location of the knight. I takes on the values 1 to 8 to examine all the moves until one is found from the current location.

40: Checks if the move is on the board and if the square has not been visited. When a move cannot be made from a location after all 8 moves have been tried, the program proceeds past the NEXT (line 50). If all the conditions in line 40 are met, the program branches to 150.

60, 70: Blank out the current location on the screen and board map.

80: Backs up to previous location.

100: Prints it in inverse.

110: Decrements P so that the next -

move found erases the deadend move. 120: Sets I to the last direction tried at

this previous location so the NEXT in

line 130 will set I to point to the values in

36

Listing 1. Knight's Tour Basic program.

E E isis T iu P prf i= ir NE E v = ti Le be ? . = = = : o > Taio i ST - QE EL ES = à A r, > = T RS f if aim TE go Sh miii” o ER 2 de = : E IES Tiii iF ia H =i tt Ti? H ati «dà tI LY. Cr RIE CUT T. -D Uisa I = n ER 7 TRi mE T = a Ba ER, —, = +. Cu j-REI mit -— = = = = = - 2133

i i H E * Hi rt ius :I3 P 31x 3 is £i 11s 4 E DOT [e c 5 "g^ ipt Ep row E yug X == a E e cm we X oe LL. A = -—i A uA ¡er ES = T imi bd am eh A he = į == d ilk! S to s V - : MA : p= -, —, Fx i ET TUE: Lx E- g H |o TA AID. ti! H = rr | EUST Seis - ave Li! PME. D = 3 £5 P EUT 1*1. = Rh TE i s => Tuc mW EUG rA zie RE + —1L- 111 eL E a & —— É ~s eE Se Wa Ye a | Za 1H “ora í Pi 3 af 3 : ru H Dii H

340 IF Ig="A" THEN GOTO 18 350. IF I$-" R HEN GOTO se TS2068 Adaptation

To use this program on the TS2068, type in the listing with the following line changes.

7A SE "RI rm e gpr = mR&icm a ~ - 3$ és ARX A LIP CONIL IUE e T, t etur LEN = > fP xU - = g DH => ¿A =oii=a= mi = ey Sen = TM = = Se SS a = a AE = rA = ? CIA Er AA It EN E TOP Se A i i rm T TE Prep LIÉ E = F"M-T- ¿11 Lar. S = tg“ r: Ti JS E q = % = TS m -o F ii ma Be E: T TE an! 9 is eomm i w SE imi! Pe H Ed ipod] ud oc m “m "a = ; T i 1L? 3 t $ = an qa wg. adhe o pu I 3€ 73 fata ipte: =- dc = =

A that will produce a move in the next

direction.

140: GOTO instructs program to back up if all the moves at this point have been exhausted until a location can be found from which a not previously tried move may be made.

150: Prints current location in normal video and new location in inverse.

160, 170: Store the new location in the stack at P.

180: Stores the index to A that was

“This species doesn t bloom, it just belches...

st T. d Li us i LIH 1 : H LEE H or H rA H TF LE ioi: = t È 3 H i : E a. E: Th T4 ER $: zis H 1 ree BE : he Mum we : : : Hes Sl E A AGRA DATA TOTO 6 i ¿col rma: BE Hi = = T H H i 3 T a] T T + - ni t PL tract (PA ES E Lim Ping a e OS cl ji TIE re t-s i i ente yrs qiti EMI oa d nO e AS O NS T + z 3 = zt ni i = t 1

used to compute the new location with the old location data in the stack at C.

190: Sets current move pointer, C, to point at the new location data in the stack.

200: Marks the board map.

210: Increments pointer P to point to the next free space in the stack.

220: Checks if the board is full; indicated by the stack being full and, if so, the solution is found. If not, the program branches to the beginning of the trial move loop.

300-360: Restart option if solution is found.

Listing 2. Array input program.

12 FOR I-i TO 8 VIA Im je 4 =e FIT LIM T ous ts = A Pe: Semen De ue Ex pe

“EFE : «1 :1 1 H 1

ADAC IES LI TUE nU

á E, ris

veu i e ‘i

ZA Dot: xn = => Tri! +: = ii T REI ms dau = cw INFU O A O? "P oe

D OD ER bi

TIO yu pete E E

LU] EA 1 "a L S 1 a

3)

March/April 1984 2 SYNC

" VORHIO-

CASSETTES Ped I

The most professional file and database manager for the TIMEX—now on plug-in cartridge! Type one command and the program runs instantly. But that’s not all—you also get “QUICK- LOAD” which saves and loads 16K in just 30 seconds! With 59 page manual! SATISFACTION GUARANTEED.

BOTH on one plug-in cartridge

QUICKLOAD CARTRIDGE $29.95

e Saves/loads 16K in 30 seconds

COMPUTER GRADE DATA TRAC

BLANK CASSETTES

C-05, C-06, C-10, C-12, C-20, C-24, C-32

From the leading supplier of Computer Cassettes, new, longer length C-12’s (6 minutes per side) provide e Stores over a megabyte on one cassette the extra few feet needed for some 16K programs.

e Next best thing to a disk drive BASF-LHD (DPS) world standard tape. Premium 5 screw shell with leader.

e Check or money order e Cal. res. add 612 %

e Shipping add $2 e SASE for catalogue c Madii ie eat decks

Both cartridges have rear expansion port for 16/64K RAM. Error Free e Money back guarantee.

For the LARGEST selection of EPROM software

Rompak

500 C-12's or C-10's 38¢ each CASSETTE STORAGE CADDY $ (w/labels, add 44 e Shipping $17./500 | Holds 12 cassettes $2.95 500 Boxes 134 ea. e Shipping $10./500 | w/o boxes 1

(Free Caddy offer does not apply)

TRACTOR FEED e DIE-CUT

A] BLANK CASSETTE LABELS

Yz WHITE: $3.00/100 $20.00/1000

COLORED LABELS + Pastels -

NEW Red, Blue, Green, Yellow, Lavender $4.00/100 $30.00/1000

Includes edge labels and index card

FREE EVERY ^

4 DOZ. CASSETTES PURCHASED (does not apply to 500 quantity offer)

TS1000 1500

Y

E YOU JUST ALITTLE TIRED pem Call: 213/700-0330 ‘0r MMEDIATE SHIPMENT F REFLEX ACTION GAMES? ame e on Credit Card Orders TRY OUR MINDWARE BY ISTHMUS ORDER [ms YORK 10" S hn. TRIVIA CHALLENGE: te new innovative software gm um = æ æ æ = ORDER FORM m am am um um m "m oy package. TRIVIA CHALLENGE is the trivia game for adults which tests [ 1DOZEN |] Each cassette js your knowledge in a variety of categories and provides countless hours of = includes two YORK 10 enjoyment. Its fun, challenging, educational and can be enjoyed by 2 to 8 aa labels only. Boxes are players. This one of a kind software package comes to you on four 92 [] 14.00 SAG SORA CHE : i : = prefer to ship by UPS minute cassettes for the unbelievable low price of only $18.95 plus $1.95 O 16.50 as being the fastest and S&H $18.95 ALLTA afest. If you need ship- No shipping and handling charge on following cassettes ganm mE by Patel Post. White Labels O 300/1100 | 2000/1000 check here [7]. MASTER MIND: An intriguing strategy game. Break the Colored Labels D 400/100 | O 3000/1000 NOTE: Additional

codes. For 1 or 2 players $7.95

BATTLESHIP =- A naval strategy game for 2 players $7.95

charges outside 48 Continental States. Shipments to AK, HI, and USA possessions go by Priority Mail: Canada & Mexico— Airmail;

All others— Sea Mail.

DESCRIPTION PRICE QUANTITY Storage Caddy 2.95 j SUB TOTAL Calif. residents add sales tax Shipping /handling (any quantity using prices above) 3.50

Outside 48 Continental States Additional $1 per caddy; per doz. cassettes or boxes.

SP ELLER QUIZ: ideal program for children to enter their

entire spelling lessons, lists, spells, and then tests each word and retests

for 100% efficiency. Makes learning fun. For 1 or 2 students $6.95 A AN | OR TA Ask about our : CHECK OR M.O. Charge to DUPLICATING ANAG RAMS: A timed word puzzle for 2 to 4 players. All ENCLOSED (] Credit Card: VISA (] MASTERCARD [] SERVICE ages. $5.95 O PLEASE SEND QUANTITY DISCOUNTS HANG ROBOT: A unique variation of an old favorite. 1 to Card No. MU XT 4 players enter their own words or solve from the pre-programmed words $5.95 Name am ite DRM TIC-TAC-TO E: Even a game for pre-schoolers, fun for Address. o3: c D oscar hen rh gu. CL rM TTE children as they learn about computers $5.95 Send Check or Money Order to: ISTHMUS PA Cn .- ES, c. cr P.O. Box 174 . Winnipeg, Manitoba Signature ___ Phone es Canada R2M 4A5 Computer make & model | =- a mn aa Disk? (y/n) e

Bum mm mm umm um um mm ma ma mmm E CIRCLE 30 ON READER SERVICE CARD CIRCLE 68 ON READER SERVICE CARD

Meteors Michael B. Williams

The Problem

You are piloting a spaceship when suddenly appears an onslaught of mete- orites which must be avoided at any cost. Your warp system is malfunction- ing and can be used, but its duration var- ies. The situation seems hopeless!

Sound challenging? How would you like to try to save the ship on the un- expanded ZX81? It may sound impos- sible, but it is not. Here is a technique that will allow arcade-style games on the ZX81—even in 1K.

The Solution

Often clouded in mystery is the dis- play file—the place in memory which stores the picture you see on your screen. In general, it is 24 lines by 33 characters (32 columns + ENTER) and occupies 793 bytes of memory. The ad- dress of the display file is held in two bytes with a special name: D-FILE. The first character in the display file is al- ways ENTER. This is why it is 793 bytes long and not 792. The address of any po- sition in the display file can be cal- culated by finding its start, adding 33 for each line down it is, and adding its col- umn number. Somewhat tedious, isn’t it?

Notice that I said, “in general.” This is because, when the computer finds it has less than 3/;K RAM available (according to RAMTOP, another sys-

tem variable), the display file is left with .

just ENTERs to serve as an end-of-line character. Thus, the system is thought- fully designed so that each of the 24 lines can contain a different number of characters. How, then, can you calculate the address of a certain screen position? The truth is, you do not even need to. The PRINT AT subroutine in the ROM is required to find the address of a

Michael B. Williams, 1300 DePaul Way, Virginia Beach, VA 23464.

38

Oiten clouded in mystery is the display file— the place in memory which stores the picture you see on your screen.

particular position held in registers B (line) and C (column) and set the PRINT position there. The current PRINT position is held as two bytes in DF-CC. These are the bytes the com- mand PRINT AT will modify.

To find the character at a certain po- sition, you PRINT AT the position and PEEK the address contained in DF-CC. This technique is illustrated in lines 60 and 70 of Listing 1. That is all there is to it; you do not even need a full display file to do memory mapping.

Do not be surprised to find an EN- TER character (code 118) at the po- sition. This simply indicates there is

nothing there yet. What CLS does is to look at RAMTOP to determine if there is sufficient memory to fill the screen with spaces. If not, it just places 25 EN- TERs in the display file. There must al- ways be these 25 ENTER characters present. POKEing an ENTER character could very well crash the system.

So our fantasy of dodging meteors hurtling through space is now within reach. Examine Listing 1. Once you understand how it works, you can create fast-moving games in just IK RAM.

The first thing you should notice is how “outer space" is printed. I could have used a FOR-NEXT loop, but the

Table 1. Important address/system variables.

Description

2 RAMTOP Stores address of first nonexistent byte; varies with

amount of RAM available.

Start of display file; first character is always ENTER.

Warning: Never POKE an ENTER.

Holds current PRINT position; PEEK after PRINT

AT to find character at that position.

Holds number of lines left on screen; line number is

equivalent to 24-PEEK 16442.

Number of lines on bottom of screen; can be POK Ed

to zero to use all 24 lines. Warning: Do not use SCROLL or INPUT if value is less than 2.

Address # bytes Name 16388

16396 2 . D-FILE 16398 2 DF-CC 16442 1 S-POSN 16418 1 DF-SZ 08F5h PRINT AT

8K monitor routine to set PRINT position as held in

registers B (row) and C (col). Useful for machine lan- guage programs.

March/April 1984 © SYNC

method used here is more economical and just as fast. The bytes called S- POSN store the number of positions to the left of and including the current po- sition and the number of lines below and including the current PRINT position (see Table 1 for a list of all bytes referred to). The second byte of S-POSN is useful for determining when to use CLS to avoid the out-of-screen error. If you add a line IF PEEK 16442=2 THEN CLS

you will not run out of screen and have to use CONT. You can see how this technique was used in line 20.

Lastly, the address at 16418 (called DF-SZ) holds the number of lines at the bottom of the screen. If this is POKEd

to zero, you can use all 24 lines! When- ever any report code is given, though, its value will return to two.

Also, there is a warning when POKEing DF-SZ: if its value is less than two, SCROLLing or INPUTing will crash the system (if you do not know what that is, try it and see what happens).

So POKEing this will not do much good in our program, but it will remove

Listing 1.

Y Ti

Ta

I" rnt -] - Hon uw m

TI ru xi m rur 7r

- Hl nei

MESE

4 ———— -—X—— Di

CO MUCH nd CECI Be Ca FOL e

E UCET Ia I Ig Ig Ia a

Ey ". r4

^ E | r Uu 28. aa aa aa Iu

Ud FU pen ar

I e dre pe

z d Cr sg en C er pe m

Siem CHR ET] 7T] 01 ETI be TH N

THAT ci =<

TFE

+44 p fete fete E) tyke: TI Ti ear a | ti I H

the 22-line restriction and allow a greater amount of data to be shown on the screen at one time.

Meteors

Type in the program as listed using the graphics notes. To begin, make sure you are in SLOW mode; type RUN and ENTER. The display represents space. You avoid the meteors by pressing the 8 key to move left and the 5 key to move right. Pressing the O key activates the warp, which makes your ship in- vulnerable to the meteors, but lasts only a random amount of time. The game is over when any part of your spaceship collides with a meteor. After your score is displayed, press R to play again.

Program Notes 10: Inverse space (10).

90: Inverse quotation marks; inverse V; inverse quotation marks.

150: Inverse space (10); inverse asterisk.

180: Double quotation marks (on Q key); double quotation marks; inverse quotation marks; inverse V; inverse quotation marks.

These are just a handful of ideas for which the display file may be used. If you have discovered some others, drop us a line. a”

REVERSE VIDEO DIRECT VIDEO

FOR

YOUR ZX-81/TS-1000

e Load 16K in 15 seconds e 30 times faster than cassette e Automatic verify with save

FAST, RELIABLE, EASY-TO-USE!

REPLACE YOUR CASSETTE NOW!

e Complete digital operation e Saves and loads programs e Automatic data chaining

YOU GET BOTH FEATURES FOR ONLY $18.95 PLUS $1.50 SHIPPING AND HANDLING. REDUCE EYESTRAIN AND FATIGUE WITH. THE REVERSE VIDEO FEATURE. ELIMINATE INTERFERENCE WITH AN INCREASE IN SHARPNESS AND DEFINITION BY USING A STANDARD VIDEO MONITOR. FEATURED IN THE MAY 1983 ISSUE OF COMPUTERS AND ELECTRONICS THE DVC-2 PRO- VIDES A 75 OHM DIRECT VIDEO OUTPUT WHICH WILL DRIVE MOST VIDEO MONITORS, IN SELECTED WITH A SWITCH,

ADDITION EITHER NORMAL OR REVERSE VIDEO CAN BE THE DVC-2 IS A SMALL PRINTED CIRCUIT BOARD WHICH FITS INSIDE THE COMPUTER AND CONNECTS WITH ONLY FOUR WIRES. YOU CAN STILL USE YOUR T.V. AS A DISPLAY SINCE THE

COMPUTERS MODULATOR IS NOT AFFECTED. ORDER YOUR KIT TODAY.

RANDOM ACCESS

BOX 41770K + PHOENIX,AZ* 85080

THE DVC-2 IS NOT COMPATIBLE WITH THE BRITISH VERSION OF THE ZX-81 OR ANY UNIT WHICH EMPLOYS A UHF MODULATOR. SALES TAX

ARIZONA RESIDENTS PLEASE ADD 6% ($1.14 per kit) TO

YOUR ORDER.

ADD $3.50 FOR ADDITIONAL SHIPPING AND HANDL- ORDER IN

FOREIGN ORDERS: ING. PAYMENT SHOULD BE VIA CERTIFIED CHECK OR MONEY U.S. FUNDS ONLY.

THE DVC-2 IS AVAILABLE ONLY IN KIT FORM.

CIRCLE 40 ON READER SERVICE CARD

March/April 1984 © SYNC

e Multiple drive systems

STRINGY FLOPPY

No rewinding or volume controls

MICRO WAFER

Starntor Kit- Ecis ecos $149.50 Sg EE tte MS $3.50 Add $6.50 Shipping Did AO ee UE E $3.50 Includes Drive O, ZONE Ido dud $4.00 Manual, Operating Software, SO tic sapis tate $4.00 Power Supply, Cable, BE. A AN $4.50 3 Microwafers.

ESF Drive2 ............ $99.50 SOFTWARE

ESF Owners Manual $4.95 Machine Language

Monitor (helps with Machine Language Programs): 2.033.508 $19.95

A&J Micro Drive

1050 E. Duane Ave., Suite I

Sunnyvale, CA 94086 (408) 732-9292

O Check or Money Order Enclosed

O C.O.D. add $1.65

O U.P.S. Shipping cost, add $3.00, unless otherwise specified O VISA O MASTERCARD O CA residents add 6.5% sales tax

Card # Exp. date Name

Address

City State Zip

CIRCLE 49 ON READER SERVICE CARD

39

TS2068

Defining Characters

Robert D. Hartung

Among the extended capabilities of the TS2068 are its high resolution graphics and user defined graphics characters (UDG). Since the definition of each char- acter requires 64 binary inputs, these entries can be made much more easily if we set up a little more elaborate input routine than the one given in the manual.

We will consider first a routine to define and store 21 characters, the limit of the UDG file. Then we will look at one method of providing for the definition, storage, and recall of as many "pages" or sets of characters as we have the inclination and RAM capacity to define.

Character Definition Routine

Listing 1 provides one routine for enter- ing the characters more easily. It starts with line 9000 to permit MERGEing it with other programs if desired.

Type in the program, RUN, and ENTER. 12345678 INPUT e FOR ERROR will appear. You are ready to draw your own character by using the 1 and O keys as your pencil and paper. Pressing 1 gives a black block; 0, a yellow block. If you make an error, press e and start over. The computer assigns your character to

the next open letter.

When the twenty-first character is com- pleted, the whole “page” of characters is displayed. BREAK may be used at any time, followed by GO TO 9600 to revise the character set or GO TO 9700 to SAVE to tape. |

To SAVE to tape, type GO TO 9700 and start the recorder at the first prompt. Continue recording and press any key at the second prompt. BREAK to get out of LOAD mode after both SAVEs have been completed. CAPS SHIFT 9 for GRAPHICS mode will then produce the new character set on keys a through u.

Additional Pages

To provide for storing more than one set of 21 defined characters or “pages” in memory above RAMTOP, we must first CLEAR the required area. Each set re- quires 168 bytes of storage plus 12 bytes

Robert D. Hartung, PO Box 125, Palmyra, NY 14522.

40

Listing 2. Short clear memory routine.

for the LDIR block transfer routine which transfers sets of data back and forth between the storage area and the UDG area beginning at 65368 in RAM. Since CLEAR deletes all variables, we will pre- face the LOADing of the main program with the short routine in Listing 2 which stores in line 1 REM nn the number of pages to be CLEARed in memory, CLEARs this RAM area, then goes automatically

Listing 1. Character definition routine.

REM 77

a Sus LET 723 S884 PORE 223592,-1 3085 PRINT AT £1.28 3887 PRINT “1234508723 THEUT e FO R ERROR” 3903 FOR g=r TO 117 3089 FOR i-i TO 6 oi LET byte =-8 adis LET b$="BIN "' 34024 FOR n=? TO 8 STEP -i 3030 PAUZE Y 3035 LET a£$£-IHEÉEY£É 3840 IF a$="e" THEN LET = PIN TO 2882 ss IF a£: i" AND a£: a THEH GO TO 2838 S@55 LET bi=bá+25% 54s LET bute-zbutesztnssHi a$ agp? IF a$-"0O" THEN INK 5: PRINT e o; INK S 25030 IF ag="1" THEN PRINT "Me 395984 NEXT n S188 PRINT i; TRE 18; b$; TAB 24; by te 3112 PORE USER CHRE g34i-1 VAL BS 3138 HEXT 3140 PRINT CHAS 3) TRE 3: OHR 3+ 4? S158 NEXT 3g acoge PRINT “SHAS PEINT OUT 3814 FOR noid¿ TO i64 3528 PRINT CHRS n; S638 NEST n S648 PRINT ‘abcde FGRi noparea TS 358590 PRINT 777 INPUT HEL CHAS 8 T ha HB iS INPUT s TO BALE COD DEUS 3006 PAUSE Y 9854 LET otobE INKEYS 3832 IF af="s*" THEH GO TO 3/12 3522 co TUO 2884 37040 SAVE "bin" LINE 37z& 3718 SAVE "bin" CODE 55353,1523 372% LORD "bin CODE B5B5252.152

NEN

Iu zu

A ama o mg

—.— r ed rimi

"Quar de

eX Ie Do os MM n

: H ¿ =

r3 i 1 L ET

n m R

: Hiis 5 mS 54 vit} $3 P. = ===> == r. == ei rif Ez bs rs Ho Rone s pce == - miL 4: e uu ien iem uu uu av EE P, ics mf = LS is

into MERGE mode for the main program following it on tape. The second n byte in 1 REM may be used to store a starting page number safe from RUN or CLEAR if desired by inserting 9312 POKE (VAL r$+6),pno

It then goes into LOAD “bin” CODE mode for the character definition codes SAVEd to tape following the main program listing. Line numbers must be exactly as listed in order for the proper MERGEing and LOADing sequences to take place auto- matically when the three SAVEs are played back with LOAD “bin” or LOAD *”.

Type in Listing 2 and input the number of sets or pages of characters you wish to define. Start the recorder at the line 9040 SAVE prompt, then BREAK, and stop the tape when the LOAD mode com- mences. Enter LOAD “bin” and reLOAD from tape the character definition program in Listing 1. (You did SAVE it, didn’t you?)

Add to it the lines and changes indi- cated in Listing 3.

SAVE the listing to tape immediately following the short CLEAR memory rou- tine by using GO TO 9200. Now rewind the tape, enter LOAD “bin” or LOAD **”, and start the tape at the CLEAR memory routine. Let it run until both it and the main listing are reLOADed. BREAK and GO TO 9300. Begin defining your char- acters at PAGE 1. At any point before the completion of a page or set of 21 characters, entering “a” will return you to the printout and menu where entering “s” will start the SAVE of the definition codes to tape, immediately following the SAVE of the main listing. All three SAVEs will LOAD one after the other by starting with LOAD “bin” or LOAD “”,

It is not necessary to MERGE the entire character definition listing with a program in which you wish to use various sets of characters. First, make a SAVE to tape of the short CLEAR memory routine. Next, reLOAD the main character definition routine and insert line 9500 RETURN. Delete all lines except 1 REM nn up to 9200 and delete all lines after 9500 except 9999. Delete lines 9245, 9335, 9340, 9410, 9470, and all DATA in 9480 following the first 201. The second set of DATA is no

March/April 1984 © SYNC

longer needed since all block transfers will now be made only from the page files to the UDG file.

When editing has been completed, enter as a direct command

LOAD “bin” CODE 65356-168*nop,16

8*nop and LOAD the definition codes (the third SAVE in the original series). Immediately following the CLEAR memory routine on the tape, SAVE the abbreviated listing and the codes by GO TO 9200, then BREAK, then GO TO 9999.

These three consecutive SAVEs will reLOAD in sequence by starting with a LOAD “bin” or LOAD *”. They may now be MERGEd with a program using UDG characters as long as it does not contain a line 1 or any other line numbers used in the UDG subroutine.

A typical program line to call up a new page of UDG characters would be like this

10 LET pno=1: GO SUB 9315: PRI

NT “a”

The letter “a” is entered in GRAPHIC mode (CAPS SHIFT 9) and “pno” is the page number. Depending on which page of UDG characters is in the UDG file at the time, the “a” will display and PRINT the first character of that page or a space if that character is undefined in the UDG file.

Line Notes:

Listing 1

9004-9005: Provide an uninterrupted scroll from the bottom line upward.

9015: “bin” is a token word (as on the ZX/TS2068 computers the underlined words in the PRINT statements may be

obtained by first entering the token word THEN, followed by the desired token word. The deletion of the THEN is a bit tricky as are line numbers since the deletion of the token word DELETE must be done with the same keystroke.).

9030: INKEY$ input is in binary digits with a restart on a character if “e” (error) is input. Hold the key down for at least 1/60 of a second or INKEYS will be read as an invalid value.

9040: In a multiple statement line any prior condition set at the beginning of the line applies to the operation of the state- ments following in the same line.

9070: A temporary attribute may be assigned by making the line read:

IF a$=“0” THEN PRINT INK 6; ”; The INK attribute reverts to original on the next statement.

9710: SAVEs the definition codes sep- arately since the UDG file does not SAVE along with the listing.

9720: The autoLOAD instruction in line 9700 is not activated until after the program is reLOADed back from tape with either LOAD “bin” or LOAD “”.

Listing 2

1: REM nn must not be overwritten by any program in which the UDG routines are used.

Listing 3

9230: Allows restarting the program at any time by GO TO menu.

9245: Will appear in the main listing after MERGEing. It must be deleted before reSAVEing the main listing back to tape, otherwise the LOADing sequence will be interrupted.

9480: Data is code for the LDIR block transfer routine to and from UDG file. Ma

Listing 3. Page routine.

5 cl c i REH * AAA pe Ms ee | S882 LET r=o3:; sei PORE 20592,-1 > ST 37 A 30885 PRINT AT 21.8 35085 PRINT “PHGSE HO. pna iNP UT FOR ERROR” agn? PRINT "12345872 INPUT a TUO PORE TO PASE" SgS FOR g=r TO 117 3089 FOR isi TO 8 3010 LET byte=2 34i5 LET EBRE="D5IN s020 FOR n-7 TO 8 STEP -1 sus PAUSE 4 38352 LET as=inkiy¢ S840 IF a$-'"e" THEN LET 7-3 PIE TO 2882 23845 IF a$-"a" THEN GO TO 5348 m = ps - " o = sz É-1 34548 TF 3 ES x ANI = ES B = THEN GO TO 3838 3855 LET bS=bS+iNKREYS apo LET byte =bute¢StnseVAlL a$ 5072 IF a$£-" "250" THEN IHE 5: PRINT d ud ; INE + sa30 IF a£-"i" THEN PRINT "Ei agas HEXT n - ^ "* Hi £34 sar ois PRT M "TIE 7 13 i a ee ee s pa diu E 1 Ho 15 GE ¡Ho 4 oo Le aiied PORE USR HRS $4i-L.VAL b 2138 NEXT S140 PRINT TAB 5; CHR$ 3 CHR $ ig+47) SiSa WEST 3 S155 PRINT “PAGE NO. ";pno;" COH pucETTBICOPM aisg LET zi -—— 1 X 320% Sei 238 Tiap m

March/April 1984 © SYNC

in e i sock iL rum “See i E VICE £375 4 i 3 sxe iL ii e. Jezna Dolce m = f E P E H 3048 F INESSE E noni: FE ENS rs i c T SID E : E arg Ue 1 = pm | y = A, ey a J = e E ode - L 1. 1 ”. z vi Lei Ph PE rA i EUT m i = ES Pi d AAA af a: To. ord qma a MA: = HH a DE=rTrne = mest unk T eS i. | qer = A E A E a a eU QU fw mitem ce pce ie t cie S o lh = RIA. SIDO A 5530; ae pe ee ee = hoi a Tu ir C . en, = PURE nas T RIEMUS r,

"d =. = Pio a Raa M c ISO H&RITSTaRAT OTI Em eS oCa = A Se Se SS SS = a gr = MEAT E T o er 3 ME E == par om TL m. E go Fae ee See pepe hc So SoS, A F : E aS == 3 >a TE 5 = $ 1 - : E H E HE $. E d z t Ifi pte ey Ss) BF S's ul te am E et Be =i

Eure e s A m - Ad IE 4 te 7. s e i ed 2:73 7 a A ae a ; z28 a = ed Io Eun et aan ate e - PRINT rio it = pap a i g | by r * S $ soi rin ficiós ii = ee ans es es Dac] m Ti) q 1 ^ = Rei ahi: $1.9 HS T:

PReimMi LHES fr, =a e oe ence £u $. i E Y r, = HGAI A = per pega A : = LA ur iT ie = i uTIXATfcTc

^ _ £i$* + ES Ted £I e = Pritt ancderdnzig£&R ii Spa + [m = * DDTRT C00 TR Im: -une G SE5G PRINT feiss ir. TAE H IN A PERDI? c TE Rie GAS i ii O nd IMP: iP miii Peis awene n o miT cz Th. cO Dc T uc - ciim

= Lia Ss Ui: SRS LLL azra Canoe 3 3554 PRUSE 4 Sie eee ee ee ee HERE LET aZz-iHkEvVE - = :oÍf -—— = x ci ite H IA —= wt’ = 387 LEP if stubpe as fum Gt TE agote: Tits es Tr az e udi at£-"x PIE! igi; ii: tsp S CER bici aoe di cele ee rta MT cH Rc palla es 1 2 cd p - - 1