The Art of Colourful Commodore 64 BASIC Listings

Before modern syntax highlighting became commonplace, Commodore 64 programmers discovered ingenious ways to make their BASIC listings more colourful and readable. Inspired by a forgotten programming tip published in a Spanish computer magazine in January 1985, we explore how the humble REM statement and PETSCII control characters could transform ordinary program listings into visually distinctive documents, revealing a delightful intersection of programming, typography and creative experimentation.

1980s-style illustration of a young Commodore 64 programmer experimenting with colourful BASIC listings, PETSCII graphics and decorative screen formatting.
Making Commodore BASIC beautiful, one character at a time.

Fifty Shades of Blue

There is something reassuring about the familiar blue screen of the Commodore 64. Switch on the computer and, within moments, a blinking cursor invites you to create something. No applications to launch, no development environments to configure and no updates to install. Just you, the computer and the BASIC programming language.

However, the novelty of this minimalist programming environment can wear thin when a program grows to several hundred lines. Variables, calculations, graphics commands and comments all share the same visual appearance. Finding a particular section of a program can become an exercise in patient scrolling.

Modern programmers enjoy syntax highlighting, automatic indentation, code folding and a multitude of other tools that make source code easier to read. The Commodore 64 programmer of 1985 had considerably fewer conveniences, but was not necessarily short of imagination.

Whilst browsing the Internet Archive, I came across a delightful little programming tip in a Spanish computer magazine. It demonstrated how the otherwise unremarkable BASIC REM statement could be persuaded to transform the visual appearance of a program listing. The technique required no additional software, hardware expansion or machine language programming. All it required was a little ingenuity and an understanding of the Commodore screen editor.

A Forgotten Tip from Spain

The January 1985 edition of Tu Micro, a Spanish computing magazine published by Ediciones INGELEK S.A., contains a short programming aside entitled REM's para Commodore 64, or REM Statements for the Commodore 64.

The author begins with the familiar observation that programmers routinely annotate their source code with comments. These comments are undoubtedly useful, but the author suggests that their presentation could also be made more attractive.

What follows is a ten-step recipe for introducing colour into a Commodore BASIC program listing. The technique uses quotation marks, reverse-video characters and embedded screen control codes to manipulate the appearance of remarks when the programmer enters the LIST command.

You can read the original Spanish instructions in the January 1985 edition of Tu Micro at the Internet Archive.

It is a small but revealing historical artefact. Among the more substantial articles about computer hardware, programming languages and applications, someone considered the appearance of a BASIC listing sufficiently important to share a technique with fellow enthusiasts.

More than four decades later, the idea remains surprisingly relevant.

When a REM Does More Than Nothing

The humble REM statement is arguably the laziest instruction in Commodore BASIC. It performs no calculations, draws no graphics and makes no music. Its purpose is to introduce a remark intended for the human reader rather than the computer.

10 REM CALCULATE THE SUM OF TEN NUMBERS
20 S=0
30 FOR I=1 TO 10
40 S=S+I
50 NEXT I
60 PRINT S
70 END

The first line explains what the program does. The BASIC interpreter encounters the REM token and disregards the remainder of that line during execution. Removing the comment would not change the numerical result.

However, executing a program and listing a program are two quite different activities. When the Commodore 64 executes a program, it interprets its instructions. When it lists a program, it converts the stored BASIC tokens and characters into a readable representation and sends them to the screen.

This distinction creates an interesting opportunity. Characters that are ignored during program execution may nevertheless influence the screen editor when the program is listed.

Commodore BASIC therefore permits a curious separation between what a program does and how its source code presents itself.

Understanding PETSCII

At the heart of this programming trick is PETSCII, the character encoding associated with Commodore's family of personal computers.

PETSCII includes letters, numbers, punctuation, graphical symbols and control codes. Unlike ordinary printable characters, control codes can instruct the computer to perform actions such as moving the cursor, changing the text colour or enabling reverse video.

Commodore BASIC programmers will recognise the use of control characters in statements such as:

10 PRINT CHR$(147)
20 PRINT CHR$(5);"HELLO WORLD"
30 PRINT CHR$(154)

The first line clears the screen. The second selects white text before displaying a message, whilst the third restores light blue text, the usual foreground colour of the Commodore 64 startup screen.

