在其他高级编程语言之前学习汇编语言是否是更好的选择? [英] Is it a better choice to learn assembly language before other high level programing languages?

查看:133
本文介绍了在其他高级编程语言之前学习汇编语言是否是更好的选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,如果我发疯了......我对c ++编程语言有一定的了解。但是我一直想知道我是否可以学习汇编语言,以便我可以通过编程来创建类似于我喜欢的电脑,创建类似DOS的程序等等...但在我的研究中我发现汇编语言不同于系统系统。如果是这样我怎么能学习汇编语言。并告诉我,如果我在编程方面走在正确的道路上。 Plz help

Sorry if I sounds mad...I have a some knowledge in c++ programing language. But I have been wondering if I can learn assembly language so that I can play with my pc as I like by programing it, creating DOS like programs and so on...but in my research I came to know assembly language differs from system to system . If it is so how can i learn assembly language . And plz tell me if I am on the right path in programing . Plz help

推荐答案

学习汇编语言(是的,不同的架构有不同的汇编语言)本身就是一个有趣的体验,你可以深入了解低层细节。你处理的系统。

我将从一个简单的汇编语言开始(例如, x86 架构之一并不简单):
Learning an assembly language (yes, different architectures have different assembly languages) is an interesting experience by itself and you would gain insight about the low level details of the system your dealing with.
I would start with a simple assembly language (for instance, the one of the x86 architecture is NOT simple):


汇编语言在不同系统之间没有区别,它在处理器与处理器之间有所不同 - 但是如果你坚持使用PC,大多数情况下你可以忽略变化:如果你尝试的话它只会是重要的将汇编程序用于不同类型的设备,如MAC,平板电脑,手机(或冰箱,或打印机,或闹钟,或电视,或......)



如果你在C ++中有一些知识那么说实话我会坚持使用它直到你在C ++中有相当多的知识 - 汇编程序很多,更接近硬件并要求一种完全不同的思维方式。编写代码的速度也慢得多:

Assembly language doesn't differ from system to system, it differs from processor to processor - but mostly you can ignore changes if you stick to PC's: it's only going to be significant if you try to use assembler for a different type of device, like a MAC, or a tablet, or a phone (or a fridge, or printer, or alarm clock, or TV, or...)

If you have "some knowledge" in C++ then to be honest I'd say stick with it until you have "quite a bit" of knowledge in C++ - Assembler is a lot, lot closer to the hardware and requires a totally different way of thinking. It's also a lot slower to write code in:
myArray[i] = myArray[j];

可以是一个令人惊讶的行数汇编程序中的代码! :笑:



如果你想学习,那么ASM不是一个好的起点,恕我直言:它是一种CISC(复杂指令集计算机)语言,这有点像开始在伦敦市中心的法拉利进行第一次驾驶课程。但是......如果这就是你所拥有的那么我会带两本书:

开始阅读汇编语言指南:Streib的简明介绍 [ ^ ]然后获取 Irvine的x86处理器汇编语言 [ ^ ]



(虽然看过你想要的欧文书的价格寻找一个网络教程:OMG:)

Can be a surprising number of lines of code in assembler! :laugh:

If you do want to learn, then ASM isn't a good starting place, IMHO: it's a CISC (complex instruction set computer) language, and it's a bit like starting off with a Ferrari in central London for your first driving lesson. But...if it's all you have then I'd go with two books:
Start be reading Guide to Assembly Language: A Concise Introduction by Streib[^] and then get a copy of Assembly Language for x86 Processors by Irvine[^]

(Though having looked at the price of the Irvine book you might want to look for a web tutorial :OMG: )


我从未见过以汇编语言开头的人,但这可能不是一个坏主意。但最好的方法是使用Assembly学习一些高级编程语言并行。你标记了C ++,并且由于某种原因,经常会忘记一个选项:在C ++中使用内联汇编语言( asm )。它可以帮助您摆脱真正的汇编程序的烦恼,并获得CPU指令集的权利。汇编语言最有用的是直接使用CPU级别编程的经验,而不是汇编语言的一种或另一种形式。



同时,现代系统不允许你用CPU指令集做你最有趣的事情:在内核模式下工作( http://en.wikipedia.org/wiki/Kernel_%28computing%29 [ ^ ], http://en.wikipedia.org/wiki/Protection_ring [ ^ ])。如果您开发内核模式驱动程序,或者从头开始编程,而不是使用高级操作系统来保护您无法进入响铃0,则可以执行此操作。这一切都取决于您想要的深度。



让我告诉你一件事:现在有很多程序员从来没有能够在CPU指令集的水平上工作。让我告诉你一个秘密:我们,或许我们许多人,不要认真对待他们;我们像对待几乎没有学会如何增加数字的孩子一样对待他们。那些开发人员不是创建技术的人(甚至是不需要汇编语言的技术),他们只是用户,与非开发人员没有太大区别。问题不在于汇编,问题是对许多事情的一般理解。



同时,不要认为学习汇编语言会打开你所有的门。恰恰相反:这是一个非常小的一块。



-SA
I never saw people starting with assembly language, but it might be not a bad idea. But probably the best would be learning some high-level programming language in parallel with Assembly. You tagged C++, and, by some reason, one option is often forgotten: using inline assembly language (asm in C++). It can help you to get rid of the annoyances of "real" assembler and get right to the CPU instruction set. The most useful thing about Assembly language is the experience of working with CPU level of programming directly, not one or another form of the Assembly language.

At the same time, modern systems won't allow you to do the most interesting thing you could do with CPU instruction set: working in the kernel mode (http://en.wikipedia.org/wiki/Kernel_%28computing%29[^], http://en.wikipedia.org/wiki/Protection_ring[^]). You can do it if you develop kernel-mode driver, or program something from scratch, not using high-level OS which protects you from getting to ring 0. It all depends on how deep you want to go.

Let me tell you one thing: there are many "programmers" these days who never were able to work at the level of the CPU instruction set. And let me tell you one secret: we, or maybe many of us, don't take them all seriously; we treat them like children who barely learned how to multiply numbers. Those developers are not those who create technologies (even the technologies not requiring Assembly language), they remain just the users, not much different from non-developers. The problem is not writing in Assembly, the problem is general understanding of many things.

At the same time, don't think that learning Assembly language along will open you all doors. Just the opposite: this is a very small piece.

—SA


这篇关于在其他高级编程语言之前学习汇编语言是否是更好的选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