Common Assembly instruction Review

Source: Internet
Author: User

If you are engaged in underlying windows development, you must understand the assembly language. In fact, the underlying layer of Windows is a machine code compiled using C language code, and then compiled into assembly language code by the debugger. We certainly cannot understand machine code. At this time, assembly language becomes a good medium.

Common stack-related commands

Push: Push a 32-bit operand into the stack. This operation causes ESP to be reduced by 4 (we think the top of the stack is a region with a small address), and the operand becomes the top of the stack.

Pop: In contrast to the push command, this command is the top operand of the stack, resulting in ESP plus 4.

Sub: subtraction command. The first parameter is the register where the subtrahend are located, and the second parameter is the memory where the subtrahend are located.

Add: Addition command. The principle is the same as above.

RET: return command, which is equivalent to jump back to the place where the function is called.

Call: Call a function.

 

Data transmission instructions

MoV: data movement. This is the simplest data transmission command. The first parameter book moves the data destination, and the second parameter is the data source.

XOR: exclusive or. This is a logic operator. However, commands such as XOR eax and eax are often used to replace mov eax and 0. The advantage is that they are faster and consume fewer bytes.

Lea: Get the address (the next operand) and put it in the previous memory.

STOs: String storage commands. To explain this command, you need to use a piece of code:

MoV ECx, 30 h

MoV eax, 0 ccccccch

Rep STOs dword pt Res: [EDI]

The function of the last sentence is to repeat the number of times entered in ECx and put the data in eax to the place specified by EDI.

 

Redirection and comparison commands

JMP: unconditional jump

JG: Jump when the value is greater than. Usually there is a comparison statement

JL: Jump when the value is smaller than. Usually there is a comparison statement

Jge: Jump when the value is greater than or equal to. Usually there is a comparison statement

CMP: comparison.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.