vincente 4649144770 Fill indexed ALU ops and point at the Mimic implementation plan.
Implement missing 6809 indexed arithmetic/logic opcodes, document the parent instruction-suite commands, add Makefile.test-instr, and point AGENTS.md at the V 21-Implementation plan (SuperMon 64).
2026-10-18 13:41:26 -05:00
…

mimic09 — Fast Motorola 6809/6309 Emulator with C64-Style Monitor

mimic09 is an extremely efficient 6809 and 6309 emulator for macOS and UNIX/Linux. It includes a powerful built-in debugger/monitor inspired by classic Commodore 64 machine language monitors, a built-in assembler/disassembler, S-Record + Intel HEX + binary loaders, and emulation of the 6850 ACIA and 6821 PIA.

It is designed to work hand-in-hand with the cc09 project (the modern recreation of the WINTEK 6809 assembler and C compiler).

Quick Start

make                  # optimized release build → bin/mimic09
make debug            # for development
./bin/mimic09 -h
./bin/mimic09 -i      # enter interactive monitor immediately
./bin/mimic09 -l samples/2299.HEX -g   # load and go (if it has a sensible start vector)

In the monitor you will see a prompt (e.g. m9>). Type ? for help.

Key Features

  • Full 6809 instruction set + major 6309 extensions
  • Very high performance interpreter (tuned for modern CPUs)
  • C64-style monitor/debugger:
    • Single step, step-over, breakpoints
    • Memory view/edit (M / : )
    • Disassemble (D) and Assemble (A) — round-trippable
    • Register view/edit (R / ;)
    • Load/Save S-Records, Intel HEX, raw binary
  • 6850 ACIA and 6821 PIA emulation (configurable base addresses)
  • Excellent for running and debugging code produced by cc09

Monitor Commands (C64-inspired)

R                     show registers + flags
; <new values>        edit registers (copy/paste from R line)
M <addr> [len]        dump memory (hex + ASCII)
:<addr> <bytes...>    write bytes starting at addr
D [addr] [count]      disassemble
A <addr> <mnemonic>   assemble one line (e.g. A 1000 LDA #$2A)
G [addr]              run (until breakpoint or Ctrl-C)
S [n]                 single-step n instructions (default 1)
N                     step over (JSR/BSR/BSR counted as one)
B [addr]              set/clear breakpoint (no addr = list)
BC                    clear all breakpoints
L <file> [addr]       load SREC / IHEX / BIN (addr forces raw load)
S <file> <start> <end> [S19|IHEX|BIN]
F <s> <e> <val>       fill
H <s> <e> <pat...>    hunt (search)
! <cmd>               run shell command
? or H                help
X or Q                quit

While a program is running (after G), Ctrl-C will usually return you to the monitor.

Loading Programs

mimic09 understands:

  • Motorola S-Records (.s19, .srec, many .HEX files from 6809 tools)
  • Intel HEX (.hex)
  • Raw binary (use L foo.bin 0xC000 to load at a specific address)

After loading, set the PC (; PC=xxxx or use the G xxxx form) or let the reset vector (usually at 0xFFFE) be used.

ACIA / Serial Console

When your 6809/6309 code uses a 6850 ACIA for I/O, mimic09 can wire it to your terminal during G runs. Use the -acia 0xA000 (or whatever base your code expects) flag.

Simple programs that do polled serial I/O will "just work" for interactive debugging.

Building & Installing

make
make debug
sudo make install PREFIX=/usr/local

The binary is bin/mimic09. A convenience symlink mimic is also created by install.

Interfacing with cc09

  1. Build your program with the cc09 toolchain → produces S-Record or binary + optional listing.
  2. mimic09 -l myprog.s19
  3. In the monitor: set breakpoints, inspect, single-step.
  4. G to run at full speed with emulated peripherals.
  5. Capture ACIA output or interact live.

This gives you a very fast "edit–assemble–debug on real 6809 semantics" loop on a modern machine.

Status

This is an active re-creation and modernization of the 1994 "mimic09" effort. The original incomplete sources live in attic/.

Core goals: correctness + extreme speed + delightful C64-monitor debugging experience.

License

See LICENSE (heritage code fragments retain original copyright notices where applicable; new code is under the terms in LICENSE).

Enjoy the 6809 on modern iron.

Running the Instruction Set Validation Tests

The CPU validation suite lives in the parent tests/ directory.

From inside this directory (mimic09):

../tests/run-instr-suite.sh                 # full 6809 + 6309 suite
../tests/run-instr-suite.sh --test 6809_ABX_inh   # one specific test
../tests/run-instr-suite.sh --list

Each test feeds monitor commands that literally poke opcodes "by hand" (: command), single-steps them, captures R output, and compares registers against the documented behavior.

See ../tests/README.md for more details.

S
Description
6809/6309 Emulator and Debugger
Readme 102 KiB
Languages
C 95.4%
C++ 3.1%
Makefile 1.5%