asmx 2.0 macro cross-assembler

asmx 2.0 macro cross-assembler

Last updated Dec 30 2023. Edited by Herb Johnson, (c) Herb Johnson, except for content written by others, including the ASMX cross assembler. Contact Herb at, an email address is on that page..


This Web page is may2012 adaptation of the asmx cross-assembler by Bruce Tomlin, to support the COSMAC 1802 "Membership Card" created by Lee Hart. I've also added some features and made minor code changes. Other 1802 software is available from this linked Web page. The ASMX cross-assembler supports "macro" capability; that's a feature I wanted to make available for 1802 Membership card owners; in a cross-assembler with sources freely available. It supports many other 8-bit microprocessors. Features of the cross-assembler are in a documentation file; I've modified the document to note the changes I made. Most changes are initialed with "HRJ" or "Herb" or other's initials for their changes.

An 1802 cross-assembler I offer is A18 as on this linked Web page.Look at the A18 Web page for links to similar cross-assemblers for 8080, Z80, 6800, 8008 and more.

asmx from Bruce Tomlin

The asmx cross assembler is a multi-CPU macro assembler written by Bruce Tomlin and available from his Web site. The version I downloaded in 2012, is "" Version 2.0 beta 5, with files a few years older. My asmx version is 1) not current to Bruce's and 2) has changes that may not be in Bruce's sources.

Meanwhile, Bruce Tomlin has updated his asmx assembler. His "version 2.0" as offered has updated sources to currently Nov 2023. Apparently he still calls it "2.0 beta 5". He also provides useful assembler-test programs for each supported processor. Other links on his Web page, are to earlier versions and to a C++ version in development. On his site, there's no specific terms of use or license described. Bruce seems to support a lot of classic video-game projects with hardware and software. There's other tools on his site which may be of interest.

In due course, I may update my version of asmx to accomodate Bruce's updates. I get very little correspondence about my version of asmx; so it gets very little attention from me. That explains itself. - Herb Johnson

asmx as offered by me

Here's my MODIFIED version of asmx v2.0b5, a ZIP file with all sources, test files, and the 32-bit Windows command-line .exe program. My changes and other's changes are described below. A similar document is in the ZIP file. Reported errors are listed below. The modifications I and others have made the sources, often have the initials of their creator. Also, I produced an 8008 version of the 8085 cross-assembler file. As of July 2017, I've retained the file structure which Bruce uses; his MAKEs ought to work for Linux-like compilers. Thanks to Scott Vitale for calling this to my attention. To see Bruce's 2009 code, check his Web sites for the version noted.

I've compiled ASMX with a Windows based C compiler. My compiled exe program runs in a 32-bit MS-DOS window under versions of Windows. See my A18 notes about that Windows C compiler and about 32-bit and 16-bit Windows/MS-DOS stuff. To run on an older 16-bit MS-DOS system, you would have to recompile with a 16-bit MS-DOS compiler, for instance Borland's "Turbo C" for MS-DOS. To run in Linux, compile with their GCC compiler and make system; Bruce's Makefile is included with the sources. For a 64-bit windows compiler, find a 64-bit C compiler for Windows.

I run the assembler as follows: rename the exe to "asmx20" and under the Windows command prompt:

C:>asmx20 C1802 -l -o -w -e [source].asm

This produces an 1802-assembly compatible [source].asm.lst listing, and a [source].asm.hex file in Intel hex format. Other object options are S-type Motorola, or binary. Error messages go to the screen, and are in also the listing file.

asmx changes

I made a few changes to the source, first to accomodate lcc-32's restrictions that procedures like "procedure()" must be defined as "procedure(void)"; and secondly to accomodate features of some 1802 assemblers. I've initialed my changes in the modified sources, except for all the "(void)"'s I had to add.

Features specific to 1802 users are:

INCL was not used, it's called INCLUDE

PAGE was not active code, but I restored function to assembler; adds FF char to start of PAGE line

HIGH was > or H() (but I fixed assembler to accept HIGH)
LOW was < or L() (but I fixed assembler to accept LOW)

A "feature" I can't change, is the fact that error messages in listings and copied to the console (command line) provide the error message, followed by the source line where the error occurred. I find this different from other software tools that reverse that order. But it's too difficult to change this.

A feature of some 1802 assemblers is to accept statements like:

DB ("B"+80H)
DB ("="+80H)

But in asmx, single char strings are not treated as byte value for byte operations. But single characters are accepted in these formats:

DB "GOT",80H ; four bytes long
DB ('='+80H) ; one byte long

