THE BEAST

by M.P. Carter



After thirteen issues' absence, MP (who still offers no elaboration on

those elusive initials) finds himself back in the focus of the

Spectrum programming world, with a routine which he himself described

as "a complicated beast". (Hence the name, you see. It would probably

be more apt to describe it as "a routine offering two collision

detection functions which are much faster than the BASIC alternatives,

along with a demo program to show the routines in action", but we

might have had a spot of trouble fitting that in as the title.)



Anyway, fine routine that it is, let's have a look at how to use it.

To get it up and running, just type in the BASIC, which will not only

enter the code for you, but will also provide you with a demo (as

mentioned) in which you have to move a blob around while avoiding

being eaten by the terrifying copyright symbol. The routine acts on

variables x and y (the screen co-ords of your blob), so these must be

defined before you start. The first function is at 64245 and LET A=USR

64245 will read the keyboard for any one of eight directions (using

the keys Q to T for up, A to G for down, O or L for left and P or

ENTER for right), and places in A the ATTR value for the intended

position of your blob. The second function, called by LET A=USR 64248,

places in A the ATTR value for the actual position of your blob. With

reference to the demo, the first function is used to determine whether

your blob is about to run into a * or a $ sign, and the second is used

to tell you when you've been 'got' by the rabid copyright symbol.



To round off, just a few little bits of info for those to whom the

word 'generic' means 'not for long'. The values for x and y are stored

at 64154 and 64155 respectively, and you can adjust the screen area

used by POKEing 64173, (left edge-1), 64183, (right edge+1), 64202,

(top-1) and 64220, (bottom+1). The maximum value for the bottom is 22,

and you can wrap the values round, so that POKE 64173,255 gives a left

edge of 0.

