Revolution in the Valley: The Insanely Great Story of How the Mac Was Made (18 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

The guard scrutinized Steve's badge. He looked at Steve, then back at the badge a few times. Finally, he shrugged his shoulders, picked up the pieces of the broken alarm, and walked away, without saying another word.

We were gleeful that the alarm was gone, but exactly one week later, a new one was put in its place, which stayed there until we moved to Bandley 3 a few months later. I'm not sure why, but not even Steve could get them to set it for a later time.

Resource Manager Countdown

by Andy Hertzfeld in August 1982

Bruce used one note for
each remaining day

The Resource Manager was one of the cornerstones of the Macintosh Toolbox. It provided a way to manage chunks of data so they could be easily accessed by the code but be stored and edited independently from it. This was the basis of our localization, for example, since text strings could be stored as resources and translated without having to change the code and rebuild the entire application.

Resources were conceived and implemented by Bruce Horn. They came a little late in the design cycle, and we had to rewrite some other parts of the toolbox to take advantage of them, although that wasn't clear initially. But in the summer of 1982 they were definitely one of the riskier parts of the design.

Bob Belleville, our new software manager, assessed the situation and decided that the resource manager was too big a risk, and tried to convince us to drop it from the design. Bruce went apoplectic, and Bob eventually compromised on giving Bruce 30 days to implement the resource manager. Bruce agreed that if it wasn't ready within 30 days, it would be dropped from the project.

The next day, Bruce came to work with a few pads of yellow sticky notes. He tore off one note at a time, wrote a number on it, and then stuck it on the wall of the double-sized cubicle that I shared with him. Soon the cubicle was encircled with little yellow notes, each with a number from 1 to 30.

"This shows me how many days that I have left", Bruce explained. "I'll tear one down each day, and it will remind me of how much time is remaining."

For the next month, the first thing that Bruce did every morning was dramatically tear off the note with the lowest remaining number. As the days passed, he was making good progress but it wasn't at all clear that he was going to make it.

When there were only three notes left, I began to wonder what was going to happen if Bruce missed the deadline. The resource manager was mostly working now, but he didn't seem to be on a path to closure, as he continued to refine the design.

Finally, there was only one note left on the wall. But when Bruce came in that morning, he had a new pad of yellow notes, and instead of taking the last one down, he wrote another ten numbers and posted them up, before taking down the previously final note. I started to laugh.

"It's overtime", he explained. "I swear I'll really be done in ten more days."

I was waiting for Bob Belleville to confront him, and tell him that he missed the deadline, but Bob wisely saw that the resource manager was far enough along that it could stay. And Bruce really did finish in the next ten days, kind of.

Boot Beep

by Andy Hertzfeld in September 1982

When you powered up an Apple II, it would make a short beep sound to let you know that it was alive. We thought that the Mac should do something similar, once it passed the diagnostics, sort of like an infant's first cry, letting the world know that you actually made it here.

The 1981 Macintosh just had a square wave sound generator, where the software controlled the frequency by loading a value into the VIA's timer. I wrote a boot sound routine that gradually incremented the frequency at an accelerating pace, so it had a whooping quality to it that was almost humorous. People generally liked it, but we knew that we'd have to do something better for the real product.

In August 1982, the Mac was redesigned with much better sound quality, so we had the possibility of a better boot sound, since we now had 8-bit samples to play with. I started experimenting a little bit, to see if I could come up with something.

Around this time, Charlie Kellner decided to transfer to the Mac group from the Apple II group. Charlie was a brilliant Apple II programmer (who wrote a classic hi-res bowling game for the Apple II before he started work at Apple), who was a multi-talented, meticulous perfectionist. He had designed a music synthesizer for the Apple II, called the alphaSyntauri, as a side project that was the basis of a small start-up company. For some reason, he got bored with the Apple II and wanted to try out working with the Mac team.

Charlie saw me messing around with sounds for a new boot beep and told me that he knew of a simple algorithm that might work pretty well. He asked me to fill the sound buffer with a simple square wave, but then make successive passes on it, averaging adjacent samples until everything reached the same level.

I coded it up and we tried it, and sure enough it had a pleasant, distinctive chiming quality. With a little bit of tweaking, it became the famous sound that the Mac made when it powered up, which lasted until the Mac II, which had even better sound capability, in 1987. For the interest of technical readers, here is a link to the
source code for the Boot Beep routine
, written in 68000 assembly language.

Charlie was pleased that he was able to make a significant contribution in his first week on the project. Inspired, he asked if he could take a prototype home over the weekend for testing. The next Monday he came into work very excited.

"I knew that something wasn't right!", he exclaimed. "The sound is being completely muffled by the case!. But I know how to fix it."

He had done a series of experiments with the Mac that he had taken home over the weekend, and found that the Macintosh's case was baffling and distorting the sound. He even printed out graphics showing the results of his measurements. Then, after analyzing the data, he drilled a hole about the size of a dime in a strategic place, which caused the measurements to improve dramatically.

He started demoing his modified prototype, showing how the hole improved the sound quality. The difference didn't sound that significant to me, but it definitely was an improvement. He showed it to Terry Oyama, who designed the case, and asked him if he could add the hole.

The next day, Steve Jobs came by in the afternoon and asked to hear Charlie's demo. He listened to the two Macs, and then decreed "There's not enough improvement! There's no way that we're going to put an ugly hole in the case! Just forget about it!"

Charlie was pretty disappointed, and never got very enthusiatic about the Mac after that. A couple of weeks later, he transfered back to the Apple II group, leaving the boot beep as his only legacy.

Sound By Monday

by Andy Hertzfeld in September 1982

Cartoon from IEEE Spectrum

When Burrell redesigned the Macintosh digital board in August 1982 after the Integrated Burrell Machine effort fell apart, one of the most significant improvements involved the sound generation capability. All of the extra logic available in the IBM chip allowed Burrell to implement four simultaneous channels of sound, each using a custom wavetable. That was too expensive to keep without the custom chip, but he was able to maintain the fundamental capability, DMA-fetched sound using 8 bits per sample and a clever, pulse width modulated digital to analog converter.

Burrell figured that the Mac could still have the four simultaneous voices that he had envisioned for the Integrated Burrell Machine, only now we'll do most of the work in software instead of hardware. So he promised Steve that the redesign would feature great sound, including a four voice synthesizer. Steve approved spending an extra dollar on an improved amplifier, to better match the improved sound generation capability.

But there were an enormous number of different things to work on in the summer of 1982, including getting the Mac Toolbox into good enough shape for developers to start writing applications. Burrell bugged me about writing a sound driver, and especially his cherished "four voice engine", but I wasn't able to get around to it as a few weeks passed.

Steve Jobs started to get impatient about getting to hear our new sound capability for himself. Finally, he pulled Burrell and myself aside late on a Friday afternoon.

"You told me that the new sound would be really great, right?", he asked Burrell. "Well, if I don't hear great sound coming out of that prototype by Monday morning, we're going to remove the amplifier. "

Then he looked at me. "You've had long enough to get the sound going. I want to hear great sound on Monday, or else." Then he stormed off, leaving Burrell and me to figure out what to do.

"I think he's bluffing", I told Burrell. "But what if he's not?"

Burrell didn't seem very upset, in fact he seemed kind of excited. I think he was pleased that Steve was on our case about the sound, since he really wanted me to write the sound routines as soon as possible anyway. He promised to buy me meals all weekend while we stayed at Apple to get the sound going.

I had already written a basic diagnostic that generated a simple square wave, which certainly didn't meet anyone's criteria for great sound, but at least it told us the hardware was working, and worked out the basic details of controlling the hardware. Burrell wanted me to get to work right away on the four voice synthesizer, since he wasn't sure we could actually make that work.

As usual, Burrell's new design was very clever. The Macintosh was already continuously fetching data from memory to drive the video display, interleaving memory bandwidth between the display and processor in a similar fashion to the Apple II. But every 44 microseconds, there was a "horizontal blanking interval" where no video data was needed, so Burrell used that time to fetch data for the sound. That gave us a sample rate of 22kHz, which would allow us to do frequencies up to 11kHz, which isn't too bad.

The sound driver worked at the interrupt level, so sound generation could proceed in the background while the processor performed some other task. It arranged to receive control at the beginning of the vertical blanking interval, which occured every 16 milliseconds. It needed to generate all the sound data for the next 16 milliseconds, which worked out to 44 microseconds for every successive sample. If our calculation took 22 microseconds per sample, for example, the sound generation would be soaking up half of the available processor cycles.

It only took a few hours to write a driver with a simple sound generation loop. It could do two voices fine, but it didn't run nearly fast enough to do four - it took too long to generate each sample, which caused audible glitches as well as making everything else run like molasses. Burrell took a look at my code, and saw that I was using some memory locations during the sound calculation.

"Memory? Are you kidding? You can't hit main memory, you'll never make it that way. You've got to do everything in the registers!"

"Registers" are special locations that are part of the processor chip itself, where the action really happens. They could be accessed four times faster than the bulk of memory, which was in separate memory chips. The problem was that there were only 16 registers. For each voice of sound, we needed a frequency, a waveform pointer, a position within the waveform, and an amplitude, plus some housekeeping data. There weren't enough registers to do four voices.

I was able to rewrite the routine without touching main memory, but I was only able to get three voices since I ran out of registers. But that wasn't good enough for Burrell. By now it was late on Saturday evening, and I wanted to go home, but he felt that we had to get the fourth voice done before "head hits pillow" as he liked to say, or we'll never get the fourth voice.

Finally, I was able to leverage the fact that the registers were 32 bits long and we only were doing 16 bit calculations in some of them, to use some of the them to hold two different values. Each sample took about 22 microseconds to calculate, so we were using roughly half of the CPU to get the four voices at the maximum sample rate. The basic four voice capability was implemented, but we still needed an impressive demo to show it off. We went home to sleep at around midnight, after agreeing to come back around noon to work on the demo.

Other books

The Overlords of War by Gerard Klein
Heaven Forbid by Lutishia Lovely
A Division of the Light by Christopher Burns
Fuzzy by Josephine Myles
Safe Word by Mummert, Teresa
Aeon Legion: Labyrinth by Beaubien, J.P.
30 Days in Sydney by Peter Carey