Guidance NotesPosted: March 16, 2013
The following notes are intended to provide some guidance to the layout of this book, and its relevance to Spectrum users.
16K and 48K Spectrum compatibility
Although the programs in this book were written on my 48K Spectrum, they should RUN on the 16K Spectrum without modification (apart from the Starmaps program in Chapter 8, which will fit on the 48K only). The total memory capacity necessary to RUN the other programs should not exceed about 7K — well within the 16K Spectrum’s 9K of usable memory. No machine code routines are included and the few POKEs and PEEKs that are used are compatible with both versions of the Spectrum.
Most of the LLISTings in this book were prepared via an Epson printer and an RS232 interface to the Spectrum. Only the ASCII character set can normally be committed to a printer (other than the ZX printer) and so the Spectrum’s chunky graphics and UDG set CHR$ 128 to CHR$ 164 inclusive are named as CHR$ CODEs in the LLISTings when they are included in programs. This doesn’t affect the RUNning of programs and is preferable in many ways — leaving no doubt as to which character is intended.
NB. The Epson printer does not include the hash sign (#), which is represented in the LLISTings by the pound (£) sign, or the copyright sign (©), which is represented by the @ sign.
As far as possible, I have tried to ensure that the LLISTings are identical to the screen LISTings you will see as you key in the programs.
Although it is unlikely that one programmer will completely understand the technique of another, you may find it helpful if I clarify some of the points behind the layout of the program LISTing.
1. The Spectrum screen and the LISTings are limited to a maximum of 32 characters per line, including the line number.
2. Multi-statement lines do not aid legibility.
3. Only 19 characters (within quotation marks) can be used in a single-line PRINT statement, before it overflows on to the next line.
4. REM statements are an important aid in breaking up the program.
I don’t subscribe to the commonly-held belief that the quality of a program should be judged by its length. A program should do the most for the least amount of effort, especially if it has to be keyed in. This means that my PRINT commands are sometimes rather curt, and only information which is necessary to RUN the program is contained in the screen display.
Generally, error-trapping of INPUTs is kept to a minimum: I’ve included some useful hints in Chapter 10, which you can add if you wish. If a program crashes with a nonsensical INPUT, for example, you usually lose little (although it may be a blow to your pride) and the program can be restarted with a GOTO command (any special conditions are included in the program notes)
ZX printer COPYs
All the programs have been prepared to give a good standard of screen display in both monochrome and colour, so that text and graphics stand out clearly and you can send legible COPYs to the ZX printer (remembering that the printer will only give you black and white COPYs, with no intermediate tones). Also, although I have used an inverse presentation (BORDER 0: PAPER 0: INK 9 – black screen with white or light colours for the display, conjuring up an impression of the night sky) the results when committed to the printer will always come out as black on white, and will look like a negative image of the screen display.
If you do not have a ZX printer, or your printer is not connected to the Spectrum, the program will just skip the COPY, LLIST, LPRINT commands wherever they occur and go on to the next line. If you don’t know how to remove the printer commands from the program, it is safer to leave them in.
None of the programs in this book is sacrosanct. You should make your own amendments as required, and personalise the finished product. For instance, I have not used BEEP instruction very often. This stems purely from my own association of astronomy with nights enjoyed in blissful silence under a starry sky. You may feel that BEEPs are appropriate to some programs (in addition to those few where I have included them) and you should feel free to add as many BEEPs as you like.
A lot is written in the computing press about the time taken to execute set routines as a test of the running speed of the particular computer. If a program is searching or sorting information, then this can be important. However, none of the programs in this book are of this kind, so the question does not arise. The operating speed of the Spectrum for most tasks in amateur astronomy is more than adequate. As an example, the Planetary Ephemeris program in Chapter 6 takes about 20 seconds to compute and PRINT to the screen all the planetary positions – Mercury through to Pluto – within, generally, a few minutes of arc accuracy for any chosen date. A skilled mathematician would take about 15 to 20 minutes per planet to do this ‘by hand’.
From Spectrum to night sky
Some of the programs have an observational bias, and I certainly hope that you will feel encouraged to leave your Spectrum sometimes, and find the stars and planets referred to in the programs, using a pair of binoculars or a telescope. This would make these programs much more rewarding.
You can get a telescope which is quite small and still very effective. The important thing to look out for is not the magnification (which is just a by-product of the optical arrangement) but the size of the aperture of the main collecting lens – or mirror, if it is a reflecting telescope. Anything which improves on the human eye’s miserly aperture (7 mm diameter at best, when adapted to the dark) will produce dramatic results. For example, a 60 mm aperture refractor (lens) telescope collects at least 70 times — ie (60/7)2 — more light than the eye, and so makes many faint night-time objects clearly visible.
If you end up hooked on astronomy, the appendix lists some organisations which will be pleased to help you.
Warning! On no account should any telescope or pair of binoculars be pointed at the Sun! Instant and permanent blindness will result. (This applies even if the instrument is fitted with so-called sun-filters, which are not safe – they may shatter under the sun’s heat or pass harmful radiation.)