Revolution in the Valley: The Insanely Great Story of How the Mac Was Made (24 page)

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

Bill Duvall was an old friend of Bob Belleville's from Xerox who we seeded with a Mac prototype in the spring of 1983 so he could port his development system to it, including an assembler and a C compiler, to be sold by his own tiny company named Consulair. His linker even generated Macintosh code resources, but there was no equivalent of RMaker for building the other resources required by a Mac application - you still had to do that on a Lisa. I decided to rewrite RMaker for the Mac, so I could finally abandon the Lisa. I used assembly language, since the assembler was much further along than Consulair C was at the time. In a week or so, I had a new RMaker that was integrated with the Consulair tools, so you finally could write a complete application with just a Macintosh.

In the summer of 1984, I got a call from Dan Cochran, who was the marketing person at Apple in charge of developer tools. He had heard about my new version of RMaker, and wanted to bundle it with the Consulair package. After a bit of negotiation, I sold it to Apple in exchange for a brand new LaserWriter prototype. I drove up to Bill Duvall's house in the Berkeley hills to help him incorporate RMaker into his system. When my reward arrived in October, I thought it was pretty cool to be the first on my block to have a LaserWriter, three months before it was officially announced.

A Big Scare!

by Dan Cochran in April 1983

Apple Appoints New CEO?

On April 8th of 1983, Steve Jobs came by the Lisa offices on Bandley Drive with the former governor of California, Jerry Brown, in tow. I had just arrived at the office, with a full day of work already scheduled, but had to drop everything when Steve asked me to brief Brown on the Lisa and to give him a tour of the offices.

Al Mandel and I spent an hour or so with Jerry in the Lisa "Sneak Room” (a very well designed multimedia, executive briefing facility), giving him demonstrations and encouraging him to try some stuff himself. As I recall we even took apart a Lisa to show him the hardware architecture. He was trying to feign interest but his mind was off somewhere else (as it often was during his tenure as Governor).

After the show-and-tell I then took Brown on a guided tour through the Lisa facilities and we visited engineering, documentation, marketing, etc. In the past I had taken other famous people on walkthroughs and Apple employees would usually never bat an eye. We were used to this (and after all, WE were celebrities as well). However, the reaction to Jerry Brown was unlike anything I'd ever seen. People were acting almost nervous...concerned. While Jerry was talking to an engineer, someone else took me aside, looked me straight in the eye and pointed at Jerry with a look of anguish on his face. As I had no idea what he was getting at I simply replied nonchalantly, "Yeah...that's Jerry Brown". After 10-15 minutes of this Jerry had completely lost interest. I walked him out of the offices and we bid each other goodbye. But I was still very puzzled by the reaction to him.

