Mac 68k emulator

Last updated

The Mac 68k emulator [1] is a software emulator built into all versions of the classic Mac OS for PowerPC. This emulator enabled running applications and system code that were originally written for the 680x0-based Macintosh models. With a few exceptions, notably Connectix's RAM Doubler, the emulator ran all software with no noticeable impact other than lower performance relative to the same program when compiled for PowerPC.

Contents

Origins

The first version was written by Gary Davidian, who had originally created it for use on the Motorola 88000 CPU, used in Apple's abortive first attempt at a RISC target platform. [2] [3] A later version, using dynamic recompilation, was developed by Eric Traut, who later worked on successful emulation projects at Connectix such as Virtual Game Station and Virtual PC. Prior to Traut's arrival there, Connectix had released Speed Doubler, which included an even faster PowerPC 68k emulator.

Implementation

All versions of this emulator emulated the "user" subset of the 68EC040 instruction set with a 68020/68030 exception stack frame. Apple developer documents indicate that the emulator provided an operating environment most closely resembling that of the Macintosh Centris 610, a system based on the Motorola 68LC040 microprocessor. [4] Early versions emulated it by decoding each instruction and immediately carrying out a series of equivalent PowerPC instructions. For the PCI PowerMacs, the dynamic recompilation emulator was used to boost performance. Dynamic recompilation works by "recompiling" common sections of the code into faster, PowerPC-native, sequences that were locally cached. The emulator could recognise the same sequence of 680x0 code and run the previously-cached PowerPC code to avoid doing the translation again. This emulator was theoretically capable of emulating 680x0 code faster than any real 680x0 was capable of running it. The 68LC040 had no floating point instructions, making this feat slightly simpler but no less impressive.

One reason that this emulation was so successful is that many of the APIs for the Mac OS were originally implemented as traps on the 680x0 processor; therefore, calling an API actually was recognised by the 680x0 as the equivalent of an error condition, which would cause it to handle that error through one of its hardware vectors. In turn, this vector would look up and run the operating system routine from ROM or RAM. In the emulator, such traps could be replaced by native PowerPC code, so the only code being emulated was the application itself, and any system API it called could be accelerated with native PowerPC code. This also allowed Apple time to port the OS to the PowerPC. At first only time-critical aspects were rewritten in native code, leaving much of the OS emulated. Gradually most of the OS was rewritten to be native, so the OS got faster over time.

For the programmer, the transition to the PowerPC was made fairly painless, because the emulator was started and stopped automatically. This was achieved using a new type of pointer called a Universal Procedure Pointer (UPP). For 68k code, this pointer appeared to be an ordinary pointer to code and could be used as such. However, it actually led to a data structure which contained a special trap instruction and flags indicating the instruction set architecture (ISA) of the called code. From PowerPC code, this UPP could be passed to the CallUniversalProc( ) function to call it. The 68k emulator then dealt with details such as presenting passed parameters in the right order for the ISA in question, as well as starting and stopping the emulator as required. The compilers for Mac OS created such UPPs automatically when the proper macros were used, and the PowerPC system libraries contained native stubs to transparently call through to native or still-68k functions as needed. This meant that dealing with the dual architecture required very little work for the programmer, and just like the OS, applications themselves could mix and match 680x0 and PowerPC code fairly easily.

Current status

Because it was built into all PowerPC versions of the classic Mac OS, the emulator was also part of the Classic environment in Mac OS X. PowerPC Macintosh emulators such as SheepShaver therefore use the emulator as well when running the classic Mac OS. Native Mac OS X outside of Classic never used the emulator.

See also

Related Research Articles

Motorola 68040

The Motorola 68040 ("sixty-eight-oh-forty") is a 32-bit microprocessor in the Motorola 68000 series, released in 1990. It is the successor to the 68030 and is followed by the 68060. There was no 68050. In keeping with general Motorola naming, the 68040 is often referred to as simply the '040.

The Motorola 68000 series is a family of 32-bit complex instruction set computer (CISC) microprocessors. During the 1980s and early 1990s, they were popular in personal computers and workstations and were the primary competitors of Intel's x86 microprocessors. They were best known as the processors used in the early Apple Macintosh, the Sharp X68000, the Commodore Amiga, the Sinclair QL, the Atari ST, the Sega Genesis, the Capcom System I (Arcade), the AT&T UnixPC, the Tandy Model 16/16B/6000, the Sun Microsystems Sun-1, Sun-2 and Sun-3, the NeXT Computer, the Texas Instruments TI-89/TI-92 calculators, the Palm Pilot and the Space Shuttle. Although no modern desktop computers are based on processors in the 680x0 series, derivative processors are still widely used in embedded systems.

In computer science, dynamic recompilation is a feature of some emulators and virtual machines, where the system may recompile some part of a program during execution. By compiling during execution, the system can tailor the generated code to reflect the program's run-time environment, and potentially produce more efficient code by exploiting information that is not available to a traditional static compiler.

In computing, binary translation is a form of binary recompilation where sequences of instructions are translated from a source instruction set to the target instruction set. In some cases such as instruction set simulation, the target instruction set may be the same as the source instruction set, providing testing and debugging features such as instruction trace, conditional breakpoints and hot spot detection.

Classic Mac OS memory management

Historically, the classic Mac OS used a form of memory management that has fallen out of favor in modern systems. Criticism of this approach was one of the key areas addressed by the change to Mac OS X.

System 7 Apple Macintosh operating system released between 1991–1997

System 7, codenamed "Big Bang", and also known as Mac OS 7, is a graphical user interface-based operating system for Macintosh computers and is part of the classic Mac OS series of operating systems. It was introduced on May 13, 1991, by Apple Computer, Inc. It succeeded System 6, and was the main Macintosh operating system until it was succeeded by Mac OS 8 in 1997. Features added with the System 7 release included virtual memory, personal file sharing, QuickTime, QuickDraw 3D, and an improved user interface.