HELLO WORLD
Illustrative output of the PRINT example, with the message displayed in white.

The programmer can also enter many control characters directly through the keyboard. Within quotation marks, the screen editor normally represents these instructions as graphical symbols rather than immediately carrying them out. This makes it possible to store screen control instructions inside a BASIC program.

The technique described in Tu Micro goes a step further. Rather than placing these characters inside an executable PRINT statement, it places them within a remark and exploits the way the Commodore screen editor handles them during a program listing.

Reconstructing the 1985 Technique

The original magazine instructions are reproduced here in adapted English form. They describe a pair of BASIC remark lines that manipulate the presentation of a comment and restore the subsequent listing colour.

The procedure requires the original Commodore 64 keyboard functions. Readers using an emulator may need to consult its keyboard mapping documentation, as the positions of the Commodore and CONTROL keys can differ from those of a modern computer keyboard.

  1. Enter a BASIC line number, followed by the REM command and a pair of quotation marks, with no space between the quotation marks.
  2. Delete the closing quotation mark. Activate reverse video by pressing CONTROL and 9 together.
  3. Enter as many letter T characters as there are digits in the line number, followed by five additional T characters.
  4. Press SHIFT and M together, followed by the character representing the desired comment colour. The magazine identifies E for white and SHIFT-P for black.
  5. Press RETURN to store the BASIC line.
  6. Repeat the first three steps using the next BASIC line number.
  7. Disable reverse video by pressing CONTROL and 0 together. Enter the desired comment text.
  8. Enable reverse video again using CONTROL and 9. Repeat the fourth step, this time selecting the colour intended for the remainder of the program listing.
  9. Press RETURN to store the second BASIC line.
  10. List the program and observe the resulting presentation.

The repeated T characters are a particularly interesting element of the recipe. In the reverse-character representation used by the Commodore screen editor, these characters can represent deletion instructions. The number of repetitions is calculated to account for the length of the BASIC line number and the additional characters associated with the remark.

The reversed SHIFT-M character represents a shifted RETURN control code. Its significance is that it can terminate the screen editor's quote mode during listing, allowing subsequent control characters to operate as screen instructions rather than appearing merely as graphical symbols.

The result intended by the original author is a visually distinguished comment, with the surrounding BASIC listing displayed in a different colour.

Experimental note: The instructions above are adapted from the original historical source and have not yet been independently reproduced for this article. The exact keyboard sequence, visual result and subsequent editing behaviour require verification on a Commodore 64 or an accurate emulator.

Making BASIC Beautiful

To appreciate the possibilities of this technique, consider a small BASIC program that calculates the sum of the integers from one to ten. The program is deliberately simple, allowing us to concentrate on its presentation rather than its operation.

10 REM INITIALISATION
20 S=0
30 REM CALCULATION
40 FOR I=1 TO 10
50 S=S+I
60 NEXT I
70 REM RESULTS
80 PRINT "TOTAL:";S
90 END

The program has three clearly identifiable sections: initialisation, calculation and results. Each is introduced with a remark, but all the remarks appear in the same colour as the executable instructions.

Imagine instead that the programmer allocates different colours to each section heading, while the executable statements remain white. Initialisation could appear in cyan, calculation in light green and results in yellow.

INITIALISATION
20 S=0
CALCULATION
40 FOR I=1 TO 10
50 S=S+I
60 NEXT I
RESULTS
80 PRINT "TOTAL:";S
90 END
Illustrative HTML reconstruction of a colour-formatted BASIC listing, not emulator output or a type-in program.

Particularly important headings might also be distinguished using reverse video or decorative graphical characters:

 *** INITIALISATION *** 
20 S=0

 *** CALCULATION *** 
40 FOR I=1 TO 10
50 S=S+I
60 NEXT I

 *** RESULTS *** 
80 PRINT "TOTAL:";S
90 END
Illustrative reverse-video headings showing another possible visual treatment.

These are possible extensions of the original idea rather than demonstrated results of the magazine's recipe. Each variation would require practical testing to establish how reliably the screen editor reproduces the intended presentation.

Although decorative formatting might seem unnecessary for a nine-line demonstration program, the benefits become more apparent when a listing extends to several hundred lines. Coloured headings could provide visual landmarks, helping the programmer locate particular routines within a lengthy listing.

