Einzelnen Beitrag anzeigen

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