6. DEFINING SPRITES
Each sprite is defined in two parts, the first being displayed when the X co-ordinate of the sprite's position is even, and the second when it is odd. The purpose of this feature is to allow for the employment of animation techniques, eg. to generate a funning man or flying bird. When using the sprite definer, you can select which is being displayed by typing "1" for part 1 and "2" for part 2. Each is defined on an 8 by 16 grid. Unless the second part is defined, it is assumed to be identical to the first.
Super sprites have four parts. These should be considered as two pairs (or phases) of normal sprites amalgamated into one. Super sprites are defined by defining two normal sprites, each of which may have two parts as usual. The two normal sprite definitions are saved exactly as for normal sprites. But when they are loaded back into the machine code sprite handler, a different piece of code is used (ie. SS/CODE rather than M/CODE), and the two pairs are saved into it separately. See section 6.2, which gives the load addresses for the two phases of each super sprite.
To define a sprite proceed as follows:
(a) Load the sprite definer program. Disc users should select it from the menu, and tape users should load it with
CHAIN "DEFINE"
It is the fifth file on the cassette.
(b) Press "1".
(c) Move the cursor (a small dot in the left-hand grid) by pressing the cursor control keys; and press the relevant function keys to paint the square at the position of the cursor as required. Continue until the sprite is complete.
(d) If the second part of the sprite is required to be defined differently, then press "2" and repeat (c).
(e) Press "S" to save the sprite on tape or disc (see the end of this section for more precise details).
(f) If you are creating a super sprite, repeat (b) to (e) above to generate and save (separately) its second phase.
Note that you may clear the grid to any chosen colour by selected a with the function keys, and then pressing "C".
Key alone | Key with shift | f0 | black | black/white | f1 | red | red/cyan | f2 | green | green/magenta | f3 | yellow | yellow/blue | f4 | blue | blue/yellow | f5 | magenta | magenta/green | f6 | cyan | cyan/red | f7 | white | white/black |
NOTES
The smaller square grid shows the sprite at actual size.
To alter a previously defined sprite, type "L" (for Load), load the sprite, alter it, and save it again.
Saving sprites on tape.
(a) Make sure that there is a clean part of the tape in the tape recorder. Any tape can be used except the one containing the sprite package.
(a) Press the S key.
(b) Type in the name of your SPRITE (up to seven letters).
(c) Press the RECORD button on your tape-recorder.
(d) Press RETURN
(e) After the sprite has been save press the STOP button on your tape-recorder.
Loading sprites from tape back into the definer.
Once your sprite has been recorded on tape it can be loaded back into the sprite definer program at any time to be altered.
(a) Load the sprite definer program into your computer.
(b) Line up the start of the part of the tape on which you have recorded your sprite.
(c) Press the L key
(d) Type in the name that you gave to the sprite.
(e) Press the play button on the tape-recorder.
(f) After your sprite has loaded press the STOP button on the tape-recorder.
Saving sprites on disc.
(a) Insert a spare formatted disc into the disc drive. If a double drive is being used, drive 0 should be selected.
(b) Press the S key.
(c) Type in the name of your SPRITE (up to seven letters).
Once your sprite has been saved on disc it can be loaded back into the sprite definer program at any time to be altered.
Loading sprites from disc back into the definer
(a) Load the sprite definer program into your computer.
(b) Press the L key.
(c) Type in the name that you gave to the sprite.
6.2 INCORPORATING USER DEFINED SPRITES
Before you use your sprites in a Basic program they must be placed in the relevant machine code sprite handling routine (M/CODE for normal sprites, SS/CODE for super sprites). This subroutine must then be re-saved containing the new sprites, so that it can run together with the main Basic program. It is advised that the altered program is saved under a different name. The operation should be performed in mode seven, with HIMEM set to &2800 for normal sprites and &2500 for super sprites.
(a) Type MODE 7: HIMEM = &2800 (or &2500)
(b) Run the machine code subroutine using:
*RUN M/CODE (normal sprites) *RUN SS/CODE (super sprites)
Cassette users should note that M/CODE is the second file on cassette, and SS/CODE the eighth.
(c) Load in the require sprites which should have been previously saved on tape or disc by typing:
*LOAD name nnnn
where name is the sprite name
and nnnn is the relevant address (see table below)
Normal sprites | sprite | nnnn |
number | ||
1 | 2800 | |
2 | 2880 | |
3 | 2900 | |
4 | 2980 | |
5 | 2A00 | |
6 | 2A80 | |
7 | 2B00 |
Super sprites | Sprite | nnnn | nnnn |
number | (phase 1) | (phase 2) | |
1 | 2500 | 2580 | |
2 | 2600 | 2680 | |
3 | 2700 | 2780 | |
4 | 2800 | 2880 | |
5 | 2900 | 2980 | |
6 | 2A00 | 2A80 | |
7 | 2D00 | 2B80 |
(d) To re-save the machine code program that now contains the redefined sprites type:-
*SAVE name 2800 +900 3000 (for normal sprites)
*SAVE name 2500 +C00 3000 (for super sprites)
This saved program will now contain the redesigned sprites and can be run exactly as if it were the original M/CODE or SS/CODE.