Advertisement
Narzew

Assembler in C - Error

Nov 16th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. // gcc -o asmtest.bin asmtest.c
  2.  
  3. #include <stdio.h>
  4.  
  5. int dodaj(int x, int y){
  6.     __asm{
  7.         /* Intel
  8.         mov eax,[esp+4]
  9.         add eax,[esp+8]
  10.         retn
  11.         */
  12.         movl +4(%esp), %eax
  13.         add +8(%esp), %eax
  14.         ret
  15.     }
  16. }
  17.  
  18. int main(){
  19.     int x,y;
  20.     scanf("%d%d",&x,&y);
  21.     printf(dodaj(x,y));
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement