I'm learning inline assembly in c and I'm trying to load a byte into another variable so I can eventually get into working with strings.
My current code took a pretty simple approach with my comments showing my logic below:
char load = 't', ret;
asm volatile(
"mov $1, %%esi;" /* move arg 1 (load) into %esi */
"lodsb;" /* load one bite from %esi into %eax */
: "=a" (ret) /* ret in %eax */
: "S" (load) /* load in %esi */
);
However, my output gives me a seg fault. Any assistance would be appreciated, thanks!