模拟器是如何工作的?当我看到NES/SNES或C64模拟器时,我很震惊。
您是否必须通过解释特定的组装指令来模拟这些机器的处理器?还有什么?它们通常是如何设计的?
你能给那些对编写模拟器(特别是游戏系统)感兴趣的人一些建议吗?
模拟器是如何工作的?当我看到NES/SNES或C64模拟器时,我很震惊。
您是否必须通过解释特定的组装指令来模拟这些机器的处理器?还有什么?它们通常是如何设计的?
你能给那些对编写模拟器(特别是游戏系统)感兴趣的人一些建议吗?
当前回答
我知道这个问题有点老了,但我想在讨论中补充一些东西。这里的大多数答案都围绕模拟器解释它们所模拟的系统的机器指令。
然而,有一个非常著名的例外,称为“UltraHLE”(维基百科文章)。UltraHLE是有史以来最著名的模拟器之一,它模拟了商用任天堂64游戏(在家用电脑上表现不错),当时人们普遍认为这是不可能的。事实上,当UltraHLE诞生时,任天堂还在为任天堂64制作新游戏!
这是我第一次在印刷杂志上看到关于模拟器的文章,而以前我只在网上看到过它们的讨论。
UltraHLE的概念是通过模拟C库调用而不是机器级调用来实现不可能。
其他回答
还可以查看Darek Mihocka的Emulators.com,获得关于jit指令级优化的建议,以及许多关于构建高效模拟器的其他好东西。
一个叫维克多·莫亚·德尔·巴里奥的人写了一篇关于这个主题的论文。152页里有很多有用的信息。你可以在这里下载PDF文件。
如果您不想注册scribd,您可以谷歌获取PDF标题,“模拟编程技术的研究”。PDF文档有几个不同的来源。
在创建了我自己的80年代BBC微型计算机模拟器(类型VBeeb到谷歌)后,有许多事情要知道。
You're not emulating the real thing as such, that would be a replica. Instead, you're emulating State. A good example is a calculator, the real thing has buttons, screen, case etc. But to emulate a calculator you only need to emulate whether buttons are up or down, which segments of LCD are on, etc. Basically, a set of numbers representing all the possible combinations of things that can change in a calculator. You only need the interface of the emulator to appear and behave like the real thing. The more convincing this is the closer the emulation is. What goes on behind the scenes can be anything you like. But, for ease of writing an emulator, there is a mental mapping that happens between the real system, i.e. chips, displays, keyboards, circuit boards, and the abstract computer code. To emulate a computer system, it's easiest to break it up into smaller chunks and emulate those chunks individually. Then string the whole lot together for the finished product. Much like a set of black boxes with inputs and outputs, which lends itself beautifully to object oriented programming. You can further subdivide these chunks to make life easier.
Practically speaking, you're generally looking to write for speed and fidelity of emulation. This is because software on the target system will (may) run more slowly than the original hardware on the source system. That may constrain the choice of programming language, compilers, target system etc. Further to that you have to circumscribe what you're prepared to emulate, for example its not necessary to emulate the voltage state of transistors in a microprocessor, but its probably necessary to emulate the state of the register set of the microprocessor. Generally speaking the smaller the level of detail of emulation, the more fidelity you'll get to the original system. Finally, information for older systems may be incomplete or non-existent. So getting hold of original equipment is essential, or at least prising apart another good emulator that someone else has written!
共享源设备模拟器包含PocketPC/智能手机模拟器的可构建源代码(需要Visual Studio,在Windows上运行)。我参与了二进制版本的V1和V2。
它解决了许多仿真问题: -从虚拟客户端到物理客户端再到虚拟主机的高效地址转换 - JIT编译客户代码 -模拟周边设备,如网络适配器、触摸屏和音频 - UI集成,主机键盘和鼠标 -保存/恢复状态,用于模拟从低功耗模式恢复
我知道这个问题有点老了,但我想在讨论中补充一些东西。这里的大多数答案都围绕模拟器解释它们所模拟的系统的机器指令。
然而,有一个非常著名的例外,称为“UltraHLE”(维基百科文章)。UltraHLE是有史以来最著名的模拟器之一,它模拟了商用任天堂64游戏(在家用电脑上表现不错),当时人们普遍认为这是不可能的。事实上,当UltraHLE诞生时,任天堂还在为任天堂64制作新游戏!
这是我第一次在印刷杂志上看到关于模拟器的文章,而以前我只在网上看到过它们的讨论。
UltraHLE的概念是通过模拟C库调用而不是机器级调用来实现不可能。