tb0105.pp 911 B

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