gcc inline
ok. so i know a little c. and i know a little asm. where do i go from here? basic gcc inline assembly.
int main(int argc, char **argv)
{
int ctr;
ctr = 1;
do {
printf("%d\n", ctr);
/*
* try changing ctr++ to inline asm
* something like an incrementor
*/
__asm__("inc %%ecx" /* ctr ++ */
:"=c" (ctr) /* ctr => ecx */
:"c" (ctr) /* ecx <= ctr */
);
} while (ctr < 11);
/* this time, i'll try exchanging values */
int first = 1;
int second = 2;
__asm__(""
: "=b" (first), "=a" (second)
: "a" (first), "b" (second)
);
printf("inverted : %d %d\n", first, second);
return 0;
}
fantastic. learning c and assembly is fun. i promise to experiment with _real life_ activities next time. you know, like dating and flirting. stuff like that.

Hey Belated Merry Christmas to you and your Family… and Happy new year.. =)take care and Godspeed
Comment by Angel — December 31, 2005 @ 1:23 pm