Classic Computer Magazine Archive COMPUTE! ISSUE 38 / JULY 1983 / PAGE 54

RATS!

Mike Steed

This impressive game makes you feel that you are inside a maze, not just seeing it from above. Three dimensional views appear as hallways, doors, and corners as you struggle to find the way out. It's for Upgrade or 4.0 BASIC PETs and Commodore 64.

You must find your way through a maze displayed from a rat's eye view. After you have solved the maze, the program displays the top view and traces your steps.

First, you are asked what maze size you want, up to 15 by 15 (you may wish to change the DIM statement in line 49 - add two to the largest dimension you want - and line 43). Line 45 checks to see if the machine code has been POKEd in, so you have to wait for that only the first time.

The space bar is used to move forward, and the "J" and "L" keys are used to turn left and right, respectively (turning doesn't change your location; it just gives you the view in another direction). The "M" key will display the top view of the maze, mark your position, and tell you in which direction you are headed.

There are four machine language routines in RATS! (they will all work as is with Upgrade or 4.0 ROMs). LINE, as its name implies, draws a line; this routine is similar to Applesoft's HPLOT TO or Atari BASIC'S DRAWTO command. PLOT sets the "hi-res cursor" to the position from which the next line is to be drawn, and plots that point on the screen.

INIT removes everything that is not a letter or number from the screen (thus the quarter-square graphics are erased, but not the "MOVE XX" at the bottom of the screen), and sets all the variables used by the other routines (locations 826-837) to zero.

SCR either loads or saves something to or from the screen. This routine is used to save the screen to memory after the top view of the maze has been displayed the first time, and from then on is used to display the maze almost instantly, so you have to wait only once.

RATS! For 64

Gregg Peele

Programming Assistant

The Commodore 64 version of "RATS!" utilizes the same machine language program that was used in the PET version. The program was changed significantly in only two ways. First, zero-page locations were altered because there is limited zero page space on the 64. Second, a routine to fill screen with color has been added to make the maze visible on the newer 64s. (Color RAM must be POKEd on newer 64s, or values POKEd to the screen are invisible.)

Whenever you run the 64 version, you must prepare the 64 by running Program 2 first. Program 2 sets screen memory at 32768 ($8000) and places BASIC at 16384 ($4000); this emulates the PET screen and provides a safe place for both BASIC and the machine language program. Since the screen normally resides at 1024 ($0400), be careful not to hit the RUN/STOP and RESTORE keys simultaneously while you are within the program. If you do this, then the 64 will "forget" where your BASIC program resides, and you will lose your program.

To transform Program 1 (the PET version) into a 64 version, type in Program 1 as is except replace, add, and delete lines as instructed below. Also, all DATA statement lines are different (see Program 5).