AZ80 Z80 cross-assembler


AZ80 Z80 cross-assembler

Last updated Jan 29 2022. Edited by Herb Johnson, (c) Herb Johnson, except for content written by others. Contact Herb at www.retrotechnology.com, an email address is on that page..

Introduction:

This Web page is about a 2010 and forward adaptation of the AZ80 cross-assembler with subsequent fixes, as described below.

A18 history

AZ80 [zip file link] is one of a number of cross-assemblers in C source, freely distributed by the developer William C Colley III, through the "C Users Group" or DUG library of C programs of the 1980's and later. I (Herb Johnson) obtained a copy of AZ80 and adapted it to compile under the lcc-Win32, a Windows/MS-DOS C compiler, to produce a 32-bit MS-DOS executable on the Windows "command prompt".

In 2010 I discussed with the AZ80 author, a adaptation of another assembler, when I adapted his A18 1802 cross assembler, as described on this linked Web page. That page also points to my other Web pages, where I have other cross assemblers from Colley I've adapted. That page also has some software tools and advice about using and compiling all these cross-assemblers. So look there for details.

Changes I've made to AZ80, is to accomodate additional ways to describe numeric values as hex, binary, octal. The syntax "0x" was a little tricky.

To run AZ80 as a 16-bit MS-DOS program under non-Windows MS-DOS, I compiled it with the former Borland's "Turbo C". The only change was to replace "#include malloc.h" with "#include alloc.h". The executable is AZ80_DOS.EXE. Again, check the A18 Web page for further explanation.

I provide the C sources and executables with my changes clearly marked. There are also docs and sample assembly code. For those who download my version, please advise me about any errors, issues or compliments. I make zero guarantees, offer zero warrenties. I am not responsible for any loss, injury or damage to person or property of any sort. Use entirely at your own risk.

bugs and features updates

Jan 2022 fixed problem with Z80 instructions like AND OR etc with 8 bit operand, where AZ80 evaluated the operand value as a 16-bit sign-extended 8-bit value (like not 03H = 0FFC0H) and choked. My test was in error, now I test for FF00H-FFFFH as acceptable values truncated to 00-FFH.

June 2020. I added another AZ80 MS-DOS executable AZ80_DOS.EXE as a 16-bit MS-DOS program compiled with Borland C under MS-DOS. In keeping with Digital Research's ASM for CP/M 2.2 and other assemblers, I've changed the hex-record output size to 16 data bytes to produce ":10" type records. There was an error in producing the checksum for the records, which I've fixed. Thanks to Dave Dawe for calling these to my attention.

Dave pointed out that the Intel hex record format, included an "address only" record at the end of the hex file. The record is unique because it has zero data, so it begins with ":00"; and because it's a type 01 record, not a type 00 record. The record includes an address and a checksum. The "END hhhh" pseduoop, both marks the end of the source file and provides an address for that record. Some hex loaders interpret that record as a starting address. See the AZ80.DOC file for details of the END pseudoop.

Apr 2020, JR instruction error: Scott Baker pointed out the following. When AZ80 assembled the JR instruction, the relative jump, it failed to error-flag when the backward jump exceeded the negative byte value of 80H (-127). The assembler produces a positive value AND doesn't note the error. This has now been repaired, and there's a test program to verify. - Herb Johnson

Other Z80 cross assemblers

To support the 1802 and the Z80, I recompiled another cross-assembler offered freely and in C, called "asmx". Here's my slightly modified version of Bruce Tomlin's ASMX 2.0. A link to his site is on that page.

- Herb Johnson


Contact information:
Herb Johnson
New Jersey, USA

This page and edited content is copyright Herb Johnson (c) 2022. Copyright of other content beyond brief quotes, or of other copyrighted works, are held by those authors. Contact Herb at www.retrotechnology.com, an email address is available on that page..