If you want to read value in al
into an int
:
GCC:
unsigned char out;
asm volatile("movb %%al, %[Var]" : [Var] "=r" (out));
Or
unsigned char out;
asm volatile("movb %%al, %0" : "=r" (out));
For MSVC:
unsigned char c;
__asm movb c, al
There's no official C++ way, it stems it from C.
EDIT
You might also want:
register unsigned char out asm("%al");
But that's GCC.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…