Antic pays $25 for every original and exclusive Tech Tip submission that we publish. Send your 8-bit or ST disk and printout to: Antic Tech Tips, 544 Second Street, San Francisco, CA 94107. Tech Tips welcomes very short programs that demonstrate the Atari's powers, simple hardware modifications, or useful macros for popular software.
Antic Technical and Online Editor Charles Jackson uses the basic concept of this debugging routine whenever he has a program to edit. It is a quick, easy way to switch the [BREAK] key on and off. You can use this method with most programming languages to control any other debugging routine. For an example of how it works in GFA BASIC, examine the BASIC Concentration listing in this issue.
Obviously, this routine is more useful in larger programs. But in the following example, let's imagine that for some reason you choose to display a simple multiplication table over and over again:
100 IF NOT DEBUG THEN GOSUB 1000
110 FOR X=1 TO 10:FOR Y=1 TO 10
120 PRINT X*Y;" ";
130 NEXT Y:PRINT:NEXT X
140 PRINT:PRINT:GOTO 110
1000 POKE 16,112
1010 POKE 53774,112:RETURN
Lines 100 through 140 contain the main routine. Lines 1000 and 1010 disable the [BREAK] key. When DEBUG is equal to one, the program will skip these lines, permitting you to stop the program and fix any bugs.
Once your program is running properly, set DEBUG equal to zero to disable the [BREAK] key.
Ingenious programmers could also replace line 1 with the line:
Here, the value of DEBUG depends on the value of PEEK(53279)- the memory location which keeps track of the console keys. When you press the [SELECT] key, PEEK(53279) will equal 5, and DEBUG will equal one. Otherwise, DEBUG=0.
The advantage of this technique is obvious. Just hold down the [SELECT] key and type RUN to enable all of your debugging routines. Otherwise, type RUN without pressing [SELECT] and your program will skip the debugging routines.
From England's Page 6 Magazine (January/February 1986) comes Fred key's pretty Snowfall demo, which demonstrates the effects of a crosswind on falling snow.
Program Listing: SNOWFALL.BAS Download