LeRoy J. Baxter, Milwaukie, OR
Debugging a long program listing can be tedious. Most of us have typed in a long program and then had to hunt for errors when it wouldn't RUN. This utility routine can make the job a little easier.
Make a copy of this program and LIST it to tape or disk. When you need it, load it with the ENTER command (the line numbers shouldn't conflict). Then type GOTO 32700. A prompt will appear. Press RETURN, and the first set of six program lines will be LISTed to the screen, regardless of their line numbers, with spaces between the lines. Then with a touch of RETURN, it LISTs the next set of six lines.
Enter "EDIT," and the program goes to the Editing Subroutine. It asks for the line number of the offending line, then LISTs the line and prints the command "CONT" below it. You can then edit the line using the screen editor keys.
When you press RETURN, the line will be entered into the program. You can enter or delete complete lines using standard techniques. Simply move the cursor up and enter your new line between the LISTed line and CONT. When you are done, enter "ERASE," and the utility program will erase itself.
32700 DIM A$(5) : T = 0 32705 Z = 0 : INPUT A$ : ON (A$ = "EDIT") + (A$ = "ERASE")*2 GOTO 32730,32745 32710 ? CHR$ (125) : ADDR = PEEK(136) + PEEK (137)*256 : FOR X = 0 TO T : ADDR = ADDR + PEEK (ADDR + 2)*(T>0) : NEXT X 32715 LINENO = PEEK(ADDR) + PEEK(ADDR + 1)*256 : Z = Z + 1 : IF LINENO > = 32700 THEN ?"* END OF LISTING *" : GOTO 32710 32720 LIST LINENO : T = T + 1 : ADDR = ADDR + PEEK (ADDR + 2) : IF Z<6 THEN 32715 32725 GOTO 32710 32730 ? "WHAT LINE #"; : INPUT X 32735 ? CHR$(125) : POSITION 2,4 : LIST X :? :? :? :? "CONT" : INPUT A$ : POSITION 2,0 : POKE 842, 13 : STOP 32740 POKE 842, 12 : T = T - 6 : GOTO 32705 32745 ? CHR$(125) : POSITION 2, 4 : FOR X = 32700 TO 32750 STEP 5:? X : NEXT X:? "POKE 842,12" 32750 POSITION 2,0 : POKE 842, 13 : STOP