如何理解汇编语言的跳转指令
如果你会C语言,而且比较熟悉,那么牛就可以理解汇编的几个跳转指令的用法了。
本人也在学习中,请各位多多指教。
3: void main()
4: {
00401010 55 push ebp
00401011 8B EC mov ebp,esp
00401013 83 EC 4C sub esp,4Ch
00401016 53 push ebx
00401017 56 push esi
00401018 57 push edi
00401019 8D 7D B4 lea edi,[ebp-4Ch]
0040101C B9 13 00 00 00 mov ecx,13h
00401021 B8 CC CC CC CC mov eax,0CCCCCCCCh
00401026 F3 AB rep stos dword ptr [edi]
5: int i, j;
6: int k;
7:
8: i = 10;
00401028 C7 45 FC 0A 00 00 00 mov dword ptr [ebp-4],0Ah
9: j = 11;
0040102F C7 45 F8 0B 00 00 00 mov dword ptr [ebp-8],0Bh
10: k = 0;
00401036 C7 45 F4 00 00 00 00 mov dword ptr [ebp-0Ch],0
11: if (i < j)
0040103D 8B 45 FC mov eax,dword ptr [ebp-4]
00401040 3B 45 F8 cmp eax,dword ptr [ebp-8]
00401043 7D 09 jge main+3Eh (0040104e)
12: k ++;
00401045 8B 4D F4 mov ecx,dword ptr [ebp-0Ch]
00401048 83 C1 01 add ecx,1
0040104B 89 4D F4 mov dword ptr [ebp-0Ch],ecx
13: if (i > j)
0040104E 8B 55 FC mov edx,dword ptr [ebp-4]
00401051 3B 55 F8 cmp edx,dword ptr [ebp-8]
00401054 7E 09 jle main+4Fh (0040105f)
14: k ++;
00401056 8B 45 F4 mov eax,dword ptr [ebp-0Ch]
00401059 83 C0 01 add eax,1
0040105C 89 45 F4 mov dword ptr [ebp-0Ch],eax
15: if (i >= j)
0040105F 8B 4D FC mov ecx,dword ptr [ebp-4]
00401062 3B 4D F8 cmp ecx,dword ptr [ebp-8]
00401065 7C 09 jl main+60h (00401070)
16: k ++;
00401067 8B 55 F4 mov edx,dword ptr [ebp-0Ch]
0040106A 83 C2 01 add edx,1
0040106D 89 55 F4 mov dword ptr [ebp-0Ch],edx
17: if (i <= j)
00401070 8B 45 FC mov eax,dword ptr [ebp-4]
00401073 3B 45 F8 cmp eax,dword ptr [ebp-8]
00401076 7F 09 jg main+71h (00401081)
18: k ++;
00401078 8B 4D F4 mov ecx,dword ptr [ebp-0Ch]
0040107B 83 C1 01 add ecx,1
0040107E 89 4D F4 mov dword ptr [ebp-0Ch],ecx
19: if (i == j)
00401081 8B 55 FC mov edx,dword ptr [ebp-4]
00401084 3B 55 F8 cmp edx,dword ptr [ebp-8]
00401087 75 09 jne main+82h (00401092)
20: k ++;
00401089 8B 45 F4 mov eax,dword ptr [ebp-0Ch]
0040108C 83 C0 01 add eax,1
0040108F 89 45 F4 mov dword ptr [ebp-0Ch],eax
21: }
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!