Mar 092014
 

Here is another part of my ASM80.com 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!

Usage

(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.