AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Simple asm from x86 to x64

Ein Thema von WojTec · begonnen am 11. Apr 2017 · letzter Beitrag vom 12. Apr 2017
Antwort Antwort
Seite 1 von 2  1 2      
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Simple asm from x86 to x64

  Alt 11. Apr 2017, 17:56
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;
  Mit Zitat antworten Zitat
Fritzew

Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Simple asm from x86 to x64

  Alt 11. Apr 2017, 18:10
warum Assembler?
hast Du nicht genug mit Delphi und C++ zu tun


sysutils : IntToHex
Fritz Westermann
  Mit Zitat antworten Zitat
jbg

Registriert seit: 12. Jun 2002
3.481 Beiträge
 
Delphi 10.1 Berlin Professional
 
#3

AW: Simple asm from x86 to x64

  Alt 11. Apr 2017, 18:25
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;

Geändert von jbg (12. Apr 2017 um 11:04 Uhr)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#4

Re: Simple asm from x86 to x64

  Alt 11. Apr 2017, 19:25
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
  Mit Zitat antworten Zitat
Fritzew

Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
 
Delphi 11 Alexandria
 
#5

AW: Simple asm from x86 to x64

  Alt 11. Apr 2017, 19:28
Du weist aber das du in einem deutschen Forum bist, oder?
Fritz Westermann
  Mit Zitat antworten Zitat
Benutzerbild von sh17
sh17

Registriert seit: 26. Okt 2005
Ort: Radebeul
1.594 Beiträge
 
Delphi 11 Alexandria
 
#6

AW: Simple asm from x86 to x64

  Alt 11. Apr 2017, 20:33
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.
Sven Harazim
--
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Simple asm from x86 to x64

  Alt 11. Apr 2017, 21:17
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.
Markus Kinzler
  Mit Zitat antworten Zitat
Fritzew

Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
 
Delphi 11 Alexandria
 
#8

AW: Simple asm from x86 to x64

  Alt 11. Apr 2017, 21:39
Arf j'en français écris ainsi, alors ici aussi ?
Fritz Westermann
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.297 Beiträge
 
Delphi 12 Athens
 
#9

AW: Simple asm from x86 to x64

  Alt 12. Apr 2017, 06:20
Hallöle...
Zitat:
Du weist aber das du in einem deutschen Forum bist, oder?
...WojTec kommt aus Polen. Warum nicht? Englisch verstehen hier alle. (mehr oder weniger )

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.

Geändert von haentschman (12. Apr 2017 um 06:24 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Jasocul
Jasocul

Registriert seit: 22. Sep 2004
Ort: Delmenhorst
1.338 Beiträge
 
Delphi 11 Alexandria
 
#10

AW: Simple asm from x86 to x64

  Alt 12. Apr 2017, 06:34
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.
Ich kann es verstehen. Nur die Antworten würden wohl nicht auf französisch sein. Dafür ist es bei mir zu sehr eingerostet.
Peter
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:28 Uhr.
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