We're Not Hackers! 我们不是黑客!

作者: 安迪·赫茨菲尔德 日期: 1983年9月 人物: 拉里·凯尼恩、安迪·赫兹菲尔德、比尔·阿特金森、伯勒尔·史密斯、史蒂夫·卡普斯 主题: 软件设计、技术、个性 概要: 关于苹果第一代Macintosh的开发以及制造它的人的轶事: 我们一直在处理内存限制 , 我们不是黑客! We’re Not Hackers!

From the start, the Macintosh was designed to be an affordable and widely sold computer. To achieve this, the design team had to find ways to keep the cost of making it low. Memory was also very expensive, so we had to work within these limitations.

从一开始,Macintosh 就被设计为一款价格实惠且广泛销售的计算机。为了实现这一目标,设计团队必须找到降低制造成本的方法。内存也非常昂贵,因此我们必须在这些限制范围内工作。

One good part of the original Macintosh computer was the way it handled the computer’s main bus. The 68000 chip needed a bus that could carry 16 bits of data at a time, but the memory chips only had 8 bits. So, Burrell Smith found a way to connect the 8 memory chips together so that the 68000 could still use the 16-bit bus. He also included a special chip that held 8 kilobytes of computer code. This meant that the first Macintosh computer, which was made in 1981, had 64,000 bytes of memory to store data and 8,000 bytes of coded instructions.

最初的麦金塔计算机的一个很好的部分是它处理计算机主总线的方式。 68000 芯片需要一条能够一次传输 16 位数据的总线,但内存芯片只有 8 位。于是,Burrell Smith找到了一种将8个内存芯片连接在一起的方法,这样68000仍然可以使用16位总线。他还添加了一个特殊的芯片,可容纳 8 KB 的计算机代码。这意味着 1981 年制造的第一台 Macintosh 计算机拥有 64,000 字节的内存用于存储数据和 8,000 字节的编码指令。

As we started to add software to the prototype, we realized that we didn’t have enough memory to run the kinds of graphics-heavy programs we wanted. Even just displaying a simple picture took up almost a third of the available space. Additionally, Bill Atkinson’s graphics code had become too big to fit in the 8KB memory chip. So, when we redesigned the digital board in June 1981, we added more memory to the chip and made it bigger. We filled two rows of memory chips, making the total memory 128KB. We also added another memory chip for the software, making it 16KB. We promised ourselves that this would be the last time we would have to increase the memory. We didn’t want it to get bigger like the Lisa project, which was using up a lot more memory than expected.

当我们开始向原型添加软件时,我们意识到我们没有足够的内存来运行我们想要的图形密集型程序。即使只是显示一张简单的图片也会占用近三分之一的可用空间。此外,Bill Atkinson 的图形代码太大,无法装入 8KB 内存芯片。
因此,当我们在 1981 年 6 月重新设计数字板时,我们为芯片添加了更多内存并使其变得更大。我们填充了两排内存芯片,使总内存达到128KB。我们还为软件添加了另一个存储芯片,使其达到 16KB。我们向自己保证,这将是我们最后一次增加内存。我们不希望它像 Lisa 项目一样变得更大,因为它消耗的内存比预期多得多。

Even though the memory on the computer doubled to 16,000 pieces, it was still not enough to fit our program and graphic pictures. Burrell thought that adding a third piece of memory would help, making a total of 24,000 pieces. Two of the memory pieces were connected directly to the computer’s main bus, which allowed the code to run faster. The third piece shared a special circuit with the RAMs, which helps the computer to remember things.

尽管计算机上的内存增加了一倍,达到16000块,但仍然不足以容纳我们的程序和图形图片。 Burrell 认为添加第三块内存会有帮助,总共 24,000 块。
其中两个内存块直接连接到计算机的主总线,这使得代码运行得更快。第三块与 RAM 共享一个特殊电路,帮助计算机记住事物。

In the fall of 1981, we made 50 copies of the Mac prototype. Each copy had 24,000 bits of information stored in a special chip called EPROM. Although the system was small enough to fit into 24,000 bits, we were still concerned that it might become too small later on. Our colleague Burrell didn’t like the fact that we were using three different chips for storing information.

1981 年秋天,我们制作了 50 台 Mac 原型机。每个副本都有 24,000 位信息存储在称为 EPROM 的特殊芯片中。尽管该系统足够小,可以容纳 24,000 位,但我们仍然担心它以后可能会变得太小。我们的同事伯勒尔不喜欢我们使用三种不同的芯片来存储信息。

One day in 1982, Burrell came back to my office after a meeting with a person who sells semiconductors. He was very excited. He almost ran into my office. He said, “You said you couldn’t fit in 24K, right? Tell me the truth. How much do you really need?”

1982 年的一天,伯勒尔在与一位半导体销售人员会面后回到我的办公室。他非常兴奋。他差点跑进我的办公室。他说:“你说你装不下24K,对吗?告诉我实话。你到底需要多少?”

We always seemed to run out of space just when we needed it. I said, “If we had 32,000 bytes more, I think we could make it work.”

当我们需要空间时,我们似乎总是用完空间。我说:“如果我们再多 32,000 字节,我想我们就能让它工作了。”

Burrell smiled. “No, it won’t be enough. The software is still not finished, so we need more space to store it. But I just heard that we will have a special kind of memory chip, called ROM, that will be ready by early 1983. We can use two of these chips together to get 64,000 bytes of storage space. This is a good idea because ROM is cheaper than RAM. I know you will want even more in the future, but this should help for now.”

伯勒尔笑了。 “不,这还不够。软件还没有完成,所以我们需要更多的空间来存储它。但我刚刚听说我们将有一种特殊的存储芯片,称为 ROM,它将在早些时候准备就绪。 1983 年。我们可以使用两个这样的芯片来获得 64,000 字节的存储空间,这是一个好主意,因为 ROM 比 RAM 便宜,我知道您将来会需要更多,但这现在应该有所帮助。”

At first, we thought 64,000 bytes of memory was more than enough. We tried to make our code as efficient as possible, and it seemed like we wouldn’t need much more. But as our system started coming together in the spring of 1983, we soon realized that we were reaching the limit and needed more memory.

起初,我们认为 64,000 字节的内存已经足够了。我们试图使我们的代码尽可能高效,而且似乎我们不需要更多。但当我们的系统在 1983 年春天开始组装时,我们很快意识到我们已经达到了极限,需要更多的内存。

We were lucky because we were using a system to manage our resources. This allowed us to keep some things on the computer’s hard drive instead of the ROM. Jerome and I came up with a plan called “PACK”. It would allow the computer to load extra code for special features, like computer calculations, from the floppy disk. However, data from the floppy disk loads much slower and takes up more space, making it less useful.

我们很幸运,因为我们使用一个系统来管理我们的资源。这使我们能够将一些东西保存在计算机的硬盘而不是 ROM 上。杰罗姆和我想出了一个名为“PACK”的计划。它将允许计算机从软盘加载用于特殊功能的额外代码,例如计算机计算。然而,软盘中的数据加载速度要慢得多,并且占用更多空间,从而使其用处不大。

When we first started writing our code, we tried to make it as small as possible. But because the computer’s memory was limited, we had to work even harder to make the code small enough. We came up with some strange ways to save space, like things Apple’s Woz did in his computer. For example, we would put things on the computer’s “stack” in a special order. This was because we had a value in a register that we needed later, and we didn’t want to use up extra space by getting it again. Although this made the code harder to understand and correct, we thought it was important to make it small enough.

当我们第一次开始编写代码时,我们试图使其尽可能小。但由于计算机的内存有限,我们必须更加努力地使代码足够小。
我们想出了一些奇怪的方法来节省空间,就像苹果公司的沃兹在他的电脑上所做的那样。例如,我们会以特殊的顺序将东西放入计算机的“堆栈”中。这是因为我们在寄存器中有一个稍后需要的值,并且我们不想通过再次获取它来占用额外的空间。
尽管这使得代码更难理解和更正,但我们认为使其足够小很重要。

When it was almost time to finish the computer program, the whole team started to try to make the program fit inside the computer’s memory. We did some practice runs, where everyone showed each other ways to make the program smaller. Then we went through the program, saving a few bytes at a time. Steve Capps, as usual, had a good idea. He found a way to make the small pictures that were built into the program smaller, which saved many valuable bytes.

当计算机程序快要完成时,整个团队开始尝试让程序适合计算机的内存。我们做了一些练习,每个人都互相展示了缩小程序规模的方法。然后我们检查了该程序,一次保存几个字节。像往常一样,史蒂夫·卡普斯有一个好主意。他找到了一种方法来使程序中内置的小图片变得更小,从而节省了许多宝贵的字节。

Bill Atkinson didn’t help with a long coding session, and didn’t think QuickDraw should be made more complicated, unless absolutely necessary. He believed that code should be easy to understand and simple. He thought this would be better for us in the long run. Just before we finished working on the computer’s memory, in September 1983, he found a problem with the way the computer used its memory. We quickly fixed it.

Bill Atkinson 没有帮助进行长时间的编码工作,并且认为 QuickDraw 不应变得更加复杂,除非绝对必要。他认为代码应该易于理解且简单。他认为从长远来看这对我们更好。 1983 年 9 月,就在我们完成计算机内存的研究之前,他发现计算机使用内存的方式存在问题。我们很快就修好了。

I went to Larry’s office with my friend Bill. Larry was working on some computer code. We added a little bit of code to fix a problem. Bill looked over our shoulders to see what we were doing. But when he saw that we used a special way of writing code that we often use, he didn’t like it. He started to get upset.

我和我的朋友比尔去了拉里的办公室。拉里正在研究一些计算机代码。我们添加了一些代码来解决问题。比尔从我们的肩膀后面观察我们在做什么。但是当他看到我们使用了我们经常使用的一种特殊的编写代码方式时,他就不喜欢了。他开始心烦意乱。

“Hey, I don’t think that’s the correct way to write code. Are you all just messing around and copying from others? I’m not sure I want to work with you if you’re not following proper coding practices.”

“嘿,我认为这不是编写代码的正确方法。你们只是在胡闹并抄袭别人吗?如果您不遵循正确的编码实践,我不确定我是否愿意与您合作。”

Larry and I really wanted to make Bill happy, so we didn’t try to make the code as good as it could be. We used a method that wasn’t the best, but Bill liked it. We also added a note to the code to help us remember why we did it. The note said “We’re Not Hackers!”

拉里和我真的想让比尔高兴,所以我们没有试图让代码尽可能好。我们使用的方法不是最好的,但比尔喜欢它。我们还在代码中添加了注释,以帮助我们记住为什么这样做。纸条上写着“我们不是黑客!”
目录