Tech Tips
SINGLE-STEPPING
The following advanced tip comes from a well-known independent Atari software developer who prefers to remain anonymous. This single-step routine works with the version of DDT (Dunion's Debugging Tool) built into the MAC/65 assembler-editor from Optimized Systems Software. Our technical staff was unable to fully test the technique prior to deadline:
Let's say you're using the [OPTION] key to single-step through a program that you're revising, and you reach a code block that includes a tight loop which is executed many times. For example:
LDX #117
LP LDA BUF,X
STA OUT,X
DEX
RPL LP
JSR SOMEPLACE
Now, you know that loop will work okay, but using [OPTION] to go through it will take forever. So Instead, use the [OPTION] key to single-step down to the first occurrence of the BPL (or any similar branch instruction). Then press [N]--the loop will execute and the program will stop on the next instruction, ready for an [OPTION].
Normally, N means to skip the Next instruction. DDT executes it by placing a temporary break-point on the instruction past the next one and then doing a GO (or START). So with a branch instruction, N puts the break right after the branch. Only when the branch is not taken is the break activated.
Caution: Don't use this technique on a branch that might never "fall through." Since DDT does a GO, your program may run away too quickly to recover.
HIGH SCORE SAVE
This tip comes from an article by lan Finlayson in Page 6, Britain's biggest Atari magazine:
BASIC's Forced Read mode lets a program modify itself by automatically writing program lines onscreen and then reading them as if they were typed in manually. Adding this subroutine to a BASIC game lets you save a high score to disk or cassette.
31210 TT7=0
31220 HICHSCORE=TT7:RETURN
31225 REM - - - - - - - - -
31229 REM THIS REWRITES LINE 31210
31230 IF HIGHSCORE<=TT7 THEN RETURN
31240 GRAPHICS 0:? :? :? "31210 TT7=";HIGHSCORE
31250 ? :? :? "CONT"
31260 POSITION 2,0:POKE 842,13:STOP
31270 POKE 842,12:SAVE "D:GAME":RETURN
31280 POKE 842,12:GRAPHIIS 0:? :? :? "Rewind tape":? :? "Push RECORD and PLAY, then press [RETURN]"
31290 CSAVE :RETURN
This is actually two routines in one. The first routine (lines 31210-31220) places the current high store into variables TT7 and HIGHSCORE. The line GOSUB 31210 calls this routine. You only need to call this subroutine once, at the beginning of your program.
During your game, remember that the variable HIGHSCORE refers to the highest score achieved during the current game, while the variable TT7 refers to the all-time high store.
Before your game ends, you should update the all-time high score with a GOSUB 31230. This is the second half of the routine. It checks to see if the current high score is greater than the all-time high score. If so, line 31210 is updated with the new all-time high score, and the program is re-SAVEd.
If your program is on cassette, you should remove line 31270. If your program is on disk, put its filenome in line 31270.
PROWRITER PATCH
Ervin Zimmerman of Mt Clemens. Mich., offers the following modification to Antic Publisher (December 1987), which allows the program to print on a Prowriter printer. Antic doesn't hove a Prowriter to verify this tip on.
1. Edit line 12010 as follows:
Find the port of the line which reads:
and change it to:
2. Edit line 32050 as follows:
Find the part of the line which reads:
and change it to:
3. Change the 48th ond 51st characters of DUMP$ in line 32130 from "&" (ampersand) to "f" (lowercase f).
WASHINGTON SHUFFLE
Mark Brown of Current Notes, the magazine of the Washington Area Atari Computer Enthusiasts, created this two-line routine that shuffles a set of items. Here, it shuffles upper- and lowercase letters, but what if you were working with playing cards instead?
10 DIM C$(52),T$(1): C$= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" :? CHR$(125);"In order: ":? C$:? :?
20 FOR A=1 TO 52:B=INT(52*RND(0)+1):T$=C$(A,A):C$(B,B):C$(B,B)=T$:NEXT A:? "Shuffled":? C$
If you have a Tech Tip that you would like to share with other readers, send it along to Antic Tech Tips, 544 Second Street, San Francisco CA 94107. You might get your name in print. We always welcome very short programs that demonstrate the Atari's powers, simple hardware modifications, or useful macros for popular software.