Classic Computer Magazine Archive ANTIC VOL. 2, NO. 4 / JULY 1983

Systems Guide


by Dana Noonan

One of the nicest features of the ATARI computer is the ease of using inverse and control characters within programs, but reading a printout of a program containing these characters is a frustrating experience. Inverse characters become weird graphics and other non-normal characters become difficult to decipher. This Program Lister will enable you to produce a readable printout of any LlSTed program.

When RUN, the program asks for the name of the program you want to have listed to the printer. It must be a LlSTed and not SAVEd program. Be sure to type D: or D2: before the file name. You will then be asked the date and source of the listing. You may leave these blank if you wish. Next you will be asked if you want condensed print. If you type "N" the normal printer font and type size will be used. Variable T sets the type size for the Epson printer (Lines 700, 710). If you have a different printer change the values of this variable to match your machine. After you have chosen the print size, the screen will go blank until the printer is done (Line 630). Any errors will bring the screen back to life and print a suitable message (Lines 730-820).

Inverse character strings will be printed between | |, controls between [ ], inverse controls between > <. Other unprintable characters will be described in plain English between brackets. At the top of the first page the file name, source, date, and page number of the listing will appear. The next printed line will print the main listing conventions.

The main portion of the program begins with Line 70 (control later shifts to line 130). Each line is checked for quotes and inverse characters. If either is found, QF (the quote flag) is set to 1 (Lines 160-170). The printer will skip a line before each program line that begins with a "REM" statement (Line 200). I have written the program so that it tabs over from the left margin and prints right-justified line numbers followed by two blank spaces (Lines 190,220). You may omit either of these features if you wish.

At this point the program will print the remainder of a line if the quote flag has not been reset and the length of the line (LL) does not exceed the length determined when the character set was chosen (Line 230). If either of these conditions exists, the program will check the line for length and nonnormal characters (Lines 240-410). If the length limit is about to be reached, the program will look for appropriate points to begin at the next line. Additional lines are indented to make the printout easier to read.

Beginning with line 300 the program checks the ASCII value of each element in substring A$(N) and branches to the appropriate line to print the character. After each non-normal character is printed, LN is adjusted to reflect the extra characters printed. This keeps the line from spilling over to the next line before its normal length (LL) is reached.

The treatment of the inverse normal characters differs a little from that of the other non-normal characters. Since so many programs contain inverse strings of more than one character, this program checks to see if additional inverse characters follow (Line 480-540). The TRAP statement in line 510 is needed to end inverse REM statements and begin a new line.

Lines 550 to 610 advance the printer, control page length and print a header on each page. Lines 730 to 820 come into play only if an error occurs. The program traps these following errors: the end of the file (error 136), non-existent file (error 170), and printer not online (error 138). Any other error causes the program to begin again.

The speed at which the program produces a listing depends on the length of program lines and number of quotes or REMs. It took a little more than two minutes to list the program itself. The program could be speeded up some by omitting lines 190-230, but the improved format of the printout would be lost. All REMs can be safely omitted.

Listing:LISTER.BAS Download