6502 assembler
Assemble and disassemble 6502 and 65C02 code in the browser, with labels, local labels, expressions, and an optional undocumented-opcode set; download raw binaries, Atari binary-load files, or C64 PRGs; search the full opcode table with cycles and flags.
Added
How to use it
Assembler
Type on the left; the listing updates as you go (⌘/Ctrl + Enter forces it). Errors are shown on their line.
-
Labels start in column 1, with or without a colon. Labels starting with
.or@are local to the last global label, so.loopcan be reused. -
NAME = expr(orNAME equ expr) defines a constant.* = $0600or.org $0600sets the address; several origins make several segments. -
Directives:
.byte/.db(numbers and"strings"),.word/.dw,.text,.fill count,value. -
Numbers:
$FF,0xFF,%1010,255,'A'. Operators:+ - * / % & | ^ << >> ~,<expr(low byte),>expr(high byte),*(the current address). -
Zero-page addressing is chosen automatically when the value is known and below
$100. -
6502 + illegal adds the stable undocumented NMOS opcodes (
LAX,SAX,DCP,ISC,SLO,RLA,SRE,RRA,ANC,ALR,ARR,SBX); 65C02 addsBRA,STZ,PHX/PLX,TSB/TRB,(zp)and the other CMOS additions.
Output: a raw .bin (gaps between segments filled with zeros), an Atari binary load
.xex ($FF $FF, one header per segment, and a run address at $02E0 pointing at the
first segment), or a C64 .prg (two-byte load address, then the code).
Disassembler
Paste hex bytes — an 0600: prefix sets the origin — or load a binary file. Branch and
jump targets inside the code get Lxxxx labels, so the output assembles again.
Opcode table
Every opcode with its addressing mode, size, cycle count, and the flags it changes. Filter by
mnemonic, opcode ($A9), mode, or flag. Cycles marked * take one more when an indexed
address crosses a page; branches take one more when taken and two when they also cross a
page. Unstable undocumented opcodes are listed but never chosen by the assembler.
Sharing
Share link copies a link to the open tab with its input: source to assemble (?src=, ?asmcpu=nmos|65c02|illegal) or bytes to disassemble (?hex=, ?org=, ?addr=, ?discpu=). Long programs are packed into ?s=. For example ?hex=A9 01 60&org=$0600#dis.
To write and debug your own machine code on this emulator, use the Assembly and Debugger tabs of the Atari 8-bit computer page.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.