20.02.2013 Views

ZX Computings - OpenLibra

ZX Computings - OpenLibra

ZX Computings - OpenLibra

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

I<br />

sr<br />

The first few weeks after the<br />

purchase of your <strong>ZX</strong>81 may<br />

justifiably be defined as the<br />

"infatuation" stage. The<br />

power of the machine to<br />

generate data at apparently<br />

phenomenal speed is<br />

fascinating, even exciting to<br />

those new to the computer<br />

keyboard. Scores of little<br />

programs are lovingly saved<br />

on cassette tapes — most of<br />

them centred around the<br />

FOR/NEXT loop. Typical<br />

programs include printing out<br />

"HELLO" 47 times, filling the<br />

screen with nine-digit columns<br />

of sin(x)and —cos(x) or<br />

meaningless equations chosen<br />

primarily for their complexity.<br />

As many of these little morsels<br />

as possible are crammed on<br />

both sides of C60 (or in some<br />

cases even C120!) tapes.<br />

Frantic trips to purchase new<br />

supplies of blank cassettes are<br />

frequently made or, if the<br />

shops are shut, a previously<br />

loved recording of<br />

Beethoven's ninth is<br />

irreverently erased in order to<br />

make room for a program<br />

which generates the first<br />

2000 primes (I often wonder<br />

what you do with primes after<br />

you generate them but they<br />

seem to offer solace to many).<br />

Naming Names<br />

But all things come to an end<br />

at some time or another. It<br />

gradually dawns on most<br />

people that their "collection"<br />

is in reality nothing more than<br />

a heap of rubbish. Most of<br />

what they have saved is<br />

useless, and the few that have<br />

some merit are buried<br />

between dozens of unwanted<br />

remnants.<br />

10<br />

20<br />

30<br />

35<br />

40<br />

50<br />

60<br />

REM PRIME NUMBERS<br />

DIM O(20O0)<br />

LET Z=1<br />

SCROLL<br />

PRINT 2<br />

LET O(l) =2<br />

Organisation, The<br />

Key?<br />

Any attempt to organise your<br />

computing life must begin<br />

with a simple rule . , . one<br />

program on a tape with a copy<br />

on the reverse side.<br />

Superficially, this appears to<br />

be a shocking waste of tape<br />

because, on the average, most<br />

of the tape will remain unused<br />

but in spite of this the rule is<br />

sound in human terms. It is<br />

better to waste a few feet of<br />

relatively inexpensive tape in<br />

return for the following<br />

benefits: no infuriating<br />

searches for programs "in the<br />

middle"; no need to name<br />

FOR G = 3 TO 2000 ST£P<br />

70 FOR H=1<br />

30 IF INT<br />

GOTO 500<br />

100 NEXT H<br />

150 LET Z=Z + 1<br />

200 LET Q(Z)=G<br />

240 SCROLL<br />

250 PRINT G<br />

250 PAUSE 50<br />

50© NEXT G<br />

TO Z<br />

( G.-'tf IHJ > + /.H*<br />

SP<br />

=G THEN<br />

Library<br />

programs, therefore no need<br />

to memorise what you have<br />

named them; if you have to<br />

amend a program, there is no<br />

danger of the extra few bytes<br />

extending into the obliterating<br />

the beginning of the next<br />

program; if the tape is<br />

accidentally dropped into a<br />

plate of soup (or a similar<br />

household hazard degrades its<br />

performance) only one<br />

program is lost; if you lend a<br />

tape to a friend for copying<br />

purposes and it is returned a<br />

corrupted length of jargon,<br />

there is less danger of physical<br />

violence breaking out if only<br />

one program is spoilt.<br />

Finally, we cannot entirely<br />

discard a psychological factor.<br />

Weeks, perhaps even months<br />

of programming work<br />

condensed onto one tape fails<br />

to impress the casual<br />

acquaintance. Spread out into<br />

twenty or so, neatly labelled<br />

cases with the whole resting<br />

in a partitioned "cabinet" will<br />

enhance your local reputation<br />

as an egghead.<br />

worthwhile<br />

Programs<br />

"Worthwhile" in this sense<br />

means "is it worth saving on<br />

tape?" Consider the following<br />

as a reasonable set of criteria<br />

from which to start:<br />

1) Has the program been<br />

tested for every conceivable<br />

input combination. For<br />

example, what happens if you<br />

input a "0" or a negative<br />

number or a number with<br />

umpteen digits in it? Nothing<br />

is more humiliating to a proud<br />

demonstrator than one of<br />

those sarcastic error<br />

messages which leap up from<br />

the bowels of the BASIC<br />

interpreter whenever it suffers<br />

the slightest confusion.<br />

Particularly if you are trying to<br />

impress.<br />

2) Will the program check for<br />

ridiculous input 7 Remember<br />

that an input can be<br />

mathematically acceptable<br />

and free from syntax error but<br />

can stilt lack realism. For<br />

example, let us assume a<br />

program, which assists in the<br />

design of a signal amplifier,<br />

asks for the supply rail<br />

voltage. If the operator<br />

mistakenly keys in 2.6E4<br />

instead of 2.6E 4 will the<br />

stupid machine accept<br />

this ... or what is more to the<br />

point . . . will the stupid<br />

program accept it and go on to<br />

compute a recommended<br />

output current in the order of<br />

kiloamps? In short, does the<br />

program include full data input<br />

validation routines?<br />

3) Is the program completely<br />

self-explanatory to the<br />

operator? Are there, for<br />

instsice, full instructions on<br />

the VDU screen or does it<br />

mean searching for some<br />

scrap of paper somewhere<br />

which contains the gory<br />

details of the button-pressing<br />

routines? No accompanying<br />

document of any kind should<br />

be necessary because the<br />

VDU screen can tell all. There<br />

should also be a title page<br />

which defines clearly the<br />

purpose of the program.<br />

Remember that at the time of<br />

1MER 1382 <strong>ZX</strong> COMPUTING SUMMER 1982 29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!