View previous topic :: View next topic |
Author |
Message |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Sun Dec 27, 2009 3:33 pm Post subject: Disassembler.pas |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Sun Dec 27, 2009 4:15 pm Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Mon Dec 28, 2009 7:14 am Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Mon Dec 28, 2009 7:59 am Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue Dec 29, 2009 12:04 pm Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Tue Dec 29, 2009 12:14 pm Post subject: |
|
|
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 |
|
 |
|