Atari Line Check Utility
Ed Sisul
"Atari Line Check" lets you use a joystick to perform a line-by-line search for program bugs.
Quite often, the most effective way to debug a program is to check each line, one at a time, for mistakes. For those of us who are not fortunate enough to own a printer, this can be a very tedious task. The lines can be examined using LIST and CTRL-1 to scroll through the program, but it is difficult to find minor mistakes while staring at a whole screen filled with GRAPHICS 0 text. The lines can be displayed one at a time using the sequence LIST line number, SHIFT CLEAR, LIST line number, SHIFT CLEAR, etc.; but this approach is too slow and cumbersome.
Scrolling With A Joystick
This program will step through a listing and display each line, one at a time, in large GRAPHICS 2 print. The best part is that the scrolling is controlled with a joystick. Pulling back on the stick advances through the listing, and pushing forward on the stick backtracks through the listing. With the stick centered, the displayed line stays on the screen for scrutiny. If a mistake is spotted, press the trigger button, and the line containing the mistake is redisplayed in the normal screen editing mode so it can be corrected. Once the error is dispatched, typing CONT will resume the line-by-line check, or typing RUN will terminate the line check and execute the main program. After typing in "Atari Line Check," LIST it to disk or cassette. Then, using the ENTER command, append it to the program to be checked. Plug a joystick into Port 1 and type GOTO 32000 to start checking lines.
Array Storage
The heart of the program is lines 32010–32030. Lines 32010–32020 retrieve the program line numbers stored in memory and store them in the array LINUM. A complete explanation of the PEEKs used to do this can be found in Larry Isaacs' article "Inside Atari BASIC" in COMPUTE/'s First Book of Atari. Line 32025 opens the screen editor for input and output, lists a line on the screen, then retrieves the entire line, including its line number, and stores it in the variable LINE$. The POKEs in line 32025 blank the screen during these operations. Line 32030 then reprints LINE$ on the screen in GRAPHICS 2 text in black letters on a white background.
Lines 32035–32055 contain the joystick controller routines to increment or decrement the subscript of the line number array or to redisplay a line for editing. Line 32000 initializes the variables, dimensions LINE$ to the maximum number of characters in a logical line, and dimensions the LINUM array to accommodate a 200-line program. The POKE in line 32000 standardizes the left-hand margin on all systems. Line 32005 initially sets all elements of the LINUM array to zero. Should you encounter a program with more than 200 lines, simply change the dimensioned size of LINUM in line 32000 and the maximum increment of the loop in line 32005 accordingly.
Storage Characters
Because each line is displayed in graphics mode 2, which uses the internal character set, some characters won't be displayed as originally typed. For instance, the special graphics characters will be displayed as numeric or punctuation symbols, and lowercase letters will be displayed as green uppercase letters. Also, the CLEAR character, CHR$(125), will cause the screen to clear when it is printed. When this happens, just press the trigger button to see the characters in their original form.
Atari Line Check
Refer to the "Automatic Proofreader" article before typing this program in.
DM 32000 POKE 82,0:ST = 0:Z Z=1:TRAP 32005:D IM LINE$(120),LINUM (200) :TRAP 40000 IC 32005 FOR N=O TO 200 :LINUM (IM) =0:NEXT N ML 32010 AD = PEEK (136)+256 *PEEK(137) JB 32015 LINUM (ZZ) =PEEK (AD)+256*PEEK(AD+1) : IF LINUM(ZZ)=3 2000 THEN END OE 32020 IF LINUM(ZZ)=0 THEN AD=AD+PEEK(AD+2):GOTO 32015 HL 32025 OPEN #1,13,0."E: ":POKE 709,8: POKE 710,8:POKE 712 ,8:LIST LINUM(ZZ):POSITION 0.1:INPUT #1;LINE$:CLOSE #1 BF 32030 GRAPHICS 18: POKE 708,2:POKE 712,8 :POSITION 0,2:? #6; LINE$ IC 32035 IF STRIG(0)=0 TH EN ST=1:GRAPHICS 0:LIST LINUM(ZZ ):STOP EP 32040 IF ST=1 THEN ST = 0:GOTO 32025 MH 32045 IF STICK(0)=13 THEN ZZ=ZZ+1:G0T0 32020 MA 32050 IF STICK(0)=14 AND ZZ>0 THEN ZZ=ZZ-1: GOTO 32025 DF 32055 GOTO 32035