So one has to fix their source, "x" changed to 'x' where x is any single char. I wrote a C program "quote.c" to find all "x" not in comments, and change to 'x'. The program in C source and lcc-32 compiled .exe is in the ZIP file. Review the result in case my program goofs.

Apr 2014: I've added an 8008 cross assembler. It uses the older Intel 8008 mnemonics, three letters only. Later, Intel produced an 8008 assembly mnemnonic set like their 8080 set. I'll get to that another day. This is still a work in progress. There's many ancient 8008 assembly features not supported in this version.

May 2014: Bill Beech noted ASMX didn't handle 'SHR', 'SHL', 'AND', 'OR', 'NOT', etc. in the expression analyzer. It does do '>>', '<<', '&' and '|' and '!'. Bill fixed that, I've updated my sources and manual. Thanks.

Sept 2016: Hank Riley called to my attention the documentation on MACRO and LIST/OPT MACRO features. Features such as macro expansion and the necessity of lables in column 1, were not documented in the main body of the ASMX HTML document. I fixed the HTML document accordingly; read the MACRO and LIST/OPT for details.

July 2017: No code changes; just aligned the ZIP file's directories to match Bruce Tomlin's so his "make"s would work with my file-set in Linux. Thanks to Scott Vitale for that effort. I added a clarifying document.


There are test sources and resulting listings for each processor, included with the assembler from Bruce, for test purposes. Some of them have deliberate errors. I've documented the one difference I found between Bruce's listings and mine.

Again, my interests are in the 1802 and 8008. So I assembled a number of 1802 software sources on this site, not all with ASMX. They look good but I've not checked every byte. You may have to modify some sources, see the notes above and the assembler's docs. I'd like to hear about any specific errors especially for the 1802, but tell me about other errors. You might wish to go back to Bruce via his Web site, for errors with other processors or other code. - Herb Johnson

Jan 2022: 1) Fran Montserrat noted that the assembler crashes if a source line is longer than about 250 characters. While ASMX limits source lines to 256 bytes, the listing file write crashed because the listing pads characters. I fixed the crash by also limiting the total listing file line to about 256 characters. Also I now issue a warning if the input line exceeds 256 chars. In most cases, the truncated characters are comments so the line can be processed anyway. 2) My ASMX20 now shows a version of 2.05b+, as it's based on Tomlin source 2.05b. I'll update the copyright string to reflect the most recent year/month of source changes. Executing the assembler with no options will show the version and copyright strings.

Dec 2021: Scott Vitale called to my attention that the 8051 assembler had a CJNE instruction syntax error. I fixed it based on a similar fix from Bruce's b06 version of 8051 code. Also the 8048 and 8051 needed to be "big-endian" not "little-endian".

Sept 2016: Hank Riley called to my attention, that a MACRO without a MEND may get you in trouble, at least until the next MACRO/MEND; then you have unbalanced macros. Also be sure any lables in your MACRO start in column 1, as must all lables in ASMX.

May 26 2016: Lee Hart reports: "One quirk is that an END statement does not put a null line at the end of a HEX file (like :00000001FF). My Heathkit and VDS EPROM programmers, and the Intel HEX file loader for the Z80MC complain about this." Response: I think some assemblers and applications, use that statement to represent a starting address. My examination of the ASMX source, shows how to create this record.

The END pseduoop accepts an optional value, as in "END 0000". If a value is provided, the assembler produces an Intel hex terminating record of zero data bytes and that value as address, and the appropriate checksum. If the value provided is 0000, the record ":00000001FF" will be created. If END has no value, then no terminating record will be written to the hex file.

May 2014: Bill Beech suggested ASMX does not well-support parenthesis ( ) in expressions. When () are part of the syntax of the assembler, use [] brackets instead of parens in expressions.

April 2 2013: Paul Robson reports: "I used your asmx cross assembler Windows port and it has a bug. When writing out binary files it doesn’t (I think) do so in binary mode, as on my system it is writing out 0D 0A for 0A values." I fixed this in April 2014.

June 25 2013: Josh Bendason reports: "1. Hex numbers beginning with $ are not recogonized. (That's true, it's an option set in the Z80 C source to permit lables such as $HERE.) 2. z80 assembler: The ADD command must be in the form ADD A,r". Herb comments: A Zilog manual shows "ADD A,r" but not "ADD value".

Contact information:
Herb Johnson
New Jersey, USA
To email @ me, see
see my home Web page.

This page and edited content is copyright Herb Johnson (c) 2023. Copyright of other contents beyond brief quotes, is held by those authors. Contact Herb at, an email address is available on that page..