RMaker RMaker

作者: 安迪·赫茨菲尔德 日期: 1983年3月 人物: 安迪·赫茨菲尔德、鲍勃·贝尔维尔、布鲁斯·霍恩、丹·科克伦、杰罗姆·库南、比尔·杜瓦尔、巴里·海恩斯 主题: 技术、软件设计、原型、LaserWriter、丽莎、丽莎竞争 概要: 关于苹果第一代Macintosh的开发以及制造它的人的轶事: 资源编译器中添加了疯狂的黑客攻击 , RMaker RMaker

In the autumn of 1982, the system became stable enough for other parts of the Toolbox to use it. At first, only one part, the dialog manager (which was also created by Bruce Horn), used this system. But soon, the use of this system spread to other parts of the system. By the beginning of 1983, we were using this system to create windows, menus, and controls. However, we didn’t have a good way to let developers choose settings for these things.

1982 年秋天,该系统变得足够稳定,可供工具箱的其他部分使用。起初,只有一个部分,即对话管理器(也是由 Bruce Horn 创建的),使用了该系统。但很快,这个系统的使用就蔓延到了系统的其他部分。到 1983 年初,我们开始使用这个系统来创建窗口、菜单和控件。然而,我们没有一个好的方法让开发人员为这些事情选择设置。

Bruce made a special program that took a simple text description of a conversation and turned it into the actual conversation files. Later, in 1983, I added to this program to make it more powerful. I named it “RMaker” and it worked on the Lisa computer. RMaker took a text description and turned it into a special file with all the needed information. This file could be for anything, like pictures or menus. You can see an example of one of these files by clicking on the link that shows the resource definition file for MacPaint.

Bruce 制作了一个特殊的程序,可以将对话的简单文本描述转化为实际的对话文件。后来,在1983年,我给这个程序添加了内容,使其更加强大。我将其命名为“RMaker”,它可以在 Lisa 计算机上运行。 RMaker 获取文本描述并将其转换为包含所有所需信息的特殊文件。该文件可以用于任何内容,例如图片或菜单。您可以通过单击显示 MacPaint 资源定义文件的链接来查看其中一个文件的示例。

The Macintosh computer was built with a special chip called the Motorola 68000. This chip was very good for its time, but it had a few things that made it difficult to work with. One problem was that the chip didn’t have a way to jump to a very faraway place in the code. Another problem was that we couldn’t use jumps to very specific places in the code because we wanted the code to work no matter where it was stored. This meant that we could only have a limited amount of code in one piece before it got too big. The most we could have was 32,000 bytes.

Macintosh 计算机采用名为 Motorola 68000 的特殊芯片构建。该芯片在当时非常出色,但有一些问题使其难以使用。一个问题是芯片无法跳转到代码中很远的地方。另一个问题是我们无法跳转到代码中非常特定的位置,因为我们希望代码无论存储在哪里都能正常工作。这意味着在代码变得太大之前,我们只能在其中包含有限数量的代码。我们最多可以拥有 32,000 字节。

The Lisa computer wasn’t powerful enough for Lisa applications, so we created a way to use many small pieces of code together. These pieces were connected with a special list that helped them talk to each other. The Macintosh, on the other hand, had much less memory. I thought we could make things simpler and only use one piece of code per application. But I was wrong.

Lisa 计算机的功能不足以支持 Lisa 应用程序,因此我们创建了一种将许多小代码片段一起使用的方法。这些作品与一个特殊的列表相连,帮助他们相互交谈。
另一方面,麦金塔电脑的内存要少得多。我认为我们可以让事情变得更简单,每个应用程序只使用一段代码。但我错了。

In March 1983, Jerome Coonen came to see me looking worried. Three different workers were having trouble because their code was too big, and he didn’t know what we could do. The schedule was already tight, and it seemed impossible to add a special feature to the code that would help with this problem. He asked me what I thought we should do.

1983 年 3 月,杰罗姆·库宁 (Jerome Coonen) 来看我,我一脸忧心忡忡。三个不同的工人遇到了麻烦,因为他们的代码太大,而他不知道我们能做什么。时间安排已经很紧张,似乎不可能在代码中添加一个特殊功能来帮助解决这个问题。他问我认为我们应该做什么。

I didn’t think about it earlier, but now it seems obvious that we should store code segments in resources, like we do with almost everything else. It will take some tricky code to create, load, and manage the jump table, but that doesn’t sound too difficult. I told Jerome that I think I can make a resource-based multi-segment loader in less than a week.

我之前没有考虑过这一点,但现在看来很明显,我们应该将代码段存储在资源中,就像我们对待几乎所有其他东西一样。创建、加载和管理跳转表需要一些棘手的代码,但这听起来并不太困难。我告诉杰罗姆,我想我可以在不到一周的时间内做出一个基于资源的多段加载器。

Jerome was surprised and wanted me to start working on it quickly. He thought it would take a month, but Jerome wanted it done sooner. I was a bit slow to agree because I was still upset about a bad review I got from Bob Belleville a little while ago. But I got excited about the new way of doing things and decided to try my best to get it done.

杰罗姆很惊讶,并希望我尽快开始工作。他原以为需要一个月的时间,但杰罗姆希望能早点完成。我有点迟钝地同意了,因为我仍然对不久前从鲍勃·贝尔维尔那里得到的差评感到不安。但我对新的做事方式感到兴奋,并决定尽力完成它。

The most difficult part of my job was creating a tool that takes the output of a special program called Lisa linker and turns it into something that computers can understand. I was still working on a project called RMaker, and I found that it was the perfect opportunity to do this job. I added some code to RMaker to make it create code resources and a special table called a jump table from small pieces of code, and was able to make a simple program that can load different parts of a program into the computer’s memory in just a few days.

我工作中最困难的部分是创建一个工具,该工具获取名为 Lisa 连接器的特殊程序的输出,并将其转换为计算机可以理解的东西。我当时仍在从事一个名为 RMaker 的项目,我发现这是完成这项工作的绝佳机会。我向 RMaker 添加了一些代码,使其能够根据小段代码创建代码资源和一个称为跳转表的特殊表,并且能够制作一个简单的程序,只需几分钟即可将程序的不同部分加载到计算机内存中天。

The Lisa linker could create two different types of jump tables. One was 6 bytes long and simply contained a long jump instruction that went to a specific memory address. This address was not real, so the operating system had to move the correct code to the correct address. The Macintosh does not have special hardware to manage memory, so this method did not work for us. Luckily, the linker also supported a 10-byte version that did not rely on virtual memory. Instead, it made a special call to the operating system to load a section of code. I used this type of jump table for my initial version.

Lisa 链接器可以创建两种不同类型的跳转表。其中一个长度为 6 个字节,仅包含一条跳转到特定内存地址的长跳转指令。这个地址不是真实的,因此操作系统必须将正确的代码移动到正确的地址。
Macintosh 没有特殊的硬件来管理内存,因此这种方法对我们不起作用。
幸运的是,链接器还支持不依赖虚拟内存的 10 字节版本。相反,它对操作系统进行了特殊调用来加载一段代码。我在最初的版本中使用了这种类型的跳转表。

It took 4 pieces of information (bytes) to call a special function on the Lisa computer, but the Macintosh could do it with only 2 pieces of information. This means we didn’t need as much space to store jump tables. Storing 8 pieces of information per jump table was better than using 10, because it saved memory and made it easier to use in the future. Everything needed to line up with a certain kind of address that computers use (32-bit boundaries). I thought it would be easy to make the Lisa computer’s program (linker) use 8 pieces of information per jump table, but I didn’t have the special code to do it, so I asked the Lisa team to make the change for us.

在 Lisa 计算机上调用一个特殊函数需要 4 条信息(字节),但 Macintosh 只需要 2 条信息就可以做到。这意味着我们不需要太多空间来存储跳转表。每个跳转表存储 8 条信息比使用 10 条更好,因为它节省了内存并且更容易将来使用。一切都需要与计算机使用的某种地址(32 位边界)保持一致。我认为让 Lisa 计算机的程序(链接器)每个跳转表使用 8 条信息会很容易,但我没有特殊的代码来做到这一点,所以我要求 Lisa 团队为我们进行更改。

The engineer on the Lisa team who worked on the linker said he wouldn’t help with renaming the project. He didn’t want to work on it and said he had more important things to do first. He also wouldn’t give me the code, so I couldn’t do it myself. After a week or so, I got tired of waiting and thought of a tricky solution that would let me move forward without him.

Lisa 团队中负责链接器的工程师表示,他不会帮助重命名该项目。他不想再做这件事,并说他有更重要的事情要做。他也不给我代码,所以我自己无法完成。大约一周后,我厌倦了等待,想到了一个棘手的解决方案,让我在没有他的情况下继续前进。

The problem was that the program was creating jump tables in a wrong way. It thought every jump table had 10 bytes, but it was actually 8 bytes. This meant I had to find and fix every reference to the jump table, multiplying the number by 8/10 to make it accurate. The jump table was only used by a few specific commands, so I added a feature to a program called RMaker to scan through the code and fix the references. This wasn’t perfect because it couldn’t tell the difference between code and data, so it might fix something it shouldn’t. But I thought it was okay for a short time until a better linker was available.

问题在于该程序以错误的方式创建跳转表。它以为每个跳转表有 10 个字节,但实际上是 8 个字节。这意味着我必须找到并修复对跳转表的每个引用,将数字乘以 8/10 以使其准确。跳转表仅由少数特定命令使用,因此我向名为 RMaker 的程序添加了一个功能来扫描代码并修复引用。这并不完美,因为它无法区分代码和数据之间的区别,因此它可能会修复一些不应该修复的问题。但我认为暂时还可以,直到有更好的链接器可用为止。

I kept asking someone named Lisa to make a change to the computer code. This change was important and needed to be done. But Lisa did not do it for more than nine months. She never actually did it. Then, Lisa moved to a different project, and a new person named Barry took over. Barry did the task quickly, just as I was about to take a break. This allowed us to fix a problem with the computer code that was not very good. Amazingly, no one ever noticed the problem before.

我一直要求一个名叫丽莎的人更改计算机代码。这一改变很重要并且需要完成。但丽莎已经九个多月没有这么做了。她实际上从未这样做过。然后,丽莎转到了另一个项目,一个名叫巴里的新人接手了。巴里很快就完成了任务,正当我正要休息的时候。这使我们能够解决计算机代码不太好的问题。令人惊讶的是,之前没有人注意到这个问题。

I left my job at Apple in March 1984, but I still loved writing software for Macintosh as an independent developer. I had many ideas for new programs. However, I was not happy that I still needed a Lisa computer to write software for Macintosh. This was partly because of a recent problem with a special link that connected programs, which had affected the Lisa system in a bad way. I had a Lisa at home, but it actually belonged to Apple, and I didn’t want to have to buy one. So, I decided to try to create a development system that only used Macintosh computers.

1984 年 3 月,我辞去了 Apple 的工作,但我仍然喜欢作为一名独立开发人员为 Macintosh 编写软件。我对新项目有很多想法。然而,我不高兴的是,我仍然需要一台 Lisa 计算机来为 Macintosh 编写软件。部分原因是最近连接程序的特殊链接出现了问题,这对 Lisa 系统造成了严重影响。我家里有一台 Lisa,但它实际上是 Apple 的,我不想买一个。因此,我决定尝试创建一个仅使用 Macintosh 计算机的开发系统。

I had known Bill Duvall, a friend from Xerox, since 1983. At the time, he was working on his own small company, Consulair. He was trying to make his development tools work on the new Mac computer. He needed an assembler and a C compiler to create software for his company. However, he couldn’t build all the necessary parts for his software on the Mac. He had to use a different computer, called Lisa, to do that part. I decided to help by rewriting a program called RMaker, which would help make all the necessary parts for a Mac application. I used a special language called assembly language, because it was more developed than the other language he was using. It only took me a week to finish the new RMaker. With it, Bill could finally make his software work entirely on the Mac, without needing the Lisa.

我自 1983 年起就认识施乐公司的朋友比尔·杜瓦尔 (Bill Duvall)。当时,他正在自己的小公司 Consulair 工作。他试图让他的开发工具在新的 Mac 电脑上运行。他需要一个汇编器和一个 C 编译器来为他的公司创建软件。
然而,他无法在 Mac 上构建他的软件的所有必要部件。他必须使用另一台名为 Lisa 的计算机来完成该部分。
我决定通过重写一个名为 RMaker 的程序来提供帮助,这将有助于为 Mac 应用程序制作所有必要的部分。我使用了一种特殊的语言,称为汇编语言,因为它比他使用的其他语言更发达。
我只花了一周的时间就完成了新的RMaker。有了它,Bill 最终可以让他的软件完全在 Mac 上运行,而无需 Lisa。

In 1984, I got a phone call from Dan Cochran, who worked at Apple. He was in charge of helping developers make software and apps. Dan wanted to add my new program, RMaker, to a package they were making called Consulair. We talked about the deal and I sold it to Apple in exchange for a brand new Apple printer called LaserWriter. I went to a friend’s house in the hills near Berkeley to help him make RMaker work with his system. When I finally got my reward, I was thrilled to be the first one in my neighborhood to have a LaserWriter. This was three months before it was officially announced by Apple.

1984 年,我接到苹果公司工作人员丹·科克伦 (Dan Cochran) 的电话。他负责帮助开发人员制作软件和应用程序。 Dan 想将我的新程序 RMaker 添加到他们正在制作的名为 Consulair 的软件包中。我们讨论了这笔交易,我把它卖给了苹果公司,以换取一台名为 LaserWriter 的全新苹果打印机。我去了伯克利附近山上一位朋友的家,帮助他让 RMaker 在他的系统上运行。当我最终获得奖励时,我很高兴成为我附近第一个拥有激光书写器的人。这是苹果正式宣布这一消息的三个月前。

2xl

目录