M68K Interpreter

Complete guide to using the M68K assembly language emulator

Quick Start

Execute

Run the entire program from the current position

Reset

Clear all registers and reset emulator state

Step

Execute one instruction at a time

Undo

Reverse the last executed instruction

📚Instruction Set Reference

Arithmetic Operations
  • ADD

    Add the source operand to the destination operand and store the result in the destination location.

  • ADDA

    Add the source operand to the destination address register and store the result. The source is sign-extended before adding.

  • ADDI

    Add immediate data to the destination operand. Store the result in the destination operand.

  • SUB

    Subtract the source operand from the destination operand and store the result in the destination location.

  • SUBA

    Subtract the source operand from the destination address register. Word operations are sign-extended to 32 bits prior to subtraction.

  • SUBI

    Subtract the immediate data from the destination operand. Store the result in the destination operand.

Logic Operations
  • AND

    AND the source operand to the destination operand and store the result in the destination location.

  • ANDI

    AND the immediate data to the destination operand.

  • EOR

    EOR (exclusive or) the source operand with the destination operand and store the result in the destination location.

  • EORI

    EOR the immediate data with the contents of the destination operand. Store the result in the destination operand.

  • NOT

    Calculate the logical complement of the destination and store the result. NOT performs bit-by-bit logical complementation.

  • OR

    OR the source operand to the destination operand, and store the result in the destination location.

  • ORI

    OR the immediate data with the destination operand. Store the result in the destination operand.

Basic Instructions
  • CLR

    The destination is cleared and loaded with all zeros. Cannot be used to clear an address register.

  • EXG

    Exchange the contents of two registers. The entire 32-bit contents are exchanged. Supports data, address, and mixed exchanges.

  • EXT

    Extend the least-significant byte in a data register to a word, or the least-significant word to a longword.

  • MOVE

    Move the contents of the source to the destination location. This is a copy operation; the source is not affected.

  • MOVEA

    Move the contents of the source to the destination address register. If a word, it is sign-extended to a longword.

  • NEG

    Subtract the destination operand from 0 and store the result in the destination location. Performs twos complement arithmetic subtraction.

  • SWAP

    Exchange the upper and lower 16-bit words of a data register.

Shift & Rotate Operations
  • ASL

    Arithmetically shift the bits left. The shift count may be specified as a literal, register contents, or the value 1.

  • ASR

    Arithmetically shift the bits right. The shift count may be specified as a literal, register contents, or the value 1.

  • LSL

    Logically shift the bits left. A zero is shifted into the input position. The shifted-out bit is copied into the C and X bits of the CCR.

  • LSR

    Logically shift the bits right. A zero is shifted into the input position. The shifted-out bit is copied into the C and X bits of the CCR.

  • ROL

    Rotate the bits left. The extend bit X is not included in the operation. Bits shifted out at one end are shifted into the other end.

  • ROR

    Rotate the bits right. The extend bit X is not included in the operation. Bits shifted out at one end are shifted into the other end.

Conditional Operations
  • CMP

    Subtract the source operand from the destination operand and set the condition codes accordingly. The destination is not modified.

  • CMPA

    Subtract the source operand from the destination address register and set the condition codes. Supports word or longword operations.

  • CMPI

    Subtract the immediate data from the destination operand and set the condition codes accordingly. The destination is not modified.

  • TST

    Compare the operand with zero. No result is saved, but the CCR bits are set according to the result.

Jump Instructions
  • JMP

    Program execution continues at the effective address specified by the instruction.

  • JSR

    Jump to subroutine. Pushes the longword address of the next instruction onto the system stack (A7). Execution continues at the specified address.

  • RTS

    Return from subroutine. The program counter is pulled from the stack. Used to terminate a subroutine and return to the calling code.

Branch Instructions
  • BRA

    Branch always. Program execution continues at [PC] + displacement. Displacement is a twos complement value (8-bit or 16-bit).

  • BSR

    Branch to subroutine. Pushes the next instruction address onto the stack (A7). Execution continues at [PC] + displacement.

  • BEQ

    Branch if equal (zero flag set). If condition is met, execution continues at [PC] + displacement.

  • BNE

    Branch if not equal (zero flag clear). If condition is met, execution continues at [PC] + displacement.

  • BGE

    Branch if greater than or equal (no overflow/negative mismatch). If condition is met, execution continues at [PC] + displacement.

  • BGT

    Branch if greater than. If condition is met, execution continues at [PC] + displacement.

  • BLE

    Branch if less than or equal. If condition is met, execution continues at [PC] + displacement.

  • BLT

    Branch if less than. If condition is met, execution continues at [PC] + displacement.

💡Tips & Tricks

⏱ Time Delay

You can add delays in your M68K assembly code using simple loops or dedicated delay routines. This is useful for controlling execution timing and creating pauses between operations. Perfect for simulating real-world timing behavior in your emulator testing.

🔧 Toggle Advanced Registers

Enable the advanced register display to view detailed register states beyond standard data and address registers. This includes condition codes, status register flags, and internal emulator state. Essential for debugging complex programs that depend on specific flag conditions.