Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_34.ADF » P/+PT1
P/+PT1
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_34.ADF |
Filename: | P/+PT1 |
Read OK: | ✔ |
File size: | 120C bytes |
Load address: | 2B0D4556 |
Exec address: | D315450 |
File contents
PROGRAMMING TECHNIQUE by Dominic Ford Part 1: Designing a program In this series, I shall be showing you how to use your programming skills to achieve the best results that you can. I will assume that you can already program, at least in BASIC. If you cannot do so, you need to read either the User Guide's BASIC tutorial, or even better, a book such as "The Electron Book", which provides an excellent tutorial. Similarly, if you want to learn assembly language, you need a book such as "Electron Assembly Language" (Shiva), which provides a much better tutorial than EUG could ever provide, simply because no reader has enough time to write such a detailed tutorial, and besides, there is not enough room on EUG to publish such a long article. If you have any ideas for subjects that you want me to cover in Programming Technique, please do write into EUG and tell me about them. I already have plans for articles on graphics, sound, and memory mangement. Do you want details about any writing specific type of program? So, you have an idea for a program which you want to write. The first thing to do, before you start writing any code, is to visualise what the user will see and do when they use the program. If it is a game, imagine what the user will have to do, and what they will see on screen as they do it. Forget the title screen and introduction: these are fun to write, and although the user will see them first, before the actual program, you should program them last. Concentrate on the heart of the program first. You may have some important decisions to make. For example in an arcade adventure such as Shipwrecked, you must decide whether it is to scroll, or whether it is to be a flick screen game (like the original Shipwrecked). Next, you should start to plan out how the computer will achieve these results. Sketches are often a good idea, to show the flow of the program from one routine to another. One great decision which you must make is whether to use BASIC or machine code. If speed is important, machine code is useful, but if readability or ease of writing the code is important, BASIC is a good choice. A mixture can also be good in some circumstances. You may want to do the main body of the code in BASIC, where it is easily readable, and quick to write, and have the slower routines in machine code. Animation routines, for example, may need machine code for speed. Laser Darts is an example of such a program. I wrote the main loop in BASIC, but the animation of the laser is too slow for BASIC, so I did it in machine code. When the player fires a laser, I simply execute CALLlaser. But do not start any coding yet - your routines should stay simply as names in boxes for the moment. Your plans do not have to be that clear - in fact if they are too clear cut you may have problems if you cannot achieve quite the effect you want. You should leave room to make alterations if you cannot get the computer to produce the right effect, or simply if you discover a much better effect than the one you originally planned! Often effects which you think will be really good in fact looks or sounds dreadful in practise. On the other hand often the best effects are stumbled upon quite by accident. Now is the time to start programming. Pick one, and only one, of the routines on your diagram, and then write the code for that routine. It is very important that you do not code too much at any one go. Your program should start out very simple, and slowly work up to being something complex. You may even want to start with only half a routine, but whatever it is you need to be able to test it to ensure that it works faultlessly. When you start testing your routine, make sure that you save the program or source code first - the computer may well crash, in which case you could very easily lose your work. Do not be afraid to risk crashing the computer - test the routine as vigorously as possible. For example, if you are writing a routine to find the square root of a number, ask it what the root of -2 is (there is not one). Is the result acceptable? If not, fix it. Remember, if you ask for a number between 1 and 10, some user is bound to type 11, and your program should be prepared to deal with this. Even internal routines should check to see if they are called with illegal parameters. If a routine is called with the wrong parameters, it is much easier to trace the problem if your program says "ERROR AT 100" than if it simply does not operate in the way it should.
00000000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000010 20 20 20 20 20 20 20 20 20 50 52 4f 47 52 41 4d | PROGRAM| 00000020 4d 49 4e 47 20 54 45 43 48 4e 49 51 55 45 0d 20 |MING TECHNIQUE. | 00000030 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000040 20 20 20 20 20 20 20 20 20 20 20 62 79 20 44 6f | by Do| 00000050 6d 69 6e 69 63 20 46 6f 72 64 0d 20 20 20 20 20 |minic Ford. | 00000060 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000070 20 50 61 72 74 20 31 3a 20 44 65 73 69 67 6e 69 | Part 1: Designi| 00000080 6e 67 20 61 20 70 72 6f 67 72 61 6d 0d 0d 20 20 |ng a program.. | 00000090 20 20 20 49 6e 20 74 68 69 73 20 73 65 72 69 65 | In this serie| 000000a0 73 2c 20 49 20 73 68 61 6c 6c 20 62 65 20 73 68 |s, I shall be sh| 000000b0 6f 77 69 6e 67 20 79 6f 75 20 68 6f 77 20 74 6f |owing you how to| 000000c0 20 75 73 65 20 79 6f 75 72 20 70 72 6f 67 72 61 | use your progra| 000000d0 6d 6d 69 6e 67 0d 73 6b 69 6c 6c 73 20 74 6f 20 |mming.skills to | 000000e0 61 63 68 69 65 76 65 20 74 68 65 20 62 65 73 74 |achieve the best| 000000f0 20 72 65 73 75 6c 74 73 20 74 68 61 74 20 79 6f | results that yo| 00000100 75 20 63 61 6e 2e 20 49 20 77 69 6c 6c 20 61 73 |u can. I will as| 00000110 73 75 6d 65 20 74 68 61 74 20 79 6f 75 0d 63 61 |sume that you.ca| 00000120 6e 20 61 6c 72 65 61 64 79 20 70 72 6f 67 72 61 |n already progra| 00000130 6d 2c 20 61 74 20 6c 65 61 73 74 20 69 6e 20 42 |m, at least in B| 00000140 41 53 49 43 2e 20 49 66 20 79 6f 75 20 63 61 6e |ASIC. If you can| 00000150 6e 6f 74 20 64 6f 20 73 6f 2c 20 79 6f 75 20 6e |not do so, you n| 00000160 65 65 64 20 74 6f 0d 72 65 61 64 20 65 69 74 68 |eed to.read eith| 00000170 65 72 20 74 68 65 20 55 73 65 72 20 47 75 69 64 |er the User Guid| 00000180 65 27 73 20 42 41 53 49 43 20 74 75 74 6f 72 69 |e's BASIC tutori| 00000190 61 6c 2c 20 6f 72 20 65 76 65 6e 20 62 65 74 74 |al, or even bett| 000001a0 65 72 2c 20 61 20 62 6f 6f 6b 20 73 75 63 68 0d |er, a book such.| 000001b0 61 73 20 22 54 68 65 20 45 6c 65 63 74 72 6f 6e |as "The Electron| 000001c0 20 42 6f 6f 6b 22 2c 20 77 68 69 63 68 20 70 72 | Book", which pr| 000001d0 6f 76 69 64 65 73 20 61 6e 20 65 78 63 65 6c 6c |ovides an excell| 000001e0 65 6e 74 20 74 75 74 6f 72 69 61 6c 2e 20 53 69 |ent tutorial. Si| 000001f0 6d 69 6c 61 72 6c 79 2c 0d 69 66 20 79 6f 75 20 |milarly,.if you | 00000200 77 61 6e 74 20 74 6f 20 6c 65 61 72 6e 20 61 73 |want to learn as| 00000210 73 65 6d 62 6c 79 20 6c 61 6e 67 75 61 67 65 2c |sembly language,| 00000220 20 79 6f 75 20 6e 65 65 64 20 61 20 62 6f 6f 6b | you need a book| 00000230 20 73 75 63 68 20 61 73 20 22 45 6c 65 63 74 72 | such as "Electr| 00000240 6f 6e 0d 41 73 73 65 6d 62 6c 79 20 4c 61 6e 67 |on.Assembly Lang| 00000250 75 61 67 65 22 20 28 53 68 69 76 61 29 2c 20 77 |uage" (Shiva), w| 00000260 68 69 63 68 20 70 72 6f 76 69 64 65 73 20 61 20 |hich provides a | 00000270 6d 75 63 68 20 62 65 74 74 65 72 20 74 75 74 6f |much better tuto| 00000280 72 69 61 6c 20 74 68 61 6e 20 45 55 47 0d 63 6f |rial than EUG.co| 00000290 75 6c 64 20 65 76 65 72 20 70 72 6f 76 69 64 65 |uld ever provide| 000002a0 2c 20 73 69 6d 70 6c 79 20 62 65 63 61 75 73 65 |, simply because| 000002b0 20 6e 6f 20 72 65 61 64 65 72 20 68 61 73 20 65 | no reader has e| 000002c0 6e 6f 75 67 68 20 74 69 6d 65 20 74 6f 20 77 72 |nough time to wr| 000002d0 69 74 65 20 73 75 63 68 0d 61 20 64 65 74 61 69 |ite such.a detai| 000002e0 6c 65 64 20 74 75 74 6f 72 69 61 6c 2c 20 61 6e |led tutorial, an| 000002f0 64 20 62 65 73 69 64 65 73 2c 20 74 68 65 72 65 |d besides, there| 00000300 20 69 73 20 6e 6f 74 20 65 6e 6f 75 67 68 20 72 | is not enough r| 00000310 6f 6f 6d 20 6f 6e 20 45 55 47 20 74 6f 0d 70 75 |oom on EUG to.pu| 00000320 62 6c 69 73 68 20 73 75 63 68 20 61 20 6c 6f 6e |blish such a lon| 00000330 67 20 61 72 74 69 63 6c 65 2e 0d 20 20 20 20 20 |g article.. | 00000340 49 66 20 79 6f 75 20 68 61 76 65 20 61 6e 79 20 |If you have any | 00000350 69 64 65 61 73 20 66 6f 72 20 73 75 62 6a 65 63 |ideas for subjec| 00000360 74 73 20 74 68 61 74 20 79 6f 75 20 77 61 6e 74 |ts that you want| 00000370 20 6d 65 20 74 6f 20 63 6f 76 65 72 20 69 6e 0d | me to cover in.| 00000380 50 72 6f 67 72 61 6d 6d 69 6e 67 20 54 65 63 68 |Programming Tech| 00000390 6e 69 71 75 65 2c 20 70 6c 65 61 73 65 20 64 6f |nique, please do| 000003a0 20 77 72 69 74 65 20 69 6e 74 6f 20 45 55 47 20 | write into EUG | 000003b0 61 6e 64 20 74 65 6c 6c 20 6d 65 20 61 62 6f 75 |and tell me abou| 000003c0 74 20 74 68 65 6d 2e 20 49 0d 61 6c 72 65 61 64 |t them. I.alread| 000003d0 79 20 68 61 76 65 20 70 6c 61 6e 73 20 66 6f 72 |y have plans for| 000003e0 20 61 72 74 69 63 6c 65 73 20 6f 6e 20 67 72 61 | articles on gra| 000003f0 70 68 69 63 73 2c 20 73 6f 75 6e 64 2c 20 61 6e |phics, sound, an| 00000400 64 20 6d 65 6d 6f 72 79 20 6d 61 6e 67 65 6d 65 |d memory mangeme| 00000410 6e 74 2e 0d 44 6f 20 79 6f 75 20 77 61 6e 74 20 |nt..Do you want | 00000420 64 65 74 61 69 6c 73 20 61 62 6f 75 74 20 61 6e |details about an| 00000430 79 20 77 72 69 74 69 6e 67 20 73 70 65 63 69 66 |y writing specif| 00000440 69 63 20 74 79 70 65 20 6f 66 20 70 72 6f 67 72 |ic type of progr| 00000450 61 6d 3f 0d 20 20 20 20 20 53 6f 2c 20 79 6f 75 |am?. So, you| 00000460 20 68 61 76 65 20 61 6e 20 69 64 65 61 20 66 6f | have an idea fo| 00000470 72 20 61 20 70 72 6f 67 72 61 6d 20 77 68 69 63 |r a program whic| 00000480 68 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 77 72 |h you want to wr| 00000490 69 74 65 2e 20 54 68 65 0d 66 69 72 73 74 20 74 |ite. The.first t| 000004a0 68 69 6e 67 20 74 6f 20 64 6f 2c 20 62 65 66 6f |hing to do, befo| 000004b0 72 65 20 79 6f 75 20 73 74 61 72 74 20 77 72 69 |re you start wri| 000004c0 74 69 6e 67 20 61 6e 79 20 63 6f 64 65 2c 20 69 |ting any code, i| 000004d0 73 20 74 6f 20 76 69 73 75 61 6c 69 73 65 20 77 |s to visualise w| 000004e0 68 61 74 0d 74 68 65 20 75 73 65 72 20 77 69 6c |hat.the user wil| 000004f0 6c 20 73 65 65 20 61 6e 64 20 64 6f 20 77 68 65 |l see and do whe| 00000500 6e 20 74 68 65 79 20 75 73 65 20 74 68 65 20 70 |n they use the p| 00000510 72 6f 67 72 61 6d 2e 20 49 66 20 69 74 20 69 73 |rogram. If it is| 00000520 20 61 20 67 61 6d 65 2c 0d 69 6d 61 67 69 6e 65 | a game,.imagine| 00000530 20 77 68 61 74 20 74 68 65 20 75 73 65 72 20 77 | what the user w| 00000540 69 6c 6c 20 68 61 76 65 20 74 6f 20 64 6f 2c 20 |ill have to do, | 00000550 61 6e 64 20 77 68 61 74 20 74 68 65 79 20 77 69 |and what they wi| 00000560 6c 6c 20 73 65 65 20 6f 6e 20 73 63 72 65 65 6e |ll see on screen| 00000570 20 61 73 0d 74 68 65 79 20 64 6f 20 69 74 2e 20 | as.they do it. | 00000580 46 6f 72 67 65 74 20 74 68 65 20 74 69 74 6c 65 |Forget the title| 00000590 20 73 63 72 65 65 6e 20 61 6e 64 20 69 6e 74 72 | screen and intr| 000005a0 6f 64 75 63 74 69 6f 6e 3a 20 74 68 65 73 65 20 |oduction: these | 000005b0 61 72 65 20 66 75 6e 20 74 6f 0d 77 72 69 74 65 |are fun to.write| 000005c0 2c 20 61 6e 64 20 61 6c 74 68 6f 75 67 68 20 74 |, and although t| 000005d0 68 65 20 75 73 65 72 20 77 69 6c 6c 20 73 65 65 |he user will see| 000005e0 20 74 68 65 6d 20 66 69 72 73 74 2c 20 62 65 66 | them first, bef| 000005f0 6f 72 65 20 74 68 65 20 61 63 74 75 61 6c 0d 70 |ore the actual.p| 00000600 72 6f 67 72 61 6d 2c 20 79 6f 75 20 73 68 6f 75 |rogram, you shou| 00000610 6c 64 20 70 72 6f 67 72 61 6d 20 74 68 65 6d 20 |ld program them | 00000620 6c 61 73 74 2e 20 43 6f 6e 63 65 6e 74 72 61 74 |last. Concentrat| 00000630 65 20 6f 6e 20 74 68 65 20 68 65 61 72 74 20 6f |e on the heart o| 00000640 66 20 74 68 65 0d 70 72 6f 67 72 61 6d 20 66 69 |f the.program fi| 00000650 72 73 74 2e 20 59 6f 75 20 6d 61 79 20 68 61 76 |rst. You may hav| 00000660 65 20 73 6f 6d 65 20 69 6d 70 6f 72 74 61 6e 74 |e some important| 00000670 20 64 65 63 69 73 69 6f 6e 73 20 74 6f 20 6d 61 | decisions to ma| 00000680 6b 65 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 0d |ke. For example.| 00000690 69 6e 20 61 6e 20 61 72 63 61 64 65 20 61 64 76 |in an arcade adv| 000006a0 65 6e 74 75 72 65 20 73 75 63 68 20 61 73 20 53 |enture such as S| 000006b0 68 69 70 77 72 65 63 6b 65 64 2c 20 79 6f 75 20 |hipwrecked, you | 000006c0 6d 75 73 74 20 64 65 63 69 64 65 20 77 68 65 74 |must decide whet| 000006d0 68 65 72 20 69 74 20 69 73 0d 74 6f 20 73 63 72 |her it is.to scr| 000006e0 6f 6c 6c 2c 20 6f 72 20 77 68 65 74 68 65 72 20 |oll, or whether | 000006f0 69 74 20 69 73 20 74 6f 20 62 65 20 61 20 66 6c |it is to be a fl| 00000700 69 63 6b 20 73 63 72 65 65 6e 20 67 61 6d 65 20 |ick screen game | 00000710 28 6c 69 6b 65 20 74 68 65 20 6f 72 69 67 69 6e |(like the origin| 00000720 61 6c 0d 53 68 69 70 77 72 65 63 6b 65 64 29 2e |al.Shipwrecked).| 00000730 0d 20 20 20 20 20 4e 65 78 74 2c 20 79 6f 75 20 |. Next, you | 00000740 73 68 6f 75 6c 64 20 73 74 61 72 74 20 74 6f 20 |should start to | 00000750 70 6c 61 6e 20 6f 75 74 20 68 6f 77 20 74 68 65 |plan out how the| 00000760 20 63 6f 6d 70 75 74 65 72 20 77 69 6c 6c 20 61 | computer will a| 00000770 63 68 69 65 76 65 0d 74 68 65 73 65 20 72 65 73 |chieve.these res| 00000780 75 6c 74 73 2e 20 53 6b 65 74 63 68 65 73 20 61 |ults. Sketches a| 00000790 72 65 20 6f 66 74 65 6e 20 61 20 67 6f 6f 64 20 |re often a good | 000007a0 69 64 65 61 2c 20 74 6f 20 73 68 6f 77 20 74 68 |idea, to show th| 000007b0 65 20 66 6c 6f 77 20 6f 66 20 74 68 65 0d 70 72 |e flow of the.pr| 000007c0 6f 67 72 61 6d 20 66 72 6f 6d 20 6f 6e 65 20 72 |ogram from one r| 000007d0 6f 75 74 69 6e 65 20 74 6f 20 61 6e 6f 74 68 65 |outine to anothe| 000007e0 72 2e 20 4f 6e 65 20 67 72 65 61 74 20 64 65 63 |r. One great dec| 000007f0 69 73 69 6f 6e 20 77 68 69 63 68 20 79 6f 75 20 |ision which you | 00000800 6d 75 73 74 0d 6d 61 6b 65 20 69 73 20 77 68 65 |must.make is whe| 00000810 74 68 65 72 20 74 6f 20 75 73 65 20 42 41 53 49 |ther to use BASI| 00000820 43 20 6f 72 20 6d 61 63 68 69 6e 65 20 63 6f 64 |C or machine cod| 00000830 65 2e 20 49 66 20 73 70 65 65 64 20 69 73 20 69 |e. If speed is i| 00000840 6d 70 6f 72 74 61 6e 74 2c 0d 6d 61 63 68 69 6e |mportant,.machin| 00000850 65 20 63 6f 64 65 20 69 73 20 75 73 65 66 75 6c |e code is useful| 00000860 2c 20 62 75 74 20 69 66 20 72 65 61 64 61 62 69 |, but if readabi| 00000870 6c 69 74 79 20 6f 72 20 65 61 73 65 20 6f 66 20 |lity or ease of | 00000880 77 72 69 74 69 6e 67 20 74 68 65 20 63 6f 64 65 |writing the code| 00000890 20 69 73 0d 69 6d 70 6f 72 74 61 6e 74 2c 20 42 | is.important, B| 000008a0 41 53 49 43 20 69 73 20 61 20 67 6f 6f 64 20 63 |ASIC is a good c| 000008b0 68 6f 69 63 65 2e 20 41 20 6d 69 78 74 75 72 65 |hoice. A mixture| 000008c0 20 63 61 6e 20 61 6c 73 6f 20 62 65 20 67 6f 6f | can also be goo| 000008d0 64 20 69 6e 20 73 6f 6d 65 0d 63 69 72 63 75 6d |d in some.circum| 000008e0 73 74 61 6e 63 65 73 2e 20 59 6f 75 20 6d 61 79 |stances. You may| 000008f0 20 77 61 6e 74 20 74 6f 20 64 6f 20 74 68 65 20 | want to do the | 00000900 6d 61 69 6e 20 62 6f 64 79 20 6f 66 20 74 68 65 |main body of the| 00000910 20 63 6f 64 65 20 69 6e 20 42 41 53 49 43 2c 0d | code in BASIC,.| 00000920 77 68 65 72 65 20 69 74 20 69 73 20 65 61 73 69 |where it is easi| 00000930 6c 79 20 72 65 61 64 61 62 6c 65 2c 20 61 6e 64 |ly readable, and| 00000940 20 71 75 69 63 6b 20 74 6f 20 77 72 69 74 65 2c | quick to write,| 00000950 20 61 6e 64 20 68 61 76 65 20 74 68 65 20 73 6c | and have the sl| 00000960 6f 77 65 72 0d 72 6f 75 74 69 6e 65 73 20 69 6e |ower.routines in| 00000970 20 6d 61 63 68 69 6e 65 20 63 6f 64 65 2e 20 41 | machine code. A| 00000980 6e 69 6d 61 74 69 6f 6e 20 72 6f 75 74 69 6e 65 |nimation routine| 00000990 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 |s, for example, | 000009a0 6d 61 79 20 6e 65 65 64 0d 6d 61 63 68 69 6e 65 |may need.machine| 000009b0 20 63 6f 64 65 20 66 6f 72 20 73 70 65 65 64 2e | code for speed.| 000009c0 20 4c 61 73 65 72 20 44 61 72 74 73 20 69 73 20 | Laser Darts is | 000009d0 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 20 73 75 |an example of su| 000009e0 63 68 20 61 20 70 72 6f 67 72 61 6d 2e 20 49 0d |ch a program. I.| 000009f0 77 72 6f 74 65 20 74 68 65 20 6d 61 69 6e 20 6c |wrote the main l| 00000a00 6f 6f 70 20 69 6e 20 42 41 53 49 43 2c 20 62 75 |oop in BASIC, bu| 00000a10 74 20 74 68 65 20 61 6e 69 6d 61 74 69 6f 6e 20 |t the animation | 00000a20 6f 66 20 74 68 65 20 6c 61 73 65 72 20 69 73 20 |of the laser is | 00000a30 74 6f 6f 20 73 6c 6f 77 0d 66 6f 72 20 42 41 53 |too slow.for BAS| 00000a40 49 43 2c 20 73 6f 20 49 20 64 69 64 20 69 74 20 |IC, so I did it | 00000a50 69 6e 20 6d 61 63 68 69 6e 65 20 63 6f 64 65 2e |in machine code.| 00000a60 20 57 68 65 6e 20 74 68 65 20 70 6c 61 79 65 72 | When the player| 00000a70 20 66 69 72 65 73 20 61 20 6c 61 73 65 72 2c 20 | fires a laser, | 00000a80 49 0d 73 69 6d 70 6c 79 20 65 78 65 63 75 74 65 |I.simply execute| 00000a90 20 43 41 4c 4c 6c 61 73 65 72 2e 0d 20 20 20 20 | CALLlaser.. | 00000aa0 20 42 75 74 20 64 6f 20 6e 6f 74 20 73 74 61 72 | But do not star| 00000ab0 74 20 61 6e 79 20 63 6f 64 69 6e 67 20 79 65 74 |t any coding yet| 00000ac0 20 2d 20 79 6f 75 72 20 72 6f 75 74 69 6e 65 73 | - your routines| 00000ad0 20 73 68 6f 75 6c 64 20 73 74 61 79 20 73 69 6d | should stay sim| 00000ae0 70 6c 79 20 61 73 0d 6e 61 6d 65 73 20 69 6e 20 |ply as.names in | 00000af0 62 6f 78 65 73 20 66 6f 72 20 74 68 65 20 6d 6f |boxes for the mo| 00000b00 6d 65 6e 74 2e 20 59 6f 75 72 20 70 6c 61 6e 73 |ment. Your plans| 00000b10 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 74 6f 20 | do not have to | 00000b20 62 65 20 74 68 61 74 20 63 6c 65 61 72 20 2d 0d |be that clear -.| 00000b30 69 6e 20 66 61 63 74 20 69 66 20 74 68 65 79 20 |in fact if they | 00000b40 61 72 65 20 74 6f 6f 20 63 6c 65 61 72 20 63 75 |are too clear cu| 00000b50 74 20 79 6f 75 20 6d 61 79 20 68 61 76 65 20 70 |t you may have p| 00000b60 72 6f 62 6c 65 6d 73 20 69 66 20 79 6f 75 20 63 |roblems if you c| 00000b70 61 6e 6e 6f 74 0d 61 63 68 69 65 76 65 20 71 75 |annot.achieve qu| 00000b80 69 74 65 20 74 68 65 20 65 66 66 65 63 74 20 79 |ite the effect y| 00000b90 6f 75 20 77 61 6e 74 2e 20 59 6f 75 20 73 68 6f |ou want. You sho| 00000ba0 75 6c 64 20 6c 65 61 76 65 20 72 6f 6f 6d 20 74 |uld leave room t| 00000bb0 6f 20 6d 61 6b 65 0d 61 6c 74 65 72 61 74 69 6f |o make.alteratio| 00000bc0 6e 73 20 69 66 20 79 6f 75 20 63 61 6e 6e 6f 74 |ns if you cannot| 00000bd0 20 67 65 74 20 74 68 65 20 63 6f 6d 70 75 74 65 | get the compute| 00000be0 72 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 |r to produce the| 00000bf0 20 72 69 67 68 74 20 65 66 66 65 63 74 2c 20 6f | right effect, o| 00000c00 72 0d 73 69 6d 70 6c 79 20 69 66 20 79 6f 75 20 |r.simply if you | 00000c10 64 69 73 63 6f 76 65 72 20 61 20 6d 75 63 68 20 |discover a much | 00000c20 62 65 74 74 65 72 20 65 66 66 65 63 74 20 74 68 |better effect th| 00000c30 61 6e 20 74 68 65 20 6f 6e 65 20 79 6f 75 20 6f |an the one you o| 00000c40 72 69 67 69 6e 61 6c 6c 79 0d 70 6c 61 6e 6e 65 |riginally.planne| 00000c50 64 21 20 4f 66 74 65 6e 20 65 66 66 65 63 74 73 |d! Often effects| 00000c60 20 77 68 69 63 68 20 79 6f 75 20 74 68 69 6e 6b | which you think| 00000c70 20 77 69 6c 6c 20 62 65 20 72 65 61 6c 6c 79 20 | will be really | 00000c80 67 6f 6f 64 20 69 6e 20 66 61 63 74 20 6c 6f 6f |good in fact loo| 00000c90 6b 73 0d 6f 72 20 73 6f 75 6e 64 73 20 64 72 65 |ks.or sounds dre| 00000ca0 61 64 66 75 6c 20 69 6e 20 70 72 61 63 74 69 73 |adful in practis| 00000cb0 65 2e 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 |e. On the other | 00000cc0 68 61 6e 64 20 6f 66 74 65 6e 20 74 68 65 20 62 |hand often the b| 00000cd0 65 73 74 20 65 66 66 65 63 74 73 0d 61 72 65 20 |est effects.are | 00000ce0 73 74 75 6d 62 6c 65 64 20 75 70 6f 6e 20 71 75 |stumbled upon qu| 00000cf0 69 74 65 20 62 79 20 61 63 63 69 64 65 6e 74 2e |ite by accident.| 00000d00 0d 20 20 20 20 20 4e 6f 77 20 69 73 20 74 68 65 |. Now is the| 00000d10 20 74 69 6d 65 20 74 6f 20 73 74 61 72 74 20 70 | time to start p| 00000d20 72 6f 67 72 61 6d 6d 69 6e 67 2e 20 50 69 63 6b |rogramming. Pick| 00000d30 20 6f 6e 65 2c 20 61 6e 64 20 6f 6e 6c 79 20 6f | one, and only o| 00000d40 6e 65 2c 20 6f 66 0d 74 68 65 20 72 6f 75 74 69 |ne, of.the routi| 00000d50 6e 65 73 20 6f 6e 20 79 6f 75 72 20 64 69 61 67 |nes on your diag| 00000d60 72 61 6d 2c 20 61 6e 64 20 74 68 65 6e 20 77 72 |ram, and then wr| 00000d70 69 74 65 20 74 68 65 20 63 6f 64 65 20 66 6f 72 |ite the code for| 00000d80 20 74 68 61 74 20 72 6f 75 74 69 6e 65 2e 20 49 | that routine. I| 00000d90 74 0d 69 73 20 76 65 72 79 20 69 6d 70 6f 72 74 |t.is very import| 00000da0 61 6e 74 20 74 68 61 74 20 79 6f 75 20 64 6f 20 |ant that you do | 00000db0 6e 6f 74 20 63 6f 64 65 20 74 6f 6f 20 6d 75 63 |not code too muc| 00000dc0 68 20 61 74 20 61 6e 79 20 6f 6e 65 20 67 6f 2e |h at any one go.| 00000dd0 20 59 6f 75 72 0d 70 72 6f 67 72 61 6d 20 73 68 | Your.program sh| 00000de0 6f 75 6c 64 20 73 74 61 72 74 20 6f 75 74 20 76 |ould start out v| 00000df0 65 72 79 20 73 69 6d 70 6c 65 2c 20 61 6e 64 20 |ery simple, and | 00000e00 73 6c 6f 77 6c 79 20 77 6f 72 6b 20 75 70 20 74 |slowly work up t| 00000e10 6f 20 62 65 69 6e 67 0d 73 6f 6d 65 74 68 69 6e |o being.somethin| 00000e20 67 20 63 6f 6d 70 6c 65 78 2e 20 59 6f 75 20 6d |g complex. You m| 00000e30 61 79 20 65 76 65 6e 20 77 61 6e 74 20 74 6f 20 |ay even want to | 00000e40 73 74 61 72 74 20 77 69 74 68 20 6f 6e 6c 79 20 |start with only | 00000e50 68 61 6c 66 20 61 20 72 6f 75 74 69 6e 65 2c 0d |half a routine,.| 00000e60 62 75 74 20 77 68 61 74 65 76 65 72 20 69 74 20 |but whatever it | 00000e70 69 73 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 62 |is you need to b| 00000e80 65 20 61 62 6c 65 20 74 6f 20 74 65 73 74 20 69 |e able to test i| 00000e90 74 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 74 |t to ensure that| 00000ea0 20 69 74 20 77 6f 72 6b 73 0d 66 61 75 6c 74 6c | it works.faultl| 00000eb0 65 73 73 6c 79 2e 0d 20 20 20 20 20 57 68 65 6e |essly.. When| 00000ec0 20 79 6f 75 20 73 74 61 72 74 20 74 65 73 74 69 | you start testi| 00000ed0 6e 67 20 79 6f 75 72 20 72 6f 75 74 69 6e 65 2c |ng your routine,| 00000ee0 20 6d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 | make sure that | 00000ef0 79 6f 75 20 73 61 76 65 20 74 68 65 0d 70 72 6f |you save the.pro| 00000f00 67 72 61 6d 20 6f 72 20 73 6f 75 72 63 65 20 63 |gram or source c| 00000f10 6f 64 65 20 66 69 72 73 74 20 2d 20 74 68 65 20 |ode first - the | 00000f20 63 6f 6d 70 75 74 65 72 20 6d 61 79 20 77 65 6c |computer may wel| 00000f30 6c 20 63 72 61 73 68 2c 20 69 6e 20 77 68 69 63 |l crash, in whic| 00000f40 68 20 63 61 73 65 0d 79 6f 75 20 63 6f 75 6c 64 |h case.you could| 00000f50 20 76 65 72 79 20 65 61 73 69 6c 79 20 6c 6f 73 | very easily los| 00000f60 65 20 79 6f 75 72 20 77 6f 72 6b 2e 20 44 6f 20 |e your work. Do | 00000f70 6e 6f 74 20 62 65 20 61 66 72 61 69 64 20 74 6f |not be afraid to| 00000f80 20 72 69 73 6b 20 63 72 61 73 68 69 6e 67 0d 74 | risk crashing.t| 00000f90 68 65 20 63 6f 6d 70 75 74 65 72 20 2d 20 74 65 |he computer - te| 00000fa0 73 74 20 74 68 65 20 72 6f 75 74 69 6e 65 20 61 |st the routine a| 00000fb0 73 20 76 69 67 6f 72 6f 75 73 6c 79 20 61 73 20 |s vigorously as | 00000fc0 70 6f 73 73 69 62 6c 65 2e 20 46 6f 72 20 65 78 |possible. For ex| 00000fd0 61 6d 70 6c 65 2c 20 69 66 0d 79 6f 75 20 61 72 |ample, if.you ar| 00000fe0 65 20 77 72 69 74 69 6e 67 20 61 20 72 6f 75 74 |e writing a rout| 00000ff0 69 6e 65 20 74 6f 20 66 69 6e 64 20 74 68 65 20 |ine to find the | 00001000 73 71 75 61 72 65 20 72 6f 6f 74 20 6f 66 20 61 |square root of a| 00001010 20 6e 75 6d 62 65 72 2c 20 61 73 6b 20 69 74 20 | number, ask it | 00001020 77 68 61 74 0d 74 68 65 20 72 6f 6f 74 20 6f 66 |what.the root of| 00001030 20 2d 32 20 69 73 20 28 74 68 65 72 65 20 69 73 | -2 is (there is| 00001040 20 6e 6f 74 20 6f 6e 65 29 2e 20 49 73 20 74 68 | not one). Is th| 00001050 65 20 72 65 73 75 6c 74 20 61 63 63 65 70 74 61 |e result accepta| 00001060 62 6c 65 3f 20 49 66 20 6e 6f 74 2c 0d 66 69 78 |ble? If not,.fix| 00001070 20 69 74 2e 20 52 65 6d 65 6d 62 65 72 2c 20 69 | it. Remember, i| 00001080 66 20 79 6f 75 20 61 73 6b 20 66 6f 72 20 61 20 |f you ask for a | 00001090 6e 75 6d 62 65 72 20 62 65 74 77 65 65 6e 20 31 |number between 1| 000010a0 20 61 6e 64 20 31 30 2c 20 73 6f 6d 65 20 75 73 | and 10, some us| 000010b0 65 72 20 69 73 0d 62 6f 75 6e 64 20 74 6f 20 74 |er is.bound to t| 000010c0 79 70 65 20 31 31 2c 20 61 6e 64 20 79 6f 75 72 |ype 11, and your| 000010d0 20 70 72 6f 67 72 61 6d 20 73 68 6f 75 6c 64 20 | program should | 000010e0 62 65 20 70 72 65 70 61 72 65 64 20 74 6f 20 64 |be prepared to d| 000010f0 65 61 6c 20 77 69 74 68 20 74 68 69 73 2e 0d 45 |eal with this..E| 00001100 76 65 6e 20 69 6e 74 65 72 6e 61 6c 20 72 6f 75 |ven internal rou| 00001110 74 69 6e 65 73 20 73 68 6f 75 6c 64 20 63 68 65 |tines should che| 00001120 63 6b 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 |ck to see if the| 00001130 79 20 61 72 65 20 63 61 6c 6c 65 64 20 77 69 74 |y are called wit| 00001140 68 20 69 6c 6c 65 67 61 6c 0d 70 61 72 61 6d 65 |h illegal.parame| 00001150 74 65 72 73 2e 20 49 66 20 61 20 72 6f 75 74 69 |ters. If a routi| 00001160 6e 65 20 69 73 20 63 61 6c 6c 65 64 20 77 69 74 |ne is called wit| 00001170 68 20 74 68 65 20 77 72 6f 6e 67 20 70 61 72 61 |h the wrong para| 00001180 6d 65 74 65 72 73 2c 20 69 74 20 69 73 20 6d 75 |meters, it is mu| 00001190 63 68 0d 65 61 73 69 65 72 20 74 6f 20 74 72 61 |ch.easier to tra| 000011a0 63 65 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 69 |ce the problem i| 000011b0 66 20 79 6f 75 72 20 70 72 6f 67 72 61 6d 20 73 |f your program s| 000011c0 61 79 73 20 22 45 52 52 4f 52 20 41 54 20 31 30 |ays "ERROR AT 10| 000011d0 30 22 20 74 68 61 6e 20 69 66 20 69 74 0d 73 69 |0" than if it.si| 000011e0 6d 70 6c 79 20 64 6f 65 73 20 6e 6f 74 20 6f 70 |mply does not op| 000011f0 65 72 61 74 65 20 69 6e 20 74 68 65 20 77 61 79 |erate in the way| 00001200 20 69 74 20 73 68 6f 75 6c 64 2e 0d | it should..| 0000120c