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

Game POKEr For VIC And 64

Dan Carmichael, Assistant Editor

With one touch of the finger and the "Screen-plot," you can easily determine the screen locations of your PEEKs and POKEs. This can be of great help when designing games or graphics. For the VIC and 64.

When you're writing or designing programs, especially games, that use a lot of POKEs and PEEKs to the screen, one of the most time-consuming tasks can be to determine the screen locations of those POKEs and PEEKs. With the VIC-20 or the Commodore 64, you can use the charts supplied with either the instruction book or the Programmer's Reference Guide, or you can take a guess and do a number of POKEs until you "hit" the position you desire. But both methods can be time-consuming.

To solve this problem, you can use this useful "Screen-plot" utility program. The program will, with the touch of one finger, move a blinking ball ("•"-CHR$113) to any position on the screen while continuously displaying both the screen and color POKE locations of the blinking ball.

This is a machine language program written to run in the cassette buffer (but you can use it even if you don't understand machine language). It will require only one BASIC statement; otherwise, it will leave your available BASIC programming memory untouched.

First, type in the program. If you're going to use Screen-plot in conjunction with the program you are currently working on, either append the screen-plotter to it or load your program and then type in the screen-plotter after it. The line numbers, starting at 59995, should insure that it will always remain at the end of your program.

After entering the program, SAVE it before running. As is true with all machine language programs, even a slight error in the DATA statements can cause your system to crash, forcing you to turn off your computer to recover. Then run the program by entering "RUN 59995", and after a pause of about two seconds, the "READY" will be displayed. The Screen-plot program is now POKEd into memory and ready to run.

To run the Screen-plot utility, enter "RUN 60000". If you entered the program correctly, a blinking ball will be displayed on your screen, along with two numbers in the upper left-hand corner. The first number is the screen position of the blinking ball; the second is the color location. As you move the ball around the screen, these numbers will change, reflecting the changes in the screen and color locations.

Controlling The Program

Movement of the ball is accomplished via the F-keys. The following table shows which F-key controls which direction of movement.

F-Key Blinking Ball Direction
F-1
F-3
F-5
F-7

Screen-plot has a built-in safety feature that prevents you from leaving the screen with the blinking ball and thereby altering other important memory locations in your computer.

This utility program runs in the cassette buffer, so you cannot use the cassette tape while this program is running. For you machine language programmers, the screen-plotter uses the zero-page locations hex $FB and $FC, so they are unavailable to you.

Also, because of Commodore's automatic scrolling feature, the screen display would scroll if you were to move the blinking ball to the very last position on the screen (lower right-hand corner). So the program prevents you from moving the ball into this position. To find the screen and color POKE locations of this position, simply move the blinking ball to the second to last position and add 1.

Hints And Tips

After the program has been successfully POKEd into memory and tested, you may delete lines 59994-59999. The only line necessary to support the running of Screen-plot is line 60000. Also, the screen-plotter will not clear the screen upon initialization, so you may use it successfully with whatever screen display your program generates. To stop the screen-plotter, simply press the STOP key.

Program 1:

Screen-plot For The Unexpanded VIC

59994 FOR A = 828 TO 921 : READB : POKEA,B : NEXT : END
59995 DATA 165, 197, 166, 251, 164, 252, 201, 39, 208, 6, 224, 21, 240, 2, 230, 251, 201, 47, 208, 6, 224, 0
59996 DATA 240, 2, 198, 251, 201, 55, 208, 6, 192, 22, 240, 2, 230, 252, 201, 63, 208, 6, 192, 0, 240, 2, 198
59997 DATA 252, 166, 252, 164, 251, 224, 22, 208, 7, 192, 21, 208, 3, 202, 198, 251, 24, 32, 240, 255, 169
59998 DATA 113, 32, 210, 255, 162, 0, 160, 0, 232, 208, 253, 200, 192, 32, 208, 248, 169, 157, 32, 210, 255
59999 DATA 169, 32, 32, 210, 255, 96, 234
60000 SYS828 : A = PEEK(251)+PEEK(252)*22+7680 : PRINT"{RED}{HOME}"A;A+30720" {BLU}" : GOTO60000

Program 2:

Screen-plot For The Expanded (8K Or More) VIC

59994 FOR A = 828TO921 : READB : POKEA, B : NEXT : END
59995 DATA 165, 197, 166, 251, 164, 252, 201, 39, 208, 6, 224, 21, 240, 2, 230, 251, 201, 47, 208, 6, 224, 0
59996 DATA 240, 2, 198, 251, 201, 55, 208, 6, 192, 22, 240, 2, 230, 252, 201, 63, 208, 6, 192, 0, 240, 2, 198
59997 DATA 252, 166, 252, 164, 251, 224, 22, 208, 7, 192, 21, 208, 3, 202, 198, 251, 24, 32, 240, 255, 169
59998 DATA 113, 32, 210, 255, 162, 0, 160, 0, 232, 208, 253, 200, 192, 32, 208, 248, 169, 157, 32, 210, 255
59999 DATA 169, 32, 32, 210, 255, 96, 234
60000 SYS828 : A = PEEK(251) + PEEK(252) * 22 + 4096 : PRINT "{RED] {HOME} "A; A + 33 792 " {BLU}":GOTO 60000

Program 3: Screen-plot For The 64

59994 FORA = 828TO921 : READB : POKEA, B : NEXT : END
59995 DATA 165, 197, 166, 251, 164, 252, 201, 4, 208, 6, 224, 39, 240, 2, 230, 251, 201, 5, 208
59996 DATA 6, 224, 0, 240, 2, 198, 251, 201, 6, 208, 6, 192, 24, 240, 2, 230, 252, 201, 3, 208, 6
59997 DATA 192, 0, 240, 2, 198, 252, 166, 252, 164, 251, 224, 24, 208, 7, 192, 39, 208, 3, 202, 198
59998 DATA 251, 24, 32, 240, 255, 169, 113, 32, 210, 255, 162, 0, 160, 0 232, 208, 253, 200, 192
59999 DATA 32, 208, 248, 169, 157, 32, 210, 255, 169, 32, 32, 210, 255, 96, 234
60000 SYS828: A = PEEK(251) + PEEK(252) * 40 + 1024:PRINT "{HOME}" A;A + 54272 : GOTO 60000