Need help with basic ASM
Posted
by Malfist
on Stack Overflow
See other posts from Stack Overflow
or by Malfist
Published on 2010-04-26T23:53:23Z
Indexed on
2010/04/27
0:03 UTC
Read the original article
Hit count: 545
Hello, I'm trying to convert some c code to assmebly, and I need some help.
char encode(char plain){
__asm{
mov eax, plain
add eax, 2
ret
}
//C code
/*
char code;
code = plain+2;
return code;*/
}
First problem is that visual studio complains that the register size doesn't match, i.e. eax is too small/large for char. I was under the impression that they were both DWORDs. Also, if I leave the variable in eax, and ret in assembly, it'll actually return that variable, right?
© Stack Overflow or respective owner