How does it work and what is the syntax of the machine code? [closed]

1

I need to understand how machine code works, for example, statement statements and how it can become readable as Assembly, where I can see instruction as mov , "interpret". Additionally, why did they make these symbols? I do not know how to name anything.

For an idea, I've compiled a simple code into an Assembly compiler that opens a message box saying something.

Convert from hex to text by MS Windows Notepad:

    
asked by anonymous 12.03.2016 / 17:29

1 answer

6

Trying to respond superficially. This is a file in a certain format, just like there are database formats, texts, spreadsheets, images, etc. This is a format that the operating system recognizes and knows what to do with the content inside. It contains instructions on how to put relevant content into memory. There are instructions and static data of the application. One can understand this as a "text" that some component will know how to deal with. It is not pure text because it allows extra characters that are not present in texts, so it is called a binary.

The operating system will tell the processor to execute the instructions there (within its scheduling system) and the processor will then "interpret" those characters to decide what to do inside it.

Some architectures have fixed-length and other instructions of variable size. Each character or character set indicates which instruction should be executed and that "operands" will be used in this operation. The processor will process the bits of these operands (if any) or some register or something previously defined by the instruction. Then it goes to the next instruction - eventually one instruction can change which is next. On most operating systems this occurs until a previously defined signaling is returned to the operating system.

This can best be seen in How does a computer understand binary code? .

Well, it's a lot more complex than that, but I'm getting longer. The important thing is that each character indicates something that the processor knows what to do. In the background the characters are numbers according to the ASCII table - it is shown this way because it can facilitate the reading in something that is being interpreted like a common text (after all a text editor was used), it is possible to see of other forms, it gives even to see the bits of them, each one chooses how he wants to visualize.

A code written in high level language can be compiled to generate this, or a code in Assembly can be assembled. There is a 1: 1 direct relationship between the Assembly statements and these characters. Therefore the machine code can be easily converted to the approximate gross assembly that generated it (far from being readable) by a disassembler . . The Assembly is an "easier" code for a human to read - including because it has comments, machine code is easier for the computer.

A suitable utility for viewing binary code is objdump or dumpbin .

The links in the comments help to give a better idea of the subject.

    
12.03.2016 / 19:03