NSE

From Sousuke.org

Jump to: navigation, search

Contents

Native SPC Emulator

NSE is a free, open source and cross-platform SPC emulator.

In contrast to other existing emulators and replayers, NSE does not use interpreting methods, but relies on recompilation.


Motivation

The main idea behind NSE is to create an emulator with a different approach: Instead of interpreting each opcode at run-time, it recompiles the SPC700-code into the host machine's code, reducing the interpretation overhead to the minimum, as this step is basically needed only once.

Because the recompiled code can be natively run by the host machine, execution performance is greatly improved and minimizes CPU load - Hence the name Native SPC Emulator.

This approach is comparable with other existing simuators and/or emulators. (e.g. Zig, Bochs, VMware, etc.).


Concept

The frontend accepts SPC700-code, and the backend compiles the SPC700-code into native code. The abstract backend is not machine specific, inorder to maintain flexiblity and extendability for other architectures. Especially optimizations for a specific target machine can be carried out more easily.

The compiled code is run in a separate thread, emulating the SPC700 CPU. Access to external peripheral, such as DSP, or even memory-mapped registers must be detected by the recompiler and redirected to the actual hardware, which can also be an emulated part.

Difficulties

NSE cannot only rely on static pre-recompilation. Simple code translation will not work because of following reasons:

  • It is (almost) impossible to distinguish code from data.
  • SPC700-code uses self-modification techniques.

Therefore Dynamic compilation and just-in-time compilation strategies must be utilized.

Frontend

n/a

Backend

n/a

Progress

NSE is still in an early development stage. No public releases yet.


Brief description on Sony SPC700

The 8bit CPU SPC700 (designed by Ken Kutaragi, manufactured by Sony) is most famous for it's use in the 16bit game console SNES, accompanied with an 16bit DSP, which is capable to reproduce stereo audio from 8 independent channels using wave-table synthesis.

These chips were mounted on a separate board, separated from SNES's mainboard. Communications with the SPC700 were carried out via 4 I/O ports over the SPX bus.

Sony SPC700 specifications

The sound module can be split into two main components:


1. CPU: Sony SPC700 series CMOS 8-bit CPU core

  • Purpose: Runs code for audio reproduction and controls peripherals, such as timers, DSP and communications
  • Clock: 1.024 MHz (min. command execution time: 1.953 us/2.048MHz when active)
  • RAM: 64 kB (shared with DSP)
  • ROM: 64 byte (IPL)
  • Timer: 3x 8-bit counter (125 us and 15.6 us resolution)


2. DSP: Sony S-SMP / S-DSP

  • 16-bit ADPCM audio reproduction
  • 8 fully independent channels
  • Hardware BRR (Bit-Rate Reduction) decompression
  • Hardware-accelerated sound effects on each channel:
    • Pitch modulation
    • 8-tap FIR filter
    • ADSR and GAIN volume envelopes
    • Soft-panning
    • Low-pass filter
  • Echo
  • Noise generator


Existing emulators

  • SPCTool, a very fast DOS SPC700 emulator. Completely written in Intel x86 assembler. Definately worth a try!
  • SNESAmp, SPC700 replayer plugin for Winamp.
  • SNESAPU, SPC700 emulator library for Linux/Windows
  • ZSNES, a very advanced SNES emulator for Intel architectures.
  • SNES9x, a cross-platform SNES emulator.

Links

Personal tools