Discovering COMAL: A Different Way to Program the C64

I thought I knew the Commodore 64's programming languages, until a forgotten 1985 graphics handbook introduced me to COMAL. Combining BASIC's simplicity with Pascal-style structure, COMAL offered surprisingly straightforward commands for drawing graphics, moving sprites and creating animations. How did this capable little language escape my attention for forty years? Join me as I explore its origins, discover what made it different, and uncover its unexpected survival on modern Linux computers.

8-bit COMAL graphics illustration featuring pixelated mountains, a palm tree, geometric spiral and bright colours against a black background.
Discovering COMAL: a different approach to Commodore 64 graphics.

A Programming Language I Never Knew Existed

COMAL? I'd never heard of it. Then I came across Len Lindsay's 1985 book, Commodore 64 Graphics With COMAL, in the Internet Archive. Here was a language for drawing graphics, moving sprites and writing organised programs on the C64. How had I missed it?

I thought I knew the options. BASIC was where most of us began. Machine language was the next step for ambitious games programmers, while Pascal offered a more formal approach. I'd even explored the work involved in drawing graphics with BASIC on the VIC-20. Yet COMAL was a complete surprise. It turns out this alternative language has quite a history, and it hasn't entirely disappeared.

The discovery raised a simple question. What would home computing have felt like if the language I'd met first had encouraged tidy programs from the start? I don't think COMAL would have replaced the thrill of learning machine code. I do wonder what it might have changed along the way.

The Route from BASIC to Machine Language

British computer magazines shaped much of my early computing. They offered type-in games, useful programs and plenty of encouragement to experiment. On a Commodore 64, BASIC was ready as soon as you switched on. Enter a few lines, type RUN and see what happened. That was part of its charm.

The magazines also showed what skilled programmers could do with the C64's 6510 processor and VIC-II graphics chip. If you wanted fast games and smooth animation, assembly language seemed the natural next step. Pascal and LOGO existed, but neither was central to the route I followed.

COMAL wasn't on my radar. That doesn't mean it was unknown in Britain. It simply wasn't prominent in the magazines and projects that caught my attention. Other programmers were taking a different path.

Looking back, the missing piece was not a lack of interest in programming. It was the material reaching me. A magazine might devote pages to faster sprites or a clever trick with the screen border, while another publication might explain how to write more reliable programs. Both were part of the same computing world, but they led readers in different directions.

So What Exactly Was COMAL?

COMAL stands for Common Algorithmic Language. It began in Denmark in 1973 through the work of teacher Børge R. Christensen and computer scientist Benedict Løfstedt. Their goal was a language that felt as welcoming as BASIC but taught better ways to organise programs.

BASIC was easy to start with. Larger programs, however, could become a maze of line numbers and GOTO statements. Pascal encouraged clearer structures, but usually lacked BASIC's immediate, type-and-run experience on home computers. COMAL tried to offer both.

It supported named procedures (groups of instructions with a name), structured loops and clear conditions. The Commodore 64 version kept line numbers for editing, but programs did not need to jump between them to work. COMAL checked syntax as you typed and checked program structure before running it.

These features made COMAL useful in schools, particularly in Denmark during the 1980s. Its central appeal was not just a longer list of commands: beginners could start quickly while learning to write programs they could understand and change.

Think of a program that draws ten shapes. In a tangled BASIC listing, changing a shape might mean hunting for the same drawing instructions in several places. With a named procedure, you could keep those instructions together and call them when needed. That simple habit matters far beyond the Commodore 64. It is still part of good programming today.

The Commodore 64 Had a Graphics Problem

The C64 had excellent graphics hardware for its day. Its VIC-II chip supported colour graphics, scrolling, eight hardware sprites and collision detection. But the built-in BASIC V2 offered few commands to control these features. Drawing a line could mean calculating memory addresses and using POKE to put values into them.

BASIC extensions such as Simons' BASIC tried to make this easier. COMAL went further by providing a separate programming language with its own graphics commands. Lindsay's book covers COMAL 0.14, including X-Y drawing, turtle graphics and sprites.

The commands say what they do. MOVETO sets the drawing position. DRAWTO draws a line. PLOT marks a point, FILL colours an area, and PENCOLOR chooses a colour. SPRITEPOS moves a sprite, while SPRITECOLLISION helps detect contact. You could think about the picture instead of every memory address.

That is a useful change of focus for a beginner. Instead of looking up registers before trying an idea, you can sketch it with a few instructions and see the result. The C64's hardware still sets the rules, but the language can take care of some of the groundwork. That leaves more room to play with shapes, colours and movement.

Drawing Something with COMAL

Here is a small original example based on the COMAL 0.14 commands documented in Lindsay's book. It is intended to draw a white square with two diagonal lines on a black screen.

BACKGROUND 0
SETGRAPHIC 0
HIDETURTLE
PENCOLOR 1

MOVETO 60,40
DRAWTO 180,40
DRAWTO 180,160
DRAWTO 60,160
DRAWTO 60,40

MOVETO 60,40
DRAWTO 180,160
MOVETO 180,40
DRAWTO 60,160

The first four commands set the background, select high-resolution graphics, hide the turtle cursor and choose white for the pen. MOVETO shifts the pen without drawing; DRAWTO draws to the next position. The rest describes the square and its diagonals, one line at a time.

This is an illustrative listing, not a tested program. I have not run it on a Commodore 64 or in an emulator. Its value here is showing how easy the instructions are to read.

But easy graphics commands are only half the story. In COMAL, a PROC can give a group of instructions a name, such as DRAW'SQUARE, so it can be used again. A FOR ... DO loop can repeat instructions without copying them line after line. That's the difference between adding graphics commands to BASIC and learning a language designed around clear program structure.

If I were building on this example, the next step would be to put the drawing instructions inside a procedure. I could then experiment with different coordinates or use a loop to draw several shapes. The example stays small here because I want to show how the language reads, not claim to have built and tested a complete graphics application.

Turtles, Sprites and Their Limits

COMAL also offered turtle graphics, an idea made popular by LOGO. Instead of choosing screen coordinates, you tell an imaginary pen to move FORWARD or turn LEFT or RIGHT. Repeating those movements can produce shapes and patterns while teaching useful ideas about angles and geometry.

Sprites were another attraction. Commands such as DEFINE, IDENTIFY, SPRITEPOS and SPRITECOLOR made the C64's moving objects easier to manage. In ordinary BASIC, much of that work called for memory addresses and POKE statements.

COMAL couldn't remove the hardware's limits. In high-resolution bitmap mode, each 8-by-8 pixel area could use only two colours. Nor should we assume COMAL could match the speed of a carefully written assembly-language game. Its advantage was making experiments easier to write, read and improve.

I also like the contrast between its two graphics styles. Coordinate drawing asks where a line should end. Turtle graphics asks where the pen is pointing and how far it should travel. Both can create pictures, but they make the programmer think in different ways. That seems a worthwhile lesson in itself, whether or not you ever make a game.

Why Had I Never Heard of It?

COMAL wasn't a secret. The American Commodore magazine RUN covered COMAL 0.14 in October 1984, discussing its structured programming and graphics features. Books, reviews and user communities existed. So why did it pass me by?

My best explanation is the culture of the magazines I read. Games, clever graphics effects and machine-language listings drew my attention. If you wanted to learn how a commercial arcade game worked, assembly language seemed the obvious direction. COMAL's educational strengths were less visible from that viewpoint.

There was a practical barrier too. COMAL wasn't built into a standard C64. Version 0.14 had to be loaded from disk; a later COMAL 2.0 cartridge was another option. For someone content with BASIC and magazine listings, buying or finding another language may not have seemed worthwhile.

I can't say exactly why I missed it. But the contrast is telling: the same computer could inspire one person to learn machine code and another to learn structured programming.

Nor is this a contest with BASIC. Its greatest strength was that everyone with a standard C64 already had it. A second language had to offer something useful enough to justify the extra effort. For a school teaching good habits, COMAL made sense. For a hobbyist trying to copy a game from a magazine before dinner, it may have been harder to justify.

COMAL Is Still Around: Meet OpenComal

The biggest surprise is that COMAL did not vanish with the eight-bit era. Dutch programmer Jos Visser began developing OpenComal in 1992 and later released it as free software under the GNU General Public License. It was designed to work across platforms, including Linux.

Visser's account, Comal Has Been Set Free, adds a personal link. He learned COMAL through school, where it helped him understand structured programming. While I was drawn from BASIC towards machine language, he found a different route.

Readers curious about the language can start with the OpenComal project and its documentation to explore procedures, loops and conditions on a modern computer. A C64 emulator is not needed to investigate those ideas.

There is one important catch. OpenComal is not a drop-in replacement for the C64's COMAL 0.14 graphics environment. Commands tied to Commodore hardware, including the graphics listing above, should not be expected to work unchanged on Linux. The language survives, even where the original machine-specific features do not.

That distinction makes OpenComal interesting rather than disappointing. We can separate the ideas of a language from the hardware it once controlled. A modern Linux computer does not have a VIC-II chip, but it can still teach the value of a clear loop, a well-named procedure and a program that another person can follow.

A Different Path Through Home Computing

Finding COMAL has reminded me that our personal history of computing is only one part of the story. I knew the route from BASIC to machine language, but not the one that combined BASIC's friendly approach with Pascal-like structure and readable graphics commands.

I haven't loaded COMAL into an emulator yet. For now, an old book and a little research have opened another corner of C64 history. Better still, OpenComal means the language can still be explored on Linux. What else might be waiting in the archives?

Of course, the built-in BASIC was enough to launch countless home-computing adventures. For a return to that familiar world, continue with Everyone Wrote This Program on the Commodore 64, where an AD&D character generator shows how much fun a simple program could be.

Featured Product

Analogue Computer Series 001 T-Shirt