Some possible applications include:

The computer gains no computational advantage from these decorations. The intended beneficiary is the programmer.

The Practical Limitations

There is a price to pay for making a BASIC listing more attractive in this manner. Unlike modern syntax highlighting, the formatting instructions occupy space inside the stored program. Additional remarks and control characters consume memory on a machine where available memory is already a practical constraint.

More significantly, the technique manipulates the very screen editor that the programmer relies upon to modify existing BASIC statements. If a listing conceals its own line numbers or alters the displayed characters, editing the original remarks may become more complicated.

The formatted representation of the program is no longer necessarily a faithful visual representation of its stored contents. A programmer attempting to edit a line directly from the screen could inadvertently modify the formatting or fail to reproduce its original control characters.

There is also the question of portability. A technique that works with the Commodore screen editor may produce unexpected results when a program listing is sent to a printer, exported to a modern text editor or processed by a cross-development tool.

Before adopting the technique in a substantial program, a practical experiment should establish whether the formatting survives saving and reloading, whether individual lines remain editable and whether the program executes identically with and without the decorative remarks.

These limitations illustrate an important distinction between embedding presentation instructions within source code and allowing a separate application to manage its visual appearance.

The Programmer as Typographer

We rarely associate computer programmers with typography. Yet the presentation of source code involves many of the same considerations as the presentation of a printed document. Hierarchy, spacing, contrast and consistency all influence how readily a reader can understand information.

A well-presented technical document guides the reader through its contents. Headings establish structure, paragraphs organise ideas and visual emphasis draws attention to important information. A computer program can benefit from similar principles.

The programmer who makes deliberate use of coloured remarks is effectively designing the reading experience of the program listing.

This is not quite the same as modern syntax highlighting. A contemporary development environment examines the source code and automatically applies colours to recognised elements, such as keywords, variables, strings and comments. The colour is generally determined by the editor rather than stored as part of the program.

The Commodore technique reverses this relationship. The programmer embeds presentation instructions directly into the source code. The listing becomes something closer to a formatted document, with the programmer responsible for determining its visual hierarchy.

Programming environment Presentation method Formatting responsibility
Conventional Commodore BASIC Uniform text presentation Screen editor
Commodore BASIC with formatted remarks Embedded control characters Programmer
Modern syntax highlighting Automatic recognition of language elements Development environment

There is no suggestion that the Spanish magazine invented syntax highlighting, nor that its technique was a direct ancestor of modern development environments. Rather, it demonstrates how programmers working within modest technical constraints addressed a recognisable problem: making source code more approachable for human readers.

It also raises a question that remains relevant today. Is source code written for the computer or for the human who must understand it?

The answer, of course, is both.

The International Language of Commodore BASIC

One of the pleasures of exploring historical computer magazines is discovering how programming knowledge circulated internationally.

Although the editorial text of Tu Micro is written in Spanish, the BASIC commands, keyboard functions and underlying computer architecture are immediately recognisable to Commodore enthusiasts elsewhere in the world.

A programmer in Madrid could experiment with precisely the same screen control characters as a programmer in Melbourne, London or New York. The natural languages differed, but the computer provided a shared technical vocabulary.

Related techniques had already appeared in English-language publications. In July 1983, COMPUTE! magazine published an article entitled Commodore REM Revealed, by John L. Darling, examining the unusual behaviour of characters embedded within Commodore BASIC remarks.

That article provides useful technical context for understanding the Spanish magazine's later recipe, particularly the interaction between reverse-video character representations, shifted RETURN characters and the listing operation. Whether the two articles share a direct editorial connection is not established.

These small programming discoveries were part of a broader culture of experimentation. Computer magazines provided a means of sharing techniques that might otherwise have remained confined to individual programmers, local computer clubs or conversations between friends.

Today, the digitisation of international computer magazines allows us to rediscover these ideas without being restricted to the publications that happened to circulate in our own country.

The Lost Art of the BASIC Listing

The Commodore 64 was not simply a machine on which people played games. It was also a machine that encouraged its owners to explore the relationship between software, hardware and human creativity.

Its limitations were often the starting point for experimentation. A programmer dissatisfied with the standard appearance of a BASIC listing did not necessarily wait for someone to develop a better programming editor. They could investigate the behaviour of the existing system and devise their own solution.

