# 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 ```bash 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 ; edit registers (copy/paste from R line) M [len] dump memory (hex + ASCII) : write bytes starting at addr D [addr] [count] disassemble A 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 [addr] load SREC / IHEX / BIN (addr forces raw load) S [S19|IHEX|BIN] F fill H hunt (search) ! 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 ```bash 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). ## Links - Repository: http://gitea.binary-systems.com/vincente/mimic - Companion: cc09 (Wintek 6809 toolchain recreation) Enjoy the 6809 on modern iron.