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

Son Of Lister For VIC And 64

Jim Butterfield, Associate Editor

This updated version of a previously published COMPUTE! program, "Lister," includes modifications for the VIC and 64. "Son Of Lister" translates tokens from other Commodore machines and produces a readable listing to facilitate program conversions.

"Lister," a program published in COMPUTE! (December 1982, p. 192), lists a BASIC program directly from disk — slowly. The only justification for its slowness is that the listing is neat and very readable.

One of the reasons for Lister was that many users couldn't read programs written for other models of Commodore machines because their machine didn't have the same vocabulary. For example, if a 4.0 program contained the command DCLOSE, other systems — not 4.0 — couldn't list the program without getting nonsense.

So Lister allowed us to get a neat listing — and to get a cross-listing of other machines' programs.

Out Go The Windows, In Come The Colors

That was all very well. At the time I wrote it, Lister could be all things to all people. Now there are a few new wrinkles.

First, the new colors used by the Commodore 64 call for new "cursor words" — but there's a twist. Some of the characters used for color in the 64 were used in the 80-column machines for entirely different purposes. We can no longer be universal — we must decide which computer's program we are translating.

It seems sensible to guess that a Commodore 64 is more likely to want to list a 64 program than a CBM 8032 program. In fact, VIC and 64 have much in common and it's likely that they will want to look at each other's programs fairly often. So, out goes the special 8032 window, scroll, and line clear commands. Make way for the new colors.

You can change this to suit your purposes, of course. If an 8032 listing is what you want, go for it — dig back to the December issue and replace the new colors with the 80-column commands.

Screen Width

On the PET/CBM, we had to deal with 80-column and 40-column screens, plus an 80-column printer. On the VIC/64, we must work with 22 or 40 columns, or (again) an 80-column printer. We must search for the screen width in a different way. No big deal — just a different type of programming.

Making a pretty listing on a VIC, with only 22 columns, is a tough task, of course. But the computer will try its best.

And A Challenge

What about extra keywords? The 4.0 machines have extra commands — like DLOAD, for example — which have no counterpart in the VIC/64. Or do they? Some of the "expanders" which add 4.0 commands are said to use the same tokens — in which case, usage will be the same as for 4.0. The program as given still recognizes the 4.0 set.

But that's only one approach. If you're a graphics nut, and have fitted a Super Expander to your VIC, you will be using new commands of your own, such as GRAPHIC or CIRCLE. In this case, you don't want the 4.0 commands — you want the special keywords your program uses. If so, try digging into the DATA statements in "Son Of Lister." Common sense will reveal the changes needed. Experiment — write programs, see how they list, and see what you need to change.

A Token Of Happiness

A word of explanation for beginners. Every time you use a keyword — PRINT, for example — the computer crunches it up into a single byte called a token. Only when you say LIST will the token be unfolded into its original form. That's why you can type in a line like 10 ? and have it list as 10 PRINT. Neither the question mark nor the PRINT word was stored as such — just a one-byte token which represents the command.

One of the ways that Son Of Lister works is to draw the program directly from the disk, and translate the tokens using its own BASIC program. In doing so, it can print out commands that might not even be available on the VIC or 64.

This way, you can read a program from some other Commodore machine — and try to figure out how to modify it for your own computer. And in the meantime, you get a neat listing — in both senses of the word.