News Issue 12 Contents Hardware World

letters



Logical statements

THIS INFORMATION on string arrays and logical arithmetic may be of interest.

Sinclair ZX-81 Basic lacks an IF ... THEN ... ELSE statement. In one specialised context, however, this can be mimicked with the use of string arrays, thus saving program space.

Since one cannot have, for example:

IF N=1 THEN PRINT A$(7) ELSE PRINT A$(8)

one might seem to need two statements:

IF N=1 THEN PRINT A$(7)
IF N <> 1 THEN PRINT A$(8)

In fact, they can both be replaced by the single statement PRINT A$(NOT N-1).

A similar effect can also be produced, so long as N is not zero or negative, by PRINT A$(7 + SGN(N-1)); but that prints A$(6) if N is zero or negative and in any case needs an extra pair of brackets.

The idea can be extended, provided always that the choice is between strings in the same array. For example;

IF N>8 AND N<13 THEN PRINT A$(25)
IF NOT (N>8 AND N<13) THEN PRINT A$(6)

can be replaced by

PRINT A$(25-19*NOT (N>8 AND N<13).

The same can even be done for more than two conditional statements; for example, the four lines

IF A=3 AND B>4 THEN PRINT A$(7)
IF A=3 AND B<=4 THEN PRINT A$(8)
IF A<>3 AND B>4 THEN PRINT A$(23)
IF A<>3 AND B<=4 THEN PRINT A$(24)

can all be replaced by the single

PRINT A$(7+16*(NOT A-3)+NOT B>4)

with a considerable saving of space.

R W Sharples

Improving printer

WITH THE FLEX coming out of the edge connector on the left instead of the normal right-hand side, my ZX printer is now non-standard. I believe it is an improvement on the Sinclair orientation. It takes up less space and does not interfere with the keyboard accessibility, either visually or manually. It also has an extremely desirable side effect, in that the RAM pack stability has improved. I do not know why.

The method of alteration is to undo the two screws on the printer connector terminal and carefully remove the two case halves, keeping the terminal card in the same position. Put the main cable to the opposite side of the terminal card and refold the wires neatly, then reverse the case halves and turn upside down, screwheads uppermost, fit over terminal card and replace screws.

A Wood

User in a bind

HAS Sinclair User any plans to sell binders for the magazine? I have bought the magazine from its first issue and I feel that a binder would transform my collection of magazines into a useful text.

Simon Stockdale

There are no plans to sell binders at the moment. If a decision is taken in the future we will keep readers informed.

Pascal convert

COULD YOU tell me if there is a Pascal converter on sale for the Spectrum and if it is possible to purchase a colour printer for the Spectrum?

Kevin Hardy

A BOOK called Pascal for Human Beings is produced by Interface. It contains a compiler which turns a subset of Pascal into Basic.

A colour printer is available for certain microcomputers but unfortunately an interface for the Spectrum to use the printer is not available yet.

Protecting software

THANK YOU for the write-up in the Sinclair User December issue regarding the Software Protection Unit. We also, in fact, had an advertisement in that issue concerning the same unit.

Unfortunately there was a rather damaging error in the write-up which had very serious effects. The protection unit uses only six batteries - as indicated in the instruction sheet. That gives a total battery price of £2.14 using Duracells or £1.50 using HP cells. The price you quoted was for eight batteries at £3.34 per set.

The price of the batteries is of vital significance to the success of the sales drive, as the competition uses nickel cadmium batteries.

R J Schmid, Microbyte

RAMTOP problem

HENRY EVANSON's question - Helpline, January 1983 - highlights a problem which the Sinclair manual does not make clear. If a program has been loaded into the Spectrum which moves RAMTOP - for example if the machine code in a program is stored above RAMTOP and the space already reserved for UDG is not sufficient - then even if NEW is pressed RAMTOP is not re-set.

In some cases the program, though written entirely in Basic, will require the whole of the RAM - including the area reserved for UDG. If that is the case the error report 4 OUT OF MEMORY will appear after the leader has been read.

To the uninitiated that can be baffling. While all our Spectrum educational software clears sufficient memory automatically to allow the program to load and run irrespective of where RAMTOP was set, not every software house is so helpful. If, therefore, a program which is supposed to fit into your machine does not but displays error 4 you will doubtless find that, clear 32767 (16K) or clear 65535 (48K) will, if entered in immediate mode before loading the offending tape, cure the problem.

Peter Forbes, Kingfisher Software

Listing is stumped

Cricket

AS A KEEN cricket enthusiast, I was interested to see the program submitted by Peter Horlock. Being a newcomer to the world of microcomputing, I should like to know if that program could be modified to run on my recently received 16K Spectrum. If so, could you publish a program for cricketing Spectrum owners, of whom there must be a great many among your readers?

Frank Kilburn

The program would be too big to run on the 16K Spectrum. If, however, any reader has written a cricket program for the machine we would be interested to see it.

Publisher seeks sports programs

THE EDITORS of a new book to be published soon on Microcomputers in Sport are looking for specimen programs which demonstrate the use of computers in sport, recreation and physical education. If you have written, or are prepared to write, suitable programs and would like to submit them for publication, please send them to Dr David Brodie, Liverpool.

The editors are interested in both simple and complex programs, so do not consider that a straightforward program is not worth submitting. All programs selected for inclusion will have full author acknowledgment in the text and frontispiece. Many readers, young and old, experienced and inexperienced, amateur and professional, must have some programming ideas which could easily be applied or adapted to sport, recreation or physical education. Please respond quickly, as publishing deadlines have to be met, even if only to say that you are working on an idea and need a little more time to develop it.

David Brodie

Firms receive pat on back

ONE READS constantly of complaints by the public against both hardware and software manufacturers. My son owns a Spectrum and has suffered bad service, in common with many others, but I felt I should write in praise of the following:

Campbell Systems, for keeping its word and sending goods by return.

Kempston Electronics, for rushing an order for Christmas. It could easily have written for extra money but sent the product first.

JRS Software, for redeeming me and supplying an upgrade on Christmas Eve after I had been let down elsewhere.

M D Pritchard

Futurology issue 9

Home computing is not harmful

RECENTLY I read with amazement the article in the December issue of Sinclair User by Chris Reynolds putting forward the view that children using computers will not increase their job prospects. While I would agree that the use of a micro will not enhance a child's prospects in the so-called computer industry, it will be very useful in almost any other job which requires management.

I am a sales manager and find a personal computing capacity invaluable, despite having a mainframe in the company. My programs may not be elegant but they get results in a practical situation.

Do not be misled; an introverted child is an introverted child whatever happens and no-one ever became introverted by using a computer. The real danger is of academics becoming isolated from the world of work.

R Fowle



News Issue 12 Contents Hardware World

Sinclair User
March 1983