A brief analysis of <<ASM>> x86 assembly instruction

Source: Internet
Author: User

Learn the system/software underlying mechanism of friends, compilation is one of the required courses. Because of the inherent characteristics of the low-level language, it makes it difficult to master the early learning. This article will focus on some of the most common and key assembly instructions, so that those who are still struggling to climb the "beginner".

At present, the mainstream of the market in the compilation of textbooks, Wang Shuang of the "Assembly Language (second edition)" is more favored by readers. The author self-taught compilation of the selected compilation textbook is Yang Jiwen's "80x86 Assembly language Programming Program" and "Assembly language program design-from DOS to Windows" Zhang Shelan/Tan Yan, according to the thickness of the book to know its ease of degree. If the reader first contact the compilation, you can consider the above three classic textbooks, there is a certain basis can consider Luo Yunbin Win32 compilation ...

Learn to compile, mainly depends on your use. Please keep this in mind for beginners! Assembly language difficulty is recognized in the industry, you do not have to read the whole book thoroughly understand to contact reverse, crack and so on. My suggestion is "selective learning": need to compile programming development friends, naturally according to the book arranged in the order of the directory sequence of learning, but do not too much (a book is enough!) The rest depends on www.baidu.com. The goal is to software debugging, decryption, malicious code Analysis of Friends, recommended only to see "the first three chapters" (then choose to read according to the needs), in general should be three parts of the content:

"Basic Introduction to microprocessors / data type of the assembly ( including carry-system conversions and Operations ) "

the Addressing Method / instruction Set / Register "

"basic elements of Assembly programming ( similar to Expressions in C, statements, Control Structures section ) "         

Apply it ! Don't simply learn to assemble for the sake of assembly, be sure what the goal is! In the course of learning, the emphasis is on the computer debugging ( not merely pictures and text )tounderstand deeply.

According to their own learning ability, reasonable arrangement of study time. The difficulty is good at network search, to be able to achieve "will not be a poem will also yin" degree.

**********************************************************************************

I briefly summarize the instruction set section:

Figure 1:

It can be clearly told that more than 100 instructions do not need all the memory (and definitely not the same as memorizing words!), I have selected a small part, it is important to grasp:

mov/lea/xchg ; transfer/Transfer ea/Exchange

push/pop : In/out stack

CALL/RETN ; procedure Call/return

add/sub/inc/dec ; add minus operation/Add 1/minus 1

Jmp/je       ... ; Unconditional transfer/conditional transfer

CMP ; compare

INT ; interrupt

xor , xor (same as 0, different 1 for register clear 0)

(also note that Ax is a 16-bit register, the corresponding 32-bit version is eax ...)

Next, bring you close contact with the assembly instructions.

VC6.0 Figure 2:

VC6.0 Debug: Figure 3

OLLYDBG: Figure 4

The disassembly code for the main function is shown

The information given by ollydbg is more detailed than VC.

I believe everyone can read the C code without effort, but after disassembly? Do reverse, often do not touch the source code, the face is a "black box", which requires the disassembly of the sharp weapon (IDA, W32DASM, etc.) for static analysis.

I have added a comment (to the right) for each instruction, so you can analyze it with C code. The function of the analysis program is different, then the corresponding instruction will be different;

Disassembly structure for main 5:

End.

2015/12/9.wednesday

YPP.

A brief analysis of <<ASM>> x86 assembly instruction

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.