Est. 1978 Advanced

Assembler (Motorola 6809)

The assembly language of the MC6809, the 1978 processor its own designers called "the best 8 bit machine so far made by human" — 59 orthogonal instructions, 1464 instruction-and-addressing-mode combinations, two stacks, a movable direct page, and program-counter-relative addressing built for position-independent ROM code.

Created by Motorola; architecture and instruction set by Terry Ritter and Joel Boney

Paradigm Assembly, Imperative, Low-level
Typing Untyped; all operands are bytes, 16-bit words or addresses interpreted by the instruction applied to them
First Appeared 1978
Latest Version No versioned language standard. Motorola's reference is the MC6809-MC6809E Microprocessor Programming Manual (M6809PM/AD), original issue 1 March 1981, reprinted May 1983. Maintained cross-assemblers still target it: LWTOOLS 4.25 (18 July 2026) and asm6809 2.17 (15 June 2025)

Assembler (Motorola 6809) is the assembly language of the MC6809, the last and most elaborate of Motorola’s 8-bit microprocessors, introduced in 1978. It is an unusual entry in this encyclopedia because its designers wrote down, at length and in public, exactly what they were trying to do. Terry Ritter and Joel Boney published a three-part account of the design in BYTE across January, February and March 1979 under the title “A Microprocessor for the Revolution: The 6809”, opening with the claim that they were describing “the best 8 bit machine so far made by human.” The language that resulted is the most orthogonal and the most programmer-oriented 8-bit assembly language of its generation — and the processor sold badly, for reasons that had nothing to do with the instruction set.

History and Origins

An interim part, deliberately chosen

By the mid-1970s Motorola’s 6800 was losing ground. Chuck Peddle and others had left to build the far cheaper MOS 6502, and Motorola’s own forward-looking effort was MACSS, the project that emerged as the 16/32-bit 68000. When Motorola polled its existing 6800 customers, the answer came back that many were not willing to pay 16-bit prices for 8-bit jobs. That produced a decision to build one more 8-bit part — a substantially improved 6800 rather than a new architecture.

Ritter and Boney describe taking a specification to roughly thirty customers, including some “known to be hostile to the 6800”, with two questions. Should the new part be 8-bit or 16-bit? And did compatibility with the 6800 have to hold at the object-code level or only at the source level? The answers shaped the language directly. Customers accepted 8 bits provided the common 16-bit operations — add, subtract, load, store, compare, multiply — were present. And “virtually every customer indicated that source compatibility was sufficient”, because nobody intended to plug 6800 ROMs into 6809 systems.

That is why the 6809 is a source-compatible successor and not a binary-compatible one. A 6800 program is moved forward by reassembling it, not by running it. Motorola’s own programming manual is careful about how strong that guarantee is: 6800 assembly source “may be assembled using the Motorola MC6809 Macro Assembler”, and the resulting code, “while not as compact as native M6809 code, is, in most cases, 100% functional.”

Measured, not guessed

The design was driven by static analysis of existing 6800 code — Table 1 of the BYTE series reports a count over 25,000 lines of 6800 source. Loads and stores together came to 38.7% of the instructions counted, while adds and subtracts were only 2.8% — but a large fraction of those loads and stores were paired with adds and subtracts, which is to say they were 16-bit arithmetic done by hand. The 6809 therefore got genuine 16-bit load, store, add, subtract and compare. Increments and decrements were 6.1% of the same count, but they clustered inside loops, so the answer was not more INC/DEC instructions but autoincrement and autodecrement addressing modes that make the pointer update disappear into the memory reference.

The building-block plan that did not happen

The other governing goal was position independence. Motorola’s market was embedded systems assembled from pre-written routines, and combining hand-written assembly modules normally meant editing addresses. The plan was a market in licensable ROM building blocks — floating point, graphics, compression — that a system integrator would simply combine and burn. Almost every distinctive feature of 6809 assembly exists to serve that plan.

The market never appeared. Motorola’s only released example was the MC6839 floating-point ROM, and the industry solved the problem instead with relocating linkers and loaders. But the features survived the plan that motivated them, and the multitasking operating systems they enabled — OS-9, TSC’s UniFlex — are what the 6809 is actually remembered for.

The Language

Programming model

The 6809’s programmer-visible state is five 16-bit registers and four 8-bit ones:

RegisterWidthRole
A, B8Accumulators, inherited from the 6800
D16A and B concatenated (A is the high byte) — the 16-bit accumulator
X, Y16Index registers; Y is new
S16Hardware stack pointer — the 6800’s stack, used by JSR, RTS and interrupt stacking
U16User stack pointer — new, entirely under program control, never touched by the hardware
PC16Program counter, usable as an index base
DP8Direct page register — new
CC8Condition codes: E F H I N Z V C

The two-stack arrangement is the feature the operating systems were built on. A routine in ROM can be entered with its caller’s data on U, do its own work on S, and return without the caller’s stack having been disturbed. Ritter and Boney were explicit that the goal was reentrancy and recursion, and that both mattered for “easy implementation of block structured high level languages”.

DP supplies the high byte of every direct-mode address, so the fast 8-bit addressing form can be pointed anywhere in the 64 KB map rather than being stuck in page zero as it is on the 6502 and the 6800. It is fast and compact — and it is also the classic 6809 bug, because a routine that assumes a DP value someone else changed will read and write the wrong page silently.

Orthogonality as an explicit goal

The 6800’s instruction count went down, from 72 opcodes to 59, while the number of distinct instruction/addressing-mode combinations rose from 197 to 1464 — figures Motorola prints in the MC6809 datasheet. Operations that had been separate instructions became addressing modes on other instructions.

The designers defended this directly:

We do not feel a processor with 500 different assembler mnemonics for instructions is better than one with 59 powerful instructions that operate on different data in the same manner.

Their example is TFR R1,R2, one transfer instruction with 42 valid register pairings, replacing a family of TAB, TBA, TAP mnemonics; EXG uses identical syntax and has 21 valid forms. As they put it: “In the time it took to read three sentences you just learned 63 new 6809 instructions!” The same instinct produced ANDCC and ORCC in place of individual set/clear-flag instructions, and PSHS/PULS/PSHU/PULU, which take a register list and push or pull any subset of the machine state in one instruction.

The designers’ summary of the aim was blunter than most architecture documents get: “It is easier to write good programs on the 6809 than bad ones!”

Addressing modes

The addressing modes are where the language really differs from its contemporaries. Motorola’s datasheet lists ten, and the indexed family alone covers:

  • constant offsets of 0, 5, 8 or 16 bits from X, Y, U, S or PC
  • accumulator offsetsA, B or D used as a signed index, computed at run time
  • autoincrement/autodecrement by 1 or 2, pre-decrement or post-increment, which is exactly the stack discipline generalised to any pointer register
  • indirection layered on top of most of the above, plus extended indirect
  • program-counter relative, for data as well as branches

That last one is the position-independence mechanism. LDA MSG,PCR assembles the difference between the label and the instruction, so the reference survives relocation. Combined with long relative branches (LBRA, LBSR, and 16-bit conditional branches reaching the whole ±32 KB span), it means a well-written 6809 module can be loaded anywhere without a linker touching it. Motorola’s manual states the property plainly: position-independent code “means that the same machine language code can be placed anywhere in memory and still function correctly.”

New instructions

The 6809 did not add many instructions, and said so. The ones it did add are pointed:

InstructionWhat it does
MUL8×8 unsigned multiply, A × BD. A hardware multiply was still unusual on an 8-bit microprocessor in 1978
SEXSign-extend B into A, making D the signed widening of B
TFR / EXGTransfer or exchange any two like-sized registers
LEAX/LEAY/LEAS/LEAULoad effective address — compute an indexed address and keep it, which is how pointer arithmetic and PCR addressing are expressed
ABXAdd unsigned B to X, a one-byte table index
PSHS/PULS/PSHU/PULUPush or pull a register list on either stack
SYNCHalt until an interrupt line asserts — synchronise with external hardware without a polling loop
CWAIClear CC bits, stack the entire machine state, then wait — pre-staging the interrupt entry to cut latency
SWI2, SWI3Two extra software interrupt vectors alongside the 6800’s SWI, commonly used as OS call gates
LBRA, LBSR, long Bcc16-bit relative branches, so relative addressing covers the entire map

Opcodes are organised in three pages: most instructions are a single byte, with a $10 prefix for the second page (CMPD immediate is $1083) and $11 for the third (CMPU immediate is $1183). LBRA and LBSR were deliberately kept on page one to save a byte each.

An assembler that knew about the old machine