As soon as I went back in the Bandley Lobby I discovered the source of the bewilderment. The Apple rumor mill was always incredibly active and that morning (unbeknownst to me because I'd been locked up with the former Governor) the word on Bandley Drive had it that Apple was prepared to announce a new CEO that day. And Jerry's arrival at the Lisa offices nearly triggered one of the biggest Wall Street panics since Black Monday. Some people were convinced that Jerry was to be named the new CEO of Apple!

And, looking back, at that time in Apple's history this scenario was actually very plausible...

As it turns out the Apple rumor mill was correct. Later that day John Sculley was announced as the new CEO of Apple. But that's another story for another time.

MacPaint Evolution

by Andy Hertzfeld in June 1983

MacPaint
tool palette

While Bill Atkinson was developing LisaGraf, the crucial, lightning fast graphics package that was the foundation of both the Lisa and Macintosh user interface (it was renamed QuickDraw for the Mac), he also worked sporadically on a simple bitmap-based drawing program for the Lisa called SketchPad. SketchPad enabled mouse-based drawing with a selection of paintbrushes and patterns, and gave Bill a quick way to test out and show off new features or improvements as they were added to LisaGraf.

In early 1983, soon after the Lisa was announced at the 1983 annual shareholders meeting, Bill switched from working on Lisa system software to writing a killer graphics application for the Macintosh. Steve Jobs thought that he should work on a structured drawing program, something like Mark Cutter's LisaDraw, but Bill thought that structured drawing was too complex, and wanted to create something that was simple, elegant and fun to use.

He began by dusting off his old SketchPad code, and getting it running on the Mac as MacSketch. SketchPad used menus to select patterns and styles to draw with, but Bill replaced them with permanent palettes at the bottom of the screen and added another large, prominent palette on the left, containing a variety of drawing tools. More tools would be added over time, but the basic structure of MacPaint was there from its earliest stages.

The first big advance that Bill worked on was eliminating flicker. As you dragged a shape or image across the screen, it had to be erased from its old position before being drawn in the new one, which caused a distracting flicker as the video sometimes displayed interim, partially rendered states. Bill completely eliminated flicker by composing everything in an offscreen memory buffer, which was transferred to the screen in one fell swoop, so the interim states were never visible.

In fact, despite the Macintosh's limited memory, he used two offscreen buffers, each the size of the document window, with one containing the current pixels of the document, and the other containing the pixels of its previous state, before the most recent operation. This made it very easy to implement undo, by just copying the old buffer to the new. It also enabled fast drawing, because it was very easy to access the original state of the document in the second buffer as an object was being modified.

After getting basic updating working well, Bill began to add more tools to the palette. He added a rectangular selection tool, to allow the user to perform operations on a subset of the document. The selection rectangle was depicted by inverting the pixels beneath it, which worked well enough over solid areas, but was confusing and hard to see when the underlying image was complex, like a digitized picture. Bill knew he had to find a better way to do it.

the inspiration for marching ants

He was thinking about the selection problem one evening when he went to dinner at an old beer and hamburger joint in Los Gatos, the kind of place where decades worth of initials are carved into the wooden tables. He ordered a beer, looked around the bar, and noticed a Hamm's beer sign. The beer sign featured an impressive animated waterfall, with the water seeming to flow down the waterfall into the lake. Bill figured out the animation was accomplished by a mask layer moving beneath the surface of the sign that varied which portion of the image was visible below.it.

He suddenly realized that an animated border, animated with a technique similar to the waterfall, could solve the graphical selection problem because it would always be easy to spot no matter what the background. He raced back home and implemented the animation by using an alternating sequence of patterns that produced the illusion of continuous motion, just like the beer sign. It looked great, but he didn't know how to refer to it. A couple of days later, he showed it to Rod Perkins on the Lisa applications team, who told Bill the effect resembled "marching ants," which Bill liked, so that's what he called it.

Around April 1983, Bill changed the name of the program from MacSketch to MacPaint. He began to hit his stride, and started to add new features to MacPaint on a daily basis. One of the most important was "Fat Bits", a mode which magnified a small section of the document by a factor of 8, allowing the user to easily manipulate individual pixels. It was implemented by scaling the offscreen buffer as it was transferred to the screen, so all of the other tools and effects kept working in Fat Bits mode.

Another key improvement came when Bill implemented the paint bucket tool, which allowed the user to fill an entire area of the screen with the selected pattern with a single click. It used a "seed fill" algorithm to find all the neighboring pixels of the matching color, which was difficult to implement because of our stringent memory constraints. Bill ended up implementing a few different seed fill algorithms before he settled on one that was both fast and memory efficient enough. The seed fill routine eventually migrated from MacPaint into QuickDraw as part of the 128K ROM.

Rectangular selection was useful, but often you needed to manipulate an arbitrarily shaped area of an image, so Bill came up with another selection tool he called the "lasso", because it contracted around its target. It's hard to control the mouse with pixel-level precision, so the lasso tool allowed you to roughly outline the area of interest, and it would automatically tighten, skipping white pixels to cinch tightly around the target. The lasso sort of fell out of doing the paint bucket, since the seed fill routine was exactly what was needed to cinch the lasso properly.

The lasso allowed an arbitrary area of pixels to be selected, so it required a third offscreen buffer the size of the document window, that contained a mask to indicate which pixels were part of the selection. The mask buffer allowed fast graphical operations on large, irregular areas, such as dragging an image around the screen, or making the lasso selection shimmer with the marching ants effect. The first two offscreen buffers were allocated statically, but the mask buffer needed to be deallocated when it wasn't being used, so its memory could be used for other purposes.

MacPaint was good at drawing text, allowing the user to specify characters at any position, with any font, size or style. But once the text was instantiated, it just became pixels like everything else; you couldn't go back and edit it as text. In June 1983, Bill thought he could do something about that.

Bill decided to try to turn pixels back into characters when you selected them with the text tool. He wrote a lot of elaborate code, probably as much as for any other MacPaint feature. First, he wrote assembly language routines to isolate the bounding box of each character in the selected range. Then he computed a checksum of the pixels within each bounding box, and compared them to a pre-computed table that was made for each known font, only having to perform the full, detailed comparison if the checksum matched.

Bill got his character recognition routines working well, and it seemed like magic, if you were used to the earlier MacPaint, to be able to recover and edit previously placed text. It wasn't perfect, because it would fail to recognize a character if a single dot was out of place, but it was still very useful. Everyone loved the feature, and congratulated Bill for pulling off another miracle.

Other books

The Fugitive by Massimo Carlotto, Anthony Shugaar
How to Romance a Rake by Manda Collins
Dodgers by Bill Beverly
Second Chance by Christy Reece
Whatever It Takes by Dixie Lee Brown
All That Glitters by V. C. Andrews
Fear the Worst: A Thriller by Linwood Barclay
Voyagers I by Ben Bova