home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 1
/
001.d81
/
t.clist
< prev
next >
Wrap
Text File
|
2022-08-26
|
2KB
|
117 lines
Color Lister
----- ------
Written by: Joel Ellis Rea
Colorlist is a tiny machine
language routine that makes program
listings print to the screen in
multiple colors.
Colorlist uses these colors for
these keyword classes:
Characters Default color
Primary keywords Light blue
Secondary keywords Green
Operators Green
Functions Orange
BASIC 4.0 keywords Purple
C64-Link keywords Pink
Undefined keywords Cyan
To start COLORLIST, do this:
LOAD"COLORLIST",8,1
Change the text color to the
color you want normal text (non-
keywords) to print, then type:
SYS 52069
COLORLIST is now active. If you
later want to change the normal text
color, do so and then type:
SYS 52091
......................................
When writing BASIC programs, you
may choose to insert spaces between
your keywords and variables, etc. in
an effort to make your program more
readable. For example:
10 FOR I=1 TO LEN(A$): IF MID$(A$,I,1)
<>" " AND I<5 THEN NEXT I: RETURN
However, you pay a price for such
neatness, both in terms of speed and
memory space. In other words, a so-
called "neat" program is usually both
slower and bigger than one that is
written without spaces. The problem
is, the program then becomes nearly
un-readable. For example:
10 FORI=1TOLEN(A$):IFMID$(A$,I,1)<>" "
ANDI<5THENEXTI:RETURN
Can you find the typo in the above
line? How much harder do you think it
would be to find the typo if it were
embedded in a LONG listing?
I am a stickler for speed and com-
pactness in BASIC programs. I also am
not a perfect programmer. Every once
in a while I write programs that don't
work right the first time! Because of
my "cramped" style, it is rather time-
consuming to try to find the errors in
my code.
Thus, I wrote COLORLIST, which is
a small (120 bytes long) machine-lan-
guage routine that changes the LIST
command so that LISTings now appear in
multiple colors. Each keyword becomes
color-coded according to its type.
--------------------------------------