Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Algorithmen, Datenstrukturen und Klassendesign (https://www.delphipraxis.net/78-algorithmen-datenstrukturen-und-klassendesign/)
-   -   Delphi Simple asm from x86 to x64 (https://www.delphipraxis.net/192357-simple-asm-x86-x64.html)

WojTec 11. Apr 2017 17:56

Simple asm from x86 to x64
 
Could you make for me compatible with both 32/64 bits this asm code (now is x86 only), because I'm not familiar with Assembler:?:

Delphi-Quellcode:
procedure ByteToHex(const AValue: Byte; Buffer: PAnsiChar);
asm
  JMP @@Convert
  @@HexTable:
    DB '0123456789ABCDEF';
  @@Convert:
    PUSH ECX // Invalid combination of opcode and operands
    XOR ECX, ECX
    MOV CL, AL
    SHR CL, 4
    MOV CL, @@HexTable.Byte[ECX] // Assembler instruction requires a 32bit absolute address fixup which is invalid for 64bit
    MOV BYTE PTR [EDX], CL
    MOV CL, AL
    AND CL, 0Fh
    MOV CL, @@HexTable.Byte[ECX] // Above error also here
    MOV BYTE PTR [EDX+1], CL
    POP ECX
end;

Fritzew 11. Apr 2017 18:10

AW: Simple asm from x86 to x64
 
warum Assembler?
hast Du nicht genug mit Delphi und C++ zu tun ;-)


sysutils : IntToHex

jbg 11. Apr 2017 18:25

AW: Simple asm from x86 to x64
 
You could try this code. It is even slightly faster than your assembler code if you activate the compiler's code optimization.

Delphi-Quellcode:
procedure ByteToHex(const AValue: Byte; Buffer: PAnsiChar);
const
  HexChars: array[0..15] of AnsiChar = '0123456789ABCDEF';
begin
  Buffer[0] := HexChars[AValue shr 4];
  Buffer[1] := HexChars[AValue and $F];
end;

WojTec 11. Apr 2017 19:25

Re: Simple asm from x86 to x64
 
This is very old procedure I found in past, it was faster than build-in routines, but if now Delphi can do it better the choice is simple, thanks buddies :)

Fritzew 11. Apr 2017 19:28

AW: Simple asm from x86 to x64
 
Du weist aber das du in einem deutschen Forum bist, oder?

sh17 11. Apr 2017 20:33

AW: Simple asm from x86 to x64
 
Zitat:

Zitat von Fritzew (Beitrag 1367228)
Du weist aber das du in einem deutschen Forum bist, oder?

In einem der besten Delphi-Foren überhaupt, denke ich. Da darf auch mal englisch geschrieben werden.

mkinzler 11. Apr 2017 21:17

AW: Simple asm from x86 to x64
 
Zitat:

Zitat von sh17 (Beitrag 1367230)
Zitat:

Zitat von Fritzew (Beitrag 1367228)
Du weist aber das du in einem deutschen Forum bist, oder?

In einem der besten Delphi-Foren überhaupt, denke ich. Da darf auch mal englisch geschrieben werden.

Definitiv.

Fritzew 11. Apr 2017 21:39

AW: Simple asm from x86 to x64
 
Arf j'en français écris ainsi, alors ici aussi ?

haentschman 12. Apr 2017 06:20

AW: Simple asm from x86 to x64
 
Hallöle...:P
Zitat:

Du weist aber das du in einem deutschen Forum bist, oder?
...WojTec kommt aus Polen. :wink: Warum nicht? Englisch verstehen hier alle. (mehr oder weniger :-D)

Zitat aus dem ersten Beitrag von 2009:
Zitat:

PS: I don't understand GER, only EN or PL.
Zitat:

Arf j'en français écris ainsi, alors ici aussi ?
...warum nicht? (Google Übersetzer befragt) Wenn du damit leben kannst das keiner antwortet weil er es nicht versteht. :roll:

Jasocul 12. Apr 2017 06:34

AW: Simple asm from x86 to x64
 
Zitat:

Zitat von haentschman (Beitrag 1367251)
Zitat:

Arf j'en français écris ainsi, alors ici aussi ?
...warum nicht? (Google Übersetzer befragt) Wenn du damit leben kannst das keiner antwortet weil er es nicht versteht. :roll:

Ich kann es verstehen. Nur die Antworten würden wohl nicht auf französisch sein. Dafür ist es bei mir zu sehr eingerostet. 8-)


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:56 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz