Chris Collins

Tools · retro

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 .loop can 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, .W or .L sizes (word if you leave it off).

    • All twelve addressing modes. d16(An) and (d16,An) are both accepted. Write $1234.w for an absolute short address.

    • HS/LO aliases and DBRA/DBF are accepted.

    • Illegal combinations, such as MOVE to d16(PC), MOVEM to (An)+ or ADDQ.B to 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,Dn becomes MOVEQ.

    • ADD/SUB of #1..8 becomes ADDQ/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, = and SET; DC.B/W/L (DC.B also 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..\9 for arguments, \0 for the size and \@ for a unique label suffix.

    • END [entry].

    • SECTION, XDEF, XREF and OPT are 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 S0 header holds your text.

    • Data goes in S1, S2 or S3 records (16-, 24- or 32-bit addresses). Auto picks the smallest that reaches your highest address.

    • Records carry 16 or 32 bytes each.

    • An S5 record counts the data records (S6 above 65,535 records).

    • The file ends with S9, S8 or S7 holding 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 ORG block 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.w source.

  • Amiga hunk: one HUNK_CODE with a HUNK_RELOC32 entry for every 32-bit reference to a label.

  • Atari ST .PRG: a $601A header, 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_xxxx labels mark branch and jump targets.

  • D_xxxx labels mark data reached through PC-relative addressing, which is shown as DC.B.

  • DC.W stands 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 S5 count 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.

Runs entirely in your browser; nothing you type leaves this page.