Table Of ContentA MARSHALL CAVENDISH (cid:9) COMPUTER C i_VSE IN WEEKLY PARTS
LEARN PROGRAMMING - FOR 4IUN AND THETUIP
HOW TO ORDER
YOUR BINDERS
UK and Republic of Ireland:
Send £4.95 (inc p & p) (1R£5.95) for
each binder to the address below:
Marshall Cavendish Services Ltd,
Department 980, Newtown Road,
Hove, Sussex BN3 7DN
Australia: See inserts for details, or
Vol. 3 (cid:9) No 35 write to INPUT, Times Consultants
PO Box 213, Alexandria, NSW 2015
APPLICATIONS 22 New Zealand: See inserts for details, or
write to INPUT, Gordon and Gotch
(NZ) Ltd, PO Box 1595, Wellington
Malta: Binders are available from local
newsagents.
Zoom into the micro world with this powerful program
GAMES PROGRAMMING 35
LUNAR TOUCHDOWN (cid:9) 1088
There are four binders each holding 13 issues.
A complete arcade-type game for you to enter
BACK NUMBERS
BASIC PROGRAMMING 73
Back numbers are supplied at the regular cover price (subject to availability).
HOW'S IT SOUND? (cid:9) 1091 UK and Republic of Ireland:
INPUT, Dept AN, Marshall Cavendish Services,
Newtown Road, Hove BN3 7DN
Using your micro to explore the world of digital sound Australia, New Zealand and Malta:
Back numbers are available through your local newsagent.
GAMES PROGRAMMING 36
THE GAME OF FOX AND GEESE (cid:9)
1091
COPIES BY POST
Make your computer think for itself in INPUT's new game
Our Subscription Department can supply copies to any UK address regularly at £1 .00 each.
For example the cost of 26 issues is £26.00; for any other quantity simply multiply the number
MACHINE CODE 36 of issues required by £1.00. Send your order, with payment to:
Subscription Department, Marshall Cavendish Services Ltd,
CLIFFHANGER: STARTING OFF(cid:9) 1101m Newtown Road, Hove, Sussex BN3 7DN
Please state the title of the publication and the part from which you wish to start.
Start Willie off on his picnic
HOW TO PAY: Readers in UK and Republic of Ireland: All cheques orpostal orders
for binders, back numbers and copies by post should he made payable to:
BASIC PROGRAMMING 74 Marshall Cavendish Partworks Ltd.
&HOW BASIC PROGRAMS ARE STORED AEA QUERIES: When writing in, please give the make and model of your computer, as
well as the Part No., page and line where the program is rejected or where it does
not work. We can only answer specific queries— and please do not telephone. Send
Find out what your machine does with your programs your queries to INPUT Queries, Marshall Cavendish Partworks Ltd, 58 Old
Compton Street, London WI V SPA.
INDEX
The last part of INPUT, Part 52, will contain a complete, cross-referenced index. INPUT IS SPECIALLY DESIGNED FOR:
For easy access to your growing collection, a cumulative index to the contents
of each issue is contained on the inside back cover. The SINCLAIR ZX SPECTRUM (16K, 48K,128 and +),
COMMODORE 64 and 128, ACORN ELECTRON, BBC B
PICTURE CREDITS and B+,and the DRAGON 32 and 64.
Front cover, Dave King. Pages 1081, 1083, 1084, 1086, Gary Wing. Pages 1082,
In addition, many of the programs and explanations are also
1092, 1100, Peter Reilly. Page 1088, Ian Craig. Page 1090, NASA. Pages 1091,
David Redfern Photography, Paul Chave. Page 1094, Paul Chave. Pages 1096, 1098, suitable for the SINCLAIR ZX81, COMMODORE VIC 20, and
1100, Phil Dobson. Pages 1011, 1102, 1104, Steve Rippington. Pages 1107, 1111, TANDY COLOUR COMPUTER in 32K with extended BASIC.
Dave King. Programs and text which are specifically for particular machines
are indicated by the following symbols:
© Marshall Cavendish Limited 1984/5/6 IICK
All worldwide rights reserved* SPECTRUM 16K,
The contents of this publication including software, codes, listings, 4814128, and + (cid:9) COMMODORE 64 and 128
graphics, illustrations and text are the exclusive property and copyright of
Marshall Cavendish Limited and may not be copied, reproduced, la ACORN ELECTRON,
transmitted, hired, lent, distributed, stored or modified in any form BBC B and B+ 14 DRAGON 32 and 64
whatsoever without the prior approval of the Copyright holder* TAN
T. TRSBO
Published by Marshall Cavendish Partworks Ltd, 58 Old Compton Street, London W1V SPA,
England. Typeset by MS Filmsetting Limited, Frome, Somerset. Printed by Cooper Clegg 7181 (cid:9) VIC 20 COMPUTER
Web Offset Ltd, Gloucester and Howard Hunt Litho, London.
DRAWING A PICTURE
SETTING THE SCALE
MAGNIFYING AND REDUCING
HIDING DETAIL IN THE PICTURE
MAKING ACCURATE DRAWINGS
This versatile program can reduce a into a game for two people* One person draws
HOW TO USE THE PROGRAM
picture to a microscopic dot or a scene hiding some 'treasure' at a very small
expand it to astronomical magnification somewhere deep in the picture* When you RUN the program you are presen-
The other person then has to search for the ted with a blank screen and a tiny flashing
dimensions. Use it to create highly
treasure. It can be surprisingly difficult* cursor at the centre* There are also two
accurate drawings or as a game
Imagine starting with a square 10 centimetres numbers. The one on the left gives the scale of
across* If this is magnified 5000 times the the present screen, 1 to start with, and the one
The program that accompanies this article is original square turns into an enormous area of on the right gives the number of lines drawn*
rather more fun than the usual applications a quarter of a million square metres—plenty This is dimensioned to a maximum of 600 at
program* In fact it can be used either as a of room to hide almost anything in* the start of the program* The program is
game or an application* The program has serious applications too, controlled from the keyboard and is ex-
It lets you draw a picture and then magnify of course. Very accurate line drawings can be tremely easy to use*
any part of it to draw in more detail down to a made by entering detail at a much larger scale On all but the Commodore, the cursor
microscopic scale* You can change the scale at than usual and then reducing it to the correct keys move the dot around the screen*
any time using magnifications of many size* Accurate technical drawings can be built The Commodore uses @ and / for up and,/
thousands or even hundreds of thousands. An up a section at a time in this way. The down, and : and ; for left and right. You
enormous amount of detail can be hidden in a program is also useful in teaching. For can speed up the movement of the cur
picture which disappears from view as you example, in a geography lesson, the position by simultaneously pressing 'SYMBOL SHIFTI,
pan out, and reappears again as you zoom in. of major towns could be marked on a map of on the Spectrum, 'SHIFT' on the Com-
Imagine yourself with a powerful micro- the country but at a much reduced scale. At modore, I COPY I on the Acorn and
scope peering more and more closely at some normal magnification they would only be a ICLEARI on the Dragon and Tandy.
part of a scene. Detail appears as the magnific- residual dot and would only appear in detail if The other keys used are L, M, C, A
ation increases and blurs into nothing as it you chose to zoom in at the correct position in D, I, 0 and Z* Here's what they do.11
decreases* Or you can look at it the other way* the picture* Press L to draw a line to the cur-
Starting with a view of your house you can You could even enter the names of the sor or M to move to the cursor
imagine moving further and further away out towns—although you cannot enter text with without drawing a line. Pressing
into space* One by one your house, town, this program, it is a simple enough matter to C returns the cursor to the
country and even earth itself disappears into a draw out the letters* Use a large scale to draw centre of the
dot in the distance. Similar graphics effects them first—in the correct position—then re- screen*
can be achieved using the relatively short duce them to the right size.
program given here*
One way of using the program is to turn it
If you magnify this house you can look through the window and see a book on the table
If you find you've made a mistake, press D 100 LET i$=1NKEY$ 460 LOAD f$ DATA a()
for delete and you'll be asked how many lines 110 IF 1$="1" AND f AND 1> In THEN BEEP 470 LOAD f$ DATA b()
you want to delete. The program counts back- 0.1,0: PLOT FN a(a(In)),FN b(b(In)): DRAW 480 LOAD f$ DATA c()
ward from the last line drawn and deletes FN a(c(In)) — PEEK 23677,FN 485 LOAD f$ DATA d()
the correct number of lines. The 0 key out- b(d(In)) — PEEK 23678: LET In = In + 1: LET 490 LET In = a(601)
puts a file so you can save your drawing, and I a(In) = x: LET b(In) = y: LET c(In) = x: LET 590 RETURN
inputs a file to load in a saved picture. d(In)=y: LET f = 0 600 CLS
The Acorn program works with both tape and 120 IF i$="c" THEN LET x=0: LET y=0: 610 INPUT "ENTER FILENAMEq ";f$
disk. For the other computers, changes for LET c(In)=x: LET d(In)=y 615 IF f$="" THEN GOTO 610
disk are given after the main program. 130 IF i$="m" THEN LET a(In)=x: LET 620 LET Iv=1: GOSUB 840
Now for the interesting part. The Z b(In)=y 625 LET a(601) =In
(Zoom) key allows you to change the scale of 140 IF i$="1" THEN GOSUB 420 630 SAVE f$ DATA a()
the picture. The scale, or magnification, is 150 IF i$="o" THEN GOSUB 600 640 SAVE f$ DATA b()
entered as a number; for example, 2 doubles 160 IF i$ ="d" THEN GOSUB 710 650 SAVE f$ DATA c()
the scale and .5 halves it. The picture is 170 IF i$="z" THEN LET Iv= 0: GOSUB 840 660 SAVE f$ DATA d()
redrawn to the new scale centred on the 180 LET sp = 256: IF CODE INKEY$ < =41 700 RETURN
cursor so always move the cursor to the THEN LET sp =2048 710 INPUT "ENTER NUMBER OF LINES TO
—
middle of the point you want magnified. If 190 IF INKEY$="8" OR INKEY$="(" AND DELETE"'k
any part of a line goes off the screen then it is x> —32768 +sp THEN LET f=1: LET 750 IF k=0 OR In —k< =0 THEN GOTO
not drawn at all except on the Acorns. The x =x + sp: LET c(In) = c(In) +sp 830
Acorns draw the part of the line that crosses 200 IF INKEY$="5" OR INKEY$="%" AND 755 LET In =In —k
the screen. x <32768 —sp THEN LET f= —1: LET 760 LET x=a(In): LET y= b(In)
Zooming to a scale of 0 does nothing, while x=x—sp: LET c(In) =c(In) —sp 780 CLS
a scale of one redraws the picture centred on 210 IF INKEY$ = "7" OR INKEY$="'" AND 790 LET c(In)=x: LET d(In)=y
the cursor, but to the same scale. Entering a y> —22400 +sp THEN LET f= —1: LET 800 IF In =1 THEN GOTO 830
negative number produces a mirror image of y= y +sp: LET d(In) = d(In) +sp 810 IF ABS (c(In —1)) <32767 AND ABS
the picture. The changes of scale are cumula- 220 IF INKEY$="6" OR INKEY$="&" AND (d(In —1)) <22399 THEN LET x=0: LET
tive so a magnification of 2 followed by y<22400—sp THEN LET f=1: LET y=0
another 2 increases the magnification to 4. y=y—sp: LET d(In) = d(In) —sp 820 LET lv = 2: GOSUB 840
Note that if you enter a very small scale on 230 GOSUB 250 830 RETURN
the Dragon and Tandy, say .0001, this is 240 GOTO 100 840 IF In =0 THEN RETURN
converted to 10E-4 but appears on the screen 250 PRINT AT 1,2; INVERSE 1; 850 IF Iv=1 THEN LET zoom =1/sc: CLS :
as 104. This is a limitation of the routine that "IIISCALE :";: LET a$=STR$ sc: IF LEN GOTO 920
draws the numbers on the screen and doesn't a$ > 4 THEN LET a$ = a$( TO 4) 860 IF lv = 2 THEN LET zoom =1: GOTO 920
affect the way the picture is drawn. 255 PRINT INVERSE 1;a$;AT 1,18; 870 BEEP .1,10: INPUT "ENTER ZOOM SCALE
"0 LINES:";In —1 ";zoom
280 LET bx=FN a(a(In)): LET by= FN 890 IF zoom =0 THEN GOTO 1020
10 DEF FN a(x) = (x/256) + 128 b(b(In)): LET ex= FN a(c(In)): LET ey= FN 910 CLS
20 DEF FN b(x)= (x/256)+85 b(d(In)) 920 FOR u =1 TO In-1
30 BORDER 0: INK 7: PAPER 0: CLS 290 PLOT bx,by: PLOT ex,ey 930 LET a(u)= (a(u)—x)*zoom: LET
50 LET In =1: LET sc =1: LET 1=600 310 PLOT OVER 1;bx,by: PLOT OVER 1;ex,ey b(u) = (b(u) —y)*zoom
60 LET f=0: LET x=0: LET y=0: LET 320 RETURN 940 LET c(u)=(c(u)—x)*zoom: LET
zoom =1 420 CLS d(u)=(d(u)—y)*zoom
70 DIM a(I +1): DIM b(I): DIM c(I): DIM d(I) 430 INPUT "ENTER FILENAMEq "4 950 IF ABS (a(u)) <32768 AND ABS
80 LET a(1) = x: LET b(1) = y 435 IF f$="" THEN GOTO 430 (b(u)) <22400 AND ABS (c(u)) <32768
90 LET c(1) =x: LET d(1) = y 440 LET In =1: LET zoom =1: LET sc =1 AND ABS (d(u)) <22400 THEN PLOT FN
a(a(u)),FN b(b(u)): DRAW FN
a(c(u)) — PEEK 23677,FN b(d(u)) — PEEK
23678
960 NEXT u
970 LET a(u)=(a(u)—x)*zoom: LET
b(u) = (b(u) —y)*zoom
980 LET c(u)=(c(u)—x)*zoom: LET
d(u) = (d(u) —y)*zoom
990 LET x = On): LET y= On)
1000 IF ABS (a(ln)) >32767 OR ABS
(b(In)) >22399 THEN LET a(In) = x: LET
b(In)=y
1010 LET sc=sc*zoom
1030 RETURN
If you have a Microdrive make these changes
to the program:
437 INPUT "ENTER DRIVE NUMBER ";dry
460 LOAD *"m";drv;"1"+f$ DATA a()
470 LOAD *"m";drv;"2"+f$ DATA b()
480 LOAD *"m";dry;"3"+f$ DATA c()
485 LOAD *"m";dry;"4"+f$ DATA d()
617 INPUT "ENTER DRIVE NUMBER ";dry
630 SAVE *"m";dry;"1"+f$ DATA a()
640 SAVE *"m";drv;"2"+f$ DATA b()
650 SAVE *"m";dry;"3"+f$ DATA c()
660 SAVE *"m";dry;"4"+f$ DATA d()
KIK
You'll need a Simons' Basic cartridge, or
INPUT's own machine code hi-res utility
(starting on page 748), for this program.
10 PRINT "Ej ":COLOUR 6,6:SC$=
"111":SC=1:LN$=SC$
20 HIRES 0,15:GOSUB 790
30 LN%= 0:L%= 600
40 X%=0:Y%=0:ZO =1
50 DIM BX(L%),BY(L%),EX(L%),EY(L%)
60 BX(0)=X%:BY(0)=Y%
70 EX(0)=X%:EY(0)=Y%
80 GOSUB 110:GOTO 80
90 LINE 160+ BX(LN%),100 + BY(LN%),
160+ EX(LN%),100 + EY(LN%),2
100 RETURN
110 DL=0:A$=":GETAVFA$="L"AND
F%ANDL%> LN%THEN GOSUB 260
120 GOSUB 90
130 IFA$ ="C"THENX%=0:Y%=-- 0:
EX(LN%) =X%:EY(LN%) =Y%
140 IFA$="M"THENPLOT160+ BX(LN%),
100 + BY(LN%),0:BX(LN%)=X%:
BY(LN%) =Y% 340 HIRES 0,15
150 IFA$="I"THEN GOSUB 640 350 FORU=0TO(LN%-1)
160 IFA$="0"THEN GOSUB 570 360 BX(U)=(BX(U)-X%)70:
170 IFA$ ="D"THEN GOSUB 460 BY(U) = (BY(U)-Y%)*ZO:
180 IFA$ ="Z"THENS%= 0:GOSUB 290 BX=BX(U):BY=BY(U)
190 SP%=1:IFPEEK(653)=1THEN 370 EX(U)=(EX(U)-X%)*ZO:
SP%=8 EY(U) = (EY(U)-Y%)*ZO:
200 IFPEEK(197)=50ANDX%+SP%<159 EX= EX(U):EY= EY(U)
THENF%= - 1:X% = X% + SP%: 380 GOSUB 710
EX(LN%) = EX(LN%) + SP% 390 NEXTU
210IFPEEK(197) = 45ANDX%- SP% > -159 400 BX(U)= (BX(U)-X%)*ZO:
THENF%= - 1 :X% = X% - SP%: BY(U) = (BY(U) -Y%)*ZO
EX(LN%) = EX(LN%) - SP% 410 EX(U)=(EX(U)-X%)70:
220 IFPEEK(197) =46ANDY%-SP%> -99 EY(U)= (EY(U)-Y%)70
THENF%= - 1:Y% = Y%- SP%: 420 X%=EX(LN%)
EY(LN%) = EY(LN%) - SP% 430 Y%= EY(LN%)
230 IFPEEK(197) =55ANDY%+ SP% 440 SC = SC*ZO:GOSUB 790
< 99TH EN F% = - 1:Y% = Y%+ SP%: 450 RETURN
EY(LN%) = EY(LN%) +SP% 460 NRM:INPUT"DHOW MANY LINES DO
240 GOSUB 90 YOU WANT DELETED";D$
250 RETURN 470 K%=VAL(D$)
260 LINE 160+ BX(LN%),100 + BY(LN%), 480 IFK%=0ORLN%-K%<0THEN
160 + EX(LN%),I 00 + EY(LN%),I : CSET(2):GOT0560
LN%= LN%+ 1:GOSUB 790 490 LN$=STR$(LN%):LN%=LN%-K%
270 BX(LN%)=X%:BY(LN%)=Y%: 500 X%= BX(LN%):Y%= BY(LN%)
EX(LN%) =X%:EY(LN%) =Y%:F%=0 510 HIRES 0,15:GOSUB 790
280 RETURN 520 EX(LN%)=X%:EY(LN%)=Y%
290 IFLN%= 0ANDZZ = 0THEN450 530 IFLN%= 0THENZZ=1:GOT0550
300 ZZ = 0:IFS%= ITH ENZO =1 /SC: 540 IFABS(EX(LN%-1))<160ANDABS
GOT0340 (EY(LN%-1))<100THENX%=0:Y%= 0
310 IFS% = 2THENZO =1:GOT0340 550 S%= 2:GOSUB 290
320 NRM:INPUT"DENTER THE ZOOM 560 RETURN
SCALEPJ";D$ 570 NRM:INPUT "C7 ENTER OUTPUT
330 ZO=VAL(D$):IFZO=0THEN
CSET(2):GOT0440
FILENAMEN";F$ 790 TEXT 264,0,LN$,0,1,8:LN$=STR$(LN%):
580 S%=1:GOSUB 290 TEXT 160,0,"NUM OF LINES:
590 NRM:CM$=",":0PEN1,1,1,F$ "+LN$,1,1,8
600 PRINT#1,LN%:FORU=0TOLN% 800 TEXT 48,0,SC$,0,1,8:SC$=STR$(1NT
610 PRINT# 1,BX(U);CM$;BY(U);CM$;EX(U); (SC*1000)/1000):
CM$;EY(U) TEXT 0,0,"SCALE:"+SC$,1,1,8
620 NEXTU:CLOSE1:HIRES 0,15: 810 RETURN
S%=2:GOSUB 290
To use the program with a disk drive change
630 RETURN
Lines 590 and 660 to:
640 NRM:INPUT"OENTER INPUT
FILENAMEN";F$ 590 NRM: CM$=",":0PEN1,8,1,F$
650 LN%=0:S%=1:GOSUB 290 660 NRM:0PEN1,8,0,F$
660 NRM:OPEN1,1,0,F$
670 INPUT#1,LN%:FORU=0TOLN% LI
680 INPUT#1,BX(U),BY(U),EX(U),EY(U): 10 *FX212,216
NEXTU 20 ON ERROR GOTO 1260
690 CLOSE1:X%= EX(LN%):Y%= EY(LN%): 30 MODE4:VDU 23,1,0;0;0;0;:
HIRES 0,15:GOSUB 790:S%=2: VDU29,640;512;
GOSUB 290 40 L%=0:scale=1:N%=600
700 RETURN 50 X%= 0:Y%= 0:zoom =1
710 SX= (EX— BX)/100:SY= 60 DIM begx(N%),begy(N%),
(EY— BY)/100 endx(N%),endy(N%)
720 FORQ = 0T0100 70 begx(0)=X%:begy(0)=Y%
730 IFABS(BX)>1550RABS(BY)>95THEN 80 endx(0) =X%:endy(0) =Y%
BX= BX+SX:BY= BY + SY:NEXTQ: 90 *FX4,1
GOT0780 95 PLOT 69,0,0
740 SX = (EX — BX)/100:SY = (EY— BY)/100 100 REPEAT
750 FORQ = 0T0100 110 PROCkey
760 IFABS(EX)>1550RABS(EY)>95THEN 120 UNTIL FALSE
EX= EX— SX:EY= EY— SY:NEXTQ 130 END
770 LINE 160 + BX,100 + BY,160 + EX, 140 DEF PROCdraw
100+ EY,1 150 PRINTTAB(5,1)"Scale:";scale;
780 RETURN TAB(18);"No of lines:";L%
160 GCOL 4,0
170 MOVE begx(L%),begy(L%):
DRAW endx(L%),endy(L%)
390 VDU7 800 VDU K%
400 VDU30:PRINT'SPC(39):VDU30 810 UNTIL K%=13
410 PRINT'Enter the zoom scale El"; 820 K%=VAL(D$)
420 D$="" 830 IF K%=0 OR L%— K%<0 GOTO
430 REPEAT 910
440 FOR C%=0 TO100:NEXT:*FX15,1 840 L%= L%— K%
450 zoom =GET 850 X%=begx(L%):Y%=begy(L%)
Game tips
460 IF zoom =127 AND LEN(D$) = 0 860 CLS
When you use this program as a game, the
VDU7:GOTO 440 870 endx(L%) = X%:endy(L%) =Y%
difficult part is to make sure that the
470 IF zoom =127 D$=LEFT$ 880 IF L%=0 GOTO 910
hidden message or treasure doesn't appear
(D$,LEN(D$)-1):GOTO 500 890 IF ABS(endx(L%-1)) <640 AND
as an obvious blob in the picture.
480 IF LEN(D$) =19 VDU7:GOTO 440 ABS(endy(L%-1)) <512 THEN
The trick is to draw in lots of detail at
485 IF (zoom <46 OR zoom >57) AND X%=0:Y%= 0
different magnifications, so your oppo-
zoom< >13 AND zoom< >69 900 PROCzoom(2)
nent has to search for the correct area of
THEN 450 910 VDU 30:PRINT'SPC(39)
the picture as well as the correct magnific-
490 D$=D$+CHR$(zoom) 920 ENDPROC
ation. Don't hide the treasure too well,
500 VDU zoom 930 DEF PROCinput
though, as it is easy to become hopelessly
510 UNTIL zoom =13 940 VDU30:PRINT'SPC(39):VDU30
lost at higher magnifications.
520 zoom= EVAL(D$) 950 VDU7:*FX15,1
If you want to score the game, simply
530 IF zoom= 0 VDU30:PRINT' 960 INPUT—Enter the input
count the number of moves and changes of
SPC(39):GOTO 650 filename III " f$:CLS
scale the player makes. The one with the
540 CLS:GCOL0,1 970 L%= 0:GCOL0,0
smallest number is the winner.
550 FOR U%=0 TO L%-1 980 PROCzoom(1)
175 PLOT 69,begx(L%),begy(L%) 560 begx(U%) = (begx(U%)—X%)*zoom:begy 990 GCOL4,0
180 ENDPROC (U%) = (begy(U%) —Y%)*zoom 1000 D%=OPENUP f$
190 DEF PROCkey 570 endx(U%) = (endx(U%)—X%)*zoom: 1010 INPUT # D%,L%
200 IF INKEY( —87) = —1 AND F% AND endy(U%) = (endy(U%)—Y%)*zoom 1020 FOR U%=0 TO L%-1
N%> L% VDU7:GCOL0,1:MOVE begx(L%), 580 IF ABS(begx(U%)) <32768 AND ABS 1030 INPUT # D%,begx(U%),begy(U%),
begy(L%):DRAW endx(L%),endy(L%):L% = (begy(U%)) <32768 AND ABS(endx(U%)) endx(U%),endy(U%)
L%+1:begx(L%)=X%:begy(L%)= Y%: <32768 AND ABS(endx(U%)) <32768 1040 IF ABS(begx(U%)) <32768 AND
endx(L%) = X%:endy(L%) = Y%:F% = 0 MOVE begx(U%),begy(U%):DRAW endx ABS(begy(U%)) <32768 AND
-
210 PROCdraw (U%),endy(U%) ABS(endx(U%)) <32768 AND
220 IF INKEY( —83) VDU7: 590 NEXT ABS(endy(U%)) <32768 MOVE
X%= 0:Y%=0:endx(L%) = X%: 600 begx(U%) = (begx(U%) —X%)*zoom:begy begx(U%),begy(U%): DRAW
endy(L%) =Y% (U%) = (begy(U%) —Y%)*zoom endx(U%),endy(U%)
230 IF INKEY( —102) VDU7: 610 endx(U%) = (endx(U%) — X%)*zoom:endy 1050 NEXT
begx(L%)=X%:begy(L%)=Y% (U%) = (endy(U%) —Y%)*zoom 1060 INPUT # D%,begx(L%),begy
240 IF INKEY( —38) PROCinput 620 X%=endx(L%):Y%=endy(L%) (L%),endx(L%),endy(L%)
250 IF INKEY( —55) PROCoutput 630 IF ABS(begx(L%)) >32767 OR 1070 X%=endx(L%):Y%=endy(L%)
260 IF INKEY( —51) PROCdelete ABS(begy(L%)) >32767 THEN 1080 CLOSE # 0
270 IF INKEY( —98) PROCzoom(0) begx(L%) = X%:begy(L%) =Y% 1090 VDU7
280 IF INKEY( —106) sp%=24 ELSE sp%= 4 640 scale =scale*zoom 1100 ENDPROC
290 IF INKEY( —122) F%= —1: 650 VDU7 1110 DEF PROCoutput
X%= X%+sp%:endx(L%) = 660 ENDPROC 1120 VDU30:PRINT'SPC(39):VDU30
endx(L%) +sp% 670 DEF PROCdelete 1130 VDU7:*FX15,1
300 IF INKEY( —26) F%= —1: 680 VDU7 1140 INPUT"Inter the output
X%=X%—sp%:endx(L%)= 690 VDU30:PRINT'SPC(39):VDU30 filename El "f$
endx(L%) —sp% 700 PRINT"`How many lines do you want 1150 PROCzoom(1)
310 IF INKEY( —42) F%= —1: deleted 111 "; 1160 VDU30:PRINT'SPC(39):
Y%=Y%—sp%:endy(L%)= 710 D$="" PRINTTAB(0,1);
endy(L%) —sp% 720 REPEAT 1170 D%= OPENOUT f$
320 IF INKEY( — 58) F%= —1: 730 FOR C%=0 TO100:NEXT:*FX15,1 1180 PRINT # D%,L%
Y%=Y%+sp%:endy(L%)= 740 K%= GET 1190 FOR U%=0 TO L%
endy(L%) +sp% 750 IF K%=13 GOTO 810 1200 PRINT # D%,begx(U%),begy
330 PROCdraw 760 IF K%<48 OR K%>57 AND (U%),endx(U%),endy(U%)
340 ENDPROC (K%< >127 OR LEN(D$) =0) 1210 NEXT
350 DEF PROCzoom(s%) VDU7:GOTO 730 1220 CLOSE # 0
360 IF L%=0 GOTO 660 770 IF K%=127 D$=LEFT$(D$, 1230 VDU30:PRINT'SPC(39)
370 IF s%=1 THEN zoom =1 /scale: LEN(D$)-1):GOTO 800 1240 VDU7
CLS:GOTO 540 780 IF LEN(D$) =3 VDU7:GOTO 730 1250 ENDPROC
380 IF s%=2 THEN zoom =1:GOTO 540 790 D$= D$+ CHR$(K%) 1260 MODE7
1270 *FX4,0 340 DI = ASC(MID$(SS$,I,1)) —48 750 IF K=0 OR LN — K< 0 THEN 830
1280 REPORT:PRINT"q at 350 IF DI= —2 THEN DI=10 760 LN=LN—K
1290 END 360 IF DI <0 OR DI>10 THEN 380 770 X= BX(LN):Y= BY(LN)
370 DRAW "C1;XNU$(8);C0;BL8"+ 780 PCLS
NU$(D1) + "BR2" 790 EX(LN) =X:EY(LN) =Y
380 NEXT I 800 IF LN=0 THEN 830
This program will RUN on the Tandy if you 390 RETURN 810 IF ABS(EX(LN —1)) <32767 AND
change the 223 in Line 10 to 247. 400 DATA R6D8L6U8BR8,BR6ND8BR2, ABS(EY(LN —1)) <24576 THEN
R6D4L6D4R6BR2BU8, X =0:Y = 0
10 PMODE4,1:COLOR 0,1:PCLS: R6D4NL3D4NL6BR2BU8,D4R6D4U8BR2, 820 LV=2:GOSUB 840
SCREEN1,0:V = 223 NR6D4R6D4L6BE8 830 SCREEN1,0:RETURN
20 DIM NU$(10):FOR 1=0 TO 10: 410 DATA D8R6U4L6U4BR8,R6ND8BR2, 840 IF LN=0 THEN RETURN
READ NU$(I):NEXT R6D8L6U8D4R6U4BR2,D4R6D4U8L6BR8, 850 IF LV=1 THEN ZOOM =1/SC:
30 DEF FNA(X)= (X/256)+128 BR3BD8NR1BR5BU8 PCLS:GOTO 920
40 DEF FNB(X)= (X/256) + 96 420 CLS 860 IF LV= 2 THEN ZOOM =1:GOTO 920
50 LN =0:SC=1:L=600 430 PRINT@256,"";:LINE INPUT "ENTER 870 CLS
60 X =0:Y = 0:ZOOM =1 LOAD FILENAME> q ";F$ 880 PRINT@256,"ENTER THE ZOOM
70 DIM BX(L),BY(L),EX(L),EY(L) 440 LN = 0:ZOOM =1:SC=1 SCALEq ";
80 BX(0)=X:BY(0)=Y 450 PCLS:SCREEN1,0 890 INPUT ZOOM
90 EX(0)=X:EY(0)=Y 460 OPEN "1",# —1,F$ 900 IF ZOOM = 0 THEN 1020
100 1$ =1NKEY$ 470 INPUT # —1,N$ 910 PCLS:SCREEN1,0
110 IF 1$="L" AND F AND L>LN THEN 480 LN=VAL(N$) 920 FOR U=0 TO LN-1
LINE(FNA(BX(LN)),FNB(BY(LN))) — (FNA 490 FOR U=0 TO LN-1 930 BX(U)=(BX(U)—X)*ZOOM:
(EX(LN)),FNB(EY(LN))), 500 INPUT # —1,BX$,BY$,EX$,EY$ BY(U)=(BY(U)—Y)*ZOOM
PSET:LN = LN +1:BX(LN)=X:BY(LN)=Y: 510 BX(U)=VAL(BX$):BY(U)=VAL(BY$): 940 EX(U) = (EX(U) —X)*ZOOM:
EX(LN) =X:EY(LN) =Y:F =0 EX(U)=VAL(EX$):EY(U)=VAL(EY$) EY(U)=(EY(U)—Y)*ZOOM
120 IF 1$ ="C" THEN X =0:Y =0: 520 IF ABS(BX(U)) < 32768 AND 950 IF ABS(BX(U)) <32768 AND ABS
EX(LN)=X:EY(LN)=Y ABS(BY(U)) <24576 AND (BY(U)) <24576 AND ABS(EX(U))
130 IF 1$ ="M" THEN BX(LN) = X: ABS(EX(U)) <32768 AND <32768 AND ABS(EY(U)) <24576 THEN
BY(LN)=Y ABS(EY(U)) <24576 THEN LINE LINE(FNA(BX(U)),
140 IF 1$ = "I" GOSUB 420 (FNA(BX(U)), FNB(BY(U)))— FNB(BY(U))) — (FNA(EX(U)),
150 IF I$="0" GOSUB 600 (FNA(EX(U)),FNB(EY(U))), FNB(EY(U))),PSET
160 IF 1$ ="D" GOSUB 710 PSET 960 NEXT
170 IF 1$ ="Z" THEN LV=0:GOSUB 840 530 NEXT 970 BX(U) = (BX(U) —X)*ZOOM:
180 IF PEEK(339) =191 THEN SP = 2048 540 INPUT # —1,BX$,BY$,EX$,EY$ BY(U) = (BY(U)—Y)*ZOOM
ELSE SP= 256 550 BX(U) = VAL(BX$):BY(U) =VAL 980 EX(U)=(EX(U)—X)*ZOOM:
190 IF PEEK(343) =V AND X> —32768+SP (BY$):EX(U) =VAL(EX$): EY(U) = (EY(U)—Y)*ZOOM
THEN F= —1:X=X—SP:EX(LN)= EY(U)=VAL(EY$) 990 X= EX(LN):Y= EY(LN)
EX(LN) — SP 560 X= EX(LN):Y= EY(LN) 1000 IF ABS(BX(LN)) > 32767 OR ABS
200 IF PEEK(344) =V AND X <32768 —SP 570(cid:127)CLOSE# —1 (BY(LN))> 24576 THEN BX(LN) =X:
THEN F= —1:X = X + SP:EX(LN) = 580 SCREEN1,0 BY(LN) = Y
EX(LN) + SP 590 RETURN 1010 SC =SC*ZOOM
210 IF PEEK(341)=V AND Y> —24576 500 CLS 1020 SCREEN1,0
+ SP THEN F= — 1:Y = Y — SP: 610 PRINT@256,"";:LINE INPUT "ENTER 1030 RETURN
EY(LN) = EY(LN) —SP SAVE FILENAME> q ";F$
220 IF PEEK(342) =V AND Y < 24576 —SP 620 LV =1:GOSUB 840 The Dragon program will work with a
THEN F= — 1:Y =Y + SP:EY(LN)= 630 OPEN "0",# —1,F$ Dragon Data disk drive if you make these
EY(LN) + SP 640 PRINT# —1,STR$(LN) changes:
230 GOSUB 250 550 FOR U=0 TO LN
240 GOTO 100 560 PRINT# —1,STR$(BX(U)), Delete Line 460 and add
250 SS$=STR$(SC) STR$(BY(U)),STR$(EX(U)),
260 DRAW "BM0,183":GOSUB 330 STR$(EY(U)) 470 FREAD F$,FROM0;N$
270 SS$=STR$(LN):DRAW "BM200, 570 NEXT 500 FREADF$;BX$,BY$,EX$,EY$
183":GOSUB 330 380 CLOSE# —1 540 FREADF$;BX$,BY$,EX$,EY$
280 BX=FNA(BX(LN)):BY= FNB(BY(LN)): 590 SCREEN1,0 570 CLOSE
EX= FNA(EX(LN)):EY= FNB(EY(LN)) 700 RETURN 630 CREATE F$
290 PSET(BX,BY):PSET(EX,EY) 710 CLS 640 FWRITEF$;STR$(LN)
300 FOR D =1 TO 50:NEXTD 720 PRINT@256,"HOW MANY LINES DO 660 FWRITEF$;STR$(BX(U)),":",
310 PRESET(BX,BY):PRESET(EX,EY) YOU WANT TOEI DELETE "; STR$(BY(U)),":",STR$(EX(U)),
q q
320 RETURN 730 INPUT K ":",STR$(EY(U))
330 FOR 1=1 TO LEN(SS$) 740 SCREEN1,0 680 CLOSE
One small step for INPUT ... You'll
need all your skill and judgement to
manoeuvre the Lunar Lander safely
to the landing pad, in this complete
arcade-type game
Games Programming need not involve huge 70 PLOT 0,0: FOR N=1 TO 16: READ GX,GY: 1037 IF LY <10 THEN RETURN
complicated programs to produce a self- DRAW GX,GY: NEXT N 1040 GOSUB 4000
contained game* Here is a version of the 80 DATA 18,30,18, —15,18,-8,18,8,16,20, 1050 RETURN
popular Lunar Lander program that offers 16,5,13, —20,16, —8,18, —4,15,0,10,10, 2000 LET YV =YV —.5: IF F<1 THEN
high resolution graphics and full control over 20,25,10, — 20,10, —10,20, — 5,18,20 RETURN
the craft* 90 PRINT AT 0,4; INK 6; PAPER 2010 IF 1NKEY$= "7" AND F>3 THEN LET
The game is complete and playable as it 2;" FUEL :";AT 0,18;" VELOCITY :" YV=YV+1: LET F= F-3: RETURN
stands, but there are many possibilities for 110 LET LX = RND*240+10: LET LY= 2020 IF INKEY$="5" THEN LET
you to customize it to suit your own pre- 160— (15+ (RND*10)): LET XV= RND.15: XV= XV —.5: LET F = F —1: RETURN
ferences* You may well want to add an LET YV = 0: LET F=246 2030 IF INKEY$="8" THEN LET
`another go?' routine to save having to RUN 115 GOSUB 4000 XV= XV +*5: LET F = F —1: RETURN
the program after each descent* You may wish 120 GOSUB 1000: GOSUB 2000: GOSUB 2040 RETURN
to alter the graphics and the sound too—it's 3000 3000 PRINT AT 0,10;" "+STR$ F+" ";AT
up to you* 130 IF LY>20 THEN GOTO 120 0,28;" "+STR$ INT YV+" "
135 PAUSE 50 3010 RETURN
CONTROLS
140 CLS IF LX<154 OR LX>164 OR ABS 4000 OVER 1: PLOT LX,LY: DRAW —5,-10:
:
Spectrum: the cursor ,keys-5, 7 and 8* YV>4 THEN GOTO 160 DRAW 5,2: DRAW 5,-2: DRAW —4,10
Commodore: the cursor keys for left and 150 PRINT "CONGRATULATIONS A 4010 OVER 0: RETURN
right, and the Commodore key for thrust. SUCCESSFULD 0 q CI LANDING !!"* 5000 DATA *2,4,.2,7,.2,5,.2,12,*2,0,*2,4,.2,4,
Acorn: Z for left, X for right and space for RESTORE 5000: FOR N=1 TO 14: READ
thrust. A,B: BEEP A,B: NEXT N: GOTO 170
1111
Dragon/Tandy: arrow control keys. 160 PRINT AT 10,7; FLASH 1; INK 2; PAPER
7;" !!!! CRASHED !!!! ": FOR T=1 TO 50: 10 HIRES 1,0:MULTI 7,4,4:COLOUR 7,0:
BORDER RND*7: BEEP .01,RND*5: NEXT T POKE 54296,15:POKE 54277,190:
10 B0RDER 1: INK 7: PAPER O. CLS BRIGHT 170 PAUSE 400 POKE 54278,248
1 180 STOP 15 POKE 54276,0
20 F0R N=1 T0 50: PL0T RND*255. 1000 IF LY <160 THEN GOSUB 4000 70 FOR Z=20 TO 160 STEP 20:Y=
(RND*135)+ 40 NEXT N 1010 LET LX= LX+ XV: LET LY= LY + YV: IF 179— RND(1)*40:LINE Z-20,179,
LY < 300 THEN BEEP .02,LY/5 Z-10,Y,3
1030 IF LX<5 THEN LET LX=LX+245 72 FOR ZZ = 1 TO 3:PLOT RND(1)*160,
1035 IF LX > 250 THEN LET LX= LX —242 RND(1)150,ZZ:NEXT ZZ
1036 IF LY >160 THEN RETURN 74 LINE Z-10,Y,Z,179,3:NEXT Z:
PAINT 0,199,1:TEXT 64,192,
ISI",2,1,8
76 LINE 0,199,159,199,2