help in an assempler procedure lazarus / 8-Other ---------------------------------------------------------------------- cpalx · 2009-07-31 02:48 Hello, i am triying to convert a delphi project in a lazarus project, i have a question here, I have a assembler procedure procedure XChg(var Critical, Normal); assembler; asm   mov  ecx, [edx]   xchg [eax], ecx   mov  [edx], ecx end; how can i do make it work in Lazarus i have the error Synchronizer.pas(22,1) Fatal: Selected assembler reader not supported i dont know assembler (never of my life), that is not my code maybe i can change it by other in pascal code, but i dont understant what it is doing. I would like your help, 1. How can i make work in Lazarus (mainly in windows,  if it could be work in Linux will be great). or 2. How can i change it for a pascal code?. I have no idea what does it do i use Lazarus 0.97 in windows (also in Linux) ---------------------------------------------------------------------- theo · 2009-07-31 08:08 {$asmmode Intel} procedure XChg(var Critical, Normal); assembler; asm   mov  ecx, [edx]   xchg [eax], ecx   mov  [edx], ecx end; It will only work for 32bit intel though. ---------------------------------------------------------------------- arnoldb · 2009-07-31 09:04 And just for info: all this function does is to exchange two values - very quickly. Non-Assembler code with same functionality would be: Code: [Select]procedure XChg(var Critical,Normal:Word); var tempword:word; begin   tempword:=Normal;   Normal:=Critical;   Critical:=tempword; end; Regards, Arnold ---------------------------------------------------------------------- theo · 2009-07-31 09:31 Would'n that be longword or longint instead of word? ---------------------------------------------------------------------- arnoldb · 2009-07-31 09:56 Quote from: theo on July 31, 2009, 11:31:07 amWould'n that be longword or longint instead of word? Theo, you're right; it must be longword/longint, but I _think_ for 32 bit Intel word/integer is the same size as longword/longint.  Other architectures may be different.  It would be best to declare the parameters and temporary value the same type as the variables that the original calling statement uses. ---------------------------------------------------------------------- theo · 2009-07-31 10:04 Quote from: arnoldb on July 31, 2009, 11:56:12 am but I _think_ for 32 bit Intel word/integer is the same size as longword/longint.  Word is 16bit in Pascal afair. ;-) longword is cardinal (32bit) ---------------------------------------------------------------------- Marc · 2009-07-31 11:24 correct. word: 16bit integer,cardinal: 16bit in tp or fpcmode, 32bit in objfpc or deplhi mode longword: 32bit ---------------------------------------------------------------------- cpalx · 2009-07-31 13:53 works perfectly in windows, thanks. I did not try in Linux, i will do it in some days. ---------------------------------------------------------------------- theo · 2009-08-01 01:18 Quote from: cpalx on July 31, 2009, 03:53:34 pmworks perfectly in windows, thanks. I did not try in Linux, i will do it in some days. it will work in 32bit Linux / Windows (intel). But not in 64bit or other CPU's.