- 注册时间
- 2022-8-23
- 最后登录
- 2024-3-6
- 在线时间
- 2 小时
编程入门
- 天马币
- 26
|
晚上无聊,易语言 和 Visual C++ 6.0 (以下内容简称C++) 编写了 相同的代码
但是编译后 用OD 查看其汇编代码 表示很无奈
C++ 的汇编代码结构清晰 代码量少
而易语言代码浑浊 上跳下跳 占用不少字节(相对C++)
下面 我贴上 两个程序的汇编代码
C++:
00401005 /$ /E9 06000000 jmp Hello.WinMain
0040100A | |CC int3
0040100B | |CC int3
0040100C | |CC int3
0040100D | |CC int3
0040100E | |CC int3
0040100F | |CC int3
00401010 >|> \55 push ebp
00401011 |. 8BEC mov ebp,esp
00401013 |. 83EC 40 sub esp,0x40
00401016 |. 53 push ebx
00401017 |. 56 push esi
00401018 |. 57 push edi
00401019 |. 8D7D C0 lea edi,[local.16]
0040101C |. B9 10000000 mov ecx,0x10
00401021 |. B8 CCCCCCCC mov eax,0xCCCCCCCC
00401026 |. F3:AB rep stos dword ptr es:[edi]
00401028 |. 8BF4 mov esi,esp
0040102A |. 6A 00 push 0x0 ; /Style = MB_OK|MB_APPLMODAL
0040102C |. 68 2C204200 push Hello.0042202C ; |Title = "C++"
00401031 |. 68 1C204200 push Hello.0042201C ; |Text = "Hello Word"
00401036 |. 6A 00 push 0x0 ; |hOwner = NULL
00401038 |. FF15 ACA24200 call dword ptr ds:[<&USER32.MessageBoxA>>; \MessageBoxA
0040103E |. 3BF4 cmp esi,esp
00401040 |. E8 3B000000 call Hello._chkesp
00401045 |. 33C0 xor eax,eax
00401047 |. 5F pop edi
00401048 |. 5E pop esi
00401049 |. 5B pop ebx
0040104A |. 83C4 40 add esp,0x40
0040104D |. 3BEC cmp ebp,esp
0040104F |. E8 2C000000 call Hello._chkesp
00401054 |. 8BE5 mov esp,ebp
00401056 |. 5D pop ebp
00401057 \. C2 1000 retn 0x10
占用字节 82 byte
E
00401150 . 83EC 64 sub esp,0x64
00401153 . 56 push esi
00401154 . 8B7424 74 mov esi,dword ptr ss:[esp+0x74]
00401158 . 57 push edi
00401159 . 8B7E 08 mov edi,dword ptr ds:[esi+0x8]
0040115C . 57 push edi
0040115D . E8 AE830000 call E_langua.00409510
00401162 . 83C4 04 add esp,0x4
00401165 . 85C0 test eax,eax
00401167 . 74 10 je short E_langua.00401179
00401169 . 8D4424 08 lea eax,dword ptr ss:[esp+0x8]
0040116D . 50 push eax
0040116E . 56 push esi
0040116F . E8 2CFFFFFF call E_langua.004010A0
00401174 . 83C4 08 add esp,0x8
00401177 . EB 42 jmp short E_langua.004011BB
00401179 > 81FF 04000080 cmp edi,0x80000004 ; 分支 (案例 80000002..80000004)
0040117F . 75 04 jnz short E_langua.00401185
00401181 . 8B0E mov ecx,dword ptr ds:[esi] ; 案例 80000004 (SINGLE STEP) --> 分支 00401179
00401183 . EB 3A jmp short E_langua.004011BF
00401185 > 81FF 02000080 cmp edi,0x80000002
0040118B . 75 12 jnz short E_langua.0040119F
0040118D . 8B16 mov edx,dword ptr ds:[esi] ; 案例 80000002 (DATATYPE MISALIGNMENT) --> 分支 00401179
0040118F . 8D4C24 08 lea ecx,dword ptr ss:[esp+0x8]
00401193 . 51 push ecx
00401194 . 52 push edx
00401195 . E8 C6470100 call E_langua.00415960
0040119A . 83C4 08 add esp,0x8
0040119D . EB 1C jmp short E_langua.004011BB
0040119F > 81FF 03000080 cmp edi,0x80000003
004011A5 . 75 1C jnz short E_langua.004011C3
004011A7 . 8B4E 04 mov ecx,dword ptr ds:[esi+0x4] ; 案例 80000003 (BREAKPOINT) --> 分支 00401179
004011AA . 8B16 mov edx,dword ptr ds:[esi]
004011AC . 8D4424 08 lea eax,dword ptr ss:[esp+0x8]
004011B0 . 50 push eax
004011B1 . 51 push ecx
004011B2 . 52 push edx
004011B3 . E8 D8400100 call E_langua.00415290
004011B8 . 83C4 0C add esp,0xC
004011BB > 8D4C24 08 lea ecx,dword ptr ss:[esp+0x8]
004011BF > 85C9 test ecx,ecx
004011C1 . 75 09 jnz short E_langua.004011CC
004011C3 > C64424 08 00 mov byte ptr ss:[esp+0x8],0x0 ; 分支 00401179 默认案例
004011C8 . 8D4C24 08 lea ecx,dword ptr ss:[esp+0x8]
004011CC > 8B46 20 mov eax,dword ptr ds:[esi+0x20]
004011CF . BA 9C414700 mov edx,E_langua.0047419C
004011D4 . 85C0 test eax,eax
004011D6 . 74 03 je short E_langua.004011DB
004011D8 . 8B56 18 mov edx,dword ptr ds:[esi+0x18]
004011DB > 8B46 0C mov eax,dword ptr ds:[esi+0xC]
004011DE . 8BF0 mov esi,eax
004011E0 . F7D6 not esi
004011E2 . 81E6 00100000 and esi,0x1000
004011E8 . 8D0470 lea eax,dword ptr ds:[eax+esi*2]
004011EB . 50 push eax ; /Style
004011EC . 52 push edx ; |Title
004011ED . 51 push ecx ; |Text
004011EE . 6A 00 push 0x0 ; |hOwner = NULL
004011F0 . FF15 A0334600 call dword ptr ds:[<&USER32.MessageBoxA>>; \MessageBoxA
004011F6 . 5F pop edi
004011F7 . 83F8 03 cmp eax,0x3 ; 分支 (案例 2..7)
004011FA . 5E pop esi
004011FB . 75 0F jnz short E_langua.0040120C
004011FD . 8B4C24 68 mov ecx,dword ptr ss:[esp+0x68] ; 案例 3 --> 分支 004011F7
00401201 . B8 02000000 mov eax,0x2
00401206 . 8901 mov dword ptr ds:[ecx],eax
00401208 . 83C4 64 add esp,0x64
0040120B . C3 retn
0040120C > 83F8 02 cmp eax,0x2
0040120F . 75 0F jnz short E_langua.00401220
00401211 . 8B5424 68 mov edx,dword ptr ss:[esp+0x68] ; 案例 2 --> 分支 004011F7
00401215 . B8 01000000 mov eax,0x1
0040121A . 8902 mov dword ptr ds:[edx],eax
0040121C . 83C4 64 add esp,0x64
0040121F . C3 retn
00401220 > 83F8 05 cmp eax,0x5
00401223 . 75 0F jnz short E_langua.00401234
00401225 . 8B4C24 68 mov ecx,dword ptr ss:[esp+0x68] ; 案例 5 --> 分支 004011F7
00401229 . B8 04000000 mov eax,0x4
0040122E . 8901 mov dword ptr ds:[ecx],eax
00401230 . 83C4 64 add esp,0x64
00401233 . C3 retn
00401234 > 83F8 07 cmp eax,0x7
00401237 . 75 0F jnz short E_langua.00401248
00401239 . 8B5424 68 mov edx,dword ptr ss:[esp+0x68] ; 案例 7 --> 分支 004011F7
0040123D . B8 06000000 mov eax,0x6
00401242 . 8902 mov dword ptr ds:[edx],eax
00401244 . 83C4 64 add esp,0x64
00401247 . C3 retn
00401248 > 83F8 06 cmp eax,0x6
0040124B . 75 0F jnz short E_langua.0040125C
0040124D . 8B4C24 68 mov ecx,dword ptr ss:[esp+0x68] ; 案例 6 --> 分支 004011F7
00401251 . B8 05000000 mov eax,0x5
00401256 . 8901 mov dword ptr ds:[ecx],eax
00401258 . 83C4 64 add esp,0x64
0040125B . C3 retn
0040125C > 33D2 xor edx,edx ; 分支 004011F7 默认案例
0040125E . 8B4C24 68 mov ecx,dword ptr ss:[esp+0x68]
00401262 . 83F8 04 cmp eax,0x4
00401265 . 0F95C2 setne dl
00401268 . 4A dec edx
00401269 . 83E2 03 and edx,0x3
0040126C . 8BC2 mov eax,edx
0040126E . 8901 mov dword ptr ds:[ecx],eax
00401270 . 83C4 64 add esp,0x64
00401273 . C3 retn
占用字节 291 byte
|
|