The little programming recipe published in Tu Micro in January 1985 captures something of that spirit. It transforms an instruction associated with documentation into a tool for visual expression. The humble remark becomes a decorative heading, a navigational aid or simply an opportunity to make programming a little more enjoyable.

Modern development environments have largely removed the practical need for such ingenuity. Nevertheless, there is something satisfying about discovering an unexpected capability within a familiar machine, particularly one that has been studied and documented for more than forty years.

Perhaps the greatest charm of this technique lies in its apparent contradiction. The BASIC instruction specifically intended to do nothing could be persuaded to do something quite sophisticated.

All the programmer had to do was type LIST.

Writer's Notes

Reader Guide

The following material expands on the terminology, historical context, technical concepts, and related reading connected to this article.

Glossary

Some of the terms used in this article have specialised, historical or technical meanings. This glossary provides additional context for selected terms and ideas.

PETSCII
The character encoding used by Commodore computers, including letters, graphical symbols and screen control codes. Its control codes can change text colour or move the cursor, allowing stored characters to affect how a BASIC listing appears.
REM
A Commodore BASIC statement introducing a remark for a human reader; the interpreter ignores the remainder of the line when the program runs. Control characters in a remark can nevertheless affect the screen when the program is listed.
BASIC listing
A readable display of a stored BASIC program, produced on the Commodore 64 with the LIST command. Listing differs from execution: characters ignored when the program runs may still affect its appearance on screen.
Quote mode
A screen-editor state in which control-key presses are generally displayed as graphical symbols rather than immediately performed, allowing control characters to be entered into program text. The historical recipe relies on ending this mode during listing so subsequent control characters can act as screen instructions.
Reverse video
A display effect that reverses the foreground and background of characters. On the Commodore screen editor, reversed graphical characters can also represent control codes, a feature used in the proposed formatting technique.

Frequently asked questions

Curious about something you’ve just read? These frequently asked questions explore some of the key ideas, details and questions surrounding the topic.

How can REM statements add colour to a Commodore 64 BASIC listing?

A 1985 technique places PETSCII screen control characters inside REM lines. When the program is listed, the screen editor may interpret those characters as instructions to change the listing’s appearance.

Do coloured REM statements change how a BASIC program runs?

The BASIC interpreter ignores the rest of a REM line during execution, so the remarks are intended to affect the listing rather than the program’s calculations. It is still advisable to test that the program executes identically with and without the decorative remarks.

What are the drawbacks of formatting a BASIC listing this way?

The remarks and control characters consume program memory and may make lines harder to edit if the displayed listing conceals or alters characters. The formatting may also produce unexpected results when printed or exported to other tools.

Has the original colour-formatting recipe been verified?

The adapted 1985 recipe has not been independently reproduced. Its exact keyboard sequence, visual result and editing behaviour need testing on a Commodore 64 or an accurate emulator.

References and Further Reading

This article was inspired by a delightful programming tip discovered in the January 1985 edition of the Spanish computing magazine Tu Micro. The following references provide historical context and technical insights into the creative use of Commodore BASIC remarks and PETSCII control characters. They make for interesting further reading, particularly for enthusiasts wishing to explore the ingenuity of early home computer programmers and experiment with these techniques themselves.

  1. Ediciones INGELEK S.A. (1985). REM's para Commodore 64. Tu Micro, Year 2, No. 9, January 1985. Internet Archive digitised edition.
  2. Darling, J. L. (1983). Commodore REM Revealed. COMPUTE!, Issue 38, July 1983, p. 204. Digitised article.
  3. C64-Wiki. REM. Commodore BASIC V2 command reference.
  4. C64-Wiki. PETSCII Codes in Listings. Technical reference for embedded Commodore screen control characters and their graphical representations.

Disclosure

This article is an independent historical and technical exploration inspired by publicly accessible vintage computing publications. The original Spanish instructions have been interpreted and adapted into English with the assistance of artificial intelligence. The programming technique has not yet been independently verified on original Commodore hardware or through emulation, and its behaviour may vary between implementations. Illustrative examples are provided for educational and experimental purposes. All referenced publications, trademarks and historical materials remain the property of their respective rights holders. This article is not affiliated with or endorsed by Commodore or the original publishers.

Change log

  1. [2026-12-05] Initial release