64-bit and 32-bit code lazarus / 8-Other ---------------------------------------------------------------------- faber · 2008-12-23 20:49 Hi, I compile my app on Win 32 and on Linux x86_64. I've some procedures with asm and when I  compile asm for 32-bit (PUSH    EAX ... ) on x86_64 then I get error, Yes of course I must change registers (PUSH RAX ...) How to aviod this ? Is there any directive like {$ASMMODE intel} for defined x86_64 system ? ---------------------------------------------------------------------- Vincent Snijders · 2008-12-24 07:48 Quote from: faber on December 23, 2008, 09:49:18 pmHow to aviod this ? What do you want to avoid? Writing assembler for each CPU?  Use a higher level language like pascal and a compiler to translate the high level language to assembler for different CPUs. :-) But I think you mean something else. ---------------------------------------------------------------------- faber · 2008-12-26 20:01 Quote from: Vincent Snijders on December 24, 2008, 08:48:20 amBut I think you mean something else. My english is not verry good  sorry I just want to compile code with asm for x86 and x64 (on x86 or x64 machine). Now I must comment lines with x86 asm and uncomment lines with x64 when I use x64 machine. ---------------------------------------------------------------------- Vincent Snijders · 2008-12-26 20:08 AFAIK, you have to write two assembler routines, one for each CPU. You can use {$IFDEF CPUI386} and {$IFDEF CPUX86_64} in your code. In the else part you could add a pascal implementation for other targets (arm?, powerpc?). ---------------------------------------------------------------------- faber · 2008-12-26 20:22 Yes, this is what I looking for. Thanks