tbs0124.pp 806 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. { $OPT= -Aas }
  2. { this problem comes from the fact that
  3. L is a static variable, not a local one !!
  4. but the static variable symtable is the localst of the
  5. main procedure (PM)
  6. It must be checked if we are at main level or not !! }
  7. var
  8. l : longint;
  9. procedure error;
  10. begin
  11. Writeln('Error in tbs0124');
  12. Halt(1);
  13. end;
  14. begin
  15. {$asmmode direct}
  16. asm
  17. movl $5,l
  18. end;
  19. if l<>5 then error;
  20. {$asmmode att}
  21. asm
  22. movl l,%eax
  23. addl $2,%eax
  24. movl %eax,l
  25. end;
  26. if l<>7 then error;
  27. {$asmmode intel}
  28. { problem here is that l is replaced by BP-offset }
  29. { relative to stack, and the parser thinks all wrong }
  30. { because of this. }
  31. asm
  32. mov eax,l
  33. add eax,5
  34. mov l,eax
  35. end;
  36. if l<>12 then error;
  37. Writeln('tbs0124 OK');
  38. end.