Recent

Author Topic: lazarus do not know ax  (Read 1948 times)

turunk

  • New Member
  • *
  • Posts: 29
lazarus do not know ax
« on: May 26, 2025, 01:53:00 pm »
i have lazarus 3.8 and can assembler, but lazarus do not recognize ax or eax or rax or bx
Code: Pascal  [Select][+][-]
  1. begin
  2.   asm
  3.     mov ax,bx;
  4.     mov eax,ebx;
  5.     mov rax,rbx;
  6.   end;
  7. end.
  8.  

Khrys

  • Sr. Member
  • ****
  • Posts: 399
Re: lazarus do not know ax
« Reply #1 on: May 26, 2025, 02:06:42 pm »
Did you set  {$asmmode intel}? FPC defaults to AT&T syntax (e.g.  movw %bx, %ax)

turunk

  • New Member
  • *
  • Posts: 29
Re: lazarus do not know ax
« Reply #2 on: May 27, 2025, 02:02:46 pm »
thank you very much
but now he do not know LES from LES BX,VarMof5;
and error "Error: Asm: 16 or 32 Bit references not supported" at
mov al,[si];
« Last Edit: May 27, 2025, 09:50:56 pm by turunk »

PascalDragon

  • Hero Member
  • *****
  • Posts: 6344
  • Compiler Developer
Re: lazarus do not know ax
« Reply #3 on: May 27, 2025, 09:56:37 pm »
mov al,[si];

For memory references you need to use the correct size matching your architecture, so mov al, [esi] for 32-bit and mov al, [rsi] for 64-bit. mov al, [si] would only work for 16-bit.

turunk

  • New Member
  • *
  • Posts: 29
Re: lazarus do not know ax
« Reply #4 on: May 28, 2025, 08:25:20 pm »
i already have tried it with "byte ptr [si]" and "word ptr [si]" .
and has the compiler a problem with LES?

Khrys

  • Sr. Member
  • ****
  • Posts: 399
Re: lazarus do not know ax
« Reply #5 on: May 29, 2025, 07:24:09 am »
but now he do not know LES from LES BX,VarMof5;

What platform are you compiling for? If you're on AMD64 (I assume you are), then the default settings (implied  -Px86_64) will prevent that opcode from being used because the hardware in fact doesn't support it  (#UD  raises a hardware exception):

Code: Text  [Select][+][-]
  1. 64-BIT_MODE
  2.     IF SS is loaded
  3.         [...]
  4.     ELSE IF attempt to load DS, or ES
  5.         THEN #UD;
  6.     ELSE IF FS, or GS is loaded with non-NULL segment selector
  7.         [...]
  8.  

If you're writing 16-bit code you should pass  -Pi8086  to the compiler. This will also fix you issue with  mov al, [si].

turunk

  • New Member
  • *
  • Posts: 29
Re: lazarus do not know ax
« Reply #6 on: May 29, 2025, 07:35:21 pm »
is AMD64 not reproducing Intel386?
i typed it here in Lazarus at it is then normal pentium 64 bit

Thaddy

  • Hero Member
  • *****
  • Posts: 18764
  • To Europe: simply sell USA bonds: dollar collapses
Re: lazarus do not know ax
« Reply #7 on: May 30, 2025, 12:44:23 pm »
It is LEA, not LES.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

 

TinyPortal © 2005-2018