If SID represents the computer as an instrument, go back another generation to computers you could see, trace and understand. The Analogue Computer Series 001 T-Shirt celebrates electric brains, logic circuits, switches and glowing indicators — wearable computing history for those who appreciate the machinery behind the magic.

Disclosure: this is a commercial product link to an external Zazzle store associated with philreichert.org. Purchases are handled by Zazzle.

Analogue Computer Series 001 T-Shirt
Buy the T-Shirt

Available on Zazzle

by philreichert.org

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.

COMAL
An acronym for Common Algorithmic Language, originally developed in Denmark (1973) by teacher Børge R. Christensen and computer scientist Benedict Løfstedt as a classroom-friendly language. It combined BASIC’s interactive REPL-style ease with Pascal-inspired structured-programming features (named procedures, clearer loops and meaningful identifiers), checked syntax on entry and could retain line numbers for editing without relying on them to control execution—making it easier to write readable, maintainable programs for teaching purposes.
VIC‑II chip
The Commodore 64’s dedicated video chip that provided the machine’s graphics capabilities—high‑resolution and multicolour bitmap modes, hardware sprites, hardware scrolling and collision detection. Because these features were implemented in hardware accessible via specific registers and display memory, programmers who wanted fast, precise graphics often had to work at the machine level to manipulate the VIC‑II directly.
POKE (statement)
A BASIC command that writes a numeric value directly into a specific memory address (e.g. POKE 53280,0 to change a screen colour); on the C64 it was the common way to alter hardware state from BASIC. Using POKE requires knowledge of the machine’s memory map and bit‑level register meanings, so graphics and sprite work tended to be fiddly and error‑prone compared with higher‑level drawing commands.
A command style, popularised by the LOGO language, where an on‑screen “turtle” is moved with instructions such as FORWARD, LEFT and RIGHT to draw shapes—so programs describe motion and orientation rather than explicit coordinates. This approach is pedagogically useful for teaching geometric concepts and algorithmic thinking because it maps movement and turns to visual outcomes in an intuitive, repeatable way.
OpenComal
A modern, free implementation of the COMAL language created by Jos Visser starting in 1992 and distributed under the GNU General Public License; it runs on contemporary platforms (Linux, macOS, Windows, DOS and even WebAssembly). It preserves COMAL’s syntax and structured programming ideas for modern systems, but does not automatically replicate hardware‑specific C64 extensions (for example, the graphics and sprite commands found in a particular Commodore 64 COMAL implementation).

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.

What is COMAL and why was it created?

COMAL (Common Algorithmic Language) was developed in Denmark in 1973 to combine BASIC's interactive convenience with Pascal-like structured programming, making programs easier to read and teach while retaining immediate, interactive use.

How did COMAL make Commodore 64 graphics programming easier?

COMAL implementations for the Commodore 64 provided high-level graphics commands such as MOVETO, DRAWTO, PLOT, FILL and PENCOLOR plus turtle-graphics and sprite commands, letting programmers describe drawings and sprite behaviour without manipulating memory addresses and POKE statements directly.

Is COMAL still available for modern computers?

Yes: OpenComal, begun by Jos Visser in 1992, is a free GNU-licensed implementation that runs on platforms like Linux, macOS, Windows, DOS and WebAssembly, though it may not reproduce Commodore-64-specific hardware features unchanged.

Why was COMAL less visible to some home-computer hobbyists?

COMAL was often used in educational settings and was not built into the Commodore 64, requiring disk or cartridge installation, while many hobbyists followed a BASIC-to-assembly path focused on games and machine-language graphics, so a separate structured-language environment was less prominent in that culture.

Further Reading and Original Sources

COMAL has a richer history than its modest place in home-computing magazines might suggest. These books, contemporary articles and modern projects offer different ways to explore the language.

  • Commodore 64 Graphics With COMAL — Len Lindsay, Reston Publishing, 1985. The book that sparked this investigation. It explores COMAL 0.14 graphics programming, including drawing commands, turtle graphics and hardware sprites.
  • C64 COMAL Reference Guide — A period technical reference for exploring the Commodore 64 implementation, its programming syntax and graphics commands.
  • COMAL — RUN Magazine, October 1984 — Colin Thompson's contemporary introduction to COMAL, beginning on page 40. A useful example of how the language was presented to Commodore enthusiasts at the time.
  • COMAL: A Brief History — Background on COMAL's development in Denmark, its educational origins and its adoption on early computer systems.
  • OpenComal — Jos Visser's free implementation of COMAL. Includes documentation, software information and a browser-based playground for readers who want to explore the language today.
  • Comal Has Been Set Free — Jos Visser's 2002 account of learning COMAL, discovering structured programming and developing OpenComal for modern computers.

Disclosure

This article explores the history, features and continued existence of the COMAL programming language, informed by historical publications, technical documentation and modern online resources. The included COMAL graphics example was developed with AI assistance and has not been tested on Commodore 64 hardware or in an emulator. AI tools also assisted with research, drafting, editing and the creation of illustrative artwork. The author's personal recollections and observations reflect his own computing experience.

Change log

  1. [2026-11-15] Initial release