Personal Computer News


Snake

 
Author: F. M. O' Dwyer
Published in Personal Computer News #077

Snake

An old favourite arcade game has been zapped up for the Atari. Written in machine code, Snake, by F. M. O' Dwyer, will need all your skills to keep ahead.

Control is via a joystick in port 1 of the Atari and using this you can guide the snake around the screen aiming for the numbers which appear from time to time at random positions. If you are unsuccessful the number changes into a deadly obstacle.

It is therefore wise to try and get all the numbers, even if they are a low value, or some reason it seems far easier to bump into the obstacles than the numbers.

If you do manage to get to a number before it changes, your length will increase by an equivalent number of segments. Points are scored each time you get a number. You must also be careful not to bump into your own tail and this gets increasingly difficult as you grow.

If you go off the edge of the screen you wrap around, which is quite confusing with the game so fast. Just when you think you know where you are, you are suddenly whisked over to the other side of the screen. Obviously a great deal of practice is required.

You gain a life every 1,000 points. Pressing START starts a new game and pressing OPTION allows you to change the speed of the game. A checksum is included in the program to ensure you type the data statements in correctly.

Program Notes

100 Sets up the screen for the introduction page
110-190 Prints instructions
200 Closes and opens the keyboard and gets input. The close is executed first to make sure that is no open error
210 Prints 'please wait' as data is being loaded
220 Reads in the number of data statements for use in line 330
230 Reads in start and end address data
240 Converts the four eight-bit numbers to 16-bit addresses
260 Reads in data
270 Checks the number of data statements to make sure they are all there
280 Checks sum to ensure data has been input correctly
290 Turns off any current sound, selects the graphics screen mode, and executes the machine code
300 Checks the flag and reset A if not set
310 Set the flag
320 End of subroutine
330-1890 Data for the machine code

F. M. O' Dwyer