I am working on a Flex/Bison based 6502 assembler (for fun and learning) and looking around for a "standard" syntax for the assembly language. Opcodes and addressing are more or less standardised, so that is clear.

But what about assembler directives, defines, labels, etc? I see labels with a colon and without, defines with equals signs, or the keyword define. There doesn't seem to be a standard...

  • 2
    As far as I can tell, neither does one exist for any other architecture. Each assembler defines its own dialect for directives and labels. Commented Mar 9 at 13:27
  • @user3840170 OK. Thanks. I guess I'll cook my own then ;-). Commented Mar 9 at 13:58
  • 1
    64tass, ACME, cc65, Merlin32, KickAssembler, ORCA/WDC, and various others all have their own ideas on label structure and pseudo-ops. The basic address modes are specified in the spec sheet, so those are pretty consistent, and operators like "#<" don't vary much. Everything else varies quite a bit, though some of them were inspired by earlier assemblers for other platforms.
    – fadden
    Commented Mar 9 at 16:09
  • 1
    That said, pick one that is already used by an existing toolchain as that allows you to just plug in your own assembler and get the whole toolchain. Commented Mar 9 at 18:25
  • 1
    Incidentally, a huge amount of 6502 assembly code wasn't in ASCII, nor any other character set as such, but was produced on paper using a pen, pencil, or a mechanical typewriter, and then assembled "by hand". As such, it could use whatever notation for labels or anything else the author felt most convenient, including things like arrows between branches and their targets.
    – supercat
    Commented Mar 14 at 15:15

1 Answer 1


Is there an standardised 6502 assembly syntax?

Not really. While MOS' own Cross-Assembler might have been a base, it was way too primitive to be be considered. Still, there is a line that can be followed from that cross assembler over the KIM resident assembler and various Commodore/CBM assemblers all the way to more recent implementation like CA65.

So if (some) compatibility, CA65 would be the best to look at. On the other hand, there are Assemblers coming from a more professional background with no relation to the MOS linage - and as usual anything inbetween.

Wiki has a list of various 6502 assemblers, which may be a good start for research.

MOS History

Michael Steil did research this genealogy on pagetable, describingit in a series of articles:

MOS Heritage

As mentioned it's a rather primitive one 48 pages are enough to describe everything - but only due using a very spacious layout :))

It essentially offers only 6 code relevant direktives:

  • Defining a label
  • Using = to modify labels
  • .byte for byte values
  • .word for LSB words
  • .dbyte for a MSB words
  • * as special label to access the location counter

Later versions added more capabilities - see above link-list.

Today's Star CA65

The MOS/Commodore linage, can be seen in many later 6500 assemblers trying to keep compatibility, all the way to CC65's assembler CA65. CA65 has gained good popularity in recent years, not at least due being close to older MOS assemblers. Of course integration into a whole development system including C compiler and linker as well as bindings for all common 6502 systems might have played a role.

If your target audience is somewhat Commodore-affine, CA65 should be your prototype.

On the other hand, CA65 is also a great example how bloaty and problematic compatibility can be. For example by providing multiple ways to do the same (e.g.'>' and '.highbyte'). They all have a good reason to be there, but do not exactly help to understand what to use.

The Inbetweens: Big Mac/Merlin and EDASM

A structure more alike used by professional assemblers for other CPUs can be found with Apple II assemblers like Merlin (originally Big Mac) and Apples own EDASM. Here directives are pseudo ops not prefixed in any way. Both (Merlin, Merlin 8/16, EDASM) offer a quite useful toolbox, but are mostly restricted to being stand alone products.

The Other END: ORCA-M

At first ORCA-M may seem similar to EDASM or more generic assemblers, until one takes a closer look at it's macro language and unusual rich handling of compile time variables. Mainframe people will get big eyes, as ORCA-M follows, wherever possible, the structure set by IBM's F-Assembler for /370 mainframes.

Here the macro facilities aren't some add on to unroll code with, but a full fledged procedural DSL executed during compile time (*1). The possibilities to enhance and modify Assembler behaviour is almost endless (*2).

Maybe even more important, ORCA/M is part of an environment also featuring C, Pascal and Modula-2 compilers. No wonder that Apple selected the ORCA-suite as base for the Apple IIgs (65816) Apple Programmer's Workshop.

So What?

Well, for your own assembler it's all about if you want to follow one of those lines and which one. Hard to give any advice not diluted by personal preference - which in my case is of course 100% with ORCA/M's style :))

Format Question:

But what about assembler directives, defines, labels, etc? I see labels with a colon and without, defines with equals signs, or the keyword define. There doesn't seem to be a standard...

They follow different philosophies - and in some case (like CA65) the idea to offer more than one way to catch the users of different prior products. Also, Assembler is, like any other language, as well about being easy to write. The colon after a label being a good example: Most assembler only require it if the label is on a line of it's own - without any mnemonic to follow. Or the equal sign being a left over from the very primitive MOS assembler ... and so on.

Again, all yours to pick your own style.

*1 - It's possible, within limits, to write programs using the assembler as kind of an interpreter language for other purposes than just generating code. On /370 it wasn't unusual to use it as script language to transform data.

*2 - Somewhen around 1980 I wrote a small BASIC compiler using the macro language. That is, not a compiler program, but a set of macros generating machine codes from BASIC statements.

  • When I did Atari 2600 development in 2005, I used an assembler called DASM which went direct to binary, rather than generating relocatble object files, which was useful on a CPU where page-crossing branches must often be avoided because cycle-perfect timing is required.
    – supercat
    Commented Mar 9 at 21:43
  • 1
    @supercat There are next to countless assemblers. I just picked three groups to show the bandwidth.
    – Raffzahn
    Commented Mar 9 at 22:20
  • Indeed, but I think it's worthwhile to note a distinction between direct-to-assembly and relocatatble-output assemblers as categories, and I don't know whether you listed any of the former category.
    – supercat
    Commented Mar 9 at 23:08
  • 1
    There was a 6502 cross-assembler for Multics and Primos written at ECD corp, Bob Frankston used it at Software Arts to code VisiCalc, the first spreadsheet (rmf.vc/implementingvisicalc). It used different mnemonics than the MOS Technology ones, as well as its own directives.
    – John Doty
    Commented Mar 9 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .