Assembler (6510)
The assembly language of the MOS Technology 6510, the 6502 variant with an on-chip I/O port that powered the Commodore 64 and became the native tongue of its games, music and demoscene.
Created by MOS Technology / Commodore (6510 CPU); instruction set inherited from the MOS 6502
Assembler (6510) is the assembly language of the MOS Technology 6510, the processor inside the Commodore 64. The 6510 is a modified 6502. It keeps the 6502’s instruction set, registers and addressing modes unchanged, down to the undocumented opcodes. What it adds is hardware: a small I/O port built into the chip and mapped to addresses $00 and $01. In the C64 that port switches ROM and RAM in and out of the address space and runs the cassette recorder. So the language is 6502 assembly, but the programs look different. They lean on that port, on the C64’s custom chips and on the machine’s memory map. Independent estimates put Commodore 64 sales at 12.5 to 17 million units, and most of its commercial software was written this way. That made “6510 assembly” the everyday name for 6502 programming among a very large generation of home-computer programmers. Demoscene coders, game makers and hobbyists still write it today.
History & Origins
A 6502 with a Port
MOS Technology, owned by Commodore since 1976, designed the 6510 for the machine that became the Commodore 64. The goal was a cheap computer with 64 KB of RAM. The 6502 can only address 64 KB, and the machine also needed BASIC, the KERNAL operating system, a character set and memory-mapped I/O. Something had to decide which of those appeared in the address space at any moment. The 6510’s answer was an on-chip parallel port.
The designers found the pins for the port by reworking the 6502’s 40-pin package. Three 6502 pins were not connected at all. The phase-1 clock output and the redundant second ground pin were dropped. So was the SO (“set overflow”) input, which few designs used. After rearranging the address and data lines, six adjacent pins were free for port lines P0 to P5. The address bus could also be put into a high-impedance (tri-state) state, and the CPU could be halted cleanly. That let the VIC-II video chip share the bus with the processor.
The Commodore 64 (1982)
Commodore showed the C64 at the Consumer Electronics Show in Las Vegas on 7-10 January 1982. Production began that spring, and volume shipments started in August at $595. The 6510 ran at 1.023 MHz in NTSC machines and 0.985 MHz in PAL machines. The chip debuted with the computer; a preliminary MOS 6510 datasheet is dated November 1982.
Commodore documented the processor in the Commodore 64 Programmer’s Reference Guide (copyright 1982). Its chapter “Basic to Machine Language” introduces “the registers inside the 6510 microprocessor,” lists the “MCS6510 Microprocessor Instruction Set” alphabetically, and explains the processor port. It also points readers to 64MON, Commodore’s monitor cartridge with an assembler and disassembler. For more serious work, Commodore’s Professional Computer Division sold the Commodore 64 Macro Assembler Development System (copyright 1982). It was a disk-based package with an editor (EDITOR64), the assembler (ASSEMBLER64), a cross-reference tool, loaders and two monitors.
Monitors, Type-ins and Turbo Assembler
Many C64 owners met machine language through monitors rather than full assemblers. Jim Butterfield’s Supermon64 appeared as a type-in listing in Compute! in January 1983. Magazines printed long machine-language programs as columns of numbers for readers to key in.
In 1985 the German company Omikron released Turbo Assembler, written by Wolfram Roemhild. It ran on the C64 itself. Cracked copies spread through the scene, and groups kept modifying it for years. The maintainers of its best-known descendant call it “the most modified piece of C64 software ever.” One of those descendants, Turbo Macro Pro, first released by the group Style in January 1997, added support for Commodore’s RAM Expansion Unit.
Design Philosophy
The 6510 adds nothing to the 6502’s instruction set, so its assembly language shares the 6502’s philosophy: very few registers, a heavy reliance on the first 256 bytes of memory (“zero page”) and a small, regular set of instructions. What sets 6510 programming apart is the machine it lives in:
- Everything is memory-mapped. Graphics (VIC-II), sound (SID), timers and I/O (two 6526 CIAs) are programmed by reading and writing addresses in
$D000-$DFFF. There are no I/O instructions. - The processor port is part of the program. Addresses
$00(data direction register) and$01(data register) belong to the CPU itself. Rewriting$01changes what the rest of the address space means. - Cycles matter. At about 1 MHz, with the VIC-II stealing bus cycles on some raster lines, effects like split screens and extra sprites depend on counting clock cycles against the video beam.
- Use every trick. The 6510 runs the NMOS 6502’s undocumented opcodes. Some C64 programs use them, and modern cross-assemblers support them explicitly.
Key Features
Registers and Instructions
The programming model is identical to the 6502’s:
| Register | Size | Purpose |
|---|---|---|
A | 8 bits | Accumulator: arithmetic, logic, most loads and stores |
X, Y | 8 bits | Index registers and loop counters |
S | 8 bits | Stack pointer; the stack is fixed at $0100-$01FF |
P | 8 bits | Status flags: N, V, B, D, I, Z, C |
PC | 16 bits | Program counter |
The 56 documented instructions and the addressing modes are the 6502’s, including zero-page, indexed, (zp,X) and (zp),Y indirect modes. See the 6502 Assembler page for the instruction set in detail.
The Processor Port
The Programmer’s Reference Guide defines the six port lines like this:
| Bit | Name | Direction | Function in the C64 |
|---|---|---|---|
| 0 | LORAM | Output | BASIC ROM or RAM at $A000-$BFFF |
| 1 | HIRAM | Output | KERNAL ROM or RAM at $E000-$FFFF |
| 2 | CHAREN | Output | I/O or character ROM at $D000-$DFFF |
| 3 | - | Output | Cassette write line |
| 4 | - | Input | Cassette switch sense |
| 5 | - | Output | Cassette motor control |
By writing the right bit pattern to $01, a program can expose almost all 64 KB of RAM. Only the processor port itself remains, at $00 and $01. A common idiom is to bank out BASIC and the KERNAL while keeping I/O visible:
| |
A Small Program
This routine prints a message through the KERNAL’s CHROUT routine at $FFD2. It uses 64tass syntax and is started from BASIC with SYS 49152:
| |
Tools
| Tool | Type | Notes |
|---|---|---|
| 64MON | Monitor cartridge | Commodore’s monitor with assembler and disassembler, recommended in the 1982 Programmer’s Reference Guide |
| Macro Assembler Development System | Native assembler | Commodore’s 1982 disk-based editor, macro assembler, loaders and monitors |
| Supermon64 | Monitor | Jim Butterfield’s type-in monitor, Compute!, January 1983 |
| Turbo Assembler / Turbo Macro Pro | Native assembler | Omikron, 1985; Style’s Turbo Macro Pro from 1997 |
| 64tass | Cross-assembler | Grew out of Marek Matula’s DOS 6502tass; reworked and maintained by Soci/Singular; highly compatible with Turbo Assembler source; version 1.60 in 2025 |
| ACME | Cross-assembler | Multi-platform; targets 6502, 6510 (including illegal opcodes), 65C02 and 65816 |
| Kick Assembler | Cross-assembler | Mads Nielsen’s Java-based assembler with a JavaScript-like script language; first beta 2006, version 5.25 in November 2022 |
| VICE | Emulator | Started in 1993; includes a built-in machine-code monitor |
Evolution
The instruction set never changed. The hardware around it did:
- MOS 7501/8501 (1984). Used in the Commodore 16, 116 and Plus/4. Its I/O port grows from six to eight lines, but the NMI input and clock output are gone.
- MOS 8500 (1985). An HMOS version of the 6510, otherwise virtually identical. It was designed for the redesigned C64C and became standard with the 85xx chipset motherboards around 1987.
- MOS 8502 (1985). The CPU of the Commodore 128, able to run at 2 MHz. The C128 added a built-in machine-language monitor, reached from BASIC 7.0 with the
MONITORcommand, so simple assembly work no longer needed a cartridge or type-in. - MOS 6510T. An eight-line port version with no NMI or RDY, used in the Commodore 1551 disk drive for the Plus/4.
After Commodore’s bankruptcy in April 1994 ended C64 production, development moved to other machines. Programmers began cross-assembling on PCs and testing in emulators such as VICE. Cross-assemblers such as 64tass, ACME and Kick Assembler replaced native tools for most new work, and they added macros, scripting and support for the undocumented opcodes.
Current Relevance
The 6510 is a historical processor, but its assembly language is still written. Demo groups keep releasing C64 productions, and homebrew developers still ship new C64 games. Kick Assembler, 64tass and ACME remain the usual tools. VICE is still actively maintained: version 3.10 was published on SourceForge on 24 December 2025, with builds for macOS on both Apple Silicon and x86-64. Because the instruction set is plain 6502, general 6502 toolchains such as cc65’s ca65 also produce code for the C64.
There is no official Docker image for 6510 development. In practice, programs are assembled on a modern machine with a cross-assembler and run in VICE or on real hardware.
Why It Matters
Assembler (6510) shows how much a processor’s surroundings shape a language. The mnemonics are the 6502’s, but C64 programming grew its own idioms: banking ROMs through $01, racing the raster beam, and packing music drivers and effects into a few kilobytes. The Commodore 64 was a huge, cheap machine, and for many programmers of the 1980s, this was their first contact with how a computer really works. A demoscene and homebrew community still keeps that knowledge alive four decades later.
Timeline
Notable Uses & Legacy
Commercial Commodore 64 software
Most commercial C64 software was written in assembly language, either cross-developed on a larger computer or written directly on the C64 with a machine-code monitor or native assembler, to maximize speed and minimize memory use.
GEOS
Berkeley Softworks' 1986 graphical operating system for the C64 was programmed in assembly language. In 2016 Michael Steil announced that the GEOS 2.0 source had been fully reverse-engineered into a form that builds with the cc65 suite.
SID music
Game composers such as Rob Hubbard, who taught himself machine code on the C64, delivered their music as 6510 code that drives the SID sound chip directly, a practice that underpins the C64's reputation for game music.
The C64 demoscene
Demo groups have written 6510 assembly continuously since the 1980s, first with native tools such as Turbo Assembler and later with cross-assemblers like 64tass, ACME and Kick Assembler, which explicitly support the 6510's undocumented opcodes.
Memory banking via the processor port
The C64's own memory map is controlled by 6510 code: writing to the processor port at address $01 swaps the BASIC, KERNAL and character ROMs and the I/O area in and out, exposing almost the full 64 KB of RAM.