C
und ich rätseler rum
hm, ich hab nur VS C++ 6 als testumgebung, die ist irgendwie komisch, akzeptiert jedoch diesen Code:
int main()
{
unsigned int a;
unsigned int l=0;
char buf[12];
a=12;
a /= 10;
__asm {
lea ebx,buf
add ebx,l
mov [ebx],edx
inc l
}
printf(" %d",buf[0]);
return 0;
}
man beachte aber dass wenn man der Funktion die Parameter wie buf usw erst übergibt, dass diese über den Stack wandern und man deshalb sowas schreiben muss:
#include <iostream>
#include <string>
void umwandeln(unsigned int a,unsigned int l,char *buf)
{
a /= 10;
__asm {
mov ebx,buf
add ebx,l
mov [ebx],edx
}
}
int main()
{
unsigned int l=0;
char buf[12];
umwandeln(20,l++,buf);
umwandeln(33,l++,buf);
printf(" %d %d",buf[0], buf[1]);
return 0;
}
Edit: formatierung korrigiert