Motorola DSP56300 Toolkit
A toolkit for working with the Motorola (Freescale/NXP) DSP56300 family of digital signal processors, including an assembler, disassembler, and emulator.
Crates
| Crate | Description |
|---|---|
dsp56300-core |
ISA constants, register indices, instruction decoder |
dsp56300-asm |
Assembler library/CLI |
dsp56300-disasm |
Disassembler library/CLI |
dsp56300-emu |
JIT emulator library/CLI |
dsp56300-emu-ffi |
C FFI layer; builds as a static library |
Building
Assembler
The dsp56300-asm crate provides a library and CLI for assembling DSP56300 source files.
# Assemble a file (default: 4-byte little-endian words)
# Native DSP byte order (3 bytes/word, big-endian)
# Text output (a56-compatible LOD format)
# Print segment map to stderr
Output formats: u32le (default), u24be, u24le, lod.
As a library:
use assemble;
let result = assemble.unwrap;
assert_eq!;
Disassembler
The dsp56300-disasm crate provides a library and CLI for disassembling program memory into readable assembly.
# Disassemble a binary (default: 4-byte little-endian words)
# Native DSP byte order
# Start at a specific address, limit output
Output is colorized when writing to a terminal (--color always|never|auto):
P:$000000 000000 nop
P:$000001 0C0042 jmp p:$0042
P:$000002 0A8580 001234 jclr #0,x:$ffffc5,p:$1234
As a library:
use disassemble;
let = disassemble;
assert_eq!;
assert_eq!;
Emulator
The dsp56300-emu crate provides a core emulator with a JIT execution engine, built with the Cranelift compiler backend. A library and simple CLI for running an emulator are included.
use ;
use JitEngine;
let mut pram = vec!;
pram = 0x0C0100; // JMP $100
let map = from_pram_buffer;
let mut state = new;
let mut jit = new;
state.run;
assert_eq!;
From C/C++
The dsp56300-emu-ffi crate exposes the same functionality through a C API.
Build the static library and include the header:
# produces: target/release/libdsp56300_emu_ffi.a
# header: crates/emu-ffi/include/dsp56300.h
Link with -ldsp56300_emu_ffi -ldl -lpthread -lm (Linux) or the platform equivalent. See crates/emu-ffi/include/dsp56300.h for the full API reference and crates/emu-ffi/examples/quickstart.c for a usage example.
Examples
The examples directory contains audio effects borrowed from the a56 assembler source tree. The scripts/dsp56300-run wrapper script assembles and runs them with live audio on Linux (requires cpp, ffmpeg, and aplay).
| Example | Description |
|---|---|
thru.a56 |
Pass-through (no processing) |
caltone.a56 |
Sine wave calibration tone via table lookup |
pink.a56 |
Pink noise generator |
reverb.a56 |
Schroeder reverb |
sixcomb.a56 |
Six-comb reverb |
flange.a56 |
Flanging effect |
chorus.a56 |
Chorus effect |
Run any example with live audio using the runner script:
References
- DSP56300 Family Manual, Rev 5 - referred to as "DSP56300FM" in source comments
Acknowledgements
The official Motorola DSP56300 assembler (asm56300), Version 6.3.15 was used for exhaustive roundtrip testing of the assembler and disassembler across the full instruction encoding space.
The DSP56300 emulator from xemu (originally based on DSP56001 emulation from ARAnyM, Hatari, and later adapted for DSP56300 emulation in XQEMU) was used for early differential testing for the JIT emitter.