Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_39.ADF » P/+P2

P/+P2

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_39.ADF
Filename: P/+P2
Read OK:
File size: 1126 bytes
Load address: 2B206576
Exec address: D0D3250
Duplicates

There are 2 duplicate copies of this file in the archive:

File contents
To use the sprites in your program, you must use the program "UDCMod" on
this issue of EUG as a starting point. This file is in the "P" directory
of this EUG disc. The program consists of a couple of lines at the
beginning which set up your computer to use the module, by entering MODE
2, and assembling the machine code module into memory. Then there is the
assembly language of the module itself which comes after the body of your
program. Your program should be inserted between the line:

REM Put your program code here!

and the line:

END

Apart from adding your program code, there is one other alteration which
you need to make, and that is to insert the filename of sprite file I
mentioned earlier into line 1020. You should replace the string <Filename>
in quotes at the end of line 1020 with the relavant filename. For the
moment use 'B+B' - this will enable you to use the sprites used in the Bat
and Ball demonstration.

Whenever you want to display a sprite in your program, you need to set a
number of variables and then call the module. These variables must be set
with integer values in the ranges given:

?char - The number of the sprite you want to draw (0-31)

?xc - The x position of the sprite in characters (0-19)  } Use just like
?yc - The y position of the sprite in characters (0-31)  }  TAB(?xc,?yc)

?xoff - The offset of the x position from the left edge of the character
        position given, in pixels (0-3). This enables you to smoothly
        move your sprite from one character to another.

?yoff - The offset of the y position from the top edge of the character
        position given (0-7).

Having set these four variables, execute CALLdisplay to display your
sprite.

As an example we can try this now. Load up a copy of 'UDCMod' and replace
the filename in line 1020 with 'B+B' as described earlier. Now enter the
following line:

30 ?char=2:?xc=1:?yc=1:?xoff=2:?yoff=4:CALLdisplay

RUN the program, and a block will appear at the top left of the screen.
The top left of the block is in character square (1,1), and with offsets
of half a character both horizontally and vertically.

The SetPaint(col) function
--------------------------

You may remember that a couple of issues back I mentioned how the GCOL
command in BASIC can be used to set how graphics are drawn onto the
screen. For example, the pixels could be set to the colours defined in
your sprites regardless of their previous state. They could also have the
light from the pixels mixed with the light from your sprite. This would
mean, for example, that if a green sprite were plotted onto a blue
background, the result would be cyan. This effect can also be achieved
using this graphics module, using the SetPaint procedure:

PROCSetPaint(x)

Where: x = Parameter giving the type of painting you want to do.

0: Your sprite will replace any previous colours on the screen.
1: Your sprite will be used as a filter put over the light already on
   the screen.
2: Your sprite will be mixed with the light already on the screen.
3: EOR (described later)

The default setting is 0. The other paint modes obviously have
applications if you want to be able to see several sprites on top of each
other by mixing the light from them, or if you only want to see a sprite
when it is in a certain area of the screen. But the EOR mode also has
another very important use:

Suppose you want to create a moving sprite. Say, for example, the ball in
the Bat & Ball demonstration. If you just draw the sprite over and over
again slowly moving across the screen you will get a trail of all of the
old displays of the sprite behind your latest display. This is because
these are not being removed before the new image is being drawn. Let's say
our sprite has moved left from square 10 to square 9. Initially you would
have drawn the sprite in square 10. Then when the sprite moves into square
9 you would draw it again in its new position in square 9. The result is
that your sprite is now visible in both squares 9 and 10 - you need to
remove the image from square 10.

