Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how write large number of bytes?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
reverser69
Expert Cheater
Reputation: 0

Joined: 03 Sep 2014
Posts: 112

PostPosted: Thu Feb 04, 2021 5:42 pm    Post subject: how write large number of bytes? Reply with quote

hi all

i want to write 200 bytes in [rsi+rax+XXX] location.

any help?[/code]
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Thu Feb 04, 2021 6:54 pm    Post subject: This post has 1 review(s) Reply with quote

Example C++ code:
Code:
#include <cstring>

void foo(char *a, char *b) {
    std::memcpy(a, b, 200);
}

gcc unrolls it to this:
Code:
vmovdqu xmm0,[rsi]
vmovdqu [rdi],xmm0
vmovdqu xmm1,[rsi+16]
vmovdqu [rdi+16],xmm1
vmovdqu xmm2,[rsi+32]
vmovdqu [rdi+32],xmm2
vmovdqu xmm3,[rsi+48]
vmovdqu [rdi+48],xmm3
vmovdqu xmm4,[rsi+64]
vmovdqu [rdi+64],xmm4
vmovdqu xmm5,[rsi+80]
vmovdqu [rdi+80],xmm5
vmovdqu xmm6,[rsi+96]
vmovdqu [rdi+96],xmm6
vmovdqu xmm7,[rsi+112]
vmovdqu [rdi+112],xmm7
vmovdqu xmm0,[rsi+128]
vmovdqu [rdi+128],xmm0
vmovdqu xmm1,[rsi+144]
vmovdqu [rdi+144],xmm1
vmovdqu xmm2,[rsi+160]
vmovdqu [rdi+160],xmm2
vmovdqu xmm3,[rsi+176]
vmovdqu [rdi+176],xmm3
mov     rax,[rsi+192]
mov     [rdi+192],rax
ret
(sysv abi) (edit: offsets are in decimal here; note CE uses hexadecimal)
Use lea to make addressing modes easier.

If you don't want to unroll it, you could make a for loop.

_________________
I don't know where I'm going, but I'll figure it out when I get there.


Last edited by ParkourPenguin on Thu Feb 04, 2021 8:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25820
Location: The netherlands

PostPosted: Thu Feb 04, 2021 7:51 pm    Post subject: Reply with quote

Code:

push rsi
push rdi
push rcx

lea rdi,[rsi+rax+XXX]
lea rsi,sourcebytes
mov rcx,#25  //25*8=200
db f3 48 a5 //rep movsq (apparently CE doesn't know how to assemble this, fixed in next version)

pop rcx
pop rdi
pop rsi

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
reverser69
Expert Cheater
Reputation: 0

Joined: 03 Sep 2014
Posts: 112

PostPosted: Fri Feb 05, 2021 8:47 am    Post subject: Reply with quote

thanks. both of you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites