Classic Computer Magazine Archive COMPUTE! ISSUE 43 / DECEMBER 1983 / PAGE 230

List And Scroll For The VIC And 64

Tom Forsythe

This utility program—an excellent tool for debugging BASIC programs—separates a BASIC listing into single statements, and sets off FOR-NEXT loops and IF-THEN statements for readability. You can also scroll in either direction to scan the listing.

Are you tired of typing LIST or trying to read BASIC statements that are lumped together on the same line? This machine language program allows listing and scrolling of BASIC statements. It prints each statement on a separate line and provides indents during FOR-NEXT loops and after IF-THEN statements, making your BASIC listing more readable.

For example, a normal screen listing looks like this on a VIC:

10 A = 10 : FORJ = 1TO4 : FORI
= 0TO10 : PRINTI; : PRINTA*
B : NEXTI : PRINT"PASS "J"
OK" : B = A + B : NEXTJ : IFJ = AT
HENA = B : GOTO5 : END

With "List And Scroll' it would look like this:

10
  A = 10:
  FORJ = 1TO4:
    FORI = 0TO10:
      PRINTI;:
      PRINTA * B:
      NEXTI:
   PRINT"PASS "J"OK":
   B = A + B:
   NEXTJ:
IFJ = ATHENA = B:
  GOTO5:
  END

Simple Operation

Operation is easier and faster than the normal LIST; just type a period (.) followed by an optional line number. Without the line number, the listing will begin with the first line of your BASIC program. To scroll forward or backward through the listing, use the cursor up or down keys. Pressing the RETURN key or scrolling past either end of the BASIC program will automatically return control to BASIC. You'll know this by the presence of a flashing cursor.

After typing in Program 1 (VIC version) or Program 2 (64 version), be sure to SAVE it to tape or disk. Then you must do one of the following: Type SYS 6769 or type in, SAVE, and RUN Program 3. The first option is fine if the BASIC program you'd like to examine with List And Scroll is not more than 2K (2673 bytes) for the VIC, or 4K (4021 bytes) for the 64. However, you must use Program 3 if your BASIC program exceeds the limits mentioned above.

If you SYS 6769 and your BASIC program is too long, it will write over List And Scroll and render it useless. So, if in doubt, use Program 3. After you type RUN, there will be a short wait and then you'll see a command to SYS to a specified address. Program 3 moves the program to a safe location at the top of memory. VIC users should remove the Super Expander cartridge before using Program 3.

Program 1: List And Scroll (VIC Version)

10 I = 6768
20 READ A : IF A = 256 THEN 40
30 POKE I, A : CK = CK + A : I = I + 1 : GOTO 20
40 IFCK < > 51983THENPRINT"{CLR}ERROR IN DAT A STATEMENTS" : END
50 END
6768 DATA 1,  113, 26, 173, 113, 26, 133
6776 DATA 55, 133, 51, 173, 114, 26, 133
6784 DATA 56, 133, 52, 234, 234, 234, 169
6792 DATA 76, 133, 124, 173, 147, 26, 133