We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
http://www.arrakis.es/~ninsesabe/pasmo/
“从版本 0.5.0 开始,还可以从 Z80 源生成 8086 代码,以 Ms-dos COM 文件的二进制格式或 CP/M 86 CMD 格式。”
Pasmo 0.6:“现在可以汇编 8080 代码,或者与 Z80 混合。”
http://www.arrakis.es/~ninsesabe/pasmo/
"Starting with version 0.5.0, can also generate 8086 code from Z80 sources, in binary format for Ms-dos COM files or in CP/M 86 CMD format."
Pasmo 0.6: "Now can assemble 8080 code instead, or mixed with, Z80."
Sargon 源代码现在可以在 CP/M 模拟器上运行。 这是从 Wavemate Jupiter III 移植到 CP/M 的源代码
此处提供 CPM 模拟器
要组装源代码,您需要 TDL ZASM 和 TDL 链接器。 它们可以在这里找到。
用于创建 Sargon 的命令MS-Windows 控制台窗口是:
The Sargon source code runs now on a CP/M emulator. Here is the source ported from Wavemate Jupiter III to CP/M
A CPM emulator is available here
To assemble the source you need the TDL ZASM and TDL Linker. They are available here.
The commands to create Sargon in a MS-Windows console window are:
您是否必须真正翻译代码,还是模拟器就足够了?甚至还有一个用 Javascript 编写的!
Must you actually translate the code, or would an emulator suffice? There's even one written in Javascript!
您可能需要考虑一些替代方案。一种是将静态二进制转换为 C,如果将 8080 代码汇编成二进制,这可能会更容易。没有看到您的代码,您可能会遇到问题,因为它不是一对一的事情。 8080 或其运行的主板中的资源与您计划运行代码的 8086 不匹配。如果您转换为 C,那么您现在或现在就可以针对任何内容,而不必局限于模拟环境中的 x86 来解决先前的问题。这并不像看起来那么可怕或痛苦......实际上很有趣。
我一直在考虑做的事情是不翻译为 C,而是翻译为 llvm 的字节码。
编辑:
汇编器到汇编器的问题,除了有一天必须再次执行之外,不是指令的功能(寄存器 A = 寄存器 A + 1),而是标志和条件分支(寄存器 A = 寄存器 A + 1) ,如果 A == 0 Z = 1,否则 Z = 0,...)。根据您对 8080 与 Z80 的了解,您知道您必须找到或创建一个可以解析该汇编程序的工具。我的理论是,您更有可能找到二进制的汇编器而不是转换工具。然后,您可以从二进制进行模拟(以远远高于全速的速度)或进行静态二进制转换,最好是转换为 C。使用 C,您可以很草率,您可以让每条指令都有代码来更新标志,然后在 C 中进行优化器编译器可以删除死代码。这是汇编器不会做的事情,直接进入 x86 会给你留下大量未使用的指令。我没有阅读手册或太多代码,因此它可能很容易处理,但除了各个指令之外,还有堆栈、内存、寄存器和用户界面的问题。如果要使用图形/视频接口,则必须批量替换该代码,如果 8080 和 x86 之间的堆栈有所不同,那么您将必须处理该问题,并且可能存在硬编码的内存地址将不得不处理。硬编码的很容易,计算的则困难得多,比如跳转表等。堆栈如何用于参数传递和调用可能因处理器而异,并且作者可能会以不将指令转换为指令的方式进行堆栈清理。这些都是我在进行汇编器到汇编器转换时遇到的所有问题,假设它不是从祖父母处理器到孙子处理器,例如 8080 到 x86。我又踢又叫,但最终看到,至少在我看来,C 语言的翻译涵盖了很多这样的问题。
我愿意打赌,根据您所说的关于 z80 的 8080 变体,您可能必须编写自己的汇编解析器。当您开始考虑有多少指令、有多少变体时,无论是汇编程序还是静态翻译器,任务似乎都非常艰巨。但一旦你进入其中,通过说明进行磨练并没有那么糟糕。
我知道我的答案与问题没有直接关系,问题是我在哪里可以找到这个工具。我的答案与:如果你没有找到该工具。如果您找到了该工具,那么就完成了。如果您找到一个可以让您接近的工具,那么您可以从那里手动或以编程方式进行调整。因为我之前已经这样做过几次,所以我知道完整的翻译可能是一个有趣的项目,特别是如果您非常关心复古程序并迁移到现在。
You might want to consider a few alternatives. One would be a static binary translation into C, this is probably easier if you assemble the 8080 code into a binary. Not seeing your code you are likely to have issues as it is not a one to one thing. The resources in the 8080 or the board it was running on wont match the 8086 you plan to run your code under. If you translate to C then you can target anything now or in the present and not be limited to x86 in a simulation environment to cover the prior problem. This is not as scary or painful as it may seem...Quite fun actually.
Something I have been thinking about doing is instead of translating to C translate to llvm's bytecode.
EDIT:
The problem with assembler to assembler, beyond having to do it again some day, is not the functionality of the instructions (register A = register A + 1), but the flags and the conditional branches (register A = register A + 1, if A == 0 Z = 1 else Z = 0, ...). Based on your understanding of 8080 vs Z80 you know that you are going to have to find or create a tool that can parse that assembler. My theory is that you are more likely to find an assembler to binary than a conversion tool. From binary then you can emulate (at far greater than full speed) or do a static binary translation, ideally to C. With the C you can be sloppy you can have every instruction have code to update the flags and then the optimizer in the C compiler can remove the dead code. Something an assembler is not going to do, leaving you with tons of unused instructions by going straight to x86. I didnt read the manual or too much of the code so it may be easy to handle, but in addition to the individual instructions there is the matter of stack and memory and registers and user interface. If this were to use a graphics/video interface you would have to replace that code wholesale, if the stacks vary between the 8080 and x86 then you are going to have to handle that, and there is likely to be hardcoded memory addresses that you are going to have to deal with. The hardcoded ones are easy the computed ones are much harder, jump tables and the like. How the stack is used for parameter passing and calls may vary between processors and the author may do stack clean up in a way that doesnt translate instruction for instruction. These are all things I hit when I did an assembler to assembler translation, granted it wasnt from a grandparent processor to its grandchild, like the 8080 to x86. I went kicking and screaming but eventually saw that, at least in my opinion, the translation to C covering so many of these problems.
I am willing to bet, based on what you said about the 8080 variations from the z80, you may have to write your own assembly parser anyway. Here again the task seems impossibly huge, assembler or static translator when you start to think about how many instructions there are, how many variations. But once you get into it the grinding through instructions is not that bad.
I understand my answer is not directly tied to the question, the question is where can I find this tool. My answer has to do with: if you dont find the tool then. If you find the tool then good, done. If you find a tool that gets you close then you can hand or programattically adjust from there. Because I have done this before a few times I know that a full translation can be a fun project, particularly if the retro program is one that you care about enough to migrate to the present.
冷知识:8086 指令集经过专门设计,可以轻松地从 8080 进行转换。例如,SAHF/LAHF 指令就是源于此。
Trivia: The 8086 instruction set was designed specifically to make it easy to translate from 8080. That is where the instructions SAHF/LAHF originate, for example.
似乎有一个商业 8080 到 8086 转换器作为此处包的一部分提供。
There seems to be a commercial 8080 to 8086 translator available as part of a package here.
你能将 Z80 源代码汇编为二进制吗?如果是这样,则在二进制文件上运行反汇编程序回到“正常”Z80 汇编程序。
Can you assemble the Z80 source to binary? If so, then run a disassembler on the binary back to "normal" Z80 assembler.