The Geek Site.


6502 Cross Compiler: 1998-

[Download] [Software] [Emulators] [Migrate] [Specs] [Links] [E-mail] [Geek Site] [Home]
Thanks to E-mail Tracking.

[Screen Shot]
Screen shot of a demo program compiled with Quetzalcoatl.
Yep; that's right! Bitmapped graphics on a VIC!

Click here to download the Quetzalcoatl Compiler.

Compilers are perhaps the most elegant of all computer programs.

I wrote Quetzalcoatl becaused I wanted to write a
full-blown compiler and linker from scratch!

October 30, 2006: Online Forum for Quetzalcoatl Questions and Suggested Changes. This replaces e-mail which had become flooded by spam, spam, spam
October 13, 2006: MacOS Port by Harry, MasterMind Game.

October 9, 2006: GNU Public License Source Release. The Quetzalcoatl Source has now been released under GPL. A big thanks to Harry Dodgson, who did a lot of work on Quetzalcoatl in 2005. This is version 2.1.0 BETA, as in Beta Release. It includes many bug fixes and improvements by Harry. I've also updated the Compiler Hacker's Guide (CHG). I would have liked to have added textbook quality comments, but I simply don't have time. Instead I've commented the headers and some of the source bodies. Along with the CHG, I hope this is enough for would-be compiler hackers. The CHG contains suggestions for what function still needs to be added, and a tutorial on optimisation. You can download the source from here here. Enjoy!

May 30, 2001: Congratulations Mike Dailly for taking the 6502 Challenge. This will be smaller next release. By request, here's the very-rough programmers manual in HTML. The Quetzalcoatl Source code is being released on request. Here's the Quetzalcoatl Compiler Hacker's Guide. The latest version of Quetzalcoatl (not yet on this web site) has double-byte support. What does this mean? Among other things, that you can write your programs in East-Asian languages. Not immediately useful perhaps, but nice to know it's there if you need it. :-)
September 15, 1999: The Quetzalcoatl Source Code is (finally) released!
June 14, 1999: To date, there have been 147 downloads of Quetzalcoatl: 39 for Linux, 84 for DOS and 106 for Windows. (Some people grab more than one port, thus the overlap.) I have been bugged for the source by 1 (count 'em!) person. I haven't had time to do any more work on the new version, so structs will have to wait! :( If anyone has the time, energy and naivity ;) to take this on themselves, let me know! Quetzacoatl is written in C++ and uses an LL(1) parser; (Not LR(1)! Automatically generated compilers are for wimps!)
March 10, 1999: Quetzalcoatl's Source will be released under GNU once enough people have bugged me to do so.
February 5, 1999: Found the pointer bug. It turned out to be a minor problem with scoping. To workaround it include brackets in your pointer references within expressions: *x = (*x) + 3
December 15, 1998: Several people have reported using Quetzalcoatl as a 6502 assembler; This is fine! For standalone assembler programs call your main routine "main:". Here's a brief note I prepared describing how to call assembler routines from C. The next release of Quetzalcoatl will add pointers and relocatable assembler modules. I plan to release the Quetzalcoatl Source Code under GNU sometime 1999, after I've had a chance to tidy up and properly document the code.
October 4, 1998: Version 2.0a4 is out, with the Commodore 64 port, limited C pointers and assembly listing files. Quetzalcoatl now lets you edit bitmapped graphics or your own programmable character set and link them directly into the executable!
September 25, 1998: Once were a 6502 warrior? See if you can squeeze a few more bytes out of the 6502 assembly runtime library.
September 24, 1998: The Alpha Release is out! The keyword here is "Alpha". It may still contain bugs, and the documentation is incomplete. If you don't feel up to this wait for the beta. The Alpha version is here.

What is Quetzalcoatl

Quetzalcoatl is a Cross Compiler for 6502 Processors. Quetzalcoatl runs under Win32, Linux, Solaris, DOS and MacOS. It can compile and link programs written in a subset of ANSI C called Tiny C, Assembler, the 1983 UPL language or any combination thereof. It is suitable for producing programs for the Commodore VIC-20 and Commodore 64. (You can run executables directly on emulators such as PCVIC or Free-64). With some minor modifications Quetzalcoatl will also produce code for the Apple ][, old 6502 game consoles (such as the Nintendo Entertainment System) and 6502 embedded systems.

Quetzalcoatl began as an experiment in compiler optimisation. Although it was not originally planned to be released publicly, the result was a decent "C" Compiler that could benefit the 6502 retrocomputing community. Accordingly Quetzalcoatl is being released free for non-commercial use.

What is Quetzalcoatl's Development Status?

The 6502 Assembler and Tiny C (arrays, subroutines, integer math) is complete. Adding structs, multi-level pointers, classes and more optimisations are suggested projects. Because Quetzalcoatl is an LL(1) compiler, it is easier and more interesting / educational than e.g. YACC generated compilers. See the Compiler Hacker's Guide.

The Alpha version was completed in 1998, and the Beta in 2006.

Since Quetzalcoatl's target systems generally have very little memory and few spare cycles it's unlikely you'll see Quetzalcoatl turn into bloatware. Future releases of Quetzalcoatl will focus on further optimisation, rather than adding advanced language features.

Extensions such as graphics and sound interfaces for particular platforms can be written as application modules, linked in only when needed. This site will maintain an archive for any such modules you write and want to share with other developers. As provided Quetzalcoatl restricts its platform-dependent code to the runtime library. Even within it there is very little platform-dependent code anyway; So much so that console I/O executables for the VIC-20 actually run on the Commodore 64 without modification!

How efficient is Quetzalcoatl?

Quetzalcoatl was developed as a test-bed for experimenting with native code optimisation. Accordingly, the code that is produced is already reasonably efficient. In later releases it will become even moreso. The 6502 was an ideal target for this experiment, because it is far from being an ideal processor!

Quetzalcoatl has a tiny runtime library; just over 1Kb, allowing it to squeeze onto just about anything. Quetzalcoatl comes with a full-blown linker that can select smaller versions of the runtime library, based on whatever functions you happen to use. The source of the runtime library is also distributed with Quetzalcoatl, allowing developers to produce even smaller custom versions or ports for other platforms.

What is UPL?

UPL is an old language developed in 1983. Although Quetzalcoatl began as a UPL compiler, it very quickly became a C compiler. I wouldn't recommend anybody use UPL today. You can do everything it can do and much more with C.

What does Quetzalcoatl cost?

Quetzalcoatl is free for non-commercial use.

Why does Quetzalcoatl have such a strange name?

I think you already know the answer to this. J

How do I get Quetzalcoatl?

Quetzalcoatl is available here. This lists the 1998 Alpha version for various platforms, and the 2006 Beta GPL source release. Why so long between releases? Lack of time! Hard to earn a living from 6502 coding these days! ;-)

Where is the Quetzalcoatl Documentation?

Click here for


Quetzalcoatl has been developed by Brendan Jones in his spare (hah!) time.



[VIC-20] [Geek Site] [Home] Thanks to E-mail Tracking.

© Brendan Jones, 1998. All Rights Reserved. Quetzalcoatl is a trademark of Kestrel Defence.
Created: August 20, 1998.