Recent

Author Topic: assembler  (Read 3449 times)

airpas

  • Full Member
  • ***
  • Posts: 179
assembler
« on: January 19, 2015, 11:55:51 am »
why you get (Error: Unknown identifier "X") with this code ?

Code: [Select]
{$asmmode intel}
type
    t_point = record
      x,y : integer;
    end;     

procedure test(SrcPoint: t_point);
asm
   mov ecx , [SrcPoint.x] //error
end;

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: assembler
« Reply #1 on: January 19, 2015, 12:07:31 pm »
Afaik you need to pass the type name too, so srcpoint.t_point.x. But I don't use Intel style that much.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: assembler
« Reply #2 on: January 19, 2015, 12:26:41 pm »
Afaik you need to pass the type name too, so srcpoint.t_point.x. But I don't use Intel style that much.
This also works:
Code: [Select]
mov ecx, [SrcPoint + offset t_point.x]

airpas

  • Full Member
  • ***
  • Posts: 179
Re: assembler
« Reply #3 on: January 19, 2015, 01:22:35 pm »
thanks

what about this
Code: [Select]
    t_int  = record
      _high,_low : smallint;
    end;
    t_point = record
      x,y : t_int;
    end;   

procedure test(SrcPoint: t_point);
asm
   mov ax , [SrcPoint.t_point.x.t_int._high] //Error: Error building record offset

end;
« Last Edit: January 19, 2015, 01:32:27 pm by airpas »

airpas

  • Full Member
  • ***
  • Posts: 179
Re: assembler
« Reply #4 on: January 19, 2015, 01:36:10 pm »
ok seems working
mov ax , [SrcPoint + offset t_point.x._high]

thanks Leledumbo

 

TinyPortal © 2005-2018