You could do this by allocating one of your program's 32 sprites as a
black square. But what happens if your sprite is in front of a complex
backdrop? If you start putting black blocks in front of that, you'll get
in a mess. The problem is illustrated by the 'Walking' demonstration which
is available at the end of this tutorial.
00000000  54 6f 20 75 73 65 20 74  68 65 20 73 70 72 69 74  |To use the sprit|
00000010  65 73 20 69 6e 20 79 6f  75 72 20 70 72 6f 67 72  |es in your progr|
00000020  61 6d 2c 20 79 6f 75 20  6d 75 73 74 20 75 73 65  |am, you must use|
00000030  20 74 68 65 20 70 72 6f  67 72 61 6d 20 22 55 44  | the program "UD|
00000040  43 4d 6f 64 22 20 6f 6e  0d 74 68 69 73 20 69 73  |CMod" on.this is|
00000050  73 75 65 20 6f 66 20 45  55 47 20 61 73 20 61 20  |sue of EUG as a |
00000060  73 74 61 72 74 69 6e 67  20 70 6f 69 6e 74 2e 20  |starting point. |
00000070  54 68 69 73 20 66 69 6c  65 20 69 73 20 69 6e 20  |This file is in |
00000080  74 68 65 20 22 50 22 20  64 69 72 65 63 74 6f 72  |the "P" director|
00000090  79 0d 6f 66 20 74 68 69  73 20 45 55 47 20 64 69  |y.of this EUG di|
000000a0  73 63 2e 20 54 68 65 20  70 72 6f 67 72 61 6d 20  |sc. The program |
000000b0  63 6f 6e 73 69 73 74 73  20 6f 66 20 61 20 63 6f  |consists of a co|
000000c0  75 70 6c 65 20 6f 66 20  6c 69 6e 65 73 20 61 74  |uple of lines at|
000000d0  20 74 68 65 0d 62 65 67  69 6e 6e 69 6e 67 20 77  | the.beginning w|
000000e0  68 69 63 68 20 73 65 74  20 75 70 20 79 6f 75 72  |hich set up your|
000000f0  20 63 6f 6d 70 75 74 65  72 20 74 6f 20 75 73 65  | computer to use|
00000100  20 74 68 65 20 6d 6f 64  75 6c 65 2c 20 62 79 20  | the module, by |
00000110  65 6e 74 65 72 69 6e 67  20 4d 4f 44 45 0d 32 2c  |entering MODE.2,|
00000120  20 61 6e 64 20 61 73 73  65 6d 62 6c 69 6e 67 20  | and assembling |
00000130  74 68 65 20 6d 61 63 68  69 6e 65 20 63 6f 64 65  |the machine code|
00000140  20 6d 6f 64 75 6c 65 20  69 6e 74 6f 20 6d 65 6d  | module into mem|
00000150  6f 72 79 2e 20 54 68 65  6e 20 74 68 65 72 65 20  |ory. Then there |
00000160  69 73 20 74 68 65 0d 61  73 73 65 6d 62 6c 79 20  |is the.assembly |
00000170  6c 61 6e 67 75 61 67 65  20 6f 66 20 74 68 65 20  |language of the |
00000180  6d 6f 64 75 6c 65 20 69  74 73 65 6c 66 20 77 68  |module itself wh|
00000190  69 63 68 20 63 6f 6d 65  73 20 61 66 74 65 72 20  |ich comes after |
000001a0  74 68 65 20 62 6f 64 79  20 6f 66 20 79 6f 75 72  |the body of your|
000001b0  0d 70 72 6f 67 72 61 6d  2e 20 59 6f 75 72 20 70  |.program. Your p|
000001c0  72 6f 67 72 61 6d 20 73  68 6f 75 6c 64 20 62 65  |rogram should be|
000001d0  20 69 6e 73 65 72 74 65  64 20 62 65 74 77 65 65  | inserted betwee|
000001e0  6e 20 74 68 65 20 6c 69  6e 65 3a 0d 0d 52 45 4d  |n the line:..REM|
000001f0  20 50 75 74 20 79 6f 75  72 20 70 72 6f 67 72 61  | Put your progra|
00000200  6d 20 63 6f 64 65 20 68  65 72 65 21 0d 0d 61 6e  |m code here!..an|
00000210  64 20 74 68 65 20 6c 69  6e 65 3a 0d 0d 45 4e 44  |d the line:..END|
00000220  0d 0d 41 70 61 72 74 20  66 72 6f 6d 20 61 64 64  |..Apart from add|
00000230  69 6e 67 20 79 6f 75 72  20 70 72 6f 67 72 61 6d  |ing your program|
00000240  20 63 6f 64 65 2c 20 74  68 65 72 65 20 69 73 20  | code, there is |
00000250  6f 6e 65 20 6f 74 68 65  72 20 61 6c 74 65 72 61  |one other altera|
00000260  74 69 6f 6e 20 77 68 69  63 68 0d 79 6f 75 20 6e  |tion which.you n|
00000270  65 65 64 20 74 6f 20 6d  61 6b 65 2c 20 61 6e 64  |eed to make, and|
00000280  20 74 68 61 74 20 69 73  20 74 6f 20 69 6e 73 65  | that is to inse|
00000290  72 74 20 74 68 65 20 66  69 6c 65 6e 61 6d 65 20  |rt the filename |
000002a0  6f 66 20 73 70 72 69 74  65 20 66 69 6c 65 20 49  |of sprite file I|
000002b0  0d 6d 65 6e 74 69 6f 6e  65 64 20 65 61 72 6c 69  |.mentioned earli|
000002c0  65 72 20 69 6e 74 6f 20  6c 69 6e 65 20 31 30 32  |er into line 102|
000002d0  30 2e 20 59 6f 75 20 73  68 6f 75 6c 64 20 72 65  |0. You should re|
000002e0  70 6c 61 63 65 20 74 68  65 20 73 74 72 69 6e 67  |place the string|
000002f0  20 3c 46 69 6c 65 6e 61  6d 65 3e 0d 69 6e 20 71  | <Filename>.in q|
00000300  75 6f 74 65 73 20 61 74  20 74 68 65 20 65 6e 64  |uotes at the end|
00000310  20 6f 66 20 6c 69 6e 65  20 31 30 32 30 20 77 69  | of line 1020 wi|
00000320  74 68 20 74 68 65 20 72  65 6c 61 76 61 6e 74 20  |th the relavant |
00000330  66 69 6c 65 6e 61 6d 65  2e 20 46 6f 72 20 74 68  |filename. For th|
00000340  65 0d 6d 6f 6d 65 6e 74  20 75 73 65 20 27 42 2b  |e.moment use 'B+|
00000350  42 27 20 2d 20 74 68 69  73 20 77 69 6c 6c 20 65  |B' - this will e|
00000360  6e 61 62 6c 65 20 79 6f  75 20 74 6f 20 75 73 65  |nable you to use|
00000370  20 74 68 65 20 73 70 72  69 74 65 73 20 75 73 65  | the sprites use|
00000380  64 20 69 6e 20 74 68 65  20 42 61 74 0d 61 6e 64  |d in the Bat.and|
00000390  20 42 61 6c 6c 20 64 65  6d 6f 6e 73 74 72 61 74  | Ball demonstrat|
000003a0  69 6f 6e 2e 0d 0d 57 68  65 6e 65 76 65 72 20 79  |ion...Whenever y|
000003b0  6f 75 20 77 61 6e 74 20  74 6f 20 64 69 73 70 6c  |ou want to displ|
000003c0  61 79 20 61 20 73 70 72  69 74 65 20 69 6e 20 79  |ay a sprite in y|
000003d0  6f 75 72 20 70 72 6f 67  72 61 6d 2c 20 79 6f 75  |our program, you|
000003e0  20 6e 65 65 64 20 74 6f  20 73 65 74 20 61 0d 6e  | need to set a.n|
000003f0  75 6d 62 65 72 20 6f 66  20 76 61 72 69 61 62 6c  |umber of variabl|
00000400  65 73 20 61 6e 64 20 74  68 65 6e 20 63 61 6c 6c  |es and then call|
00000410  20 74 68 65 20 6d 6f 64  75 6c 65 2e 20 54 68 65  | the module. The|
00000420  73 65 20 76 61 72 69 61  62 6c 65 73 20 6d 75 73  |se variables mus|
00000430  74 20 62 65 20 73 65 74  0d 77 69 74 68 20 69 6e  |t be set.with in|
00000440  74 65 67 65 72 20 76 61  6c 75 65 73 20 69 6e 20  |teger values in |
00000450  74 68 65 20 72 61 6e 67  65 73 20 67 69 76 65 6e  |the ranges given|
00000460  3a 0d 0d 3f 63 68 61 72  20 2d 20 54 68 65 20 6e  |:..?char - The n|
00000470  75 6d 62 65 72 20 6f 66  20 74 68 65 20 73 70 72  |umber of the spr|
00000480  69 74 65 20 79 6f 75 20  77 61 6e 74 20 74 6f 20  |ite you want to |
00000490  64 72 61 77 20 28 30 2d  33 31 29 0d 0d 3f 78 63  |draw (0-31)..?xc|
000004a0  20 2d 20 54 68 65 20 78  20 70 6f 73 69 74 69 6f  | - The x positio|
000004b0  6e 20 6f 66 20 74 68 65  20 73 70 72 69 74 65 20  |n of the sprite |
000004c0  69 6e 20 63 68 61 72 61  63 74 65 72 73 20 28 30  |in characters (0|
000004d0  2d 31 39 29 20 20 7d 20  55 73 65 20 6a 75 73 74  |-19)  } Use just|
000004e0  20 6c 69 6b 65 0d 3f 79  63 20 2d 20 54 68 65 20  | like.?yc - The |
000004f0  79 20 70 6f 73 69 74 69  6f 6e 20 6f 66 20 74 68  |y position of th|
00000500  65 20 73 70 72 69 74 65  20 69 6e 20 63 68 61 72  |e sprite in char|
00000510  61 63 74 65 72 73 20 28  30 2d 33 31 29 20 20 7d  |acters (0-31)  }|
00000520  20 20 54 41 42 28 3f 78  63 2c 3f 79 63 29 0d 0d  |  TAB(?xc,?yc)..|
00000530  3f 78 6f 66 66 20 2d 20  54 68 65 20 6f 66 66 73  |?xoff - The offs|
00000540  65 74 20 6f 66 20 74 68  65 20 78 20 70 6f 73 69  |et of the x posi|
00000550  74 69 6f 6e 20 66 72 6f  6d 20 74 68 65 20 6c 65  |tion from the le|
00000560  66 74 20 65 64 67 65 20  6f 66 20 74 68 65 20 63  |ft edge of the c|
00000570  68 61 72 61 63 74 65 72  0d 20 20 20 20 20 20 20  |haracter.       |
00000580  20 70 6f 73 69 74 69 6f  6e 20 67 69 76 65 6e 2c  | position given,|
00000590  20 69 6e 20 70 69 78 65  6c 73 20 28 30 2d 33 29  | in pixels (0-3)|
000005a0  2e 20 54 68 69 73 20 65  6e 61 62 6c 65 73 20 79  |. This enables y|
000005b0  6f 75 20 74 6f 20 73 6d  6f 6f 74 68 6c 79 0d 20  |ou to smoothly. |
000005c0  20 20 20 20 20 20 20 6d  6f 76 65 20 79 6f 75 72  |       move your|
000005d0  20 73 70 72 69 74 65 20  66 72 6f 6d 20 6f 6e 65  | sprite from one|
000005e0  20 63 68 61 72 61 63 74  65 72 20 74 6f 20 61 6e  | character to an|
000005f0  6f 74 68 65 72 2e 0d 0d  3f 79 6f 66 66 20 2d 20  |other...?yoff - |
00000600  54 68 65 20 6f 66 66 73  65 74 20 6f 66 20 74 68  |The offset of th|
00000610  65 20 79 20 70 6f 73 69  74 69 6f 6e 20 66 72 6f  |e y position fro|
00000620  6d 20 74 68 65 20 74 6f  70 20 65 64 67 65 20 6f  |m the top edge o|
00000630  66 20 74 68 65 20 63 68  61 72 61 63 74 65 72 0d  |f the character.|
00000640  20 20 20 20 20 20 20 20  70 6f 73 69 74 69 6f 6e  |        position|
00000650  20 67 69 76 65 6e 20 28  30 2d 37 29 2e 0d 0d 48  | given (0-7)...H|
00000660  61 76 69 6e 67 20 73 65  74 20 74 68 65 73 65 20  |aving set these |
00000670  66 6f 75 72 20 76 61 72  69 61 62 6c 65 73 2c 20  |four variables, |
00000680  65 78 65 63 75 74 65 20  43 41 4c 4c 64 69 73 70  |execute CALLdisp|
00000690  6c 61 79 20 74 6f 20 64  69 73 70 6c 61 79 20 79  |lay to display y|
000006a0  6f 75 72 0d 73 70 72 69  74 65 2e 0d 0d 41 73 20  |our.sprite...As |
000006b0  61 6e 20 65 78 61 6d 70  6c 65 20 77 65 20 63 61  |an example we ca|
000006c0  6e 20 74 72 79 20 74 68  69 73 20 6e 6f 77 2e 20  |n try this now. |
000006d0  4c 6f 61 64 20 75 70 20  61 20 63 6f 70 79 20 6f  |Load up a copy o|
000006e0  66 20 27 55 44 43 4d 6f  64 27 20 61 6e 64 20 72  |f 'UDCMod' and r|
000006f0  65 70 6c 61 63 65 0d 74  68 65 20 66 69 6c 65 6e  |eplace.the filen|
00000700  61 6d 65 20 69 6e 20 6c  69 6e 65 20 31 30 32 30  |ame in line 1020|
00000710  20 77 69 74 68 20 27 42  2b 42 27 20 61 73 20 64  | with 'B+B' as d|
00000720  65 73 63 72 69 62 65 64  20 65 61 72 6c 69 65 72  |escribed earlier|
00000730  2e 20 4e 6f 77 20 65 6e  74 65 72 20 74 68 65 0d  |. Now enter the.|
00000740  66 6f 6c 6c 6f 77 69 6e  67 20 6c 69 6e 65 3a 0d  |following line:.|
00000750  0d 33 30 20 3f 63 68 61  72 3d 32 3a 3f 78 63 3d  |.30 ?char=2:?xc=|
00000760  31 3a 3f 79 63 3d 31 3a  3f 78 6f 66 66 3d 32 3a  |1:?yc=1:?xoff=2:|
00000770  3f 79 6f 66 66 3d 34 3a  43 41 4c 4c 64 69 73 70  |?yoff=4:CALLdisp|
00000780  6c 61 79 0d 0d 52 55 4e  20 74 68 65 20 70 72 6f  |lay..RUN the pro|
00000790  67 72 61 6d 2c 20 61 6e  64 20 61 20 62 6c 6f 63  |gram, and a bloc|
000007a0  6b 20 77 69 6c 6c 20 61  70 70 65 61 72 20 61 74  |k will appear at|
000007b0  20 74 68 65 20 74 6f 70  20 6c 65 66 74 20 6f 66  | the top left of|
000007c0  20 74 68 65 20 73 63 72  65 65 6e 2e 0d 54 68 65  | the screen..The|
000007d0  20 74 6f 70 20 6c 65 66  74 20 6f 66 20 74 68 65  | top left of the|
000007e0  20 62 6c 6f 63 6b 20 69  73 20 69 6e 20 63 68 61  | block is in cha|
000007f0  72 61 63 74 65 72 20 73  71 75 61 72 65 20 28 31  |racter square (1|
00000800  2c 31 29 2c 20 61 6e 64  20 77 69 74 68 20 6f 66  |,1), and with of|
00000810  66 73 65 74 73 0d 6f 66  20 68 61 6c 66 20 61 20  |fsets.of half a |
00000820  63 68 61 72 61 63 74 65  72 20 62 6f 74 68 20 68  |character both h|
00000830  6f 72 69 7a 6f 6e 74 61  6c 6c 79 20 61 6e 64 20  |orizontally and |
00000840  76 65 72 74 69 63 61 6c  6c 79 2e 0d 0d 54 68 65  |vertically...The|
00000850  20 53 65 74 50 61 69 6e  74 28 63 6f 6c 29 20 66  | SetPaint(col) f|
00000860  75 6e 63 74 69 6f 6e 0d  2d 2d 2d 2d 2d 2d 2d 2d  |unction.--------|
00000870  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000880  2d 2d 0d 0d 59 6f 75 20  6d 61 79 20 72 65 6d 65  |--..You may reme|
00000890  6d 62 65 72 20 74 68 61  74 20 61 20 63 6f 75 70  |mber that a coup|
000008a0  6c 65 20 6f 66 20 69 73  73 75 65 73 20 62 61 63  |le of issues bac|
000008b0  6b 20 49 20 6d 65 6e 74  69 6f 6e 65 64 20 68 6f  |k I mentioned ho|
000008c0  77 20 74 68 65 20 47 43  4f 4c 0d 63 6f 6d 6d 61  |w the GCOL.comma|
000008d0  6e 64 20 69 6e 20 42 41  53 49 43 20 63 61 6e 20  |nd in BASIC can |
000008e0  62 65 20 75 73 65 64 20  74 6f 20 73 65 74 20 68  |be used to set h|
000008f0  6f 77 20 67 72 61 70 68  69 63 73 20 61 72 65 20  |ow graphics are |
00000900  64 72 61 77 6e 20 6f 6e  74 6f 20 74 68 65 0d 73  |drawn onto the.s|
00000910  63 72 65 65 6e 2e 20 46  6f 72 20 65 78 61 6d 70  |creen. For examp|
00000920  6c 65 2c 20 74 68 65 20  70 69 78 65 6c 73 20 63  |le, the pixels c|
00000930  6f 75 6c 64 20 62 65 20  73 65 74 20 74 6f 20 74  |ould be set to t|
00000940  68 65 20 63 6f 6c 6f 75  72 73 20 64 65 66 69 6e  |he colours defin|
00000950  65 64 20 69 6e 0d 79 6f  75 72 20 73 70 72 69 74  |ed in.your sprit|
00000960  65 73 20 72 65 67 61 72  64 6c 65 73 73 20 6f 66  |es regardless of|
00000970  20 74 68 65 69 72 20 70  72 65 76 69 6f 75 73 20  | their previous |
00000980  73 74 61 74 65 2e 20 54  68 65 79 20 63 6f 75 6c  |state. They coul|
00000990  64 20 61 6c 73 6f 20 68  61 76 65 20 74 68 65 0d  |d also have the.|
000009a0  6c 69 67 68 74 20 66 72  6f 6d 20 74 68 65 20 70  |light from the p|
000009b0  69 78 65 6c 73 20 6d 69  78 65 64 20 77 69 74 68  |ixels mixed with|
000009c0  20 74 68 65 20 6c 69 67  68 74 20 66 72 6f 6d 20  | the light from |
000009d0  79 6f 75 72 20 73 70 72  69 74 65 2e 20 54 68 69  |your sprite. Thi|
000009e0  73 20 77 6f 75 6c 64 0d  6d 65 61 6e 2c 20 66 6f  |s would.mean, fo|
000009f0  72 20 65 78 61 6d 70 6c  65 2c 20 74 68 61 74 20  |r example, that |
00000a00  69 66 20 61 20 67 72 65  65 6e 20 73 70 72 69 74  |if a green sprit|
00000a10  65 20 77 65 72 65 20 70  6c 6f 74 74 65 64 20 6f  |e were plotted o|
00000a20  6e 74 6f 20 61 20 62 6c  75 65 0d 62 61 63 6b 67  |nto a blue.backg|
00000a30  72 6f 75 6e 64 2c 20 74  68 65 20 72 65 73 75 6c  |round, the resul|
00000a40  74 20 77 6f 75 6c 64 20  62 65 20 63 79 61 6e 2e  |t would be cyan.|
00000a50  20 54 68 69 73 20 65 66  66 65 63 74 20 63 61 6e  | This effect can|
00000a60  20 61 6c 73 6f 20 62 65  20 61 63 68 69 65 76 65  | also be achieve|
00000a70  64 0d 75 73 69 6e 67 20  74 68 69 73 20 67 72 61  |d.using this gra|
00000a80  70 68 69 63 73 20 6d 6f  64 75 6c 65 2c 20 75 73  |phics module, us|
00000a90  69 6e 67 20 74 68 65 20  53 65 74 50 61 69 6e 74  |ing the SetPaint|
00000aa0  20 70 72 6f 63 65 64 75  72 65 3a 0d 0d 50 52 4f  | procedure:..PRO|
00000ab0  43 53 65 74 50 61 69 6e  74 28 78 29 0d 0d 57 68  |CSetPaint(x)..Wh|
00000ac0  65 72 65 3a 20 78 20 3d  20 50 61 72 61 6d 65 74  |ere: x = Paramet|
00000ad0  65 72 20 67 69 76 69 6e  67 20 74 68 65 20 74 79  |er giving the ty|
00000ae0  70 65 20 6f 66 20 70 61  69 6e 74 69 6e 67 20 79  |pe of painting y|
00000af0  6f 75 20 77 61 6e 74 20  74 6f 20 64 6f 2e 0d 0d  |ou want to do...|
00000b00  30 3a 20 59 6f 75 72 20  73 70 72 69 74 65 20 77  |0: Your sprite w|
00000b10  69 6c 6c 20 72 65 70 6c  61 63 65 20 61 6e 79 20  |ill replace any |
00000b20  70 72 65 76 69 6f 75 73  20 63 6f 6c 6f 75 72 73  |previous colours|
00000b30  20 6f 6e 20 74 68 65 20  73 63 72 65 65 6e 2e 0d  | on the screen..|
00000b40  31 3a 20 59 6f 75 72 20  73 70 72 69 74 65 20 77  |1: Your sprite w|
00000b50  69 6c 6c 20 62 65 20 75  73 65 64 20 61 73 20 61  |ill be used as a|
00000b60  20 66 69 6c 74 65 72 20  70 75 74 20 6f 76 65 72  | filter put over|
00000b70  20 74 68 65 20 6c 69 67  68 74 20 61 6c 72 65 61  | the light alrea|
00000b80  64 79 20 6f 6e 0d 20 20  20 74 68 65 20 73 63 72  |dy on.   the scr|
00000b90  65 65 6e 2e 0d 32 3a 20  59 6f 75 72 20 73 70 72  |een..2: Your spr|
00000ba0  69 74 65 20 77 69 6c 6c  20 62 65 20 6d 69 78 65  |ite will be mixe|
00000bb0  64 20 77 69 74 68 20 74  68 65 20 6c 69 67 68 74  |d with the light|
00000bc0  20 61 6c 72 65 61 64 79  20 6f 6e 20 74 68 65 20  | already on the |
00000bd0  73 63 72 65 65 6e 2e 0d  33 3a 20 45 4f 52 20 28  |screen..3: EOR (|
00000be0  64 65 73 63 72 69 62 65  64 20 6c 61 74 65 72 29  |described later)|
00000bf0  0d 0d 54 68 65 20 64 65  66 61 75 6c 74 20 73 65  |..The default se|
00000c00  74 74 69 6e 67 20 69 73  20 30 2e 20 54 68 65 20  |tting is 0. The |
00000c10  6f 74 68 65 72 20 70 61  69 6e 74 20 6d 6f 64 65  |other paint mode|
00000c20  73 20 6f 62 76 69 6f 75  73 6c 79 20 68 61 76 65  |s obviously have|
00000c30  0d 61 70 70 6c 69 63 61  74 69 6f 6e 73 20 69 66  |.applications if|
00000c40  20 79 6f 75 20 77 61 6e  74 20 74 6f 20 62 65 20  | you want to be |
00000c50  61 62 6c 65 20 74 6f 20  73 65 65 20 73 65 76 65  |able to see seve|
00000c60  72 61 6c 20 73 70 72 69  74 65 73 20 6f 6e 20 74  |ral sprites on t|
00000c70  6f 70 20 6f 66 20 65 61  63 68 0d 6f 74 68 65 72  |op of each.other|
00000c80  20 62 79 20 6d 69 78 69  6e 67 20 74 68 65 20 6c  | by mixing the l|
00000c90  69 67 68 74 20 66 72 6f  6d 20 74 68 65 6d 2c 20  |ight from them, |
00000ca0  6f 72 20 69 66 20 79 6f  75 20 6f 6e 6c 79 20 77  |or if you only w|
00000cb0  61 6e 74 20 74 6f 20 73  65 65 20 61 20 73 70 72  |ant to see a spr|
00000cc0  69 74 65 0d 77 68 65 6e  20 69 74 20 69 73 20 69  |ite.when it is i|
00000cd0  6e 20 61 20 63 65 72 74  61 69 6e 20 61 72 65 61  |n a certain area|
00000ce0  20 6f 66 20 74 68 65 20  73 63 72 65 65 6e 2e 20  | of the screen. |
00000cf0  42 75 74 20 74 68 65 20  45 4f 52 20 6d 6f 64 65  |But the EOR mode|
00000d00  20 61 6c 73 6f 20 68 61  73 0d 61 6e 6f 74 68 65  | also has.anothe|
00000d10  72 20 76 65 72 79 20 69  6d 70 6f 72 74 61 6e 74  |r very important|
00000d20  20 75 73 65 3a 0d 0d 53  75 70 70 6f 73 65 20 79  | use:..Suppose y|
00000d30  6f 75 20 77 61 6e 74 20  74 6f 20 63 72 65 61 74  |ou want to creat|
00000d40  65 20 61 20 6d 6f 76 69  6e 67 20 73 70 72 69 74  |e a moving sprit|
00000d50  65 2e 20 53 61 79 2c 20  66 6f 72 20 65 78 61 6d  |e. Say, for exam|
00000d60  70 6c 65 2c 20 74 68 65  20 62 61 6c 6c 20 69 6e  |ple, the ball in|
00000d70  0d 74 68 65 20 42 61 74  20 26 20 42 61 6c 6c 20  |.the Bat & Ball |
00000d80  64 65 6d 6f 6e 73 74 72  61 74 69 6f 6e 2e 20 49  |demonstration. I|
00000d90  66 20 79 6f 75 20 6a 75  73 74 20 64 72 61 77 20  |f you just draw |
00000da0  74 68 65 20 73 70 72 69  74 65 20 6f 76 65 72 20  |the sprite over |
00000db0  61 6e 64 20 6f 76 65 72  0d 61 67 61 69 6e 20 73  |and over.again s|
00000dc0  6c 6f 77 6c 79 20 6d 6f  76 69 6e 67 20 61 63 72  |lowly moving acr|
00000dd0  6f 73 73 20 74 68 65 20  73 63 72 65 65 6e 20 79  |oss the screen y|
00000de0  6f 75 20 77 69 6c 6c 20  67 65 74 20 61 20 74 72  |ou will get a tr|
00000df0  61 69 6c 20 6f 66 20 61  6c 6c 20 6f 66 20 74 68  |ail of all of th|
00000e00  65 0d 6f 6c 64 20 64 69  73 70 6c 61 79 73 20 6f  |e.old displays o|
00000e10  66 20 74 68 65 20 73 70  72 69 74 65 20 62 65 68  |f the sprite beh|
00000e20  69 6e 64 20 79 6f 75 72  20 6c 61 74 65 73 74 20  |ind your latest |
00000e30  64 69 73 70 6c 61 79 2e  20 54 68 69 73 20 69 73  |display. This is|
00000e40  20 62 65 63 61 75 73 65  0d 74 68 65 73 65 20 61  | because.these a|
00000e50  72 65 20 6e 6f 74 20 62  65 69 6e 67 20 72 65 6d  |re not being rem|
00000e60  6f 76 65 64 20 62 65 66  6f 72 65 20 74 68 65 20  |oved before the |
00000e70  6e 65 77 20 69 6d 61 67  65 20 69 73 20 62 65 69  |new image is bei|
00000e80  6e 67 20 64 72 61 77 6e  2e 20 4c 65 74 27 73 20  |ng drawn. Let's |
00000e90  73 61 79 0d 6f 75 72 20  73 70 72 69 74 65 20 68  |say.our sprite h|
00000ea0  61 73 20 6d 6f 76 65 64  20 6c 65 66 74 20 66 72  |as moved left fr|
00000eb0  6f 6d 20 73 71 75 61 72  65 20 31 30 20 74 6f 20  |om square 10 to |
00000ec0  73 71 75 61 72 65 20 39  2e 20 49 6e 69 74 69 61  |square 9. Initia|
00000ed0  6c 6c 79 20 79 6f 75 20  77 6f 75 6c 64 0d 68 61  |lly you would.ha|
00000ee0  76 65 20 64 72 61 77 6e  20 74 68 65 20 73 70 72  |ve drawn the spr|
00000ef0  69 74 65 20 69 6e 20 73  71 75 61 72 65 20 31 30  |ite in square 10|
00000f00  2e 20 54 68 65 6e 20 77  68 65 6e 20 74 68 65 20  |. Then when the |
00000f10  73 70 72 69 74 65 20 6d  6f 76 65 73 20 69 6e 74  |sprite moves int|
00000f20  6f 20 73 71 75 61 72 65  0d 39 20 79 6f 75 20 77  |o square.9 you w|
00000f30  6f 75 6c 64 20 64 72 61  77 20 69 74 20 61 67 61  |ould draw it aga|
00000f40  69 6e 20 69 6e 20 69 74  73 20 6e 65 77 20 70 6f  |in in its new po|
00000f50  73 69 74 69 6f 6e 20 69  6e 20 73 71 75 61 72 65  |sition in square|
00000f60  20 39 2e 20 54 68 65 20  72 65 73 75 6c 74 20 69  | 9. The result i|
00000f70  73 0d 74 68 61 74 20 79  6f 75 72 20 73 70 72 69  |s.that your spri|
00000f80  74 65 20 69 73 20 6e 6f  77 20 76 69 73 69 62 6c  |te is now visibl|
00000f90  65 20 69 6e 20 62 6f 74  68 20 73 71 75 61 72 65  |e in both square|
00000fa0  73 20 39 20 61 6e 64 20  31 30 20 2d 20 79 6f 75  |s 9 and 10 - you|
00000fb0  20 6e 65 65 64 20 74 6f  0d 72 65 6d 6f 76 65 20  | need to.remove |
00000fc0  74 68 65 20 69 6d 61 67  65 20 66 72 6f 6d 20 73  |the image from s|
00000fd0  71 75 61 72 65 20 31 30  2e 0d 0d 59 6f 75 20 63  |quare 10...You c|
00000fe0  6f 75 6c 64 20 64 6f 20  74 68 69 73 20 62 79 20  |ould do this by |
00000ff0  61 6c 6c 6f 63 61 74 69  6e 67 20 6f 6e 65 20 6f  |allocating one o|
00001000  66 20 79 6f 75 72 20 70  72 6f 67 72 61 6d 27 73  |f your program's|
00001010  20 33 32 20 73 70 72 69  74 65 73 20 61 73 20 61  | 32 sprites as a|
00001020  0d 62 6c 61 63 6b 20 73  71 75 61 72 65 2e 20 42  |.black square. B|
00001030  75 74 20 77 68 61 74 20  68 61 70 70 65 6e 73 20  |ut what happens |
00001040  69 66 20 79 6f 75 72 20  73 70 72 69 74 65 20 69  |if your sprite i|
00001050  73 20 69 6e 20 66 72 6f  6e 74 20 6f 66 20 61 20  |s in front of a |
00001060  63 6f 6d 70 6c 65 78 0d  62 61 63 6b 64 72 6f 70  |complex.backdrop|
00001070  3f 20 49 66 20 79 6f 75  20 73 74 61 72 74 20 70  |? If you start p|
00001080  75 74 74 69 6e 67 20 62  6c 61 63 6b 20 62 6c 6f  |utting black blo|
00001090  63 6b 73 20 69 6e 20 66  72 6f 6e 74 20 6f 66 20  |cks in front of |
000010a0  74 68 61 74 2c 20 79 6f  75 27 6c 6c 20 67 65 74  |that, you'll get|
000010b0  0d 69 6e 20 61 20 6d 65  73 73 2e 20 54 68 65 20  |.in a mess. The |
000010c0  70 72 6f 62 6c 65 6d 20  69 73 20 69 6c 6c 75 73  |problem is illus|
000010d0  74 72 61 74 65 64 20 62  79 20 74 68 65 20 27 57  |trated by the 'W|
000010e0  61 6c 6b 69 6e 67 27 20  64 65 6d 6f 6e 73 74 72  |alking' demonstr|
000010f0  61 74 69 6f 6e 20 77 68  69 63 68 0d 69 73 20 61  |ation which.is a|
00001100  76 61 69 6c 61 62 6c 65  20 61 74 20 74 68 65 20  |vailable at the |
00001110  65 6e 64 20 6f 66 20 74  68 69 73 20 74 75 74 6f  |end of this tuto|
00001120  72 69 61 6c 2e 0d                                 |rial..|
00001126
P/+P2.m0
P/+P2.m1
P/+P2.m2
P/+P2.m4
P/+P2.m5