68000 assembler and disassembler
Assemble Motorola 68000 code in the browser and export S-records (S19/S28/S37), Intel HEX, raw binary, a C array, an Amiga hunk executable or an Atari ST .PRG; disassemble hex, binaries, S-records or Intel HEX with a byte-exact reassembly check; inspect and convert S-record files.
Added
How to use it
Assemble
Type on the left. The listing updates as you type, and ⌘/Ctrl + Enter assembles at once. Errors appear under the line that caused them.
-
Syntax. Motorola style, as used by vasm and Devpac.
-
Labels start in column 1; the colon is optional.
-
Labels starting with
.are local to the last global label, so.loopcan be reused. -
Comments start with
;or with*in column 1. Text after the operands is also a comment.
-
-
Instructions. The full MC68000 set, with
.B,.Wor.Lsizes (word if you leave it off).-
All twelve addressing modes.
d16(An)and(d16,An)are both accepted. Write$1234.wfor an absolute short address. -
HS/LOaliases andDBRA/DBFare accepted. -
Illegal combinations, such as
MOVEtod16(PC),MOVEMto(An)+orADDQ.Bto an address register, are reported as errors.
-
-
Branch sizing. A branch without a size is made short or word automatically, over as many passes as it takes.
-
Optimise (off by default):
-
MOVE.L #n,DnbecomesMOVEQ. -
ADD/SUBof#1..8becomesADDQ/SUBQ. -
A constant absolute address that fits becomes
abs.w.
-
-
Expressions:
-
Numbers:
$FF,%1010,@17,255, and'AB'(character constants). -
Operators:
+ - * / % << >> & | ^ ~ !and parentheses, with the same precedence as vasm. Shifts bind tightest, and a binary!is OR. -
*is the current address.
-
-
Directives:
-
ORG;EQU,=andSET;DC.B/W/L(DC.Balso takes strings);DS;DCB;EVEN;CNOP. -
ALIGN n, which aligns to 2^n bytes, as in vasm. -
INCBIN "file": add the file first with Add INCBIN file…. -
MACRO/ENDM, with\1..\9for arguments,\0for the size and\@for a unique label suffix. -
END [entry]. -
SECTION,XDEF,XREFandOPTare accepted and ignored.
-
The entry point comes from END, otherwise from a label called start, otherwise from the
first ORG.
Output formats
-
S-records:
-
The
S0header holds your text. -
Data goes in
S1,S2orS3records (16-, 24- or 32-bit addresses). Auto picks the smallest that reaches your highest address. -
Records carry 16 or 32 bytes each.
-
An
S5record counts the data records (S6above 65,535 records). -
The file ends with
S9,S8orS7holding the entry address. -
Every record’s checksum is the one’s complement of the low byte of the sum of its count, address and data bytes.
-
Each
ORGblock becomes its own run of records, so gaps stay gaps.
-
-
Intel HEX (I32HEX): type 04 sets the upper 16 address bits and type 05 the entry address.
-
Binary: everything from the lowest to the highest address, with gaps filled with zeros.
-
C array and
dc.wsource. -
Amiga hunk: one
HUNK_CODEwith aHUNK_RELOC32entry for every 32-bit reference to a label. -
Atari ST
.PRG: a$601Aheader, the TEXT segment and a GEMDOS relocation table.
For hunk and PRG output, labels are treated as relative to the first address. References to labels in 8- or 16-bit fields cannot be relocated, and the tool warns about them.
Disassemble
Paste any of these, or load a file:
-
hex bytes, where an
1000:prefix sets the address; -
S-records;
-
Intel HEX.
The output uses Motorola syntax:
-
L_xxxxlabels mark branch and jump targets. -
D_xxxxlabels mark data reached through PC-relative addressing, which is shown asDC.B. -
DC.Wstands in for any word that is not a 68000 instruction.
Re-assemble round trip assembles the disassembly again and reports either identical bytes or the addresses that differ.
S-record
Paste or load S19/S28/S37 or Intel HEX. The tab:
-
checks every record’s length and checksum;
-
shows the header text, the entry address, the
S5count against the real number of records, and any gaps and overlaps; -
converts to S-records of any type, Intel HEX or binary.
Reference
A searchable table of every 68000 instruction, with its syntax, sizes, the flags it changes (XNZVC) and its cycle counts. Below it are tables of the addressing modes and the directives.
Sharing
Share link copies a link to the open tab with its input: source to assemble (?src=, ?opt=true for optimisations), machine code to disassemble (?dis=, ?org=, ?addr=), or S-records/Intel HEX to inspect (?srec=). Short inputs stay readable; long programs are packed into ?s=. For example ?dis=4E75&org=$2000#dis.
To add up the cycles of a whole routine against an Amiga or ST frame, use the 68000 cycle counter.
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.