如何在独立于操作系统的环境中开始使用汇编进行输入/输出编程?
学习汇编语言后,我正在尝试提出挑战。其中之一是用它来学习输入/输出编程。不好的是,我找不到教如何解决此类问题的资源,而且我在 Google 中找到的大多数文章都有类似“这些指令使用起来相当复杂,因此我们通常使用操作系统来执行相反,我们使用 I/O”,但现在我在操作系统之外工作,使用我自己编写的一个非常简单的 512 引导加载程序(即不运行任何操作系统)。
您能推荐一些可以教授此类内容的资源吗?
After learning assembly language I am trying to put challenges. One of them is to learn Input/Ouput programming with it. The bad part is that I can't find a source that teaches how to approach such problem and most of the articles I found in Google have something similar to "These instructions are quite complicated to use, so we usually use the operating system to do I/O for us instead" but now I am working outside the operating system using a very simple 512 boot loader i wrote myself (i.e. Running no os).
Would you please suggest some sources that can teach such stuff ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想看看 Randall Hyde 的高级装配
http://homepage.mac.com/randyhyde/webster .cs.ucr.edu/HighLevelAsm/index.html
You might want to look, High level assembly by Randall Hyde
http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/HighLevelAsm/index.html
如果您位于“操作系统之外”,则意味着没有操作系统,或者它是一个松散的操作系统(可能称为“执行程序”),允许程序直接访问 i/o 设备。后者尤其麻烦:如果两个程序同时从同一串行线读取会发生什么?
我建议从编写设备驱动程序开始,以获得良好且相当温和的介绍。现在几乎所有设备驱动程序都是用 C 或 C++ 编写的,研究它们如何与设备中断和控制寄存器交互是理解如何在汇编中进行编程的第一个障碍。请参阅此。
如果您有一个小型专用设备,例如嵌入式控制器,其中操作系统不是必然的结果,您可以选择查看供应商示例,或阅读硬件工程师编写的文档——这是一个重大挑战,至少有几个原因这与软件工程师的思维方式截然不同。不管怎样,仅仅理解许多概念的上下文就需要相当长的学习曲线,更不用说编写第一行有用的代码了。
It you are "outside the operating system" that means there is no operating system, or it is a loose one (probably called an "executive") which allows programs to directly access i/o devices. The latter is especially troublesome: what happens if two programs both read from the same serial line at the same time?
I suggest starting with writing device drivers for a good and reasonably gentle introduction. Virtually all device drivers are written in C or C++ now, and studying how they interact with device interrupts and control registers is the first hurdle you'll have in understanding how to program that in assembly. See this.
If you have a small dedicated device, like an embedded controller where an operating system isn't a foregone conclusion, you have a choice of looking at vendor examples, or reading documentation written by hardware engineers—a major challenge for several reasons, the least of which is a significantly different mindset than software engineers. Either way, there is quite a learning curve just to understand the context of many concepts, let alone writing the first useful line of code.