سؤال

I'm interested in learning Assembly, specifically because I find polymorphic code rather interesting and I'm kind of confused as to which I should learn.

I heard x86 is the most common to learn or start with, but aren't most applications (written in Visual Studio) in a different assembly language? Or in Common Intermediate Language or something? Or does CIL or IL or whatever get compiled into x86 at runtime?

هل كانت مفيدة؟

المحلول

It depends on what you want to learn. CIL is the assembly language for a theoretical machine (or virtual machine) called the CLR, which is implemented in software. The CIL code is then compiled by a just-in-time compiler into x86 assembly or 64bit intel assembly.

If you are primarily programming in Visual Studio i would recommend learning CIL first, for these reasons:

1) CIL is much simpler. x86 assembly has evolved since the 1970s and it really shows. The number of instructions is huge and you will have to learn irrelevant technical details just to get started.

2) It will be easier to write well-structured programs. If you later decide to learn x86 assembly, hopefully you will take those habits with you.

3) CIL will be more useful if you ever want to performance tune your .NET-programs on a low level, since this is what they are compiled to. This is the last place you should be optimizing though.

Reasons for learning x86/x64:

1) It is an assembly language for real hardware. This means that what you learn will be "the real thing". You will also learn a lot about how the actual hardware works. This doesn't mean that it might not be easier to learn a simpler language first though.

2) The platform has registers, which is a feature you won't learn about with CIL.

3) The platform doesn't have object oriented features built in, which means that you will have to learn how to implement these yourself. This is something that you can also learn about through C++.

All in all, I would recommend learning a simple language like CIL, JVM assembly or LC-3 assembly, as suggested by Daniel Wolfe. If you also want to learn x86 assembly you can do always do that afterwards. Learning both in the correct order is probably easier than just learning x86 assembly on its own.

نصائح أخرى

If you're truly interested in learning assembly language, a book that I would recommend is Introduction to Computer Systems. The authors teach an assembly language for a computer system that they invented on their own known as the LC-3. There's no value to learning this platform in itself, but it's a vastly simplified machine language. After you understand a simpler machine language, you can then move onto learning more complicated languages like x86.

IL is not assembler, is Intermediate Language and yes, gets compiled by the .NET runtime into assembler. Assembler (or machine code) is the only language the CPU speaks.

.NET assemblies are not written or generated in assembler, those are very different things.

I think x86 Assembler should be ok to start, if you really want to give yourself all this pain or do such effort ;-)

What computer chip architecture do you usually work or like to work most ? What platform or O.S. do you usually work ?

These matter when programing in assembly.

PC & Windows ? Mac ? Unix ? Linux or BSD running on PC (x86), Linux or BSD running in Solaris Sparc ?

There are several ways to learn an assembly language.

Usually, there is only a single assembly language for a single chip architecture, not like several high level programing languages.

Another as already mentioned, is to use a "virtual machine" like the ones already mention by previous answers: J.M.V., dotNet CIL or MSIL (its the same), P-Code, etc.

And in that scenario doesn't matter which platform are you using.

PC has ASM, but, you can also use a derivate called NASM:

http://www.nasm.us/

http://en.wikipedia.org/wiki/Netwide_Assembler

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top