The first part of the Atari 65xe Basic Locate program sets Graphics mode 3.
Then three variables for X, Y, and C are setup. The X and Y variables manage the positions of the pixel on the screen and the C controls the color.
Next we begin to draw the screen. This creates a line at the center and a square to the right of it.
Now we begin to call the joystick by reading the data values at register 632 which manages the joystick port data.
The next line begins to place our moveable pixel on the screen at position X, Y.
After this we define a new variable called X1 and store the contents of X into it, and we define a variable called Y1 and store the contents of Y into it. These are later used to recall an earlier position of our controllable pixel when it bumps up against a wall.
Then we begin checking all the joystick values to move our pixel around using the X and Y variables.
The lines after these are conditions that check to be sure that our pixel doesn’t leave the screen boundaries.
With these lines we are checking if the joystick is idle (=15) or moving (if greater or less than 15) in order to turn off the color of the pixel controlled with the joystick.
Finally we use imitate the Atari 65xe Basic Locate command and save the collision data in variable COL. If the color of 3 is found (green) then we collided into a wall so prevent the pixel from passing through.
However, if the green color is found then we sound a bell, clear the screen, and write “NICE JOB” and then end the program.
The last line continues back to line 30, which keeps the program constantly running.
Please follow and like us: