将 WordStar 从 CP/M 移植到 DOS 的单字节更改是什么?
我正在重读 Joel 的策略信 II:先有鸡还是先有蛋的问题,并发现了这个有趣的内容引用:
事实上,WordStar 已移植到 DOS 通过改变一个字节 代码。 (真正的程序员可以告诉你 那个字节是什么,我早就知道了 忘记了)。
我通过快速谷歌搜索找不到任何其他参考资料。 这是真的还是只是一种比喻? 为了成为一名“真正的程序员”,单字节的变化是什么?
I was re-reading Joel's Strategy Letter II: Chicken and Egg problems and came across this fun quote:
In fact, WordStar was ported to DOS
by changing one single byte in the
code. (Real Programmers can tell you
what that byte was, I've long since
forgotten).
I couldn't find any other references to this with a quick Google search. Is this true or just a figure of speech? In the interest of my quest to become a "Real Programmer", what was the single byte change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
听起来有点夸张,在这里找到了一些WordStar历史
但是……Joel 的意思可能是 MS-DOS 1.0 / QDOS
Sounds a bit exaggerated, found some WordStar history here
But...Joel maybe meant MS-DOS 1.0 / QDOS
您必须更改多个字节。 CP/M-86 可执行文件 (.CMD) 均具有 128-字节标头,它与 .EXE 标头不同。
如果将所有 API 调用限制为 CP/M 和 DOS 的公共子集,则可以使用条件汇编从同一源构建 CP/M 和 DOS 版本:
You'd have to change more than one byte. CP/M-86 executables (.CMD) all have a 128-byte header, which isn't anything like the .EXE header.
If you restrict all your API calls to the common subset of CP/M and DOS, then you can use conditional assembly to build CP/M and DOS versions from the same source:
此维基百科条目声称 CP/M 和 MS-DOS 共享二进制格式。 它接着说:
这意味着修复/移植可能正在将第一条指令更改为其他指令,从而允许其余指令执行。 但不确定,这似乎意味着二进制文件一定是“胖”的,这对于遗留二进制文件来说似乎不合理。
This Wikipedia entry claims that CP/M and MS-DOS share binary formats. It goes on to say:
This implies that perhaps the fix/port was changing this first instruction into something else, that alowed the rest to execute. Not sure though, that seems to imply that the binary must have been "fat", which seems unreasonable for a legacy binary.
WordStar 是用 8080 汇编程序编写的,当时有工具可以将 8080 汇编程序转换为 8086 汇编程序(8086 指令集旨在允许这样做),如果所有代码都可以放入单个段中,那么这是完全可能的。
我第一次使用 WordStar 是在 1979 年,当时是在 Z80 CP/M 盒子上。 今天的人们可能没有意识到他们是多么幸运 - 有多少 MS Word 用户在安装文字处理器时的第一个任务是必须编写几个小型汇编程序例程(十六进制!)以有效地连接文字处理器(您可以在屏幕和键盘上使用 CP/M 例程,但它们太慢而且无法正常工作? 快乐的时光...
WordStar was written in 8080 assembler, and there were tools back then to convert 8080 to 8086 assembler (the 8086 instruction set was designed to allow this) if all the code could fit into a single segment, so this is quite possible.
I first used WordStar in 1979, on a Z80 CP/M box. People today might not realise how lucky they are - how many MS Word users would be prepared as the first task on installing their word processor to have to write a couple of small assembler routines (in hex!) to interface the word processor efficiently (you could use the CP/M routines but they were dog slow and didn't work properly) with the screen and keyboard? Happy days...
“事实上,WordStar 是通过更改代码中的一个字节而移植到 DOS 的。(真正的程序员可以告诉你那个字节是什么,我早已忘记了)。”
2009 年 6 月 8 日星期一下午 6:27。 我的假设是 Spolsky 正在谈论 8080 CP/M 到 8086 MSDOS,这个故事可能是假的。 8086 CP/M 从来就不是一个大项目——我的意思是,它被 MSDOS 彻底压垮了——而且有人可能通过重新组装将 WordStar 从 8080-CPM 转换为 8086-CPM,如下所示其他人指出,使用特殊的 8080 到 8086 转换器——然后也许只需要更改一个字节。
"In fact, WordStar was ported to DOS by changing one single byte in the code. (Real Programmers can tell you what that byte was, I've long since forgotten)."
Mon 6/08/2009 6:27 pm. My assumption was Spolsky was talking about 8080 CP/M to 8086 MSDOS, and that the story is probably bogus. 8086 CP/M was never a big item -- I mean, it was crushed utterly by MSDOS -- and someone may have converted WordStar from 8080-CPM to 8086-CPM -- by reassembling it, as others have noted, using a special 8080-to-8086 translator thingey -- and then perhaps only a single byte had to be changed.
我不确定乔尔的说法是否准确。 也许他指的是吉姆·福克斯制作的演示版本?
请参阅http://www.wordstar.org/wordstar/history/history.htm
我将引用相关部分:
(编辑:哎呀,太晚了。其他人已经发现了完全相同的事情:-/请随意忽略我。)
I'm not sure whether Joel's statement is accurate or not. Perhaps he meant the demonstration version that Jim Fox made?
See http://www.wordstar.org/wordstar/history/history.htm
I'll quote the pertinent section:
(Edit: Oops, too late. Someone else already found the exact same thing :-/ Feel free to ignore me.)
需要了解的重要一点是,当时 16 位 8086 机器刚刚问世,以取代当前的 8 位机器,其中 CP/M 操作系统就是当时的 Windows。 一切带有用于工作的磁盘驱动器的东西都运行 CP/M。 该版本后来被称为 CP/M-80,以区别于 8086 处理器的 CP/M-86。
不幸的是,它花了很长时间才上市,以至于 QDOS 被编写为可以运行程序的东西,而这本质上是 CP/M 函数的快速重新实现(但使用不同的语法)。 QDOS后来被微软收购并制成MS-DOS。 因此,MS-DOS 实际上有一个 CP/M 核心,因此使 CP/M-86 程序在 MS-DOS 下运行所需的工作量是有限的(不是单个字节,但可以管理)。
我很高兴使用 CCP/M-86 工作了几年,它允许的多任务处理与今天 Linux 文本模式(带有虚拟控制台)允许的多任务处理非常相似。 不幸的是它从未流行起来。 哦,好吧,我们有 Linux :)
An important thing to understand is that at the time 16-bit 8086 machines was just coming out to replace the current 8-bit machines, where the CP/M operating system was the Windows of the day. Everything with a disk drive intended for work ran CP/M. That version was later called CP/M-80 to differentiate it from CP/M-86 for the 8086 processor.
Unfortunately that took so long to get to market that QDOS was written to have SOMETHING to run programs on, and that was essentially a quick reimplementation of the CP/M functions (but with a different syntax). QDOS was later bought by Microsoft and made into MS-DOS. Hence MS-DOS actually has a CP/M core deep deep inside, and therefore the amount of work needed to get a CP/M-86 program to run under MS-DOS was limited (not to a single byte, but manageable).
I had the pleasure to work a few years with CCP/M-86 which allowed multitasking very similar to what Linux in text mode (with virtual consoles) allow today. Unfortunately it never caught on. Oh, well, we have Linux :)