tbs0124.pp 797 B

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