Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Do 19.03.09 21:45 
Ich hab mich in letzter Zeit ein wenig mit reversing beschäftigt.
Ziemlich interessant soweit

Hab jetzt aber folgenden Code:
ausblenden Quelltext
1:
2:
3:
4:
5:
MOV EAX,[ECX]
CDQ
AND EDX,7
ADD EAX,EDX
SAR EAX,3

was wäre die Delphi-entsprechung dafür?
das hier:
ausblenden Delphi-Quelltext
1:
2:
3:
a:=xyz;
if(a<0then a:=a+7;
a:=a div 8

oder ist etwas anderes sinnvoller?

wozu könnte das cdq gut sein?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 20.03.09 12:50 
CDQ = Convert DoubleWord to QuadWord (Sign Extend)
Könnte man in Delphi mit ner Zuweisung von Integer zu nem Int64 übersetzen.

CDQ ist analog zu MOVSX (Move with Sign Extend) außer, dass bei CDQ das Zielregister mit EDX:EAX fest vorgegeben ist.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Fr 20.03.09 16:16 
ok
wenn ich die beschreibung richtig verstanden habe heißt es am ende einfach nur:
wenn x>=0-->EDX=0; EAX=x
wenn x<0-->EDX=-1, EAX=x

stimmt nun also meine (Pseudo-)Delphi-Entprechung?
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: So 05.04.09 18:53 
nein war es nicht...hab mal mit delphi und dem cpu-fenster rumprobiert: es ist ein simples (x div 8) die überprüfungen sind nur damit es abgerundet wird (richtung 0)