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

closed . This question needs to be more objective and is not currently accepting answers.

want to improve this question? update the question to focus on just one problem when edit it .

Closed 4 years ago .

improve this question

I need to understand how machine code works, e.g. Statement Statements, and how it can become readable like Assembly, where I will be able to see statement like mov, "interpret". Additionally, why did they make these symbols? I can't name anything.

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

Converted from hexadecimal to text by MS Windows Notepad:

Executable

Author: Maniero, 2016-03-12

1 answers

Trying to answer superficially, this is a file in a certain format, just as 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. There contains instructions on how to put the relevant content in memory. It also has the instructions and static data of the application. One can understand this as a" Texton " that some component will know how to deal with. It is not a pure text because it allows extra characters that are not present in texts, so it is called binary.

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

Some architectures have fixed-size statements and others have variable-size statements. Each character or set of characters indicates which statement should be executed and that "operands" will be used in this operation. The processor will process the bits of these operands (if it has any) or of some register or something else previously defined by the instruction. Then it goes to the next instruction-eventually an instruction can change which one is next (bypass). On most operating systems this occurs until a previously defined flag returns control to the operating system.

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

Is much more complex than that, but I'm already stretching. The important thing is that each character of these indicates something that the processor knows what to do. In the background the characters are numbers according to the extended ASCII table - it is shown this way because it can facilitate reading in something that is being interpreted as a common text (after all a text editor was used), it is possible to see in other ways, you can even see their bits, each one chooses how he wants to visualize.

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

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

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

 6
Author: Maniero, 2020-10-16 17:08:02