Jonas Maebe wrote:
> 
> On 17 aug 2006, at 21:40, Konstantin Münning wrote:
> 
>> There are some other inconsistencies to previous versions of FPC and
>> Borland Pascal like assembler syntax and pointer addition
>> (inc(Pointer,LongInt) does not work anymore).
> 
> Please (as always) post a test program, because it works file for me
> with 2.0.4-rc3.

Here to demonstrate assembler problem:

PROGRAM Original;
{$ASMMODE Intel}
 PROCEDURE Test(p:Pointer;l:LongInt;w:Word;b:Byte);ASSEMBLER;
  ASM
   mov eax,[p]
   mov eax,[l]
   mov ax,[w]
   mov al,[b]
  END;
BEGIN
END.

This program is like the code I'm using which works with fpc 1.0.10 and
BP (BP is 16 bit only so without eax). FPC 2.0.x complains on the mov
ax,[w] with the error(s):

original.pas(7,13) Error: Asm: 16 Bit references not supported
original.pas(7,13) Error: Asm: Invalid effective address

Modifying like this fixes this:

PROGRAM Modified;
{$ASMMODE Intel}
 PROCEDURE Test(p:Pointer;l:LongInt;w:Word;b:Byte);ASSEMBLER;
  ASM
   mov eax,[p]
   mov eax,[l]
   mov ax,w
   mov al,[b]
  END;
BEGIN
END.

Interestingly this works without complaints:

PROGRAM Working;
{$ASMMODE Intel}
 PROCEDURE Test;ASSEMBLER;
  VAR
   p:Pointer;
   l:LongInt;
   w:Word;
   b:Byte;
  ASM
   mov eax,[p]
   mov eax,[l]
   mov ax,[w]
   mov al,[b]
  END;

 VAR
  p:Pointer;
  l:LongInt;
  w:Word;
  b:Byte;
BEGIN
 ASM
  mov eax,[p]
  mov eax,[l]
  mov ax,[w]
  mov al,[b]
 END;
END.

Konstantin

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to