A Z80 cross-assembler, written in Python. It should therefore work on MacOS X, Linux, un*x (and even Windows, if you have the appropriate interpreter installed). This is intended for producing code to run on the Sam Coupe, but it may be useful for other Z80-based platforms as well.
The input files are text files, formatted using the Syntax of the Sam's popular COMET assembler. The output files are a compressed disk image which can be loaded by the SimCoupe emulator, containing the object code file.
This is version is considered release quality, and contains no known bugs. Please contact me if you find any, particularly if you can isolate any examples of bad code generation.
DownloadDownload pyz80 now!
Q. What are the licence terms of pyz80?
A. I am distributing pyz80 under the terms of the GNU General Public License. You can download and use it at no cost.
Q. Why write a z80 assembler?
A. Because I wanted one. I looked at several existing programs, and decided that writing a new one from scratch would probably be easier than modifiying any of the others to a) take COMET source as input, b) handle more than 64k of output, c) fit into a SimCoupe workflow.
Q. Why in Python?
A. Python is a very convenient language for scripting and prototyping - it really helps speed up development to take the "compile" step out of the edit-compile-run cycle. I could have used Perl, but I'd like to be able to understand it next week.
Q. What extra features are planned?
A. pyz80 currently implements all the items on my wish list. Please let me know if you have anything else to add!
Q. How compatible is it?
A. pyz80's source syntax is a superset of Comet's and is fully backwards compatible: any source file which can be assembled by Comet can also be assembled by pyz80. However, there are also some new features which can be added to source code, in which case Comet will no longer be able to assemble them.
Q. What are the new language features?
Complete support for all "undocumented" Z80 instructions, for loops (an instruction, or sequence of instructions, can be included in the object code multiple times), if blocks (control what code is generated, for multiple build variants), assert checks, local symbols (e.g. for writing quick loops, you don't need to define a globally unique name), macro substitution in symbol names, automatic execution of the saved object code, alignment of buffer space to boundaries, and a variety of mathematical expresions (useful for building data tables).