Read Revolution in the Valley: The Insanely Great Story of How the Mac Was Made Online
Authors: Andy Hertzfeld
Tags: #Business & Economics, #General, #Industries, #Computers & Information Technology, #Workplace Culture, #Research & Development, #Computers, #Operating Systems, #Macintosh, #Hardware
the Puzzle desk accessory
The original Macintosh could only run one real application at a time, but it could also concurrently run little programs called "desk accessories" that shared memory with the main application. Like the system itself, most of the desk accessories were written in 68000 assembly language, but in the fall of 1982, I decided to write one in Pascal as a proof of concept and to show developers how to do it, by writing a tiny adaptor that the Pascal code linked with.
Desk accessories were usually utilities, like the calculator or the alarm clock, but I thought that we should also have a game or two, to show that the Macintosh was fun, too. I decided to write a "15 number puzzle", where there are fifteen numbered tiles in a four by four space that must be arranged in sequential order. If you click on a tile next to the empty space, it slides into that space. It was a fun way to waste time and build up your mouse coordination.
Since the number puzzle was written in Pascal, it had to link with the Pascal run-time, which dragged in lots of extra code that wasn't used. This made the Puzzle over 6K bytes long, even though most of it was just the run-time.
By the fall of 1983, it was time to make decisions about what to include in the shipping product. We had shown the Mac to a number of industry analysts, and while most were enthusiastic, some didn't really get the graphical user interface and thought it was "game-like", not suitable for serious computing. This made some of the Macintosh marketing folks a bit leery about the more whimsical aspects of the design, and the puzzle, being an actual game, became somewhat controversial.
Jerome Coonen, the software manager, came by my cubicle one morning to tell me that they decided not to ship the puzzle, partially because of the game-like perception, but mostly because it was just too big. Applications were very tight on RAM, and the puzzle was one of the biggest desk accessories because it was written in Pascal. At over 6K bytes, it also ate into the available disk space.
I liked the puzzle and I didn't want to capitulate to the buttoned-down, all business view of the customer, so I told Jerome, "You know, the puzzle doesn't have to be so big. I bet I could rewrite it and get it to take up less than 1K bytes. Would you keep it if I got it that small, or is it really the other issue?"
Jerome thought about it, and then told me if I could get it down to 600 bytes or so, it would be in the release. The only problem was I had to get it done over the weekend, because they had to send the manuals out to the printer soon, and there was plenty of other stuff for me to work on.
Of course, I couldn't resist a challenge like that. It only took a few hours on Saturday to recode it in assembly language, and get it down to the required 600 bytes, since it no longer had to link with the bulky Pascal code. I proudly showed it off to everyone on Monday, and it did make it into the first release, and stayed there for many years, although it was completely rewritten a couple of times, for various reasons.
Cut, Paste and Crash
by Andy Hertzfeld in September 1983
The sneaker was used to demo cut and paste
One of the last parts of the Macintosh system software to be finished before freezing the ROM in September 1983 was the "clipboard manager", which was the code responsible for facilitating cutting and pasting information between applications. The clipboard manager provided some simple calls to access and manipulate the "clipboard", a memory buffer that held the last piece of data that was cut or copied. The trickiest part of the clipboard manager was the way it managed memory when the user quit an application.
The clipboard buffer was typically kept in the primary memory area that was available to an application, known as the "application heap". But when an application terminated, its application heap was deallocated, before a brand new heap was allocated for the incoming application. The clipboard manager had to take special measures to preserve the clipboard during this interregnum, when no application heap was available to hold it.
The first thing we thought of was to write the clipboard to disk while we were between applications, which worked but was problematic because the Macintosh didn't have a fixed disk, so there might not be a floppy in the drive, or perhaps it was write protected. We also tried to copy the clipboard into the system heap, which persisted between applications, but the clipboard was often too big to fit there. Ultimately, we solved the problem by copying the clipboard to the stack, which was a large area in high memory used to hold application variables and run-time state like return addresses, where it stayed until it was moved into the application heap of the newly launched application.
A few weeks after the ROM was frozen, Apple put together a sales "roll-out" presentation to introduce the sales team to all things Macintosh, in order to prepare them to start selling the machine a few months later. There was lots of the usual sales hoopla, but the clear highlight of the event was the first-person training on the machine itself, where each salesperson would get to try out a Macintosh for the first time. A teacher guided them through a simple demo which let them learn to use the mouse and then try out MacWrite, MacPaint and the Finder.
The climax of the demo had them loading a MacPaint document, selecting an area and copying it to the clipboard, and then launching MacWrite and pasting the image into a MacWrite document, easily mixing text and graphics, which was very impressive back in those days. Susan Kare had drawn a terrific, detailed rendering of a sneaker for the Macintosh brochure, which was used as the graphic for the demo. They were supposed to select and copy the sneaker and then paste it into MacWrite.
I was invited to go to the sales presentation, but I couldn't, because I was still working frantically with the rest of the software team to finish the software in time to ship the following January. I was busy working in the afternoon when I received a panicked phone call from one of the sales guys involved with the presentation.
"We've got a problem!", he told me. "The sneaker demo is crashing. Not all the time, though, sometimes it works and sometimes it doesn't. It's impossible to predict when it will happen, but when it does, the crash is really bad - as soon as you quit MacPaint, the screen goes crazy and then it reboots. We're going to have to stop doing the cut and paste part of the demo unless you get us a fix soon."
I got off the phone and thought about it. I was describing the problem to someone when I suddenly stopped in mid-sentence, because I realized what was going on. After quitting the application, the clipboard manager would copy the clipboard to the stack. It subtracted the size of the clipboard from the stack pointer, and then moved the memory into the allocated space. I realized that around half of the time, the size of the clipboard would be an odd number, which would end up setting the stack pointer to an odd number, which was a perversely horrible thing to do. The Mac's 68000 microprocessor couldn't fetch memory from an odd address; it generated an error if you tried. But the stack is used for the basic operation of the processor, including error handling. An odd stack pointer would essentially drive the 68000 crazy, recursively faulting as it tried to handle exceptions. It worked around half of the time because statistically the clipboard size would be an even number around half of the time. But the other half would cause the flamboyant crash that was being described.
Once I understood what was going on, it was easy to fix by rounding up the clipboard size to an even number. Unfortunately, the errant code in question was in ROM, which was already frozen in immutable silicon. This was the first major bug that I knew of in the ROM and I wondered if we were going to have to spin another version. But Larry Kenyon had already figured out a sneaky technique to fix ROM bugs, by patching system traps. We had always figured to replace entire buggy system calls in that fashion, but Larry thought of a finer grain way to do it, by patching the first trap called before or after the problem area. Basically, we could grab control any time the system was invoked, and then add code to fix problems. I used Larry's technique to devise a patch that fixed the odd stack problem, and then he helped me incorporate it into the System file, so it was loaded when the system booted.
We made a floppy containing the new System file, which was flown out to the sales presentation with a sales manager who was leaving the next day. But it took a while for the fixed System to proliferate to everyone, so for the next few weeks I had to brace myself every time that I saw someone about to cut and paste between applications.
1984
by Andy Hertzfeld in September 1983
the girl from the 1984 commercial
From the very beginning, Apple always had a flair for marketing. Mike Markkula believed that a fledgling venture needed to act like a successful company if it wanted to become one, at least in terms of external perception, and Steve Jobs always insisted on the highest possible production values, even while Apple was still in the garage. The Apple II was featured in an expensive, two page spread in the September 1977 issue of Scientific American, for example, even though Apple had less than twenty employees and minimal sales at the time.
Apple's advertising agency was Chiat-Day, founded by Jay Chiat in 1968. Jay Chiat was compulsively innovative, brash and irreverent, much like an older version of Steve Jobs, and the two hit it off great when they were introduced in 1981, just before Chiat-Day acquired Regis McKenna's advertising operations. Jay and his talented team, featuring Creative Director Lee Clow and star copywriter Steve Hayden, crafted Apple's first TV commercials, recruiting talk show host Dick Cavett as a spokesperson, and created the campaign that launched the Lisa, including a TV commercial that starred Kevin Costner while he was still unknown.
Toward the end of 1982, art director Brent Thomas and Steve Hayden came up with the idea of doing an ad campaign based on the timely tagline "Why 1984 won't be like 1984". Chiat-Day shopped it around to a number of clients, including Apple, where it was proposed to be used for a print ad in the Wall Street Journal promoting the Apple II. But Apple didn't go for it, and the idea was filed away until the spring of 1983, when they met with the Mac marketing team to start working on the launch, which was scheduled for January 1984.
Steve Jobs wanted to launch the Macintosh with an inspiring commercial that was as revolutionary as the product itself. He loved the Orwellian tagline when it was presented, and he encouraged the Chiat-Day team to pursue it. Steve Hayden and Brent Thomas put together an intriguing story board, envisioning a visually striking, highly symbolic, miniature science fiction epic featuring a young female athlete who liberates the subjugated masses from totalitarian domination by throwing her sledgehammer to smash a huge screen displaying Big Brother.
Macintosh marketing manager Mike Murray and Steve Jobs loved it, but they needed to get new CEO John Sculley's approval for such a large expenditure. Sculley was a bit apprehensive (after all, the commercial hardly mentioned the Macintosh), but he gave his OK for an unprecedented production budget of over $750,000, to make the one-minute commercial.
Chiat-Day hired the best science fiction oriented director they could find, Ridley Scott, whose previous movie, Blade Runner, possessed the visionary dystopian feel they were striving for. Ridley was based in London, so they decided to shoot it there, at Shepperton Studios. Several Apple and Chiat Day executives, including Mike Murray and Steve Jobs, travelled to London for the week of filming.
By the time the Apple folks arrived, Ridley's team had assembled a cast of almost 200. To play the oppressed, downtrodden baldheaded workers, his people recruited dozens of authentic British skinheads, paying them $125 dollars a day to participate. It was harder to cast the young heroine, since most of the models who tried out had trouble spinning with the heavy sledgehammer. Luckily, one named Anya Major was an accomplished discus thrower, and she could do it faultlessly, so she got the part.