v68k is a 68K emulation library designed for programs that need to run either sourceless legacy code or untrusted third-party code.
v68k is platform-independent on the host (written in portable (lightweight) C++ and running anywhere) and OS-indifferent internally -- the calling program is free to load any ROM or kernel it likes, or even run on the bare 'metal'.
So far, 47498 opcodes (of a possible 65536, not all of which are valid) are decoded as instructions. All 68000 and 68010 instructions are implemented, as well as some 68020 instructions.
The host program can use BKPT as a callback interface to provide service routines to emulated code. This allows emulated code to 'jump out of the system' in a controlled manner.
xv68k (formerly x68k, formerly v68k-exec) is a sample program using v68k. It creates a new emulator instance, loads a tiny 'operating system' (consisting of just over 100 bytes of startup code and exception handlers), loads a user-supplied binary, and then begins executing instructions. It implements BKPT #2 as a trap for invoking a native system call (currently bridging read(), write(), and writev()), and installs a Trap 0 exception handler to rewrite TRAP #0 instructions as BKPT #2 so the same code can work in both xv68k and MacRelix. It also skips A-traps so that Metrowerks' startup code will run successfully, allowing 68K programs to be written in C and C++.
It's now capable of running (in emulation) its predecessor, v68k-hello (which includes a canned Hello World program instead of loading from a file).
A live demo is available.