Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- char printf_format[] = "Index = %d Value = %d\n";
- int arrSize = 10;
- int a[10] = {0,1,2,3,6,3,6,7,8,9};
- int index = 0;
- _asm
- {
- mainEntry:
- mov eax, index
- mov ecx, 4
- mul ecx
- mov ecx,eax
- lea eax, a
- add eax, ecx
- push [eax] //Push a[i]
- lea eax, printf_format //lay dia chi "%d %d\n"
- push index //push index
- push eax // push xau "%d %d\n"
- call printf //call
- add esp, 12 // push 3 lan nen phai dich stack len 4*3 =12 byte
- inc index //Tang chi so index
- mov ecx,arrSize
- cmp index, ecx //so sanh index voi arrSize
- jb mainEntry
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement