Hello,


In this case

  procedure nx_fill(P: PLongword; Count: Longint; Value: Longword);
  assembler;
  asm
          pushl   %edi
          movl    P,%edi  // edi <- P
          movl    Value,%eax  // eax <- Value
          movl    Count,%ecx  // ecx <- Count
          rep
          stosl
          popl    %edi
  end;

works both as embedded and non-embedded assembler procedure because the
order of assignments is ok in both cases.

Yes, but this way a program becomes a mineland. You write this, a few weeks later, for some reason, you change the line order, and you waste time to find why, suddenly, your program crashes (and yet, assuming you
immediately activate the bug).

:( That's true.

I usually add a 'pascal' procedure modifier to most (if not all) assembler routines exactly because of that. This forces parameter passing on the stack.
This is a little slower, but if your hand-coded assembler proc is only faster if the parameters are passed through registers, it might be a good idea to use Pascal right away...


Regards,
  Thomas


_______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to