开发者

Overwhelmed while learning assembly. Orientation please

开发者 https://www.devze.com 2022-12-18 10:42 出处:网络
Recently I decided that learning assembly would be a good idea, but right now, I\'m really overwhelmed by all the material I have read about assembly in forums, here, tutos etc (Some of it is really o

Recently I decided that learning assembly would be a good idea, but right now, I'm really overwhelmed by all the material I have read about assembly in forums, here, tutos etc (Some of it is really old) so I would love to have some orientation about the assembly language, how to "compile" etc, I would also like it to be able to run on my CPU, so that i can practice, here are my CPU details from CPU-Z

AMD Athlon 64 3200+

Supported Instructions: MMX(+), 3DNow!(+), SSE(1, 2, 3), x86-64

Note: If possible I want this to be Windows oriented (Does this really 开发者_运维技巧matters?)

Thanks in advance.


I think that one of the best ways to start learning assembly language is to look at the output created by a compiler for a language you're familiar with. For example, if you are familiar with Visual C++, then write some very simple code in C++ and use the integrated debugger to show the assembly language created by the compiler (make sure you're compiling with optimisations off). Write some simple for loops, assignment, arithmetic, etc and see what the created assembly language looks like.

For learning, you don't need to know anything about the instruction set extensions that you've listed in your question. All you need to be concerned about is x86 32-bit instructions. You can learn about 64-bit instructions, MMX, SSE, etc later once you've got the foundations in place.

Once you've got some basic understanding in place, you'll need an assembler. A good, well-supported open source general purpose assembler is nasm.


My advice would be to pick a really old 8-bit processor like the 8080, and use a simulator, just to get the basic concepts straight in your head. Frankly, once you know one assembly language, learning another is pretty easy (I know about eight or so), but the first step is the hardest.


I would question whether it's a good idea to jump right into learning x86-64.

Typically, it would be a good idea to start with a "simpler" RISC language (you can get emulaters for a lot of RISC processors) to give you a grounding in assembly basics, and then learn more complex architectures afterwards if you're still keen.


You say Windows oriented, but the most simple way to get started is actually to do some oldskool DOS/Command programming in assembly. Give yourself simple assignments like 'Write a program that prints the numbers 1 to 10 to the console' or 'Write a program to read a line off text and reverse it'.


You might try reading the Crenshaw tutorial on compilers. I know it seems a little strange, but he is building a minimal little compiler that targets m68k assembly, so you get to see how the programming concepts you are already used to are expressed in a very clear, relatively easy assembly language.

Disadvantage: m68k assembly is not very much like x86 assembly, so you'll have another round of learning to do after your done.


If you want to learn assembler you have to learn how a computer works. And Im not talking about 'this lib in my os is responsible for this and that..' I mean hardware. How a CPU is built, what the ALU is, how memory works, how a program is executeted. That is the first step then you can star learning assembler that is what assembler is all about - controlling all those devices. And if you dont know how it works you cant control it.

I suggest browse for a book about computer technologies/architecture it will save you 100+ hours of google and reading stuff you dont understand.

And the easiest arch to start with i MIPS.


You could try looking at some of the documents produced by the Rom Hacking community, aimed at simpler systems. Some of the community's assembly tutorials might be a little easier to swallow, as the intended audience is a bit different. While it's certainly not the bleeding edge of technology, it might hold your interest a little more while learning how older hardware works if you learn about something familiar. Furthermore, some emulators have graphical debugging tools which, depending on your tastes, might be easier to get started with than command-line machine level debuggers. On the other hand, it is also important to consider that emulation and game modification are of dubious legality.


I'm learning assembler for 4 months on Randall Hyde's book, the art of assembly language.. It's the best assembler manual I've found around. You can download it from here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号