One neat consequence of the source-compatibility decision landed in the assembler rather than the silicon. Some 6800 instructions were dropped in favour of two-instruction 6809 sequences — and, Ritter and Boney write, “these sequences are generated automatically by our assembler when the 6800 mnemonic is recognized.” The assembler, not the CPU, is where the last of the 6800 compatibility lives.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
* Position-independent string compare, 6809 style.
* Entry: X -> input string, Y -> buffer, A = input length.
* Uses U for the caller's data, S for our own linkage.

CMPSTR  PSHS    A,B,X,Y         save exactly what we touch, one instruction
        TFR     A,B             length into the loop counter
LOOP    LDA     ,X+             post-increment: fetch and advance in one mode
        CMPA    ,Y+
        BNE     NOMATCH
        DECB
        BNE     LOOP
        LEAX    MSG,PCR         PC-relative: survives relocation of this module
        ORCC    #$01            set carry to signal "found"
        PULS    A,B,X,Y,PC      restore and return in one instruction
NOMATCH ANDCC   #$FE            clear carry
        PULS    A,B,X,Y,PC

MSG     FCC     /MATCHED/
        FCB     $04

Note PULS ...,PC as the return: pulling the program counter off the hardware stack is the return instruction, which is the kind of thing the register-list design makes natural.

Market Reception

The 6809 was expensive to build and expensive to buy. It took roughly 9,000 transistors against about 4,100 for the 6800 and 3,500 for the 6502, and that showed up at the counter: Ancrona’s advertisement in the April 1981 Radio-Electronics (page 111) lists mail-order single-unit prices of $36.50 for an MC6809P, $8.95 for a Z-80 CPU and $6.40 for a P6502 — roughly six times the price of a 6502 for the Motorola part.

The performance advantage was real but not proportionate to the price. In the assembly-language Sieve of Eratosthenes results collected in BYTE by Jim Gilbreath (September 1981) and by Jim and Gary Gilbreath (January 1983) — ten iterations of the sieve over an 8,190-entry flag array, with the per-machine assembly versions contributed by readers rather than written by one author — a 2 MHz 6809 completed the run in about 5.1 seconds, against 13.9 seconds for a 1 MHz 6502 and 6.8 seconds for a 4 MHz Z80: better work per clock cycle than either. But an 8 MHz 8086 came in near 1.9 seconds and an 8 MHz 68000 near 0.49. These are single-benchmark figures from period magazine testing, on differing implementations, memory systems and hand-written code, and should be read as an indication of rough standing rather than a controlled comparison.

The timing was also bad. The 8086 arrived the same year, the 8088 the next, and Motorola’s own 68000 in 1979. Motorola soon signalled that its future 8-bit products would be cut-down 68000s rather than improved 6809s. A beautifully designed 8-bit assembly language arrived just as the industry stopped caring about 8-bit assembly languages.

The 6309 Dialect

Hitachi’s 6309, with preliminary data in its 1985 data book, was sold as a CMOS low-power 6809 and is fully 6809-compatible in its emulation mode. It also contained a native mode with extra registers (E and F, concatenating into a 16-bit W, which joins D to form the 32-bit Q; a V transfer register; a zero register; a mode register MD) and new instructions — hardware division, 32-bit arithmetic, block transfers, bit manipulation — none of which Hitachi documented.

The April 1988 issue of the Japanese magazine Oh! FM published the first description of these capabilities, and Hirotsugu Kakugawa’s memo to comp.sys.m6809 in early 1992 spread them to the English-speaking world. The result is a second, reverse-engineered dialect of the language. NitrOS-9 is the best-known project to exploit it, and modern assemblers including lwasm and asm6809 support 6309 mnemonics alongside 6809 ones.

Current Relevance

The language is listed as historical because no new commercial system is designed around it, but it remains unusually live for a 1978 8-bit assembly language:

  • The toolchain is maintained. LWTOOLS reached 4.25 on 18 July 2026 and asm6809 2.17 on 15 June 2025 — both cross-assemblers actively released in the last two years, supporting macros, conditional assembly, linking and both 6809 and 6309 targets. Pierre Sarrazin’s CMOC compiles a large subset of C to 6809 assembly for the CoCo, Dragon, Vectrex, Thomson machines, OS-9 and FLEX.
  • The community produces new code. The CoCo, Dragon and Vectrex scenes all still ship assembly-language software, and NitrOS-9 continues as a 6309-aware descendant of OS-9.
  • The hardware has not entirely vanished. Rochester Electronics catalogues MC6809 devices as a continuing source for the original NMOS part, and FPGA implementations — John Kent’s HDL core among them — run 6809 code, reportedly at clock rates the 1978 silicon never reached, though published speed ratings for those cores are not well sourced.
  • The documentation is complete and free. Motorola’s programming manual, the datasheets, and the Ritter and Boney BYTE series are all scanned and readable, which is why the 6809 remains a popular architecture for people learning assembly language from primary sources.