Macintosh Color Classic

The Macintosh Color Classic is a personal computer designed, manufactured and sold by Apple Computer, Inc. from February 1993 to May 1995. It has an "all-in-one PC" design, with a small, integrated 10″ Sony Trinitron display at 512 × 384 pixel resolution. The display is capable of supporting up to thousands of colors with a video memory upgrade.

Connectix

Connectix Corporation was a software and hardware company, noted for having released innovative products that were either made obsolete as Apple Computer incorporated the ideas into system software, or were sold to other companies once they became popular. It was formed in October 1988 by Jon Garber; dominant board members and co-founders were Garber, Bonnie Fought, and close friend Roy McDonald. McDonald was still Chief Executive Officer and president when Connectix finally closed in August 2003.

The Macintosh Toolbox implements many of the high-level features of the Classic Mac OS, including a set of application programming interfaces for software development on the platform. The Toolbox consists of a number of "managers," software components such as QuickDraw, responsible for drawing onscreen graphics, and the Menu Manager, which maintain data structures describing the menu bar. As the original Macintosh was designed without virtual memory or memory protection, it was important to classify code according to when it should be loaded into memory or kept on disk, and how it should be accessed. The Toolbox consists of subroutines essential enough to be permanently kept in memory and accessible by a two-byte machine instruction; however it excludes core "kernel" functionality such as memory management and the file system. Note that the Toolbox does not draw the menu onscreen: menus were designed to have a customizable appearance, so the drawing code was stored in a resource, which could be on a disk.

Basilisk II

Basilisk II is an emulator which emulates Apple Macintosh computers based on the Motorola 68000 series. The software is cross-platform and can be used on a variety of operating systems.

Macintosh clone Computer running Mac OS not produced by Apple

A Macintosh clone, also known as a Clonintosh, is a computer running the Mac OS operating system that was not produced by Apple Inc. The earliest Mac clones were based on emulators and reverse-engineered Macintosh ROMs. During Apple's short lived Mac OS 7 licensing program authorized Mac clone makers were able to either purchase 100% compatible motherboards or build their own hardware using licensed Mac reference designs.

Rhapsody was the code name given to Apple Computer's next-generation operating system during the period of its development between Apple's purchase of NeXT in late 1996 and the announcement of Mac OS X in 1998. At first more than an operating system, Rhapsody represented a new strategy for Apple, who intended the operating system to run on x86-based PCs and DEC Alpha workstations as well as on PowerPC-based Macintosh hardware. In addition, the underlying API frameworks would be ported to run natively on Microsoft Windows NT. Eventually, the non-Apple platforms were dropped, and later versions consisted primarily of the OPENSTEP operating system ported to the Power Macintosh, along with a new GUI to make it appear more Mac-like. Several existing "classic" Mac OS technologies were also ported to Rhapsody, including QuickTime and AppleSearch. Rhapsody could also run Mac OS 8 in a "Blue Box" emulation layer.

Rosetta (software) Apple, Inc. software for Mac OS X

Rosetta is a dynamic binary translator developed by Apple Inc. for macOS, an application compatibility layer between different instruction set architectures. It gives developers and consumers a transition period in which to update their application software to run on newer hardware, by "translating" it to run on the different architecture. The name "Rosetta" is a reference to the Rosetta Stone, the artifact which enabled translation of Egyptian hieroglyphs.

Macintosh Quadra 605

The Macintosh Quadra 605 is a personal computer designed, manufactured, and sold by Apple Computer, Inc. from October 1993 to July 1996. The model names reflect a decision made at Apple in 1993 to follow an emerging industry trend of naming product families for their target customers – Quadra for business, LC for education, and Performa for home. Accordingly, the Performa 475 and 476 was sold in department stores and electronics stores such as Circuit City, whereas the Quadra was purchased through an authorized Apple reseller.

The Amiga computer can be used to emulate several other computer platforms, including legacy platforms such as the Commodore 64, and its contemporary rivals such as the IBM PC and the Macintosh.

Eric Traut is an American software engineer and software emulation pioneer. Traut graduated from Stanford University in 1992. From 1993 to 1995 he worked for Apple Computer, creating a Mac 68K emulator to be used in PowerPC-based Macintoshes. His work on this project led to a patent on a form of dynamic recompilation.

The Mac OS nanokernel is an operating system kernel serving as the basis of most PowerPC based system software versions 7 through 9 of the classic Mac OS, predating Mac OS X.

MagiC is a third party and now open-sourced multitasking-capable TOS-compatible operating system for Atari computers, including some newer clone systems manufactured later. There are also variants that run as part of Mac and PC emulation environments, as well as on macOS Intel-Mac computers.

Classic Mac OS Original operating system of Apple Mac (1984–2001)

The Classic Mac OS is the series of operating systems developed for the Macintosh family of personal computers by Apple Inc. from 1984 to 2001, starting with System 1 and ending with Mac OS 9. The Macintosh operating system is credited with having popularized the graphical user interface concept. It was included with every Macintosh that was sold during the era in which it was developed, and many updates to the system software were done in conjunction with the introduction of new Macintosh systems.

References

  1. "PowerBook: Information About ROM-in-RAM". Apple Support. 20 February 2012.
  2. "The PowerPC Triumph" . Retrieved 1 July 2011.
  3. "Power Computing: Fighting Back for the Mac or Stealing Apple's Customers?". Low End Mac. Archived from the original on 26 March 2012. Retrieved 1 July 2011.
  4. "The 68LC040 Emulator (IM: PS)". Apple Developer. 3 July 1996. Retrieved 1 July 2011.