インラインアセンブリをやってみようとしたのですが、いきなりつまずきました。
aとbの値を足してoutに代入しようとしています。
#include <stdio.h>
void test(int*,int,int);
int main(void) {
int a;
test(&a,10,24);
printf("%d\n",a);
return 0;
}
void test(int* out,int a,int b) {
asm("movl 12(%ebp),%eax\n\t"
"movl 16(%ebp),%ebx\n\t"
"add %ebx,%eax\n\t"
"movl %eax,8(%ebp)");
}
これだと0としか表示されないのですが、どうすればいいかわかりますでしょうか?お願いします。
全くわかっていないのででたらめを書いていたらすみません。
参考にしたサイトはこれです。
http://sci10.org/on_gcc_asm.html
http://maccyo.hp.infoseek.co.jp/assembl ... embly.html