Player Missile Graphics ... a machine code routine

by Anthony Hughes



Issue 13

Jan/Feb 85

Next Article >>

<< Prev Article



Using Players to any extent from BASIC is complex and I have therefore come up with a routine that takes away all the fuss and allows a shape to be placed anywhere on the screen with ease. I have also incorporated a routine that allows different 'frames' to be used to achieve animation and I hope that readers will find this program of use in their own games.

The program uses machine code residing in page 6 of memory but allows horizontal and vertical movement to be controlled easily and rapidly from BASIC. There is also the facility for animation sequences up to 48 frames long. The machine code routine used is tied to the Vertical Blank Interrupt system to allow smooth movement.

The accompanying program demonstrates what is possible with the aid of a Shamus type character. Lines 1000 to 1080 hold the data for the machine code and lines 100 to 155 hold the data for the frames required. It is a good idea to save the program before you attempt to run it as any errors in the data statements could cause the system to crash. If you have a 16K system, the 144 in line 10 should be changed to 48.

To initialise the routine, the following BASIC command is used at the beginning of the program


PMSTART is the page number of the beginning of the player/missile table and would normally be above the display memory.

Each frame is defined on a grid of 16 rows of 8 columns in a similar manner to the way characters are defined and up to 48 different patterns may be stored. The memory map for single line resolution players is normally as figure 1.

The program makes use of the unused 768 bytes to store the data for each frame. Thus frame 0 occupies PMSTART*256 to PMSTART*256+15, frame 1 occupies PMSTART*256+16 to PMSTART*256+31, frame 2 occupies PMSTART*256+32 to PMSTART*256+47 and so on.

Players are placed on the screen by the following command


the variables used are shown in figure 2.

Each player can access any frame, regardless of whether it is being used by another. The horizontal and vertical co-ordinates refer to the top left hand corner of the player, so to centre it around point X,Y, the values X4,Y-8 would have to be substituted into the USR call. Animation may be achieved simply by modifying the X,Y and F values and repeatedly calling the routine.

To incorporate the routine into you own programs, just omit lines from 100 to 999 and continue programming as usual.

AtariLister - requires Java