Does every processor use the same set of instructions?

4

I was researching on machine language, but all I found on the Internet is very little and only theoretical so I wanted to know if it's possible for me to create a simple machine language program. What should I study to create a very simple machine language program? Just to have that experience and see how everything works more closely.

    
asked by anonymous 24.01.2016 / 10:04

1 answer

9

You can answer the title question, the rest would be too long. And what you'll find out there is theoretical. Practice is to do. So do it. But how are you going to do it without knowing the theory? Unless you're referring to practice like the cake recipes that some post. That does not teach anyone. Maybe in this area you do not even find this kind of thing, because who wants to get involved in it knows that recipes are good for nothing.

Machine language itself nobody program for several decades. People program in Assembly which is an easier representation for humans, but that has a direct relationship with the processor instructions. This Assembly code is mounted to the machine code through an assembler which looks like a compiler , but much simpler.

Actually even the Assembly today is used in rare moments, usually to do bootstrap of operating systems and other environments, some very specific points in some drivers , creation of backends of compilers and some very specific optimizations. Today it is rare for human to produce better machine code than compilers do.

Each processor family (x86, ARM, MIPS, etc.) has a specific instruction set. Even processors of the same family vary. New generations have new instructions and eventually fail to have instructions that no longer make sense, though rare. Each processor also has its own way of writing Assembly code. Although the Assembly is an abstraction for humans, there is a culture of its own on each processor.

Not only should the Assembly be specific to each processor type, but there are also differences between assembly languages from different assembler providers (for the X86 processor it is common to use the basic syntax of Intel's or AT & T's / a> plus the editor's syntax ). The Assembly should be specific to what is called instruction set .

If you already know how to program in C, write a simple code that only does one thing and have it compiled into the Assembly. There you will see how the high level code turns into low level. Go do this with various things that you are curious, go experimenting. And then start making your own codes.

The Wikipedia is a good place to start understanding the subject . As you learn the basics, you can leave for other articles right there or on the pages. You will then have better conditions to do research and ask specific questions here.

If you really want to learn, look for books. Things on the internet help, but do not replace books. A good start and book indication . That other one is well indicated . The processor handbook will help.

I'm going through everything in English because obviously learning Assembly without knowing English does not match.

Ah, programming in Assembly is absurdly harder than finding information on the internet on the subject. So I advise you to re-evaluate whether you are prepared for this right now. But his attitude is commendable. Before they had more people wanting to learn the whole thing.

    
24.01.2016 / 10:52