Why It Matters

The 6809’s assembly language is the strongest 8-bit answer to a question most 8-bit architectures never asked: what should an instruction set look like if the people using it are going to write large, modular, relocatable programs by hand?

Every characteristic feature follows from that question. Program-counter-relative addressing for data, so a module can be moved. A second stack, so a library routine can keep its own state without disturbing its caller’s. A movable direct page, so the fast addressing mode is not a scarce global resource. Register-list push and pull, so saving and restoring context is one instruction instead of six. Orthogonal TFR, EXG and LEA, so the programmer learns a rule rather than a table. Motorola even shipped the demonstration — the full source of the ASSIST09 monitor, printed in the programming manual as a model of how the style was supposed to work.

The business case behind all of it collapsed. The ROM building-block market never materialised, linkers solved the relocation problem in software, the part cost six times what a 6502 cost, and 16-bit processors arrived the same year. But the features found a different use than the one intended: they made it possible to run a genuinely multitasking, multi-user operating system in 64 KB without memory-management hardware, which is what OS-9 did and what nothing else in the 8-bit world managed as well. For an architecture designed to be interim, that is a reasonable legacy — and the assembly language it defined is still the one people reach for when they want to show what 8-bit assembly programming could have looked like if orthogonality had been affordable.

Timeline

1974
Motorola releases the MC6800. Its programming model — two 8-bit accumulators A and B, one 16-bit index register X, a stack pointer, a program counter and a condition code register — becomes the baseline the 6809 assembly language must stay source-compatible with
1978
The MC6809 reaches the trade press: Ian Powers's note "MC6809 microprocessor" appears in Microprocessors vol. 2 no. 3 (July 1978), page 162. Motorola dates the part's introduction to 1978
1979
Terry Ritter and Joel Boney, the 6809's designers, publish "A Microprocessor for the Revolution: The 6809" in BYTE in three parts — Part 1, Design Philosophy (January 1979, page 14); Part 2, Instruction Set Dead Ends, Old Trails and Apologies (February 1979); Part 3, Final Thoughts (March 1979). It remains the fullest first-hand account of why the instruction set looks the way it does
1979
Microware's OS-9 Level One appears — sources date the first version to 1979-1980 — written in 6809 assembly language and developed as the supporting operating system for the BASIC09 project that Motorola had contracted. It is the clearest proof of the 6809's reentrancy and position-independence claims: a multitasking, multi-user OS inside a 64 KB address space with no MMU
1980
Tandy announces the TRS-80 Color Computer in July and ships it in September, built on the 6809E. The "CoCo" goes on to become, by most accounts, the largest single population of machines programmed in 6809 assembly
1981
Motorola issues the MC6809-MC6809E Microprocessor Programming Manual (M6809PM/AD), original issue 1 March 1981. Appendix B prints the complete assembly source of ASSIST09, a ROM-resident monitor, as a worked example of the position-independent, modular style the architecture was designed for
1981
The 6809's price problem is visible in the catalogues: the Ancrona advertisement in Radio-Electronics (April 1981, page 111) lists single-unit mail-order prices of $36.50 for an MC6809P against $8.95 for a Z-80 CPU and $6.40 for a P6502
1981
Williams Electronics ships Defender — demonstrated in late 1980, released in arcades in February-March 1981 — the first of a run of 6809-based arcade games written in hand-coded assembly; Stargate follows later the same year, and Robotron: 2084, Joust and Sinistar over the next two
1982
The 6809 reaches consumer hardware beyond Tandy: Dragon Data introduces the Dragon 32 in August, and the Vectrex vector-display console is released in North America in October around an MC68A09 clocked at 1.5 MHz
1983
BYTE publishes Jim and Gary Gilbreath's "Eratosthenes Revisited: Once More through the Sieve" (January 1983), whose assembly-language results put a 2 MHz 6809 at about 5.1 seconds on the Sieve benchmark against 13.9 seconds for a 1 MHz 6502 and 6.8 seconds for a 4 MHz Z80 — faster per clock than either, but well behind the 16-bit parts already shipping
1985
Hitachi's 6309, a CMOS 6809 with preliminary data published in its 1985 8/16-Bit Multi-chip Microcomputer Data Book, is marketed simply as a low-power 6809. Its extra registers and instructions go undocumented
1988
The April 1988 issue of Oh! FM, a Japanese magazine for Fujitsu personal computer users, is credited with the first published description of the 6309's hidden native mode, opening a second, unofficial dialect of 6809 assembly language
1992
Hirotsugu Kakugawa posts "A Memo on the Secret Features of 6309" to the comp.sys.m6809 newsgroup in early 1992, putting the extended instruction set in front of an English-speaking audience; the work it prompted eventually led to NitrOS-9 for the Color Computer 3
2009
LWTOOLS — William Astle's lwasm assembler and lwlink linker, begun in 2006 — has its initial release on 29 January 2009. With Ciaran Anscomb's asm6809 and Pierre Sarrazin's CMOC C compiler, it becomes the modern toolchain for writing 6809 assembly on a hosted machine
2026
The toolchain is still maintained: LWTOOLS 4.25 is released on 18 July 2026, following asm6809 2.17 on 15 June 2025. Rochester Electronics also catalogues MC6809 parts as a continuing source for the original NMOS device

