movzx eax, BYTE PTR [move] //Do you want char as unsigned? Use 'movsx' otherwisemov ebx,offset _fPlaceFallthrough //eax = _fPlaceFallthroughcmp DWORD PTR [ebx+eax*4],3 //if _fPlaceFallthrough[move*4]!= 3).........
inline asm: move signed chars
give this a shot:
thx tachikoma
I tried this:
but as soon as the program starts, i get a stack overflow error.
should i do pop eax first?
pop move from the stack
movzx eax, BYTE PTR [move]
[] means get the value at address... so shouldn't it be
movzx eax, BYTE PTR [&move]
cmp BYTE PTR [ebx+eax*4],-3
I'm stunned this is possible. I thought ebx+eax*4 should be calculated with add and mult commands first.
to promit: never thought of inline (never used it too), I'll certainly get rid of those defines. Like you say, i'd better not mess around with assembler in my code, but i'd like to test the inline asm commands.
I tried this:
__asm { movzx eax, BYTE PTR [move] // eax = content of move mov ebx, offset _fPlaceFallthrough //eax = _fPlaceFallthrough cmp BYTE PTR [ebx+eax*4],-3 //if _fPlaceFallthrough[move*4]!= -3) jnz validMove // goto validMove mov message, INVALID_MOVE jmp endAsm validMove: dec BYTE PTR [ebx+eax*4] // decFallthrough(move*4); dec BYTE PTR [ebx+eax*4 +1] // decFallthrough(move*4 + 1); dec BYTE PTR [ebx+eax*4 +2] // decFallthrough(move*4 + 2); dec BYTE PTR [ebx+eax*4 +3] // decFallthrough(move*4 + 3); endAsm: }
but as soon as the program starts, i get a stack overflow error.
Quote:by Lessbread
Although the argument to the function is a char, it gets pushed as a dword in order to maintain stack alignment. Also note that on 32 bit systems, 32 bit registers are faster.
should i do pop eax first?
pop move from the stack
movzx eax, BYTE PTR [move]
[] means get the value at address... so shouldn't it be
movzx eax, BYTE PTR [&move]
cmp BYTE PTR [ebx+eax*4],-3
I'm stunned this is possible. I thought ebx+eax*4 should be calculated with add and mult commands first.
to promit: never thought of inline (never used it too), I'll certainly get rid of those defines. Like you say, i'd better not mess around with assembler in my code, but i'd like to test the inline asm commands.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement