- UID
- 66114
注册时间2010-4-1
阅读权限30
最后登录1970-1-1
龙战于野
TA的每日心情 | 慵懒 2019-3-12 17:25 |
---|
签到天数: 3 天 [LV.2]偶尔看看I
|
发表于 2010-6-6 18:23:27
|
显示全部楼层
#include"stdio.h"
main(){
int a[3][3]={1,2,3,4,5,6,7,8,9};
int *pa[3]={a[0],a[1],a[2]};
int *p=a[0];
int i;
for(i=0;i<3;i++)
printf("%d,%d,%d\n",a[i][2-i],*a[i],*(*(a+i)+i));
for(i=0;i<3;i++)
printf("%d,%d,%d\n",*pa[i],p[i],*(p+i));
}
0040F9F0 >/> \55 PUSH EBP
0040F9F1 |. 8BEC MOV EBP,ESP
0040F9F3 |. 83EC 78 SUB ESP,78
0040F9F6 |. 53 PUSH EBX
0040F9F7 |. 56 PUSH ESI
0040F9F8 |. 57 PUSH EDI
0040F9F9 |. 8D7D 88 LEA EDI,DWORD PTR SS:[EBP-78]
0040F9FC |. B9 1E000000 MOV ECX,1E
0040FA01 |. B8 CCCCCCCC MOV EAX,CCCCCCCC
0040FA06 |. F3:AB REP STOS DWORD PTR ES:[EDI]
0040FA08 |. C745 DC 01000>MOV DWORD PTR SS:[EBP-24],1
0040FA0F |. C745 E0 02000>MOV DWORD PTR SS:[EBP-20],2
0040FA16 |. C745 E4 03000>MOV DWORD PTR SS:[EBP-1C],3
0040FA1D |. C745 E8 04000>MOV DWORD PTR SS:[EBP-18],4
0040FA24 |. C745 EC 05000>MOV DWORD PTR SS:[EBP-14],5
0040FA2B |. C745 F0 06000>MOV DWORD PTR SS:[EBP-10],6
0040FA32 |. C745 F4 07000>MOV DWORD PTR SS:[EBP-C],7
0040FA39 |. C745 F8 08000>MOV DWORD PTR SS:[EBP-8],8
0040FA40 |. C745 FC 09000>MOV DWORD PTR SS:[EBP-4],9 //**数组初始化
0040FA47 |. 8D45 DC LEA EAX,DWORD PTR SS:[EBP-24]
0040FA4A |. 8945 D0 MOV DWORD PTR SS:[EBP-30],EAX
0040FA4D |. 8D4D E8 LEA ECX,DWORD PTR SS:[EBP-18]
0040FA50 |. 894D D4 MOV DWORD PTR SS:[EBP-2C],ECX
0040FA53 |. 8D55 F4 LEA EDX,DWORD PTR SS:[EBP-C] //指针数组初始化,lea拿到地址就放入指针数组堆栈中,都是每个子数组的首地址
0040FA56 |. 8955 D8 MOV DWORD PTR SS:[EBP-28],EDX
0040FA59 |. 8D45 DC LEA EAX,DWORD PTR SS:[EBP-24]
0040FA5C |. 8945 CC MOV DWORD PTR SS:[EBP-34],EAX //将**数组的首地址放入p指针变量里
0040FA5F |. C745 C8 00000>MOV DWORD PTR SS:[EBP-38],0 //此堆栈充当的是计数器
0040FA66 |. EB 09 JMP SHORT NO318.0040FA71 //无条件跳转
0040FA68 |> 8B4D C8 /MOV ECX,DWORD PTR SS:[EBP-38]
0040FA6B |. 83C1 01 |ADD ECX,1
0040FA6E |. 894D C8 |MOV DWORD PTR SS:[EBP-38],ECX
0040FA71 |> 837D C8 03 CMP DWORD PTR SS:[EBP-38],3 //进入比较
0040FA75 |. 7D 41 |JGE SHORT NO318.0040FAB8 //当不小于3的时候跳转
0040FA77 |. 8B55 C8 |MOV EDX,DWORD PTR SS:[EBP-38] //拿到计数器 也就相当于i的值
0040FA7A |. 6BD2 0C |IMUL EDX,EDX,0C //进行乘法指令
0040FA7D |. 8D4415 DC |LEA EAX,DWORD PTR SS:[EBP+EDX-24] //拿到子数组的首地址
0040FA81 |. 8B4D C8 |MOV ECX,DWORD PTR SS:[EBP-38] //看看是子数组的第几个元素
0040FA84 |. 8B1488 |MOV EDX,DWORD PTR DS:[EAX+ECX*4] //根据首地址(EAX)+偏移地址(ECX*4)=元素地址,在根据相对基址加变址,拿数据
0040FA87 |. 52 |PUSH EDX ; /<%d>
0040FA88 |. 8B45 C8 |MOV EAX,DWORD PTR SS:[EBP-38] ; |
0040FA8B |. 6BC0 0C |IMUL EAX,EAX,0C ; |
0040FA8E |. 8B4C05 DC |MOV ECX,DWORD PTR SS:[EBP+EAX-24] ; |
0040FA92 |. 51 |PUSH ECX ; |<%d>
0040FA93 |. 8B55 C8 |MOV EDX,DWORD PTR SS:[EBP-38] ; |
0040FA96 |. 6BD2 0C |IMUL EDX,EDX,0C ; |
0040FA99 |. 8D4415 DC |LEA EAX,DWORD PTR SS:[EBP+EDX-24] ; |
0040FA9D |. B9 02000000 |MOV ECX,2 ; |
0040FAA2 |. 2B4D C8 |SUB ECX,DWORD PTR SS:[EBP-38] ; |
0040FAA5 |. 8B1488 |MOV EDX,DWORD PTR DS:[EAX+ECX*4] ; |
0040FAA8 |. 52 |PUSH EDX ; |<%d>
0040FAA9 |. 68 1C504200 |PUSH OFFSET NO318.??_C@_09CDGI@?$CFd?0?>; |format = "%d,%d,%d
"
0040FAAE |. E8 5D16FFFF |CALL NO318.printf ; \printf
0040FAB3 |. 83C4 10 |ADD ESP,10
0040FAB6 |.^ EB B0 \JMP SHORT NO318.0040FA68
0040FAB8 |> C745 C8 00000>MOV DWORD PTR SS:[EBP-38],0
0040FABF |. EB 09 JMP SHORT NO318.0040FACA
0040FAC1 |> 8B45 C8 /MOV EAX,DWORD PTR SS:[EBP-38]
0040FAC4 |. 83C0 01 |ADD EAX,1
0040FAC7 |. 8945 C8 |MOV DWORD PTR SS:[EBP-38],EAX
0040FACA |> 837D C8 03 CMP DWORD PTR SS:[EBP-38],3
0040FACE |. 7D 2D |JGE SHORT NO318.0040FAFD
0040FAD0 |. 8B4D C8 |MOV ECX,DWORD PTR SS:[EBP-38]
0040FAD3 |. 8B55 CC |MOV EDX,DWORD PTR SS:[EBP-34]
0040FAD6 |. 8B048A |MOV EAX,DWORD PTR DS:[EDX+ECX*4]
0040FAD9 |. 50 |PUSH EAX ; /<%d>
0040FADA |. 8B4D C8 |MOV ECX,DWORD PTR SS:[EBP-38] ; |
0040FADD |. 8B55 CC |MOV EDX,DWORD PTR SS:[EBP-34] ; |
0040FAE0 |. 8B048A |MOV EAX,DWORD PTR DS:[EDX+ECX*4] ; |
0040FAE3 |. 50 |PUSH EAX ; |<%d>
0040FAE4 |. 8B4D C8 |MOV ECX,DWORD PTR SS:[EBP-38] ; |
0040FAE7 |. 8B548D D0 |MOV EDX,DWORD PTR SS:[EBP+ECX*4-30] ; |
0040FAEB |. 8B02 |MOV EAX,DWORD PTR DS:[EDX] ; |
0040FAED |. 50 |PUSH EAX ; |<%d>
0040FAEE |. 68 1C504200 |PUSH OFFSET NO318.??_C@_09CDGI@?$CFd?0?>; |format = "%d,%d,%d
"
0040FAF3 |. E8 1816FFFF |CALL NO318.printf ; \printf
0040FAF8 |. 83C4 10 |ADD ESP,10
0040FAFB |.^ EB C4 \JMP SHORT NO318.0040FAC1
0040FAFD |> 5F POP EDI
0040FAFE |. 5E POP ESI
0040FAFF |. 5B POP EBX
0040FB00 |. 83C4 78 ADD ESP,78
0040FB03 |. 3BEC CMP EBP,ESP
0040FB05 |. E8 E616FFFF CALL NO318.__chkesp
0040FB0A |. 8BE5 MOV ESP,EBP
0040FB0C |. 5D POP EBP
0040FB0D \. C3 RETN
//我只做了一部分讲解,其实别的细细分析也会出来的!! |
|