Notable Uses & Legacy

OS-9 and BASIC09 (Microware, 1979-)

OS-9 Level One was written in 6809 assembly language for Motorola, as the operating system underneath the BASIC09 project. It is a process-based, multitasking, multi-user real-time OS whose entire design leans on 6809 features: reentrant modules built from position-independent code, a separate user stack so a ROM routine can keep its own private stack, and the fast interrupt request for low-latency service. The later Level Two used external memory-management hardware. OS-9 outlived the 6809 by decades, migrating to the 68000 and later to C.

TRS-80 / Tandy Color Computer (1980-1991)

Tandy's CoCo line ran a 6809E and, across the Color Computer 1, 2 and 3, kept a high degree of software compatibility from 1980 until the CoCo 3 was discontinued in 1991. It very likely put more 6809 assembly programmers in bedrooms than every embedded design-in combined, and its community — through NitrOS-9, the Color Computer Archive and cross-assemblers such as lwasm — remains the most visible source of new 6809 code.

Williams Electronics arcade and pinball hardware (1981-1990s)

Williams built Defender (1981), Stargate, Joust, Robotron: 2084 and Sinistar on the 6809, with game logic hand-written in assembly against tight frame deadlines. The processor stayed in the company's product line well beyond the arcade era: the Williams Pinball Controller (WPC) platform of the 1990s is built around a 6809 clocked at 2 MHz.

Vectrex (General Consumer Electronics / Milton Bradley, 1982-1984)

The only vector-display home console ever sold used an MC68A09 at 1.5 MHz with 1 KB of RAM. Every game was assembly language driving a vector generator in real time, including the built-in Mine Storm. Its cartridges remain a well-documented corpus of 6809 code, and CMOC still lists the Vectrex as a supported target.

European and Japanese home computers

Dragon Data's Dragon 32/64 (from August 1982), Fujitsu's FM-7 series, the Thomson MO and TO machines widely deployed in French schools, Hitachi's own MB-6890 and S1, and the Commodore SuperPET — a 6809 card grafted onto a PET, originating in a University of Waterloo project to give computer-science students a cheap programming platform — all ran 6809 code, giving the language distinct regional software cultures.

Electronic musical instruments (1980s)

The 6809 became a common control processor in synthesizers and samplers. PPG built the Wave series around a 6809 with 6500- and 6800-series support chips, Oberheim used it in the Xpander and the Matrix instruments, and Ensoniq's Mirage sampler and ESQ-1 and SQ-80 synthesizers are all reported to be 6809-based. Ensoniq is said to have chosen the externally clocked 6809E so that the processor could be synchronised to the sound chip, though that rationale rests on secondary accounts rather than Ensoniq documentation.

Language Influence

Influenced By

Influenced

Hitachi 6309 Assembler

Running Today

Run examples using the official Docker image:

docker pull
Last updated: