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 


Disassembler.pas

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Sun Dec 27, 2009 3:33 pm    Post subject: Disassembler.pas Reply with quote

Im currently in progress making my own Disassembler in C++, and i of curse looked in CE's disassembler, when i noticed that CE has 2 modrm functions, and a modrm2.

Code:
    function MODRM(memory:TMemory; prefix: TPrefix; modrmbyte: integer; inst: integer; var last: dword): string; overload;
    function MODRM(memory:TMemory; prefix: TPrefix; modrmbyte: integer; inst: integer; var last: dword;opperandsize:integer): string; overload;

    function MODRM2(memory:TMemory; prefix: TPrefix; modrmbyte: integer; inst: integer; var last: dword): string;


and since the definitions of the first MODRM function and MODRM2 is exactly the same, and the first MODRM funtion actually only does this:

Code:
function tdisassembler.MODRM(memory:TMemory; prefix: TPrefix; modrmbyte: integer; inst: integer; var last: dword): string;
begin
  result:=modrm2(memory,prefix,modrmbyte,inst,last);
end;


Why is the MODRM then nessesary?, why not simply remove it, and then rename MODRM2 to MODRM?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Dec 27, 2009 4:15 pm    Post subject: Reply with quote

modrm calls modrm2.
The only difference is that the modrm with a specified opperandsize adds the text "dword ptr ", "word ptr ", "byte ptr ", etc... in front of the address specifier

_________________
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
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Dec 28, 2009 7:14 am    Post subject: Reply with quote

Dark Byte wrote:
modrm calls modrm2.
The only difference is that the modrm with a specified opperandsize adds the text "dword ptr ", "word ptr ", "byte ptr ", etc... in front of the address specifier


I know that, but what i dont understand is why this function is needed:
Code:
function tdisassembler.MODRM(memory:TMemory; prefix: TPrefix; modrmbyte: integer; inst: integer; var last: dword): string;
begin
  result:=modrm2(memory,prefix,modrmbyte,inst,last);
end;


Instead of just calling MODRM2 instantly?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Dec 28, 2009 7:59 am    Post subject: Reply with quote

that's so I don't have to change all the code that doesn't care about the opperandsize
_________________
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
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Tue Dec 29, 2009 12:04 pm    Post subject: Reply with quote

Dark Byte wrote:
that's so I don't have to change all the code that doesn't care about the opperandsize


Lazyness? O.o
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Dec 29, 2009 12:14 pm    Post subject: Reply with quote

pretty much yes
the original design didn't care about dword ptr[ qword ptr[ in front.

But for a few specific instructions this seems important to note, so it's added. so just an overloaded function that appends it when called explicitly

and really, there's no noticeable speed penalty

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source 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