Mar 092014

Here is another part of my free licensed: a 6809 emulator in JavaScript.

It’s alpha version, not optimized yet, no interrupts handled and CWAI instruction, but it works. I’ve tested it on Grant Searle’s 6809 simple SBC. The next step is Hitachi HD6309, so stay tuned!


(a.k.a. The API)

  • window.CPU6809 – main object (instantiated at the start – it shall change)
  • CPU6809.init(memoryTo,memoryAt,ticker) – Initializes the whole system. All parameters are callback functions for port / memory access:
    • memoryTo(addr,value) – store byte to given address
    • memoryAt(addr) – read byte from given address
    • ticker(T) – unused now. For future use
  • CPU6809.T() – returns clock ticks count from last init (or reset)
  • CPU6809.reset() – does a CPU reset
  • CPU6809.set(register, value) – sets internal register (named PC, SP, U, A, B, X, Y, DP and flags) to a given value
  • CPU6809.status() – Returns a object {pc, sp, u, a, b, x, y, dp} with actual state of internal registers
  • CPU6809.steps(N) – Execute instructions as real CPU, which takes “no less than N” clock ticks.

  One Response to “Motorola MC6809 microprocessor emulator in JS”

  1. […] yet, but it’ll be soon). Assembled code can be tested in embedded 6809 emulator, based on my code. You can use an online SBC09 emulator, which is capable to emulate Grant Searle’s 6 chip […]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">