Mimic/68K


Aimed at embedded applications, Mimic/68K is a program which allows software written for a 68000, 68010, 68020 (optionally with 68881 floating-point unit) or 68040 processor, as well as some ColdFire CPUs, to run unchanged on modern processors. It does this by reading the 68000-family code, interpreting the meaning of each instruction, and carrying out an equivalent series of instructions in the target architecture.

Mimic/68K is a very faithful emulator of the 680x0 architecture, including both user- and supervisor-mode instructions. It can be used to run whole operating systems designed for the 680x0, or to run applications which interface (through a mechanism which you can customize) to a native host operating system, real-time kernel, or to native application code.

Recommended applications

Mimic/68K is recommended for porting 680x0 code which cannot be recompiled (using a native compiler) or translated (using PortAsm/68K or Relogix), or for which it is not cost-effective to produce a native version. For example, it would be appropriate where:

  • The original source code is not available, or the code was written in a language for which no suitable compiler is available;
  • The code is large, rarely run, and performance is not critical. In such cases - particularly if code size is a key constraint - running it under Mimic/68K may be the most cost-effective option;
  • 68K object code is held on removable media, or in plug-in modules which must still be supported.
  • It is necessary to maintain byte-for-byte the exact representation of data (including the original byte-ordering) in memory as the original used.

Mimic/68K is especially useful for modernising systems which are facing obsolescence because 680x0 processors like the 68040 have reached End of Life (EOL) status.

Customizing Mimic/68K through callbacks

The Mimic/68K development kit comes in two main parts. The emulator itself is supplied as an object code file which you link to native code in your application or system. In addition, a Mimic/68K front-end, supplied as C source code, allows you to customize the interface very easily.

In a minimal implementation this front-end can be extremely simple, but it is also possible to implement an entire debugger and object file loader in the front-end; sample files to do this are supplied in C source.

680x0 programs running under Mimic/68K can call out to the front end using unassigned 68K opcodes or TRAP instructions, and native code can call 680x0 code by making calls into Mimic/68K. These mechanisms can be used both to allow the 680x0 program access to the facilities of the native environment, and to divide up processing between speed-critical native code, and non-critical emulated code.

Memory-mapped I/O

In addition Mimic/68K can be customised through the optional use of protected 68K memory ranges. During emulation, any 68K instruction which accesses an address in one of the protected ranges will cause a front-end routine to be called, where you can determine what happens next - suppress the instruction, change the access address, change the data read or written, etc.

This provides a powerful mechanism to, for example, simulate the behavior of a hardware I/O port. For example, you could output a character to a serial port when Mimic/68K calls your routine to handle a write to an address previously associated with a UART data-output port, and return a status byte to indicate ‘OK to send more data’ in response to a simulated read from the UART status port.

Simulating 680x0 Interrupts

Some 680x0 code includes facilities which can only be supported by means of hardware interrupts. For example, if you are running a 68K operating system under Mimic/68K, you will almost certainly need a periodic timer interrupt, and very probably interrupts for keyboard and other forms of I/O.

The distinguishing feature of such interrupts is that they occur asynchronously with respect to the 68K program, and thus to Mimic/68K itself. You simulate such interrupts from the 68K program’s point of view by calling a routine within Mimic/68K. This routine can be called from another (native) task, or from a native interrupt service routine, or from a Unix-style signal handler.

Features

  • Fully supports all instructions for the 68000, 68010, 68020 and 68040. (68060 and some ColdFire versions available on request).
  • 68881 and 68040 floating-point instructions supported.
  • User mode and supervisor mode both fully supported.
  • Fully customizable by changing the supplied C front-end source code.
  • Special instructions such as TRAP, MOVEC or PFLUSH invoke a callback which you can tailor
  • 680x0 interrupts can be simulated by calling into Mimic/68K from an asynchronous task or interrupt service routine.
  • Memory-mapped I/O accesses can be detected to allow simulation of I/O peripherals in software
  • Exceptions can be handled either in native or emulated code.
  • Small memory footprint.
  • Very easy integration with native C or other high-level code.
  • Includes loaders for 68K ELF, COFF, S-record and raw binary object files.
  • Includes 68K debugger for debugging emulated code.
  • Supplied with source-code to the front-end loaders and debugger.
  • Supplied with pre-built sample executables for Linux, and Windows (x86 version only)

Supported Target Processsor Architectures

  • POWER/PowerPC
  • X86
  • X86-64
  • ARM/Thumb

Please contact MicroAPL for information about other targets.

Documentation

The following version (v4.1) of the Mimic/68K user manual is available for download: