Home » Personal collection » Acorn ADFS disks » Archimedes » Unlabelled_disk_2.ADF » +PT1

+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 » Archimedes » Unlabelled_disk_2.ADF
Filename: +PT1
Read OK:
File size: 1288 bytes
Load address: 2B206576
Exec address: D315450
Duplicates

There is 1 duplicate copy of this file in the archive:

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? If you
prefer using email to sending comments into EUG, I have a temporary
address, which is: "dominic@reigram.demon.co.uk"
     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 20 49 66 20 79  6f 75 0d 70 72 65 66 65  |am? If you.prefe|
00000460  72 20 75 73 69 6e 67 20  65 6d 61 69 6c 20 74 6f  |r using email to|
00000470  20 73 65 6e 64 69 6e 67  20 63 6f 6d 6d 65 6e 74  | sending comment|
00000480  73 20 69 6e 74 6f 20 45  55 47 2c 20 49 20 68 61  |s into EUG, I ha|
00000490  76 65 20 61 20 74 65 6d  70 6f 72 61 72 79 0d 61  |ve a temporary.a|
000004a0  64 64 72 65 73 73 2c 20  77 68 69 63 68 20 69 73  |ddress, which is|
000004b0  3a 20 22 64 6f 6d 69 6e  69 63 40 72 65 69 67 72  |: "dominic@reigr|
000004c0  61 6d 2e 64 65 6d 6f 6e  2e 63 6f 2e 75 6b 22 0d  |am.demon.co.uk".|
000004d0  20 20 20 20 20 53 6f 2c  20 79 6f 75 20 68 61 76  |     So, you hav|
000004e0  65 20 61 6e 20 69 64 65  61 20 66 6f 72 20 61 20  |e an idea for a |
000004f0  70 72 6f 67 72 61 6d 20  77 68 69 63 68 20 79 6f  |program which yo|
00000500  75 20 77 61 6e 74 20 74  6f 20 77 72 69 74 65 2e  |u want to write.|
00000510  20 54 68 65 0d 66 69 72  73 74 20 74 68 69 6e 67  | The.first thing|
00000520  20 74 6f 20 64 6f 2c 20  62 65 66 6f 72 65 20 79  | to do, before y|
00000530  6f 75 20 73 74 61 72 74  20 77 72 69 74 69 6e 67  |ou start writing|
00000540  20 61 6e 79 20 63 6f 64  65 2c 20 69 73 20 74 6f  | any code, is to|
00000550  20 76 69 73 75 61 6c 69  73 65 20 77 68 61 74 0d  | visualise what.|
00000560  74 68 65 20 75 73 65 72  20 77 69 6c 6c 20 73 65  |the user will se|
00000570  65 20 61 6e 64 20 64 6f  20 77 68 65 6e 20 74 68  |e and do when th|
00000580  65 79 20 75 73 65 20 74  68 65 20 70 72 6f 67 72  |ey use the progr|
00000590  61 6d 2e 20 49 66 20 69  74 20 69 73 20 61 20 67  |am. If it is a g|
000005a0  61 6d 65 2c 0d 69 6d 61  67 69 6e 65 20 77 68 61  |ame,.imagine wha|
000005b0  74 20 74 68 65 20 75 73  65 72 20 77 69 6c 6c 20  |t the user will |
000005c0  68 61 76 65 20 74 6f 20  64 6f 2c 20 61 6e 64 20  |have to do, and |
000005d0  77 68 61 74 20 74 68 65  79 20 77 69 6c 6c 20 73  |what they will s|
000005e0  65 65 20 6f 6e 20 73 63  72 65 65 6e 20 61 73 0d  |ee on screen as.|
000005f0  74 68 65 79 20 64 6f 20  69 74 2e 20 46 6f 72 67  |they do it. Forg|
00000600  65 74 20 74 68 65 20 74  69 74 6c 65 20 73 63 72  |et the title scr|
00000610  65 65 6e 20 61 6e 64 20  69 6e 74 72 6f 64 75 63  |een and introduc|
00000620  74 69 6f 6e 3a 20 74 68  65 73 65 20 61 72 65 20  |tion: these are |
00000630  66 75 6e 20 74 6f 0d 77  72 69 74 65 2c 20 61 6e  |fun to.write, an|
00000640  64 20 61 6c 74 68 6f 75  67 68 20 74 68 65 20 75  |d although the u|
00000650  73 65 72 20 77 69 6c 6c  20 73 65 65 20 74 68 65  |ser will see the|
00000660  6d 20 66 69 72 73 74 2c  20 62 65 66 6f 72 65 20  |m first, before |
00000670  74 68 65 20 61 63 74 75  61 6c 0d 70 72 6f 67 72  |the actual.progr|
00000680  61 6d 2c 20 79 6f 75 20  73 68 6f 75 6c 64 20 70  |am, you should p|
00000690  72 6f 67 72 61 6d 20 74  68 65 6d 20 6c 61 73 74  |rogram them last|
000006a0  2e 20 43 6f 6e 63 65 6e  74 72 61 74 65 20 6f 6e  |. Concentrate on|
000006b0  20 74 68 65 20 68 65 61  72 74 20 6f 66 20 74 68  | the heart of th|
000006c0  65 0d 70 72 6f 67 72 61  6d 20 66 69 72 73 74 2e  |e.program first.|
000006d0  20 59 6f 75 20 6d 61 79  20 68 61 76 65 20 73 6f  | You may have so|
000006e0  6d 65 20 69 6d 70 6f 72  74 61 6e 74 20 64 65 63  |me important dec|
000006f0  69 73 69 6f 6e 73 20 74  6f 20 6d 61 6b 65 2e 20  |isions to make. |
00000700  46 6f 72 20 65 78 61 6d  70 6c 65 0d 69 6e 20 61  |For example.in a|
00000710  6e 20 61 72 63 61 64 65  20 61 64 76 65 6e 74 75  |n arcade adventu|
00000720  72 65 20 73 75 63 68 20  61 73 20 53 68 69 70 77  |re such as Shipw|
00000730  72 65 63 6b 65 64 2c 20  79 6f 75 20 6d 75 73 74  |recked, you must|
00000740  20 64 65 63 69 64 65 20  77 68 65 74 68 65 72 20  | decide whether |
00000750  69 74 20 69 73 0d 74 6f  20 73 63 72 6f 6c 6c 2c  |it is.to scroll,|
00000760  20 6f 72 20 77 68 65 74  68 65 72 20 69 74 20 69  | or whether it i|
00000770  73 20 74 6f 20 62 65 20  61 20 66 6c 69 63 6b 20  |s to be a flick |
00000780  73 63 72 65 65 6e 20 67  61 6d 65 20 28 6c 69 6b  |screen game (lik|
00000790  65 20 74 68 65 20 6f 72  69 67 69 6e 61 6c 0d 53  |e the original.S|
000007a0  68 69 70 77 72 65 63 6b  65 64 29 2e 0d 20 20 20  |hipwrecked)..   |
000007b0  20 20 4e 65 78 74 2c 20  79 6f 75 20 73 68 6f 75  |  Next, you shou|
000007c0  6c 64 20 73 74 61 72 74  20 74 6f 20 70 6c 61 6e  |ld start to plan|
000007d0  20 6f 75 74 20 68 6f 77  20 74 68 65 20 63 6f 6d  | out how the com|
000007e0  70 75 74 65 72 20 77 69  6c 6c 20 61 63 68 69 65  |puter will achie|
000007f0  76 65 0d 74 68 65 73 65  20 72 65 73 75 6c 74 73  |ve.these results|
00000800  2e 20 53 6b 65 74 63 68  65 73 20 61 72 65 20 6f  |. Sketches are o|
00000810  66 74 65 6e 20 61 20 67  6f 6f 64 20 69 64 65 61  |ften a good idea|
00000820  2c 20 74 6f 20 73 68 6f  77 20 74 68 65 20 66 6c  |, to show the fl|
00000830  6f 77 20 6f 66 20 74 68  65 0d 70 72 6f 67 72 61  |ow of the.progra|
00000840  6d 20 66 72 6f 6d 20 6f  6e 65 20 72 6f 75 74 69  |m from one routi|
00000850  6e 65 20 74 6f 20 61 6e  6f 74 68 65 72 2e 20 4f  |ne to another. O|
00000860  6e 65 20 67 72 65 61 74  20 64 65 63 69 73 69 6f  |ne great decisio|
00000870  6e 20 77 68 69 63 68 20  79 6f 75 20 6d 75 73 74  |n which you must|
00000880  0d 6d 61 6b 65 20 69 73  20 77 68 65 74 68 65 72  |.make is whether|
00000890  20 74 6f 20 75 73 65 20  42 41 53 49 43 20 6f 72  | to use BASIC or|
000008a0  20 6d 61 63 68 69 6e 65  20 63 6f 64 65 2e 20 49  | machine code. I|
000008b0  66 20 73 70 65 65 64 20  69 73 20 69 6d 70 6f 72  |f speed is impor|
000008c0  74 61 6e 74 2c 0d 6d 61  63 68 69 6e 65 20 63 6f  |tant,.machine co|
000008d0  64 65 20 69 73 20 75 73  65 66 75 6c 2c 20 62 75  |de is useful, bu|
000008e0  74 20 69 66 20 72 65 61  64 61 62 69 6c 69 74 79  |t if readability|
000008f0  20 6f 72 20 65 61 73 65  20 6f 66 20 77 72 69 74  | or ease of writ|
00000900  69 6e 67 20 74 68 65 20  63 6f 64 65 20 69 73 0d  |ing the code is.|
00000910  69 6d 70 6f 72 74 61 6e  74 2c 20 42 41 53 49 43  |important, BASIC|
00000920  20 69 73 20 61 20 67 6f  6f 64 20 63 68 6f 69 63  | is a good choic|
00000930  65 2e 20 41 20 6d 69 78  74 75 72 65 20 63 61 6e  |e. A mixture can|
00000940  20 61 6c 73 6f 20 62 65  20 67 6f 6f 64 20 69 6e  | also be good in|
00000950  20 73 6f 6d 65 0d 63 69  72 63 75 6d 73 74 61 6e  | some.circumstan|
00000960  63 65 73 2e 20 59 6f 75  20 6d 61 79 20 77 61 6e  |ces. You may wan|
00000970  74 20 74 6f 20 64 6f 20  74 68 65 20 6d 61 69 6e  |t to do the main|
00000980  20 62 6f 64 79 20 6f 66  20 74 68 65 20 63 6f 64  | body of the cod|
00000990  65 20 69 6e 20 42 41 53  49 43 2c 0d 77 68 65 72  |e in BASIC,.wher|
000009a0  65 20 69 74 20 69 73 20  65 61 73 69 6c 79 20 72  |e it is easily r|
000009b0  65 61 64 61 62 6c 65 2c  20 61 6e 64 20 71 75 69  |eadable, and qui|
000009c0  63 6b 20 74 6f 20 77 72  69 74 65 2c 20 61 6e 64  |ck to write, and|
000009d0  20 68 61 76 65 20 74 68  65 20 73 6c 6f 77 65 72  | have the slower|
000009e0  0d 72 6f 75 74 69 6e 65  73 20 69 6e 20 6d 61 63  |.routines in mac|
000009f0  68 69 6e 65 20 63 6f 64  65 2e 20 41 6e 69 6d 61  |hine code. Anima|
00000a00  74 69 6f 6e 20 72 6f 75  74 69 6e 65 73 2c 20 66  |tion routines, f|
00000a10  6f 72 20 65 78 61 6d 70  6c 65 2c 20 6d 61 79 20  |or example, may |
00000a20  6e 65 65 64 0d 6d 61 63  68 69 6e 65 20 63 6f 64  |need.machine cod|
00000a30  65 20 66 6f 72 20 73 70  65 65 64 2e 20 4c 61 73  |e for speed. Las|
00000a40  65 72 20 44 61 72 74 73  20 69 73 20 61 6e 20 65  |er Darts is an e|
00000a50  78 61 6d 70 6c 65 20 6f  66 20 73 75 63 68 20 61  |xample of such a|
00000a60  20 70 72 6f 67 72 61 6d  2e 20 49 0d 77 72 6f 74  | program. I.wrot|
00000a70  65 20 74 68 65 20 6d 61  69 6e 20 6c 6f 6f 70 20  |e the main loop |
00000a80  69 6e 20 42 41 53 49 43  2c 20 62 75 74 20 74 68  |in BASIC, but th|
00000a90  65 20 61 6e 69 6d 61 74  69 6f 6e 20 6f 66 20 74  |e animation of t|
00000aa0  68 65 20 6c 61 73 65 72  20 69 73 20 74 6f 6f 20  |he laser is too |
00000ab0  73 6c 6f 77 0d 66 6f 72  20 42 41 53 49 43 2c 20  |slow.for BASIC, |
00000ac0  73 6f 20 49 20 64 69 64  20 69 74 20 69 6e 20 6d  |so I did it in m|
00000ad0  61 63 68 69 6e 65 20 63  6f 64 65 2e 20 57 68 65  |achine code. Whe|
00000ae0  6e 20 74 68 65 20 70 6c  61 79 65 72 20 66 69 72  |n the player fir|
00000af0  65 73 20 61 20 6c 61 73  65 72 2c 20 49 0d 73 69  |es a laser, I.si|
00000b00  6d 70 6c 79 20 65 78 65  63 75 74 65 20 43 41 4c  |mply execute CAL|
00000b10  4c 6c 61 73 65 72 2e 0d  20 20 20 20 20 42 75 74  |Llaser..     But|
00000b20  20 64 6f 20 6e 6f 74 20  73 74 61 72 74 20 61 6e  | do not start an|
00000b30  79 20 63 6f 64 69 6e 67  20 79 65 74 20 2d 20 79  |y coding yet - y|
00000b40  6f 75 72 20 72 6f 75 74  69 6e 65 73 20 73 68 6f  |our routines sho|
00000b50  75 6c 64 20 73 74 61 79  20 73 69 6d 70 6c 79 20  |uld stay simply |
00000b60  61 73 0d 6e 61 6d 65 73  20 69 6e 20 62 6f 78 65  |as.names in boxe|
00000b70  73 20 66 6f 72 20 74 68  65 20 6d 6f 6d 65 6e 74  |s for the moment|
00000b80  2e 20 59 6f 75 72 20 70  6c 61 6e 73 20 64 6f 20  |. Your plans do |
00000b90  6e 6f 74 20 68 61 76 65  20 74 6f 20 62 65 20 74  |not have to be t|
00000ba0  68 61 74 20 63 6c 65 61  72 20 2d 0d 69 6e 20 66  |hat clear -.in f|
00000bb0  61 63 74 20 69 66 20 74  68 65 79 20 61 72 65 20  |act if they are |
00000bc0  74 6f 6f 20 63 6c 65 61  72 20 63 75 74 20 79 6f  |too clear cut yo|
00000bd0  75 20 6d 61 79 20 68 61  76 65 20 70 72 6f 62 6c  |u may have probl|
00000be0  65 6d 73 20 69 66 20 79  6f 75 20 63 61 6e 6e 6f  |ems if you canno|
00000bf0  74 0d 61 63 68 69 65 76  65 20 71 75 69 74 65 20  |t.achieve quite |
00000c00  74 68 65 20 65 66 66 65  63 74 20 79 6f 75 20 77  |the effect you w|
00000c10  61 6e 74 2e 20 59 6f 75  20 73 68 6f 75 6c 64 20  |ant. You should |
00000c20  6c 65 61 76 65 20 72 6f  6f 6d 20 74 6f 20 6d 61  |leave room to ma|
00000c30  6b 65 0d 61 6c 74 65 72  61 74 69 6f 6e 73 20 69  |ke.alterations i|
00000c40  66 20 79 6f 75 20 63 61  6e 6e 6f 74 20 67 65 74  |f you cannot get|
00000c50  20 74 68 65 20 63 6f 6d  70 75 74 65 72 20 74 6f  | the computer to|
00000c60  20 70 72 6f 64 75 63 65  20 74 68 65 20 72 69 67  | produce the rig|
00000c70  68 74 20 65 66 66 65 63  74 2c 20 6f 72 0d 73 69  |ht effect, or.si|
00000c80  6d 70 6c 79 20 69 66 20  79 6f 75 20 64 69 73 63  |mply if you disc|
00000c90  6f 76 65 72 20 61 20 6d  75 63 68 20 62 65 74 74  |over a much bett|
00000ca0  65 72 20 65 66 66 65 63  74 20 74 68 61 6e 20 74  |er effect than t|
00000cb0  68 65 20 6f 6e 65 20 79  6f 75 20 6f 72 69 67 69  |he one you origi|
00000cc0  6e 61 6c 6c 79 0d 70 6c  61 6e 6e 65 64 21 20 4f  |nally.planned! O|
00000cd0  66 74 65 6e 20 65 66 66  65 63 74 73 20 77 68 69  |ften effects whi|
00000ce0  63 68 20 79 6f 75 20 74  68 69 6e 6b 20 77 69 6c  |ch you think wil|
00000cf0  6c 20 62 65 20 72 65 61  6c 6c 79 20 67 6f 6f 64  |l be really good|
00000d00  20 69 6e 20 66 61 63 74  20 6c 6f 6f 6b 73 0d 6f  | in fact looks.o|
00000d10  72 20 73 6f 75 6e 64 73  20 64 72 65 61 64 66 75  |r sounds dreadfu|
00000d20  6c 20 69 6e 20 70 72 61  63 74 69 73 65 2e 20 4f  |l in practise. O|
00000d30  6e 20 74 68 65 20 6f 74  68 65 72 20 68 61 6e 64  |n the other hand|
00000d40  20 6f 66 74 65 6e 20 74  68 65 20 62 65 73 74 20  | often the best |
00000d50  65 66 66 65 63 74 73 0d  61 72 65 20 73 74 75 6d  |effects.are stum|
00000d60  62 6c 65 64 20 75 70 6f  6e 20 71 75 69 74 65 20  |bled upon quite |
00000d70  62 79 20 61 63 63 69 64  65 6e 74 2e 0d 20 20 20  |by accident..   |
00000d80  20 20 4e 6f 77 20 69 73  20 74 68 65 20 74 69 6d  |  Now is the tim|
00000d90  65 20 74 6f 20 73 74 61  72 74 20 70 72 6f 67 72  |e to start progr|
00000da0  61 6d 6d 69 6e 67 2e 20  50 69 63 6b 20 6f 6e 65  |amming. Pick one|
00000db0  2c 20 61 6e 64 20 6f 6e  6c 79 20 6f 6e 65 2c 20  |, and only one, |
00000dc0  6f 66 0d 74 68 65 20 72  6f 75 74 69 6e 65 73 20  |of.the routines |
00000dd0  6f 6e 20 79 6f 75 72 20  64 69 61 67 72 61 6d 2c  |on your diagram,|
00000de0  20 61 6e 64 20 74 68 65  6e 20 77 72 69 74 65 20  | and then write |
00000df0  74 68 65 20 63 6f 64 65  20 66 6f 72 20 74 68 61  |the code for tha|
00000e00  74 20 72 6f 75 74 69 6e  65 2e 20 49 74 0d 69 73  |t routine. It.is|
00000e10  20 76 65 72 79 20 69 6d  70 6f 72 74 61 6e 74 20  | very important |
00000e20  74 68 61 74 20 79 6f 75  20 64 6f 20 6e 6f 74 20  |that you do not |
00000e30  63 6f 64 65 20 74 6f 6f  20 6d 75 63 68 20 61 74  |code too much at|
00000e40  20 61 6e 79 20 6f 6e 65  20 67 6f 2e 20 59 6f 75  | any one go. You|
00000e50  72 0d 70 72 6f 67 72 61  6d 20 73 68 6f 75 6c 64  |r.program should|
00000e60  20 73 74 61 72 74 20 6f  75 74 20 76 65 72 79 20  | start out very |
00000e70  73 69 6d 70 6c 65 2c 20  61 6e 64 20 73 6c 6f 77  |simple, and slow|
00000e80  6c 79 20 77 6f 72 6b 20  75 70 20 74 6f 20 62 65  |ly work up to be|
00000e90  69 6e 67 0d 73 6f 6d 65  74 68 69 6e 67 20 63 6f  |ing.something co|
00000ea0  6d 70 6c 65 78 2e 20 59  6f 75 20 6d 61 79 20 65  |mplex. You may e|
00000eb0  76 65 6e 20 77 61 6e 74  20 74 6f 20 73 74 61 72  |ven want to star|
00000ec0  74 20 77 69 74 68 20 6f  6e 6c 79 20 68 61 6c 66  |t with only half|
00000ed0  20 61 20 72 6f 75 74 69  6e 65 2c 0d 62 75 74 20  | a routine,.but |
00000ee0  77 68 61 74 65 76 65 72  20 69 74 20 69 73 20 79  |whatever it is y|
00000ef0  6f 75 20 6e 65 65 64 20  74 6f 20 62 65 20 61 62  |ou need to be ab|
00000f00  6c 65 20 74 6f 20 74 65  73 74 20 69 74 20 74 6f  |le to test it to|
00000f10  20 65 6e 73 75 72 65 20  74 68 61 74 20 69 74 20  | ensure that it |
00000f20  77 6f 72 6b 73 0d 66 61  75 6c 74 6c 65 73 73 6c  |works.faultlessl|
00000f30  79 2e 0d 20 20 20 20 20  57 68 65 6e 20 79 6f 75  |y..     When you|
00000f40  20 73 74 61 72 74 20 74  65 73 74 69 6e 67 20 79  | start testing y|
00000f50  6f 75 72 20 72 6f 75 74  69 6e 65 2c 20 6d 61 6b  |our routine, mak|
00000f60  65 20 73 75 72 65 20 74  68 61 74 20 79 6f 75 20  |e sure that you |
00000f70  73 61 76 65 20 74 68 65  0d 70 72 6f 67 72 61 6d  |save the.program|
00000f80  20 6f 72 20 73 6f 75 72  63 65 20 63 6f 64 65 20  | or source code |
00000f90  66 69 72 73 74 20 2d 20  74 68 65 20 63 6f 6d 70  |first - the comp|
00000fa0  75 74 65 72 20 6d 61 79  20 77 65 6c 6c 20 63 72  |uter may well cr|
00000fb0  61 73 68 2c 20 69 6e 20  77 68 69 63 68 20 63 61  |ash, in which ca|
00000fc0  73 65 0d 79 6f 75 20 63  6f 75 6c 64 20 76 65 72  |se.you could ver|
00000fd0  79 20 65 61 73 69 6c 79  20 6c 6f 73 65 20 79 6f  |y easily lose yo|
00000fe0  75 72 20 77 6f 72 6b 2e  20 44 6f 20 6e 6f 74 20  |ur work. Do not |
00000ff0  62 65 20 61 66 72 61 69  64 20 74 6f 20 72 69 73  |be afraid to ris|
00001000  6b 20 63 72 61 73 68 69  6e 67 0d 74 68 65 20 63  |k crashing.the c|
00001010  6f 6d 70 75 74 65 72 20  2d 20 74 65 73 74 20 74  |omputer - test t|
00001020  68 65 20 72 6f 75 74 69  6e 65 20 61 73 20 76 69  |he routine as vi|
00001030  67 6f 72 6f 75 73 6c 79  20 61 73 20 70 6f 73 73  |gorously as poss|
00001040  69 62 6c 65 2e 20 46 6f  72 20 65 78 61 6d 70 6c  |ible. For exampl|
00001050  65 2c 20 69 66 0d 79 6f  75 20 61 72 65 20 77 72  |e, if.you are wr|
00001060  69 74 69 6e 67 20 61 20  72 6f 75 74 69 6e 65 20  |iting a routine |
00001070  74 6f 20 66 69 6e 64 20  74 68 65 20 73 71 75 61  |to find the squa|
00001080  72 65 20 72 6f 6f 74 20  6f 66 20 61 20 6e 75 6d  |re root of a num|
00001090  62 65 72 2c 20 61 73 6b  20 69 74 20 77 68 61 74  |ber, ask it what|
000010a0  0d 74 68 65 20 72 6f 6f  74 20 6f 66 20 2d 32 20  |.the root of -2 |
000010b0  69 73 20 28 74 68 65 72  65 20 69 73 20 6e 6f 74  |is (there is not|
000010c0  20 6f 6e 65 29 2e 20 49  73 20 74 68 65 20 72 65  | one). Is the re|
000010d0  73 75 6c 74 20 61 63 63  65 70 74 61 62 6c 65 3f  |sult acceptable?|
000010e0  20 49 66 20 6e 6f 74 2c  0d 66 69 78 20 69 74 2e  | If not,.fix it.|
000010f0  20 52 65 6d 65 6d 62 65  72 2c 20 69 66 20 79 6f  | Remember, if yo|
00001100  75 20 61 73 6b 20 66 6f  72 20 61 20 6e 75 6d 62  |u ask for a numb|
00001110  65 72 20 62 65 74 77 65  65 6e 20 31 20 61 6e 64  |er between 1 and|
00001120  20 31 30 2c 20 73 6f 6d  65 20 75 73 65 72 20 69  | 10, some user i|
00001130  73 0d 62 6f 75 6e 64 20  74 6f 20 74 79 70 65 20  |s.bound to type |
00001140  31 31 2c 20 61 6e 64 20  79 6f 75 72 20 70 72 6f  |11, and your pro|
00001150  67 72 61 6d 20 73 68 6f  75 6c 64 20 62 65 20 70  |gram should be p|
00001160  72 65 70 61 72 65 64 20  74 6f 20 64 65 61 6c 20  |repared to deal |
00001170  77 69 74 68 20 74 68 69  73 2e 0d 45 76 65 6e 20  |with this..Even |
00001180  69 6e 74 65 72 6e 61 6c  20 72 6f 75 74 69 6e 65  |internal routine|
00001190  73 20 73 68 6f 75 6c 64  20 63 68 65 63 6b 20 74  |s should check t|
000011a0  6f 20 73 65 65 20 69 66  20 74 68 65 79 20 61 72  |o see if they ar|
000011b0  65 20 63 61 6c 6c 65 64  20 77 69 74 68 20 69 6c  |e called with il|
000011c0  6c 65 67 61 6c 0d 70 61  72 61 6d 65 74 65 72 73  |legal.parameters|
000011d0  2e 20 49 66 20 61 20 72  6f 75 74 69 6e 65 20 69  |. If a routine i|
000011e0  73 20 63 61 6c 6c 65 64  20 77 69 74 68 20 74 68  |s called with th|
000011f0  65 20 77 72 6f 6e 67 20  70 61 72 61 6d 65 74 65  |e wrong paramete|
00001200  72 73 2c 20 69 74 20 69  73 20 6d 75 63 68 0d 65  |rs, it is much.e|
00001210  61 73 69 65 72 20 74 6f  20 74 72 61 63 65 20 74  |asier to trace t|
00001220  68 65 20 70 72 6f 62 6c  65 6d 20 69 66 20 79 6f  |he problem if yo|
00001230  75 72 20 70 72 6f 67 72  61 6d 20 73 61 79 73 20  |ur program says |
00001240  22 45 52 52 4f 52 20 41  54 20 31 30 30 22 20 74  |"ERROR AT 100" t|
00001250  68 61 6e 20 69 66 20 69  74 0d 73 69 6d 70 6c 79  |han if it.simply|
00001260  20 64 6f 65 73 20 6e 6f  74 20 6f 70 65 72 61 74  | does not operat|
00001270  65 20 69 6e 20 74 68 65  20 77 61 79 20 69 74 20  |e in the way it |
00001280  73 68 6f 75 6c 64 2e 0d                           |should..|
00001288
+PT1.m0
+PT1.m1
+PT1.m2
+PT1.m4
+PT1.m5