Home
F-1 - Altervista
Contents
1. pm HH ar T 1 ii M Aii ee SS ee SS eee ee O eee 8 qe eS en e ER ee M m ce e 5 Re ee c rr lt ame eee e lt lt ee mo co lt a SS o gt a 0 e m cR 58 oe come c R Oo _ S SS a lt c Seti a m eee oo Cmm RET e cot I BASIC PROGRAMMING 1 2 7 oi P E p n x 3d gt The RND function IF THEN Variables INPUT MACHINE CODE 1 Some striking graphics to introduce you to machine code BASIC PROGRAMMING 2 The computer as a counting device and how it s used PERIPHERALS ihe ins and outs of storing and loading taped program
2. 70 PRINT 192 N PRINTG 224 N O00 lt PRINT 256 7 88 FOR X 1 TO 10 90 NEXT X 1 PRINT 1924 N L1L1D PRINTG 2244 N L IL ILL PRINTG 25643 N LILILI 110 NEXT 120 GOTO 20 There are three FOR NEXT loops in the pro gram The two loops using X both do exactly the same thing as in your first attempt at using them they slow the printing down by causing the computer to count to 10 each time The FOR NEXT loop using has a dif ferent function The loop actually makes the insect move across the screen one loca tion at a time For how a FOR NEXT loop works see BASIC programming 2 You may be puzzled that Line 20 reads FOR N 0 TO 28 when there are 32 spaces the top line numbered from 0 to 31 avail able in each line of the screen The reason for this is that the insect is four spaces long if you had any more than 28 the insect s antennae would appear at the opposite side of the screen one line down This is because of the way the screen locations are numbered Screen location 32 for example is the first location on the second row from the top of the screen Lines 60 and 100 appear to be PRINTing nothing at all Try deleting them and see what happens though These are un PRINTing lines as described earlier You can make up bugs and monsters on Acorn machines simply by using the ordi nary keyboard characters such as brackets dashes and letters
3. PRINT THE COMPUTER HAS CHOSEN A NUMBER BETWEEN AND 5 CAN YOU GUESS IT 40 INPUT G 60 IF G X THEN PRINT WELL DONE 88 IF G lt X THEN PRINT TOUGH LUCK YOU RE WRONG RUN this program and you will see that it is playable but only just To begin with the screen is a bit cluttered On top of that the game expires after just one go To deal with the first problem all you need do is enter EIS 10 CLS 50 CLS C ed 18 PRINT J 5 PRINT J This statement means clear screen so that only the new relevant information appears there To deal with the second problem is slightly harder One way round it would be to enter 90 GOTO 10 To re start the game automatically STRING VARIABLES A better way is to offer the player the chance of another game if he wants it This may sound complicated but in practice it is quite straightforward Start by typing in the complete pro gram On the ZX81 leave out OR AS y in Line 110 E 18 CLS 20 LET X INT RND 6 PRINT THE COMPUTER HAS CHOSEN NUMBER BETWEEN AND 5 CAN YOU GUESS IT 40 INPUT 5 CLS 68 IF G X THEN PRINT WELL DONE 70 IF G X THEN GOTO 9g PRINT TOUGH LUCK YOU RE WRONG 99 PRINT DO YOU WANT ANOTHER GO IF SO PLEASE TYPE Y AND PRESS THE ENTER KEY 100 INPUT AS 110 IF AS Y OR AS y THEN GOTO 1g 120 GOTO 199 LAT 18 CLS 20 LET
4. body of the insect appears to cross the screen Commodore BASIC has no PRINT AT statement so other methods have to be used to position characters In simple applications you can use the TAB function TAB is always followed by either a number enclosed within brackets such as TAB 15 which places the cursor at column 15 on the screen or by a vari able enclosed within brackets And TAB always forms part of the PRINT statement to which it applies In this case use a variable to make the TAB position move across the screen So use another FOR NEXT loop 1g FOR P TO 35 20 PRINT 2 TAB P PRINT TAB P 000 lt 40 PRINT TAB P 45 FOR I 1 TO 19g NEXT PRINT EX TAB P 70 PRINT TAB P 000 lt 80 PRINT TAB P 85 FOR I 1 TO 5g NEXT 90 NEXT P What you have done is to scrap the original GOTO statement in Line 90 It is now replaced by a loop which increases by 1 the value of the variable P each time the program repeats itself Since P 1s part of the TAB statement this moves the insect across the screen by one step for every cycle of the program When vou RUN the program vou can see the insect move across the screen and stop at the right To re start the action you need 100 GOTO 18 USING ROM GRAPHICS The Commodore has a wide range of on board graphics characters which can be used for creating rather more elaborate
5. Below is a small creepy crawlie made up this way which is very easy to animate To begin with try creating him in a static position J O 00 OOO 00 R 3 2 0 5 CLS 1 PRINT TAB 15 1 000 20 PRINT TAB 15 9 PRINT TAB 15 11 40 PRINT TAB 18 19 lt Note that when you type in this program you must not leave a space after TAB Now RUN the program This is a very simple picture and not terribly lifelike but it does illustrate one or two interesting points First it gives you an idea of the relative positions of the screen locations The middle of your insect is on Line 10 from the top and about halfway across the screen Second it shows the effect of telling the computer to print more than one character on a single location It simply carries on and prints the extra characters on the adjoining locations That is why the feelers in Line 40 are at 18 10 Locations 15 10 16 10 and 17 10 are already occupied by the insect s body GAMES PROGRAMMING 1 To animate the insect you must over print it with another slightly different one and then swap quickly between the two Add these lines to draw the second insect 5 PRINT 15 1 000 PRINT TAB 15 9 70 PRINT TAB 15 11 8 PRINT 18 1 lt Add one more line and you have anima tion 90 GOTO 10 When you run this
6. ANY NUMBER Learning to program a computer is a bit like learning to play football Theoretically you could learn football by practising one skill at a time stepping out onto the pitch for an actual game only when you have mastered every move But you would learn slowly and have very little fun in the process Similarly with programming One way is to plough your way through a manual which teaches one function at a time but never how to combine them A better way is to step out on the pitch and start playing So where do you begin GUESSING THE NUMBER The easiest of all home computer games to program is the one in which the computer invents a random number and the player tries to guess what it 15 Some computers use the keyword RANDOMIZE What exactly does this do The Spectrum uses the function RANDOMIZE 1 or any other number to make sure that a program repeats the same sequence of random numbers each time it is run This is useful if you are trying to debug a program as it is easier to find any mistakes if the program does the same thing each time The Acorn Commodore and Dragon computers use RND 1 for the same purpose Again any number will do but it must be negative The Spectrum can also use the function RANDOMIZE without a number or with a after it and this has quite the opposite effect It makes the random number sequence even more random THE RND FUN
7. KJ 20 LET N INT RND 1 25 4g FOR M N TO N 39 40 LET C INT RND 1 16 50 POKE 1924 M 162 60 POKE 55296 M C 70 NEXT 80 GOTO 20 GR g PROGRAMM NG Do keywords such as PRINT always have to be entered in capital letters Yes except on Commodore where you must use capitals if you are in upper case mode but small letters if you are in text mode Before you go any further here is a small experiment you should try on the Spec trum Acorn Dragon and Tandy only Delete Line 45 from the first of the two programs and RUN it again with this line substituted 55 NEXT m 55 NEXT column 99 NEXTM You have just discovered the final important fact about FOR NEXT loops when you have two such loops in the same program one must be nested completely inside the other or be completely separate If they overlap your program will not work On the Commodore the problem does not arise on this occasion But the prin ciple that one loop must be completely inside the other is the same 19 2 then repeats itself This is the BBC version SUNSET PATTERN This program uses a FOR NEXT loop to create a sunset pattern The first part of the program fixes a point in mid screen and draws from there to random points across the top of the screen The second part draws perspective lines at the bottom half of the screen starting from a series of
8. exacting demands more quickly than early problems of SAVEing and LOADing programs with a cassette recorder Almost everyone has tape problems The causes are not always easy to isolate even when you do know your way round a computer Nor is it possible to completely eliminate SAVE and LOAD errors by adopting apparently fail safe recording and back procedures But you can establish routines which will minimize the risks CORRECT SET UP Some computers use a purpose built tape recorder which makes a single direct con nection to the host machine and there should be no problem linking this up But most computers can be linked to any cas sette type tape recorder often using more than one type of lead combination Typically the lead consists of a DIN plug connected to three jack plugs but can be a DIN plug to a DIN plug with or without a jack plug If you buy a lead or make one up from existing audio leads you may have do ensure it is suitable LOADing difficulties will be evident right away if it is not CONTROL SETTINGS An early and important step which prevents a hit or miss approach to SAVE and LOAD routines is to establish exact set tings of the tone volume and feature con trols on the recorder you are using Some computer instructions provide precise directions on the best way of doing this advice which you should follow carefully Others leave it all up to you If you are using a specia
9. fixed points 5 BORDER g INK 6 CLS 1g FOR n 1 TO 80 20 PLOT 127 75 DRAW INT RND 25 125 INT RND 97 40 NEXT 45 INK 5 5g FOR n 75 TO STEP 15 60 PLOT 127 75 70 DRAW 127 n PLOT 127 75 DRAW 127 n 8 NEXT 1 FOR n 127 TO 127 STEP 2 PLOT 127 75 128 DRAW n 75 138 NEXT Ea MODE 15 GCOLG 2 20 FOR S 1 TO 8g LET 128 4g LET Y 5124 RND 512 58 MOVE 64 512 60 DRAW X Y 70 NEXT S 3 Sunrise by FOR 15 GCOLG 1 FOR L TO 1280 STEP 4g 90 MOVE L 512 100 DRAW L 512 4 0 NEXT L 20 PMODE 3 1 PCLS 40 COLOR 2 50 SCREEN 1 0 FOR N 1 8g NEXT loop out of Acorn 70 LINE 127 95 256 RND 256 96 RND 96 PSET 88 NEXT 90 COLOR 4 1 FOR 95 191 STEP 12 118 LINE 127 95 N PSET 128 LINE 127 95 255 N PSET 138 NEXT 140 FOR N TO 255 STEP 158 LINE 127 95 N 191 PSET 16g NEXT 178 GOTO 170 INSTANT EMBROIDERY Finally here is really spectacular program which works on four of our machines 10 FOR n TO 255 STEP 2 15 INK RND 8 20 PLOT 8 8 DRAW n 175 30 PLOT 255 8 DRAW 175 40 PLOT g 175 DRAW n 175 5 PLOT 255 175 DRAW n 175 60 NEXT 79 GOTO 10 FJ 8 MODE 2 FOR N 1279 STEP 10 15 GCOL B RND 7 20 MOVE 0 0 DRAW N 1923 MOVE 1279 0 DRAW 1
10. play mode until LOADing is complete Try alternative volume tone and feature control settings on your recorder if LOADing proves unsuc cessful e Move the recorder away from the TV monitor if a program won t LOAD but has LOADed successfully before Try another program recording to see if it works if it does the first tape may have been damaged in some way If volume settings need frequent adjusting from program to program mark the necessary volume settings on the label of the tape cassette Make a habit of rewinding tapes after they have been used This may prevent you later trying to LOAD from blank parts of the tape Start program searches at the beginning of a tape rather than put too much reliance on the tape counter Store your program tapes in a dry dust free place away from electrical appliances and heat e Make sure your new program LOAD doesnt conflict with something already in memory 23 E Although my friends with expensive cassette recorders make a great thing about cleaning their machines is it really necessary just for data recording Perhaps more so Regular maintenance of the tape recorder and its leads takes only a few minutes yet can save the frustration of poor SAVEs and LOADs Use a good quality cassette recorder cleaning kit to remove oxide deposits from the drive mechanism and head s of your recorder Be especially careful not to scratch the delicate
11. shapes and images To access the full range you have to be familiar with the computer s upper case and graphics mode obtained by sim ultaneously pressing the and SHIFT keys Now try keying in a few of the graphics The left hand symbol can be printed on the screen by simultaneously pressing and the chosen key letter The right hand symbol is obtained in the same way but by using the SHIFT and letter keys Other graphic symbols can be obtained by using RVS reverse enabled by sim ultaneously pressing CTRL and 9 and switched off by simultaneously pressing CTRL The helicopter graphic fig 3 uses un reversed symbols and gives some idea of ROM graphics Here is the program Shown below is a small creepy crawly which is easy to animate the Spectrum or ZX81 To begin with try creating him in a static position thus PRINT AT 10 15 000 20 PRINT AT 9 15 7 PRINT AT 11 15 40 PRINT AT 19 18 lt t rr Ne 2 3 757 gt y A 7 7 a Tu e wv gt 9 mt 5 PRINT U 7 10 PRINT EJ 15 PRINT O 3 20 PRINT O d 25 PRINTO 9 PRINTO 35 PRINTO BE ABPRINTC 45 PRINT CJ 50 PRINT O 55 PRINT O N 60 FOR D 1 TO 5 65 PRINT fq PRINT O 75 PRINT J PRINT O 85 PRINT C1 PRINT L TO O E 95 PRI
12. 0 0 70 0 1050 DATA 0 14 0 0 0 144 0 1 16 0 1 16 0 1 32 0 3 32 0 6 48 0 2 32 0 Tap the space bar to make the frog jump What s a sprite spriteis a kind of high resolution user defined graphic also referred to as a movable object block It is used as a kind of mobile component of high quality Commodore 64 graphics in preference to UDGs Unlike UDG a sprite offers smooth easily programmable pixel by pixel movement in any direction just as if it were a single character even though its size is 24 x 21 pixels compared to 8 x 8 for a standard character Normally up to eight sprites can be displayed together anywhere on the screen but the number can be increased by special programming A group of sprites can be arranged side by side or overlaid for 3D effects Sprites can be easily doubled in size set for collision detection adopt hi res or multicolour forms in short they are extremely versatile Programming for sprites actually proves simpler than that for UDGs if sophisticated animation sequences are required For example you don t have to follow the trail of a sprite with a blanking out routine to erase what s been printed in a previous position And sprites may be used with any of the other graphics modes Each one s characteristics can be changed at will THE ART OF THE conair ootan FOR NEXT LOOP on ms The FOR NEXT loop takes th
13. 10 23 Numbers painting by 18 P PMODE Dragon Tandy 12 POKE Commodore 64 15 Dragon Tandy 13 PRINT AT Dragon Tandy 26 27 Spectrum ZX81 8 9 31 32 PRINT TAB Acorn 11 28 Commodore 64 Vic 20 30 Program BASIC 8 BREAKing into 4 7 11 line numbers 7 punctuation of 4 slowing down 17 PSET Dragon Tandy 13 Punctuation in programming 4 25 Random numbers 2 7 ranges of 7 also see games guessing RND function RANDOMIZE tables multiplication RANDOMIZE 2 RND function 2 7 Acorn 2 3 4 5 Commodore 64 35 5 Dragon Tandy 2 3 46 7 Spectrum 7 81 23 8 6 4 ROM graphics Acorn 28 29 Commodore 64 Vic 20 31 Dragon Tandy 26 27 Spectrum ZX81 31 32 Running man building a Acorn 28 29 RVS Commodore 31 5 Satellite building a Dragon 26 27 SAVE command 22 25 setting controls 22 verifying 24 25 Shell firing a 10 15 Sprite definition and use of Commodore 64 14 15 STEP 17 21 STOP Spectrum ZX81 4 String variables see variables Symbols arithmetic 6 T Tables multiplication 5 7 Tank controlling and creating Acorn 11 12 Commodore 64 14 15 Dragon Tandy 13 14 Spectrum 10 Teletext graphics BBC 28 U UDG definition of 8 UDG grids Acorn 11 Dragon Tandy 13 Spectrum 8 9 V Variables names for 17 string 4 5 use of 3 VDU command use of Acorn 28 29 VERIFY command 24 The publishers accept no responsibility for unsolicited material sent for pu
14. 255 252 255 255 254 255 255 255 117 215 94 96 130 12 1958 DATA 38 182 96 If you now RUN the program you can see a tank sprite displayed on the screen You can use the Z and X keys to move it left or right and the P and L keys to move it up and down Press RUN STOP to terminate the program Notice how the tank sprite changes shape when the direction of move ment is altered ADDING SOME ACTION So far you have used only one of the avail able sprites and another sprite can be created to add some firepower to the tank This shell fires across the screen when you tap the space bar and is obtained by adding the following program lines FOR M 254 TO 255 FOR I 64 M TO 64 M 62 POKE 40 2 M 255 THEN M2 2 5 FOR I 64 M 18 64 M 36 STEP3 READA POKE M2 A NEXT NEXT 80 POKE 5 23 5 29 SC4 41 1 150 IF A lt gt CO THEN 180 160 RT PEEK 2943 253 X2 369 RT Y2 Y J X 24 RT 11 POKE 2042 254 178 POKE SC 21 12 GOSUB 26 260 FOR T J TO X2 4 STEP RT 2 1 20 270 JA INT T 256 JB T JA 256 280 POKE SC 16 4 1 AND JA 8 1 AND XA 290 POKE SC 4 JB POKE SC4 5 Y 300 FOR P 1 TO 3 NEXT NEXT RETURN 1500 DATA 4 9 2 176 2 9 4 1518 DATA 32 144 64 13 64 144 32 To SAVE the program for future use first type POKE 53269 0 which clears the screen of sprites and then use a normal BASIC pro gram SAVE If
15. 4 19g VDU 31 X Y DY 200 X CALL amp D 210 READ F DY 220 X X 3 238 VDU 31 X Y DY 240 X F CALL amp 250 AS INKEYS 5 268 NEXTT 218 RETURN 280 DATA 2 3 2 5 2 3 1 For disk drive change the 8000 in Lines 140 160 200 and 240 to amp A00 RUN the program The DATA statements repre sent the height of the frog above ground level 12 E To set up the graphics illustrated in figs 2 and 3 you will need to do three things First you must set up in the computer s memory a frame which defines the size of the graphic you want This frame is made up of user defimed graphics characters which on the Dragon are invisible at first Second you must enter the DATA which defines the shape of your tank or frog in the computer s memory though not yet on the screen Third you must enter another program which both prints the tank or frog and makes it move DRAGON UDG CHARACTERS A user defined graphics character or UDG for short is a box in which part of a picture can be located Within this box there is an 8 x 8 grid of 64 dots each of which in PMODE 4 1 can be either black or white PMODE 4 1 is a much more flexible mode than the others in which you have to define not just one pixel or dot at a time but two pixels or four Putting several UDGs together allows you to build up much more detailed larger shapes called frames Unlike some other computers the Drag
16. A PRINT AT B C RANDOMIZE USR P 22 PAUSE 2 CLS NEXTF 230 GOTO 190 1000 DATA 1 18 8 2 7 3 2 5 6 2 7 9 1 18 12 1 18 12 2 7 15 2 5 18 2 7 21 1 18 24 gt ie ene To set up the graphics illustrated in figs 2 and 3 you will need to do three things First you must set up in the computer s memory a frame or grid which defines the size of the graphic you want To begin with this frame will be reproduced as a series of user defined graphics characters see below Second you must enter a program which will allow you to move the frame around the screen If your graphic is to be part of a game in BASIC this movement routine will also normally be in BASIC Third you must replace the user defined graphics characters in the frame with the graphic you actually want tank frog or whatever ACORN UDG CHARACTERS On the Electron and BBC B a user defin able graphics character or UDG for short is a box in which you can produce a picture Each box contains 64 dots within an 8 x 8 grid Since they are all the same colour as the background the box is invisible to begin with But provided you stay within the box you can change the colours of some or all of the dots to form any shape you like The Acorn machines normally let you have 32 UDG characters As fig 2 shows you can put them next to each other on the screen to form larger shapes At any one time for example y
17. AT 9 15 AT 11 15 Add two more lines and you have anima tion 20 PRINT AT 10 15 000 lt AT 8 15 AT 11 15 38 GOTO 19 When you RUN this program you may find that it produces a blur the pictures are being swapped too rapidly The best way to slow them down is to use a FOR NEXT loop which makes the computer count up to 10 or whatever else you like before PRINTing the next picture So try adding these extra lines to your program On the ZX81 use 2 instead of 19 15 FOR L 1 TO 19 17 NEXT L 25 FOR M 1 TO 1g 27 NEXTM Of course you can vary the length of the pause simply by changing the 1 TO 19 to 1 TO 5 1 T0 20 or whatever else you need So far you have created a rather useless little insect whose legs flail about madly but who doesn t move That comes a little later see Movement Somewhat more interesting animation can be produced by using the standard Sinclair graphics characters One example is in fig 4 The full program is given below but if you are not used to the graphics symbols it will pay you to first create a static figure GAMES PROGRAMMING 1 one line at a time thus 1 PRINT AT 5 15 0 2 PRINT 6 15 and so on Getting these graphics characters is easy get those in Line 2 above for example press CAPS SHIFT on the ZX81 and 9 simultaneously This puts you in graphics mode indicate
18. Commodore 64 Future articles will show how you can apply these techniques to the ZX81 and Vic 20 To set up the graphics illustrated in figs 2 and 3 you will need to do three things First you must set up in the computer s memory a frame or grid which defines the size of the graphic you want At first this frame will be reproduced as a series of user defined graphics characters see below Second you must enter a program which will allow you to move the frame around the screen Third you must remove the user defined graphics characters in the frame and replace them with the graphic you actually want tank frog or whatever SPECTRUM UDG CHARACTERS On the Spectrum a user definable graphics character or UDG character for short is a letter such as A which you can mould into something else Shee E Pema fig 1 Each letter consists of 64 dots some one colour some another within an 8 x 8 grid as in fig 1 Provided you stay within the grid you can write a program which changes each letter into any shape you like The Spectrum gives you 21 such letters A to U inclusive As fig 2 shows you can put these tiny grids together on the screen to form larger frames At any one time for example you can have two 3 x 3 frames with three UDG characters left over or five 2 x 2 frames SETTING UP THE GRID Both the frog and the tank illustrated in this article need a 3x 3 frame of UDG charact
19. X RND 6 1 PRINT THE COMPUTER HAS CHOSEN A NUMBER BETWEEN AND 5 CAN YOU GUESS IT 40 INPUT 5B CLS 68 IF G X THEN PRINT WELL DONE ELSE PRINT TOUGH LUCK YOU RE WRONG 9g PRINT DO YOU WANT ANOTHER G0 IF SQ PLEASE TYPE Y AND PRESS THE ENTER KEY 100 INPUT AS 119 IF AS Y THEN GOTO 10 120 GOTO 100 Ea 1 CLS 20 LET X RND 6 1 PRINT THE COMPUTER HAS CHOSEN NUMBER BETWEEN AND 5 CAN YOU GUESS IT 40 INPUT G 5 CLS IF G X THEN PRINT WELL DONE ELSE PRINT TOUGH LUCK YOU RE WRONG 99 PRINT DO YOU WANT ANOTHER GO IF SO PLEASE TYPE Y AND PRESS THE RETURN KEY 128 INPUT AS 11g IF AS Y THEN GOTO 1 128 GOTO 100 Cc 1g PRINT C7 20 LET X INT RND 1 6 PRINT THE COMPUTER HAS CHOSEN NUMBER BETWEEN AND 5 CAN YOU GUESS IT 40 INPUT 5 PRINT J 6 IF G X THEN PRINT WELL DONE GOTO PRINT TOUGH LUCK YOU RE WRONG PRINT DO YOU WANT ANOTHER GO IF SO PLEASE TYPE Y AND PRESS THE RETURN KEY 19g INPUT AS 110 IF AS Y THEN GOTO 10 128 GOTO 100 As you can see first you ask the player in Line 90 if he wants another game Then to warn the computer to expect an answer you use in Line 100 the INPUT statement This time however there is an important difference After Line 20 the player entered a number This time he is going to enter Y for ye
20. by the computer press stop when prompted to do so The program you LOAD will replace whatever is already in your computer s available RAM memory so if you have an important program in there make sure you have SAVEd it beforehand Wind the four line test program back to its start and try to LOAD it using the chosen file name If you have problems refer to the troubleshooting guide here Other forms of LOAD command are needed for accessing machine code data for program relocation and for merging one program with another Your first encounter with these may be as part of the Sy 3 5 PIN DIN PLUG LOADing instructions for games you have bought Many of these will also use small loader programs which initiate LOADing of the much larger programs which follow To get these programs going simply follow the command and file name requirements listed on the cassette Can I use old music cassettes for recording program data Although it is best to use good quality data tapes perfectly acceptable results are possible using top quality audio cassettes If by old music cassettes you mean tapes which have lain around on a parcel shelf of a car or in some equally unsatisfactory storage location you are asking for trouble Tapes which have shed minute fragments of their coating or bind slightly may make no appreciable difference if you are playing music but can wreak havoc on data SAVEin
21. file name Is restricted to ten characters or less only a few permit anything longer You can call your program anything you like within the allowable line length and short abbreviations are just as good as long winded descriptions But everything that forms part of the file or program name must be enclosed wholly by quote marks before it can be recognised as such by the computer SAVE PROGNAME 1 SAVE 1 Both these are valid SAVE commands but note the use of both capitals and lower case letters in the second example If you mix capitals and lower case in this way on a program name you must repeat the name exactly when you ask the computer to LOAD the program GETTING THE RIGHT SET UP CONTROL SETTINGS THE SAVE COMMAND VERIFYING YOUR SAVES THE LOAD COMMAND Use a simple reliable mono port able recorder and if you can reserve this for exclusive use with the com puter Always use mains power to ensure constant motor speeds Avoid using sophisticated stereo recorders unless its facilities can be switched out and mono playback is possible Use good quality audio or data tape if you find a brand which is reliable stick to it A popular or much worked on program will be LOADed many times and poor quality tapes will not put up with this treatment Watch the screen for specific instructions you must leave the recorder in
22. head Avoid re using bud type wipes though these may be used with caution when new to remove stubborn build ups which cannot be handled by a play or two of the cleaning tape If you use cleaning solution make sure it has an alcohol not solvent base If you want visual spacing consider using punctuation marks other than full quotes instead SAVE PROG NAME SAVE PROG NAME SAVE PROG NAME If your computer is linked to a remote con trol facility on the recorder set the controls 7 PIN DIN PLUG to record Enter your selected program name after your computer s tape SAVE command and then hit The computer should then take control of the recorder motor until the SAVE routine is completed If control is left to you enter the SAVE command put the recorder into record mode and then press or RETURN Wait until the ready prompt shows on the screen display If you are storing a particularly important program repeat the SAVE rou tine for at least one backup copy but first make sure there is room on the tape to do this Better still record the backup copy on a quite separate tape The time taken for the program to load depends on two factors its size in terms of memory usage and the speed of data flow between the computer and recorder which is fixed on some machines and selectable on others The most reliable recordings are made at the slowest rates and many co
23. of a picture which you project onto a given area of the screen will stay there One way of getting rid of the unwanted segment is simply to print something over it The computer cannot put two images on the same screen location at the same time So if for example Line 10 tells the com puter to print an at a particular location any later line which prints say B at the same location will dispose of the A as well The programs below include several examples of this kind of substitution But what if you have nothing that you want to print over the unwanted character Then you must remember to include in a later line an instruction to print a space LJ at the relevant screen location Forget this detail and your screen can easily be cluttered with unwanted bits of arms legs and bodies There are big differences between one computer and another in the way you get graphics characters on the screen The standard or ROM graphics characters vary So does the way you PRINT them on the screen And so does the way you make them move LAT A simple animation you can try on the Dragon and Tandy is the small creepy crawly below To create him program the machine as follows w C v 223 Der lt DE C v C nu D wv 1g PRINT 238 000 20 PRINT 206 PRINT 241 lt 40 PRINT 27 RUNning this
24. 0 A INKEY 19 80 PRINT TAB X 19 L1000 lt PRINT TAB X 9 0 188 PRINT 11 J A INKEY 18 120 NEXT X C The Commodore version of the creepy crawlie uses exactly the same typewriter symbols as do other machines but the method of creating him on the screen is dif ferent Try keying in this program 10 PRINT I 20 PRINT PRINT 000 lt PRINT 50 PRINT EJ 60 PRINT 70 PRINT 000 lt PRINT 99 GOTO10 When you RUN the program you will see a rapidly alternating picture It is created by the separate sets of symbols in the PRINT statements overlaying each other At the same time the GOTO statement in the last line creates a continuous loop it tells the computer to go back to the start Without Lines 10 and 50 the program could not RUN properly Both use the special characters available in the quote mode of CBM machines which allow you 2 to incorporate cursor movements and other controls within an otherwise standard PRINT statement How do work The HOME symbol S gt 1n Lar e 50 returns the cursor to e HC E of the ME sition at the Position s mean 1 this b S The CLEAR HOME symbol reverse heart in Line 10 does something more Having returned the cursor to the top left position it also clears the scr
25. 1 on the Spectrum ZX81 and Com modore is necessary because their random numbers start at 0 a number not wanted for this job In Line 20 you ask the player to multiply BASIGPROGRAMMING by 9 whichever number the computer has chosen this time Line 40 warns the com puter to multiply the random number by 9 compare this with the player s answer and if the latter is correct print CORRECT RUN this program and you will find that it works once You could make it con tinuous by adding 50 GOTO 19 but why not do the job properly as here 1 PRINT HELLO WHAT IS YOUR NAME 20 INPUT AS 30 CLS PRINT HELLO CT AS 1 HAVE SOME QUESTIONS FOR YOU 50 PAUSE 2 60 CLS 70 LET N INT RND 12 1 80 PRINT WHAT ISL N 9 90 INPUT A 100 IF A N 9 THEN GOTO 150 110 CLS 128 PRINT L 1 138 PRINT SORRY PLEASE TRY AGAIN 148 GOTO 80 159 PRINT WELL DONE 7 A HERE IS THE NEXT ONE 168 PAUSE 150 178 GOTO 6g PAT 1 PRINT HELLO WHAT IS YOUR NAME 20 INPUT A 30 CLS PRINT HELLO C1 AS PRINT I HAVE SOME QUESTIONS FOR YOU 5B FOR X 1 TO 6 X 60 CLS 70 LET N RND 12 PRINT WHAT 1507 8 9 90 INPUT A 100 IF A N 9 THEN GOTO 150 11g CLS 128 PRINT A 130 PRINT SORRY PLEASE TRY AGAIN 148 GOTO 80 158 PRINT WELL DONE C1 AS PRINT HERE IS THE NE
26. 14 27 Commodore 4 18 21 30 Spectrum 10 Dragon Tandy 4 18 21 26 CLOAD Dragon Tandy 14 Spectrum ZX81 4 18 21 31 CLS explanation of 27 Graphics CODE Spectrum 8 low resolution 26 32 Cursor definition of 3 also see animation movement ROM graphics D teletext UDG DATA statements Grid of UDG Acorn 11 see UDG Commodore 64 Vic 20 14 Gunshell firing a Dragon Tandy 13 Acorn 12 Spectrum 8 9 Commodore 64 15 Delaying action 17 Dragon Tandy 14 DIN plug 22 Spectrum 10 E H ESCAPE Acorn 4 Helicopter building a F Commodore 64 31 FOR NEXT loop 16 21 definition of 16 IF THEN 3 delaying action 17 IF THEN ELSE fractions program 17 Acorn Dragon Tandy 3 graphics 18 21 INKEY in games Acorn 28 29 Acorn 12 INPUT statement 3 4 5 Commodore 64 14 INT 2 3 Dragon Tandy 13 Spectrum 8 9 K music 18 Keywords spelling of 19 painting by numbers 18 patterns 20 21 L nested loops 19 Line numbers in programs 7 used in programs 16 21 LIST function 4 using variations 19 LOAD Frog controlling and command 22 25 creating a success at 23 Acorn 12 LOOP FOR NEXT Commodore 64 15 see FOR NEXT loop Low resolution graphics see graphics M Machine Code programming speeding up games routines 8 15 MODE Acorn 28 Movement Acorn 28 29 Commodore 64 Vic 20 30 31 Dragon Tandy 26 27 Spectrum ZX81 31 32 N Nested loop definition and use of 19 NEW Acorn 11 23 Commodore 64 Vic 20 15 23 Dragon Tandy 13 23 Spectrum 7 81
27. 168 70 VDU 31 X Y4 3 146 160 224 165 234 176 88 VDU 31 X Y4 4 146 168 177 160 160 160 90 VDU 31 X Y 146 169 168 252 160 160 188 VDU 31 X Y 1 146 232 236 189 174 160 119 VDU 31 2 146 162 238 177 160 160 128 VDU 31 3 146 240 250 162 180 160 138 VDU 31 X Y4 4 146 161 16 160 245 160 14g GOTO 4g 2 The running man two views The first line puts the computer into Mode 7 the Teletext mode Line 20 sets the man s position on the screen Lines 40 to 80 define the man in the first position while Lines 90 to 130 define him in the second position Again you may need to use INKEY after Lines 80 and 130 GAMES PROGRAMMING 1 The VDU command controls the screen so that VDU 31 X Y means PRINT TAB X Y The next number produces coloured gra phics 145 to 151 making all the different colours In this case 146 draws the man in green The other numbers 160 and over are the ones that control the shape Making the man move across the screen is also quite easy All you do is start him in position X at the left of the screen and move him one position at a time to the other side The computer does this by using a FOR NEXT loop So you will need to type in two new lines FOR TO 35 14g NEXT X This prints the man at each position from column to column 35 You may wonder why X only goes up to 35 when there are 40 columns on the screen from TO 39 The reason is that the man is fi
28. 221 119 14 221 229 62 2 2 5 16 DATA 1 22 2 9 1 18 2 5 6 32 201 9913 This routine you may feel is a very long winded way of entering the equivalent of three PRINT AT statements True but it has two big advantages 1 Once you have typed it once you can SAVE it and use it over and over again 2 In use this routine will make the whole frame or the graphic you replace it with move about the screen much much faster than the equivalent BASIC Without knowing machine code you cannot of course understand each of the es above DATA numbers But in summary Lines 10 and 20 work out where the pro gram will be stored If you have a 16K machine the program is stored in a different part of the machine from where it would be in a 48K machine Note that on some 48K machines which have been up graded from 16K this may not work If you have a problem with a 48K machine omit Line 10 and substitute Line 20 with 20 CLEAR 65199
29. 232 19 DATA 134 3 183 125 111 48 137 0 253 122 125 112 38 218 57 Now you can SAVE the routine for immedi ate or future use The computer will prompt you to do this so have your tape recorder handy As well as producing faster graphics than the equivalent BASIC program could this machine code routine is shorter and so takes up less memory space Until you understand 6809 machine code you cannot know what each number in the DATA means The overall picture however is that Line 10 sets aside some memory for the routine at the same time protecting it from corruption by any BASIC that you enter later Lines 90 to 120 SAVE the machine code from memory onto tape BUILDING THE TANK To build the tank you need to use two frames one for the left pointing tank and one for the right pointing version Type NEW to get rid of the old BASIC program but not the machine code and then enter the following lines 10 CLEAR 299 3200 20 FOR 1 3239 0 32443 READ N 40 POKE I N 5 NEXT 60 DATA 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 c c c 19 DATA 0 3 7 127 127 7 0 0 0 128 252 255 255 255 0 80 DATA g 0 0 0 255 0 128 0 255 255 255 117 96 38 9 DATA 255 255 255 215 138 182 0 0 252 254 255 94 12 96 0 0 109 DATA 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 8 118 DATA 8 8 0 0 255 0 1 0 0 0 1 63 255 255 255 128 DATA 0 0192 224 254 254 224 0 63 127 255 122 48 6
30. 27 255 122 48 6 0 0 255 255 255 235 65 182 0 0 1040 DATA 255 255 255 174 6 100 0 0 1950 DATA 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1960 DATA 0 0 0 0 0 0 0 0 0 0 3 7 127 127 7 0 1070 DATA 128 252 255 255 255 255 128 1 8 DATA 255 255 255 117 96 38 0 0 255 255 255 215 13 1 2 1 9 DATA 252 254 255 94 12 96 9 Two more UDG characters will arm the tank First press BREAK then type 10 FOR N USR a TO USR t 7 READ A POKE N A NEXT N 115 IF INKEYS L 07 THEN GOTO 200 200 IF Z 2 THEN GOTO 300 210 FOR N X 1 STEP 1 229 PRINT INK 5 AT Y 1 N CHRS 162 230 PAUSE 1 249 PRINT AT Y 1 N C1 250 NEXT 260 GO TO 110 38g FOR N X 3 31 310 PRINT INK 5 AT Y 1 N CHRS 163 vuv 2 How the tank is assembled 320 PAUSE 1 330 PRINT AT Y 1 N L 1 340 NEXT 350 GO TO 118 1100 DATA 8 4 9 2 176 2 9 4 0 32 144 64 13 64 144 32 RUN this program and you can use the key to fire a shell CREATING THE FROG To turn your existing frames into the frog you will of course first have to get rid of the tank So first type NEW then ENTER What this does is to clear away both the tank and the program with which you controlled it The machine code program which set up the frames however will still be in the Spectrum s memory unless you have pulled the power plug If you have disconnected the power first type CLEAR 32399 on
31. 279 N 1923 40 MOVE 9 1223 DRAW 5 MOVE 1279 1023 DRAW 1279 N 70 GOTO 10 3 PMODE 3 1 6 PCLS 9 SCREEN1 0 10 FOR L TO 255 STEP 2 15 COLOR RND 4 20 LINE 8 8 L 191 PSET LINE 255 0 255 1 191 40 LINE g 191 L PSET 50 LINE 255 191 255 L PSET 5 Spectrum s version stronger less delicate Go ows a NEXT L 79 GOTO 10 Each of the four segments of this pattern begins with a dot in one corner of the screen What the FOR NEXT loop is doing is to count across the opposite side of the screen while a pattern of lines is drawn between the pairs of points thus created Exactly how the graphics work is in a later chapter But try deleting Lines 30 and 40 and you will get the general idea You can experiment too by deleting some of the drawing lines by varying the colours by lengthening the STEPs in Line 10 and by excluding the GOTO line at the end In minutes you can create hundreds of different patterns instant embroidery in fact In doing this you are not just creating pretty pictures on the screen You are also helping to familiarize yourself with one of the most useful tools available to the programmer but producing a constantly changing pattern 22 UNTANGLING YOUR SAVES AND LOADS Few things bring a newcomer down to the harsh reality of computers
32. 34 9 0 0 0 0 0 9 0 320 VDU 23 235 0 0 0 0 0 0 0 0 23 236 9 0 3 7 127 127 7 0 330 VDU 23 237 8 8 128 252 255 255 255 0 23 238 0 0 0 0 255 0 128 0 340 VDU 23 239 255 255 255 117 96 38 9 0 23 249 255 255 255 215 138 102 0 0 350 VDU 23 241 252 254 255 94 12 96 0 0 380 RETURN When you run this program you will notice that the tank leaves a trail behind it Type this line in to get rid of it 11g VDU 31 X Y X CALL amp D 8000 For disk drive replace the with This line produces a 3x3 frame of space which rubs out what is on the screen at the X Y position After seeing the tank you may want to create other graphics This is quite easy as long as you stay within the 3x3 frame In the meantime you have used only 18 of the 32 available UDGs You can make the tank fire a shell by defining two of the other UDGs as shells one for firing left and the other for firing right You need a few lines to control the shell So add these lines to your exisung program 100 IF AS C THEN GOTO 150 150 IF Z 2 THEN GOTO 210 160 FOR T X 1 TO STEP 1 170 VDU 31 7 Y 1 242 8 180 AS INKEY 5 VDU32 190 NEXT T 200 GOTO 50 210 FOR T X 3 TO 39 220 VDU 31 7 Y 1 243 8 230 AS INKEYS 5 VDU 32 240 NEXT T 259 GOTO 50 360 VDU 23 242 0 4 9 2 176 2 9 4 370 VDU 23 243 0 32 144 64 13 64 144 32 As Line 100 indicates the space bar is your firing mechanism CREATING THE FROG Creating
33. 5 counts off the lines of the screen from top to bottom Line 25 selects squares randomly across the width of each screen line in turn while Line 20 chooses random colours to print in each square VARIATIONS ON A THEME Trying variations on this theme will help make you familiar with both the FOR NEXT Statement and the RND function Here are two for each machine Don t forget the NEW between them 10 FOR n TO 21 20 FOR 0 TO 31 30 INK RND 7 1 4g PRINT AT n m MI 45 NEXT m 50 NEXT n 60 GOTO 10 10 LET n RND 21 20 FOR m 0 TO 31 30 INK RND 7 1 40 PRINT AT n m II 45 NEXT m 68 GOTO 19 FJ 8 MODE 2 9 VDU 23 82 2 1 FOR row TO 20 FOR column TO 19 COLOUR 128 RND 7 40 PRINT TAB column row Ul 45 NEXT column 5 NEXT row 68 GOTO 10 8 MODE 2 9 VDU 23 82 2 10 LET row RND 31 1 1 First the patchwork builds up on the screen BASIC 20 FOR column TO 19 COLOUR 1284 RND 7 40 PRINT TAB column row O 5 NEXT column 68 GOTO 10 8 CLS FOR N 1 TO 60 20 FOR M g TO 31 38 LET C RND 9 1 SET N M C 45 NEXT M 5 NEXT 60 GOTO 1g 8 CLSA 10 LET N RND 69 20 FOR TO 31 LET C RND 9 1 SET N M C 45 NEXT M 60 GOTO 10 C 1g PRINT 20 FOR TO 999 LET C INT RND 1 16 40 POKE 1724 M 160 POKE 55296 M C 60 NEXT M 70 GOTO 20 10 PRINT
34. CHRS 129 CHRS 129 CHRS 129 CHRS 129 CHRS 129 CHRS 141 50 PRINT 268 CHRS 135 CHR 132 CHRS 132 CHRS 132 CHRS 132 CHRS 133 CHRS 135 60 PRINT 300 CHRS 143 PRINT 303 CHRS 133 PRINT 305 CHRS 143 2 CHR 143 70 FOR X 1 TO 10 80 NEXT X PRINT 173 CHRS 141 PRINT 177 CHRS 141 100 PRINT 205 CHRS 139 CHRS 140 CHRS 14 CHRS 137 110 PRINT 236 CHRS 138 CHRS 132 CHRS 13g CHRS 13g CHRS 139 2 CHRS 13g CHRS 143 120 PRINT 268 CHRS 139 CHRS 136 CHRS 136 CHRS 136 CHRS 136 CHRS 137 CHRS 143 130 PRINT 300 CHRS 137 PRINT 303 CHRS 143 PRINT 395 CHRS 139 CHRS 141 14g FOR X 1 TO 1g 150 NEXT X 160 GOTO 10 Do not worry about Line 10 in the pro gram CLEAR 500 simply makes enough memory space available for the strings created by using CHRS codes and CLS gives you a clear screen for your animation Look up the graphics characters repre sented by the codes after CHRS in the pro gram And by referring to fig 1 try to see how the spaceship is constructed The pro gram instruction CHRS means PRINT CHRS on the next screen location Here at last is a program which not only animates the insect but also moves it across the screen 1g CLS 20 FOR N TO 28 PRINT 192 N PRINT 224 4N 000 PRINTG 256 N 4g FOR X 1 TO 1g 50 NEXT X PRINT 1924 N L1L1L1 PRINT 2244 N LILILIL PRINT og
35. CS FRAME GETTING FASTER MOVEMENT A FROG THAT JUMPS AND A TANK THAT FIRES Note that print in lower case letters has to be typed in letter by letter and is not the same as PRINT on the P key This BASIC program lets you move the frame around the screen using P up Z left L down X right When you RUN the program you will see that you have created not one 3 x 3 frame but two the second one consisting of the letters JKLMNOPOR This is to allow you to have two versions of your final graphic one facing left as it moves left and one facing right as it moves right You will also notice something else as the frames move they leave behind a trail of unwanted characters You do not need to use up any of your UDG characters to get rid of this clutter All you need is 160 PRINT AT Y X POKE B 0 RANDOMIZE USR print This produces 3x3 frame of spaces which rub out whatever is on the screen at the Y X position did 8 ye O CREATING THE TANK To turn your existing frames into a tank type in these few lines of statements plus DATA They define a tank pointing to the left in frame 1 and to the right in frame 2 FOR N USR TO USR r 7 READ A POKE NEXT N 1 DATA 1 1 DATA 8 0 0 0 0 0 0 0 0 0 0 0 255 0 1 0 1020 DATA 0 0 1 63 255 255 255 0 0 0 192 224 254 254 224 9 1030 DATA 63 1
36. CTION All home computers have a random number generator to allow you to invent such games This 1s operated in BASIC by the function RND On some computers the numbers it pro duces however are not much use in their original form they are all decimalized fractions between 0 and 099999999 To demonstrate this type in this program first entering NEW to clear out any existing program UT 10 LET X RND 10 LET X RND 2 PRINT X 20 PRINT X GOTO 19 GOTO 18 Dice throwing quizzes and many other computer games use random numbers to create a seemingly irregular sequence of events Here we show you how 10 LET X RND 1 20 PRINT X GOTO 19 Remember to tap ENTER or RETURN whichever your computer has after each line of program When you RUN this program all you will get will be a string of long decimalized fractions far too hard for a guessing game for why this is see the chart on page 7 So how can you get the computer to pro duce only whole numbers By putting INT short for integer or whole number in front of the RND thus 18 LET X INT C 10 LET X INT RND 1 6 This generates a whole number between 0 and 5 On other computers you do not have to use INT To generate whole numbers be tween 0 and 5 for example you just type FJ 18 LET X RND 6 1 2 PRINT X GOTO 19 Remember to tap or RETURN after BASIGPROG
37. DATA 255 255 255 235 65 1 2 255 255 255 174 6 This defines the tank in the computer s memory but still does not print it on the screen So the final stage is PRINTING AND MOVING THE TANK This BASIC program both PRINTs the tank and allows you to move it around the screen Before entering it do NOT type NEW this would destroy the DATA you have just typed in so carefully On the Tandy use 251 instead of 239 in Line 380 253 instead of 247 in 3 90 247 instead of 223 in 400 and 410 5 PCLEAR 5 17 PMODE 4 1 180 PCLS 290 PCLS 3030 SCREEN 1 1 310 T 1 320 5 330 POKE 32700 INT TP 256 340 POKE 32701 TP 256 INT TP 256 350 POKE 32259 T 360 EXEC 32000 378 LP TP 38g IF PEEK 338 239 THEN TP TP 32 GOTO 440 39g IF PEEK 342 247 THEN TP TP 32 60 044 400 IF PEEK 340 223 THEN 1 2 60 0 449 410 IF PEEK 338 223 THEN 1 T 1 GOTO 44g 430 GOTO 38g 44g IF TP 1536 OR TP 6941 THEN TP LP 478 GOTO 339 Now you can RUN the program and move the tank around the screen using P up left L down and X right You will notice that the tank leaves a trail behind it To get rid of it type in these lines 450 POKE 32250 0 460 EXEC 32000 This uses special feature of the machine code routine that prints a frame of blanks uy FIRING A SHELL To make things more interesti
38. E WRONG 20 LET X RND 6 1 PRINT THE COMPUTER HAS CHOSEN NUMBER BETWEEN AND 5 CAN YOU GUESS IT 4g INPUT IF G X THEN PRINT WELL DONE ELSE PRINT TOUGH LUCK YOU RE WRONG Ea 20 LET X RND 6 1 PRINT THE COMPUTER HAS CHOSEN A NUMBER BETWEEN AND 5 CAN YOU GUESS IT 40 INPUT G IF G X THEN PRINT WELL DONE ELSE PRINT TOUGH LUCK YOU RE WRONG Finding your way out Beginners sometimes find it difficult to interrupt a RUNning program and get back to the program listing perhaps because it needs amendment This usually happens when the computer is expecting a series of INPUTs Whatever you type it seems simply fills the screen with rubbish First press CAPS SHIFT and to BREAK If this doesn t work you could be in INPUT mode If this is the case use the cursor controls and DELETE to remove any quotation marks Then use STOP shifted A then ENTER This gives you report H stop in INPUT Now press ENTER again to list the program Try pressing RUN STOP then type LIST If this does not work hold down RUN STOP while you press RESTORE Then type LIST E Push ESCAPE then type LIST If this does not work press the BREAK key and then type 010 then LIST c m Press BREAK then type LIST If this does not work push the button located on the left side of the machine Then type LIST Cc 20 LET X INT RND 1 6
39. FOR row and FOR column than say FOR x and FOR y Some computers recognise only one or two letter variables discarding any other letters In this case try using suitable initials T for time SC for score HS for high score H for hits and so on This makes them very easy to pick up PEEL APPEAL Games programmers often make such pauses less boring by inserting a few notes of a tune into them Try this for example 18 FOR n 29 TO 10 STEP 1 20 BEEP 015 n NEXT n FJ 1g FOR N 160 TO 100 STEP 4 20 SOUND 1 15 1 NEXT N 10 FOR N 12 1 STEP 1 20 PLAY 40 04 STRS 30 This 15 the noise that programmers some times use to say You ve failed or The alien has landed It illustrates one point to remember when you are counting downw ards from a given starting point your STEPs must be 1 or whatever not just 1 The Commodore 64 does not have a simple sound command You would have to write a separate sound generating routine between Lines 10 and 30 branched to by a GOSUB in Line 20 Use the right loop There are many occasions for using a FOR NEXT loop and just as many occasions when you shouldn t The rule is When you want a program sequence performed a fixed number of times without breaking into it at any stage use a FOR NEXT loop When you want a program sequence execute
40. ING UP 100 COMPUTER THE FOR NEXT LOOP AS A DELAYING DEVICE CREATING SOUND EFFECTS How does it do this When the computer encounters FOR it knows that the fol lowing lines of the program are going to be repeated So it executes carries out all the following lines until it reaches NEXT Then it loops back to the line with FOR in it and repeats the process line by line While the computer is doing this it is also counting The first time it reaches Line 20 it calculates the square root of 1 the second time around it calculates the square root of 2 and so on Once it has dealt with the highest number in the F R statement the com puter automatically quits the loop and goes on to the next line of the program in this case Line 40 FRACTIONS TOO In carrying out a FOR NEXT instruction the computer can count in units other than 1 Try this for example n 1 TO STEP 2 7 20 PRINT n SOR n NEXT n 1g FOR N 1 TO 30 STEP 2 7 29 PRINT N LJ SOR N NEXT C C nu FOR N 1 TO 3g STEP 2 7 20 PRINT SOR N NEXT The computer you ll notice is not at all deterred by the fact that 30 will not divide evenly in the STEPs you have asked for It just goes as near as it can then stops Nor is it bothered by the number of lines between the FOR part of the loop and the NEXT part You can write for FOR int
41. LEAR 29 3200 20 FOR 1 32300 TO 32443 READ 40 POKE N NEXT 60 DATA 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 79 DATA 8 8 6 0 0 0 1 1 0 0 0 0 8 128 192 176 88 DATA 0 8 0 0 0 0 0 0 4 15 31 63 127 254 248 127 90 DATA 96 249 224 192 64 32 156 192 9 0 0 0 0 0 0 0 3 The frog graphics The large squares are 8 pixels by 8 100 DATA 8 0 0 0 0 0 0 0 0 0 0 0 0 1 3 7 8 28 27 78 255 254 252 249 T1g DATA 0 0 0 0 0 0 0 0 7 7 15 30 62 54 70 70 120 DATA 250 196 0 0 0 0 0 0 0 0 1 1 3 130 DATA 14 144 16 32 32 48 32 0 CONTROLLING THE FROG To make the frog jump type NEW then enter the following On the Tandy use 247 instead of 223 in Line 100 PCLEAR 5 20 PMODE 4 1 PCLS 40 SCREEN 1 1 5 FP 4487 POKE 327 17 19 POKE 327 1 135 80 POKE 32259 1 9 EXEC 32000 100 IF PEEK 345 lt gt 223 THEN 190 11 RESTORE 128 FOR I 1 0 5 READ F FD 148 POKE 3279 INT FP 256 150 POKE 3278 1 FP 256 INT FP 256 160 POKE 32259 F 17g EXEC 320009 188 FOR J TO 7 190 POKE 32250 0 200 EXEC 32000 210 FP FP FD 220 NEXT 230 GOTO 80 240 DATA 1 287 2 253 2 258 2 291 1 The DATA statement at the end of the pro gram contains the numbers that make the frog jump As you will see the frog jumps in an arc across the screen giving the effect of movement when you tap the space bar best way to cr
42. LET B 65200 LET Z 1 Line 30 tells the computer to memorize the numbers out of DATA statements If you make a mistake in copying this long list of numbers it will tell you there is a data error so recheck your entries in Lines 100 to 160 These lines contain the numbers which when placed in memory form your machine code routine SAVEing this program is done in a differ ent way from usual When you have typed it and RUN it the screen will go blank and the computer will prompt you to start your tape recorder and then press key to save the routine on tape To reLOAD it use LOAD Frame Prin CODE i i 4 MOVING THE GRID With the program still in memory or reLOADED from tape and RUN you can begin to use it First type NEW and so your new program does not corrupt the old Then type in 20 LET print 3249 LET 324 2 IF PEEK 23733 255 THEN LET print 65200 LET B 65202 90 BORDER PAPER INK 4 CLS 188 LET Y 8 LET X 15 LET Y1 8 LET X1 15 LET Z 1 11g LET AS INKEYS 120 IF AS z AND X2 THEN LET X1 X 1 LET Z 1 130 IF AS x AND lt 29THEN LET X1 X 1 LET Z 2 140 IF AS p AND Y THEN LET 1 1 150 IF AS I AND Y lt 18 THEN LET Y1 Y 1 178 LET X X1 LET Y Y1 180 PRINT AT Y X POKE B Z RANDOMIZE USR print 199 GOTO 119 4 og mE UY gt gt f SETTING UP A MOVEABLE GRAPHI
43. NT C1 r 100 PRINT 105 PRINT 110 PRINT 115 FOR D 1 TO 59 NEXT 120 GOTO 10 x 20 RARE ALT tt O REUTKI 8 1 Nm 54 1 a 74 n 1 4 amp ui D 147 7 ga LL LLL AA 3 How to build a helicopter Each square is a ROM graphic Now RUN the program This is rather ela borate way of producing a simple image but it does illustrate one or two interesting points First it gives you an idea of the relative positions of the screen locations The middle of your insect is on Line 10 from the top and about halfway across the screen Second it shows the effect of telling the computer to print more than one character on a single location it simply carries on and prints the extra characters on the adjoining locations That is why the feelers in Line 40 are at 10 18 Locations 1 15 10 16 and 10 17 are already occupied by the insect s body 5 ve B 0 gt Ses more convenient way of setting up the insect is to amalgamate the above instruc tions into a single line thus 10 PRINT AT 10 15 000 lt
44. RAMMING THE RND FUNCTION HOW RANDOM NUMBERS ARE CREATED USING VARIABLES THE INPUT STATEMENT each line Whichever computer you are using you are not limited to using a range of numbers from 0 to 5 You could equally well choose 10 or even 10 000 but this last would make the guessing game very hard indeed USING VARIABLES In writing the short program above you have not only selected a random number but also given it a name X From now on whenever X crops up the computer will know you mean that random number you just thought of Such a name which allows the com puter to identify a number so that it can compare it with another number or multiply it or divide it or whatever you wish is called a variable THE INPUT STATEMENT Having generated the random number the next step is to warn the computer to accept your guess at what that number is So you use the INPUT statement This tells the computer to wait until some information has been typed in INPUT by itself however means nothing The computer must have a name by which it can identify the data it will receive So as before a variable is used In this case it is G for guess but it doesn t have to be it could be any other letter or combination of letters or even the whole word GUESS if you feel that energetic So the whole statement is as follows but do not type it in yet SC C Now th
45. XT ONE 160 FOR X 1 TO 4 X 178 GOTO 68 C 10 PRINT HELLO WHAT IS YOUR 2g INPUT AS PRINT J 40 PRINT HELLO C1 AS PRINT 1 HAVE SOME QUESTIONS FOR YOU 50 FOR X 1 TO 2000 NEXT X 60 PRINT I 70 N INT RND 1 12 1 88 PRINT WHAT 1507 9 90 A 9 INPUT 18g IF A N 9 THEN GOTO 150 PRINT C7 128 PRINT A LJ 138 PRINT SORRY PLEASE TRY AGAIN 14g GOTO 8g 158 PRINT WELL DONE C1 AS PRINT HERE IS THE NEXT ONE 168 FOR X 1 TO 2000 X 178 GOTO 68 What most of these lines are doing will be obvious when you RUN the program But a few are worth a comment Lines 30 60 and 110 are to stop the screen getting cluttered up with computer chatter or columns of wrong answers RUN the program with these lines deleted and you will see the difference they make Lines 50 and 160 simply waste time by making the computer count up to a certain number before springing the next question on your unsuspecting infant How it does this is in BASIC Program ming 2 In the Sinclair program the commas in Lines 40 and 150 as all but absolute begin ners will know are to space out the mess ages so there are no word splits at the end of the line In the programs for the other machines the colons and extra PRINT state ments in Lines 40 and 150 are doing the same job From the viewpoint of your eight year old this progra
46. ard Hunt Litho London HOW TO ORDER YOUR BINDERS UK and Republic of Ireland Send 4 95 inc p amp p IR S 45 for each binder to the address below Marshall Cavendish Services Ltd Department 980 Newtown Road Hove Sussex BN37DN Australia See inserts for details or write to INPUT Gordon and Gotch Ltd PO Box 213 Alexandria NSW 2015 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 W A ies TN WW Ww ww IM LT Ww i WW www W N i NN Www N e MN W W A NAN NN AWN WW N N iN NW wt There are four binders each holding 13 issues BACK NUMBERS Copies of any part of INPUT can be obtained from the following addresses at the regular cover price with no extra charge for postage and packing UK and Republic of Ireland INPUT Dept AN Marshall Cavendish Services Newtown Road Hove BN3 7DN Australia New Zealand and Malta Back numbers are available through your local newsagent COPIES BY POST Our Subscription Department can supply your copies direct to you regularly at 1 00 each For example the cost of 26 issues is 26 00 for any other quantity simply multi
47. at your computer knows the secret number it has generated and your guess it can compare the two This is done in a very similar way to ordinary English CH IF X G THEN PRINT WELL DONE The IF THEN statement is clearly a very useful one In programming you will use it Over and over again A ADDING IF THEN FOR COMPARISONS TWO NUMBERS GAMES YOU CAN PROGRAM RANDOM NUMBER RANGES LIST 10 LET AS TODAY IS LET BS TUESDAY 30 LET CS AS BS 1 The cursor a small under line on this machine but a blob on others shows where the next character you enter will appear on the screen of the television set Some computers such as the Acorns and Dragon go one better They have an extension of the statement IF THEN ELSE In this case the computer does som ething else if the two numbers are equal On those computers without the ELSE extension such as the Sinclair and Commodore home computers the com puter automatically skips to the next line of program if in this case the two num bers are not equal PROGRAM OUTLINE Now type in this program The lt gt means 15 less than or more than in other words is notequal to X 20 LET X INT RND 6 PRINT THE COMPUTER HAS CHOSEN A NUMBER BETWEEN AND 5 CAN YOU GUESS IT 4g INPUT 68 IF G X THEN PRINT WELL DONE 88 IF G lt gt X THEN PRINT TOUGH LUCK YOU R
48. blication in INPUT All tapes and written material should be accompanied by a stamped self addressed envelope your games programs off the ground with KEYBOARD CONTROL techniques how to make move how to make em fly and how to make em shoot LJ Fill the screen with graphic images with easy short programs to create UDGs for games characters of your own design your computer earn its keep with your own versatile DATA FILING system You can store and recall information on hobbies collections names and addresses and lots more Learn how to use GOTO and GOSUB the doors and gates that give your BASIC programs a logical structure Put your computer s decision making ability to work for you with IF THEN routines to add to your BASIC programming skills COMING IN ISSUE 2 A MARSHALL CAVENDISH COMPUTER COURSE IN WEEKLY PARTS 3 R Fl FUN AND THE FUTURE
49. d by a flashing on the screen Then on the Spectrum press CAPS SHIFT and 6 together to get an inverse black for white version of the symbol on the key then _CAPSSHIFT and 8 then 6 by itself On the ZX81 press SHIFT and T SHIFT and SPACE SHIFT and Y Finally push 9 again to get out of graphics mode before inserting the quotes at the end Here is the full program for the figure 10 PRINT AT 5 14 1100 1 AT 6 14 TN 7 14 Ag LE AT 8 14 Ma Co 20 PRINT AT 5 14 LJOL AT 6 14 wn AT 7 14 Fl a AT 8 14 CS 30 GOTO 10 Again you may find that inserting a FOR NEXT loop after Line 10 and again after Line 20 is necessary to slow the action 0 JOE 4 Dancer in just 12 squares Here at last is a program which not only animates the insect in the earlier program but also makes him move across the screen 18 FOR N TO 27 2 PRINT AT 18 N 000 AT 9 N 5 AT TIN C 38 PRINT AT 10 000097 AT 9 HN 49 PRINT AT 10 000 lt AT 9 AT 11 N PRINT AT 1 00009 9 AT 1 000 69 NEXT 70 GOTO 10 This program also uses a FOR NEXT loop but for a completely different purpose In the example above the computer was counting up fractions of a second before printing an image Now it is moving a
50. d only until some condition is fulfilled and then want to break out of the loop use a different statement instead Most often this will be GOTO taking you back to an earlier line to complete a loop But on some computers you can use REPEAT UNTIL instead PAINTING BY NUMBERS Just for fun plus valuable practice in pro gramming you can use FOR NEXT loops to create a huge range of graphics effects Here is one example 10 FOR n TO 21 20 LET m RND 31 30 INK RND 7 1 PRINT AT IMP 50 NEXT n 60 GOTO 1g S 8 MODE 2 9 VDU23 8202 0 0 0 10 FOR row TO 30 20 LET column RND 19 COLOUR 128 RND 7 PRINT TAB column row L1 DBA NEXT row 68 GOTO 10 7 4 J 7 CLS 10 FOR N T0 63 20 LET M RND 32 1 LET C RND 9 1 SET N M C 50 NEXT N 60 GOTO 10 Here Line 10 sets the depth of the pattern you are going to print on the screen and tells the computer to print it out one line at a time Line 20 sets the width of the overall pattern and with Line 40 tells the computer to print little squares randomly across that width Line 30 randomizes the colours in the little squares 1g PRINT I 15 FOR N TO 24 20 M INT RND 1 16 25 C INT RND 1 40 POKE 1024 40 N C 160 POKE 55296 4 N C M 5 NEXT 60 GOTO 15 The Commodore program works in a slightly different way from those on the other machines Line 1
51. d you can produce a much more compact pro gram that will not only ask all the right 5 questions but ask them in random order 1 a much better way of teaching as well as of programming Particularly when you are learning pro gramming it is always best to work out the core of a program before adding the frills So first try these lines remember NEW 18 LET RND 127 1 29 PRINT WHAT ISO 9 INPUT A 40 IF A N 9 THEN PRINT CORRECT FJ 1 LET N RND 12 20 PRINT WHAT IS O LJ TIMES 9 INPUT A 40 IF A N 9 THEN PRINT CORRECT C 10 N x INT RND 1 12 1 20 PRINT WHAT ISO N CITIMES 9 INPUT A 40 IF A N 9 THEN PRINT CORRECT This program is using RND in much the same way as in the guessing game In Line 10 you first set up a variable or label for the random number the computer selects In this case it is N but it could be any other letter or letters PRINT C1 2 PRINT 4 5 6 PRINT 6 2 1741421386 lt 3 Computer symbols for basic arithmetic The sign and not small x is used for multiply The means divided by and raised to the power The 7 81 uses instead Plus minus signs are conventional Then in the right hand half of Line 10 you tell the computer to pick a number any whole number between 1 and 12 The
52. e hard work out of many repetitive operations It is used when you want the computer to count for you usually executing some other operations as it goes then stop when it reaches a predetermined number You can create your own instant paint ings using NEXT loops in quite tiny programs You ll also find them useful in games programming indeed in programs of all kinds gt S amp 5 WHAT IS A NEXT LOOP A NEXT loop in BASIC is a device which makes the computer repeat the same operation a number of times Suppose for example you wanted to know the square roots of all the numbers from 1 to 100 You could tell the computer PRINT SOR 1 PRINT SQR 2 PRINT 50 3 and so on And each time you asked a question the computer would display the answer Quite apart from imposing unne cessary wear and tear on your typing finger s this is not a particularly efficient use of the computer So 18 FOR n 1 1g 20 PRINT n SOR n NEXT n 49 PRINT and that is all 1g FOR N 1 TO 100 29 PRINT SQOR N NEXT PRINT AND THAT IS ALL C C Eng 18 FOR N21 TO 1 28 PRINT SQR N NEXT N 49 PRINT AND THAT IS ALL What this tells the computer to do is to print 1 and its square root 2 and its square root 3 and its square root and so on until it reaches 100 when it stops COUNT
53. eate graphics similar to those in figs 1 and 2 is to use one of the Commodore 64 s special graphics features sprites a king sized type of UDG CREATING THE TANK The sprite program here covers three activ ities an initializing routine a control se quence to regulate the sprite s movement on the screen and data which is used to define the shape of the tank sprite 10 FOR M 252 TO 253 64 M TO 64 M 63 POKE 1 0 NEXT 20 FOR I 64 M 21 64 M 56 READ I A NEXT NEXT 60 SC 53248 X3 24 X 24 Y3 157 Y 15 7 70 POKE 2043 252 POKE 2042 254 POKE SC4 23 0 POKE SC 29 0 POKE SC4 42 12 POKE SC 27 0 90 J R 9 POKE 650 128 PRINT U POKE SC 21 8 1 GET AS IF AS THEN 188 110 IF AS Z AND gt 24 THEN X3 X3 12 128 IF AS X AND X3 lt lt 310 THEN X3 X3 12 130 IF A P AND Y3 gt 5 THEN Y3 Y3 12 148 IF AS L AND lt lt 220 THEN Y3 Y3 12 188 IF X X3 THEN X X 3 POKE 2043 253 19g IF X gt THEN X X 3 POKE 2043 252 200 IF Y THEN Y Y 3 218 IF Y THEN 3 220 XA INT X 256 XB X XA 256 230 POKE SC 6 XB POKE SC 7 Y 240 POKE SC 16 4 1 AND JA 8 1 AND XA 250 1 1000 1 192 63 224 255 255 254 255 254 1 255 224 1818 DATA 63 255 255 127 255 255 255 255 255 122 235 174 48 65 6 1828 DATA 6 122 108 1838 DATA 3 128 8 7 252 8 127 255 255 127 255 8 7 255 128 0 0 1948 DATA 255
54. een ready for the next image to appear SLOWING IT DOWN Until now the movement of the insect is rather fast and could do with being slowed down This is most easily done by using a FOR NEXT loop So next enter this line 45 FOR T 1 TO 100 NEXT When you press the RETURN key and RUN the program the movement is much more deliberate The FOR NEXT loop is acting as a counter in thi ing up to 1 before the program goes on to Line 50 You can vary the length of the pause simply by changing 100 to any other number you choose the bigger the number the longer the delay also changing the position of the FOR NEXT delay loop to Line 15 Depending on the delay you select there should be a noticeable pause a blank screen when one image is cleared but not immediately replaced by another This shows why it 15 better to use HOME rather than CLEAR HOME within a program of this kind As it stands the image is still rather jerky because the delay loop is acting only on the first image You can get a much more purposeful movement by introducing another FOR NEXT loop into the program to act on the second image So enter this 85 FOR 1 1 TO 50 NEXT This delay loop is shorter to create over lig E irregular leg movement but you cano course change it if you wish P e 2 i T MOVING THE CHARACTER The next step is to alter the program so that the
55. er or INT function The expression now looks like this INT original function 4 It will generate a number between 0 and 39 because the INT function merely cuts off all the figures after the decimal point Suppose you want to have a range of numbers from 1 to 40 you have to do is to add 1 to the INT expression The Dragon and Acorn machines have a shortcut whole number between 1 and 40 is generated when RND 40 is typed See the table for some examples nn EXE RND B RND RND n RND n INT RND 49 INT RND 4g SPEED UP YOUR GAMES ROUTINES Machine code programming on the sur face anyway 1s far from easy To most home computer owners machine code is a daunting maze of numbers The best way to begin is by actually trying out some machine code routines In this way you right from the start will be familiar with the advantages of machine code and what it can do for vour programs Then in later articles in the series we will take you through all the mysterious numbers so that you can develop machine code programs of your own The graphics in this article use BASIC programs to put machine code routines into your computer s memory In this way you can produce far faster and more lifelike movement than you could using BASIC alone Note that because this is dependent on the characteristics of individual computer s the Sinclair and Commodore programs are designed only for the Spectrum and
56. ers as under our Irm o Machine code is not just for the experienced programmer You can start off by using short routines to speed up your BASIC games and have fun while you re learning One way to create this would be to use a series of PRINT AT statements in BASIC PRINT AT 19 18 lt graphics ABC gt PRINT AT 11 19 lt lt graphics DEF better way is to use the machine code routine which the BASIC program below sets up When you type it in make sure you use the Spectrum key words and not the actual letters CODE for example is entered by pressing CAPS SHIFT and SYMBOL SHIFT together and then pressing the key 10 IF PEEK 23733 127 THEN CLEAR 32399 LET B 3249g LET 7 20 IF PEEK 23733 255 THEN CLEAR 65199 LET 652 LET Z 1 30 LET T FOR N B TO B 129 READ A LET T T A POKE N A NEXT N READ A IF A lt gt T THEN PRINT DATA ERROR STOP 40 IF Z 1 THEN POKE 65258 178 POKE 65259 254 POKE 65277 179 POKE 65278 254 5 SAVE FramePrint CODE B 130 60 STOP 100 DATA 24 55 1 22 0 0 32 32 32 22 0 0 32 32 32 22 0 0 32 32 DATA 32 22 8 0 144 145 146 22 0 0 147 148 149 22 8 0 158 151 152 22 120 DATA 8 8 153 154 155 22 8 8 156 157 158 22 0 0 159 160 161 58 146 126 130 DATA 254 1 1 18 0 40 8 56 4 203 33 24 2 14 0 221 33 147 126 221 14g DATA 9 58 137 92 71 62 24 144 221 119 1 69 221 119 7 69 221 119 13 58 150 DATA 136 92 71 62 33 144 221 119 2 221 119 8
57. g or LOADing Only one item of information has to go astray for a SAVE or LOAD error A further problem of using tapes previously used to record data or music is the continued presence of part of original signal after the new data recording has been made This can easily spoil it GET MOVING ON ANIMATION Want to bring your games programming to life Then start with these simple graphics characters you can produce them from the ROM graphics on your computer Playing commercial computer games is fine up to a point but the time comes when most people feel the need to let loose their imaginations and create their own games Games programming is not easy you have to start with simple things and build up But this helps you to learn to think logi cally and increases your programming skill You ll also have more fun In games programming the first thing you need to learn apart from BASIC skills is the technique of animation To create the illusion of movement the computer programmer uses much the same techniques as the cartoonist who ani mates a movie He creates two or more pictures and alternates them rapidly ideally about 24 times a second But there is an important difference In movie animation the cartoonist can rely on the film projector to get rid of each pic ture when it is no longer wanted In com puter animation this 15 not so Unless you do something about it any segment
58. l data cassette recorder follow the specific setting up instructions which should be provided With an ordinary audio recorder start by switching out all the special features such as noise reduction systems and filters Set the tone control s to give maximum treble high and leave the recorder in this state whenever it is used with the com puter Switch out special filters Nothing is more infuriating than a program which won t SAVE or a game that won t LOAD Here s how to get the frustration down to an irreducible minimum Choose a mid point volume setting and try LOADing a prerecorded program such as on the demonstration tape which came with your machine If the program fails to LOAD try increasing the volume by a little and running it again If the program still fails to LOAD continue increasing the volume step by step running the program tape again each time If you reach the maximum setting with no success reset the volume control to slightly less than the original mid point position and then progressively decrease the volume setting running the tape again each time It tor some reason the program fails to LOAD at any volume setting check the con 1 If you can permanently mark the best volume setting nections again Try another lead pro gram tape or borrow a tape recorder known to work with your make of com puter If nothing works ask your deale
59. m has one terrible disadvantage it goes on and on without stopping You can release him from his misery like this Push STOP then ENTER VAT Push BREAK Specifying random number ranges L3 C Generates a random number between and 999999 RND 1 RND 1 Generates a random number between and 999999 RND 1 n RND 1 n Generates a random number between 10 and 10 RND 21 11 INT RND 1 21 10 RND 21 11 INT RND 21 10 Generates a random whole number between and 39 INT RND 1 49 INT RND 1 40 Generates a random whole number between 1 and 4f 4 1 740 1 4 INT RND 4g 2 1 FJ Push ESCAPE c Push RUN STOP From your viewpoint on the other hand the program has a bonus feature Simply by changing the 9s in the pro gram to 5s 6s 7s or whatever you can test him on all his tables And because the computer does all the sums you do not need to know any of the answers yourself How do you specify a range of random numbers RND on the Sinclair RND 1 on the Acorn and RND on the Dragon and Commodore generate a random number between 0 and 0 999999 If you want a larger range of random numbers you have to multiply the original RND function For example to generate a number between 0 and 39 999999 you would multiply the original function by 40 To generate a random whole number as opposed to a decimal number you use the integ
60. mputers will use their own minimum settings unless instructed otherwise Fast settings use less tape and obviously SAVE and LOAD pro grams more quickly With the very fastest rates it is important to use top quality tapes and a proven recorder Other variations of the SAVE command to deal with special applications explained in a later article Make a habit of labelling the cassette as soon as you have made a new program recording Small self adhesive labels are particularly convenient for this Remove the tab from the back of the cassette to pre vent accidental erasing or overwriting of an important program VERIFYING YOUR SAVES One way of checking whether or not a pro gram has been SAVEd properly is to LOAD and RUN it But this could mean the loss of the program if the SAVE has not been suc cessful In the computer s memory you will 6 CORE SCREENED LEADS replace the program you want to SAVE with the program on the tape If the SAVE has been successful it will be the same thing But if the transfer has distorted the pro gram in any way you will have lost the original Many computers avoid this problem by providing some form of VERIFY command Its use typically involves rewinding the tape back to start of the program and running the command using a file name which exactly matches that used in the SAVE command for example VERIFY PROGNAME 1 2 Here are two recorder leads you could c
61. n image across the screen one screen loca tion or box if you like at a time Why then does Line 10 read TO 27 when there are in fact 32 screen locations across a Sinclair screen To find out try replacing Line 10 in the program with FOR N TO 32 Another puzzle may be the need for Lines 30 and 50 But try deleting them you will soon see why they are needed zc c E NEXT STEPS Now that you have started to learn animation and movement you can begin to invent figures or rockets or space ships of your own using the graphics set illustrated in your manual the standard typewriter characters or both If you decide to try any of the figures illustrated for other makes of computer however you cannot use the programs as listed Instead you have to draw out the figures on graph paper and evolve your own programs from there CUMULATIVE INDEX An interim index will be published each week There will be a complete index in the last issue of NPUT A Dragon Tandy 14 Animation 26 32 Spectrum 10 B G Basic programming Games guessing think of a number 2 7 Acorn 4 5 the FOR NEXT loop 16 21 Commodore 64 Vic 20 4 5 BREAK Dragon Tandy 4 Dragon Tandy 3 4 Spectrum ZX81 3 4 C Games programming Cassette choice of 25 animation 26 32 Cassette recorders Games routines 8 15 choice of 24 GOSUB Commodore 18 CHR Dragon Tandy 26 27 CLEAR Acorn 4 18 21 28 Dragon Tandy
62. n type in the following program 18 MODE 1 20 VDU 23 82 2 40 20 20 1 20 1 20 7 1 50 AS GETS 68 IF AS Z AND X THEN X1 X 1 Z 1 18 IF A X AND lt 37 THEN X1 X 1 Z 2 80 IF AS L AND Y 29 THEN Y1 Y 1 9 IF AS P AND Y gt THEN Y1 Y 1 128 X X1 Y Y1 138 VDU 31 X Y X Z CALL amp D 148 GOTO 50 For disk drive in replace amp Df0 with amp Aff You can now RUN the program and move the frame using P up Z left L down and X right When the program is RUN you still will not see very much If you have just played a game that uses UDG characters you may find that remnants of space ship or killer gorilla have invaded your frames Other wise all you are likely to see is a horizontal line when you move left This is of course because you have not yet defined the UDG characters CREATING THE TANK To make the program useful you can pro duce the tank in fig 2 pointing left in one frame and pointing right in another Press ESCAPE then enter GOSUB 262 260 VDU 23 224 0 0 0 0 0 0 0 0 23 225 0 0 0 0 0 0 0 0 270 0023 226 23 227 0 0 0 0 255 0 1 0 288 VDU 23 228 0 0 1 63 255 255 255 0 23 229 0 0 192 224 254 254 224 0 290 VDU 23 230 63 127 255 122 48 6 23 231 255 255 255 235 65 1 2 Line 130 300 VDU 23 232 255 255 255 174 6 120 9 0 31g VDU 23 233 0 0 0 8 0 0 0 0 23 2
63. nes 15 and 25 not only 15 Other numbers will simply give you a longer or shorter delay Try adding these extra lines 15 FOR L 1 TO 15 17 NEXTL 25 FOR L 1 15 27 NEXTL about uselessly but iVi believable animation Movement tes little later see Movement 133 3 1 3 OOO OOO OOO 3 1 ER VII LOW RESOLUTION GRAPHICS 5 You can use the computer esolut graphics to create more interesting anir ations The User s manual shows the gra phics characters which you can use Each graphics character has a code a value from 128 to 143 To display them on the screen you use CHRS then the code of the graphics character in brackets For example to display the character represented by code 138 tewards the middle of the screen you would type 1 PRINT amp 239 CHRS 138 The following program uses the low reso lution graphics to animate this spinning satellite fig 1 shows two views of it which are alternated in the program 10 CLEAR 599 CLS 20 PRINT 174 CHRS 143 CHRS 141 PRINT 178 5 143 a OL fa la la la a MRa al al al al aE so m ee TL CR s JEJE EEE 1 How to build your satellite THE PRINCIPLES ANIMATION s MOVING GRAPHICS FROM THE TYPEWRITER KEYS ka HOW TO USE ROM GRAPHICS 04 e PRINT 296 CHRS 14g 2 CHRS 132 4 CHRS 141 PRINT 236 CHRS 137
64. new program you may find the flashing cursor spoils the picture You can get rid of it by adding 7 VDU 23 8202 0 0 0 You may also want to change the speed at which the legs move You can slow them down by using INKEY which tells the com puter to wait for a while The delay is mea sured in hundredths of a second so A INKEY 1 means a delay of one second Try adding these lines 45 LET A INKEY 50 85 LET 5 You can adjust the speed of the insect s legs by varying the INKEY number until you get realistic movement USING TELETEXT GRAPHICS If you have a BBC computer you can make better looking characters using the com puter s graphics set Making graphics cha racters on the Electron requires a different procedure and is covered in a later article In MODE 7 the BBC computer can pro duce a whole range of block graphics which you can build up into interesting shapes First draw out a shape on graph paper and divide it into rectangles 2 squares across by 3 squares down Each of these is a graphics character Each character has a number which is given in the back of the manual If you look up the numbers and write them out as shown in Fig 2 it is easy to write a program to draw the picture on the screen Here is one example 1 MODE 7 20 LET Y 19f LET X 15 40 VDU 31 X Y 146 169 169 191 160 160 5g VDU 31 1 146 184 163 255 240 160 68 VDU 31 X Y 2 146 169 168 189 236
65. ng you can add a bit more BASIC program to move a shell fired from the tank Enter these lines and RUN the program the space bar will then fire the shell On the Tandy you need to type in 247 instead of 223 in Line 420 or the program will not work 168 DIM A 2 B 2 C 2 198 FOR 1536 TO 1760 STEP 32 200 READ 218 POKE 220 NEXT 230 GET 8 8 7 7 A 240 FOR 1 1536 TO 1760 STEP 32 25 READ 260 POKE N NEXT 280 GET 8 8 7 7 B 429 IF PEEK 345 223 GOSUB 500 48 DATA 8 32 144 64 13 64 144 32 49g DATA 4 9 2 176 2 9 4 IF T 2 THEN 56g 518 YP INT TP 1536 32 8 520 XP 8 TP 1533 YP 8 32 530 IF XP 255 THEN 620 549 PUT XP YP XP 7 YP 7 A 550 GOTO 600 560 YP INT TP 1536 32 8 570 XP 8 TP 1537 YP 8 32 580 IF XP lt THEN 628 59 PUT XP YP XP 7 YP 7 B FOR I 1T0190 NEXT 610 PUT XP YP XP 7 YP 7 620 RETURN CREATING THE FROG Fig 3 shows the frames that you can define now and which when controlled properly will make the frog jump across the screen Unless you have just turned on the com puter the machine code routine should still be in memory If it isn t allocate some memory for it by typing CLEAR200 3 2000 Then type CLOADM and turn on your tape recorder define the frog you need these lines First type NEW to get rid of any rubbish in the machine and then enter this DATA 10 C
66. o Line 10 and the NEXT into Line 90 or even 9000 if you like and your computer will faithfully remember it Remember though that it will execute all the lines within the loop every time it passes through PAINTING NUMBERS WITH FOR NEXT LOOPS SUNRISE PATTERNS E INSTANT PATCHWORK AND EMBROIDERY DELAYING ACTION FOR NEXT loops have dozens of uses in programming And the easiest of them is simply to waste time If you refer back to the Know your tables program on page 7 you will find a good example In this case all that happens between each and its NEXT is that the com puter counts up one number Computers count very rapidly so this takes only a tiny fraction of a second the exact time varies from computer to computer but is in the order of hundredths or thousandths But by the time it has counted to 1000 you have noticeable pause And if you should program it 18 FOR N 1 to 1980000 2 NEXT N you would probably have time for a coffee before it executed the next line in the program How can I keep track of the variables in my programs and not get lost among all those Xs and Ys Keeping track of your variables is much easier if you give them names that actually mean something in English In a short program your variables are easy to trace But in a longer program if for example you are setting out material on the screen it is easier to remember
67. odification Line 10 be FOR amp 8A58 In Line 40 And in Lines 60 and 70 replace amp fD with amp JA Now RUN the program When you have finished the computer will tell you to press the record button on your tape recorder and then press the computer s RETURN key This will save the routine for immediate or future use DO NOT BREAK Now a word of warning do not use the BREAK key at any time while this machine code routine is in your computer s memory as you might for example to amend a line of BASIC program or of DATA Using the BREAK key will corrupt the routine and you may be unable to get your program back again Without knowing machine code you will not understand what the numbers in the DATA statements above mean but you may find this helpful Lines 10 30 take the numbers out of the DATA statement and place them into the memory of the machine Line 40 is the command needed to SAVE your machine code routine You can change the filename if you wish MOVING THE GRID Now you have a copy of the machine code routine on tape you can begin to use it First you should clear the memory of any rubbish so type NEW This does not get rid of the machine code routine which is protected from the NEW statement or any other BASIC by its position in memory Next to move the frame around the scree
68. on has no inbuilt UDG characters but parts of its memory will behave as UDGs if you write a program telling them to In theory you have hundreds of these frames at your disposal But using them all would involve hours and hours of pro gramming and in practice you will usually use about five of them SETTING UP THE To produce the frog in fig 3 or the tank in fig 2 you first need to define a frame to put the character in Both need a 3 x 3 frame of UDG characters like that in fig 1 but with nothing in it This gives you an imaginary grid 24 dots by 24 dots which you can move around the screen In Dragon BASIC you would have to PSET every dot in the frame all 576 of them So the machine code routine is faster First type in the following routine 18 CLEAR 2 32 20 FOR 32 TO 32119 30 READ 40 POKE I N 50 NEXT 60 CLS PRINT PRESS ANY KEY TO SAVE MACHINE CODE ROUTINE 100 BS INKEYS 11g IF B THEN 100 128 CSAVEM FRAMEPRN 32000 321 10 32000 130 DATA 199 127 188 134 3 183 125 111 183 125 112 134 8 183 125 113 14g DATA 182 125 25 39 5 2 6 126 44 14 198 72 61 51 203 166 192 150 DATA 167 132 48 136 32 122 125 113 38 244 134 8 183 125 113 48 168 DATA 137 255 1 122 125 111 38 230 134 3 183 125 111 48 137 0 170 DATA 253 122 125 112 38 216 57 95 231 132 48 136 32 122 125 113 180 DATA 38 246 134 8 183 125 113 48 137 255 1 122 125 111 38
69. opy for use on your computer Check your manual for the right pin configuration at the computer end lower left The computer will then read through the SAVEd program and check it against the one it has in its memory If the program has corrupted during recording an error mes sage will be displayed on the screen This gives you the opportunity to try the SAVE again until you are successful THE LOAD COMMAND If you start by using prerecorded program tapes your first problems are likely to be with the LOAD command As with the SAVE command there can be several types of LOAD command even for a single type of computer But for the moment look at the simplest form LOAD PROGNAME 1 This exactly duplicates the form of file address used by the SAVE and VERIFY com mands the program will not load if there is any error in the program file name Keying in the LOAD instruction and pressing the play key on the recorder enables the computer to read the tape signals It searches first for a program name and will display all the program names until it reaches the one which matches the file name you have entered after the LOAD command When this name is found the data which follows is auto matically LOADed into the memory If the recorder is remotely controlled by the computer the cassette drive automati cally stops after loading but it is up to you to press the stop key If your recorder is not controlled
70. ou could have three 3 x 3 frames with five UDG characters left over Or you could have eight 2 x 2 frames or even one massive 8 x 4 frame with nothing left over SETTING UP THE GRID Both the frog and the tank illustrated in this article need a 3 3 frame of UDG characters as under 224 225 226 221 228 229 230 231 232 You could create this using a series of PRINT TAB commands for example PRINT TAB 10 10 CHRS 224 CHRS 225 CHRS 226 PRINT TAB 19 11 CHRS 227 CHRS 228 CHRS 229 and so on better if slightly longer way is to use a BASIC program to set up a machine code routine as shown below This routine has two advantages once you have entered it once you can use it over and over again and of course it allows you to move your graphics around the screen much faster than you could using BASIC alone Before entering the program type NEW Then type FOR T amp D9 TO amp D58 20 READ A T A NEXT T 4 SAVE FramePrint 59 5 DATA 24 169 224 2 2 48 47 24 7 202 240 2 105 9 105 9 162 3 160 3 32 238 255 24 1 5 1 136 2 8 247 2 2 24 21 72 169 60 DATA 10 32 238 255 169 8 32 238 255 32 238 255 32 238 255 104 76 17 amp D 96 169 32 162 3 169 3 32 238 255 136 208 250 70 DATA 202 240 249 169 10 32 238 255 169 8 32 238 255 32 238 255 32 238 255 169 32 76 57 80 D If you have a disk drive this program will need some m
71. ply the number of issues required by 1 00 These rates apply anywhere in the world Send your order with payment to Subscription Department Marshall Cavendish Services Ltd Newtown Road Hove Sussex BN37DN Please state the title of the publication and the part from which you wish to start HOW TO PAY Readers in UK and Republic of Ireland All chequesor postal orders for binders back numbers and copies by post should be made payable to Marshall Cavendish Partworks Ltd 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 your queries to INPUT Queries Marshall Cavendish Partworks Ltd 58 Old Compton Street London WIV SPA INPUTIS SPECIALLY DESIGNED FOR The SINCLAIR ZX SPECTRUM 16K 48K 128 and COMMODORE 64 and 128 ACORN ELECTRON BBC B and B and the DRAGON 32 and 64 In addition many of the programs and explanations are also suitable for the SINCLAIR ZX81 COMMODORE VIC 20 and TANDY COLOUR COMPUTER in 32K with extended BASIC Programs and text which are specifically for particular machines are indicated by the following symbols SPECTRUM 16K 48K 128 and ACORN ELECTRON e BBC B and B RA DRAGON 32 and 64 E QE vic 20 8 COLOUR compurer COMMODORE 64 and 128 THINK OF A NUMBER
72. program is rather an elabo rate way to produce a simple image but it does illustrate some interesting points First it gives you some feel for the rela tive positions of the screen locations The middle of the insect is about in the middle of the screen at location 239 Second it shows what happens when the machine is told to PRINT more than one character at one screen location it simply carries on and prints the characters at the adjoining higher numbered locations That is why the feelers in line 30 are at 241 Locations 238 248 are already occupied by the insect s body more convenient way of setting up the insect is to amalgamate the program above into a single line Incidentally if you have not discovered it yet on the Dragon there is a shorthand for PRINT just use the character When the program is listed the machine will show PRINT instead of The simplified program looks like this 1B PRINT 238 000 lt PRINT 206 PRINT 278 If you add two more lines you get some animation 20 PRINT 238 000 lt PRINT 296 P PRINT 278 38 GOTO 10 RUNning the program produces a blur and does not look like animation at all The reason for this is that the pictures are being swapped too quickly If you insert a FOR NEXT loop it makes the computer pause and count and animation is clearer Any number can be used in the FOR NEXT loop lines Li
73. r s advice it could very easily be a fault with your computer When you have found a successful volume setting for LOADing note the con trol setting establish upper and lower limits then mark the mid point for future use You can usually leave the volume con trol at the same setting for SAVEing opera tions many recorders have automatic recording level control in any case To test that the volume levels are right for SAVEing clear the computer memory type NEW then press ENTER or RETURN or simply switch the machine off and then back on and enter this dummy program 10 REM TEST 20 REM 30 REM 40 REM and then follow the SAVE command routine used by your computer When you LOAD and LIST you should get the program back THE SAVE COMMAND The exact form of SAVE command used with your computer is given in your manual But several preliminary steps are needed Before SAVEing any program load vour recorder with a suitable cassette and wind it just past the point where the leader joins the tape Next decide on a suitable file name for your program All data is stored in the form of files of one type or another regardless of the actual storage methods used But for recordings made on tape particular types of file names are used with the SAVE command The file or program name can usually be any combination of characters or symbols within the line length specified for your machine On most machines the
74. s GAMES PROGRAMMING 1 Easy characters from your computer s standard graphics INDEX The last part of INPUT Part 52 will contain a complete cross referenced index For easy access to your growing collection a cumulative index to the contents of each issue is contained on the inside back cover PICTURE CREDITS Front cover Ian Taylor Inside front cover Binder picture Graeme Harris AA Page Mt Tamborine Observatory Pages 8 9 12 13 15 Jeremy Gower Pages 16 21 illustrations Peter Bentley photos John Darling Pages 22 23 top Kevin O Keefe bottom Chris Lyon Pages 24 25 Kevin O Keefe Page 27 illustration Chris Lyon photo NASA Pages 28 29 illustration Chris Lyon photo Tony Stone Associates Pages 30 31 illustration Chris Lyon photo Jerry Young Page 32 illustration Chris Lyon photo Rex Features Ltd Computer effects by J D Audio Visual Marshall Cavendish Limited 1984 5 6 All worldwide rights reserved The contents of this publication including software codes listings graphics illustrations and text are the exclusive property and copyright of Marshall Cavendish Limited and may not be copied reproduced transmitted hired lent distributed stored or modified in any form whatsoever without the prior approval of the Copyright holder Published by Marshall Cavendish Partworks Ltd 58 Old Compton Street London W1V 5 England Printed by Artisan Presss Leicester and How
75. s or N for no not a number but a letter This means that at Line 100 instead of INPUT A you must use INPUT AS The dollar sign is called a string and AS is known as a string variable Why is the necessary To understand this you need to know a great deal about how the computer stores and handles input the subject of a later chapter For now the important point to remember is When the computer is expecting number you use INPUT A INPUT B INPUT X or whatever When it is expecting a letter or word you must use INPUT AS INPUT BS INPUT X or whatever Line 120 is included so that if the player does not want another game immediately the computer waits until he does by repeating the process until the answer does equal Y It does this by repeatedly jumping back to Line 100 until a Y keypress after that line breaks the cycle KNOW YOUR TABLES The RND function has hundreds of uses in programming Suppose for example you wanted a program to teach your eight year old son or brother his 9 times table You could set it up like this 10 PRINT WHAT IS 1 TIMES 9 20 INPUT A IF A 9 THEN PRINT CORRECT 40 PRINT WHAT IS 2 TIMES 9 59 INPUT B 60 IF B 18 THEN PRINT CORRECT and so on But this would give you a very long pro gram without even solving the problem of how the computer responds if one of his answers is wrong Use the RND function however an
76. the 16K machine or CLEAR 65199 on the 48K machine This reserves for the machine code a space at the top of the computer s memory where the BASIC you are going to enter cannot reach and corrupt it Next type LOAD CODE and switch on your tape recorder to load the original machine code routine With the machine code loaded type in the following statements plus DATA to define the frog Then you can RUN the program 30 RESTORE 5008 FOR N USR a TO USR r 7 READ POKE N A NEXT N 5010 DATA 9 0 0 1 1 5020 DATA 0 0 0 0 0 128 192 176 0 0 0 0 0 bubo 0 0 0 5039 DATA 4 15 31 63 127 254 248 127 96 240 224 192 64 32 156 192 5040 DATA 9 0 0 0 0 0 B 5050 DATA 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 7 5060 DATA 8 28 27 70 255 254 252 249 0 0 0 0 0 0 0 5070 DATA 7 7 15 39 54 38 70 78 259 196 9 0 0 0 0 0 5080 DATA 0 1 1 3 6 2 8 148 144 16 32 32 48 32 5090 DATA 0 0 0 0 0 0 0 8 CONTROLLING THE FROG To control the frog s movements you need 1 BORDER PAPER INK 4 BRIGHT 1 CLS 20 LET 324 IF PEEK 23733 255 THEN LET 652 100 PRINT AT 10 0 RANDOMIZE USR P IF THEN GOTO 100 110 RESTORE 1000 FOR F 1 TO 5 120 READ A B C POKE P 2 A PRINT AT B C RANDOMIZE USR P 130 PAUSE 2 CLS NEXT F 15 PRINT AT 19 12 RANDOMIZE USR P IF INKEYS THEN GOTO 150 200 FOR F 1 0 5 210 READ A B C POKE P 2
77. the frog is a similar job to creating the tank First you type NEW This gets rid of the tank and its controlling pro gram but leaves the machine code routine intact This routine will go only when you turn off the computer or press BREAK If you have just turned on the computer load up the routine from the tape you SAVEd earlier Next using a slight variation of the normal LOAD command type LOAD and the computer will load the program Now the computer is ready for the BASIC program needed to define the frog So enter these lines 30 VDU 23 224 0 0 0 0 0 0 0 0 23 225 0 Vp pese ri 0 8 0 0 1 1 23 228 0 0 40 VDU 23 227 0 0 0 0 0 0 11 2 0 0 0 128 192 176 50 VDU 23 229 0 0 0 0 0 0 0 0 23 230 4 15 31 63 127 254 248 127 60 VDU 23 231 96 240 224 192 64 32 156 192 23 232 0 0 0 0 0 0 0 0 70 VDU 23 233 0 0 0 0 0 0 0 0 23 234 0 0 0 0 1 3 7 80 VDU 23 235 8 28 27 70 255 254 252 249 23 236 0 0 0 0 0 0 0 8 90 VDU 23 237 7 7 15 30 62 54 78 79 23 238 250 196 0 0 0 0 0 0 109 VDU 23 239 0 0 1 1 3 6 2 0 23 240 14 144 16 32 32 48 32 0 11g VDU 23 241 0 6 0 0 0 0 0 0 CONTROLLING THE FROG These extra lines will make the frog jump when the space bar is pushed 19 MODE 1 29 VDU 23 8202 120 0 20 0 0 138 VDU 31 X Y 14g X 1 CALL amp D 158 IF GETS THEN GOSUB 18 168 IF X gt 35 THEN VDU 31 X Y X96 9 CALL amp D GOTO 120 178 6070150 180 RESTORE FOR T 1 T0
78. ve columns wide If he went past the end of the screen bits of him would start appearing on the left hand side Try changing Line 30 and see what happens Now add two more lines to introduce a slight delay 85 LET 3 135 LET A INKEY 3 Finally add one more line to turn off the flashing cursor 15 VDU 23 8202 0 9 Here then is complete program 18 MODE7 15 VDU 23 82 2 29 LET 10 FOR X 1 TO 35 40 VDU 31 X Y 146 168 160 191 160 162 59 VDU 31 X Y 1 146 184 163 255 240 160 60 VDU 31 X Y 2 146 168 168 189 236 160 79 VDU 31 X Y4 3 146 160 224 165 234 176 88 VDU 31 X Y2 4 146 168 177 160 169 160 85 LET 3 99 VDU 31 X Y 146 169 168 252 160 162 198 VDU 31 X Y 1 146 232 236 189 174 160 118 VDU 31 X Y4 2 146 162 238 17 7 160 160 128 VDU 31 3 146 24 25 162 18 16 138 VDU 31 X Y4 4 146 161 16 160 245 160 135 LET A INKEY 3 14g NEXT X Notice that in this case there is no need for any un PRINTing spaces The control code 146 acts as a blank space which automati cally erases the previous image as the man is moved along You would need them though if you wanted to make the creepy crawlie move so spaces are inserted in front of each image as shown in the program below 1g CLS 20 VDU 23 82 2 30 FOR X 1 0 35 40 PRINT TAB X 10 L 1000 lt 58 PRINT TAB X 9 L 1 PRINT TAB X 11 L 1 7
79. you try to SAVE without first clearing the sprites they will corrupt your pro gram CREATING FROG SPRITE Now let s try the frog The graphics of the frog shown in fig 2 have to be changed slightly so that each can be accommodated in a single sprite This is done by removing three of the 24 rows and the only effect of this is to shorten the legs a little Either switch off and then back on or simply type NEW RETURN and enter this 10 FOR M 252 0 253 I 64 M TO 64 M 29 POKE I NEXT 20 FOR I 64 M 39 2 30 M 253 TO 64 M 62 READ A POKE A NEXT NEXT PRINT CZ 40 SC 53248 X 24 Y 155 POKE 2043 252 SC 7 Y POKE SC4 6 X POKE SC4 16 0 50 POKE SC 23 0 POKE SC 29 0 POKE SC4 27 0 POKE SC 42 5 POKE SC 21 8 60 SC 53248 X 24 Y 155 POKE 2043 252 POKE SC 7 Y POKE SC 6 X POKE SC 16 0 YR 70 GET AS 80 IF Y 155 THEN POKE 2043 252 9g IF PEEK 2043 253 THEN 120 188 IF AS lt gt L1 THEN 70 118 POKE 2043 253 YR 7 5 120 Y Y YR YR YR 7 130 X X 4 4 IF X 296 THEN POKE 2043 252 FO0R 1 TO 20 NEXT GOTO 60 140 XA INT X 256 XB X XA 256 150 POKE SC 6 XB POKE SC 7 Y POKE SC 16 1 AND XA 8 G0T07 1000 DATA 0 128 0 1 192 0 1 176 0 1818 DATA 4 96 15 240 0 31 224 63 192 1020 DATA 127 64 0 254 32 0 248 156 127 192 1939 DATA 0 0 28 27 7 0 0 255 1 254 3 252 d 7 249 1040 DATA 0 7 250 0 7 196 0 15 0 0 30 0 0 62 0 0 54
Download Pdf Manuals
Related Search
Related Contents
Gold DC Trombone Digital Servo Drive Installation Guide SPECIFICATIONS, INSTALLATION Mini-machine à coudre de poche Carson SA-400-83 14V Car Amplifier User Manual OS-9 Porting Guide Copyright © All rights reserved.
Failed to retrieve file