在 Mac 上测试汇编代码
不久前,我正在遵循一些组装教程。我在 Windows 机器上运行它,使用 NASM 编译,然后将编译的代码写入软盘,然后重新启动并尝试代码。这个过程漫长且耗时,遗憾的是不在 Mac 上。当我发现 Xcode for mac 安装了 NASM 时,我立即尝试编译一些代码。代码编译得很好。问题是测试它。在 Mac 上,我没有软盘(不像我想使用软盘),所以我不确定如何测试它。我查看了 Q (kju) 并发现它只能模拟 ISO 文件上的内容。所以我想我想问的是是否可以将编译后的代码安装在 ISO 文件上进行测试? (注意:编译后的代码形成 .bin 文件)
感谢您的帮助
A while back I was following some tutorials an assembly. I was running it all on a windows machine, compiling with NASM and then writing the compiled code to a floppy disk, then reboot and try the code. This process was long and time consuming and sadly was not on a mac. When I found out that Xcode for mac installed NASM I immediately tried to compile some code. The code compiled fine. The issue is testing it. On a mac I have no floppy (not like I want to use one) so Im not sure how to test this. I looked in to Q (kju) and found it would only emulate things on an ISO file. So I guess what Im asking is is it possible to install the compiled code on an ISO file for testing? (Note: the code when compiled forms a .bin file)
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你到底想测试什么(也许是引导加载程序?),但你不需要重新启动或从磁盘引导只是为了运行汇编代码(除非它是引导加载程序或其他东西)。
无论哪种方式,如果您需要“重新启动”来测试,我建议运行模拟器。 Sun VirtualBox 非常易于使用且免费,并模拟标准 x86 架构(包括软盘驱动器) !所以这可能在短期内对你有用。如果您将来想创建 ISO 映像,可以使用命令行实用程序
hdiutil
来完成。在终端窗口中,输入man hdiutil
或访问在线 手册页 了解有关使用它创建各种磁盘映像的更多信息。I don't know exactly what you are trying to test (a boot loader maybe?) but you don't need to reboot or boot from a disk just to run assembled code (unless it is a boot loader or something).
Either way, if you need to "reboot" to test, I suggest running an emulator. Sun VirtualBox is super easy to use and free and emulates a standard x86 architecture (including floppy drives)! So that may work for you in the short term. If you ever want to create an ISO image in the future, you can do that with the command line utility
hdiutil
. In a terminal window, typeman hdiutil
or visit the online man page for more information on using that to create all kinds of disk images.