A sidebar to the Apple Macintosh preview published in Byte, issue 2/1984, pp. 38-39.
Macintosh System Software Overview
The Macintosh is more than a powerful, inexpensive 68000-based desktop computer. It comes with a built-in personality provided by 64K bytes of handcrafted system software contained in two ROM chips on its digital board. Besides performing traditional operating-system functions such as memory and file management, the Macintosh ROM includes the revolutionary Quickdraw package and a User-Interface Toolbox to help programmers develop applications that share a consistent, advanced user interface.
The Macintosh ROM can be thought of as an extension to the 68000 instruction set, augmenting its 56 basic instructions with more than 480 new instructions designed for implementing fast mouse-based applications. It is implemented entirely in 68000 assembly-language code that has been handcrafted and optimized over a period of almost three years. We chose assembly language over a higher-level language because it was very important for the system to be small and fast. The Macintosh is intended to be a very high-volume product, and we could afford to lavish time and attention on every routine, making each one as efficient as possible, knowing that our efforts would be multiplied by the millions of units that we will eventually ship.
It is somewhat risky to put 64K bytes of intricate system software in ROM on a disk-based system, but we did it because we wanted the machine to have a built-in standard user interface. By using our ROM-based toolbox, a programmer saves development time and precious memory space; this provides a positive incentive for doing it our way. Also, the price per bit of ROM is significantly less than that of RAM, and not having the operating system load in from disk saves space on every disk you have. Application programs never reference the ROM directly; instead, they use compact “trap” instructions that are interpreted by the system dispatcher. This allows us to intercept any routine to fix the program bugs that will inevitably arise.
The Mac’s system software design philosophy emphasizes simplicity, flexibility, and high performance. We chose the single-application-at-a-time philosophy to help keep things relatively simple. The user-interface software is designed to be flexible, because we are still learning how to make systems easier and more fun to use. Another reason for designing the software this way is that trying to live for years with what we thought was best at any given time would doom us to eventual failure. High performance is extremely important in an interactive system; people won’t enjoy using a system unless it is very responsive.
About one-third of the ROM is devoted to what we call the Macintosh Operating System, which contains many components found in more traditional systems. It includes the low-level device drivers and interrupt handlers, an asynchronous I/O system, a memory manager, a simple, fast file system, a segment loader, and various utility routines. The I/O system supports swappable, RAM-based device drivers as well as its built-in serial, disk, and sound drivers. Most I/O and file-system calls can be made asynchronously, which allows an application to overlap I/O tasks with other tasks. The memory manager minimizes the fragmentation of available memory into small pieces by supporting relocatable objects that are always accessed indirectly; the memory manager also provides an automatic caching scheme by optionally purging objects as memory grows fuller. The file system ensures against loss of data by maintaining tags on every block; these allow the contents of a disk to be pieced back together even if the directory is destroyed.
Another third of the ROM is occupied by Bill Atkinson’s Quickdraw graphics package. Quickdraw, which is the cornerstone of Apple’s “Lisa technology,” is responsible for the Mac’s extremely fast user interaction. It draws practically everything you see on the screen, including text (in a variety of typefaces and styles) and both filled and unfilled rectangles, lines, and ovals. It also is capable of representing arbitrary areas of the screen called regions in a very compact data structure. All Quickdraw calls are clipped to the intersection of up to three regions, providing the fundamental capability necessary for overlapping windows. Quickdraw also is capable of recording any sequence of procedure calls and saving them as a picture. Pictures provide an easy, powerful method for transferring graphics between applications.
The final third of the Macintosh ROM is occupied by the User-Interface Toolbox, a collection of various managers and services intended to help a programmer develop implications that conform to the Macintosh standard user interface. Its principal components are resources, windows, menus, controls, dialogues, and a text-editing package. The window, menu, and control managers contain little information on how individual windows, menus, or controls look or behave. Instead, this information is encapsulated in definition functions, which are kept as resources and swapped into memory as necessary to implement messages sent by the various managers. This provides a very flexible structure capable of evolving as we learn how to improve the user interface.
Another important goal of the Macintosh system software is to facilitate the passing of data between applications. A scrap manager is provided to help applications share data. It defines two data types that every application is requested to support (simple ASCII text and Quickdraw pictures) and lets applications define their own custom types. It provides routines for transferring data in and out of the scrap.
As stated above, Macintosh supports only one application running at any given time. This restriction is mainly due to limited available memory. By making a few simple calls to the desk manager, an application may allow many useful mini-applications to run concurrently with itself. These small programs are called desk accessories and are capable of cutting and pasting data with each other as well as with the major application. We currently provide five desk accessories (calculator, clock, notepad, control panel for default system parameters, and scrapbook).
By the spring of 1983, it became apparent that we would not be able to fit all the routines that we had hoped to into our 64K-byte ROM space. We designed a facility to allow some system code (in the system resource file) to be swapped in from disk to RAM when needed. We now use five such RAM-based packages, including a fully IEEE-standard floating-point numeric package, a standard file dialogue package, and an international string package that deals with various formats for date and time display.
In summary, the 64K bytes of ROM-based firmware provide Macintosh with a unique personality and user interface, forming the foundation for the development of communicating applications that share a common user interface. The Macintosh firmware is very fast and flexible, and it will be exciting to see all the applications that develop from it in the years to come.
Andy Hertzfeld is a member of the Apple Macintosh design team.
Page added on 20th January 2004.