player1:
cmp [player1cmp],1
jne code
mov [player1cmp],0
push rcx
mov ecx,[player1coinsvalue] // My Value
mov [rbx+rdi+1C],ecx
pop rcx
jmp code
What i want is: I want my value to be a little Endian but it has to be converted into Big Endian because [rbx+rdi+1C] is Big Endian.
I can offcourse just manualy convert my value into Big Endian but i want it to be a little Endian, I already tried bswap ecx but it doesn't work, maybe i'm just doing something wrong... I hope someone can help me out
Last edited by Bloodybone on Thu Dec 28, 2017 12:49 am, edited 1 time in total.
Yes, it doensn't work... If i put any value in [player1coinsvalue] the outcome is 0 but if i don't do the bswap ecx and put a Big Endian value in there it works here is the whole code, maybe it helps:
[ENABLE]
aobscan(coins1,0F B7 74 3B 1C 0F CE C1 FE 10 89)
alloc(newmem,$100,coins1)
Yes, it doensn't work... If i put any value in [player1coinsvalue] the outcome is 0 but if i don't do the bswap ecx and put a Big Endian value in there it works here is the whole code, maybe it helps:
Okay, but the code is correct so if it doesn't work something else is going on. Are you sure the value stored is 4 bytes? i see further down you're only moving 2 bytes into esi before returning to the original code.
If you're just converting a 16bit value you can just do this:
mov cx, WORD PTR [player1coinsvalue]
xchg cl,ch
mov WORD PTR [rbx+rdi+1C],cx
Last edited by Acido on Thu Dec 28, 2017 12:54 am, edited 2 times in total.
Yes, it doensn't work... If i put any value in [player1coinsvalue] the outcome is 0 but if i don't do the bswap ecx and put a Big Endian value in there it works here is the whole code, maybe it helps:
Okay, but the code is correct so if it doesn't work something else is going on. Are you sure the value stored is 4 bytes? i see further down you're only moving 2 bytes into esi before returning to the original code.
Yes at the origianal code it's only moving a 2 byte value after that it is doing a bswap esi and after that sar esi,10
Yes, it doensn't work... If i put any value in [player1coinsvalue] the outcome is 0 but if i don't do the bswap ecx and put a Big Endian value in there it works here is the whole code, maybe it helps:
Okay, but the code is correct so if it doesn't work something else is going on. Are you sure the value stored is 4 bytes? i see further down you're only moving 2 bytes into esi before returning to the original code.
Yes at the origianal code it's only moving a 2 byte value after that it is doing a bswap esi and after that sar esi,10
Edited my reply after you responded to it it seems
Try this:
mov cx, WORD PTR [player1coinsvalue]
exchg cl,ch
mov WORD PTR [rbx+rdi+1C],cx
Okay, but the code is correct so if it doesn't work something else is going on. Are you sure the value stored is 4 bytes? i see further down you're only moving 2 bytes into esi before returning to the original code.
Yes at the origianal code it's only moving a 2 byte value after that it is doing a bswap esi and after that sar esi,10
Edited my reply after you responded to it it seems
Try this:
mov cx, WORD PTR [player1coinsvalue]
exchg cl,ch
mov WORD PTR [rbx+rdi+1C],cx
Thanks it works, exchg doesn't work but xchg works
Edit: One question why does xchg cl,ch work? It doesn't make any sense to me ...